/*
 * brand.css — IMEXUM default theme
 * --brand-schema-version: 1
 *
 * The single source of branding for the platform (Spec S1.1). Change this file
 * (or replace it) and run brand:compile to re-theme web, client portal, PDFs and
 * emails. Values are taken from IMEXUM's current CRM stylesheet
 * (assets/css/custom.css, --imexum-* tokens) and logos (Spec S1.12).
 *
 * Fidelity: every --imexum-* token and every colour, shadow, radius and font
 * in custom.css is carried over exactly (owner decision, 1 Dec 2026), including
 * the IMEXUM blue #0089be for primary/info buttons and links, as the current CRM
 * shows them. That blue gives 3.95:1 with white text and as link text on white,
 * below WCAG AA (4.5:1), so this file sets --brand-contrast-policy to "warn":
 * brand:compile reports those pairs as warnings instead of rejecting the theme.
 * Accessible alternative, if ever wanted: --color-primary #007caf, hover
 * #00749f, --color-text-link #00749f, hover #006a93, and policy "enforce".
 *
 * Not yet defined by the owner: dark theme, compact density, a square logo mark
 * [P-05]. Those blocks are omitted; the platform falls back to defaults.
 *
 * Allowed content: this comment, one :root block, optional [data-theme] and
 * [data-density] blocks, and @font-face rules (BR-BRAND-02).
 */

/* Commercial font; use in documents confirmed by the owner (R-23 closed, 1 Dec 2026). */
:root {
  --brand-schema-version: "1";

  /* ---------- Identity (quoted strings) ---------- */
  --brand-contrast-policy: "warn";                 /* "enforce" rejects any pair below WCAG AA */
  --brand-name: "IMEXUM";                 /* product name still open [P-01] */
  --brand-short-name: "IMEXUM";
  --brand-legal-name: "IMEXUM Inc.";
  --brand-tagline: "Trade in every direction";
  --brand-support-email: "";              /* owner to supply [P-01] */
  --brand-support-url: "";                /* owner to supply [P-01] */
  --brand-sender-name: "IMEXUM";
  --brand-footer-text: "IMEXUM Inc.";
  --brand-copyright-holder: "IMEXUM Inc.";

  /* ---------- Assets ---------- */
  --brand-logo-light: url("assets/imexum-logo.svg");
  --brand-logo-dark: url("assets/imexum-logo-light.svg");
  --brand-logo-mark: url("assets/favicon.png");    /* same mark as the current CRM */
  --brand-favicon: url("assets/favicon.png");
  --brand-login-bg: none;                          /* gradient recipe below is used instead */
  --brand-email-logo: url("assets/imexum-logo.png");
  --brand-pdf-logo: url("assets/imexum-logo-colour.png");

  /* ---------- Palette (primitive) ---------- */
  --palette-brand-50: #eef8fc;   /* --imexum-soft-blue */
  --palette-brand-100: #d6eef8;
  --palette-brand-200: #addcf0;
  --palette-brand-300: #7cc6e6;
  --palette-brand-400: #00a6d6;  /* --imexum-blue-2 */
  --palette-brand-500: #0089be;  /* --imexum-blue */
  --palette-brand-600: #007caf;  /* --imexum-blue-hover */
  --palette-brand-700: #00749f;
  --palette-brand-800: #17345f;  /* --imexum-navy */
  --palette-brand-900: #0c1f3a;  /* --imexum-navy-2 */

  --palette-gold: #c8a45c;       /* --imexum-gold */
  --palette-gold-light: #e0c47a; /* --imexum-gold-2 */
  --palette-gold-dark: #9a7732;  /* --imexum-gold-dark */

  --palette-neutral-0: #ffffff;
  --palette-neutral-50: #f5f8fb;   /* --imexum-soft */
  --palette-neutral-100: #f7fbfd;
  --palette-neutral-200: #dfe8f1;  /* --imexum-line */
  --palette-neutral-300: #c5d2df;
  --palette-neutral-400: #9aa8b6;
  --palette-neutral-500: #5e6b7a;  /* --imexum-muted */
  --palette-neutral-600: #4a5664;
  --palette-neutral-700: #2a3948;
  --palette-neutral-800: #1b2a3c;
  --palette-neutral-900: #102033;  /* --imexum-ink */
  --palette-neutral-950: #0a1626;

  --palette-success-50: #f2fbf5;
  --palette-success-100: #dcf2e3;
  --palette-success-500: #287a45;
  --palette-success-600: #22683b;
  --palette-success-700: #1d6036;

  --palette-warning-50: #fbf7ed;
  --palette-warning-100: #f5ecd3;
  --palette-warning-500: #c8a45c;
  --palette-warning-600: #9a7732;
  --palette-warning-700: #684b16;

  --palette-danger-50: #fff3f2;
  --palette-danger-100: #fde0dd;
  --palette-danger-500: #b42318;
  --palette-danger-600: #9c1e15;
  --palette-danger-700: #8e1c14;

  --palette-info-50: #eef8fc;
  --palette-info-100: #d6eef8;
  --palette-info-500: #0089be;
  --palette-info-600: #007caf;
  --palette-info-700: #00749f;

  /* ---------- Semantic: actions ---------- */
  --color-primary: #0089be;              /* --imexum-blue: .btn-primary, .btn-info */
  --color-primary-hover: #007caf;        /* --imexum-blue-hover */
  --color-primary-active: #007caf;
  --color-on-primary: #ffffff;
  --color-primary-subtle: #eef8fc;
  --color-on-primary-subtle: #17345f;

  --color-secondary: #17345f;            /* IMEXUM navy; also the positive-confirmation button */
  --color-secondary-hover: #0c1f3a;
  --color-secondary-active: #0c1f3a;
  --color-on-secondary: #ffffff;
  --color-secondary-subtle: #eef3f8;
  --color-on-secondary-subtle: #0c1f3a;

  --color-accent: #c8a45c;               /* IMEXUM gold; the exact blue #0089be is used via focus, markers and charts */
  --color-accent-hover: #e0c47a;
  --color-accent-active: #9a7732;
  --color-on-accent: #0c1f3a;
  --color-accent-subtle: #fbf7ed;
  --color-on-accent-subtle: #684b16;

  /* ---------- Semantic: surfaces ---------- */
  --color-bg-app: #f5f8fb;
  --color-bg-surface: #ffffff;
  --color-bg-surface-raised: #ffffff;
  --color-bg-subtle: #f5f8fb;
  --color-bg-overlay: rgba(255, 255, 255, 0.94);
  --color-scrim: rgba(12, 31, 58, 0.45);

  /* ---------- Semantic: text ---------- */
  --color-text: #102033;
  --color-text-muted: #5e6b7a;
  --color-text-subtle: #6b7785;
  --color-text-inverse: #ffffff;
  --color-text-link: #0089be;            /* body a, .text-primary, .text-info */
  --color-text-link-hover: #007caf;
  --color-heading: #0c1f3a;

  /* ---------- Semantic: lines and focus ---------- */
  --color-border: #dfe8f1;
  --color-border-strong: #c5d2df;
  --color-border-focus: #0089be;
  --color-focus-ring: rgba(0, 137, 190, 0.24);

  /* ---------- Semantic: status ---------- */
  --color-success: #287a45;
  --color-on-success: #ffffff;
  --color-success-subtle: #f2fbf5;
  --color-on-success-subtle: #1d6036;

  --color-warning: #c8a45c;
  --color-on-warning: #0c1f3a;
  --color-warning-subtle: #fbf7ed;
  --color-on-warning-subtle: #684b16;
  --color-warning-text: #684b16;

  --color-danger: #b42318;
  --color-on-danger: #ffffff;
  --color-danger-subtle: #fff3f2;
  --color-on-danger-subtle: #8e1c14;

  --color-info: #0089be;
  --color-on-info: #ffffff;
  --color-info-subtle: #eef8fc;
  --color-on-info-subtle: #17345f;

  /* ---------- Semantic: navigation ---------- */
  --color-nav-bg: #0c1f3a;
  --color-nav-text: rgba(255, 255, 255, 0.78);
  --color-nav-text-active: #ffffff;
  --color-nav-item-hover-bg: rgba(255, 255, 255, 0.1);
  --color-nav-item-active-bg: rgba(255, 255, 255, 0.1);
  --color-nav-active-marker: #00a6d6;
  --color-topbar-bg: rgba(255, 255, 255, 0.94);
  --color-topbar-text: #17345f;
  --color-topbar-item-hover-bg: #eef8fc;

  /* ---------- Semantic: data ---------- */
  --color-table-header-bg: #eef8fc;
  --color-table-header-text: #17345f;
  --color-table-row-hover: #eef8fc;
  --color-table-row-stripe: #f8fcfe;
  --color-skeleton: #dfe8f1;

  /* ---------- Charts (each at least 3:1 on white) ---------- */
  --chart-1: #0089be;
  --chart-2: #17345f;
  --chart-3: #9a7732;
  --chart-4: #287a45;
  --chart-5: #b42318;
  --chart-6: #5e6b7a;
  --chart-7: #7a5195;
  --chart-8: #0e7c86;
  --chart-grid: #dfe8f1;
  --chart-axis: #5e6b7a;

  /* ---------- Typography ---------- */
  --font-family-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-family-heading: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --font-family-document: "IMEXUM Montserrat", Montserrat, sans-serif;
  --font-family-document-arabic: "IMEXUM DIN Arabic", "IMEXUM Montserrat", sans-serif;

  --font-size-xs: 0.75rem;
  --font-size-sm: 0.8rem;
  --font-size-md: 0.9rem;
  --font-size-lg: 1.0625rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.625rem;
  --font-size-3xl: 2.25rem;

  --font-weight-regular: 400;
  --font-weight-medium: 650;     /* IMEXUM form labels */
  --font-weight-semibold: 700;   /* IMEXUM buttons and headings */
  --font-weight-bold: 750;       /* IMEXUM table headers */

  --line-height-tight: 1.2;
  --line-height-normal: 1.55;
  --line-height-relaxed: 1.7;
  --letter-spacing-tight: -0.018em;
  --letter-spacing-normal: 0;
  --letter-spacing-wide: 0.02em;

  /* ---------- Spacing, shape, depth, motion ---------- */
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  --control-height-sm: 32px;
  --control-height-md: 40px;     /* IMEXUM minimum input height */
  --control-height-lg: 48px;
  --row-height-compact: 36px;
  --row-height-comfortable: 48px;

  --radius-none: 0;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;             /* --imexum-radius-sm */
  --radius-xl: 22px;             /* --imexum-radius */
  --radius-full: 999px;          /* --imexum-pill */
  --border-width: 1px;

  --shadow-xs: 0 4px 18px rgba(16, 32, 51, 0.04);
  --shadow-sm: 0 8px 24px rgba(16, 32, 51, 0.05);
  --shadow-md: 0 10px 36px rgba(16, 32, 51, 0.07);   /* --imexum-shadow-sm */
  --shadow-lg: 0 22px 60px rgba(16, 32, 51, 0.11);   /* --imexum-shadow */
  --shadow-xl: 0 18px 45px rgba(16, 32, 51, 0.13);   /* dropdowns and popovers */
  --shadow-focus: 0 0 0 4px rgba(0, 137, 190, 0.1);

  --motion-duration-fast: 120ms;
  --motion-duration-base: 180ms;   /* --imexum-transition */
  --motion-duration-slow: 280ms;
  --motion-ease-standard: ease;
  --motion-ease-emphasized: cubic-bezier(0.2, 0, 0, 1);

  /* ---------- Layout ---------- */
  --layout-sidebar-width: 240px;
  --layout-sidebar-width-collapsed: 64px;
  --layout-topbar-height: 60px;
  --layout-content-max-width: 1440px;
  --layout-gutter: 24px;

  /* ---------- Surface recipes (IMEXUM signature backgrounds) ---------- */
  --app-background:
    radial-gradient(circle at top right, rgba(0, 137, 190, 0.17), transparent 34%),
    radial-gradient(circle at 12% 30%, rgba(200, 164, 92, 0.18), transparent 32%),
    linear-gradient(135deg, #f7fbfd 0%, #ffffff 50%, #eef8fc 100%);
  --nav-background: linear-gradient(165deg, #0c1f3a 0%, #17345f 100%);
  --topbar-background: rgba(255, 255, 255, 0.94);
  --topbar-blur: 18px;
  --modal-header-background: linear-gradient(135deg, #ffffff, #eef8fc);
  --login-card-background: rgba(255, 255, 255, 0.9);
  --login-card-blur: 16px;

  /* ---------- Components ---------- */
  --button-radius: 999px;
  --button-font-weight: 700;
  --button-padding-x: 18px;
  --button-height-sm: 32px;
  --button-height-md: 40px;
  --button-height-lg: 48px;
  --button-shadow-primary: 0 10px 24px rgba(0, 137, 190, 0.18);
  --button-hover-lift: -1px;

  --input-radius: 14px;
  --input-border: #dfe8f1;
  --input-bg: #ffffff;
  --input-bg-disabled: #f5f8fb;
  --input-placeholder: #6b7785;

  --card-radius: 14px;
  --card-shadow: 0 10px 36px rgba(16, 32, 51, 0.07);
  --card-padding: 22px;
  --card-border: #dfe8f1;

  --badge-radius: 999px;
  --badge-font-size: 0.75rem;
  --badge-padding-x: 10px;

  --table-radius: 14px;
  --table-cell-padding-y: 12px;
  --table-cell-padding-x: 16px;

  --modal-radius: 22px;
  --modal-shadow: 0 22px 60px rgba(16, 32, 51, 0.11);
  --modal-width-sm: 420px;
  --modal-width-md: 640px;
  --modal-width-lg: 960px;

  --toast-radius: 14px;
  --toast-shadow: 0 18px 45px rgba(16, 32, 51, 0.13);

  /* Component details carried over from custom.css (selector in comment) */
  --selection-text: #0c1f3a;                                  /* ::selection */
  --selection-background: rgba(0, 166, 214, 0.22);
  --topbar-border: rgba(223, 232, 241, 0.9);                  /* #header border-bottom */
  --topbar-shadow: 0 4px 18px rgba(16, 32, 51, 0.035);
  --logo-panel-background: rgba(255, 255, 255, 0.98);         /* .admin_logo */
  --nav-submenu-background: rgba(5, 17, 34, 0.2);             /* .nav-second/third/fourth-level */
  --nav-profile-border: rgba(23, 52, 95, 0.14);               /* .sidebar-user-profile > a.profile */
  --nav-profile-border-hover: rgba(0, 137, 190, 0.3);
  --nav-profile-background: rgba(245, 248, 251, 0.96);
  --nav-profile-shadow: 0 10px 26px rgba(5, 17, 34, 0.18);
  --dropdown-shadow: 0 18px 45px rgba(16, 32, 51, 0.13);      /* .dropdown-menu, .popover */
  --select-dropdown-shadow: 0 18px 45px rgba(16, 32, 51, 0.12); /* .select2-dropdown, .bootstrap-select */
  --kanban-card-hover-shadow: 0 16px 42px rgba(16, 32, 51, 0.1);
  --kanban-card-hover-lift: -2px;
  --tag-border: rgba(0, 137, 190, 0.25);                      /* ul.tagit li.tagit-choice */
  --dropzone-border: 1px dashed rgba(0, 137, 190, 0.45);      /* .dropzone */
  --input-error-ring: 0 0 0 4px rgba(180, 35, 24, 0.08);      /* .has-error controls */
  --alert-success-border: rgba(40, 122, 69, 0.25);
  --alert-warning-border: rgba(200, 164, 92, 0.35);
  --alert-danger-border: rgba(180, 35, 24, 0.24);
  --login-card-border: rgba(223, 232, 241, 0.96);             /* .authentication-form-wrapper */
  --login-card-surface: rgba(245, 248, 251, 0.94);
  --login-panel-border: rgba(223, 232, 241, 0.95);            /* .authentication-form .panel-body */
  --portal-footer-border: rgba(223, 232, 241, 0.9);           /* customers .footer */
  --portal-footer-background: rgba(255, 255, 255, 0.82);
  --line-height-body: 1.55;                                   /* html body */

  /* Certification seal on signed PDFs (Spec S6.4.10) */
  --seal-fill: #fff7e2;
  --seal-border: #b88f31;
  --seal-text: #2a3948;
  --seal-title: #102033;
  --seal-logo-opacity: 0.11;

  /* Email accent block (Spec S1.12 BR-BRAND-24) */
  --email-accent-bg: #fffaf0;
  --email-accent-border: #d8c28c;
  --email-button-bg: #102033;
  --email-button-text: #f3dfac;
}


/* ---- platform bridge (token consumers only) ---- */
/*
 * Platform bridge: applies brand tokens to the upstream Krayin admin markup.
 *
 * Rules here may only reference tokens (var(--...)); literal colours, fonts
 * and sizes are forbidden (BR-BRAND-06, BR-BRAND-14). This file is appended
 * to the compiled brand stylesheet and loaded last through the
 * admin.layout.head.after render event (Foundation Audit V-02).
 *
 * It covers brand colour, typography, surfaces, navigation, buttons, inputs
 * and cards. Krayin's stock palette is replaced by UpstreamPalette when the
 * brand is compiled.
 */

:root {
  /* Krayin's single theming variable now follows the brand. */
  --brand-color: var(--color-primary);
}

html body,
html body button,
html body input,
html body select,
html body textarea {
  font-family: var(--font-family-sans);
}

html body {
  color: var(--color-text);
  line-height: var(--line-height-normal);
}

html:not(.dark) body {
  background: var(--app-background) fixed;
}

html:not(.dark) body .bg-gray-100 {
  background-color: transparent;
}

::selection {
  background-color: var(--color-focus-ring);
}

html body h1,
html body h2,
html body h3 {
  color: var(--color-heading);
  letter-spacing: var(--letter-spacing-tight);
}

html body a.text-brandColor,
html body .text-brandColor {
  color: var(--color-text-link);
}

/* Top bar */
html:not(.dark) body .sticky.top-0.border-b {
  background: var(--topbar-background);
  border-color: var(--color-border);
  box-shadow: var(--shadow-xs);
  backdrop-filter: blur(var(--topbar-blur));
}

html body header.sticky #logo-image {
  height: var(--space-8);
  width: auto;
}

/* Sidebar (desktop) */
html:not(.dark) body .fixed.top-\[60px\].h-full {
  background: var(--nav-background);
  border-color: transparent;
}

html:not(.dark) body .fixed.top-\[60px\].h-full .group\/item > a > div,
html:not(.dark) body .fixed.top-\[60px\].h-full .group\/item p,
html:not(.dark) body .fixed.top-\[60px\].h-full .group\/item span {
  color: var(--color-nav-text);
}

html:not(.dark) body .fixed.top-\[60px\].h-full .group\/item a > div:hover {
  background: var(--color-nav-item-hover-bg);
}

/* The active item keeps the upstream solid brand pill. */
html:not(.dark) body .fixed.top-\[60px\].h-full .group\/item.active > a > div:hover {
  background: transparent;
}

html body .fixed.top-\[60px\].h-full .group\/item.active a > div *,
html body .fixed.top-\[60px\].h-full .group\/item.active .text-white {
  color: var(--color-nav-text-active);
}

/* Buttons */
html body .primary-button {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-on-primary);
  border-radius: var(--button-radius);
  font-weight: var(--button-font-weight);
  box-shadow: var(--button-shadow-primary);
  transition: transform var(--motion-duration-base) var(--motion-ease-standard),
    background-color var(--motion-duration-base) var(--motion-ease-standard);
}

html body .primary-button:hover,
html body .primary-button:focus {
  background-color: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  opacity: 1;
  transform: translateY(var(--button-hover-lift));
}

html body .secondary-button {
  border-color: var(--color-primary);
  color: var(--color-text-link);
  border-radius: var(--button-radius);
  font-weight: var(--button-font-weight);
}

html body .secondary-button:hover,
html body .secondary-button:focus {
  background-color: var(--color-primary-subtle);
}

html body .transparent-button {
  border-radius: var(--button-radius);
}

/* Inputs */
html:not(.dark) body input[type="text"],
html:not(.dark) body input[type="email"],
html:not(.dark) body input[type="password"],
html:not(.dark) body input[type="number"],
html:not(.dark) body input[type="search"],
html:not(.dark) body select,
html:not(.dark) body textarea {
  border-color: var(--input-border);
  border-radius: var(--input-radius);
  background-color: var(--input-bg);
}

html body input:focus,
html body select:focus,
html body textarea:focus {
  border-color: var(--color-border-focus);
  box-shadow: var(--shadow-focus);
  outline: none;
}

/* Cards and panels */
html:not(.dark) body .box-shadow.rounded,
html:not(.dark) body .rounded-lg.bg-white,
html:not(.dark) body .rounded.bg-white {
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
}

/* Sign-in, password, web form and error pages: logo size and footer */
html body .h-\[100vh\] img.w-max {
  height: var(--space-12);
  width: auto;
  max-width: 100%;
}

html:not(.dark) body .h-\[100vh\] .box-shadow.rounded-md {
  background: var(--login-card-background);
  border: 1px solid var(--login-card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

html body #platform-brand-footer {
  color: var(--color-text-muted);
}

/* Dark mode: the status and link colours are made for light surfaces. */
html.dark body .text-green-500:not([class*="bg-green"]),
html.dark body .text-green-600:not([class*="bg-green"]) {
  color: color-mix(in srgb, var(--palette-success-500) 45%, var(--palette-neutral-0)) !important;
}

html.dark body .text-red-500:not([class*="bg-red"]),
html.dark body .text-red-600:not([class*="bg-red"]) {
  color: color-mix(in srgb, var(--palette-danger-500) 45%, var(--palette-neutral-0)) !important;
}

html.dark body a.text-brandColor,
html.dark body .text-brandColor,
html.dark body .text-blue-600:not([class*="bg-blue"]) {
  color: var(--palette-brand-300);
}

/* Focus visibility */
html body :focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html body * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
