/* =====================================================================
   gc.css — tema do painel no padrão "Gerencia Clientes" (GC)
   Fonte: GUIA_VISUAL_GERENCIA_CLIENTES.md (seções 1–12 + 15).
   Paleta ESMERALDA (primary emerald, accent cyan, neutra slate).
   Claro e escuro: classe "dark" no <html> (padrão = escuro; escolha em localStorage.theme).
   Regra: nenhuma cor solta. Neutras = --d-*, marca = --p-* e --a-*, status = variáveis --st-*
   (valores da tabela de status do guia, 1.2/10/12), definidas só neste arquivo, no topo.
   Carregado POR ÚLTIMO no header.php (depois do CSS da tela).
   Parte 1: tokens + base + shell + componentes do guia.
   Parte 2 (gc-compat.css): mapeia as classes que as telas já usam para este visual.
   ===================================================================== */

/* ---------- 1.1 Tokens de cor (R G B sem vírgula) ---------- */
:root,
:root[data-palette="esmeralda"] {
  /* primary (emerald) */
  --p-50: 236 253 245; --p-100: 209 250 229; --p-200: 167 243 208; --p-300: 110 231 183;
  --p-400: 52 211 153; --p-500: 16 185 129;  --p-600: 5 150 105;   --p-700: 4 120 87;
  --p-800: 6 95 70;    --p-900: 6 78 59;     --p-950: 2 44 34;
  /* accent (cyan) */
  --a-50: 236 254 255; --a-100: 207 250 254; --a-200: 165 243 252; --a-300: 103 232 249;
  --a-400: 34 211 238; --a-500: 6 182 212;   --a-600: 8 145 178;   --a-700: 14 116 144;
  --a-800: 21 94 117;  --a-900: 22 78 99;    --a-950: 8 51 68;
}
:root {
  /* neutra (slate) */
  --d-50: 248 250 252;  --d-100: 241 245 249; --d-200: 226 232 240; --d-300: 203 213 225;
  --d-400: 148 163 184; --d-500: 100 116 139; --d-600: 71 85 105;   --d-700: 51 65 85;
  --d-800: 30 41 59;    --d-900: 15 23 42;    --d-950: 2 6 23;
  --white: 255 255 255;

  /* ---------- 1.2 Status (fixos, não mudam com a paleta) ---------- */
  --st-success: #22c55e;  --st-success-2: #10b981; --st-success-btn: #16a34a; --st-success-btn-h: #15803d;
  --st-warn: #f59e0b;     --st-warn-2: #d97706;
  --st-danger: #dc2626;   --st-danger-2: #ef4444;  --st-danger-h: #b91c1c;
  --st-info: #3b82f6;
  --st-whats: #25D366;    --st-whats-h: #20BD5A;
  /* badges (claro) */
  --st-success-bg: #dcfce7; --st-success-fg: #15803d;
  --st-warn-bg: #fef3c7;    --st-warn-fg: #b45309;
  --st-danger-bg: #fee2e2;  --st-danger-fg: #b91c1c;
  --st-info-bg: #dbeafe;    --st-info-fg: #1d4ed8;
  /* caixas de alerta (claro) */
  --st-danger-box: #fef2f2; --st-danger-line: #fecaca; --st-danger-txt: #dc2626;
  --st-warn-box: #fffbeb;   --st-warn-txt: #92400e;
  --st-success-box: #ecfdf5; --st-success-txt: #047857; --st-success-ico: #059669;
  --st-info-box: #dbeafe;   --st-info-txt: #1d4ed8;
  /* ícones/valores dos StatsCards (claro) */
  --st-warn-ico: #d97706;   --st-warn-val: #b45309;
  --st-danger-ico: #dc2626; --st-danger-val: #b91c1c;
  /* seção do administrador (âmbar) */
  /* claro (fix6): título/itens/ativo com contraste >= 4,5:1 sobre o menu branco e o texto branco do ativo */
  --adm-title: #b45309; --adm-text: #92400e; --adm-hover: #fffbeb; --adm-active: #b45309;
  --theme-sun: #eab308;
  --avatar-bg: rgb(var(--p-600));

  /* ---------- 1.7 Sombras ---------- */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / .05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / .25);
  --shadow-primary: 0 10px 15px -3px rgb(var(--p-600) / .3), 0 4px 6px -4px rgb(var(--p-600) / .3);

  /* ---------- superfícies semânticas (claro) ---------- */
  --gc-bg: rgb(var(--d-50));
  --gc-surface: rgb(var(--white));
  --gc-surface-2: rgb(var(--d-50));          /* subcaixas dentro de card */
  --gc-sidebar: rgb(var(--white));
  --gc-border: rgb(var(--d-200));
  --gc-border-input: rgb(var(--d-300));
  --gc-input: rgb(var(--white));
  --gc-text-strong: rgb(var(--d-900));
  --gc-text: rgb(var(--d-800));
  --gc-label: rgb(var(--d-700));
  --gc-muted: rgb(var(--d-500));
  --gc-hover: rgb(var(--d-100));
  --gc-link: rgb(var(--p-600));

  /* ---------- ponte para as variáveis antigas do painel (CSS das telas usa var(--panel-*)) ---------- */
  --panel-primary: rgb(var(--p-600));
  --panel-primary-strong: rgb(var(--p-700));
  --panel-primary-soft: rgb(var(--p-500) / .12);
  --panel-secondary: rgb(var(--a-600));
  --panel-success: var(--st-success-btn);
  --panel-warning: var(--st-warn-2);
  --panel-danger: var(--st-danger);
  --panel-bg: var(--gc-bg);
  --panel-surface: var(--gc-surface);
  --panel-surface-soft: var(--gc-surface-2);
  --panel-text: var(--gc-text);
  --panel-muted: var(--gc-muted);
  --panel-border: var(--gc-border);
  --panel-border-soft: rgb(var(--d-100));
  --panel-shadow: var(--shadow-sm);
  --panel-shadow-lg: var(--shadow-xl);
  --panel-radius: 12px;
  --panel-radius-sm: 8px;
  --sx-accent: rgb(var(--p-600));
  --sx-accent-2: rgb(var(--a-600));
  color-scheme: light;
}
html.dark {
  --gc-bg: rgb(var(--d-900));
  --gc-surface: rgb(var(--d-800));
  --gc-surface-2: rgb(var(--d-900) / .45);
  --gc-sidebar: rgb(var(--d-900));
  --gc-border: rgb(var(--d-700));
  --gc-border-input: rgb(var(--d-600));
  --gc-input: rgb(var(--d-700));
  --gc-text-strong: rgb(var(--d-100));
  --gc-text: rgb(var(--d-100));
  --gc-label: rgb(var(--d-300));
  --gc-muted: rgb(var(--d-400));
  --gc-hover: rgb(var(--d-700));
  --gc-link: rgb(var(--p-400));

  --st-success-bg: rgb(20 83 45 / .3);  --st-success-fg: #86efac;
  --st-warn-bg: rgb(120 53 15 / .3);    --st-warn-fg: #fcd34d;
  --st-danger-bg: rgb(127 29 29 / .3);  --st-danger-fg: #fca5a5;
  --st-info-bg: rgb(30 58 138 / .3);    --st-info-fg: #93c5fd;
  --st-danger-box: rgb(127 29 29 / .2); --st-danger-line: rgb(127 29 29 / .5); --st-danger-txt: #fca5a5;
  --st-warn-box: rgb(120 53 15 / .2);   --st-warn-txt: #fde68a;
  --st-success-box: rgb(6 78 59 / .3);  --st-success-txt: #6ee7b7; --st-success-ico: #34d399;
  --st-info-box: rgb(30 58 138 / .3);   --st-info-txt: #93c5fd;
  --st-warn-ico: #fbbf24;   --st-warn-val: #fcd34d;
  --st-danger-ico: #f87171; --st-danger-val: #fca5a5;
  --adm-title: #f59e0b; --adm-text: #fcd34d; --adm-hover: rgb(120 53 15 / .2); --adm-active: #d97706;

  --panel-primary: rgb(var(--p-500));
  --panel-primary-strong: rgb(var(--p-600));
  --panel-primary-soft: rgb(var(--p-500) / .16);
  --panel-secondary: rgb(var(--a-400));
  --panel-border-soft: rgb(var(--d-700) / .6);
  --panel-shadow: 0 1px 2px 0 rgb(0 0 0 / .25);
  color-scheme: dark;
}

/* ---------- 1.8 Gradientes de marca ---------- */
.bg-brand-gradient { background-image: linear-gradient(135deg, rgb(var(--p-500)), rgb(var(--a-600))); }
.text-brand-gradient { background-image: linear-gradient(135deg, rgb(var(--p-400)), rgb(var(--a-500)));
  -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- 2. Base global ----------
   (O guia zera margin/padding de tudo; aqui NÃO, porque as telas usam o Bootstrap e
   dependem das margens dele. Só box-sizing.) */
*, *::before, *::after { box-sizing: border-box; }
html.panel-html { background: var(--gc-bg); transition: background-color .3s ease; }
html.panel-html body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-size: 14px; line-height: 1.5; letter-spacing: normal;
  background: transparent !important; color: var(--gc-text) !important; /* o fundo fica no <html>; o .theme-glow (z-index -1) aparece por cima dele */
  margin: 0; overflow: hidden;
  transition: background-color .3s ease, color .3s ease;
}
html.panel-html body a { color: var(--gc-link); text-decoration: none; }
html.panel-html body a:hover { color: rgb(var(--p-700)); }
html.dark.panel-html body a:hover { color: rgb(var(--p-300)); }
html.panel-html img { max-width: 100%; height: auto; }
html.panel-html button, html.panel-html input, html.panel-html select, html.panel-html textarea { font-family: inherit; }
::selection { background: rgb(var(--p-500) / .25); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgb(var(--d-100)); }
.dark ::-webkit-scrollbar-track { background: rgb(var(--d-800)); }
::-webkit-scrollbar-thumb { background: rgb(var(--d-300)); border-radius: 4px; }
.dark ::-webkit-scrollbar-thumb { background: rgb(var(--d-600)); }
::-webkit-scrollbar-thumb:hover { background: rgb(var(--p-400)); }
.dark ::-webkit-scrollbar-thumb:hover { background: rgb(var(--p-500)); }
* { scrollbar-color: rgb(var(--d-300)) transparent; }
.dark * { scrollbar-color: rgb(var(--d-600)) transparent; }

input[type="checkbox"], input[type="radio"], input[type="range"] { accent-color: rgb(var(--p-600)); }
:focus-visible { outline: none; box-shadow: 0 0 0 2px rgb(var(--p-500)); }
[hidden] { display: none !important; }

/* ---------- 3. Animações ---------- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.animate-fade-in { animation: fadeIn .3s ease-out; }
@keyframes page-enter { from { opacity: 0; } }
.page-enter { animation: page-enter .3s ease-out; }
@keyframes spin { to { transform: rotate(360deg); } }
.animate-spin { animation: spin 1s linear infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.animate-pulse { animation: pulse 2s cubic-bezier(.4,0,.6,1) infinite; }
.card-hover { transition: all .2s ease; }
.card-hover:hover { transform: translateY(-2px); box-shadow: 0 10px 25px -5px rgb(0 0 0 / .1); }
.press:active { transform: scale(.95); }
.skeleton {
  background-color: rgb(var(--d-200) / .7);
  background-image: linear-gradient(100deg, transparent 20%, rgb(var(--p-400) / .18) 50%, transparent 80%);
  background-size: 200% 100%; animation: skeleton-shine 1.4s ease-in-out infinite; border-radius: 8px;
}
.dark .skeleton { background-color: rgb(var(--d-700) / .6); }
@keyframes skeleton-shine { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.theme-glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    radial-gradient(55rem 38rem at 100% 0%, rgb(var(--p-500) / .12), transparent 60%),
    radial-gradient(48rem 34rem at 0% 100%, rgb(var(--a-500) / .10), transparent 60%);
}
.dark .theme-glow {
  background-image:
    radial-gradient(55rem 38rem at 100% 0%, rgb(var(--p-500) / .20), transparent 60%),
    radial-gradient(48rem 34rem at 0% 100%, rgb(var(--a-500) / .16), transparent 60%);
}
[data-glow] { position: relative; }
[data-glow]::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  opacity: 0; transition: opacity .25s ease;
  background: radial-gradient(380px circle at var(--gx,-999px) var(--gy,-999px), rgb(var(--p-500) / .08), transparent 45%);
}
.dark [data-glow]::after { background: radial-gradient(380px circle at var(--gx,-999px) var(--gy,-999px), rgb(var(--p-400) / .11), transparent 45%); }
[data-glow]:hover::after { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .skeleton, .page-enter, .animate-pulse, .animate-fade-in { animation: none !important; }
  .sidebar, .nav-items, .nav-item { transition: none !important; }
}

/* ---------- 4. Shell ---------- */
/* Sem isolation/z-index aqui: os modais do Bootstrap ficam dentro do .app e o fundo escuro
   (.modal-backdrop) vai no <body>; um contexto de empilhamento no .app prenderia o modal atrás dele. */
.app { position: relative; display: flex; height: 100vh; height: 100dvh;
  background: transparent; transition: background-color .3s; }
.app-col { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.app-main { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; scroll-behavior: smooth; }
@media (min-width: 1024px) { .app-main { padding: 24px; } }
/* algumas telas antigas pintam .page-content de branco com !important */
html.panel-html body main.app-main.page-content { background: transparent !important; }
.page-enter { display: flex; flex-direction: column; min-height: 100%; }
.page-enter > .page-body { flex: 1 0 auto; }

/* 4.1 Sidebar */
.sidebar { width: 256px; display: flex; flex-direction: column; background: var(--gc-sidebar); color: rgb(var(--d-900));
  border-right: 1px solid rgb(var(--d-200)); transition: transform .3s ease-in-out, background-color .3s; z-index: 50; flex-shrink: 0; }
.dark .sidebar { color: rgb(var(--white)); border-color: rgb(var(--d-800)); }
.side-logo { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid rgb(var(--d-200)); min-height: 72px; }
.dark .side-logo { border-color: rgb(var(--d-700)); }
@media (min-width: 1024px) { .side-logo { padding: 16px 24px; } }
.side-logo img { width: 40px; height: 40px; border-radius: 8px; object-fit: contain; flex-shrink: 0; }
.side-brand { min-width: 0; flex: 1; }
/* nome do painel: até 2 linhas sem cortar palavra no meio (fix6: nome longo cortado na gaveta do celular) */
.side-brand .side-name { margin: 0; font-size: 18px; line-height: 24px; font-weight: 700; color: inherit;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
@media (max-width: 1023.98px) { .side-brand .side-name { font-size: 16px; line-height: 20px; } }
.side-brand .side-sub { margin: 0; font-size: 12px; line-height: 16px; color: rgb(var(--d-500)); }
.dark .side-brand .side-sub { color: rgb(var(--d-400)); }
.side-close { display: none; place-items: center; width: 40px; height: 40px; padding: 8px; border-radius: 8px; border: 0;
  background: none; color: rgb(var(--d-600)); cursor: pointer; }
.side-close:hover { background: rgb(var(--d-100)); }
.dark .side-close { color: rgb(var(--d-300)); }
.dark .side-close:hover { background: rgb(var(--d-800)); }
.side-close svg { width: 20px; height: 20px; }
.side-nav { flex: 1; min-height: 0; padding: 12px; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 8px; }
@media (min-width: 1024px) { .side-nav { padding: 16px; } }
.sidebar-scroll { scrollbar-width: thin; scrollbar-color: rgb(var(--p-500) / .6) transparent; }
.sidebar-scroll::-webkit-scrollbar { width: 6px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: linear-gradient(180deg, rgb(var(--p-500)), rgb(var(--a-500))); border-radius: 999px; }
.side-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }

.nav-section-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-radius: 8px;
  font-size: 12px; line-height: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: rgb(var(--d-500)); transition: color .2s, background .2s; background: none; border: 0; cursor: pointer;
}
.dark .nav-section-btn { color: rgb(var(--d-400)); }
.nav-section-btn:hover { color: rgb(var(--d-700)); background: rgb(var(--d-100)); }
.dark .nav-section-btn:hover { color: rgb(var(--d-200)); background: rgb(var(--d-800) / .5); }
.nav-section-btn .sec-title { display: inline-flex; align-items: center; gap: 6px; }
.nav-section-btn svg { width: 14px; height: 14px; transition: transform .2s; }
.nav-section.closed .nav-section-btn svg.sec-chevron { transform: rotate(-90deg); }
.nav-items { overflow: hidden; max-height: 640px; opacity: 1; transition: max-height .2s, opacity .2s; margin-top: 4px; }
.nav-section.closed .nav-items { max-height: 0; opacity: 0; margin-top: 0; visibility: hidden; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-radius: 8px; font-size: 14px; line-height: 20px;
  color: rgb(var(--d-600)); text-decoration: none; transition: all .2s;
}
html.panel-html body .nav-item { color: rgb(var(--d-600)); }
html.dark.panel-html body .nav-item { color: rgb(var(--d-300)); }
html.panel-html body .nav-item:hover { background: rgb(var(--d-100)); color: rgb(var(--d-900)); }
html.dark.panel-html body .nav-item:hover { background: rgb(var(--d-800)); color: rgb(var(--white)); }
.nav-item:active { transform: scale(.95); }
.nav-item svg, .nav-item i[data-lucide] { flex-shrink: 0; width: 24px; height: 24px; }
.nav-item .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; font-size: inherit; font-weight: inherit; margin: 0; display: block; }
html.panel-html body .nav-item.active, html.dark.panel-html body .nav-item.active {
  background: rgb(var(--p-600)); color: rgb(var(--white));
  box-shadow: var(--shadow-primary);
}
.nav-tag { margin-left: auto; color: rgb(var(--white)); font-size: 10px; line-height: 14px; font-weight: 700; padding: 2px 6px; border-radius: 9999px; }
.nav-tag.new { background: var(--st-success); animation: pulse 2s infinite; }
.nav-tag.beta { background: rgb(var(--a-500)); }
.nav-count { margin-left: auto; color: rgb(var(--white)); font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 9999px; min-width: 20px; text-align: center; }
.nav-count.warn { background: var(--st-warn); }
.nav-count.info { background: rgb(var(--a-500)); }

/* seção do administrador (âmbar) */
.nav-section.admin { padding-top: 16px; border-top: 1px solid rgb(var(--d-200)); margin-top: 4px; }
.dark .nav-section.admin { border-color: rgb(var(--d-700) / .5); }
html.panel-html body .nav-section.admin .nav-section-btn { color: var(--adm-title); }
.nav-section.admin .nav-section-btn .sec-title svg { width: 12px; height: 12px; }
html.panel-html body .nav-section.admin .nav-item { color: var(--adm-text); }
html.panel-html body .nav-section.admin .nav-item:hover { background: var(--adm-hover); color: var(--adm-text); }
html.panel-html body .nav-section.admin .nav-item.active { background: var(--adm-active); color: rgb(var(--white));
  box-shadow: 0 10px 15px -3px rgb(217 119 6 / .3), 0 4px 6px -4px rgb(217 119 6 / .3); }

.side-footer { padding: 12px; border-top: 1px solid rgb(var(--d-200)); display: flex; flex-direction: column; gap: 8px; }
.dark .side-footer { border-color: rgb(var(--d-700)); }

.sidebar-overlay { position: fixed; inset: 0; background: rgb(0 0 0 / .5); z-index: 40; }
@media (min-width: 1024px) { .sidebar-overlay { display: none !important; } }
@media (max-width: 1023.98px) {
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 288px; max-width: 86vw; transform: translateX(-100%); box-shadow: var(--shadow-2xl); }
  .sidebar.open { transform: translateX(0); }
  .side-close { display: grid; }
}

/* 4.2 Header */
.app-header { height: 56px; flex-shrink: 0; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--gc-surface); border-bottom: 1px solid var(--gc-border); position: relative; z-index: 30; transition: background-color .3s; }
@media (min-width: 1024px) { .app-header { height: 64px; padding: 0 24px; } }
.hdr-left { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.hdr-burger { width: 40px; height: 40px; margin-left: -8px; border-radius: 8px; border: 0; background: none; display: grid; place-items: center;
  color: rgb(var(--d-700)); cursor: pointer; flex-shrink: 0; }
.dark .hdr-burger { color: rgb(var(--d-200)); }
.hdr-burger:hover { background: var(--gc-hover); }
.hdr-burger svg { width: 24px; height: 24px; }
@media (min-width: 1024px) { .hdr-burger { display: none; } }
.hdr-greet { min-width: 0; }
.hdr-hello { margin: 0; font-size: 16px; line-height: 24px; font-weight: 600; color: var(--gc-text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-date { margin: 0; font-size: 12px; line-height: 16px; color: var(--gc-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-hello .hello-long, .hdr-date { display: none; }
@media (min-width: 640px) {
  .hdr-hello .hello-short { display: none; }
  .hdr-hello .hello-long { display: inline; }
  .hdr-date { display: block; }
}
@media (min-width: 1024px) { .hdr-hello { font-size: 18px; line-height: 28px; } .hdr-date { font-size: 14px; line-height: 20px; } }
.hdr-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
@media (min-width: 640px) { .hdr-right { gap: 8px; } }
@media (min-width: 1024px) { .hdr-right { gap: 16px; } }
.hdr-chip { height: 36px; padding: 0 12px; border-radius: 9999px; align-items: center; gap: 6px; font-size: 12px; font-weight: 500;
  background: rgb(var(--p-500) / .1); color: rgb(var(--p-700)); white-space: nowrap; }
.dark .hdr-chip { background: rgb(var(--p-900) / .3); color: rgb(var(--p-300)); }
.hdr-chip svg { width: 16px; height: 16px; }
.hdr-icon-btn { width: 40px; height: 40px; border-radius: 8px; border: 0; background: none; display: grid; place-items: center; cursor: pointer;
  color: rgb(var(--d-600)); transition: background .2s; }
.hdr-icon-btn:hover { background: var(--gc-hover); }
.hdr-icon-btn svg { width: 20px; height: 20px; }
.theme-toggle .ic-sun { display: none; }
.dark .theme-toggle .ic-sun { display: block; color: var(--theme-sun); }
.dark .theme-toggle .ic-moon { display: none; }
.hdr-user { position: relative; }
.hdr-user-btn { display: flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none; cursor: pointer; color: var(--gc-text-strong); border-radius: 9999px; }
.hdr-avatar { width: 40px; height: 40px; border-radius: 9999px; display: grid; place-items: center; font-size: 14px; font-weight: 700;
  background: var(--avatar-bg); color: rgb(var(--white)); flex-shrink: 0; }
.hdr-user-name { display: none; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; }
@media (min-width: 640px) { .hdr-user-name { display: block; } }
.hdr-user-btn .hdr-chev { width: 16px; height: 16px; color: var(--gc-muted); transition: transform .2s; display: none; }
@media (min-width: 640px) { .hdr-user-btn .hdr-chev { display: block; } }
.hdr-user.open .hdr-chev { transform: rotate(180deg); }
.hdr-dropdown { position: absolute; right: 0; top: 100%; margin-top: 8px; width: 208px; z-index: 60;
  background: var(--gc-surface); border: 1px solid var(--gc-border); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 4px 0;
  animation: fadeIn .2s ease-out; }
.hdr-dd-top { padding: 8px 16px 10px; border-bottom: 1px solid var(--gc-border); margin-bottom: 4px; }
.hdr-dd-top strong { display: block; font-size: 14px; font-weight: 500; color: var(--gc-text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr-dd-top small { display: block; font-size: 12px; color: var(--gc-muted); }
html.panel-html body .hdr-dd-item { display: flex; align-items: center; gap: 8px; padding: 8px 16px; font-size: 14px; color: var(--gc-label); text-decoration: none; }
html.panel-html body .hdr-dd-item:hover { background: var(--gc-hover); color: var(--gc-text-strong); }
html.panel-html body .hdr-dd-item.danger { color: var(--st-danger); }
html.dark.panel-html body .hdr-dd-item.danger { color: var(--st-danger-ico); }
html.panel-html body .hdr-dd-item.danger:hover { background: var(--st-danger-box); }
.hdr-dd-item svg { width: 16px; height: 16px; }

/* 5.1 PageHeader */
.page-header { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
@media (min-width: 1024px) { .page-header { flex-direction: row; align-items: flex-start; justify-content: space-between; } }
.page-title { margin: 0; font-size: 24px; line-height: 32px; font-weight: 700; letter-spacing: -.01em;
  background: linear-gradient(to right, rgb(var(--p-600)), rgb(var(--a-700)));
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
@media (min-width: 768px) { .page-title { font-size: 30px; line-height: 36px; } }
.dark .page-title { background-image: linear-gradient(to right, rgb(var(--p-300)), rgb(var(--a-400))); }
.page-desc { margin: 4px 0 0; font-size: 14px; color: rgb(var(--d-500)); }
@media (min-width: 768px) { .page-desc { font-size: 16px; } }
.dark .page-desc { color: rgb(var(--d-400)); }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* rodapé da página (dentro do main) */
.app-footer { margin-top: 24px; padding: 16px 0 4px; border-top: 1px solid var(--gc-border); color: var(--gc-muted); }
.footer-premium { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; text-align: center; font-size: 12px; font-weight: 500; }
html.panel-html body .footer-premium a { display: inline-flex; align-items: center; gap: 4px; color: var(--gc-link); font-weight: 600; }
.footer-dot { color: rgb(var(--d-300)); }
.dark .footer-dot { color: rgb(var(--d-600)); }
@media (max-width: 639.98px) { .footer-dot { display: none; } }

.back-to-top { position: fixed; right: 16px; bottom: 16px; z-index: 35; width: 44px; height: 44px; border: 0; border-radius: 12px;
  display: grid; place-items: center; background: rgb(var(--p-600)); color: rgb(var(--white)); box-shadow: var(--shadow-primary);
  opacity: 0; visibility: hidden; transform: translateY(10px); transition: .2s ease; cursor: pointer; }
.back-to-top.show { opacity: 1; visibility: visible; transform: none; }
.back-to-top svg { width: 20px; height: 20px; }
.back-to-top .bx { font-size: 24px; }
body.modal-open .back-to-top, body.menu-open .back-to-top { opacity: 0; pointer-events: none; }

/* ---------- 6. Cards ---------- */
.card { background: var(--gc-surface); border: 1px solid var(--gc-border); border-radius: 12px; box-shadow: var(--shadow-sm);
  color: var(--gc-text); transition: background-color .3s, border-color .3s; }
.card.clickable { cursor: pointer; }
.card-title { font-size: 18px; line-height: 28px; font-weight: 600; color: var(--gc-text-strong); }

/* 6.2 StatsCard */
.stat { background: var(--gc-surface); border: 2px solid rgb(var(--d-200)); border-radius: 12px; padding: 16px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; transition: all .2s; text-align: left; width: 100%; }
.dark .stat { border-color: rgb(var(--d-700)); }
button.stat:hover { border-color: rgb(var(--d-300)); box-shadow: var(--shadow-md); cursor: pointer; }
.stat.active { border-color: transparent; box-shadow: 0 0 0 2px rgb(var(--white)), 0 0 0 4px rgb(var(--p-500)); }
.dark .stat.active { box-shadow: 0 0 0 2px var(--gc-bg), 0 0 0 4px rgb(var(--p-500)); }
.stat-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .025em; color: rgb(var(--d-500)); margin-bottom: 4px; }
.stat-value { font-size: 24px; line-height: 32px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gc-text-strong); }
.stat-hint { font-size: 12px; color: rgb(var(--d-500)); margin-top: 4px; }
.dark .stat-label, .dark .stat-hint { color: rgb(var(--d-400)); }
.stat-icon { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.stats-row { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 1024px) { .stats-row { grid-template-columns: repeat(4, 1fr); } }
/* acentos (classes reaproveitadas pela compat) */
.acc-primary .stat-icon, .stat-icon.acc-primary { background: rgb(var(--p-50)); color: rgb(var(--p-600)); }
.acc-primary .stat-value { color: rgb(var(--p-700)); }
.acc-success .stat-icon, .stat-icon.acc-success { background: var(--st-success-box); color: var(--st-success-ico); }
.acc-success .stat-value { color: var(--st-success-txt); }
.acc-warn .stat-icon, .stat-icon.acc-warn { background: var(--st-warn-box); color: var(--st-warn-ico); }
.acc-warn .stat-value { color: var(--st-warn-val); }
.acc-danger .stat-icon, .stat-icon.acc-danger { background: var(--st-danger-box); color: var(--st-danger-ico); }
.acc-danger .stat-value { color: var(--st-danger-val); }
.acc-neutral .stat-icon, .stat-icon.acc-neutral { background: rgb(var(--d-100)); color: rgb(var(--d-600)); }
.acc-neutral .stat-value { color: rgb(var(--d-800)); }
.dark .acc-primary .stat-icon, .dark .stat-icon.acc-primary { background: rgb(var(--p-900) / .3); color: rgb(var(--p-400)); }
.dark .acc-primary .stat-value { color: rgb(var(--p-300)); }
.dark .acc-neutral .stat-icon, .dark .stat-icon.acc-neutral { background: rgb(var(--d-700)); color: rgb(var(--d-300)); }
.dark .acc-neutral .stat-value { color: rgb(var(--d-100)); }

/* 6.3 EmptyState */
.empty-state { text-align: center; padding: 48px 16px; display: flex; flex-direction: column; align-items: center; }
.empty-state .empty-ico { width: 64px; height: 64px; border-radius: 16px; background: rgb(var(--d-100)); color: rgb(var(--d-400));
  display: grid; place-items: center; margin-bottom: 16px; font-size: 32px; }
.dark .empty-state .empty-ico { background: rgb(var(--d-700)); }
.empty-state h3, .empty-state h4, .empty-state h5, .empty-state .empty-title { font-size: 18px; font-weight: 600; color: var(--gc-text-strong); margin: 0 0 4px; }
.empty-state p { font-size: 14px; color: var(--gc-muted); max-width: 448px; margin: 0 auto 16px; }

/* ---------- 7. Botões (base) ---------- */
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: rgb(var(--d-700)); }
.btn-ghost:hover { background: rgb(var(--d-100)); }
.dark .btn-ghost { background: rgb(var(--d-700)); color: rgb(var(--d-300)); }

/* ---------- 8. Formulários (classes do guia) ---------- */
label.label, .form-label.label { display: block; font-size: 14px; font-weight: 500; color: var(--gc-label); margin-bottom: 4px; }
.field-error { margin-top: 4px; font-size: 12px; color: var(--st-danger-txt); display: flex; align-items: center; gap: 4px; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; color: rgb(var(--d-500)); pointer-events: none; }
.input-icon .form-control, .input-icon .input { padding-left: 40px; }

/* ---------- 12. Feedback: spinner de página ---------- */
.gc-spinner { width: 40px; height: 40px; border-radius: 9999px; border: 4px solid rgb(var(--p-200)); border-top-color: rgb(var(--p-600)); animation: spin 1s linear infinite; }
.dark .gc-spinner { border-color: rgb(var(--p-900)); border-top-color: rgb(var(--p-400)); }
.gc-note { padding: 8px 12px; border-radius: 8px; font-size: 12px; display: flex; gap: 8px; align-items: flex-start; }
.gc-note.warn { background: var(--st-warn-box); color: var(--st-warn-txt); }
.gc-note.error { background: var(--st-danger-box); border: 1px solid var(--st-danger-line); color: var(--st-danger-txt); }
.gc-note.info { color: rgb(var(--p-600)); padding-left: 0; }

/* ícones Lucide: tamanho padrão quando ainda não viraram SVG */
i[data-lucide] { display: inline-block; width: 1em; height: 1em; }
svg.lucide { flex-shrink: 0; }

/* trava a rolagem do main com a gaveta aberta */
body.menu-open .app-main { overflow: hidden; }
