/* ==========================================================================
   FINANCIAL FAMILY v3.0 — DESIGN TOKENS (TASTE-SKILL FINTECH + REACT BITS)
   Paletas: Warm Black & Gold (Dark) | Teal on Paper (Light)
   Tipografia: Instrument Sans + DM Mono | Raio Fintech: Sharp (4 / 6 / 8px)
   Sem violeta/lavanda | Contraste WCAG 2.2 AA+ | Motion Tokens Padronizados
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Instrument+Sans:wght@400;500;600;700&display=swap');

:root,
[data-theme="dark"] {
    color-scheme: dark;

    /* Superfícies — Warm Black & Gold (taste-skill fintech dark-neutral) */
    --bg-canvas: #0C0A08;
    --bg-sidebar: #110F0C;
    --bg-surface: #161310;
    --bg-elevated: #1E1A15;
    --bg-control: #12100D;
    --bg-hover: rgba(242, 236, 226, 0.055);

    /* Linhas & Hairlines (12-16% ink) + Bordas de Controle (WCAG 1.4.11 >= 3:1) */
    --border-subtle: rgba(242, 236, 226, 0.095);
    --border-default: rgba(242, 236, 226, 0.16);
    --border-strong: rgba(242, 236, 226, 0.28);
    --border-control: #6E675E;

    /* Tipografia (Warm off-white ink — contraste >= 13:1) */
    --text-primary: #F6F3EE;
    --text-secondary: #C8C1B6;
    --text-muted: #938B80;
    --text-on-accent: #14110D;

    /* Acento Principal — Champagne Wealth Gold (nunca violeta) */
    --accent-primary: #C9A45A;
    --accent-primary-hover: #D8B56E;
    --accent-secondary: #DEC082;
    --accent-soft: rgba(201, 164, 90, 0.12);
    --accent-border: rgba(201, 164, 90, 0.30);

    /* Lucro / Receita / Quitado — Institutional Emerald */
    --profit-solid: #17855E;
    --profit-solid-hover: #1C9B6E;
    --profit-fg: #3AD19B;
    --profit-bg: rgba(23, 133, 94, 0.14);
    --profit-border: rgba(58, 209, 155, 0.28);

    /* Estados Semânticos */
    --status-success-fg: #3AD19B;
    --status-success-bg: rgba(23, 133, 94, 0.14);
    --status-success-border: rgba(58, 209, 155, 0.28);

    --status-warning-fg: #EAB354;
    --status-warning-bg: rgba(234, 179, 84, 0.13);
    --status-warning-border: rgba(234, 179, 84, 0.30);

    --status-danger-fg: #F07368;
    --status-danger-bg: rgba(224, 82, 68, 0.14);
    --status-danger-border: rgba(240, 115, 104, 0.32);
    --status-danger-solid: #C93B2F;

    --status-info-fg: #7CB9C9;
    --status-info-bg: rgba(124, 185, 201, 0.12);
    --status-info-border: rgba(124, 185, 201, 0.28);

    /* Paleta de Categorias (Zero violeta — curadoria editorial) */
    --cat-1: #C9A45A;
    --cat-2: #2EB886;
    --cat-3: #4E9BB5;
    --cat-4: #D97B48;
    --cat-5: #789B6E;
    --cat-6: #D1606E;
    --cat-7: #6F88A1;
    --cat-8: #938B80;

    /* React Bits Spotlight & Dot Grid Tokens */
    --spotlight-color: rgba(201, 164, 90, 0.11);
    --spotlight-border: rgba(201, 164, 90, 0.34);
    --dot-base: rgba(242, 236, 226, 0.14);
    --dot-active: rgba(201, 164, 90, 0.72);
    --aurora-glow: radial-gradient(ellipse 68% 54% at 18% 12%, rgba(201, 164, 90, 0.12), rgba(23, 133, 94, 0.05) 45%, transparent 74%);

    /* Foco & Sombras */
    --focus-ring: 0 0 0 2px var(--bg-canvas), 0 0 0 4px var(--accent-primary);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.42);
    --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.48);
    --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.68);
    --backdrop-bg: rgba(8, 6, 4, 0.78);

    /* Tipografia & Escala */
    --font-sans: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    --text-xs: 0.8125rem;   /* 13px piso mínimo taste-skill */
    --text-sm: 0.875rem;    /* 14px */
    --text-base: 0.9375rem; /* 15px */
    --text-lg: 1.125rem;    /* 18px */
    --text-xl: 1.375rem;    /* 22px */
    --text-2xl: 1.75rem;    /* 28px */

    --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;

    /* Raio Fintech Sharp (taste-skill: 4 / 6 / 8px) */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 10px;
    --radius-pill: 9999px;

    /* Motion Tokens (taste-skill motion.md) */
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --ease-enter: cubic-bezier(0.22, 1, 0.36, 1);
    --m-in: 150ms;
    --m-out: 120ms;
    --m-press: 90ms;
    --m-slide: 240ms;

    --sidebar-width: 240px;
    --topbar-height: 62px;
    --touch-target-min: 44px;
}

[data-theme="light"] {
    color-scheme: light;

    /* Superfícies — Teal on Paper (taste-skill fintech two-tone) */
    --bg-canvas: #F4F7F6;
    --bg-sidebar: #EBF0EE;
    --bg-surface: #FFFFFF;
    --bg-elevated: #F7F9F8;
    --bg-control: #F7F9F8;
    --bg-hover: rgba(6, 82, 92, 0.055);

    /* Linhas & Hairlines + Bordas de Controle (WCAG 1.4.11 >= 3:1) */
    --border-subtle: rgba(6, 54, 62, 0.11);
    --border-default: rgba(6, 54, 62, 0.19);
    --border-strong: rgba(6, 54, 62, 0.34);
    --border-control: #6A8287;

    /* Tipografia (Deep institutional teal-ink — contraste >= 9:1) */
    --text-primary: #09262B;
    --text-secondary: #2A464B;
    --text-muted: #4D686D;
    --text-on-accent: #FFFFFF;

    /* Acento Principal — Sovereign Teal */
    --accent-primary: #06525C;
    --accent-primary-hover: #043E46;
    --accent-secondary: #06525C;
    --accent-soft: rgba(6, 82, 92, 0.09);
    --accent-border: rgba(6, 82, 92, 0.26);

    /* Lucro / Receita / Quitado */
    --profit-solid: #0D7A57;
    --profit-solid-hover: #0A6346;
    --profit-fg: #0A6B4B;
    --profit-bg: #E7F6F0;
    --profit-border: #A8DFC9;

    /* Estados Semânticos */
    --status-success-fg: #0A6B4B;
    --status-success-bg: #E7F6F0;
    --status-success-border: #A8DFC9;

    --status-warning-fg: #9A5B06;
    --status-warning-bg: #FDF5E6;
    --status-warning-border: #F2D399;

    --status-danger-fg: #A82820;
    --status-danger-bg: #FDECEB;
    --status-danger-border: #F5BDB9;
    --status-danger-solid: #B82E25;

    --status-info-fg: #06525C;
    --status-info-bg: #E8F3F5;
    --status-info-border: #B5D7DD;

    /* Paleta de Categorias */
    --cat-1: #06525C;
    --cat-2: #0D7A57;
    --cat-3: #B67D1A;
    --cat-4: #C05A34;
    --cat-5: #2C6E91;
    --cat-6: #A83E52;
    --cat-7: #4B7A5A;
    --cat-8: #5A7075;

    /* React Bits Spotlight & Dot Grid Tokens */
    --spotlight-color: rgba(6, 82, 92, 0.065);
    --spotlight-border: rgba(6, 82, 92, 0.28);
    --dot-base: rgba(6, 82, 92, 0.14);
    --dot-active: rgba(6, 82, 92, 0.65);
    --aurora-glow: radial-gradient(ellipse 68% 54% at 18% 12%, rgba(6, 82, 92, 0.09), rgba(13, 122, 87, 0.04) 45%, transparent 74%);

    /* Foco & Sombras */
    --focus-ring: 0 0 0 2px var(--bg-canvas), 0 0 0 4px var(--accent-primary);
    --shadow-sm: 0 1px 2px rgba(6, 40, 46, 0.06);
    --shadow-md: 0 8px 24px rgba(6, 40, 46, 0.08);
    --shadow-lg: 0 20px 44px rgba(6, 40, 46, 0.14);
    --backdrop-bg: rgba(9, 38, 43, 0.46);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-padding-top: calc(var(--topbar-height) + 1.25rem);
    scroll-padding-bottom: 8.5rem;
}

html, body {
    font-family: var(--font-sans);
    background-color: var(--bg-canvas);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: background-color 180ms var(--ease), color 180ms var(--ease);
}

:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    top: -100px;
    left: var(--space-4);
    z-index: 1200;
    background: var(--accent-primary);
    color: var(--text-on-accent);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: var(--text-sm);
    text-decoration: none;
}

.skip-link:focus {
    top: var(--space-3);
}

.text-right {
    text-align: right;
}

.mono-num {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.text-healthy {
    color: var(--status-success-fg) !important;
}

.text-warning {
    color: var(--status-warning-fg) !important;
}

.text-danger {
    color: var(--status-danger-fg) !important;
}
