/* =============================================================
   Orçamentista Leme — interface 1.5
   Todas as cores vêm de tokens; cada tema redefine apenas os tokens.
   Temas: grafite-escuro (padrão), grafite, leme, noturno, canteiro, esmeralda, terracota e personalizado.
   ============================================================= */

/* ---------- Tokens estruturais (comuns a todos os temas) ---------- */
:root {
    --font:          'Manrope', 'Segoe UI', system-ui, sans-serif;
    --nav-h:         54px;
    --header-h:      68px;
    --sidebar-w:     272px;
    --radius:        10px;
    --radius-sm:     7px;
    --radius-lg:     16px;
    --ease:          cubic-bezier(.2, .75, .2, 1);
}

/* ---------- Tema Leme (claro, azul institucional; também base dos tokens) ---------- */
:root,
[data-theme="leme"] {
    color-scheme: light;
    --bg:             #f3f6fa;
    --bg-glow:        rgba(31, 93, 153, .07);
    --surface:        #ffffff;
    --surface-2:      #f7f9fc;
    --surface-3:      #eef2f7;
    --border:         #dbe3ed;
    --border-strong:  #c3cfdd;
    --text:           #1b3048;
    --text-2:         #3b5169;
    --text-muted:     #647b92;
    --text-faint:     #93a5b8;
    --heading:        #0f2940;

    --primary:        #1f5d99;
    --primary-hover:  #174a7c;
    --primary-soft:   #eaf2fb;
    --on-primary:     #ffffff;
    --link:           #1f5d99;
    --accent:         #13937a;
    --accent-soft:    #e1f5f0;
    --ring:           rgba(31, 93, 153, .22);

    --success:        #15803d;
    --warning:        #b45309;
    --error:          #c62828;

    --nav-bg:         linear-gradient(90deg, #15375c, #1f5d99);
    --nav-solid:      #173f6a;
    --nav-text:       #dbe9f8;
    --nav-hover:      rgba(255, 255, 255, .10);
    --nav-active:     rgba(255, 255, 255, .18);
    --nav-line:       #9fd3ff;
    --topbar-bg:      rgba(255, 255, 255, .92);

    --hero-bg:        linear-gradient(115deg, #12355a 0%, #1f5d99 62%, #13937a 130%);
    --hero-text:      #ffffff;
    --hero-muted:     #c3d6ee;
    --hero-line:      #6ee7cf;

    --tint-blue-bg:   #e3eefc;  --tint-blue-fg:   #1d4f91;
    --tint-green-bg:  #def3e6;  --tint-green-fg:  #166534;
    --tint-yellow-bg: #fcf1cf;  --tint-yellow-fg: #8a5300;
    --tint-red-bg:    #fde3e1;  --tint-red-fg:    #a4261d;
    --tint-teal-bg:   #d7f3ee;  --tint-teal-fg:   #0f6b62;
    --tint-violet-bg: #ece8fd;  --tint-violet-fg: #5b3fc4;

    --chart-1: #8fb8e8;
    --chart-2: #3cc3a8;
    --chart-3: #173f6a;
    --chart-4: #f0a92e;
    --chart-5: #e05b52;
    --chart-grid: #edf1f6;

    --shadow-sm: 0 1px 2px rgba(16, 42, 67, .05), 0 2px 8px rgba(16, 42, 67, .04);
    --shadow:    0 12px 34px rgba(16, 42, 67, .10);
    --shadow-lg: 0 28px 80px rgba(8, 22, 40, .24);
}

/* ---------- Tema Grafite escuro (padrão: o grafite "ao contrário") ---------- */
[data-theme="grafite-escuro"] {
    color-scheme: dark;
    --radius:         10px;
    --radius-sm:      8px;
    --radius-lg:      16px;
    --bg:             #111113;
    --bg-glow:        rgba(139, 147, 255, .07);
    --surface:        #18181b;
    --surface-2:      #1d1d21;
    --surface-3:      #242428;
    --border:         #2c2c31;
    --border-strong:  #3b3b42;
    --text:           #e4e4e7;
    --text-2:         #c4c4ca;
    --text-muted:     #9a9aa3;
    --text-faint:     #6b6b74;
    --heading:        #fafafa;

    --primary:        #ececef;
    --primary-hover:  #ffffff;
    --primary-soft:   rgba(255, 255, 255, .08);
    --on-primary:     #151518;
    --link:           #a5adff;
    --accent:         #8b93ff;
    --accent-soft:    rgba(139, 147, 255, .14);
    --ring:           rgba(139, 147, 255, .4);

    --success:        #34d399;
    --warning:        #fbbf24;
    --error:          #f87171;

    --nav-bg:         linear-gradient(90deg, #1d1d21, #2a2a2f);
    --nav-solid:      #1c1c20;
    --nav-text:       #d4d4d8;
    --nav-hover:      rgba(255, 255, 255, .07);
    --nav-active:     rgba(255, 255, 255, .12);
    --nav-line:       #8b93ff;
    --topbar-bg:      rgba(21, 21, 24, .86);

    --hero-bg:        radial-gradient(circle at 85% 20%, rgba(139, 147, 255, .26), transparent 24rem), linear-gradient(115deg, #1c1c20 0%, #2a2a30 60%, #3a3b46 130%);
    --hero-text:      #fafafa;
    --hero-muted:     #b4b4bd;
    --hero-line:      #8b93ff;

    --tint-blue-bg:   rgba(139, 147, 255, .15); --tint-blue-fg:   #b7bdff;
    --tint-green-bg:  rgba(52, 211, 153, .14);  --tint-green-fg:  #7ee2b8;
    --tint-yellow-bg: rgba(251, 191, 36, .14);  --tint-yellow-fg: #f6cf6b;
    --tint-red-bg:    rgba(248, 113, 113, .15); --tint-red-fg:    #fca5a5;
    --tint-teal-bg:   rgba(45, 212, 191, .14);  --tint-teal-fg:   #6fe3d2;
    --tint-violet-bg: rgba(167, 139, 250, .16); --tint-violet-fg: #c9bcfd;

    --chart-1: #55555e;
    --chart-2: #8b93ff;
    --chart-3: #e4e4e7;
    --chart-4: #fbbf24;
    --chart-5: #f87171;
    --chart-grid: #26262a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow:    0 14px 36px rgba(0, 0, 0, .45);
    --shadow-lg: 0 30px 90px rgba(0, 0, 0, .65);
}

/* ---------- Tema Grafite claro (neutro moderno, detalhe índigo) ---------- */
[data-theme="grafite"] {
    color-scheme: light;
    --radius:         10px;
    --radius-sm:      8px;
    --radius-lg:      16px;
    --bg:             #f4f4f5;
    --bg-glow:        rgba(99, 102, 241, .05);
    --surface:        #ffffff;
    --surface-2:      #f8f8f9;
    --surface-3:      #efeff1;
    --border:         #e1e1e5;
    --border-strong:  #cacace;
    --text:           #232327;
    --text-2:         #3f3f46;
    --text-muted:     #6b6b74;
    --text-faint:     #a1a1aa;
    --heading:        #151518;

    --primary:        #27272b;
    --primary-hover:  #3a3a40;
    --primary-soft:   #ececef;
    --on-primary:     #ffffff;
    --link:           #4450c8;
    --accent:         #5b67f1;
    --accent-soft:    #eceefe;
    --ring:           rgba(91, 103, 241, .28);

    --success:        #15803d;
    --warning:        #b45309;
    --error:          #c62828;

    --nav-bg:         linear-gradient(90deg, #141416, #242428);
    --nav-solid:      #18181b;
    --nav-text:       #d4d4d8;
    --nav-hover:      rgba(255, 255, 255, .07);
    --nav-active:     rgba(255, 255, 255, .13);
    --nav-line:       #8b93ff;
    --topbar-bg:      rgba(255, 255, 255, .9);

    --hero-bg:        radial-gradient(circle at 85% 20%, rgba(139, 147, 255, .22), transparent 22rem), linear-gradient(115deg, #141416 0%, #26262b 58%, #3a3b44 130%);
    --hero-text:      #fafafa;
    --hero-muted:     #b4b4bd;
    --hero-line:      #8b93ff;

    --tint-blue-bg:   #e8ebfd;  --tint-blue-fg:   #3a44a8;
    --tint-green-bg:  #e2f3e8;  --tint-green-fg:  #1b6a38;
    --tint-yellow-bg: #fbf0d4;  --tint-yellow-fg: #855000;
    --tint-red-bg:    #fce4e2;  --tint-red-fg:    #a3261c;
    --tint-teal-bg:   #ddf2ef;  --tint-teal-fg:   #17645c;
    --tint-violet-bg: #efe9fd;  --tint-violet-fg: #5b3fc4;

    --chart-1: #c9c9d0;
    --chart-2: #6f7af3;
    --chart-3: #27272b;
    --chart-4: #eca33a;
    --chart-5: #dd5b50;
    --chart-grid: #efeff1;

    --shadow-sm: 0 1px 2px rgba(20, 20, 24, .05), 0 2px 8px rgba(20, 20, 24, .04);
    --shadow:    0 12px 32px rgba(20, 20, 24, .10);
    --shadow-lg: 0 28px 80px rgba(10, 10, 12, .26);
}

/* ---------- Tema Noturno (escuro) ---------- */
[data-theme="noturno"] {
    color-scheme: dark;
    --bg:             #0b1220;
    --bg-glow:        rgba(91, 156, 248, .08);
    --surface:        #111a2b;
    --surface-2:      #152036;
    --surface-3:      #1b2840;
    --border:         #25334b;
    --border-strong:  #35486a;
    --text:           #dbe5f2;
    --text-2:         #b5c3d6;
    --text-muted:     #8698b1;
    --text-faint:     #62748d;
    --heading:        #f3f7fc;

    --primary:        #5b9cf8;
    --primary-hover:  #7fb2fa;
    --primary-soft:   rgba(91, 156, 248, .14);
    --on-primary:     #06101f;
    --link:           #86b6fb;
    --accent:         #2dd4bf;
    --accent-soft:    rgba(45, 212, 191, .13);
    --ring:           rgba(91, 156, 248, .35);

    --success:        #34d399;
    --warning:        #fbbf24;
    --error:          #f87171;

    --nav-bg:         linear-gradient(90deg, #0a1323, #10203a);
    --nav-solid:      #0e1a2f;
    --nav-text:       #b9cbe3;
    --nav-hover:      rgba(255, 255, 255, .06);
    --nav-active:     rgba(91, 156, 248, .18);
    --nav-line:       #5b9cf8;
    --topbar-bg:      rgba(13, 21, 36, .88);

    --hero-bg:        linear-gradient(115deg, #0f1d36 0%, #17325c 60%, #0f5e58 135%);
    --hero-text:      #f3f7fc;
    --hero-muted:     #a6bddc;
    --hero-line:      #2dd4bf;

    --tint-blue-bg:   rgba(91, 156, 248, .15);  --tint-blue-fg:   #a5c8ff;
    --tint-green-bg:  rgba(52, 211, 153, .14);  --tint-green-fg:  #7ee2b8;
    --tint-yellow-bg: rgba(251, 191, 36, .14);  --tint-yellow-fg: #f6cf6b;
    --tint-red-bg:    rgba(248, 113, 113, .15); --tint-red-fg:    #fca5a5;
    --tint-teal-bg:   rgba(45, 212, 191, .14);  --tint-teal-fg:   #6fe3d2;
    --tint-violet-bg: rgba(167, 139, 250, .16); --tint-violet-fg: #c9bcfd;

    --chart-1: #3e6fb8;
    --chart-2: #2dd4bf;
    --chart-3: #a5c8ff;
    --chart-4: #fbbf24;
    --chart-5: #f87171;
    --chart-grid: #1d2a42;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow:    0 14px 36px rgba(0, 0, 0, .40);
    --shadow-lg: 0 30px 90px rgba(0, 0, 0, .60);
}

/* ---------- Tema Canteiro (grafite + laranja de segurança) ---------- */
[data-theme="canteiro"] {
    color-scheme: light;
    --radius:         6px;
    --radius-sm:      4px;
    --radius-lg:      10px;
    --bg:             #f3f2ef;
    --bg-glow:        rgba(194, 65, 12, .06);
    --surface:        #ffffff;
    --surface-2:      #f8f7f5;
    --surface-3:      #efedea;
    --border:         #e0dcd6;
    --border-strong:  #c9c2b8;
    --text:           #25221e;
    --text-2:         #47423b;
    --text-muted:     #766e63;
    --text-faint:     #a69e93;
    --heading:        #1a1714;

    --primary:        #c2410c;
    --primary-hover:  #9a3412;
    --primary-soft:   #fdf0e7;
    --on-primary:     #ffffff;
    --link:           #b23c0b;
    --accent:         #3d6b5f;
    --accent-soft:    #e5efec;
    --ring:           rgba(194, 65, 12, .24);

    --success:        #15803d;
    --warning:        #b45309;
    --error:          #b91c1c;

    --nav-bg:         #26231f;
    --nav-solid:      #26231f;
    --nav-text:       #e7e2da;
    --nav-hover:      rgba(255, 255, 255, .08);
    --nav-active:     rgba(249, 115, 22, .20);
    --nav-line:       #f97316;
    --topbar-bg:      rgba(255, 255, 255, .94);

    --hero-bg:        repeating-linear-gradient(135deg, rgba(249, 115, 22, .06) 0 14px, transparent 14px 28px), linear-gradient(115deg, #1f1c19 0%, #36302a 62%, #7c2d12 135%);
    --hero-text:      #ffffff;
    --hero-muted:     #d8cfc4;
    --hero-line:      #fb923c;

    --tint-blue-bg:   #e6edf5;  --tint-blue-fg:   #2c4f78;
    --tint-green-bg:  #e2f1e6;  --tint-green-fg:  #1f6b3a;
    --tint-yellow-bg: #fcefd2;  --tint-yellow-fg: #8a4b00;
    --tint-red-bg:    #fbe3df;  --tint-red-fg:    #9f2a1b;
    --tint-teal-bg:   #e0eeea;  --tint-teal-fg:   #2f5f53;
    --tint-violet-bg: #ece8f6;  --tint-violet-fg: #5a4591;

    --chart-1: #c9bfb2;
    --chart-2: #f08a3c;
    --chart-3: #2e2a25;
    --chart-4: #3d6b5f;
    --chart-5: #b91c1c;
    --chart-grid: #efedea;

    --shadow-sm: 0 1px 2px rgba(38, 35, 31, .08);
    --shadow:    0 12px 30px rgba(38, 35, 31, .12);
    --shadow-lg: 0 26px 70px rgba(20, 16, 12, .28);
}

/* ---------- Tema Esmeralda (claro, verde) ---------- */
[data-theme="esmeralda"] {
    color-scheme: light;
    --radius:         14px;
    --radius-sm:      10px;
    --radius-lg:      20px;
    --bg:             #eff5f1;
    --bg-glow:        rgba(15, 122, 85, .08);
    --surface:        #ffffff;
    --surface-2:      #f5faf7;
    --surface-3:      #e7f1eb;
    --border:         #d3e3d9;
    --border-strong:  #b8d0c1;
    --text:           #16322a;
    --text-2:         #33504a;
    --text-muted:     #5b776d;
    --text-faint:     #8ea79e;
    --heading:        #0c291f;

    --primary:        #0f7a55;
    --primary-hover:  #0b6144;
    --primary-soft:   #e3f3ea;
    --on-primary:     #ffffff;
    --link:           #0d6e4c;
    --accent:         #0e7490;
    --accent-soft:    #def1f6;
    --ring:           rgba(15, 122, 85, .24);

    --success:        #15803d;
    --warning:        #b45309;
    --error:          #c62828;

    --nav-bg:         linear-gradient(90deg, #0b3f2f, #0f6b4d);
    --nav-solid:      #0d4a37;
    --nav-text:       #d6efe3;
    --nav-hover:      rgba(255, 255, 255, .10);
    --nav-active:     rgba(255, 255, 255, .18);
    --nav-line:       #86efc1;
    --topbar-bg:      rgba(255, 255, 255, .92);

    --hero-bg:        linear-gradient(115deg, #0b3b2c 0%, #0f6b4d 60%, #0e7490 135%);
    --hero-text:      #ffffff;
    --hero-muted:     #c4e6d6;
    --hero-line:      #86efc1;

    --tint-blue-bg:   #e0eef7;  --tint-blue-fg:   #1b5d86;
    --tint-green-bg:  #dcf2e4;  --tint-green-fg:  #14633d;
    --tint-yellow-bg: #fbf0d2;  --tint-yellow-fg: #855100;
    --tint-red-bg:    #fce4e1;  --tint-red-fg:    #a3261c;
    --tint-teal-bg:   #d8f0f3;  --tint-teal-fg:   #0e6477;
    --tint-violet-bg: #ebe8fb;  --tint-violet-fg: #5640b8;

    --chart-1: #9fd8bd;
    --chart-2: #38a9c7;
    --chart-3: #0b4a36;
    --chart-4: #e8a93a;
    --chart-5: #dd5b50;
    --chart-grid: #e8f1ec;

    --shadow-sm: 0 1px 2px rgba(12, 41, 31, .05), 0 4px 14px rgba(12, 41, 31, .05);
    --shadow:    0 14px 36px rgba(12, 41, 31, .10);
    --shadow-lg: 0 28px 80px rgba(6, 28, 20, .24);
}

/* ---------- Tema Terracota (quente, areia) ---------- */
[data-theme="terracota"] {
    color-scheme: light;
    --radius:         12px;
    --radius-sm:      8px;
    --radius-lg:      18px;
    --bg:             #f6f0e9;
    --bg-glow:        rgba(168, 72, 44, .07);
    --surface:        #fffdfa;
    --surface-2:      #fbf6f0;
    --surface-3:      #f2e9df;
    --border:         #e6d9cb;
    --border-strong:  #d3c1ad;
    --text:           #3a2a20;
    --text-2:         #5a4638;
    --text-muted:     #85705f;
    --text-faint:     #b09c8b;
    --heading:        #2a1c13;

    --primary:        #a8482c;
    --primary-hover:  #8a3a23;
    --primary-soft:   #f8e9e2;
    --on-primary:     #ffffff;
    --link:           #9a4128;
    --accent:         #5f7434;
    --accent-soft:    #edf1e0;
    --ring:           rgba(168, 72, 44, .24);

    --success:        #4d7c0f;
    --warning:        #b45309;
    --error:          #b42318;

    --nav-bg:         linear-gradient(90deg, #4f2a1c, #7a3d26);
    --nav-solid:      #5b2f1f;
    --nav-text:       #f3e3d6;
    --nav-hover:      rgba(255, 255, 255, .09);
    --nav-active:     rgba(255, 255, 255, .17);
    --nav-line:       #f4b88f;
    --topbar-bg:      rgba(255, 253, 250, .93);

    --hero-bg:        linear-gradient(115deg, #45241a 0%, #8a3a23 62%, #5f7434 135%);
    --hero-text:      #fffaf5;
    --hero-muted:     #efd6c6;
    --hero-line:      #f4b88f;

    --tint-blue-bg:   #e8ecf2;  --tint-blue-fg:   #34507a;
    --tint-green-bg:  #e8efd9;  --tint-green-fg:  #4a6618;
    --tint-yellow-bg: #faecc9;  --tint-yellow-fg: #7f4c05;
    --tint-red-bg:    #f9e0da;  --tint-red-fg:    #9b2c1b;
    --tint-teal-bg:   #e0ece6;  --tint-teal-fg:   #2f6150;
    --tint-violet-bg: #efe6f1;  --tint-violet-fg: #6e3f7a;

    --chart-1: #e3c3ad;
    --chart-2: #8fa65a;
    --chart-3: #6b2e1c;
    --chart-4: #d8963a;
    --chart-5: #b42318;
    --chart-grid: #f2e9df;

    --shadow-sm: 0 1px 2px rgba(58, 42, 32, .06), 0 3px 10px rgba(58, 42, 32, .05);
    --shadow:    0 14px 34px rgba(58, 42, 32, .12);
    --shadow-lg: 0 28px 80px rgba(40, 22, 12, .28);
}

/* ---------- Tema Personalizado (degradê entre dois matizes --h1 → --h2) ---------- */
[data-theme="personalizado"] {
    --h1: 210;
    --h2: 170;
    color-scheme: light;
    --bg:             hsl(var(--h1) 30% 96%);
    --bg-glow:        hsl(var(--h2) 70% 50% / .08);
    --surface:        hsl(var(--h1) 40% 99.6%);
    --surface-2:      hsl(var(--h1) 35% 97.6%);
    --surface-3:      hsl(var(--h1) 28% 93.5%);
    --border:         hsl(var(--h1) 24% 87%);
    --border-strong:  hsl(var(--h1) 20% 78%);
    --text:           hsl(var(--h1) 35% 17%);
    --text-2:         hsl(var(--h1) 22% 31%);
    --text-muted:     hsl(var(--h1) 14% 44%);
    --text-faint:     hsl(var(--h1) 12% 62%);
    --heading:        hsl(var(--h1) 45% 12%);

    --primary:        hsl(var(--h1) 65% 37%);
    --primary-hover:  hsl(var(--h1) 68% 29%);
    --primary-soft:   hsl(var(--h1) 70% 95%);
    --on-primary:     #ffffff;
    --link:           hsl(var(--h1) 65% 35%);
    --accent:         hsl(var(--h2) 62% 35%);
    --accent-soft:    hsl(var(--h2) 55% 93%);
    --ring:           hsl(var(--h1) 65% 37% / .24);

    --nav-bg:         linear-gradient(90deg, hsl(var(--h1) 55% 21%), hsl(var(--h1) 60% 34%) 55%, hsl(var(--h2) 58% 33%));
    --nav-solid:      linear-gradient(180deg, hsl(var(--h1) 52% 20%), hsl(var(--h2) 50% 22%));
    --nav-text:       hsl(var(--h1) 60% 92%);
    --nav-hover:      rgba(255, 255, 255, .10);
    --nav-active:     rgba(255, 255, 255, .18);
    --nav-line:       hsl(var(--h2) 80% 74%);
    --topbar-bg:      hsl(var(--h1) 40% 99% / .92);

    --hero-bg:        linear-gradient(115deg, hsl(var(--h1) 55% 17%) 0%, hsl(var(--h1) 60% 33%) 58%, hsl(var(--h2) 62% 36%) 130%);
    --hero-text:      #ffffff;
    --hero-muted:     hsl(var(--h1) 45% 86%);
    --hero-line:      hsl(var(--h2) 80% 72%);

    --chart-1: hsl(var(--h1) 55% 76%);
    --chart-2: hsl(var(--h2) 58% 48%);
    --chart-3: hsl(var(--h1) 55% 24%);
    --chart-4: #eca33a;
    --chart-5: #dd5b50;
    --chart-grid: hsl(var(--h1) 25% 93%);

    --shadow-sm: 0 1px 2px hsl(var(--h1) 40% 15% / .06), 0 3px 10px hsl(var(--h1) 40% 15% / .05);
    --shadow:    0 14px 34px hsl(var(--h1) 40% 15% / .12);
    --shadow-lg: 0 28px 80px hsl(var(--h1) 50% 8% / .26);
}
[data-theme="personalizado"][data-tone="escuro"] {
    color-scheme: dark;
    --bg:             hsl(var(--h1) 35% 7.5%);
    --bg-glow:        hsl(var(--h2) 70% 55% / .09);
    --surface:        hsl(var(--h1) 30% 11%);
    --surface-2:      hsl(var(--h1) 28% 13.5%);
    --surface-3:      hsl(var(--h1) 26% 16.5%);
    --border:         hsl(var(--h1) 22% 21%);
    --border-strong:  hsl(var(--h1) 20% 29%);
    --text:           hsl(var(--h1) 30% 88%);
    --text-2:         hsl(var(--h1) 20% 76%);
    --text-muted:     hsl(var(--h1) 14% 60%);
    --text-faint:     hsl(var(--h1) 12% 44%);
    --heading:        hsl(var(--h1) 40% 96%);

    --primary:        hsl(var(--h1) 80% 68%);
    --primary-hover:  hsl(var(--h1) 85% 76%);
    --primary-soft:   hsl(var(--h1) 80% 68% / .14);
    --on-primary:     hsl(var(--h1) 60% 8%);
    --link:           hsl(var(--h1) 85% 77%);
    --accent:         hsl(var(--h2) 65% 58%);
    --accent-soft:    hsl(var(--h2) 65% 58% / .14);
    --ring:           hsl(var(--h1) 80% 68% / .35);

    --success:        #34d399;
    --warning:        #fbbf24;
    --error:          #f87171;

    --nav-bg:         linear-gradient(90deg, hsl(var(--h1) 40% 7%), hsl(var(--h1) 42% 13%) 60%, hsl(var(--h2) 42% 14%));
    --nav-solid:      linear-gradient(180deg, hsl(var(--h1) 38% 9%), hsl(var(--h2) 36% 11%));
    --nav-text:       hsl(var(--h1) 30% 80%);
    --nav-hover:      rgba(255, 255, 255, .06);
    --nav-active:     hsl(var(--h1) 80% 68% / .18);
    --nav-line:       hsl(var(--h2) 75% 62%);
    --topbar-bg:      hsl(var(--h1) 35% 9% / .88);

    --hero-bg:        linear-gradient(115deg, hsl(var(--h1) 45% 12%) 0%, hsl(var(--h1) 50% 22%) 60%, hsl(var(--h2) 55% 24%) 135%);
    --hero-text:      hsl(var(--h1) 40% 96%);
    --hero-muted:     hsl(var(--h1) 30% 75%);
    --hero-line:      hsl(var(--h2) 75% 62%);

    --tint-blue-bg:   rgba(91, 156, 248, .15);  --tint-blue-fg:   #a5c8ff;
    --tint-green-bg:  rgba(52, 211, 153, .14);  --tint-green-fg:  #7ee2b8;
    --tint-yellow-bg: rgba(251, 191, 36, .14);  --tint-yellow-fg: #f6cf6b;
    --tint-red-bg:    rgba(248, 113, 113, .15); --tint-red-fg:    #fca5a5;
    --tint-teal-bg:   rgba(45, 212, 191, .14);  --tint-teal-fg:   #6fe3d2;
    --tint-violet-bg: rgba(167, 139, 250, .16); --tint-violet-fg: #c9bcfd;

    --chart-1: hsl(var(--h1) 45% 42%);
    --chart-2: hsl(var(--h2) 65% 58%);
    --chart-3: hsl(var(--h1) 80% 80%);
    --chart-4: #fbbf24;
    --chart-5: #f87171;
    --chart-grid: hsl(var(--h1) 25% 15%);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow:    0 14px 36px rgba(0, 0, 0, .40);
    --shadow-lg: 0 30px 90px rgba(0, 0, 0, .60);
}

/* ---------- Aliases de compatibilidade (usados em estilos inline) ---------- */
:root, [data-theme] {
    --primary-dark:  var(--primary-hover);
    --primary-light: var(--primary-soft);
    --secondary:     var(--accent);
    --neutral-50:    var(--surface-2);
    --neutral-100:   var(--surface-3);
    --neutral-200:   var(--border);
    --neutral-300:   var(--border-strong);
    --neutral-400:   var(--text-faint);
    --neutral-500:   var(--text-muted);
    --neutral-600:   var(--text-2);
    --neutral-700:   var(--text-2);
    --neutral-800:   var(--text);
    --neutral-900:   var(--heading);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    min-height: 100vh;
    font-family: var(--font);
    line-height: 1.6;
    color: var(--text);
    background:
        radial-gradient(circle at 96% -4%, var(--bg-glow), transparent 32rem),
        var(--bg);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}
body.nav-open, body.viewer-open { overflow: hidden; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { color: var(--heading); }
strong { color: inherit; }
::selection { background: var(--primary-soft); color: var(--heading); }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.theme-switching *, .theme-switching *::before, .theme-switching *::after { transition: none !important; }

/* ---------- Estrutura ---------- */
.layout { display: block; min-height: 100vh; }
.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.content { width: 100%; max-width: 1440px; margin: 0 auto; padding: 26px 26px 48px; flex: 1; }

/* Navegação principal — mesma marcação para as 3 disposições (data-layout):
   topo (padrão): barra horizontal com grupos suspensos;
   lateral: menu vertical com grupos em acordeão;
   trilho: coluna de ícones com submenu flutuante.
   Em telas até 900px todas viram gaveta lateral. */
.sidebar {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    height: var(--nav-h);
    color: var(--nav-text);
    background: var(--nav-bg);
    box-shadow: 0 1px 0 rgba(0, 0, 0, .12);
}
.sidebar-frame {
    width: 100%;
    max-width: 1580px;
    height: 100%;
    margin: 0 auto;
    display: flex;
    align-items: stretch;
}
.sidebar-brand {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    color: #fff;
}
.sidebar-brand:hover { color: #fff; text-decoration: none; background: rgba(0, 0, 0, .10); }
.sidebar-brand .logo-icon {
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: .9rem;
    background: rgba(255, 255, 255, .16);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.sidebar-brand h1 { color: #fff; font-size: .86rem; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; white-space: nowrap; }
.sidebar-brand span { display: none; font-size: .7rem; color: var(--nav-text); opacity: .8; }
.sidebar-nav {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 4px;
}
.nav-section { display: none; }
.nav-link {
    position: relative;
    flex: 0 0 auto;
    height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--nav-text);
    background: none;
    font: 650 .8rem var(--font);
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.nav-link:hover, .nav-group.open > .nav-link { color: #fff; background: var(--nav-hover); text-decoration: none; }
.nav-link.active { color: #fff; background: var(--nav-active); }
.nav-link.active::after {
    content: '';
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: -8px;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--nav-line);
}
.nav-link .icon { width: 18px; text-align: center; font-size: .88rem; opacity: .85; }
.nav-caret { font-size: .58rem; opacity: .7; transition: transform .2s ease; }
.nav-group.open > .nav-link .nav-caret { transform: rotate(180deg); }
.nav-badge { margin-left: auto; padding: 2px 7px; border-radius: 99px; color: var(--on-primary); background: var(--primary); font-size: .65rem; font-weight: 700; }

/* Grupo e submenu (painel flutuante por padrão) */
.nav-group { position: relative; display: flex; align-items: center; }
.nav-submenu {
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    z-index: 120;
    min-width: 250px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .16s ease, transform .16s var(--ease), visibility .16s;
}
.nav-submenu::before { content: ''; position: absolute; left: 0; right: 0; top: -12px; height: 12px; }
.nav-group.open > .nav-submenu { opacity: 1; visibility: visible; transform: none; }
@media (hover: hover) and (min-width: 901px) {
    [data-layout="topo"] .nav-group:hover > .nav-submenu,
    [data-layout="trilho"] .nav-group:hover > .nav-submenu { opacity: 1; visibility: visible; transform: none; }
}
.nav-submenu-title { padding: 4px 10px 6px; color: var(--text-muted); font-size: .62rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.nav-sublink {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: .84rem;
    font-weight: 650;
    white-space: nowrap;
}
.nav-sublink .icon { width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center; border-radius: var(--radius-sm); color: var(--primary); background: var(--primary-soft); font-size: .82rem; }
.nav-sublink:hover { color: var(--heading); background: var(--surface-2); text-decoration: none; }
.nav-sublink.active { color: var(--primary); background: var(--primary-soft); }
.nav-sublink.active .icon { color: var(--on-primary); background: var(--primary); }

.sidebar-footer { flex: 0 0 auto; display: flex; align-items: center; padding: 0 10px; }
.sidebar-user { display: none; }
.sidebar-footer .logout-link { display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--nav-text); font-size: .78rem; font-weight: 700; }
.sidebar-footer .logout-link:hover { color: #fff; background: var(--nav-hover); text-decoration: none; }
.sidebar-footer .logout-link span { display: none; }
.nav-close { display: none; }
.sidebar-overlay { display: none; }

/* ---------- Disposição: lateral ---------- */
@media (min-width: 901px) {
    [data-layout="lateral"] .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: var(--sidebar-w);
        height: auto;
        padding: 14px 12px;
        background: var(--nav-solid);
        box-shadow: 1px 0 0 rgba(0, 0, 0, .12);
    }
    [data-layout="lateral"] .sidebar-frame { flex-direction: column; }
    [data-layout="lateral"] .sidebar-brand { padding: 4px 8px 16px; margin-bottom: 6px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
    [data-layout="lateral"] .sidebar-brand:hover { background: none; }
    [data-layout="lateral"] .sidebar-brand .logo-icon { width: 40px; height: 40px; font-size: 1rem; }
    [data-layout="lateral"] .sidebar-brand h1 { font-size: .95rem; }
    [data-layout="lateral"] .sidebar-brand span { display: block; }
    [data-layout="lateral"] .sidebar-nav { display: block; padding: 6px 0; overflow-y: auto; scrollbar-width: thin; }
    [data-layout="lateral"] .nav-group { display: block; }
    [data-layout="lateral"] .nav-link { width: 100%; height: auto; min-height: 40px; margin: 2px 0; padding: 8px 12px; font-size: .85rem; }
    [data-layout="lateral"] .nav-link.active::after { display: none; }
    [data-layout="lateral"] a.nav-link.active { box-shadow: inset 3px 0 var(--nav-line); }
    [data-layout="lateral"] .nav-group-toggle.active { background: none; }
    [data-layout="lateral"] .nav-caret { margin-left: auto; }
    [data-layout="lateral"] .nav-submenu {
        position: static;
        display: none;
        min-width: 0;
        margin: 0 0 6px 21px;
        padding: 2px 0 2px 10px;
        border: 0;
        border-left: 1px solid rgba(255, 255, 255, .14);
        border-radius: 0;
        background: none;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
    }
    [data-layout="lateral"] .nav-group.open > .nav-submenu { display: block; }
    [data-layout="lateral"] .nav-submenu-title { display: none; }
    [data-layout="lateral"] .nav-sublink { padding: 7px 10px; color: var(--nav-text); font-size: .8rem; }
    [data-layout="lateral"] .nav-sublink .icon { width: auto; height: auto; color: inherit; background: none; opacity: .75; }
    [data-layout="lateral"] .nav-sublink:hover { color: #fff; background: var(--nav-hover); }
    [data-layout="lateral"] .nav-sublink.active { color: #fff; background: var(--nav-active); box-shadow: inset 3px 0 var(--nav-line); }
    [data-layout="lateral"] .nav-sublink.active .icon { color: inherit; background: none; }
    [data-layout="lateral"] .sidebar-footer { justify-content: space-between; margin-top: auto; padding: 12px 6px 2px; border-top: 1px solid rgba(255, 255, 255, .1); }
    [data-layout="lateral"] .sidebar-user { min-width: 0; display: flex; align-items: center; gap: 8px; color: #fff; font-size: .76rem; }
    [data-layout="lateral"] .sidebar-user > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    [data-layout="lateral"] .main { margin-left: var(--sidebar-w); }
    [data-layout="lateral"] .topbar { top: 0; }
}

/* ---------- Disposição: trilho de ícones ---------- */
@media (min-width: 901px) {
    [data-layout="trilho"] { --rail-w: 88px; }
    [data-layout="trilho"] .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: var(--rail-w);
        height: auto;
        padding: 12px 8px;
        background: var(--nav-solid);
        box-shadow: 1px 0 0 rgba(0, 0, 0, .12);
    }
    [data-layout="trilho"] .sidebar-frame { flex-direction: column; align-items: stretch; }
    [data-layout="trilho"] .sidebar-brand { justify-content: center; padding: 4px 0 14px; margin-bottom: 8px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
    [data-layout="trilho"] .sidebar-brand:hover { background: none; }
    [data-layout="trilho"] .sidebar-brand .logo-icon { width: 42px; height: 42px; font-size: 1.05rem; }
    [data-layout="trilho"] .sidebar-brand > div:last-child { display: none; }
    [data-layout="trilho"] .sidebar-nav { flex-direction: column; align-items: stretch; gap: 4px; padding: 0; }
    [data-layout="trilho"] .nav-group { display: block; }
    [data-layout="trilho"] .nav-link {
        width: 100%;
        height: auto;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        padding: 10px 4px 8px;
        font-size: .64rem;
        line-height: 1.15;
        text-align: center;
        white-space: normal;
    }
    [data-layout="trilho"] .nav-link .icon { width: auto; font-size: 1.12rem; opacity: 1; }
    [data-layout="trilho"] .nav-caret { display: none; }
    [data-layout="trilho"] .nav-link.active::after { left: -8px; right: auto; top: 12px; bottom: 12px; width: 3px; height: auto; border-radius: 0 3px 3px 0; }
    [data-layout="trilho"] .nav-submenu { left: calc(100% + 14px); top: -6px; transform: translateX(-6px); }
    [data-layout="trilho"] .nav-submenu::before { left: -16px; top: 0; bottom: 0; width: 16px; height: auto; }
    [data-layout="trilho"] .nav-group.open > .nav-submenu { transform: none; }
    [data-layout="trilho"] .sidebar-footer { justify-content: center; margin-top: auto; padding: 10px 0 0; border-top: 1px solid rgba(255, 255, 255, .1); }
    [data-layout="trilho"] .main { margin-left: var(--rail-w); }
    [data-layout="trilho"] .topbar { top: 0; }
}

/* ---------- Disposição: duas faixas (grupo ativo vira faixa de abas) ---------- */
@media (min-width: 901px) {
    [data-layout="faixas"]:has(.nav-group.has-active) { --subnav-h: 48px; }
    [data-layout="faixas"] .sidebar { height: calc(var(--nav-h) + var(--subnav-h, 0px)); }
    [data-layout="faixas"] .sidebar-frame { height: var(--nav-h); }
    [data-layout="faixas"] .topbar { top: calc(var(--nav-h) + var(--subnav-h, 0px)); }
    [data-layout="faixas"] .nav-group.has-active { position: static; }
    [data-layout="faixas"] .nav-group.has-active > .nav-link .nav-caret { display: none; }
    [data-layout="faixas"] .nav-group.has-active > .nav-link.active::after { bottom: -8px; }
    [data-layout="faixas"] .nav-group.has-active > .nav-submenu {
        left: 0;
        right: 0;
        top: var(--nav-h);
        height: var(--subnav-h);
        min-width: 0;
        display: flex;
        align-items: stretch;
        gap: 4px;
        padding: 0 max(18px, calc((100% - 1580px) / 2 + 18px));
        overflow-x: auto;
        border: 0;
        border-bottom: 1px solid var(--border);
        border-radius: 0;
        background: var(--surface);
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        scrollbar-width: none;
    }
    [data-layout="faixas"] .nav-group.has-active > .nav-submenu::before { display: none; }
    [data-layout="faixas"] .nav-group.has-active .nav-submenu-title { display: flex; align-items: center; gap: 8px; padding: 0 12px 0 0; margin-right: 6px; border-right: 1px solid var(--border); white-space: nowrap; }
    [data-layout="faixas"] .nav-group.has-active .nav-sublink { position: relative; flex: 0 0 auto; gap: 8px; padding: 0 12px; border-radius: 0; font-size: .82rem; background: none; }
    [data-layout="faixas"] .nav-group.has-active .nav-sublink .icon { width: auto; height: auto; color: var(--text-muted); background: none; }
    [data-layout="faixas"] .nav-group.has-active .nav-sublink:hover { color: var(--primary); }
    [data-layout="faixas"] .nav-group.has-active .nav-sublink.active { color: var(--primary); }
    [data-layout="faixas"] .nav-group.has-active .nav-sublink.active .icon { color: var(--primary); background: none; }
    [data-layout="faixas"] .nav-group.has-active .nav-sublink.active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); }
}

/* ---------- Disposição: dock flutuante na base ---------- */
@media (min-width: 901px) {
    [data-layout="dock"] .sidebar {
        position: fixed;
        top: auto;
        left: 50%;
        bottom: 16px;
        width: auto;
        max-width: calc(100vw - 32px);
        height: 70px;
        padding: 0 8px;
        border: 1px solid rgba(255, 255, 255, .12);
        border-radius: 22px;
        background: var(--nav-bg);
        box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
        translate: -50% 0;
    }
    [data-layout="dock"] .sidebar-frame { width: auto; gap: 4px; }
    [data-layout="dock"] .sidebar-brand { padding: 0 8px; }
    [data-layout="dock"] .sidebar-brand:hover { background: none; }
    [data-layout="dock"] .sidebar-brand .logo-icon { width: 44px; height: 44px; border-radius: 14px; font-size: 1.05rem; }
    [data-layout="dock"] .sidebar-brand > div:last-child { display: none; }
    [data-layout="dock"] .sidebar-nav { gap: 4px; padding: 0; }
    [data-layout="dock"] .nav-link {
        width: 78px;
        height: 56px;
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        padding: 6px 4px;
        border-radius: 14px;
        font-size: .64rem;
        white-space: nowrap;
        transition: background .15s ease, transform .18s var(--ease);
    }
    [data-layout="dock"] .nav-link:hover { transform: translateY(-3px); }
    [data-layout="dock"] .nav-link .icon { width: auto; font-size: 1.12rem; opacity: 1; }
    [data-layout="dock"] .nav-caret { display: none; }
    [data-layout="dock"] .nav-link.active::after { left: 50%; right: auto; bottom: 3px; width: 5px; height: 5px; border-radius: 50%; translate: -50% 0; }
    [data-layout="dock"] .nav-submenu { top: auto; bottom: calc(100% + 18px); left: 50%; translate: -50% 0; transform: translateY(6px); }
    [data-layout="dock"] .nav-submenu::before { top: auto; bottom: -20px; height: 20px; }
    [data-layout="dock"] .nav-group.open > .nav-submenu { transform: none; }
    [data-layout="dock"] .sidebar-footer { padding: 0 6px 0 4px; border-left: 1px solid rgba(255, 255, 255, .14); }
    [data-layout="dock"] .topbar { top: 0; }
    [data-layout="dock"] .content { padding-bottom: 120px; }
}
@media (hover: hover) and (min-width: 901px) {
    [data-layout="faixas"] .nav-group:not(.has-active):hover > .nav-submenu,
    [data-layout="dock"] .nav-group:hover > .nav-submenu { opacity: 1; visibility: visible; transform: none; }
}

/* Painel "Aparência": temas, degradê personalizado e disposições */
.theme-menu.has-layouts { width: 600px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.theme-menu { max-height: calc(100vh - 90px); overflow-y: auto; overscroll-behavior: contain; }
.appearance-col { min-width: 0; }
.theme-swatch.custom-swatch, .gradient-chip { background: linear-gradient(120deg, hsl(var(--h1) 60% 34%), hsl(var(--h2) 62% 42%)); }
.theme-swatch.custom-swatch::before, .theme-swatch.custom-swatch::after { display: none; }
.custom-theme { margin: 4px 4px 6px; padding: 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); }
.gradient-presets { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 10px; }
.gradient-chip { height: 26px; border: 0; border-radius: 8px; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); transition: transform .15s ease; }
.gradient-chip:hover { transform: translateY(-2px); }
.gradient-chip[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary); }
.hue-field { display: grid; gap: 4px; margin-bottom: 8px; color: var(--text-2); font-size: .7rem; font-weight: 700; }
.hue-slider {
    width: 100%;
    height: 14px;
    border-radius: 99px;
    background: linear-gradient(90deg, hsl(0 70% 50%), hsl(60 70% 50%), hsl(120 70% 45%), hsl(180 70% 45%), hsl(240 70% 55%), hsl(300 70% 50%), hsl(360 70% 50%));
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}
.hue-slider::-webkit-slider-thumb { width: 20px; height: 20px; border: 3px solid #fff; border-radius: 50%; background: transparent; box-shadow: 0 1px 5px rgba(0, 0, 0, .4); -webkit-appearance: none; appearance: none; }
.hue-slider::-moz-range-thumb { width: 14px; height: 14px; border: 3px solid #fff; border-radius: 50%; background: transparent; box-shadow: 0 1px 5px rgba(0, 0, 0, .4); }
.hue-slider:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; }
.tone-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 4px; padding: 3px; border-radius: var(--radius-sm); background: var(--surface-3); }
.tone-toggle button { padding: 6px; border: 0; border-radius: calc(var(--radius-sm) - 2px); color: var(--text-2); background: none; font: 700 .74rem var(--font); cursor: pointer; }
.tone-toggle button[aria-pressed="true"] { color: var(--heading); background: var(--surface); box-shadow: var(--shadow-sm); }

.layout-options { display: grid; gap: 2px; }
.layout-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--text);
    background: none;
    font-family: var(--font);
    text-align: left;
    cursor: pointer;
}
.layout-option:hover { background: var(--surface-2); }
.layout-option[aria-checked="true"] { border-color: var(--primary); background: var(--primary-soft); }
.layout-option strong { display: block; color: var(--heading); font-size: .8rem; }
.layout-option small { display: block; color: var(--text-muted); font-size: .68rem; line-height: 1.35; }
.layout-option .fa-check { margin-left: auto; color: var(--primary); opacity: 0; }
.layout-option[aria-checked="true"] .fa-check { opacity: 1; }
.layout-thumb { position: relative; flex: 0 0 52px; height: 38px; overflow: hidden; border-radius: 6px; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--border); }
.layout-thumb i, .layout-thumb b { position: absolute; display: block; }
.layout-thumb i { background: var(--primary); opacity: .85; }
.layout-thumb b { border-radius: 3px; background: var(--surface); box-shadow: 0 0 0 1px var(--border); }
.layout-thumb-topo i { left: 0; right: 0; top: 0; height: 8px; }
.layout-thumb-topo b { left: 5px; right: 5px; top: 12px; bottom: 4px; }
.layout-thumb-lateral i { left: 0; top: 0; bottom: 0; width: 32%; }
.layout-thumb-lateral b { left: calc(32% + 4px); right: 4px; top: 4px; bottom: 4px; }
.layout-thumb-trilho i { left: 0; top: 0; bottom: 0; width: 13%; }
.layout-thumb-trilho b { left: calc(13% + 4px); right: 4px; top: 4px; bottom: 4px; }
.layout-thumb-faixas i { left: 0; right: 0; top: 0; height: 7px; box-shadow: 0 7px 0 0 var(--primary-soft), 0 8px 0 0 var(--border); }
.layout-thumb-faixas b { left: 5px; right: 5px; top: 17px; bottom: 4px; }
.layout-thumb-dock i { left: 24%; right: 24%; bottom: 3px; height: 7px; border-radius: 4px; }
.layout-thumb-dock b { left: 5px; right: 5px; top: 4px; bottom: 13px; }

/* Barra de título */
.topbar {
    position: sticky;
    top: var(--nav-h);
    z-index: 50;
    height: var(--header-h);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
}
.topbar-inner {
    width: 100%;
    max-width: 1440px;
    height: 100%;
    margin: 0 auto;
    padding: 0 26px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.topbar-copy { flex: 1; min-width: 0; }
.topbar-eyebrow { display: block; color: var(--text-muted); font-size: .62rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.topbar-title { overflow: hidden; color: var(--heading); font-size: 1.05rem; font-weight: 800; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: .85rem; }
.version-chip { display: inline-flex; padding: 4px 9px; border-radius: 999px; color: var(--primary); background: var(--primary-soft); font-size: .66rem; font-weight: 800; letter-spacing: .02em; }
.avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--on-primary);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    font-size: .85rem;
    font-weight: 800;
}
.avatar-small { width: 28px; height: 28px; font-size: .7rem; }
.hamburger { display: none; }

/* ---------- Seletor de tema ---------- */
.theme-picker { position: relative; }
.theme-toggle {
    height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 11px 0 6px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-2);
    background: var(--surface);
    font: 700 .76rem var(--font);
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.theme-toggle:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.theme-toggle .theme-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) 0 50%, var(--accent) 50% 75%, var(--heading) 75%);
    box-shadow: inset 0 0 0 2px var(--surface), 0 0 0 1px var(--border);
}
.theme-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 300;
    width: 290px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(.98);
    transform-origin: top right;
    transition: opacity .16s ease, transform .16s var(--ease), visibility .16s;
}
.theme-picker.open .theme-menu { opacity: 1; visibility: visible; transform: none; }
.theme-menu-title { padding: 6px 10px 8px; color: var(--text-muted); font-size: .64rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.theme-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--text);
    background: none;
    font-family: var(--font);
    text-align: left;
    cursor: pointer;
}
.theme-option:hover { background: var(--surface-2); }
.theme-option[aria-checked="true"] { border-color: var(--primary); background: var(--primary-soft); }
.theme-option strong { display: block; color: var(--heading); font-size: .82rem; }
.theme-option small { display: block; color: var(--text-muted); font-size: .7rem; line-height: 1.35; }
.theme-option .fa-check { margin-left: auto; color: var(--primary); opacity: 0; }
.theme-option[aria-checked="true"] .fa-check { opacity: 1; }
.theme-swatch {
    position: relative;
    flex: 0 0 44px;
    height: 34px;
    overflow: hidden;
    border-radius: 8px;
    background: var(--sw-bg);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}
.theme-swatch::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 9px; background: var(--sw-nav); }
.theme-swatch::after { content: ''; position: absolute; left: 7px; bottom: 6px; width: 20px; height: 8px; border-radius: 3px; background: var(--sw-primary); box-shadow: 22px -1px 0 -2px var(--sw-accent); }

/* ---------- Cartões ---------- */
.card {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-header {
    padding: 16px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}
.card-header h2 { color: var(--heading); font-size: 1rem; font-weight: 800; letter-spacing: -.01em; }
.card-body { padding: 22px; }

/* Indicadores */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: transform .18s var(--ease), box-shadow .18s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card::after {
    content: '';
    position: absolute;
    right: -36px;
    top: -42px;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--stat-glow, var(--primary-soft));
    opacity: .7;
}
.stat-icon {
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 1.2rem;
}
.stat-info .value { color: var(--heading); font-size: 1.6rem; font-weight: 800; line-height: 1; letter-spacing: -.04em; }
.stat-info .label { margin-top: 5px; color: var(--text-muted); font-size: .78rem; }

/* Tons semânticos reutilizáveis */
.tint-blue   { color: var(--tint-blue-fg)   !important; background: var(--tint-blue-bg)   !important; --stat-glow: var(--tint-blue-bg); }
.tint-green  { color: var(--tint-green-fg)  !important; background: var(--tint-green-bg)  !important; --stat-glow: var(--tint-green-bg); }
.tint-yellow { color: var(--tint-yellow-fg) !important; background: var(--tint-yellow-bg) !important; --stat-glow: var(--tint-yellow-bg); }
.tint-red    { color: var(--tint-red-fg)    !important; background: var(--tint-red-bg)    !important; --stat-glow: var(--tint-red-bg); }
.tint-teal   { color: var(--tint-teal-fg)   !important; background: var(--tint-teal-bg)   !important; --stat-glow: var(--tint-teal-bg); }
.tint-violet { color: var(--tint-violet-fg) !important; background: var(--tint-violet-bg) !important; --stat-glow: var(--tint-violet-bg); }
.glow-blue   { --stat-glow: var(--tint-blue-bg); }
.glow-green  { --stat-glow: var(--tint-green-bg); }
.glow-yellow { --stat-glow: var(--tint-yellow-bg); }
.glow-teal   { --stat-glow: var(--tint-teal-bg); }
.glow-violet { --stat-glow: var(--tint-violet-bg); }

/* ---------- Botões ---------- */
.btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 17px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font: 700 .86rem/1.2 var(--font);
    letter-spacing: -.005em;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { color: var(--on-primary); background: var(--primary); box-shadow: 0 6px 16px -8px var(--primary); }
.btn-primary:hover { color: var(--on-primary); background: var(--primary-hover); }
.btn-secondary { color: var(--text-2); background: var(--surface-3); border-color: var(--border); }
.btn-secondary:hover { color: var(--heading); background: var(--border); }
.btn-success { color: #fff; background: #15803d; }
.btn-success:hover { color: #fff; background: #116932; }
.btn-warning { color: #fff; background: #b45309; }
.btn-warning:hover { color: #fff; background: #92400e; }
.btn-danger { color: #fff; background: #c62828; }
.btn-danger:hover { color: #fff; background: #a61f1f; }
.btn-outline { color: var(--text-2); background: var(--surface); border-color: var(--border-strong); }
.btn-outline:hover { color: var(--primary); background: var(--primary-soft); border-color: var(--primary); }
.btn-sm { min-height: 33px; padding: 5px 12px; font-size: .78rem; }
.btn-lg { min-height: 48px; padding: 12px 26px; font-size: .98rem; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
[data-theme="noturno"] .btn-success,
[data-theme="grafite-escuro"] .btn-success,
[data-tone="escuro"] .btn-success { color: #04130c; background: #34d399; }
[data-theme="noturno"] .btn-success:hover,
[data-theme="grafite-escuro"] .btn-success:hover,
[data-tone="escuro"] .btn-success:hover { background: #5ee0b0; }
[data-theme="noturno"] .btn-danger,
[data-theme="grafite-escuro"] .btn-danger,
[data-tone="escuro"] .btn-danger { color: #1a0505; background: #f87171; }
[data-theme="noturno"] .btn-danger:hover,
[data-theme="grafite-escuro"] .btn-danger:hover,
[data-tone="escuro"] .btn-danger:hover { background: #fb9191; }
[data-theme="noturno"] .btn-warning,
[data-theme="grafite-escuro"] .btn-warning,
[data-tone="escuro"] .btn-warning { color: #1a1203; background: #fbbf24; }

/* ---------- Formulários ---------- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; margin-bottom: 6px; color: var(--text-2); font-size: .83rem; font-weight: 700; }
.form-control {
    width: 100%;
    min-height: 42px;
    padding: 9px 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    background: var(--surface);
    font: 500 .9rem var(--font);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control::placeholder { color: var(--text-faint); }
.form-control:hover { border-color: var(--text-faint); }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.form-control:disabled, .form-control[readonly] { background: var(--surface-2); }
.form-control.is-invalid { border-color: var(--error); }
textarea.form-control { min-height: 90px; resize: vertical; }
select.form-control { cursor: pointer; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
.form-text, .form-help { display: block; margin-top: 5px; color: var(--text-muted); font-size: .76rem; }
.invalid-feedback { margin-top: 4px; color: var(--error); font-size: .78rem; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
    padding: 10px 14px;
    color: var(--text-muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--surface-3); font-size: .86rem; vertical-align: middle; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
.td-actions { display: flex; gap: 6px; }

/* ---------- Selos ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px 3px 8px;
    border-radius: 99px;
    font-size: .7rem;
    font-weight: 800;
    white-space: nowrap;
}
.badge-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-blue   { color: var(--tint-blue-fg);   background: var(--tint-blue-bg); }
.badge-green  { color: var(--tint-green-fg);  background: var(--tint-green-bg); }
.badge-yellow { color: var(--tint-yellow-fg); background: var(--tint-yellow-bg); }
.badge-red    { color: var(--tint-red-fg);    background: var(--tint-red-bg); }
.badge-teal   { color: var(--tint-teal-fg);   background: var(--tint-teal-bg); }
.badge-gray   { color: var(--text-2);         background: var(--surface-3); }

/* ---------- Alertas ---------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 18px;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-left-width: 4px;
    border-radius: var(--radius-sm);
    font-size: .86rem;
    font-weight: 600;
}
.alert > i:first-child { margin-top: 3px; }
.alert-success { color: var(--tint-green-fg);  background: var(--tint-green-bg);  border-color: currentColor; }
.alert-error   { color: var(--tint-red-fg);    background: var(--tint-red-bg);    border-color: currentColor; }
.alert-warning { color: var(--tint-yellow-fg); background: var(--tint-yellow-bg); border-color: currentColor; }
.alert-info    { color: var(--tint-blue-fg);   background: var(--tint-blue-bg);   border-color: currentColor; }
.alert { border-top-color: transparent; border-right-color: transparent; border-bottom-color: transparent; }

/* ---------- Progresso ---------- */
.progress { height: 8px; overflow: hidden; border-radius: 99px; background: var(--surface-3); }
.progress-bar { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .5s var(--ease); }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(6, 12, 24, .55);
    backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; animation: viewerFade .18s ease both; }
.modal {
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    animation: viewerEnter .26s var(--ease) both;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-header h3 { color: var(--heading); font-size: 1.02rem; font-weight: 800; }
.modal-body { padding: 22px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }
.btn-close { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 0; border-radius: var(--radius-sm); color: var(--text-muted); background: none; font-size: 1.15rem; line-height: 1; cursor: pointer; }
.btn-close:hover { color: var(--heading); background: var(--surface-3); }

/* ---------- Abas ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 22px; overflow-x: auto; border-bottom: 1px solid var(--border); scrollbar-width: thin; }
.tab-link {
    margin-bottom: -1px;
    padding: 10px 16px;
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    background: none;
    font: 700 .86rem var(--font);
    white-space: nowrap;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease;
}
.tab-link:hover { color: var(--heading); }
.tab-link.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: viewerFade .2s ease both; }

/* ---------- Paginação ---------- */
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; margin-top: 16px; }
.page-btn {
    min-width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-2);
    background: var(--surface);
    font: 700 .83rem var(--font);
    cursor: pointer;
}
.page-btn:hover { color: var(--primary); background: var(--primary-soft); border-color: var(--primary); }
.page-btn.active { color: var(--on-primary); background: var(--primary); border-color: var(--primary); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Etapas ---------- */
.stepper { display: flex; align-items: center; margin-bottom: 28px; }
.step { flex: 1; display: flex; align-items: center; }
.step-circle {
    z-index: 1;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--text-muted);
    background: var(--surface-3);
    font-size: .8rem;
    font-weight: 800;
    transition: all .2s ease;
}
.step-circle.done { color: #fff; background: var(--success); }
.step-circle.active { color: var(--on-primary); background: var(--primary); box-shadow: 0 0 0 5px var(--ring); }
.step-line { flex: 1; height: 2px; margin: 0 4px; background: var(--border); }
.step-line.done { background: var(--success); }
.step-label { display: none; }

/* ---------- Upload ---------- */
.dropzone {
    padding: 40px 20px;
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface-2);
    text-align: center;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease;
}
.dropzone:hover, .dropzone.drag-over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone .dz-icon { margin-bottom: 12px; color: var(--text-faint); font-size: 2.5rem; }
.dropzone p { color: var(--text-muted); font-size: .86rem; }
.dropzone span { color: var(--primary); font-weight: 800; }

/* ---------- Login ---------- */
.login-page {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 72px 20px 32px;
    background:
        radial-gradient(circle at 12% 12%, rgba(255, 255, 255, .10), transparent 26rem),
        var(--hero-bg);
}
.login-theme { position: absolute; top: 18px; right: 20px; }
.login-shell {
    width: 100%;
    max-width: 940px;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 22px;
    box-shadow: 0 40px 100px rgba(0, 0, 0, .35);
    animation: viewerEnter .45s var(--ease) both;
}
.login-showcase {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 32px;
    padding: 44px 40px;
    color: var(--hero-text);
    background: rgba(255, 255, 255, .06);
    backdrop-filter: blur(6px);
}
.login-showcase::after {
    content: '';
    position: absolute;
    right: -90px;
    bottom: -120px;
    width: 320px;
    height: 320px;
    border: 56px solid rgba(255, 255, 255, .06);
    border-radius: 50%;
}
.login-showcase .logo-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    color: #fff;
    background: rgba(255, 255, 255, .16);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2);
    font-size: 1.35rem;
}
.login-showcase h2 { margin-top: 22px; color: var(--hero-text); font-size: clamp(1.5rem, 3vw, 2.05rem); line-height: 1.15; letter-spacing: -.04em; }
.login-showcase p { margin-top: 10px; color: var(--hero-muted); font-size: .92rem; }
.login-features { position: relative; z-index: 1; display: grid; gap: 12px; list-style: none; }
.login-features li { display: flex; align-items: center; gap: 12px; color: var(--hero-text); font-size: .86rem; font-weight: 600; }
.login-features i { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 9px; color: var(--hero-line); background: rgba(255, 255, 255, .10); font-size: .8rem; }
.login-box { width: 100%; padding: 44px 40px; background: var(--surface); }
.login-box .brand { margin-bottom: 28px; }
.login-box .brand .eyebrow { color: var(--primary); font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.login-box .brand h1 { margin-top: 4px; color: var(--heading); font-size: 1.6rem; font-weight: 800; letter-spacing: -.035em; }
.login-box .brand p { color: var(--text-muted); font-size: .88rem; }
.password-field { position: relative; }
.password-field .form-control { padding-right: 44px; }
.password-toggle { position: absolute; right: 6px; top: 50%; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: var(--radius-sm); color: var(--text-muted); background: none; cursor: pointer; transform: translateY(-50%); }
.password-toggle:hover { color: var(--heading); background: var(--surface-3); }
.login-page .theme-toggle { color: #fff; background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .22); }
.login-page .theme-toggle .theme-dot { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .6); }

/* ---------- Cabeçalhos de página ---------- */
.page-actions { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-heading { margin-top: 8px; color: var(--heading); font-size: clamp(1.35rem, 2vw, 1.8rem); line-height: 1.15; letter-spacing: -.035em; }
.page-subtitle { margin-top: 7px; color: var(--text-muted); font-size: .88rem; }
.back-link { display: inline-flex; align-items: center; gap: 7px; color: var(--text-muted); font-size: .8rem; font-weight: 700; }

/* ---------- Painel executivo ---------- */
.dashboard-hero {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1.5fr .8fr;
    gap: 24px;
    margin-bottom: 22px;
    padding: 30px 32px;
    border-radius: var(--radius-lg);
    color: var(--hero-text);
    background: var(--hero-bg);
    box-shadow: var(--shadow);
}
.dashboard-hero::after { content: ''; position: absolute; right: -80px; top: -150px; width: 330px; height: 330px; border: 60px solid rgba(255, 255, 255, .05); border-radius: 50%; pointer-events: none; }
.dashboard-hero h1 { max-width: 650px; margin-top: 10px; color: var(--hero-text); font-size: clamp(1.5rem, 3vw, 2.25rem); line-height: 1.16; letter-spacing: -.045em; }
.dashboard-hero p { max-width: 600px; margin-top: 10px; color: var(--hero-muted); }
.hero-chip { display: inline-flex; padding: 4px 10px; border-radius: 999px; color: var(--hero-text); background: rgba(255, 255, 255, .12); font-size: .64rem; font-weight: 800; letter-spacing: .08em; }
.hero-metric { position: relative; z-index: 1; align-self: center; padding: 18px 20px; border: 1px solid rgba(255, 255, 255, .14); border-radius: var(--radius); background: rgba(255, 255, 255, .08); backdrop-filter: blur(10px); }
.hero-metric small { display: block; color: var(--hero-muted); font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.hero-metric strong { display: block; margin-top: 5px; color: var(--hero-text); font-size: 1.75rem; letter-spacing: -.04em; }
.hero-metric .progress { margin-top: 12px; background: rgba(255, 255, 255, .16); }
.hero-metric .progress-bar { background: var(--hero-line); }

.finance-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.finance-card { position: relative; padding: 20px 22px; }
.finance-card::before { content: ''; position: absolute; left: 0; top: 18px; bottom: 18px; width: 3px; border-radius: 0 3px 3px 0; background: var(--finance-line, var(--primary)); }
.finance-card .eyebrow { color: var(--text-muted); font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.finance-card .amount { display: block; margin-top: 8px; color: var(--finance-line, var(--primary)); font-size: 1.6rem; font-weight: 800; letter-spacing: -.045em; }
.finance-card .trend { margin-top: 5px; color: var(--text-muted); font-size: .76rem; }
.finance-card.is-primary { --finance-line: var(--primary); }
.finance-card.is-accent { --finance-line: var(--accent); }
.finance-card.is-success { --finance-line: var(--success); }
.finance-card.is-error { --finance-line: var(--error); }
.charts-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 18px; margin-bottom: 22px; }
.chart-card { min-height: 390px; }
.chart-wrap { position: relative; height: 300px; padding: 16px 20px 22px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(340px, .7fr); gap: 18px; }
.list-link { display: flex; align-items: center; gap: 12px; padding: 12px 8px; margin: 0 -8px; border-bottom: 1px solid var(--surface-3); border-radius: var(--radius-sm); color: var(--text); }
.list-link:hover { text-decoration: none; background: var(--surface-2); }
.list-link:last-child { border-bottom: 0; }
.list-link .stat-icon { width: 38px; height: 38px; font-size: .95rem; }

/* ---------- Visualizador de planta (sempre escuro, estética blueprint) ---------- */
.blueprint-shell { display: grid; grid-template-columns: minmax(0, 1fr) 320px; min-height: 650px; overflow: hidden; border: 1px solid #1f2b40; border-radius: var(--radius-lg); background: #0b1220; box-shadow: var(--shadow); }
.blueprint-stage { position: relative; min-width: 0; display: grid; place-items: center; background-color: #0d1728; background-image: linear-gradient(rgba(80,120,180,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(80,120,180,.07) 1px, transparent 1px); background-size: 24px 24px; }
.blueprint-stage iframe, .blueprint-stage img { width: 100%; height: 650px; border: 0; object-fit: contain; }
.blueprint-stage img { padding: 24px; }
.blueprint-versions { padding: 18px; overflow-y: auto; border-left: 1px solid #23324a; background: #101c30; }
.blueprint-panel-title { margin: 2px 4px 14px; color: #dbeafe; font-size: .78rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.blueprint-version { width: 100%; display: flex; align-items: center; gap: 12px; margin-bottom: 8px; padding: 12px; border: 1px solid transparent; border-radius: 12px; color: #b9c9df; background: transparent; text-align: left; cursor: pointer; }
.blueprint-version:hover, .blueprint-version.active { color: #fff; background: rgba(59,130,246,.13); border-color: rgba(96,165,250,.23); }
.blueprint-version .file-icon { flex: 0 0 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: #60a5fa; background: rgba(255,255,255,.07); }
.blueprint-version span:last-child { min-width: 0; }
.blueprint-version strong, .blueprint-version small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blueprint-version strong { font-size: .82rem; }
.blueprint-version small { margin-top: 3px; color: #7890b1; font-size: .68rem; }

/* ---------- Estado vazio ---------- */
.empty-state { min-height: 420px; display: grid; place-items: center; align-content: center; padding: 40px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); text-align: center; }
.empty-state .empty-icon { width: 72px; height: 72px; display: grid; place-items: center; margin-bottom: 18px; border-radius: 20px; color: var(--primary); background: var(--primary-soft); font-size: 1.8rem; }
.empty-state h2 { color: var(--heading); font-size: 1.1rem; }
.empty-state p { max-width: 470px; margin-top: 7px; color: var(--text-muted); }

/* ---------- Catálogo de plantas ---------- */
.catalog-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.catalog-heading h1 { color: var(--heading); font-size: clamp(1.45rem, 2.2vw, 1.9rem); line-height: 1.15; letter-spacing: -.04em; }
.catalog-heading p { margin-top: 5px; color: var(--text-muted); font-size: .82rem; }
.catalog-filter {
    display: grid;
    grid-template-columns: minmax(240px, 1.45fr) minmax(180px, .85fr) minmax(220px, 1fr) auto;
    align-items: end;
    gap: 14px;
    margin-bottom: 18px;
    padding: 20px 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.catalog-filter .form-group { margin: 0; }
.catalog-filter-actions { display: flex; gap: 8px; }
.catalog-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.catalog-metric { min-height: 96px; display: grid; place-items: center; align-content: center; padding: 17px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); text-align: center; }
.catalog-metric strong { display: block; color: var(--primary); font-size: clamp(1.45rem, 2.3vw, 1.9rem); line-height: 1; letter-spacing: -.045em; }
.catalog-metric span { margin-top: 8px; color: var(--text-muted); font-size: .75rem; }
.document-section { padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.document-section-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.document-section-header h2 { color: var(--heading); font-size: 1rem; }
.document-section-header span { color: var(--text-muted); font-size: .74rem; }
.document-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.document-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    opacity: 0;
    animation: plantCardReveal .48s var(--ease) forwards;
    animation-delay: calc(min(var(--card-index, 0), 10) * 55ms);
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.document-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-2px); }
.document-preview {
    position: relative;
    height: 176px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: var(--surface-2);
    background-image: linear-gradient(135deg, var(--primary-soft) 25%, transparent 25%, transparent 50%, var(--primary-soft) 50%, var(--primary-soft) 75%, transparent 75%, transparent);
    background-size: 18px 18px;
}
.document-preview img { width: 100%; height: 100%; padding: 7px; object-fit: contain; background: #fff; }
.document-preview .file-placeholder { display: grid; place-items: center; gap: 6px; color: var(--text-faint); }
.document-preview .file-placeholder i { font-size: 3rem; }
.document-preview .file-placeholder strong { font-size: 1.7rem; letter-spacing: .03em; }
.document-type-chip, .document-extension, .document-version { position: absolute; z-index: 2; padding: 3px 7px; border-radius: 6px; font-size: .61rem; font-weight: 800; line-height: 1.35; }
.document-type-chip { top: 9px; left: 9px; max-width: calc(100% - 70px); overflow: hidden; color: var(--heading); background: var(--surface); text-overflow: ellipsis; white-space: nowrap; box-shadow: var(--shadow-sm); }
.document-version { top: 9px; right: 9px; color: var(--tint-blue-fg); background: var(--tint-blue-bg); }
.document-extension { right: 9px; bottom: 9px; color: #fff; background: #15803d; }
.document-extension.pdf { background: #c62828; }
.document-body { padding: 12px 13px 13px; }
.document-title { display: block; overflow: hidden; color: var(--heading); font-size: .82rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.document-meta { display: block; margin-top: 3px; overflow: hidden; color: var(--text-muted); font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.document-details { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--surface-3); color: var(--text-muted); font-size: .64rem; }
.document-actions { display: flex; gap: 5px; }
.document-actions a { width: 29px; height: 29px; display: inline-grid; place-items: center; border: 1px solid var(--border); border-radius: 7px; color: var(--primary); background: var(--surface); }
.document-actions a:hover { text-decoration: none; background: var(--primary-soft); }

/* Visualizador imersivo de plantas */
.plant-preview-trigger { width: 100%; border: 0; color: inherit; cursor: zoom-in; }
.plant-preview-trigger::after {
    content: '\f00e';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--on-primary);
    background: var(--primary);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
    font: 900 1rem/1 'Font Awesome 6 Free';
    opacity: 0;
    transform: translate(-50%, -42%) scale(.8);
    transition: opacity .18s ease, transform .18s ease;
}
.document-card:hover .plant-preview-trigger::after,
.plant-preview-trigger:focus-visible::after { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.plant-preview-trigger img { transition: transform .42s var(--ease), filter .25s ease; }
.document-card:hover .plant-preview-trigger img { transform: scale(1.035); filter: saturate(.8) contrast(1.03); }

.plant-viewer { position: fixed; inset: 0; z-index: 1000; display: none; padding: clamp(10px, 2.2vw, 30px); }
.plant-viewer.open { display: grid; place-items: center; }
.plant-viewer-backdrop { position: absolute; inset: 0; border: 0; background: rgba(3, 12, 28, .82); backdrop-filter: blur(12px); cursor: default; animation: viewerFade .2s ease both; }
.plant-viewer-dialog {
    position: relative;
    width: min(1480px, 100%);
    height: min(900px, calc(100vh - clamp(20px, 4.4vw, 60px)));
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border: 1px solid rgba(162, 193, 223, .22);
    border-radius: 17px;
    color: #e9f3ff;
    background: #0b1a2c;
    box-shadow: 0 35px 100px rgba(0, 0, 0, .45);
    animation: viewerEnter .35s cubic-bezier(.16,.8,.25,1) both;
}
.plant-viewer-dialog h2 { color: #e9f3ff; }
.plant-viewer-header { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 16px 13px 20px; border-bottom: 1px solid rgba(162,193,223,.15); background: linear-gradient(90deg, #102b4b, #0e223c); }
.plant-viewer-heading { min-width: 0; }
.plant-viewer-kicker { color: #71d9c5; font-size: .63rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.plant-viewer-heading h2 { margin-top: 3px; overflow: hidden; font-size: clamp(1rem, 2vw, 1.32rem); text-overflow: ellipsis; white-space: nowrap; }
.plant-viewer-heading p { margin-top: 2px; overflow: hidden; color: #91aac4; font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.plant-viewer-toolbar { display: flex; align-items: center; gap: 6px; }
.plant-viewer-toolbar button, .plant-viewer-toolbar a, .plant-viewer-footer button {
    min-width: 38px; height: 38px; padding: 0 11px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid rgba(162,193,223,.18); border-radius: 9px; color: #dceafb; background: rgba(255,255,255,.06); cursor: pointer;
}
.plant-viewer-toolbar button:hover, .plant-viewer-toolbar a:hover, .plant-viewer-footer button:hover { color: #fff; background: rgba(78,142,205,.22); text-decoration: none; }
.plant-viewer-toolbar button:disabled { opacity: .32; cursor: not-allowed; }
.plant-viewer-stage {
    position: relative;
    min-height: 0;
    display: grid;
    place-items: center;
    overflow: auto;
    background-color: #0a1727;
    background-image: linear-gradient(rgba(88,130,170,.09) 1px,transparent 1px),linear-gradient(90deg,rgba(88,130,170,.09) 1px,transparent 1px),radial-gradient(circle at 50% 40%,rgba(38,91,143,.2),transparent 45%);
    background-size: 26px 26px,26px 26px,auto;
}
.plant-viewer-stage::after { content: ''; position: absolute; z-index: 3; top: -10%; left: 0; right: 0; height: 2px; pointer-events: none; opacity: 0; background: linear-gradient(90deg,transparent,#64d8c0,transparent); box-shadow: 0 0 18px #64d8c0; }
.plant-viewer-stage.is-ready::after { animation: blueprintScan 2.2s ease-out .15s 1; }
.plant-viewer-loader { position: absolute; z-index: 5; color: #77b8f5; font-size: 1.7rem; }
.plant-viewer-error { width: min(430px, calc(100% - 32px)); display: grid; justify-items: center; gap: 9px; padding: 30px; border: 1px solid rgba(255,164,164,.25); border-radius: 16px; color: #dceafb; background: rgba(15,38,65,.94); box-shadow: 0 20px 60px rgba(0,0,0,.25); text-align: center; }
.plant-viewer-error > i { margin-bottom: 5px; color: #ff9e9e; font-size: 2rem; }
.plant-viewer-error strong { font-size: 1.05rem; }
.plant-viewer-error span { color: #9db2c9; font-size: .78rem; }
.plant-viewer-error button { margin-top: 8px; padding: 9px 13px; border: 1px solid rgba(162,193,223,.25); border-radius: 9px; color: #eef7ff; background: rgba(78,142,205,.22); cursor: pointer; }
.plant-viewer-error button:hover { background: rgba(78,142,205,.38); }
.plant-viewer-image, .plant-viewer-frame { width: 100%; height: 100%; border: 0; opacity: 0; }
.plant-viewer-image { padding: clamp(14px, 3vw, 38px); object-fit: contain; transform-origin: center; transition: transform .24s ease; }
.plant-viewer-frame { background: #fff; }
.plant-viewer-stage.is-ready .plant-viewer-image, .plant-viewer-stage.is-ready .plant-viewer-frame { animation: blueprintMaterialize .52s var(--ease) forwards; }
.plant-viewer-footer { min-height: 60px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 15px; padding: 10px 16px; border-top: 1px solid rgba(162,193,223,.15); background: #0e223c; }
.plant-viewer-footer p { overflow: hidden; color: #9db2c9; font-size: .72rem; text-align: center; text-overflow: ellipsis; white-space: nowrap; }

@keyframes plantCardReveal { from { opacity: 0; transform: translateY(16px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes viewerFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes viewerEnter { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes blueprintMaterialize { from { opacity: 0; filter: blur(8px); transform: scale(.97); } to { opacity: 1; filter: blur(0); } }
@keyframes blueprintScan { 0% { top: 4%; opacity: 0; } 15% { opacity: .9; } 80% { opacity: .7; } 100% { top: 96%; opacity: 0; } }

/* ---------- Utilitários ---------- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .75rem; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }
.font-bold { font-weight: 800; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.divider { margin: 20px 0; border: none; border-top: 1px solid var(--border); }

/* ---------- Responsivo ---------- */
@media (min-width: 901px) and (max-width: 1360px) {
    [data-layout="topo"] .sidebar-brand h1 { display: none; }
    [data-layout="topo"] .sidebar-brand { padding: 0 12px; }
}

@media (max-width: 1100px) {
    .charts-grid, .blueprint-shell, .dashboard-grid { grid-template-columns: 1fr; }
    .blueprint-versions { max-height: 300px; border-left: 0; border-top: 1px solid #23324a; }
    .blueprint-stage iframe, .blueprint-stage img { height: 520px; }
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(86vw, 330px);
        height: 100vh;
        padding: 12px;
        background: var(--nav-solid);
        box-shadow: none;
        transform: translateX(-105%);
        transition: transform .28s var(--ease), box-shadow .28s ease;
    }
    .sidebar.open { transform: translateX(0); box-shadow: 15px 0 45px rgba(0, 0, 0, .28); }
    .sidebar-frame { height: 100%; flex-direction: column; }
    .sidebar-brand { min-height: 64px; padding: 10px 48px 13px 10px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
    .sidebar-brand h1 { display: block; font-size: .95rem; }
    .sidebar-brand span { display: block; }
    .sidebar-brand .logo-icon { width: 40px; height: 40px; font-size: 1rem; }
    .nav-close { position: absolute; top: 22px; right: 20px; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 8px; color: #fff; background: rgba(255, 255, 255, .10); cursor: pointer; }
    .main { margin-left: 0; }
    .sidebar-nav { display: block; padding: 8px 0; overflow-y: auto; }
    .nav-group { display: block; }
    .nav-caret { margin-left: auto; }
    .nav-group-toggle.active { background: none; }
    .nav-submenu { position: static; display: none; min-width: 0; margin: 0 0 6px 21px; padding: 2px 0 2px 10px; border: 0; border-left: 1px solid rgba(255, 255, 255, .14); border-radius: 0; background: none; box-shadow: none; opacity: 1; visibility: visible; transform: none; }
    .nav-group.open > .nav-submenu { display: block; }
    .nav-submenu-title { display: none; }
    .nav-sublink { padding: 9px 10px; color: var(--nav-text); }
    .nav-sublink .icon { width: auto; height: auto; color: inherit; background: none; opacity: .75; }
    .nav-sublink:hover { color: #fff; background: var(--nav-hover); }
    .nav-sublink.active { color: #fff; background: var(--nav-active); box-shadow: inset 3px 0 var(--nav-line); }
    .nav-sublink.active .icon { color: inherit; background: none; }
    .nav-section { display: block; padding: 15px 11px 5px; color: var(--nav-text); opacity: .6; font-size: .64rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
    .nav-link { width: 100%; height: auto; min-height: 42px; margin: 2px 0; padding: 9px 12px; flex-direction: row; justify-content: flex-start; font-size: .84rem; }
    a.nav-link.active { box-shadow: inset 3px 0 var(--nav-line); }
    .nav-link.active::after { display: none; }
    .sidebar-footer { margin-top: auto; justify-content: space-between; padding: 12px 8px 3px; border-top: 1px solid rgba(255, 255, 255, .1); }
    .sidebar-user { min-width: 0; display: flex; align-items: center; gap: 8px; color: #fff; font-size: .74rem; }
    .sidebar-user > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .sidebar-footer .logout-link span { display: inline; }
    .sidebar-overlay { position: fixed; inset: 0; z-index: 99; background: rgba(0, 0, 0, .45); }
    .sidebar-overlay.open { display: block; animation: viewerFade .2s ease both; }
    .topbar { top: 0; }
    .hamburger { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; border: 0; border-radius: var(--radius-sm); color: var(--text-2); background: none; font-size: 1.25rem; cursor: pointer; }
    .hamburger:hover { background: var(--surface-3); }
    .catalog-filter { grid-template-columns: 1fr 1fr; }
    .catalog-filter-actions { grid-column: 1 / -1; }
    .login-shell { grid-template-columns: 1fr; max-width: 460px; }
    .login-showcase { padding: 30px 30px 26px; gap: 20px; }
    .login-showcase h2 { margin-top: 16px; font-size: 1.4rem; }
    .login-features { display: none; }
}

@media (max-width: 760px) {
    .dashboard-hero, .finance-grid { grid-template-columns: 1fr; }
    .page-actions { flex-direction: column; align-items: stretch; }
    .page-actions .btn { justify-content: center; }
    .version-chip { display: none; }
    .blueprint-stage iframe, .blueprint-stage img { height: 420px; }
}

@media (max-width: 660px) {
    .topbar-inner { padding: 0 14px; gap: 10px; }
    .topbar-eyebrow, .topbar-user .text-sm { display: none !important; }
    .theme-toggle { padding: 0 6px; }
    .theme-toggle span:not(.theme-dot) { display: none; }
    .topbar .avatar { display: none; }
    .content { padding: 18px 14px 32px; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .catalog-heading { flex-direction: column; align-items: stretch; }
    .catalog-heading .btn { justify-content: center; }
    .catalog-filter { grid-template-columns: 1fr; padding: 16px; }
    .catalog-filter-actions { grid-column: auto; }
    .catalog-filter-actions .btn { flex: 1; }
    .catalog-metrics { grid-template-columns: 1fr 1fr; }
    .catalog-metric { min-height: 86px; }
    .document-section { padding: 15px; }
    .document-gallery { grid-template-columns: 1fr 1fr; gap: 10px; }
    .document-preview { height: 148px; }
    .login-box { padding: 30px 24px; }
    .card-header { padding: 14px 16px; flex-wrap: wrap; }
    .card-body { padding: 16px; }
}

@media (max-width: 700px) {
    .plant-viewer { padding: 0; }
    .plant-viewer-dialog { height: 100vh; border: 0; border-radius: 0; }
    .plant-viewer-header { min-height: 70px; padding: 10px 11px 10px 14px; }
    .plant-viewer-heading p { max-width: 55vw; }
    .plant-viewer-toolbar [data-viewer-zoom-out], .plant-viewer-toolbar [data-viewer-zoom-reset], .plant-viewer-toolbar [data-viewer-zoom-in] { display: none; }
    .plant-viewer-footer { grid-template-columns: auto auto; }
    .plant-viewer-footer p { display: none; }
    .plant-viewer-footer button { min-width: 110px; }
}

@media (max-width: 520px) {
    .stats-grid { grid-template-columns: 1fr; }
    .dashboard-hero { padding: 23px 20px; }
    .theme-menu { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; }
}

@media (max-width: 440px) {
    .document-gallery { grid-template-columns: 1fr; }
    .document-preview { height: 190px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
    .document-card { opacity: 1; }
    .plant-viewer-stage::after { display: none; }
}

@media print {
    .sidebar, .topbar, .sidebar-overlay, .theme-picker, .btn { display: none !important; }
    body { background: #fff; }
    .card, .stat-card { box-shadow: none; }
}

@media (max-width: 700px) {
    .theme-menu.has-layouts { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; grid-template-columns: 1fr; }
}
