/* ============================================================
   REDANTEC HUB — design system
   Camada visual carregada depois de style.css e responsive.css.
   Linguagem: superfícies em camadas, vidro só onde há flutuação
   (menu, barra do topo, busca, janelas, avisos, indicador em
   destaque), luz esmeralda sutil, bordas finas, Inter.
   Dois temas completos com os mesmos nomes de token:
   Dark Premium (padrão) e Light Premium ([data-theme="light"]).
   Componentes só usam tokens; nada de cor solta.
   ============================================================ */

/* ---------- tokens: Dark Premium ---------- */
:root {
  color-scheme: dark;

  /* acento Redantec */
  --accent-50: #00d6a3;
  --accent-500: #00b98a;
  --accent-700: #0a8f72;
  --accent-rgb: 0, 214, 163;

  /* fundo e superfícies */
  --background: #080a0d;
  --surface: #0f1217;           /* cartões e campos */
  --surface-elevated: #141820;  /* hover, cabeçalhos, menus */
  --surface-sunken: #0b0e12;    /* trilhos, áreas de fundo */
  --surface-glass: rgba(255, 255, 255, .035);
  --glass-strong: rgba(16, 19, 25, .8);
  --popover: rgba(18, 21, 28, .97);
  --glass-blur: 16px;
  --card-sheen: linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(255, 255, 255, 0) 60%);

  /* linhas */
  --border: rgba(255, 255, 255, .07);
  --border-strong: rgba(255, 255, 255, .12);
  --border-soft: rgba(255, 255, 255, .045);
  --border-glass: rgba(255, 255, 255, .08);

  /* texto */
  --text-primary: #eef1f5;
  --text-secondary: #9aa3b2;
  --text-muted: #6f7888;

  /* acento e estados */
  --accent: #00d6a3;
  --accent-hover: #2ee3b6;
  --accent-text: #3ee0b5;
  --accent-soft: rgba(0, 214, 163, .10);
  --accent-border: rgba(0, 214, 163, .18);
  --accent-glow: rgba(0, 214, 163, .28);
  --on-accent: #03140f;
  --success: #2fd39b;
  --warning: #f2b84b;
  --danger: #ff6b7a;
  --info: #6aa8ff;
  --violet: #a68bff;

  /* sombras */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .7);
  --shadow-hover: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 40px -16px rgba(0, 0, 0, .8);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .8), 0 2px 8px rgba(0, 0, 0, .4);
  --inner-light: inset 0 1px 0 rgba(255, 255, 255, .04);

  /* luz ambiente atrás das áreas principais */
  --ambient:
    radial-gradient(900px 520px at 100% -10%, rgba(0, 214, 163, .075), transparent 60%),
    radial-gradient(700px 520px at -10% 110%, rgba(64, 120, 255, .05), transparent 60%);

  /* forma */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 10px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --radius-xl: 16px;

  /* movimento */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur: .18s;

  /* tipografia */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Inter", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;

  /* ---- ponte para os nomes que style.css e as telas já usam ---- */
  --bg: var(--background); --canvas: var(--background);
  --surface-2: var(--surface-elevated); --surface-3: #1a1f28;
  --text: var(--text-primary); --muted: var(--text-secondary); --muted-2: var(--text-muted);
  --brand: var(--accent); --on-brand: var(--on-accent);
  --brand-hover: var(--accent-hover); --brand-active: var(--accent-500);
  --brand-soft: var(--accent-soft); --brand-ring: var(--accent-border);
  --accent-strong: var(--accent-text); --accent-deep: var(--accent-text); --accent-ink: var(--accent-text);
  --danger-soft: rgba(255, 107, 122, .10);
  --warning-soft: rgba(242, 184, 75, .10);
  --info-soft: rgba(106, 168, 255, .10);
  --violet-soft: rgba(166, 139, 255, .10);
  --sidebar: rgba(14, 17, 22, .72);
  --sidebar-hover: rgba(255, 255, 255, .04);
  --sidebar-active: var(--accent-soft);
  --sidebar-line: var(--border);
  --sidebar-text: var(--text-secondary); --sidebar-muted: var(--text-muted);
  --sidebar-icon: var(--text-muted); --sidebar-strong: var(--text-primary);
  --chip-text: #c6cdd8;
  --inverse-bg: var(--glass-strong); --inverse-text: var(--text-primary);
  --scrim: rgba(3, 5, 8, .62);
  --topbar-bg: rgba(14, 17, 22, .66);
  --scroll-thumb: rgba(255, 255, 255, .08); --scroll-thumb-hover: rgba(255, 255, 255, .16);
  --ring: 0 0 0 3px rgba(var(--accent-rgb), .22);
}

/* ---------- tokens: Light Premium ---------- */
:root[data-theme="light"] {
  color-scheme: light;

  --accent-rgb: 10, 143, 114;

  --background: #f5f7f9;
  --surface: #ffffff;
  --surface-elevated: #f8fafb;
  --surface-sunken: #eef1f4;
  --surface-glass: rgba(255, 255, 255, .72);
  --glass-strong: rgba(255, 255, 255, .86);
  --popover: rgba(255, 255, 255, .98);
  --card-sheen: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 1));

  --border: #e5e7eb;
  --border-strong: #d6dae0;
  --border-soft: #eef0f3;
  --border-glass: rgba(17, 24, 39, .08);

  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #8a919c;

  --accent: #0a8f72;
  --accent-hover: #087a61;
  --accent-text: #087a61;
  --accent-soft: rgba(0, 185, 138, .09);
  --accent-border: rgba(10, 143, 114, .2);
  --accent-glow: rgba(0, 185, 138, .22);
  --on-accent: #ffffff;
  --success: #0e9f6e;
  --warning: #b45309;
  --danger: #dc2645;
  --info: #2563eb;
  --violet: #6d4fd8;

  --shadow-sm: 0 1px 2px rgba(17, 24, 39, .04);
  --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 8px 24px -14px rgba(17, 24, 39, .14);
  --shadow-hover: 0 1px 2px rgba(17, 24, 39, .05), 0 14px 34px -14px rgba(17, 24, 39, .18);
  --shadow-lg: 0 28px 70px -20px rgba(17, 24, 39, .28), 0 2px 6px rgba(17, 24, 39, .06);
  --inner-light: inset 0 1px 0 rgba(255, 255, 255, .9);

  --ambient:
    radial-gradient(900px 520px at 100% -10%, rgba(0, 185, 138, .07), transparent 60%),
    radial-gradient(800px 560px at -10% 110%, rgba(64, 120, 255, .045), transparent 60%);

  --surface-3: #eef1f4;
  --danger-soft: rgba(220, 38, 69, .07);
  --warning-soft: rgba(217, 119, 6, .09);
  --info-soft: rgba(37, 99, 235, .07);
  --violet-soft: rgba(109, 79, 216, .07);
  --sidebar: rgba(255, 255, 255, .7);
  --sidebar-hover: rgba(17, 24, 39, .04);
  --chip-text: #374151;
  --scrim: rgba(17, 24, 39, .28);
  --topbar-bg: rgba(255, 255, 255, .7);
  --scroll-thumb: rgba(17, 24, 39, .12); --scroll-thumb-hover: rgba(17, 24, 39, .22);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2214%22 height=%2214%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23111827%22 stroke-opacity=%22.55%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpolyline points=%226 9 12 15 18 9%22/%3E%3C/svg%3E");
}

/* ============================================================
   Base
   ============================================================ */
html { background: var(--background); }
/* o fundo fica no <html>: o body é transparente para a luz ambiente (z-index -1) aparecer
   sem criar camadas que prendam o menu em gaveta atrás da película escura */
body {
  font-family: var(--font); font-size: 13.5px; line-height: 1.5; letter-spacing: -.006em;
  font-feature-settings: "cv11", "ss01", "tnum";
  background: transparent; color: var(--text-primary);
}
/* luz ambiente fixa atrás de tudo */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--ambient);
}
::selection { background: rgba(var(--accent-rgb), .28); color: var(--text-primary); }
a { color: var(--accent-text); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background-color: var(--scroll-thumb); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-thumb-hover); }
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }

/* transições do menu só depois da primeira pintura */
html:not(.pronto) .layout, html:not(.pronto) .sidebar, html:not(.pronto) .sidebar * { transition: none !important; }

/* troca de tema: revelação circular (View Transitions) ou cores deslizando */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
html.tema-trocando, html.tema-trocando *, html.tema-trocando *::before, html.tema-trocando *::after {
  transition: background-color .32s var(--ease), border-color .32s var(--ease), color .32s var(--ease), fill .32s var(--ease), box-shadow .32s var(--ease) !important;
}

/* ============================================================
   Movimento
   ============================================================ */
@keyframes hub-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes hub-drop { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes hub-pop { from { opacity: 0; transform: translateY(10px) scale(.97); filter: blur(2px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes hub-pop-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes hub-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes hub-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes hub-shimmer { 0% { background-position: 180% 0; } 100% { background-position: -80% 0; } }
@keyframes hub-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes hub-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes hub-spin { to { transform: rotate(360deg); } }
@keyframes hub-ping { 0% { transform: scale(1); opacity: .7; } 80%, 100% { transform: scale(2.4); opacity: 0; } }
@keyframes hub-sol { from { transform: rotate(-90deg) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* troca de tela: fade + 6px, curto, com leve cascata */
.vista-entra > * { animation: hub-in .22s var(--ease-out) both; }
.vista-entra > *:nth-child(2) { animation-delay: 40ms; }
.vista-entra > *:nth-child(3) { animation-delay: 80ms; }
.vista-entra > *:nth-child(n+4) { animation-delay: 110ms; }
.vista-entra .kpi-grid > .kpi { animation: hub-in .28s var(--ease-out) both; }
.vista-entra .kpi-grid > .kpi:nth-child(2) { animation-delay: 45ms; }
.vista-entra .kpi-grid > .kpi:nth-child(3) { animation-delay: 90ms; }
.vista-entra .kpi-grid > .kpi:nth-child(4) { animation-delay: 135ms; }
.vista-entra .kpi-grid > .kpi:nth-child(n+5) { animation-delay: 170ms; }
.vista-entra .table tbody tr { animation: hub-fade .3s var(--ease) both; }
.vista-entra .table tbody tr:nth-child(n+2) { animation-delay: 60ms; }
.vista-entra .table tbody tr:nth-child(n+6) { animation-delay: 110ms; }
.page-head { animation: hub-in .22s var(--ease-out) both; }

.progress > i, .orc-bar i, .ohk-bar i, .oma-pct, .qty-bar i, .stk-bar i { transform-origin: left center; animation: hub-grow .6s var(--ease-out) both; }

/* ============================================================
   Esqueleto de carregamento (formato de tela real)
   ============================================================ */
.skeleton {
  display: block;
  background: linear-gradient(100deg, var(--surface-sunken) 30%, var(--surface-elevated) 50%, var(--surface-sunken) 70%);
  background-size: 220% 100%; animation: hub-shimmer 1.4s ease-in-out infinite; border-radius: var(--radius-xs);
}
.carregando { display: flex; flex-direction: column; gap: 16px; min-width: 0; overflow: hidden; }
.carregando .sk-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.carregando .sk-kpi {
  display: flex; flex-direction: column; gap: 10px; padding: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.sk-ic { width: 32px; height: 32px; border-radius: var(--radius); margin-bottom: 6px; }
.sk-l1 { width: 55%; height: 22px; }
.sk-l2 { width: 75%; height: 10px; }
.sk-bar { display: flex; gap: 10px; min-width: 0; overflow: hidden; }
.sk-busca { height: 36px; flex: 0 1 340px; border-radius: var(--radius); }
.sk-chip { height: 36px; flex: 0 1 120px; min-width: 0; border-radius: var(--radius); }
.sk-tabela { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 6px 18px; }
.sk-linha { display: grid; grid-template-columns: 2.2fr 1fr 1fr .8fr; gap: 24px; align-items: center; height: 50px; border-bottom: 1px solid var(--border-soft); }
.sk-linha:last-child { border-bottom: 0; }
.sk-linha i { height: 10px; }
.sk-c1 { width: 70%; } .sk-c2 { width: 50%; } .sk-c3 { width: 60%; } .sk-c4 { width: 40%; justify-self: end; }

/* ============================================================
   Layout
   ============================================================ */
@media (min-width: 981px) {
  .layout { grid-template-columns: 268px minmax(0, 1fr); transition: grid-template-columns .3s var(--ease-out); }
  .layout.menu-curto { grid-template-columns: 84px minmax(0, 1fr); }
}
.main { background: transparent; min-width: 0; }
/* faixa fixa atrás da barra do topo: o conteúdo rolado some antes de chegar nela
   (sem isso os cartões aparecem no vão acima e dos lados da barra flutuante).
   Usa o mesmo fundo da página, preso à tela, para não aparecer emenda; a base esmaece. */
.main::before {
  content: ""; display: block; position: sticky; top: 0; z-index: 29;
  height: 84px; margin-bottom: -84px; pointer-events: none;
  background: var(--ambient), var(--background); background-attachment: fixed;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 14px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 14px), transparent);
}
@media (max-width: 980px) {
  .main::before { height: 64px; margin-bottom: -64px; }
}
@media print { .main::before { display: none; } }
.container { padding: 6px 32px 72px; max-width: 1440px; }

/* ---------- menu lateral (vidro) ---------- */
.sidebar {
  margin: 12px 0 12px 12px; top: 12px; height: calc(100vh - 24px);
  padding: 14px 12px 12px; gap: 0;
  background: var(--sidebar);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
  border: 1px solid var(--border-glass); border-radius: var(--radius-xl);
  box-shadow: var(--shadow), var(--inner-light);
  overflow-x: hidden;
}
.side-nav { display: flex; flex-direction: column; gap: 2px; }

.brand { padding: 2px 4px 14px 4px; gap: 10px; align-items: center; }
.brand-icon {
  width: 34px; height: 34px; border-radius: var(--radius); flex-shrink: 0;
  color: var(--on-accent);
  background: linear-gradient(145deg, var(--accent-50) 0%, var(--accent-700) 100%);
  box-shadow: 0 6px 18px -6px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .25);
}
:root[data-theme="light"] .brand-icon { color: #fff; }
.brand-icon svg { width: 18px; height: 18px; }
.brand-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; transition: opacity .2s var(--ease); }
.brand-name { font-size: 14.5px; font-weight: 700; letter-spacing: -.02em; color: var(--text-primary); }
.brand-hub { font-size: 10.5px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--accent-text); margin-top: 3px; }
.side-toggle {
  margin-left: auto; width: 30px; height: 30px; border-radius: var(--radius-sm); color: var(--text-muted);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform .3s var(--ease-out);
}
.side-toggle:hover { background: var(--sidebar-hover); color: var(--text-primary); }
.side-toggle:focus-visible { outline: none; box-shadow: var(--ring); }

.empresa-switch { padding: 0 0 8px; }
.empresa-switch select {
  height: 36px; border-radius: var(--radius); font-size: 13px; font-weight: 500;
  background-color: var(--surface-glass); border: 1px solid var(--border); color: var(--text-primary);
}
.empresa-switch select:hover { background-color: var(--sidebar-hover); border-color: var(--border-strong); }

.nav-label {
  margin: 16px 10px 6px; font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-muted); white-space: nowrap; overflow: hidden; transition: opacity .2s var(--ease);
}
.nav-label:first-child { margin-top: 4px; }

.nav-item {
  height: 36px; padding: 0 10px; gap: 11px; border-radius: var(--radius);
  font-size: 13.5px; font-weight: 500; color: var(--text-secondary);
  border: 1px solid transparent; position: relative; overflow: hidden;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.nav-item > span:first-child { display: inline-flex; flex-shrink: 0; }
.nav-item svg { width: 17px; height: 17px; color: var(--text-muted); transition: color var(--dur) var(--ease), transform .25s var(--ease-out); }
.nav-item:hover { background: var(--sidebar-hover); color: var(--text-primary); text-decoration: none; }
.nav-item:hover svg { color: var(--text-secondary); }
.nav-item:focus-visible { outline: none; box-shadow: var(--ring); }
.nav-txt { display: block !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; transition: opacity .18s var(--ease), max-width .3s var(--ease-out); }

/* ativo: vidro esmeralda sutil, borda fina e brilho pequeno (sem barra lateral) */
.nav-item.active:not(.nav-group-head) {
  background: var(--accent-soft); border-color: var(--accent-border); color: var(--text-primary); font-weight: 600;
  box-shadow: 0 0 22px -8px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .04);
}
.nav-item.active:not(.nav-group-head) svg { color: var(--accent-text); }
.nav-item.active:not(.nav-group-head)::after { display: none; }

/* grupos recolhíveis */
.nav-group { margin-top: 0; }
.nav-group-head .nav-chev { margin-left: auto; color: var(--text-muted); transition: transform .25s var(--ease-out), color var(--dur) var(--ease); }
.nav-group-head .nav-chev svg { width: 14px; height: 14px; }
.nav-group.open > .nav-group-head { color: var(--text-primary); }
.nav-group.open > .nav-group-head > span:first-child svg { color: var(--text-secondary); }
.nav-group.open > .nav-group-head .nav-chev { color: var(--accent-text); }
.nav-group.has-active:not(.open) > .nav-group-head { background: var(--accent-soft); color: var(--text-primary); }
.nav-group.has-active:not(.open) > .nav-group-head svg { color: var(--accent-text); }
.nav-group-items { transition: grid-template-rows .28s var(--ease-out); }
.nav-group-items > div { position: relative; gap: 2px; padding: 0; }
.nav-group.open .nav-group-items > div { padding: 3px 0 5px; }
.nav-group-items > div::before {
  content: ""; position: absolute; left: 18px; top: 4px; bottom: 6px; width: 1px; background: var(--border-strong);
}
.nav-group-items .nav-item {
  margin-left: 30px; width: calc(100% - 30px); padding-left: 10px; height: 33px; font-size: 13px; gap: 10px;
  opacity: 0; transform: translateX(-6px); overflow: visible;
  transition: opacity .2s var(--ease), transform .25s var(--ease-out), background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease), visibility 0s linear .2s;
}
.nav-group.open .nav-group-items .nav-item {
  opacity: 1; transform: none;
  transition: opacity .25s var(--ease), transform .3s var(--ease-out), background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease), visibility 0s;
}
.nav-group.open .nav-group-items .nav-item:nth-child(2) { transition-delay: 35ms, 35ms, 0s, 0s, 0s, 0s; }
.nav-group.open .nav-group-items .nav-item:nth-child(3) { transition-delay: 70ms, 70ms, 0s, 0s, 0s, 0s; }
.nav-group.open .nav-group-items .nav-item:nth-child(n+4) { transition-delay: 105ms, 105ms, 0s, 0s, 0s, 0s; }
.nav-group-items .nav-item svg { width: 15px; height: 15px; }
.nav-group-items .nav-item::before {
  content: ""; position: absolute; left: -13px; top: 50%; bottom: auto; width: 1px; height: 0;
  background: transparent; transform: translateY(-50%);
  transition: height .25s var(--ease-out), background var(--dur) var(--ease);
}
.nav-group-items .nav-item:hover::before { height: 14px; background: var(--text-muted); }
.nav-group-items .nav-item.active::before { left: -14px; width: 3px; height: 16px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }

/* cartão do usuário */
.user-area { margin-top: auto; padding-top: 12px; border-top: 0; }
.user-card {
  gap: 10px; padding: 8px; border-radius: var(--radius-md);
  background: var(--surface-glass); border: 1px solid var(--border);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.user-card:hover { background: var(--sidebar-hover); border-color: var(--border-strong); }
.user-ava, .top-ava {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--on-accent);
  background: linear-gradient(145deg, var(--accent-50), var(--accent-700));
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--accent-border);
}
:root[data-theme="light"] .user-ava, :root[data-theme="light"] .top-ava { color: #fff; }
.user-ava img, .top-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-info { min-width: 0; flex: 1; display: flex; align-items: center; gap: 6px; transition: opacity .2s var(--ease); }
.user-txt { min-width: 0; flex: 1; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-out { width: 30px; height: 30px; padding: 0; justify-content: center; border-radius: var(--radius-sm); color: var(--text-muted); }
.user-out:hover { color: var(--danger); background: var(--danger-soft); }

/* recolhido: só ícones, com a transição de largura e o texto esmaecendo */
@media (min-width: 981px) {
  .menu-curto .sidebar { padding: 14px 10px 12px; }
  .menu-curto .brand { flex-direction: column; gap: 10px; padding: 2px 0 12px; }
  .menu-curto .brand-txt { opacity: 0; position: absolute; pointer-events: none; }
  .menu-curto .side-toggle { margin: 0 auto; transform: rotate(180deg); }
  .menu-curto .nav-item { font-size: 13.5px; gap: 0; justify-content: center; padding: 0; height: 40px; }
  .menu-curto .nav-txt { opacity: 0; max-width: 0; }
  .menu-curto .nav-label { font-size: 0; height: 1px; margin: 10px 14px; background: var(--border); }
  .menu-curto .nav-label:first-child { display: none; }
  .menu-curto .nav-group-items > div::before { display: none; }
  .menu-curto .nav-group .nav-group-items .nav-item {
    margin-left: 0; width: 100%; padding: 0; height: 40px; opacity: 1; transform: none; visibility: visible;
    font-size: 13.5px; gap: 0; justify-content: center;
  }
  .menu-curto .nav-group-items .nav-item svg { width: 17px; height: 17px; }
  .menu-curto .nav-group-items .nav-item::before { display: none; }
  .menu-curto .nav-group::before { margin: 6px 14px; background: var(--border); }
  .menu-curto .user-card { justify-content: center; padding: 6px; background: none; border-color: transparent; }
  .menu-curto .user-info { opacity: 0; width: 0; flex: 0; overflow: hidden; }
  .menu-curto .empresa-switch { display: none; }
}

/* ---------- barra do topo (vidro, funde com o fundo) ---------- */
.topbar {
  position: sticky; top: 12px; z-index: 30;
  margin: 12px 24px 0 20px; min-height: 56px; padding: 8px 10px 8px 16px; gap: 12px;
  background: var(--topbar-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
  border: 1px solid var(--border-glass); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm), var(--inner-light);
}
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; }
.crumbs a { color: var(--text-muted); font-weight: 500; text-decoration: none; transition: color var(--dur) var(--ease); }
.crumbs a:hover { color: var(--text-primary); text-decoration: none; }
.crumbs strong { color: var(--text-primary); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.crumb-sep { display: inline-flex; color: var(--text-muted); opacity: .7; }

.top-search {
  display: flex; align-items: center; gap: 10px; height: 36px; width: min(340px, 34vw); padding: 0 8px 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-glass);
  color: var(--text-muted); font: inherit; font-size: 13px; cursor: pointer; text-align: left;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.top-search > span:first-child { display: inline-flex; }
.top-search svg { width: 15px; height: 15px; }
.top-search .ts-txt { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-search:hover { border-color: var(--border-strong); color: var(--text-secondary); background: var(--sidebar-hover); }
.top-search:focus-visible { outline: none; box-shadow: var(--ring); }
kbd {
  font-family: var(--font); font-size: 11px; font-weight: 500; line-height: 1; color: var(--text-secondary);
  padding: 4px 6px; border-radius: var(--radius-xs); border: 1px solid var(--border); background: var(--surface-elevated);
  box-shadow: inset 0 -1px 0 var(--border);
}

.top-tools { display: flex; align-items: center; gap: 4px; }
.top-btn {
  position: relative; width: 36px; height: 36px; border-radius: var(--radius); border: 1px solid transparent;
  display: grid; place-items: center; background: none; color: var(--text-secondary); cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease), transform .12s var(--ease);
}
.top-btn > span { display: inline-flex; }
.top-btn svg { width: 17px; height: 17px; }
.top-btn:hover { background: var(--sidebar-hover); border-color: var(--border); color: var(--text-primary); }
.top-btn:active { transform: scale(.94); }
.top-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.theme-ic { animation: hub-sol .45s var(--ease-out) both; }
.top-ava { border: 0; cursor: pointer; margin-left: 6px; transition: transform .2s var(--ease-out), box-shadow var(--dur) var(--ease); }
.top-ava:hover { transform: scale(1.06); }
.top-ava:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }

/* avisos */
.notif-wrap { position: relative; }
.notif-dot {
  position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger); box-shadow: 0 0 0 2px var(--surface);
}
.notif-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--danger); animation: hub-ping 2s var(--ease-out) infinite; }
.notif-pop {
  position: absolute; right: -6px; top: calc(100% + 10px); width: 340px; z-index: 50; overflow: hidden;
  /* dentro da barra de vidro o desfoque não alcança a página: fundo quase opaco */
  background: var(--popover);
  -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--border-glass); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); animation: hub-drop .2s var(--ease-out) both;
}
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 12px 10px 16px; min-height: 48px; }
.notif-head > div { display: flex; align-items: baseline; gap: 8px; }
.notif-head strong { font-size: 13.5px; font-weight: 600; }
.notif-head span { font-size: 12px; color: var(--text-muted); }
.notif-ler {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 9px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: none; color: var(--accent-text); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.notif-ler:hover { background: var(--accent-soft); border-color: var(--accent-border); }
.notif-ler:focus-visible { outline: none; box-shadow: var(--ring); }
.notif-novo { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); flex-shrink: 0; }
.notif-item.lido .notif-tx b { font-weight: 500; color: var(--text-secondary); }
.notif-item.lido .notif-ic { opacity: .6; }
.notif-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; color: var(--text-primary); text-decoration: none;
  border-top: 1px solid var(--border-soft); transition: background var(--dur) var(--ease);
}
.notif-item:hover { background: var(--sidebar-hover); text-decoration: none; }
.notif-ic { width: 32px; height: 32px; border-radius: var(--radius); display: grid; place-items: center; flex-shrink: 0; }
.notif-ic.down { background: var(--danger-soft); color: var(--danger); }
.notif-ic.warn { background: var(--warning-soft); color: var(--warning); }
.notif-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.notif-tx b { font-size: 13px; font-weight: 600; }
.notif-tx small { font-size: 12px; color: var(--text-muted); }
.notif-go { color: var(--text-muted); display: inline-flex; }
.notif-vazio { display: flex; align-items: center; gap: 10px; padding: 14px 16px 18px; color: var(--text-secondary); font-size: 13px; border-top: 1px solid var(--border-soft); }
.notif-vazio svg { color: var(--accent-text); }

/* ---------- cabeçalho da página ---------- */
.page-head {
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  padding: 26px 32px 18px; max-width: 1440px;
}
.page-head .grow { flex: 1; min-width: 220px; }
.page-title { font-family: var(--display); font-size: 28px; font-weight: 650; letter-spacing: -.03em; line-height: 1.15; color: var(--text-primary); }
.page-sub { font-size: 13.5px; color: var(--text-secondary); margin-top: 6px; }
.page-sub:empty { display: none; }
.sub-data { color: var(--text-muted); }
.page-head .btn-group { gap: 8px; }

/* ============================================================
   Botões
   ============================================================ */
.btn {
  height: 36px; padding: 0 14px; gap: 7px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600; letter-spacing: -.008em; border: 1px solid transparent;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform .16s var(--ease-out), opacity var(--dur) var(--ease);
}
.btn svg { width: 15px; height: 15px; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.98); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* primário: esmeralda */
.btn-primary {
  color: var(--on-accent);
  background: linear-gradient(180deg, var(--accent-50), var(--accent-500));
  border-color: rgba(var(--accent-rgb), .5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 6px 16px -8px var(--accent-glow);
}
:root[data-theme="light"] .btn-primary { background: linear-gradient(180deg, #0c9b7b, var(--accent-700)); border-color: var(--accent-700); }
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--accent-hover), var(--accent-50));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 10px 22px -8px var(--accent-glow);
}
:root[data-theme="light"] .btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, var(--accent-700), #087a61); }
.btn-primary:active:not(:disabled) { background: var(--accent-500); }
.btn-primary:focus-visible { box-shadow: var(--ring), inset 0 1px 0 rgba(255, 255, 255, .22); }

/* secundário: superfície de vidro */
.btn-ghost {
  background: var(--surface-glass); color: var(--text-primary); border-color: var(--border-strong);
  box-shadow: var(--inner-light);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
:root[data-theme="light"] .btn-ghost { background: var(--surface); box-shadow: var(--shadow-sm); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-elevated); border-color: var(--border-strong); }
.btn-ghost:active:not(:disabled) { background: var(--surface-3); }

/* terciário: transparente */
.btn-tertiary { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-tertiary:hover:not(:disabled) { background: var(--sidebar-hover); color: var(--text-primary); }

/* perigo: vermelho sutil */
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(255, 107, 122, .22); }
.btn-danger:hover:not(:disabled) { background: rgba(255, 107, 122, .16); }

/* carregando: troca o conteúdo por um anel girando */
.btn.is-loading { color: transparent !important; pointer-events: none; position: relative; }
.btn.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--text-secondary) transparent var(--text-secondary) transparent;
  animation: hub-spin .7s linear infinite;
}
.btn-primary.is-loading::after { border-color: var(--on-accent) transparent var(--on-accent) transparent; }

.btn-mini { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: var(--radius-sm); }
.icon-btn {
  width: 30px; height: 30px; border-radius: var(--radius-sm); color: var(--text-muted);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform .12s var(--ease);
}
.icon-btn:hover { color: var(--text-primary); background: var(--sidebar-hover); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.emerald:hover { color: var(--accent-text); background: var(--accent-soft); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }

/* ============================================================
   Cartões
   ============================================================ */
.card, .obra-card {
  background: var(--card-sheen), var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm), var(--inner-light);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform .2s var(--ease-out);
}
.card:hover { border-color: var(--border-strong); }
.obra-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--border-soft); }
.card-head h3, .section-head h3, .modal-head h3, .obra-card h3 { font-family: var(--display); font-size: 14.5px; font-weight: 600; letter-spacing: -.015em; }
.card-head .sub, .section-head .sub { font-size: 12.5px; color: var(--text-muted); }
.section-head { border-bottom-color: var(--border-soft); }

/* ============================================================
   Indicadores
   ============================================================ */
.kpi-grid { gap: 14px; background: transparent; border: 0; border-radius: 0; overflow: visible; box-shadow: none !important; margin-bottom: 20px; }
:root[data-theme="light"] .kpi-grid { box-shadow: none !important; }
.kpi-grid .kpi {
  position: relative; overflow: hidden; container-type: inline-size;
  background: var(--card-sheen), var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 18px 16px; box-shadow: var(--shadow-sm), var(--inner-light);
  transition: border-color var(--dur) var(--ease), box-shadow .22s var(--ease), transform .22s var(--ease-out), background var(--dur) var(--ease);
}
.kpi-grid .kpi-click, .kpi-grid button.kpi { cursor: pointer; }
.kpi-grid .kpi-click:hover, .kpi-grid button.kpi:hover:not(.kpi-on) {
  background: var(--card-sheen), var(--surface); border-color: var(--border-strong);
  box-shadow: var(--shadow-hover), var(--inner-light); transform: translateY(-2px);
}
.kpi-grid .kpi:focus-visible { outline: none; box-shadow: var(--ring); }
.kpi-grid .kpi.kpi-on {
  background: linear-gradient(180deg, var(--accent-soft), transparent), var(--surface);
  border-color: var(--accent-border); box-shadow: 0 0 0 1px var(--accent-border), 0 10px 28px -16px var(--accent-glow);
}
.kpi-label, .kpi-label-l { font-size: 12.5px; color: var(--text-secondary); font-weight: 500; }
.kpi-label-l { margin-top: 4px; }
.kpi-value, .kpi-min .kpi-value {
  font-family: var(--font); font-size: 26px; font-weight: 650; letter-spacing: -.035em; line-height: 1.15;
  font-variant-numeric: tabular-nums; color: var(--text-primary); white-space: nowrap;
}
@supports (font-size: 1cqi) {
  .kpi-grid .kpi-value { font-size: clamp(17px, 11cqi, 26px); }
  .kpi-grid.kpi-min .kpi-value { font-size: clamp(16px, 10cqi, 22px); }
}
.kpi-value small { font-size: 12px; font-weight: 500; color: var(--text-muted); letter-spacing: 0; }
.kpi-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.kpi-sub .up { color: var(--success); } .kpi-sub .down { color: var(--danger); } .kpi-sub .warn { color: var(--warning); }

.kpi-ic {
  width: 34px; height: 34px; border-radius: var(--radius); display: grid; place-items: center; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent-text); border: 1px solid var(--accent-border);
  transition: transform .35s var(--ease-out);
}
.kpi-ic svg { width: 17px; height: 17px; }
.kpi:hover .kpi-ic { transform: translateY(-1px) rotate(-6deg); }
.kpi-com-ic .kpi-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.kpi-pill {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--radius-xs);
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--text-secondary);
}
.kpi-pill.up { background: rgba(var(--accent-rgb), .12); color: var(--accent-text); }
.kpi-pill.down { background: var(--danger-soft); color: var(--danger); }
.kpi-pill.warn { background: var(--warning-soft); color: var(--warning); }

/* indicador em destaque: vidro com luz esmeralda (o verde é luz, não fundo) */
.kpi-grid .kpi.kpi-destaque {
  background:
    radial-gradient(130% 120% at 100% 0%, rgba(var(--accent-rgb), .16), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, 0)),
    var(--surface);
  border-color: var(--accent-border);
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), .04), 0 14px 34px -18px var(--accent-glow), var(--inner-light);
}
.kpi-grid .kpi.kpi-destaque::before {
  content: ""; position: absolute; left: 18px; right: 18px; top: 0; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), .7), transparent);
}
.kpi-grid .kpi.kpi-destaque:hover { border-color: rgba(var(--accent-rgb), .3); box-shadow: 0 18px 40px -18px var(--accent-glow), var(--inner-light); }
.kpi-destaque .kpi-ic { background: rgba(var(--accent-rgb), .16); box-shadow: 0 0 18px -4px var(--accent-glow); }
.kpi-destaque > * { position: relative; }

/* ============================================================
   Tabelas
   ============================================================ */
.table-wrap.card { overflow-x: auto; }
.table { font-size: 13px; }
.table th {
  height: 40px; padding: 0 16px; background: transparent !important;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.table td { height: 52px; padding: 10px 16px; border-bottom: 1px solid var(--border-soft); }
.table tbody tr { transition: background var(--dur) var(--ease); }
.table tbody tr:hover td { background: rgba(var(--accent-rgb), .025); }
:root[data-theme="light"] .table tbody tr:hover td { background: #f8fafb; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .row-acoes { opacity: .55; transition: opacity var(--dur) var(--ease); }
.table tbody tr:hover .row-acoes, .table .row-acoes:focus-within { opacity: 1; }
.tr-vazio td, .tr-vazio:hover td { height: auto !important; background: transparent !important; }
.cell-strong { font-weight: 600; color: var(--text-primary); }
.cell-soft { color: var(--text-muted); font-size: 12px; }
.table .mono { font-family: var(--mono); font-size: 11.5px; color: var(--text-muted); }

/* listas que não são tabela */
.list-row, .orc-row, .dash-row, .oma-head { transition: background var(--dur) var(--ease); border-bottom-color: var(--border-soft) !important; }
.list-row:hover, .orc-row:hover, .dash-row:hover, .oma-head:hover { background: rgba(var(--accent-rgb), .025); }
:root[data-theme="light"] .list-row:hover, :root[data-theme="light"] .orc-row:hover,
:root[data-theme="light"] .dash-row:hover, :root[data-theme="light"] .oma-head:hover { background: #f8fafb; }

/* status pequenos: ponto + texto */
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; color: var(--text-secondary); white-space: nowrap; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.status.ok { color: var(--success); }
.status.warn { color: var(--warning); }
.status.danger { color: var(--danger); }
.status.ok i { box-shadow: 0 0 0 3px rgba(47, 211, 155, .14); }
.status.warn i { box-shadow: 0 0 0 3px var(--warning-soft); }
.status.danger i { box-shadow: 0 0 0 3px var(--danger-soft); }

/* selos */
.badge { height: 22px; padding: 0 8px; border-radius: var(--radius-xs); font-size: 11.5px; font-weight: 600; letter-spacing: 0; gap: 5px; }
.badge-emerald { background: rgba(var(--accent-rgb), .1); color: var(--accent-text); }
.badge-zinc { background: var(--surface-3); color: var(--chip-text); }

/* estoque */
.stk-mat { gap: 12px; }
.stk-ava {
  width: 32px; height: 32px; border-radius: var(--radius); flex-shrink: 0; display: grid; place-items: center;
  background: var(--surface-elevated); border: 1px solid var(--border); color: var(--text-muted);
}
.stk-cat { display: inline-flex; height: 22px; align-items: center; padding: 0 8px; border-radius: var(--radius-xs); background: var(--surface-3); color: var(--chip-text); font-size: 12px; font-weight: 500; }
.stk-saldo.ok { color: var(--text-primary); }
.stk-bar { background: var(--surface-3); }
.stk-bar.ok i { background: var(--accent); }

/* ============================================================
   Filtros e busca das telas
   ============================================================ */
.filtros {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
  padding: 10px; border-radius: var(--radius-lg);
  background: var(--surface-glass); border: 1px solid var(--border);
}
:root[data-theme="light"] .filtros { background: var(--surface); box-shadow: var(--shadow-sm); }
.filtros-busca { flex: 1 1 280px; max-width: 380px; }
.filtros-busca input { width: 100% !important; }
.filtros-campos { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filtro-sel { display: inline-flex; align-items: center; position: relative; }
.filtro-sel > span {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%); pointer-events: none;
  font-size: 12px; color: var(--text-muted); font-weight: 500;
}
.filtro-sel select { height: 36px; padding-left: 76px; min-width: 170px; font-weight: 500; }
.filtros-info { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 12.5px; color: var(--text-muted); }
.filtros-contagem { font-variant-numeric: tabular-nums; white-space: nowrap; }
.stock-scope { font-size: 12.5px; color: var(--text-muted); }
.stock-scope strong { color: var(--text-primary); font-weight: 600; }

.toolbar .searchbox input, .searchbox input { height: 36px; }
.searchbox svg { left: 11px; color: var(--text-muted); }
.searchbox input { padding-left: 34px; }

/* filtros em pílula (chips) viram um controle segmentado */
.chips { gap: 2px; padding: 3px; border-radius: var(--radius); background: var(--surface-sunken); border: 1px solid var(--border); display: inline-flex; }
.chip {
  height: 30px; border-radius: var(--radius-sm); border: 1px solid transparent; color: var(--text-secondary); font-weight: 500;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.chip:hover { color: var(--text-primary); background: var(--sidebar-hover); }
.chip.active { background: var(--surface); color: var(--text-primary); border-color: var(--border); box-shadow: var(--shadow-sm), var(--inner-light); font-weight: 600; }
.chip.active .num { color: var(--accent-text); }
.pay-toggle { background: var(--surface-sunken); border: 1px solid var(--border); }

/* abas de Cadastros */
.module-card { transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.module-card.active { color: var(--text-primary); border-bottom-color: var(--accent); }
.module-card.active .module-count { background: rgba(var(--accent-rgb), .12); color: var(--accent-text); }

/* ============================================================
   Formulários
   ============================================================ */
input, select, textarea {
  border-radius: var(--radius); border: 1px solid var(--border-strong);
  background-color: var(--surface-sunken); color: var(--text-primary);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
:root[data-theme="light"] input, :root[data-theme="light"] select, :root[data-theme="light"] textarea { background-color: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:hover:not(:disabled):not(:focus), select:hover:not(:disabled):not(:focus), textarea:hover:not(:disabled):not(:focus) { border-color: var(--text-muted); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .12);
  background-color: var(--surface);
}
input:disabled, select:disabled, textarea:disabled { background-color: var(--surface-3); color: var(--text-muted); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
/* erro: campo inválido depois que a pessoa mexeu */
input:user-invalid, select:user-invalid, textarea:user-invalid, .is-invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 3px var(--danger-soft) !important; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--text-secondary); }
.field .hint, .hint { font-size: 12px; color: var(--text-muted); }
.field-erro { font-size: 12px; color: var(--danger); }
.dropzone { border-radius: var(--radius-lg); border-color: var(--border-strong); background: var(--surface-sunken); transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.editor-wrap { border-radius: var(--radius-md); border-color: var(--border); }
.editor-row { border-bottom-color: var(--border-soft) !important; }
.editor-row.head { background: var(--surface-elevated); }

/* listas suspensas (autocompletar, seletor de material) */
.picker-results, .ta-list {
  background: var(--glass-strong) !important;
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border: 1px solid var(--border-glass) !important; border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important; animation: hub-drop .18s var(--ease-out) both;
}
.picker-item, .ta-item { border-radius: var(--radius-sm); transition: background .12s var(--ease); }
.picker-item:hover, .picker-item.active, .ta-item:hover, .ta-item:focus { background: rgba(var(--accent-rgb), .08); }

/* ============================================================
   Janelas (modais)
   ============================================================ */
.overlay { background: var(--scrim); }
.overlay.open {
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: hub-fade .2s var(--ease) both;
}
.overlay.saindo { animation: hub-fade-out .16s var(--ease) both; }
.modal {
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--border-glass); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), var(--inner-light);
  animation: hub-pop .24s var(--ease-out) both;
}
.overlay.saindo .modal { animation: hub-pop-out .16s var(--ease) both; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border-soft); }
.modal-head h3 { font-size: 15px; }
.modal-body { padding: 20px; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--border-soft);
  background: rgba(var(--accent-rgb), .015); border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}
:root[data-theme="light"] .modal-foot { background: var(--surface-elevated); }
.modal.obra-view .obra-hero, .modal.obra-view .ohk { background: transparent; }

/* ============================================================
   Busca rápida (Ctrl+K)
   ============================================================ */
.cmdk {
  background: var(--scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: hub-fade .18s var(--ease) both;
}
.cmdk.saindo { animation: hub-fade-out .14s var(--ease) both; }
.cmdk-box {
  max-width: 640px; border-radius: var(--radius-xl);
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(28px) saturate(1.5); backdrop-filter: blur(28px) saturate(1.5);
  border: 1px solid var(--border-glass); box-shadow: var(--shadow-lg), var(--inner-light);
  animation: hub-pop .22s var(--ease-out) both;
}
.cmdk.saindo .cmdk-box { animation: hub-pop-out .14s var(--ease) both; }
.cmdk-top { padding: 0 18px; border-bottom-color: var(--border-soft); }
.cmdk-top input { height: 58px; font-size: 15px; }
.cmdk-titulo { font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); padding: 12px 10px 6px; }
.cmdk-item { min-height: 42px; border-radius: var(--radius); border: 1px solid transparent; transition: background .1s var(--ease); font-size: 13.5px; }
.cmdk-item.on { background: var(--accent-soft); border-color: var(--accent-border); }
.cmdk-item.on .cmdk-ic { color: var(--accent-text); }
.cmdk-pe { background: transparent; border-top-color: var(--border-soft); }

/* ============================================================
   Avisos rápidos (toasts) e estados vazios
   ============================================================ */
.toast {
  background: var(--glass-strong); color: var(--text-primary);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border: 1px solid var(--border-glass); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); animation: hub-drop .24s var(--ease-out) both;
}
.toast.success svg { color: var(--success); }
.toast.error svg { color: var(--danger); }
.toast.info svg { color: var(--info); }

.empty { padding: 44px 24px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.empty > svg { display: none; }
.empty-ic {
  width: 44px; height: 44px; border-radius: var(--radius-md); display: grid; place-items: center; margin-bottom: 14px;
  background: var(--surface-elevated); border: 1px solid var(--border); color: var(--text-muted);
  box-shadow: var(--inner-light);
}
.empty-ic svg { width: 20px; height: 20px; margin: 0; color: inherit; }
.empty h4 { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.empty p { font-size: 13px; color: var(--text-muted); max-width: 46ch; }
.empty .btn { margin-top: 16px; }
.dash-empty { color: var(--text-muted); }
.tela-erro { border-radius: var(--radius-lg); }

/* ============================================================
   Painel (visão geral)
   ============================================================ */
.dash-cols { gap: 14px; }
.dash-date { border-radius: var(--radius); background: var(--surface-elevated); border-color: var(--border); }
.dash-more { border-top-color: var(--border-soft); color: var(--text-secondary); transition: color var(--dur) var(--ease), background var(--dur) var(--ease); }
.dash-more:hover { color: var(--accent-text); background: rgba(var(--accent-rgb), .03); text-decoration: none; }

/* ============================================================
   Gráficos
   ============================================================ */
.pg-grid { stroke: var(--border-soft); stroke-dasharray: 2 4; }
.pg-eixo { fill: var(--text-muted); font-family: var(--font); font-size: 11px; }
.pg-linha { stroke-dasharray: 1; animation: hub-draw .9s var(--ease-out) both; }
.pg-area-fill { animation: hub-fade .9s var(--ease) .15s both; }
.pg-tip {
  background: var(--glass-strong) !important; color: var(--text-primary) !important;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass) !important; border-radius: var(--radius) !important; box-shadow: var(--shadow-lg);
}
.pg-mira { stroke: var(--border-strong); }
.pg-ponto { fill: var(--surface); }

/* ============================================================
   Login
   ============================================================ */
.login-root { background: var(--background); }
.login-root::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(600px 400px at 50% 0%, rgba(var(--accent-rgb), .12), transparent 70%),
    var(--ambient);
}
.login-card {
  position: relative; max-width: 380px; padding: 32px 28px 28px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--border-glass); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), var(--inner-light);
  animation: hub-pop .35s var(--ease-out) both;
}
.login-ico {
  width: 40px; height: 40px; border-radius: var(--radius-md); margin-bottom: 18px; color: var(--on-accent);
  background: linear-gradient(145deg, var(--accent-50), var(--accent-700));
  box-shadow: 0 8px 22px -8px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .25);
}
:root[data-theme="light"] .login-ico { color: #fff; }
.login-brand { font-size: 12px; font-weight: 700; letter-spacing: -.01em; color: var(--text-secondary); margin-bottom: 4px; }
.login-brand span { color: var(--accent-text); letter-spacing: .16em; text-transform: uppercase; font-size: 10.5px; margin-left: 2px; }
.login-title { font-size: 22px; font-weight: 650; letter-spacing: -.025em; }
.login-sub { color: var(--text-secondary); }
.login-field label { font-size: 12.5px; color: var(--text-secondary); }
.login-field input { height: 40px; }
.login-btn {
  height: 40px; border-radius: var(--radius); font-weight: 600; color: var(--on-accent);
  background: linear-gradient(180deg, var(--accent-50), var(--accent-500));
  border: 1px solid rgba(var(--accent-rgb), .5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 8px 20px -10px var(--accent-glow);
  transition: transform .16s var(--ease-out), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
:root[data-theme="light"] .login-btn { background: linear-gradient(180deg, #0c9b7b, var(--accent-700)); }
.login-btn:hover:not(:disabled) { transform: translateY(-1px); background: linear-gradient(180deg, var(--accent-hover), var(--accent-50)); }
:root[data-theme="light"] .login-btn:hover:not(:disabled) { background: linear-gradient(180deg, var(--accent-700), #087a61); }

/* ============================================================
   Celular e tablet
   ============================================================ */
@media (max-width: 980px) {
  /* a coluna do conteúdo nunca passa da tela (tabelas rolam dentro do cartão) */
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    margin: 0; top: 0; height: 100vh; height: 100dvh; width: 280px;
    border-radius: 0 var(--radius-xl) var(--radius-xl) 0; border-left: 0;
    background: var(--popover);
    transition: transform .28s var(--ease-out);
  }
  .topbar { margin: 8px 8px 0; top: 8px; padding: 6px 8px; gap: 8px; }
  .menu-toggle { display: grid; width: 36px; height: 36px; }
  .top-search { width: 36px; padding: 0; justify-content: center; border-color: transparent; background: none; }
  .top-search .ts-txt, .top-search kbd { display: none; }
  .crumbs > a, .crumbs > span, .crumb-sep { display: none; }
  .page-head { padding: 18px 16px 12px; }
  .container { padding: 4px 16px 72px; }
}
@media (max-width: 900px) {
  .topbar { flex-wrap: nowrap; }
  .page-title { font-size: 22px; }
  .page-head .btn-group:not(:empty) { width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .page-head .btn-group .btn { flex: 1 0 auto; }
  .top-btn, .top-search { width: 40px; height: 40px; }
  .filtros-busca { max-width: none; flex-basis: 100%; }
  .filtros-campos { width: 100%; }
  .filtro-sel { flex: 1 1 160px; }
  .filtro-sel select { width: 100%; }
  .filtros-info { margin-left: 0; width: 100%; justify-content: space-between; }
  .notif-pop { position: fixed; left: 8px; right: 8px; top: 72px; width: auto; }
  .table .row-acoes { opacity: 1; }
}
@media (max-width: 560px) {
  .kpi-grid .kpi { padding: 14px; }
  .kpi-com-ic .kpi-top { margin-bottom: 10px; }
  .kpi-ic { width: 30px; height: 30px; }
  .page-head { padding: 16px 12px 10px; }
  .container { padding: 2px 10px 80px; }
}

/* ============================================================
   Acessibilidade e impressão
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  :root, :root[data-theme="light"] {
    color-scheme: light;
    --background: #fff; --surface: #fff; --surface-elevated: #fafafa; --surface-3: #f2f2f4; --surface-sunken: #f6f6f6;
    --border: #e2e2e6; --border-soft: #eee; --border-strong: #cfcfd5;
    --text-primary: #18181b; --text-secondary: #55555e; --text-muted: #85858e;
    --accent: #0a8f72; --accent-text: #0a8f72; --danger: #b42340; --warning: #8a4b04;
    --glass-strong: #fff; --card-sheen: none; --ambient: none;
  }
  body::before { display: none; }
  .topbar, .page-head .btn-group, .filtros { display: none !important; }
  .card, .kpi-grid .kpi, .modal { box-shadow: none !important; backdrop-filter: none !important; }
  .vista-entra > *, .kpi-grid > .kpi { animation: none !important; }
}
