:root {
  --mobile-dark-bg:#16191f;
  --mobile-dark-ink:#f4f6fb;
  --mobile-light-bg:#fafbff;
  --mobile-light-ink:#202631;
  --mobile-blue:#2563eb;
  --mobile-green:#15803d;
  --mobile-purple:#9333ea;
  --mobile-orange:#b45309;
  --mobile-blue-dark:#93c5fd;
  --mobile-green-dark:#86efac;
  --mobile-purple-dark:#d8b4fe;
  --mobile-orange-dark:#fcd34d;
  --print-paper: #ffffff;
  --print-ink: #151515;
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;

  --text-xs: .75rem;
  --text-sm: .875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.25rem;
  --text-kpi: clamp(1.65rem, 2.4vw, 2.3rem);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 30px;
  --radius-pill: 999px;

  --shadow-1: 0 1px 3px rgb(15 23 42 / .06), 0 1px 2px rgb(15 23 42 / .03);
  --shadow-2: 0 10px 32px rgb(15 23 42 / .08);
  --shadow-3: 0 20px 60px rgb(15 23 42 / .14);
  --blur-soft: 12px;
  --blur-glass: 22px;
  --border-width: 1px;
  --focus-width: 3px;

  --duration-fast: 140ms;
  --duration-normal: 220ms;
  --ease-standard: cubic-bezier(.2,.8,.2,1);

  --z-sidebar: 30;
  --z-topbar: 40;
  --z-floating: 60;
  --z-modal: 100;

  --color-primary: #2165e8;
  --color-primary-hover: #1958cf;
  --color-secondary: #0f3a72;
  --color-accent: #22b8cf;
  --color-background: #f5f8fc;
  --color-surface: #ffffff;
  --color-surface-elevated: #ffffff;
  --color-surface-muted: #edf3fb;
  --color-text-primary: #152033;
  --color-text-secondary: #647089;
  --color-border: #dce5f1;
  --color-success: #17885b;
  --color-warning: #b76a0c;
  --color-danger: #c43d4b;
  --color-info: #2165e8;
  --color-ai: #7456e8;
  --color-on-primary: #ffffff;
  --color-overlay: rgb(9 16 30 / .48);
  --glass-surface: rgb(255 255 255 / .74);
  --glass-border: rgb(255 255 255 / .58);
  --gradient-brand: linear-gradient(135deg, #2165e8, #22b8cf);
  --gradient-soft: linear-gradient(135deg, rgb(33 101 232 / .09), rgb(34 184 207 / .07));
}

[data-theme="midnight"] {
  --color-primary: #56b7ff;
  --color-primary-hover: #7bc7ff;
  --color-secondary: #27466b;
  --color-accent: #53e0da;
  --color-background: #0e1420;
  --color-surface: #151d2a;
  --color-surface-elevated: #1b2535;
  --color-surface-muted: #1b2637;
  --color-text-primary: #f4f7fb;
  --color-text-secondary: #aebbd0;
  --color-border: #2b394d;
  --color-on-primary: #08111d;
  --glass-surface: rgb(21 29 42 / .74);
  --glass-border: rgb(160 200 240 / .16);
  --gradient-brand: linear-gradient(135deg, #56b7ff, #53e0da);
  --gradient-soft: linear-gradient(135deg, rgb(86 183 255 / .12), rgb(83 224 218 / .08));
}

[data-theme="rose"] {
  --color-primary: #c85e82;
  --color-primary-hover: #ac496c;
  --color-secondary: #7f425c;
  --color-accent: #df91aa;
  --color-background: #fff8fa;
  --color-surface: #fffefe;
  --color-surface-elevated: #ffffff;
  --color-surface-muted: #fbeef2;
  --color-text-primary: #3d2730;
  --color-text-secondary: #7b626c;
  --color-border: #edd7df;
  --gradient-brand: linear-gradient(135deg, #c85e82, #df91aa);
  --gradient-soft: linear-gradient(135deg, rgb(200 94 130 / .12), rgb(255 231 238 / .65));
}

[data-theme="rose-gold"] {
  --color-primary: #b97967;
  --color-primary-hover: #9f6454;
  --color-secondary: #79584f;
  --color-accent: #d6a890;
  --color-background: #fffaf3;
  --color-surface: #fffdf9;
  --color-surface-elevated: #ffffff;
  --color-surface-muted: #f8eee4;
  --color-text-primary: #3c302b;
  --color-text-secondary: #776861;
  --color-border: #e9dbcf;
  --gradient-brand: linear-gradient(135deg, #b97967, #e3bc9f);
  --gradient-soft: linear-gradient(135deg, rgb(185 121 103 / .12), rgb(255 236 219 / .7));
}

[data-theme="purple"] {
  --color-primary: #7555d9;
  --color-primary-hover: #6142c4;
  --color-secondary: #4b3a88;
  --color-accent: #a88de7;
  --color-background: #f8f6ff;
  --color-surface: #ffffff;
  --color-surface-elevated: #ffffff;
  --color-surface-muted: #f0ecfb;
  --color-text-primary: #2d2740;
  --color-text-secondary: #69627d;
  --color-border: #e1dbf1;
  --gradient-brand: linear-gradient(135deg, #7555d9, #a88de7);
  --gradient-soft: linear-gradient(135deg, rgb(117 85 217 / .12), rgb(168 141 231 / .09));
}

[data-theme="purple-night"] {
  --color-primary: #a98cff;
  --color-primary-hover: #bca6ff;
  --color-secondary: #473a78;
  --color-accent: #d9c9ff;
  --color-background: #120f1b;
  --color-surface: #1c1729;
  --color-surface-elevated: #251e35;
  --color-surface-muted: #29213b;
  --color-text-primary: #faf8ff;
  --color-text-secondary: #bdb2d2;
  --color-border: #3b3151;
  --color-on-primary: #1a102c;
  --glass-surface: rgb(28 23 41 / .76);
  --glass-border: rgb(214 198 255 / .18);
  --gradient-brand: linear-gradient(135deg, #a98cff, #d9c9ff);
  --gradient-soft: linear-gradient(135deg, rgb(169 140 255 / .14), rgb(217 201 255 / .08));
}

[data-theme="pink-purple"] {
  --color-primary: #d44d9a;
  --color-primary-hover: #bb3d87;
  --color-secondary: #6d4ac8;
  --color-accent: #a978ef;
  --color-background: #fbf7ff;
  --color-surface: #ffffff;
  --color-surface-elevated: #ffffff;
  --color-surface-muted: #f7edf9;
  --color-text-primary: #34253c;
  --color-text-secondary: #74627b;
  --color-border: #eadcf0;
  --gradient-brand: linear-gradient(135deg, #d44d9a, #6d4ac8);
  --gradient-soft: linear-gradient(135deg, rgb(212 77 154 / .12), rgb(109 74 200 / .09));
}

[data-theme="emerald"] {
  --color-primary: #12866a;
  --color-primary-hover: #0e7059;
  --color-secondary: #235c4e;
  --color-accent: #59bea1;
  --color-background: #f4fbf8;
  --color-surface: #ffffff;
  --color-surface-elevated: #ffffff;
  --color-surface-muted: #e9f6f1;
  --color-text-primary: #203832;
  --color-text-secondary: #60736d;
  --color-border: #d5e9e2;
  --gradient-brand: linear-gradient(135deg, #12866a, #59bea1);
  --gradient-soft: linear-gradient(135deg, rgb(18 134 106 / .11), rgb(89 190 161 / .08));
}

[data-theme="graphite"] {
  --color-primary: #30363f;
  --color-primary-hover: #20252c;
  --color-secondary: #545b64;
  --color-accent: #7b8794;
  --color-background: #f6f7f8;
  --color-surface: #ffffff;
  --color-surface-elevated: #ffffff;
  --color-surface-muted: #eceff1;
  --color-text-primary: #20242a;
  --color-text-secondary: #646b74;
  --color-border: #dfe3e6;
  --gradient-brand: linear-gradient(135deg, #30363f, #7b8794);
  --gradient-soft: linear-gradient(135deg, rgb(48 54 63 / .09), rgb(123 135 148 / .08));
}

[data-mode="dark"]:not([data-theme="midnight"]):not([data-theme="purple-night"]) {
  --color-background: #11151b;
  --color-surface: #181e26;
  --color-surface-elevated: #202732;
  --color-surface-muted: #222a35;
  --color-text-primary: #f5f7fa;
  --color-text-secondary: #aeb7c4;
  --color-border: #303946;
  --glass-surface: rgb(24 30 38 / .76);
  --glass-border: rgb(255 255 255 / .12);
  --color-overlay: rgb(0 0 0 / .62);
}

[data-contrast="increased"] {
  --color-text-secondary: color-mix(in srgb, var(--color-text-primary) 76%, var(--color-background));
  --color-border: color-mix(in srgb, var(--color-text-primary) 30%, var(--color-background));
  --border-width: 1.5px;
}

[data-contrast="high"] {
  --color-text-secondary: var(--color-text-primary);
  --color-border: var(--color-text-primary);
  --border-width: 2px;
  --glass-surface: var(--color-surface);
  --glass-border: var(--color-border);
  --shadow-1: none;
  --shadow-2: none;
  --blur-soft: 0px;
  --blur-glass: 0px;
}

[data-radius="compact"] { --component-radius: var(--radius-sm); }
[data-radius="rounded"] { --component-radius: var(--radius-md); }
[data-radius="extra-rounded"] { --component-radius: var(--radius-lg); }
:root { --component-radius: var(--radius-md); }

[data-density="compact"] { --control-height: 36px; --section-gap: var(--space-4); --card-padding: var(--space-4); }
[data-density="comfortable"] { --control-height: 42px; --section-gap: var(--space-6); --card-padding: var(--space-6); }
[data-density="spacious"] { --control-height: 48px; --section-gap: var(--space-8); --card-padding: var(--space-8); }
:root { --control-height: 42px; --section-gap: var(--space-6); --card-padding: var(--space-6); }

[data-larger-text="true"] { font-size: 112.5%; }

[data-animations="reduced"] { --duration-fast: 80ms; --duration-normal: 120ms; }
[data-animations="off"] { --duration-fast: 0ms; --duration-normal: 0ms; }

@media (prefers-reduced-motion: reduce) {
  :root { --duration-fast: 0ms; --duration-normal: 0ms; }
}


[data-theme="midnight"][data-mode="light"] {
  --color-background:#f2f6fb; --color-surface:#ffffff; --color-surface-elevated:#ffffff; --color-surface-muted:#e7eef7;
  --color-text-primary:#132033; --color-text-secondary:#617088; --color-border:#d5dfeb; --color-on-primary:#08111d;
  --glass-surface:rgb(255 255 255 / .76); --glass-border:rgb(86 183 255 / .18);
}
[data-theme="purple-night"][data-mode="light"] {
  --color-background:#f6f2ff; --color-surface:#ffffff; --color-surface-elevated:#ffffff; --color-surface-muted:#eee7fb;
  --color-text-primary:#2b233b; --color-text-secondary:#6d627f; --color-border:#ded5ef; --color-on-primary:#1a102c;
  --glass-surface:rgb(255 255 255 / .76); --glass-border:rgb(169 140 255 / .18);
}

:root {--color-focus:#174f3f;--color-success-soft:#e8f5ed;--color-warning-soft:#fff3dc;--color-danger-soft:#ffedf0;--color-shadow:rgb(0 0 0 / .15);--swatch-primary:#2165e8;--swatch-accent:#22b8cf;--swatch-base:#eef3fb;--color-warning:#875005;--color-success:#137446;--color-danger:#ad2339;--control-height:44px;}
[data-theme=rose]{--color-primary:#ad3e68;--color-primary-hover:#923053}
[data-theme=rose-gold]{--color-primary:#99604e;--color-primary-hover:#7f4b3b}
[data-theme=pink-purple]{--color-primary:#ae287c;--color-primary-hover:#962069}
[data-theme=emerald]{--color-primary:#087258;--color-primary-hover:#075e49}
[data-theme=graphite]{--color-focus:#30363f}
[data-theme=professional-blue],[data-theme=midnight]{--color-focus:#1753c6}
[data-theme=rose],[data-theme=rose-gold]{--color-focus:#983b59}
[data-theme=purple],[data-theme=purple-night],[data-theme=pink-purple]{--color-focus:#6743b6}
[data-mode=dark]{--color-focus:#b9d8ff;--color-success:#77e4ad;--color-warning:#ffd087;--color-danger:#ff9aaa;--color-success-soft:#133c2d;--color-warning-soft:#3d301d;--color-danger-soft:#43212a}
[data-contrast=increased]{--color-text-secondary:var(--color-text-primary);--color-border:var(--color-text-secondary);--border-width:1.5px}
[data-contrast=high]{--color-text-secondary:var(--color-text-primary);--color-border:var(--color-text-primary);--border-width:2px;--focus-width:5px;--glass-surface:var(--color-surface);--glass-border:var(--color-border);--shadow-1:none;--shadow-2:none;--shadow-3:none}
.swatch-emerald{--swatch-primary:#087258;--swatch-accent:#a8decb;--swatch-base:#f4fbf8}
.swatch-midnight{--swatch-primary:#56b7ff;--swatch-accent:#27466b;--swatch-base:#101825}
.swatch-rose{--swatch-primary:#ad3e68;--swatch-accent:#f1c1d1;--swatch-base:#fff8fa}
.swatch-rose-gold{--swatch-primary:#99604e;--swatch-accent:#edc8af;--swatch-base:#fffaf3}
.swatch-purple{--swatch-primary:#7555d9;--swatch-accent:#d4c3f5;--swatch-base:#f8f6ff}
.swatch-purple-night{--swatch-primary:#a98cff;--swatch-accent:#493568;--swatch-base:#171123}
.swatch-pink-purple{--swatch-primary:#ae287c;--swatch-accent:#9d7fdb;--swatch-base:#fbf7ff}
.swatch-graphite{--swatch-primary:#30363f;--swatch-accent:#b6bec7;--swatch-base:#f6f7f8}
.swatch-custom{--swatch-primary:#7555d9;--swatch-accent:#59bea1;--swatch-base:#fffaf3}

:root {--invoice-gold:#b88624;--invoice-tint:#fbf4e4;--invoice-muted:#59616c;--invoice-rule:#dce0e4;}

:root {--invoice-title-gold:#b68b2e;--invoice-deep-gold:#a37519;--invoice-shadow:rgba(98,69,21,.4);--invoice-soft-shadow:rgba(98,69,21,.22);}

:root {--invoice-rose:#b38a46;}
