/* ==========================================================================
   Silver Star Inventory — Design Tokens
   ========================================================================== */

:root {
  /* Brand colors */
  --color-primary: #383710;
  --color-primary-light: #4a4918;
  --color-primary-dark: #232205;
  --color-primary-bg: #f0f0e8;
  /* Secondary is used selectively (highlights, active states, key actions,
     links) — the base hue is for accents/badges/outlines on light surfaces,
     not solid buttons: white text on --color-secondary measures ~2.6:1
     contrast, below WCAG AA (4.5:1) for normal text. --color-secondary-dark
     (~4.9:1) is what solid buttons/fills use instead; see .btn-secondary in
     components.css. */
  --color-secondary: #c69a6d;
  --color-secondary-light: #d1ae8a;
  --color-secondary-dark: #8b6c4c;
  --color-secondary-bg: #f9f5f0;
  --color-command-panel: #34360f;
  --color-command-panel-border: rgba(198, 154, 109, 0.36);

  /* Layered surfaces: app → page → section → card/elevated → input */
  --surface-app: #e9ece6;
  --surface-page: #f3f5f1;
  --surface-card: #ffffff;
  --surface-section: #f8f9f6;
  --surface-control: #f4f6f2;
  --surface-input: #eef1ec;
  --surface-elevated: #ffffff;
  --surface-modal: var(--surface-elevated);
  --surface-dialog: var(--surface-elevated);
  --surface-table-head: #e9ede7;
  --surface-overlay: rgba(23, 22, 10, 0.58);

  /* Legacy aliases keep every existing module on the same token source. */
  --color-bg: var(--surface-page);
  --color-card: var(--surface-card);
  --color-surface: var(--surface-section);
  --color-control-bg: var(--surface-input);
  --color-table-head: var(--surface-table-head);

  /* Navigation surfaces */
  --color-sidebar: #24230f;
  --color-sidebar-hover: #35331a;
  --color-sidebar-active: #423f1f;
  --color-sidebar-text: #cfceb8;
  --color-sidebar-text-muted: #8f8d72;

  /* Borders */
  --border-subtle: #dde1da;
  --border-default: #cfd5cb;
  --border-strong: #b7c0b3;
  --field-border: #aeb7aa;
  --field-border-hover: #8f9a8b;
  --color-border: var(--border-default);
  --color-border-strong: var(--border-strong);

  /* Text */
  --color-text: #252621;
  --color-text-muted: #6b6f66;
  --color-text-faint: #9d9c8a;
  --color-text-on-primary: #f8f8f6;

  /* Status */
  --color-success: #15803d;
  --color-success-bg: #e3f0e8;
  --color-warning: #d97706;
  --color-warning-bg: #faefe1;
  --color-danger: #dc2626;
  --color-danger-bg: #fbe5e5;
  --color-info: #2563eb;
  --color-info-bg: #e5ecfd;

  /* Module identity — accents are intentionally limited to navigation,
     icons, KPI indicators, section markers, and charts. */
  --accent-dashboard: #6b6a2b;
  --accent-inventory: #047857;
  --accent-purchasing: #c2410c;
  --accent-accounting: #2563eb;
  --accent-banking: #0f766e;
  --accent-people: #7e22ce;
  --accent-bookings: #be185d;
  --accent-reports: #383714; /* brand color (2026-08-23) -- was #4f46e5, an off-brand indigo */
  --accent-administration: #475569;
  --module-accent: var(--accent-dashboard);
  --module-accent-soft: color-mix(in srgb, var(--module-accent) 11%, transparent);

  /* Categorical chart series (donut/pie slices, multi-series bars). Fixed
     order, validated for CVD-safe adjacent-pair separation and contrast
     against --surface-card -- assign in this order, never cycle/reorder
     per-chart, and never repurpose a module-accent or status color as a
     series (both are reserved: identity and state, not magnitude/category). */
  --chart-cat-1: #2a78d6;
  --chart-cat-2: #eb6834;
  --chart-cat-3: #1baf7a;
  --chart-cat-4: #eda100;
  --chart-cat-5: #e87ba4;
  --chart-cat-6: #008300;
  --chart-cat-7: #4a3aa7;
  --chart-cat-8: #e34948;

  /* Typography — one enterprise scale */
  --font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 0.9375rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-xxl: 2rem;
  --lh-caption: 1.35;
  --lh-body: 1.5;
  --lh-heading: 1.2;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* Spacing: 4 / 8 / 12 / 16 / 24 / 32 / 48 / 64 */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 999px;

  /* Three-level enterprise elevation system */
  --shadow-level-1: 0 1px 2px rgba(25, 28, 20, 0.08), 0 4px 10px rgba(25, 28, 20, 0.04);
  --shadow-level-2: 0 8px 24px rgba(25, 28, 20, 0.11), 0 2px 6px rgba(25, 28, 20, 0.06);
  --shadow-level-3: 0 24px 64px rgba(25, 28, 20, 0.18), 0 8px 20px rgba(25, 28, 20, 0.1);
  --shadow-sm: var(--shadow-level-1);
  --shadow-md: var(--shadow-level-2);
  --shadow-lg: var(--shadow-level-3);
  --shadow-focus: 0 0 0 3px rgba(198, 154, 109, 0.4);

  --page-wash: var(--surface-page);

  /* Motion */
  --transition-fast: 0.15s ease;
  --transition: 0.2s ease;
  --transition-slow: 0.3s ease;

  /* Layout */
  --sidebar-width: 264px;
  --sidebar-width-collapsed: 76px;
  --topbar-height: 68px;
  --z-topbar: 100;
  --z-sidebar: 90;
  --z-dropdown: 200;
  --z-modal-backdrop: 300;
  --z-modal: 310;
  --z-modal-popover: 320;
  --z-toast: 400;
  --z-tooltip: 500;
}

/* ---- Dark theme overrides ---- */
:root[data-theme="dark"] {
  --surface-app: #101107;
  --surface-page: #17180d;
  --surface-card: #202113;
  --surface-section: #262719;
  --surface-control: #28291a;
  --surface-input: #2c2d1d;
  --surface-elevated: #2a2b1b;
  --surface-table-head: #303121;
  --surface-overlay: rgba(5, 5, 2, 0.72);

  --color-bg: var(--surface-page);
  --color-card: var(--surface-card);
  --color-control-bg: var(--surface-input);
  --color-table-head: var(--surface-table-head);
  --color-sidebar: #17160a;
  --color-sidebar-hover: #26240f;
  --color-sidebar-active: #322f17;
  --border-subtle: #303220;
  --border-default: #3d4029;
  --border-strong: #575b3a;
  --field-border: #64694a;
  --field-border-hover: #858b63;
  --color-border: var(--border-default);
  --color-border-strong: var(--border-strong);
  --color-command-panel: #27280d;
  --color-command-panel-border: rgba(198, 154, 109, 0.24);

  --color-text: #f1f0e6;
  --color-text-muted: #b8b6a0;
  --color-text-faint: #837f65;
  --color-text-on-primary: #f8f8f6;

  --color-primary-bg: rgba(241, 240, 230, 0.12);
  --color-success-bg: rgba(21, 128, 61, 0.18);
  --color-warning-bg: rgba(217, 119, 6, 0.18);
  --color-danger-bg: rgba(220, 38, 38, 0.18);
  --color-info-bg: rgba(37, 99, 235, 0.18);
  --color-secondary-bg: rgba(198, 154, 109, 0.16);

  /* Same eight hues, stepped for the dark surface -- not a separate palette. */
  --chart-cat-1: #3987e5;
  --chart-cat-2: #d95926;
  --chart-cat-3: #199e70;
  --chart-cat-4: #c98500;
  --chart-cat-5: #d55181;
  --chart-cat-6: #008300;
  --chart-cat-7: #9085e9;
  --chart-cat-8: #e66767;

  --shadow-level-1: 0 1px 2px rgba(0, 0, 0, 0.34), 0 4px 10px rgba(0, 0, 0, 0.18);
  --shadow-level-2: 0 8px 24px rgba(0, 0, 0, 0.42), 0 2px 6px rgba(0, 0, 0, 0.24);
  --shadow-level-3: 0 24px 64px rgba(0, 0, 0, 0.56), 0 8px 20px rgba(0, 0, 0, 0.34);
  --shadow-sm: var(--shadow-level-1);
  --shadow-md: var(--shadow-level-2);
  --shadow-lg: var(--shadow-level-3);

  --page-wash: var(--surface-page);
}
