/* ══════════════════════════════════════════════════════════════════════
   LUMIN — CONTROLE FINANCEIRO
   CSS v7 | REFINED SaaS — Proporções de mercado, escala harmônica
   Base: 16px (1rem) | Fontes: clamp() fluido | Espaços: 4-48px
   Breakpoints:
     ≥ 1025px  → Desktop   (Sidebar fixa 260px)
     ≤ 1024px  → Tablet    (Off-canvas sidebar)
     ≤ 768px   → Mobile    (Bottom Navigation)
══════════════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════
   TOKENS DESIGN
══════════════════════════════════════════════ */
:root {
  /* ─ Paleta — grafite premium (menos saturado, mais Linear/Notion) ─ */
  --bg:      #0a0a0c;
  --bg2:     #111114;
  --bg3:     #1a1a1f;
  --accent:  #00d4ff;
  --accent2: #008fb5;
  --success: #4ade80;
  --alert:   #f87171;
  --warning: #fbbf24;
  --purple:  #a78bfa;
  --text:    #e8e8ea;
  --muted:   rgba(232,232,234,.45);
  --glass:   rgba(255,255,255,.03);
  --border:  rgba(255,255,255,.06);
  --ease:    cubic-bezier(.4,0,.2,1);

  /* ─ Layout ─ */
  --sidebar-w:    260px;
  --topbar-h:     60px;
  --filterbar-h:  48px;
  --bottom-nav-h: 60px;
  --content-max:  1280px;

  /* ─ Escala tipográfica rem + clamp()
     Base 16px (browser default)
     clamp(min-mobile, fluid, max-desktop)
  ─ */
  --fs-2xs:  0.625rem;                          /* 10px — badges apertados */
  --fs-xs:   0.6875rem;                         /* 11px — labels uppercase */
  --fs-sm:   0.8125rem;                         /* 13px — meta, th */
  --fs-base: 0.9375rem;                         /* 15px — corpo / td */
  --fs-md:   clamp(1rem, 1.4vw, 1.125rem);     /* 16-18px — subtítulos */
  --fs-lg:   clamp(1.125rem, 2vw, 1.5rem);     /* 18-24px — títulos seção */
  --fs-xl:   clamp(1.375rem, 2.5vw, 1.875rem); /* 22-30px — h1 painéis */
  --fs-2xl:  clamp(1.5rem, 3vw, 2.25rem);      /* 24-36px — valores monetários */
  --fs-3xl:  clamp(1.75rem, 4vw, 2.75rem);     /* 28-44px — wordmark */

  /* ─ Espaçamento (múltiplos de 4px) ─ */
  --sp-1: 0.25rem;   /* 4px  */
  --sp-2: 0.5rem;    /* 8px  */
  --sp-3: 0.75rem;   /* 12px */
  --sp-4: 1rem;      /* 16px */
  --sp-5: 1.25rem;   /* 20px */
  --sp-6: 1.5rem;    /* 24px */
  --sp-8: 2rem;      /* 32px */
  --sp-10: 2.5rem;   /* 40px */
  --sp-12: 3rem;     /* 48px */

  /* Aliases semânticos */
  --sp-xs:  var(--sp-2);
  --sp-sm:  var(--sp-3);
  --sp-md:  var(--sp-4);
  --sp-lg:  var(--sp-6);
  --sp-xl:  var(--sp-8);

  /* ─ Raios ─ */
  --r-xs:  6px;
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-2xl: 24px;

  /* ─ Interativos — padrão WCAG (min 44px) ─ */
  --h-input:   44px;
  --h-btn:     44px;
  --h-btn-sm:  36px;
  --h-btn-act: 36px;

  /* ─ Card padding ─ */
  --card-pad: 1.25rem;  /* 20px desktop; sobrescrito no mobile */
}

/* ══════════════════════════════════════════════
   RESET
══════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box; margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', sans-serif;
  font-size: var(--fs-base);
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  min-height: 100svh;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}
button, a { cursor: pointer; border: none; background: transparent; color: inherit; font-family: inherit; }

/* ─ Escala tipográfica global ─ */
h1 { font-family: 'Inter', sans-serif; font-size: var(--fs-xl);  font-weight: 700; letter-spacing: -.035em; line-height: 1.15; }
h2 { font-family: 'Inter', sans-serif; font-size: var(--fs-lg);  font-weight: 700; letter-spacing: -.030em; line-height: 1.2; }
h3 { font-family: 'Inter', sans-serif; font-size: var(--fs-md);  font-weight: 650; letter-spacing: -.022em; line-height: 1.25; }
h4 { font-family: 'Inter', sans-serif; font-size: var(--fs-base); font-weight: 600; letter-spacing: -.015em; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; letter-spacing: -.01em; }

::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,212,255,.18); border-radius: 4px; }

/* ══════════════════════════════════════════════
   UTILITIES
══════════════════════════════════════════════ */
.glass {
  background: var(--bg2);
  border: 1px solid var(--border);
}
.orb {
  display: none; /* removido — efeito visual datado */
}

/* ══════════════════════════════════════════════
   BOTÃO PRIMÁRIO
══════════════════════════════════════════════ */
.btn-primary {
  background: var(--accent);
  color: var(--bg);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -.005em;
  padding: 0 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--h-btn);
  transition: filter .12s, transform .1s;
  -webkit-appearance: none;
  white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--accent) 70%, black);
}
.btn-primary:hover   { filter: brightness(1.08); }
.btn-primary:active  { transform: translateY(1px); }
.btn-primary:disabled{ opacity: .4; cursor: not-allowed; }

/* ══════════════════════════════════════════════
   CAMPO DE ENTRADA
══════════════════════════════════════════════ */
.input-field {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -.005em;
  outline: none;
  transition: border-color .15s, background .15s;
  min-height: var(--h-input);
  -webkit-appearance: none;
}
.input-field:focus {
  border-color: var(--accent);
  background: transparent;
}
.input-field::placeholder { color: var(--muted); font-size: 14px; }
.input-field option { background: var(--bg2); color: var(--text); }

/* ══════════════════════════════════════════════
   BADGES & BOTÕES DE AÇÃO
══════════════════════════════════════════════ */
.badge-status {
  font-size: 10.5px; font-weight: 500;
  padding: 2px 8px; border-radius: 6px;
  letter-spacing: -.005em;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px;
}
.badge-status::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.badge-active   { background: rgba(74,222,128,.10); color: #4ade80; }
.badge-inactive { background: rgba(248,113,113,.08); color: var(--alert); }

.btn-act {
  width: 30px; height: 30px;
  border-radius: 7px;
  display: inline-grid; place-items: center;
  font-size: 13px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  transition: color .12s, border-color .12s, background .12s;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-act:hover      { color: var(--text); border-color: rgba(255,255,255,.16); }
.btn-act.edit:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.btn-act.del:hover  { color: var(--alert); border-color: rgba(248,113,113,.35); }
.td-actions { display: flex; gap: var(--sp-2); align-items: center; justify-content: flex-end; }

/* FORM LABELS */
.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: -.005em;
  text-transform: none;
  display: block;
  margin-bottom: 6px;
}

/* ══════════════════════════════════════════════
   ANIMAÇÕES
══════════════════════════════════════════════ */
@keyframes fadeOverlay { from{opacity:0}to{opacity:1} }
@keyframes modalUp     { from{transform:translateY(16px);opacity:0}to{transform:translateY(0);opacity:1} }
@keyframes sheetUp     { from{transform:translateY(32px);opacity:0}to{transform:translateY(0);opacity:1} }
@keyframes slideUp     { from{transform:translateY(10px);opacity:0}to{transform:translateY(0);opacity:1} }
@keyframes loSpin      { to{transform:rotate(360deg)} }
@keyframes barFill     { from{width:0}to{width:100%} }
@keyframes fontSwap {
  0%   { font-family:'Bebas Neue',cursive;    letter-spacing:.08em; }
  25%  { font-family:'Comfortaa',cursive;     letter-spacing:-.02em; }
  50%  { font-family:'Montserrat',sans-serif; letter-spacing:-.03em; }
  75%  { font-family:'Inter',sans-serif;      letter-spacing:-.01em; }
  100% { font-family:'Comfortaa',cursive;     letter-spacing:-.02em; }
}
@keyframes glow {
  0%,100% { text-shadow: 0 0 30px rgba(0,212,255,.12); }
  50%      { text-shadow: 0 0 80px rgba(0,212,255,.6); }
}

/* ══════════════════════════════════════════════
   PRELOADER
══════════════════════════════════════════════ */
#preloader {
  position: fixed; inset: 0; background: #000; z-index: 9999;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 28px;
  transition: opacity .6s var(--ease);
}
#preloader.out { opacity: 0; pointer-events: none; }
.pl-brand {
  font-size: var(--fs-3xl);
  color: #fff; user-select: none;
  animation: fontSwap 3s steps(1) 1 forwards, glow 2s ease-in-out infinite;
}
.pl-bar-wrap { width: min(220px, 50vw); height: 2px; background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden; }
.pl-bar { height: 100%; background: linear-gradient(90deg, transparent, var(--accent)); width: 0; animation: barFill 3s linear forwards; }
.pl-sub { font-size: var(--fs-xs); letter-spacing: .28em; text-transform: uppercase; color: rgba(255,255,255,.2); font-weight: 700; }

/* ══════════════════════════════════════════════
   LOADING OVERLAY
══════════════════════════════════════════════ */
#loadingOverlay {
  position: fixed; inset: 0; background: rgba(5,13,18,.9);
  backdrop-filter: blur(10px); z-index: 9800;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
}
#loadingOverlay.active { display: flex; }
.lo-spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid rgba(0,212,255,.12); border-top-color: var(--accent);
  animation: loSpin .7s linear infinite;
}
.lo-msg { font-size: var(--fs-xs); font-weight: 800; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }

/* ══════════════════════════════════════════════
   LOGIN
══════════════════════════════════════════════ */
#login-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 9000; display: none; align-items: center; justify-content: center;
  padding: var(--sp-lg);
}
#login-screen.active { display: flex; }

.login-wordmark {
  font-family: 'Inter', sans-serif;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -.03em;
  margin-bottom: 4px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.login-wordmark::before {
  content: '';
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
}

/* ══════════════════════════════════════════════
   ADMIN PANEL
══════════════════════════════════════════════ */
#admin-panel {
  position: fixed; inset: 0;
  background: radial-gradient(circle at 30% 20%, #0a1a2e, var(--bg));
  z-index: 9100; display: none; flex-direction: column;
}
#admin-panel.active { display: flex; }

#admin-topbar {
  background: rgba(5,13,18,.97);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--sp-xl);
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  backdrop-filter: blur(20px); flex-shrink: 0; gap: var(--sp-md);
}

#admin-tabs {
  display: flex; gap: 4px;
  padding: var(--sp-3) var(--sp-xl) 0;
  border-bottom: 1px solid var(--border);
  background: rgba(5,13,18,.6); flex-shrink: 0;
}
.admin-tab {
  padding: 10px 20px;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  font-size: var(--fs-sm); font-weight: 700; color: var(--muted);
  border: 1px solid transparent; border-bottom: none;
  transition: .2s; cursor: pointer; letter-spacing: .01em;
  min-height: auto; white-space: nowrap;
}
.admin-tab.active { color: var(--accent); background: var(--glass); border-color: var(--border); border-bottom-color: rgba(5,13,18,.6); }
.admin-tab:not(.active):hover { color: var(--text); }

#admin-content { flex: 1; overflow-y: auto; padding: var(--sp-xl); }
#admin-content > .admin-tab-panel { display: none; max-width: var(--content-max); margin: 0 auto; }
#admin-content > .admin-tab-panel.active { display: block; }

.admin-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 16px;
}
.admin-card h3 {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
  letter-spacing: -.018em;
  display: flex; align-items: center; gap: 8px;
}
.admin-card h3 svg { display: none; } /* esconde ícones inline antigos */
.admin-card > p {
  font-size: 13px; color: var(--muted);
  margin: 0 0 16px;
  letter-spacing: -.005em;
}
.admin-card h3 + .admin-form-grid,
.admin-card h3 + div:not([style*="margin-bottom"]) { margin-top: 14px; }

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.admin-form-full { grid-column: 1 / -1; }
.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: -.005em;
  text-transform: none;
  display: block;
  margin-bottom: 6px;
}

/* Tabelas Admin */
.adm-table-wrap { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); }
.adm-search-bar { display: flex; align-items: center; gap: var(--sp-sm); margin-bottom: var(--sp-md); }
.adm-search-bar input { flex: 1; }

table { width: 100%; border-collapse: collapse; }
th {
  padding: 12px 16px;
  color: var(--muted); text-transform: uppercase; font-size: var(--fs-xs);
  font-weight: 800; text-align: left; border-bottom: 1px solid var(--border);
  letter-spacing: .1em; background: var(--bg2); white-space: nowrap;
}
td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  font-size: var(--fs-sm); vertical-align: middle; line-height: 1.5;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.025); }

.company-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-radius: 9px;
  background: transparent;
  border: 1px solid var(--border);
  transition: border-color .12s, background .12s;
  margin-bottom: 6px;
}
.company-row:hover { background: rgba(255,255,255,.02); border-color: rgba(255,255,255,.12); }
.company-color-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.company-info      { flex: 1; min-width: 0; line-height: 1.3; }
.company-name      { font-size: 13.5px; font-weight: 500; letter-spacing: -.005em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-meta      { font-size: 11.5px; color: var(--muted); margin-top: 2px; letter-spacing: -.005em; }

/* Modal Editar Usuário */
#modal-edit-user {
  position: fixed; inset: 0; background: rgba(0,0,0,.8);
  backdrop-filter: blur(12px); z-index: 9500;
  display: none; align-items: center; justify-content: center; padding: var(--sp-lg);
}
#modal-edit-user.active { display: flex; animation: fadeOverlay .2s var(--ease); }
#modal-edit-company {
  position: fixed; inset: 0; background: rgba(0,0,0,.8);
  backdrop-filter: blur(12px); z-index: 9500;
  display: none; align-items: center; justify-content: center; padding: var(--sp-lg);
}
#modal-edit-company.active { display: flex; animation: fadeOverlay .2s var(--ease); }
.modal-card {
  width: 100%; max-width: 520px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: var(--sp-xl); position: relative; max-height: 92svh; overflow-y: auto;
  animation: modalUp .25s var(--ease);
}
.modal-close-btn {
  position: absolute; top: 16px; right: 16px; width: 36px; height: 36px;
  border-radius: var(--r-sm); background: rgba(255,255,255,.06);
  border: 1px solid var(--border); color: var(--muted);
  display: grid; place-items: center; font-size: 18px; transition: color .2s, background .2s;
}
.modal-close-btn:hover { color: var(--text); background: rgba(255,255,255,.1); }

/* ══════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════ */
#toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: rgba(0,212,255,.1); border: 1px solid rgba(0,212,255,.25);
  backdrop-filter: blur(12px); border-radius: 40px;
  padding: 12px 28px;
  font-size: var(--fs-sm); font-weight: 700; color: var(--accent);
  z-index: 9900; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err  { border-color: rgba(255,91,112,.3); color: var(--alert); background: rgba(255,91,112,.08); }

/* ══════════════════════════════════════════════
   APP SHELL — TENANT DASHBOARD
══════════════════════════════════════════════ */
#app-shell-wrapper {
  position: fixed; inset: 0; z-index: 9050;
  display: none; flex-direction: row; background: var(--bg);
}
#app-shell-wrapper.active { display: flex; }

#t-sb-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px); z-index: 590; touch-action: none;
}
#t-sb-overlay.active { display: block; }

/* ── SIDEBAR (estilo Linear/Notion) ── */
#t-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100svh;
  z-index: 600; overflow-y: auto;
  transition: transform .3s var(--ease);
}

#t-sb-header {
  padding: 18px 16px 14px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}

#t-btn-sb-close {
  display: none; width: 32px; height: 32px; border-radius: 8px;
  background: transparent;
  color: var(--muted); align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}

/* Section labels (estilo Linear) */
.t-sb-section-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  padding: 14px 22px 6px;
  user-select: none;
}

/* Nav items — minimalistas */
.t-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px;
  border-radius: 7px;
  color: var(--muted);
  width: 100%; text-align: left;
  font-weight: 500; font-size: 13.5px;
  letter-spacing: -.005em;
  min-height: 32px;
  transition: color .12s, background .12s;
  touch-action: manipulation;
}
.t-nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .85; }
.t-nav-item.active {
  color: var(--text);
  background: rgba(255,255,255,.05);
}
.t-nav-item.active svg { color: var(--accent); opacity: 1; }
.t-nav-item:hover {
  color: var(--text);
  background: rgba(255,255,255,.04);
}

/* Footer com usuário + ícones */
#t-sb-footer {
  margin-top: auto;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 2px;
}
#t-sb-footer .t-nav-item:hover,
#t-btn-logout:hover { background: rgba(255,255,255,.05) !important; color: var(--text) !important; }

#t-btn-menu {
  display: none; width: 40px; height: 40px; border-radius: var(--r-sm);
  background: var(--glass); border: 1px solid var(--border);
  color: var(--text); align-items: center; justify-content: center; font-size: 20px;
}

/* ── MAIN ── */
#t-main {
  flex: 1; margin-left: var(--sidebar-w);
  display: flex; flex-direction: column; min-width: 0;
  background: var(--bg); height: 100svh; overflow: hidden;
}

/* ── TOPBAR ── */
#t-topbar {
  position: sticky; top: 0; z-index: 400;
  padding: 0 var(--sp-xl);
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── FILTER BAR ── */
#t-filter-bar {
  padding: 0 var(--sp-xl);
  height: var(--filterbar-h);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  overflow-x: auto; background: var(--bg);
  -webkit-overflow-scrolling: touch; flex-shrink: 0;
}
#t-filter-bar::-webkit-scrollbar { height: 0; }
.fpill {
  padding: 5px 12px; border-radius: 7px;
  font-size: 12.5px; font-weight: 500;
  transition: .12s; white-space: nowrap;
  letter-spacing: -.005em;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
}
.fpill:hover { color: var(--text); background: rgba(255,255,255,.04); }
.fpill.active,
.fpill[style*="var(--accent)"] {
  background: rgba(255,255,255,.06) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  position: relative;
}
.fpill.active::before,
.fpill[style*="var(--accent)"]::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}

/* ── VIEWS ── */
.t-view {
  display: none; padding: var(--sp-xl);
  animation: slideUp .3s var(--ease);
  overflow-y: auto;
  height: calc(100svh - var(--topbar-h) - var(--filterbar-h));
}
.t-view.active { display: block; }

/* ══════════════════════════════════════════════
   STATS GRID
══════════════════════════════════════════════ */
/* ══════════════════════════════════════════════
   STAT CARDS (legado — não usado no dashboard novo,
   mantido para outros lugares)
══════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
@media (min-width: 720px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
}
@media (min-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(5, 1fr); gap: 16px; }
}
.stat-card {
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  min-width: 0;
  gap: 10px;
}
.stat-card p {
  font-size: var(--fs-xs) !important;
  font-weight: 700 !important;
  letter-spacing: .08em !important;
  text-transform: uppercase !important;
  color: var(--muted) !important;
  margin: 0 !important;
  line-height: 1.4 !important;
}
.stat-card h3 {
  font-family: 'DM Mono', monospace !important;
  font-size: clamp(1.125rem, 2.5vw, 1.625rem) !important;
  font-weight: 500 !important;
  line-height: 1.1 !important;
  margin: 0 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ══════════════════════════════════════════════
   SETTINGS / CONTA — cards e tema
══════════════════════════════════════════════ */
.settings-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 22px 20px;
}
.settings-card-head { margin-bottom: 18px; }
.settings-card-head h4 {
  font-size: 15px; font-weight: 600;
  letter-spacing: -.018em;
  color: var(--text); margin: 0 0 4px;
}
.settings-card-head p {
  font-size: 13px; color: var(--muted);
  letter-spacing: -.005em; margin: 0;
}

/* Cards de tema (presets) */
.t-theme-card {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  transition: border-color .15s, background .15s;
  text-align: left;
  position: relative;
}
.t-theme-card:hover {
  border-color: rgba(255,255,255,.16);
  background: rgba(255,255,255,.02);
}
.t-theme-card.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.t-theme-card.active::after {
  content: '';
  position: absolute;
  top: 10px; right: 10px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--bg2);
}
.t-theme-card.active::before {
  content: '✓';
  position: absolute;
  top: 9px; right: 11px;
  font-size: 10px;
  font-weight: 700;
  color: var(--bg);
  z-index: 1;
  line-height: 1.4;
}
.t-theme-swatches {
  display: flex;
  width: 100%;
  height: 36px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.t-theme-swatches > span { flex: 1; display: block; }
.t-theme-name {
  font-size: 13px; font-weight: 500;
  color: var(--text); letter-spacing: -.005em;
}
.t-theme-tag {
  font-size: 10px; font-weight: 500;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  margin-top: -4px;
}

/* ══════════════════════════════════════════════
   RESUMO FINANCEIRO (card hero unificado)
══════════════════════════════════════════════ */
.resumo-card {
  border-radius: 14px;
  padding: 24px 24px 20px;
  margin-bottom: 24px;
  background: var(--bg2);
  border: 1px solid var(--border);
  backdrop-filter: none;
}

/* Linha 1: HERO */
.resumo-hero { margin-bottom: 16px; }
.resumo-hero-label {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.resumo-hero-label > span:first-child {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -.005em;
  text-transform: none;
  color: var(--muted);
}
.resumo-month {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: -.005em;
  text-transform: none;
}
.resumo-hero-value {
  font-family: 'Inter', sans-serif;
  font-size: clamp(28px, 5.5vw, 40px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.025em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  word-break: break-all;
  margin-bottom: 10px;
}
.resumo-hero-value.pos { color: var(--success); }
.resumo-hero-value.neg { color: var(--alert); }
.resumo-hero-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  align-items: center;
  letter-spacing: -.005em;
}
.resumo-hero-sub strong {
  color: var(--text);
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  font-variant-numeric: tabular-nums;
}
.resumo-hero-sub strong.pos { color: var(--success); }
.resumo-hero-sub strong.neg { color: var(--alert); }
.resumo-sep { opacity: .35; }

/* Divisor sutil */
.resumo-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 18px 0;
}

/* Linha 2: TOTAIS (Receita / Despesa) */
.resumo-totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.resumo-total-block { min-width: 0; }
.resumo-total-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.resumo-total-value {
  font-family: 'DM Mono', monospace;
  font-size: clamp(18px, 3.5vw, 26px);
  font-weight: 600;
  line-height: 1.1;
  word-break: break-all;
}
.resumo-total-value.pos { color: var(--success); }
.resumo-total-value.neg { color: var(--alert); }

/* Linha 3: BREAKDOWN por categoria */
.resumo-breakdown {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bd-row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 9px 4px;
  border-radius: 8px;
  transition: background .15s;
}
.bd-row:hover { background: rgba(255, 255, 255, .025); }
.bd-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .25);
}
.bd-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bd-val {
  font-family: 'DM Mono', monospace;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -.2px;
  white-space: nowrap;
}
.bd-val.pos { color: var(--success); }
.bd-val.neg { color: var(--alert); }

/* Mobile: ajustes finos */
@media (max-width: 540px) {
  .resumo-card { padding: 22px 20px 18px; }
  .resumo-hero-sub { font-size: 11.5px; }
  .resumo-totals { gap: 12px; }
  .bd-label { font-size: 13px; }
  .bd-val { font-size: 13.5px; }
}

/* ══════════════════════════════════════════════
   CALENDÁRIO
══════════════════════════════════════════════ */
.cal-grid {
  border-radius: 10px; overflow: hidden;
  display: grid; grid-template-columns: repeat(7,1fr);
  grid-auto-rows: minmax(86px, auto);
  background: var(--bg2);
}
.cal-day-header-label {
  font-size: 10.5px; font-weight: 500; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted);
  padding: 8px 0; text-align: center;
  background: transparent; border-bottom: 1px solid var(--border);
}
.cal-day {
  height: 100%;
  min-height: 86px;
  padding: 6px 6px 4px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: background .12s; cursor: pointer;
}
.cal-day:nth-child(7n) { border-right: none; }
.cal-day:hover { background: rgba(255,255,255,.02); }
.cal-day.today { background: transparent; }
.cal-day.today .cal-day-num {
  color: var(--bg);
  background: var(--accent);
  border-radius: 6px;
  padding: 0;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600;
}
.cal-day-num {
  font-family: 'Inter', sans-serif;
  font-size: 12px; font-weight: 500; color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: -.005em;
  font-variant-numeric: tabular-nums;
}
/* Eventos no calendário: dot colorido + texto, sem fundo colorido cheio */
.cal-event-pill {
  font-size: 11px; padding: 2px 6px 2px 4px; border-radius: 4px;
  margin-bottom: 2px;
  white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 100%;
  display: flex; align-items: center; gap: 5px;
  font-weight: 400; cursor: pointer;
  color: var(--text);
  letter-spacing: -.005em;
  transition: background .12s;
}
.cal-event-pill::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--ev-color, var(--accent));
  flex-shrink: 0;
}
.cal-event-pill:hover { background: rgba(255,255,255,.04); }
.cal-more-label { font-size: 11px; color: var(--muted); font-weight: 500; margin-top: 2px; padding-left: 4px; }

/* ══════════════════════════════════════════════
   MODAL NOVA PESAGEM — PAPELÃO
══════════════════════════════════════════════ */
#pap-modal-add {
  position: fixed; inset: 0; background: rgba(0,0,0,.8);
  backdrop-filter: blur(12px); z-index: 800;
  display: none; align-items: flex-end; justify-content: center; padding: 0;
}
#pap-modal-add.active { display: flex; animation: fadeOverlay .2s var(--ease); }
#pap-modal-inner {
  width: 100%; max-width: 640px; background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 16px var(--sp-xl) 52px;
  position: relative; max-height: 92svh; overflow-y: auto;
  animation: sheetUp .28s var(--ease); overscroll-behavior: contain;
}

/* ══════════════════════════════════════════════
   TRANSAÇÕES
══════════════════════════════════════════════ */
.tx-wrap { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); }
.tx-wrap table thead th {
  padding: 12px 16px; color: var(--muted); text-transform: uppercase;
  font-size: var(--fs-xs); font-weight: 800; text-align: left;
  border-bottom: 1px solid var(--border); letter-spacing: .1em;
  background: var(--bg2); white-space: nowrap;
}
.tx-wrap table tbody td {
  padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.04);
  font-size: var(--fs-sm); vertical-align: middle;
}
.tx-wrap table tbody tr:last-child td { border-bottom: none; }
.tx-wrap table tbody tr:hover td { background: rgba(255,255,255,.02); }
.td-actions-cell { text-align: right; }
.cat-badge {
  font-size: 10px; font-weight: 800; padding: 3px 10px;
  border-radius: 20px; text-transform: uppercase; letter-spacing: .06em;
}

/* ══════════════════════════════════════════════
   BOTÃO "NOVA TRANSAÇÃO" — discreto no canto, sem círculo flutuante
══════════════════════════════════════════════ */
#t-fab {
  position: fixed; bottom: 18px; right: 18px;
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 14px 0 12px;
  border-radius: 8px;
  background: var(--accent); color: var(--bg);
  font-size: 13px; font-weight: 600; letter-spacing: -.01em;
  border: 1px solid color-mix(in srgb, var(--accent) 70%, black);
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  z-index: 500;
  transition: filter .15s, transform .12s;
  touch-action: manipulation;
}
#t-fab::before {
  content: '+';
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  margin-top: -1px;
}
#t-fab > .fab-label { white-space: nowrap; }
#t-fab:hover  { filter: brightness(1.08); }
#t-fab:active { transform: translateY(1px); }

/* ══════════════════════════════════════════════
   MODAIS
══════════════════════════════════════════════ */
#t-m-add {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  z-index: 800;
  display: none; align-items: flex-end; justify-content: center; padding: 0;
}
#t-m-add.active { display: flex; animation: fadeOverlay .2s var(--ease); }
#t-modal-inner {
  width: 100%; max-width: 540px; background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px 14px 0 0;
  padding: 16px 20px 40px;
  position: relative; max-height: 92svh; overflow-y: auto;
  animation: sheetUp .25s var(--ease); overscroll-behavior: contain;
}
@media (min-width: 768px) {
  #t-m-add { align-items: center; padding: 24px; }
  #t-modal-inner { border-radius: 12px; padding: 20px 24px; max-width: 480px; }
}
#t-cal-day-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  z-index: 850;
  display: none; align-items: flex-end; justify-content: center;
}
#t-cal-day-modal.active { display: flex; }

/* ══════════════════════════════════════════════
   OBRIGAÇÕES
══════════════════════════════════════════════ */
.ob-item {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg2);
  border: 1px solid var(--border);
  display: flex; align-items: center;
  gap: 12px;
  transition: background .12s, border-color .12s;
}
.ob-item:hover { border-color: rgba(255,255,255,.12); }
.ob-check {
  width: 20px; height: 20px; min-width: 20px;
  border-radius: 5px;
  border: 1.5px solid var(--border);
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: border-color .12s, background .12s;
  touch-action: manipulation;
}
.ob-check:hover { border-color: rgba(255,255,255,.25); }
.ob-check.done {
  border-color: var(--success);
  background: var(--success);
}
.ob-check.done::after {
  content: '';
  position: absolute;
  left: 5px; top: 2px;
  width: 5px; height: 9px;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.ob-del:hover { color: var(--alert) !important; border-color: rgba(248,113,113,.4) !important; }

/* ══════════════════════════════════════════════
   BOTTOM NAV — oculto no desktop
══════════════════════════════════════════════ */
#t-bottom-nav { display: none; }


/* ══════════════════════════════════════════════════════════════
   TABLET (≤ 1024px)
══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  :root {
    --topbar-h:    56px;
    --filterbar-h: 44px;
    --card-pad:    1rem;
  }
  /* Sidebar: fullscreen overlay quando aberta */
  #t-sidebar {
    transform: translateX(-100%); z-index: 620;
    width: 100vw; max-width: 100%;
  }
  #t-sidebar.open {
    transform: translateX(0);
    background: rgba(5,13,18,.97);
    backdrop-filter: blur(28px);
    display: flex; flex-direction: column;
  }
  #t-sb-header {
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,.06) !important;
    padding: 20px 24px !important;
  }
  #t-sidebar.open #t-sb-profile { display: none !important; }
  #t-sidebar.open nav {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 4px; padding: 20px 32px;
  }
  #t-sidebar.open .t-nav-item {
    font-size: clamp(0.9375rem, 2.5vw, 1.125rem);
    font-weight: 700;
    justify-content: center;
    text-align: center;
    max-width: 420px;
    width: 100%;
    border-radius: 14px;
    min-height: 52px;
    padding: 12px 24px;
    gap: 14px;
  }
  #t-sidebar.open .t-nav-item svg { width: 22px; height: 22px; }
  #t-sidebar.open > div:last-child {
    flex-shrink: 0;
    padding: 12px 32px 32px !important;
    border-top: 1px solid rgba(255,255,255,.06) !important;
  }

  #t-main { margin-left: 0; }
  /* No mobile, o bottom nav já cobre tudo — sidebar fica oculta */
  #t-btn-menu { display: none; }
  .t-view { padding: var(--sp-lg) var(--sp-md); height: auto; }
  .cal-day { min-height: 64px; padding: 5px 4px 3px; }
  .cal-day-num { font-size: 11px; }
  .cal-event-pill { font-size: 10px; padding: 1px 3px 1px 4px; }
  .cal-event-pill::before { width: 4px; height: 4px; }

  /* No mobile, topbar + filter-bar viram um header único sem linha entre eles */
  #t-topbar {
    padding: 12px 16px 8px;
    height: auto;
    border-bottom: none;
    flex-wrap: wrap;
    gap: 6px;
  }
  #t-topbar h2 { font-size: 17px; }
  #t-topbar > div:last-child { flex-shrink: 1; min-width: 0; }
  #t-filter-bar {
    padding: 0 16px 12px;
    height: auto;
    gap: 6px;
    border-bottom: 1px solid var(--border);
  }
  #t-smart-search { width: 100% !important; max-width: 200px; }
  #admin-content { padding: var(--sp-lg) var(--sp-md); }
  #admin-topbar  { padding: 0 var(--sp-md); }
  #admin-tabs    { padding: var(--sp-2) var(--sp-md) 0; gap: 2px; }
  .admin-tab     { padding: 8px 16px; font-size: var(--fs-xs); }
  .admin-card    { padding: var(--sp-md); }
}


/* ══════════════════════════════════════════════════════════════
   MOBILE (≤ 768px)
══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root {
    --topbar-h:     52px;
    --filterbar-h:  40px;
    --h-input:      44px;
    --h-btn:        44px;
    --card-pad:     1rem;
  }

  #t-btn-sb-close   { display: flex !important; }
  #t-sb-overlay { display: none !important; }

  button        { min-height: 44px; }
  .btn-primary  { min-height: var(--h-btn); font-size: var(--fs-sm); padding: 0 var(--sp-md); }
  .input-field  { min-height: var(--h-input); font-size: var(--fs-sm); padding: 0 var(--sp-sm); }
  .t-nav-item   { min-height: 44px; }

  #t-main { margin-left: 0; height: 100svh; padding-bottom: var(--bottom-nav-h); }
  /* Topbar/filter-bar padding já tratado acima — header unificado */
  .t-view       { padding: var(--sp-md) var(--sp-md) var(--sp-lg); height: auto; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* BOTTOM NAV — minimalista, sem fundo blur */
  #t-bottom-nav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    height: var(--bottom-nav-h);
    background: var(--bg);
    border-top: 1px solid var(--border);
    z-index: 550;
    align-items: stretch; justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .t-bn-item {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px; color: var(--muted);
    font-size: 10px; font-weight: 500;
    letter-spacing: -.005em; text-transform: none;
    min-height: 44px; padding: 6px 2px;
    transition: color .15s; touch-action: manipulation;
    border: none; background: transparent; cursor: pointer; position: relative;
  }
  .t-bn-item svg { width: 20px; height: 20px; flex-shrink: 0; opacity: .8; }
  .t-bn-item.active { color: var(--text); }
  .t-bn-item.active svg { color: var(--accent); opacity: 1; }
  .t-bn-item.active::before { display: none; }

  /* Botão Nova Transação acima do bottom nav */
  #t-fab {
    bottom: calc(var(--bottom-nav-h) + 12px);
    right: 14px;
    height: 36px;
    padding: 0 14px 0 12px;
  }
  #t-fab .fab-label { display: none; }
  #t-fab { padding: 0; width: 44px; height: 44px; border-radius: 50%; justify-content: center; }
  #t-fab::before { margin: 0; font-size: 22px; }
  #toast  { bottom: calc(var(--bottom-nav-h) + 14px); font-size: var(--fs-sm); }

  /* Calendário mobile */
  .cal-grid { display: grid; grid-template-columns: repeat(7,1fr); }
  .cal-day  { min-height: 64px; padding: 6px; }
  .cal-day-num { font-size: 10px; }
  .cal-event-pill { font-size: 9px; padding: 1px 4px; }

  /* Saldo strip mobile */
  #t-saldo-strip { grid-template-columns: 1fr !important; gap: 0 !important; padding: 0 !important; }
  #t-saldo-strip > div { padding: var(--sp-4) var(--sp-5) !important; }
  #t-saldo-strip > div:nth-child(2) {
    border-left: none !important; border-right: none !important;
    border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  }
  #rep-summary { grid-template-columns: 1fr !important; }

  /* Transações — stacked cards */
  .tx-wrap { overflow: visible; background: transparent; border: none; border-radius: 0; }
  .tx-wrap table { display: block; width: 100%; background: transparent; border-collapse: unset; }
  .tx-wrap table thead { display: none; }
  .tx-wrap table tbody { display: flex; flex-direction: column; gap: 10px; }
  .tx-wrap table tbody tr {
    display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto auto;
    column-gap: 12px; border-radius: 16px;
    border: 1px solid rgba(255,255,255,.06); background: rgba(255,255,255,.025);
    padding: 16px 16px 16px 20px; position: relative; overflow: hidden; transition: background .2s;
  }
  .tx-wrap table tbody tr:active { background: rgba(255,255,255,.05); }
  .tx-wrap table tbody tr::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--card-accent, var(--accent)); border-radius: 4px 0 0 4px;
  }
  .tx-wrap table tbody td { display: block; padding: 0; border: none; background: transparent !important; line-height: 1.4; }
  .tx-wrap table tbody td[data-label="Data"]      { grid-column:1; grid-row:1; font-size:var(--fs-xs); font-family:'DM Mono',monospace; color:var(--muted); padding-bottom:4px; }
  .tx-wrap table tbody td[data-label="Categoria"] { grid-column:2; grid-row:1; font-size:var(--fs-xs); text-align:right; padding-bottom:4px; }
  .tx-wrap table tbody td[data-label="Descrição"] { grid-column:1/-1; grid-row:2; font-size:var(--fs-sm); font-weight:700; padding:4px 0 10px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .tx-wrap table tbody td[data-label="Valor"]     { grid-column:1; grid-row:3; font-family:'DM Mono',monospace; font-size:var(--fs-md); font-weight:700; align-self:center; }
  .tx-wrap table tbody td.td-actions-cell         { grid-column:2; grid-row:3; text-align:right; align-self:center; }

  .btn-act { width: 36px; height: 36px; border-radius: 10px; font-size: 15px; }

  /* Admin mobile */
  #admin-topbar { padding: 0 var(--sp-md); }
  #admin-tabs   { overflow-x: auto; flex-wrap: nowrap; padding: 8px var(--sp-md) 0; gap: 2px; }
  #admin-tabs::-webkit-scrollbar { height: 0; }
  .admin-tab    { padding: 8px 14px; font-size: 11px; white-space: nowrap; min-height: 38px; }
  #admin-content  { padding: var(--sp-md) var(--sp-md); }
  .admin-card     { padding: var(--sp-4); border-radius: var(--r-lg); margin-bottom: 14px; }
  .admin-form-grid { grid-template-columns: 1fr; gap: var(--sp-sm); }
  .admin-form-full { grid-column: 1; }
  .company-meta   { display: none; }

  /* Tabela Usuários — stacked */
  .adm-table-wrap { border: none; border-radius: 0; background: transparent; overflow: visible; }
  .adm-table-wrap table { display: block; }
  .adm-table-wrap table thead { display: none; }
  .adm-table-wrap table tbody { display: flex; flex-direction: column; gap: 10px; }
  .adm-table-wrap table tbody tr {
    display: grid; grid-template-columns: 1fr; grid-template-rows: repeat(5,auto);
    border-radius: 16px; border: 1px solid rgba(255,255,255,.06);
    background: rgba(255,255,255,.025);
    padding: 16px 16px 16px 18px; position: relative; overflow: hidden;
  }
  .adm-table-wrap table tbody tr::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--accent); border-radius: 4px 0 0 4px;
  }
  .adm-table-wrap table tbody td { display: block; padding: 0; border: none; background: transparent !important; font-size: var(--fs-sm); line-height: 1.6; }
  .adm-table-wrap table tbody td:nth-child(1) { font-size: var(--fs-base); font-weight: 800; padding-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,.05); margin-bottom: 10px; }
  .adm-table-wrap table tbody td:nth-child(2)::before { content: 'Empresa'; }
  .adm-table-wrap table tbody td:nth-child(3)::before { content: 'Role'; }
  .adm-table-wrap table tbody td:nth-child(4)::before { content: 'Status'; }
  .adm-table-wrap table tbody td:nth-child(2)::before,
  .adm-table-wrap table tbody td:nth-child(3)::before,
  .adm-table-wrap table tbody td:nth-child(4)::before {
    display: block; font-size: 10px; font-weight: 800;
    text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 2px;
  }
  .adm-table-wrap table tbody td:nth-child(2) { padding-bottom: 10px; }
  .adm-table-wrap table tbody td:nth-child(3) { padding-bottom: 10px; }
  .adm-table-wrap table tbody td:nth-child(4) { padding-bottom: 12px; }
  .adm-table-wrap table tbody td:nth-child(5) {
    display: flex; justify-content: flex-end; gap: 8px;
    border-top: 1px solid rgba(255,255,255,.05); padding-top: 12px;
  }
  .adm-table-wrap table tbody td:nth-child(5) .btn-act { width: 36px; height: 36px; border-radius: 10px; font-size: 15px; }

  /* Papelão modal mobile padding */
  #pap-modal-inner { padding: 12px var(--sp-md) 72px; }
}


/* ══════════════════════════════════════════════
   EXTRA SMALL (≤ 480px)
══════════════════════════════════════════════ */
@media (max-width: 480px) {
  .modal-card    { padding: var(--sp-md); border-radius: var(--r-lg); }
  #t-modal-inner { padding: 12px var(--sp-md) 52px; }
  #admin-topbar > div:last-child > span { display: none; }
  .t-bn-item     { font-size: 9px; }
  .t-bn-item svg { width: 20px; height: 20px; }
}

/* ══════════════════════════════════════════════
   EXTRA — Combustível e Papelão
══════════════════════════════════════════════ */
#comb-modal-add.active { display: flex !important; }
#comb-modal-add input:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 3px rgba(0,212,255,.1); }
#comb-preco-custom:focus { border-color: var(--warning) !important; box-shadow: 0 0 0 3px rgba(255,179,71,.1); }
.comb-hero-card { transition: transform .2s, box-shadow .2s; }
.comb-card { transition: transform .15s, box-shadow .15s; }
.comb-card:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,.2); }
.comb-tab-btn:hover:not(.active) { background: rgba(255,255,255,.05) !important; color: var(--text) !important; }

#pap-modal-add.active { display: flex !important; }
#pap-modal-add input:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 3px rgba(0,212,255,.1); }
#pap-preco-custom:focus { border-color: var(--warning) !important; box-shadow: 0 0 0 3px rgba(255,179,71,.1); }
.pap-tab-btn:hover:not(.active) { background: rgba(255,255,255,.05) !important; color: var(--text) !important; }
.ob-item { display: flex; align-items: center; }

/* ═══════════════════════════════════════════════════════════════
   ADMIN PANEL — Sidebar Layout (espelho do Tenant)
   Substituição do layout topbar+tabs por sidebar+main responsiva
═══════════════════════════════════════════════════════════════ */

/* Reset do admin-panel para flex-row (igual ao app-shell-wrapper) */
#admin-panel {
  flex-direction: row !important;
  overflow: hidden;
}

/* Overlay sidebar mobile */
#adm-sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  z-index: 590;
  touch-action: none;
}
#adm-sb-overlay.active { display: block; }

/* Sidebar do Admin — espelho exato do #t-sidebar */
#adm-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100svh;
  z-index: 600;
  overflow-y: auto;
  transition: transform .3s var(--ease);
}

/* Header da sidebar admin */
#adm-sb-header {
  padding: 18px 16px 14px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
#adm-btn-sb-close {
  display: none;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
}

/* Section labels (estilo Linear) */
.adm-sb-section-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  padding: 14px 22px 6px;
  user-select: none;
}

/* Nav items do Admin — idênticos ao .t-nav-item */
.adm-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -.005em;
  cursor: pointer;
  transition: color .12s, background .12s;
  text-align: left;
  width: 100%;
  min-height: 32px;
  touch-action: manipulation;
}
.adm-nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .85; }
.adm-nav-item:hover { background: rgba(255,255,255,.04); color: var(--text); }
.adm-nav-item.active {
  background: rgba(255,255,255,.05);
  color: var(--text);
}
.adm-nav-item.active svg { color: var(--accent); opacity: 1; }

/* Footer da sidebar admin */
#adm-sb-footer {
  margin-top: auto;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 2px;
}
#adm-sb-footer #btn-admin-logout:hover {
  background: rgba(255,255,255,.05) !important;
  color: var(--text) !important;
}

/* ══════════════════════════════════════════════
   CONTROLE HETROS — Componentes
══════════════════════════════════════════════ */

/* KPI cards (Visão geral) */
.llm-kpi {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.llm-kpi-label {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: -.005em;
  margin: 0 0 6px;
}
.llm-kpi-val {
  font-family: 'Inter', sans-serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

/* Section card */
.llm-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.llm-section-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -.018em;
  margin: 0 0 12px;
}

/* Action buttons (Atualizar / Exportar / Filtros) */
.llm-action-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 12px; height: 32px;
  border-radius: 7px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px; font-weight: 500;
  letter-spacing: -.005em;
  cursor: pointer;
  white-space: nowrap;
  transition: color .12s, border-color .12s, background .12s;
  font-family: 'Inter', sans-serif;
}
.llm-action-btn:hover {
  color: var(--text);
  border-color: rgba(255,255,255,.16);
  background: rgba(255,255,255,.02);
}

/* Filter buttons (Todos/Entradas/Saídas) — usa pill style */
.ll-filter-btn {
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -.005em;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color .12s, background .12s, border-color .12s;
  font-family: 'Inter', sans-serif;
}
.ll-filter-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,.04);
}
.ll-filter-btn.active {
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-color: var(--border);
}
.ll-filter-btn.active::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}

/* Pill filter (radar de suspeitas) */
.llm-pill {
  padding: 4px 11px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: -.005em;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color .12s, background .12s, border-color .12s;
  font-family: 'Inter', sans-serif;
}
.llm-pill:hover { color: var(--text); }
.llm-pill.active {
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-color: rgba(255,255,255,.16);
}

/* Operador Hetros: esconde abas não permitidas */
body[data-hetros-only] #adm-sidebar .adm-sb-section-label:first-of-type,
body[data-hetros-only] .adm-nav-item:not([data-adm-tab="tab-luminlog"]) {
  display: none !important;
}
body[data-hetros-only] .admin-tab-panel:not(#tab-luminlog) {
  display: none !important;
}
body[data-hetros-only] #tab-luminlog {
  display: block !important;       /* força mostrar mesmo sem .active */
}
/* Avatar no rodapé da sidebar mostra "H" pra hetros */
body[data-hetros-only] #adm-sb-footer > div > div:first-child {
  background: rgba(0,212,255,.15);
  color: var(--accent);
}

/* <details> dentro de admin-card */
details.admin-card summary { user-select: none; }
details.admin-card summary::-webkit-details-marker { display: none; }
details.admin-card[open] .details-chevron { transform: rotate(180deg); }

/* Linha compacta de motorista clicável (semana) */
.llm-week-compact {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  margin-bottom: 6px;
  transition: border-color .12s, background .12s;
}
.llm-week-compact:hover { border-color: rgba(255,255,255,.16); background: rgba(255,255,255,.02); }
.llm-week-compact-name {
  flex: 1; min-width: 0;
  font-size: 13.5px; font-weight: 500;
  color: var(--text); letter-spacing: -.005em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.llm-week-compact-meta {
  font-size: 12px; color: var(--muted);
  letter-spacing: -.005em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.llm-week-compact-meta strong {
  color: var(--text);
  font-weight: 500;
  margin: 0 4px;
}
.llm-week-compact-chevron {
  color: var(--muted);
  flex-shrink: 0;
  transition: transform .15s;
}
.llm-week-compact[open] .llm-week-compact-chevron,
.llm-week-compact.open .llm-week-compact-chevron { transform: rotate(180deg); }
.llm-week-expand {
  padding: 14px 12px 6px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(255,255,255,.02);
  margin-top: -8px;
}

@keyframes pulseGreen {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74,222,128,.6); }
  50%      { box-shadow: 0 0 0 4px rgba(74,222,128,0); }
}
@keyframes pulseRing {
  0%   { transform: scale(.6); opacity: .9; }
  100% { transform: scale(1.6); opacity: 0; }
}
/* Leaflet — popup dark-friendly */
.leaflet-popup-content-wrapper {
  background: #fff; color: #111; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.leaflet-popup-tip { background: #fff; }
.leaflet-container { background: #1a1a1f; }

/* Linha de motorista no Resumo da Semana */
.llm-week-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.llm-week-row:last-child { border-bottom: none; }
.llm-week-row-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
}
.llm-week-row-name {
  flex: 1; min-width: 0;
  font-size: 14px; font-weight: 600;
  color: var(--text); letter-spacing: -.015em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.llm-week-row-total {
  font-size: 13px; font-weight: 500;
  color: var(--text); letter-spacing: -.005em;
  font-variant-numeric: tabular-nums;
}
.llm-week-row-total .accent {
  color: var(--accent); margin-right: 4px;
}
.llm-week-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 10px 16px;
  font-size: 12px; color: var(--muted);
  letter-spacing: -.005em;
}
.llm-week-stat-val {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.llm-week-stat-val.pos { color: var(--success); }
.llm-week-stat-val.neg { color: var(--alert); }

/* Sub-tabs do Controle Hetros — estilo "browser tabs" minimalista */
.llm-subtab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px;
  border: none; background: transparent;
  color: var(--muted);
  font-size: 13px; font-weight: 500;
  letter-spacing: -.005em;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  transition: color .12s;
  font-family: 'Inter', sans-serif;
}
.llm-subtab svg { opacity: .7; }
.llm-subtab:hover { color: var(--text); }
.llm-subtab.active {
  color: var(--text);
}
.llm-subtab.active svg { color: var(--accent); opacity: 1; }
.llm-subtab.active::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

/* Features — linha clean estilo Linear */
.feat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 9px;
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.feat-row:hover { border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.02); }

.feat-toggle {
  width: 36px; height: 20px;
  border-radius: 11px;
  background: rgba(255,255,255,.1);
  transition: background .15s;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
.feat-toggle-knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: left .15s, background .15s;
}
.feat-toggle.active { background: var(--accent); }
.feat-toggle.active .feat-toggle-knob { left: 18px; background: var(--bg); }

/* Main do Admin */
#adm-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100svh;
  overflow: hidden;
}

/* Topbar do Admin — minimal */
#admin-topbar {
  position: sticky;
  top: 0;
  z-index: 400;
  flex-shrink: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--sp-xl);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Conteúdo scrollável */
#admin-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-xl);
}
#admin-content > .admin-tab-panel { max-width: var(--content-max); margin: 0 auto; }

/* ── Tablet: sidebar off-canvas (≤ 1024px) ── */
@media (max-width: 1024px) {
  #adm-sidebar {
    transform: translateX(-100%);
    z-index: 620;
    width: 100vw;
    max-width: 100%;
  }
  #adm-sidebar.open {
    transform: translateX(0);
    background: rgba(5,13,18,.97);
    backdrop-filter: blur(28px);
  }
  #adm-sidebar.open #adm-btn-sb-close { display: grid !important; }
  #adm-main { margin-left: 0; }
  #adm-btn-menu { display: grid !important; }
  #admin-topbar  { padding: 0 var(--sp-md); }
  #admin-content { padding: var(--sp-lg) var(--sp-md); }
}

/* ── Mobile (≤ 768px) ── */
@media (max-width: 768px) {
  #adm-sidebar.open nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 20px 32px;
  }
  #adm-sidebar.open .adm-nav-item {
    font-size: clamp(0.9375rem, 2.5vw, 1.125rem);
    font-weight: 700;
    justify-content: center;
    text-align: center;
    max-width: 420px;
    width: 100%;
    border-radius: 14px;
    min-height: 52px;
    padding: 12px 24px;
    gap: 14px;
  }
  #adm-sidebar.open .adm-nav-item svg { width: 22px; height: 22px; }
  #admin-content { padding: var(--sp-md); }
  .admin-card { padding: var(--sp-4); border-radius: var(--r-lg); margin-bottom: 14px; }
  .admin-form-grid { grid-template-columns: 1fr; gap: var(--sp-sm); }
}

/* ══════════════════════════════════════════════════════════════
   LUMIN LOG — Modais Adicionar e Editar
   Usa o mesmo padrão .active dos outros modais do sistema
══════════════════════════════════════════════════════════════ */
#ll-modal-add,
#ll-modal-edit {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(6px);
  place-items: center;
  padding: 20px;
}
#ll-modal-add.active,
#ll-modal-edit.active {
  display: grid !important;
  animation: fadeOverlay .2s var(--ease);
}

/* ── Feature flags — oculta itens de nav desactivados ─────── */
.feat-hidden {
  display: none !important;
}

/* ── Filtros dos Relatórios — visual idêntico ao dashboard ── */
.t-rep-filter, .t-rep-cat-filter {
  padding: 5px 12px; border-radius: 7px;
  font-size: 12.5px; font-weight: 500;
  border: 1px solid transparent;
  background: transparent; color: var(--muted);
  cursor: pointer; white-space: nowrap;
  letter-spacing: -.005em;
  transition: color .12s, background .12s, border-color .12s;
  min-height: 30px;
}
.t-rep-filter:hover, .t-rep-cat-filter:hover {
  color: var(--text); background: rgba(255,255,255,.04);
}
.t-rep-filter.active, .t-rep-cat-filter.active {
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-color: var(--border);
}
.t-rep-filter.active::before, .t-rep-cat-filter.active::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}
