/*
 * SALDO design tokens, shared by apps/web and apps/desktop. Source of truth: the SALDO brand book.
 * Import after `@import "tailwindcss";`.
 * Semantic tokens are themed by `data-theme` on any ancestor; components use only the
 * semantic names below (`bg-surface`, `text-fg-muted`, `text-status-due`, …). The `ink-*`
 * and `gold-*` ramps are mode-stable brand colours for the sidebar, login and marketing.
 */
:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #faf8f3;
  --surface: #ffffff;
  --surface-hover: #f2efe7;
  --sidebar: #1e1e24;
  --sidebar-text: #b5b5c0;
  --border: #e4dfd3;
  --border-strong: #948c7c;
  --text: #1e1e24;
  --text-secondary: #5e5e6a;
  --text-muted: #6e6e7a;
  --accent: #8a6526;
  --primary-bg: #1e1e24;
  --on-primary: #ddbd77;
  --focus-ring: #a07a34;
  --status-done: #18744a;
  --status-done-bg: #d4f3e2;
  --status-progress: #1f5fbf;
  --status-progress-bg: #dbe8fd;
  --status-sent: #0b7285;
  --status-sent-bg: #d0f2f7;
  --status-idle: #5e5e6a;
  --status-idle-bg: #efede8;
  --status-due: #b03a0a;
  --status-due-bg: #ffe4d1;
  --status-danger: #c81e1e;
  --status-danger-bg: #fdd8d8;
  --on-status-danger: #ffffff;
  --status-error: #7e3bd0;
  --status-error-bg: #ecdffc;
  /* Company priority chevrons: blue low, yellow medium, red high (≥3:1 on surface for the icon). */
  /* Key expiry "soon": yellow, between blue (fine) and red (expired). */
  --status-soon: #8a6a00;
  --status-soon-bg: #fff1bf;
  --priority-low: #1f5fbf;
  --priority-medium: #b98900;
  --priority-high: #c81e1e;
  --shadow-card: 0 1px 2px rgba(30, 30, 36, 0.06);
  --shadow-popover: 0 8px 24px rgba(30, 30, 36, 0.12);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1e1e24;
  --surface: #26262e;
  --surface-hover: #2f2f38;
  --sidebar: #16161b;
  --sidebar-text: #b5b5c0;
  --border: #3a3a44;
  --border-strong: #777785;
  --text: #f2f1ee;
  --text-secondary: #b5b5c0;
  --text-muted: #9696a2;
  --accent: #ddbd77;
  --primary-bg: #ddbd77;
  --on-primary: #1e1e24;
  --focus-ring: #ddbd77;
  --status-done: #5fd49b;
  --status-done-bg: #143d29;
  --status-progress: #7fb2ff;
  --status-progress-bg: #16305a;
  --status-sent: #4fd3e4;
  --status-sent-bg: #0f3a42;
  --status-idle: #b5b5c0;
  --status-idle-bg: #2f2f38;
  --status-due: #ff9a57;
  --status-due-bg: #4a2710;
  --status-danger: #ff7b72;
  --status-danger-bg: #4f1a1a;
  --on-status-danger: #1e1e24;
  --status-error: #c49bff;
  --status-error-bg: #33204f;
  --status-soon: #ffd24a;
  --status-soon-bg: #3d3210;
  --priority-low: #7fb2ff;
  --priority-medium: #ffd24a;
  --priority-high: #ff7b72;
  --shadow-card: none;
  --shadow-popover: 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* Print and export always use the light workspace theme (brand book §5). */
@media print {
  :root,
  [data-theme] {
    color-scheme: light;
    --bg: #faf8f3;
    --surface: #ffffff;
    --surface-hover: #f2efe7;
    --sidebar: #1e1e24;
    --sidebar-text: #b5b5c0;
    --border: #e4dfd3;
    --border-strong: #948c7c;
    --text: #1e1e24;
    --text-secondary: #5e5e6a;
    --text-muted: #6e6e7a;
    --accent: #8a6526;
    --primary-bg: #1e1e24;
    --on-primary: #ddbd77;
    --focus-ring: #a07a34;
    --status-done: #18744a;
    --status-done-bg: #d4f3e2;
    --status-progress: #1f5fbf;
    --status-progress-bg: #dbe8fd;
    --status-sent: #0b7285;
    --status-sent-bg: #d0f2f7;
    --status-idle: #5e5e6a;
    --status-idle-bg: #efede8;
    --status-due: #b03a0a;
    --status-due-bg: #ffe4d1;
    --status-danger: #c81e1e;
    --status-danger-bg: #fdd8d8;
    --on-status-danger: #ffffff;
    --status-error: #7e3bd0;
    --status-error-bg: #ecdffc;
    --status-soon: #8a6a00;
    --status-soon-bg: #fff1bf;
    --priority-low: #1f5fbf;
    --priority-medium: #b98900;
    --priority-high: #c81e1e;
    --shadow-card: 0 1px 2px rgba(30, 30, 36, 0.06);
    --shadow-popover: 0 8px 24px rgba(30, 30, 36, 0.12);
  }
}

@theme inline {
  /* Semantic colours (themed) */
  --color-canvas: var(--bg);
  --color-surface: var(--surface);
  --color-surface-hover: var(--surface-hover);
  --color-sidebar: var(--sidebar);
  --color-sidebar-text: var(--sidebar-text);
  --color-border: var(--border);
  --color-border-strong: var(--border-strong);
  --color-fg: var(--text);
  --color-fg-secondary: var(--text-secondary);
  --color-fg-muted: var(--text-muted);
  --color-accent: var(--accent);
  --color-primary: var(--primary-bg);
  --color-primary-fg: var(--on-primary);
  --color-focus: var(--focus-ring);
  --color-status-done: var(--status-done);
  --color-status-done-bg: var(--status-done-bg);
  --color-status-progress: var(--status-progress);
  --color-status-progress-bg: var(--status-progress-bg);
  --color-status-idle: var(--status-idle);
  --color-status-idle-bg: var(--status-idle-bg);
  --color-status-due: var(--status-due);
  --color-status-due-bg: var(--status-due-bg);
  --color-status-soon: var(--status-soon);
  --color-status-soon-bg: var(--status-soon-bg);
  --color-priority-low: var(--priority-low);
  --color-priority-medium: var(--priority-medium);
  --color-priority-high: var(--priority-high);
  --color-status-danger: var(--status-danger);
  --color-status-danger-bg: var(--status-danger-bg);
  --color-on-status-danger: var(--on-status-danger);
  --color-status-sent: var(--status-sent);
  --color-status-sent-bg: var(--status-sent-bg);
  --color-status-error: var(--status-error);
  --color-status-error-bg: var(--status-error-bg);

  /* Brand ramps (mode-stable) */
  --color-ink-950: #16161b;
  --color-ink-900: #1e1e24;
  --color-ink-800: #26262e;
  --color-ink-700: #2f2f38;
  --color-ink-600: #3a3a44;
  --color-ink-400: #8a8a96;
  --color-ink-200: #b5b5c0;
  --color-ink-50: #f2f1ee;
  --color-gold-100: #f6e7c4;
  --color-gold-200: #eece8d;
  --color-gold-300: #ddbd77;
  --color-gold-400: #cfad5a;
  --color-gold-500: #c79f4e;
  --color-gold-600: #97702c;
  --color-gold-700: #8a6526;
  --color-gold-900: #5c4318;

  /*
   * Type. The web app sets --font-inter/--font-montserrat/--font-jetbrains-mono through next/font;
   * the desktop app bundles the same faces with Fontsource ("Inter Variable", "Montserrat", "JetBrains Mono").
   */
  --font-sans: var(--font-inter, "Inter Variable"), Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font-montserrat, Montserrat), Montserrat, var(--font-inter, "Inter Variable"), system-ui, sans-serif;
  --font-mono: var(--font-jetbrains-mono, "JetBrains Mono"), "JetBrains Mono", ui-monospace, Menlo, monospace;

  /* Radius: badges 4, controls 8, cards 12 */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-card: var(--shadow-card);
  --shadow-popover: var(--shadow-popover);
}
