/* ==========================================================================
   FinApp v2 — Design Tokens (Single Warm Editorial-Financial Theme)
   Pinned 6-Color Palette:
     #F8F3E1 (Parchment)  #E3DBBB (Linen)       #AEB784 (Sage Olive)
     #41431B (Deep Olive) #D96868 (Muted Coral) #091413 (Deep Pine Ink)
   ========================================================================== */

@layer tokens, reset, base, layout, components, views, utilities;

@layer tokens {
  :root {
    color-scheme: light;

    /* 1. Core 6 Pinned Palette */
    --color-parchment: #F2F2ED;
    --color-linen: #E4E6E1;
    --color-sage: #8BBB92;
    --color-olive-deep: #12544F;
    --color-coral: #FF7171;
    --color-ink: #071B2B;

    /* 2. Surfaces */
    --bg-canvas: #F2F2ED;
    --bg-surface: #FFFFFF;
    --bg-subtle: #EEEEEE;
    --bg-linen: #E4E6E1;
    --bg-linen-hover: #D8DCD6;
    --bg-topbar: #C4D8C7;
    --border-topbar: rgba(7, 27, 43, 0.14);
    --bg-row-hover: #E4E6E1;
    --color-cash-tile: #4A6B7C;
    --color-cash-tile-border: #35505E;
    --bg-dark: #092328;
    --bg-overlay: rgba(7, 27, 43, 0.52);

    /* 3. Borders */
    --border-subtle: rgba(18, 84, 79, 0.13);
    --border-default: #D5DBD7;
    --border-strong: rgba(18, 84, 79, 0.34);
    --border-ink: rgba(7, 27, 43, 0.18);

    /* 4. Typography Ink (All >= WCAG AA 4.5:1 on light surfaces) */
    --text-primary: #071B2B;
    --text-secondary: #243B44;
    --text-muted: #52676E;
    --text-on-brand: #F2F2ED;
    --text-on-dark: #F2F2ED;
    --text-on-danger: #FFFFFF;

    /* 5. Brand & Interactive Accents */
    --brand-primary: #12544F;
    --brand-primary-hover: #0E433F;
    --brand-primary-active: #092328;
    --brand-soft: rgba(139, 187, 146, 0.24);
    --brand-soft-strong: rgba(139, 187, 146, 0.42);
    --brand-ring: rgba(18, 84, 79, 0.28);

    /* 6. Semantic States (Positive / Negative / Warning / Info) */
    --positive-fill: #8BBB92;
    --positive-solid: #2A835F;
    --positive-text: #1D6347;
    --positive-bg: rgba(139, 187, 146, 0.24);
    --positive-border: rgba(42, 131, 95, 0.28);

    --negative-fill: #FF7171;
    --negative-solid: #BD4444;
    --negative-solid-hover: #9E3636;
    --negative-text: #BD4444;
    --negative-bg: rgba(255, 113, 113, 0.15);
    --negative-border: rgba(189, 68, 68, 0.42);

    --warning-fill: #D4943A;
    --warning-text: #85550E;
    --warning-bg: rgba(212, 148, 58, 0.15);
    --warning-border: rgba(212, 148, 58, 0.40);

    --info-fill: #6D94C5;
    --info-text: #355B8A;
    --info-bg: rgba(109, 148, 197, 0.13);
    --info-border: rgba(109, 148, 197, 0.30);

    /* 7. Chart Palette (Harmonized with the 6-color world) */
    --chart-1: #12544F;
    --chart-2: #8BBB92;
    --chart-3: #FF7171;
    --chart-4: #6D94C5;
    --chart-5: #2A835F;
    --chart-6: #D4943A;
    --chart-7: #BD4444;
    --chart-8: #092328;
    --chart-grid: rgba(18, 84, 79, 0.11);
    --chart-tick: #52676E;
    --chart-tooltip-bg: #071B2B;
    --chart-tooltip-text: #F2F2ED;

    /* 8. Typography */
    --font-display: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.875rem;
    --text-md: 0.9375rem;
    --text-lg: 1.125rem;
    --text-xl: 1.375rem;
    --text-2xl: 1.75rem;
    --text-3xl: 2.25rem;

    --leading-tight: 1.2;
    --leading-snug: 1.35;
    --leading-normal: 1.5;
    --leading-relaxed: 1.65;

    /* 9. Spacing Scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* 10. Radii */
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 9999px;

    /* 11. Elevation (Warm tinted soft shadows with vertical offset) */
    --shadow-xs: 0 1px 2px rgba(7, 27, 43, 0.05);
    --shadow-sm: 0 2px 6px rgba(7, 27, 43, 0.06), 0 1px 2px rgba(7, 27, 43, 0.04);
    --shadow-md: 0 8px 24px -4px rgba(7, 27, 43, 0.09), 0 2px 6px rgba(7, 27, 43, 0.05);
    --shadow-lg: 0 20px 44px -8px rgba(7, 27, 43, 0.16), 0 4px 12px rgba(7, 27, 43, 0.08);
    --shadow-tooltip: 0 10px 26px rgba(7, 27, 43, 0.24);

    /* 12. Layout Dimensions */
    --sidebar-width: 252px;
    --sidebar-collapsed-width: 72px;
    --topbar-height: 64px;
    --mobile-topbar-height: 56px;
    --mobile-bottombar-height: 64px;
    --content-max-width: 1440px;

    /* 13. Motion */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-standard: cubic-bezier(0.25, 0.8, 0.25, 1);
    --dur-fast: 140ms;
    --dur-normal: 200ms;
    --dur-slow: 280ms;

    /* 14. Z-Index Layers */
    --z-sticky: 20;
    --z-sidebar: 40;
    --z-topbar: 45;
    --z-dropdown: 60;
    --z-drawer: 80;
    --z-modal: 100;
    --z-modal-nested: 120;
    --z-dialog: 140;
    --z-toast: 160;
    --z-tooltip: 180;
  }

  /* ========================================================================
     Dark Theme — Deep Pine & Luminous Sage-Teal Editorial Palette
     ======================================================================== */
  :root[data-theme="dark"] {
    color-scheme: dark;

    /* 1. Core Adapted Palette */
    --color-parchment: #EDF2EF;
    --color-linen: #1D3038;
    --color-sage: #5EC29E;
    --color-olive-deep: #5EC29E;
    --color-coral: #FF7A7A;
    --color-ink: #EDF2EF;

    /* 2. Surfaces */
    --bg-canvas: #0B1317;
    --bg-surface: #111D23;
    --bg-subtle: #16252C;
    --bg-linen: #1D3038;
    --bg-linen-hover: #253C46;
    --bg-topbar: #0F2026;
    --border-topbar: rgba(139, 187, 146, 0.16);
    --bg-row-hover: #192A32;
    --color-cash-tile: #3B5D70;
    --color-cash-tile-border: #2B4757;
    --bg-dark: #070E12;
    --bg-overlay: rgba(3, 8, 11, 0.72);

    /* 3. Borders */
    --border-subtle: rgba(180, 214, 196, 0.10);
    --border-default: #233842;
    --border-strong: rgba(139, 187, 146, 0.34);
    --border-ink: rgba(237, 242, 239, 0.18);

    /* 4. Typography Ink (All >= WCAG AA 4.5:1 on dark surfaces) */
    --text-primary: #EDF2EF;
    --text-secondary: #B6C7C3;
    --text-muted: #849B97;
    --text-on-brand: #061816;
    --text-on-dark: #EDF2EF;
    --text-on-danger: #FFFFFF;

    /* 5. Brand & Interactive Accents */
    --brand-primary: #5EC29E;
    --brand-primary-hover: #72CEAD;
    --brand-primary-active: #4BAE8B;
    --brand-soft: rgba(94, 194, 158, 0.14);
    --brand-soft-strong: rgba(94, 194, 158, 0.22);
    --brand-ring: rgba(94, 194, 158, 0.34);

    /* 6. Semantic States */
    --positive-fill: #5EC29E;
    --positive-solid: #3FA87F;
    --positive-text: #73D6AA;
    --positive-bg: rgba(94, 194, 158, 0.16);
    --positive-border: rgba(115, 214, 170, 0.30);

    --negative-fill: #FF7A7A;
    --negative-solid: #D94F4F;
    --negative-solid-hover: #E56060;
    --negative-text: #FF8A8A;
    --negative-bg: rgba(255, 113, 113, 0.15);
    --negative-border: rgba(255, 138, 138, 0.36);

    --warning-fill: #E3A84B;
    --warning-text: #F2C06B;
    --warning-bg: rgba(227, 168, 75, 0.15);
    --warning-border: rgba(242, 192, 107, 0.36);

    --info-fill: #7BA7DB;
    --info-text: #92BBE8;
    --info-bg: rgba(123, 167, 219, 0.15);
    --info-border: rgba(146, 187, 232, 0.32);

    /* 7. Chart Palette */
    --chart-1: #5EC29E;
    --chart-2: #8BBB92;
    --chart-3: #FF8585;
    --chart-4: #7BA7DB;
    --chart-5: #45A880;
    --chart-6: #E3A84B;
    --chart-7: #E06666;
    --chart-8: #A3B8B2;
    --chart-grid: rgba(180, 214, 196, 0.12);
    --chart-tick: #8FA6A1;
    --chart-tooltip-bg: #070E12;
    --chart-tooltip-text: #EDF2EF;

    /* 11. Elevation */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.28);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.34), 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-md: 0 10px 26px -4px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.30);
    --shadow-lg: 0 22px 48px -8px rgba(0, 0, 0, 0.62), 0 6px 16px rgba(0, 0, 0, 0.38);
    --shadow-tooltip: 0 12px 28px rgba(0, 0, 0, 0.55);
  }
}