/* ============================================================
   Jorge · 49imob — casca do painel (2026)

   Um único visual, sem seletor de temas: menu em teal profundo com o
   "trilho de elevador" (a marca da casa é a cidade vertical), conteúdo
   sobre areia com cartões brancos de linha fina. Escuro automático pelo
   sistema. Carregado por último: redefine os tokens que panel.css consome
   e reescreve a estrutura (menu, topo, cabeçalhos, cartões, botões).
   Regras de componentes internos (kanban, modais, formulários) continuam
   em panel.css e herdam os tokens daqui.
   ============================================================ */

:root {
  /* paleta */
  --bg: #F3EFE7;            /* areia */
  --surface: #FFFFFF;       /* papel */
  --surface2: #F8F5EF;
  --surface3: #EFEAE1;
  --border: #E4DED3;        /* linha */
  --border-accent: #0A95A3;
  --gold: #0A95A3;          /* turquesa — acento (nome herdado do CSS antigo) */
  --gold-light: #DDF4F6;    /* espuma — tinta do acento */
  --gold-dim: #0B4A52;      /* mar profundo */
  --blue: #0A95A3;
  --green: #2E7D53;
  --red: #B42318;
  --orange: #B8600F;
  --text: #1E1C19;          /* tinta */
  --text-dim: #4E4942;
  --text-muted: #6B655C;    /* pedra */
  --on-accent: #FFFFFF;
  --success-bg: #E6F4EC;
  --warning-bg: #FDF1E4;
  --danger-bg: #FCEBE8;
  --info-bg: #E7F6F8;
  --toast-success-bg: #E6F4EC; --toast-error-bg: #FCEBE8; --toast-info-bg: #E7F6F8;
  --login-bg: #0B4A52;
  --topbar-bg: rgba(255, 255, 255, .94);
  --glow: none;
  --shadow-sm: 0 1px 2px rgba(11, 74, 82, .05);
  --shadow-md: 0 6px 18px rgba(11, 74, 82, .08);
  --shadow-lg: 0 16px 40px rgba(11, 74, 82, .14);
  --radius: 12px; --radius-sm: 8px;

  /* menu (elevador) */
  --nav-bg: #0B4A52;
  --nav-bg-2: #0E5661;
  --nav-line: rgba(255, 255, 255, .12);
  --nav-text: #D9E9EB;
  --nav-muted: #86B0B6;
  --nav-lit: #7EE3EC;

  /* tipografia */
  --font: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Bricolage Grotesque', 'Hanken Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', monospace;

  /* ritmo denso */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1A1C;
    --surface: #152427;
    --surface2: #1B2D31;
    --surface3: #21363A;
    --border: #274046;
    --gold-light: #123F46;
    --gold-dim: #8ADDE6;
    --text: #ECE7DE;
    --text-dim: #C6BFB3;
    --text-muted: #8F978F;
    --success-bg: #14362A; --warning-bg: #3A2A14; --danger-bg: #3B1B18; --info-bg: #123F46;
    --toast-success-bg: #14362A; --toast-error-bg: #3B1B18; --toast-info-bg: #123F46;
    --topbar-bg: rgba(21, 36, 39, .94);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, .35);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, .5);
    --nav-bg: #0A2F35; --nav-bg-2: #0C383F;
  }
}

/* ── Base ─────────────────────────────────────────────────── */
body { font-family: var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
::selection { background: var(--gold-light); color: var(--gold-dim); }
a { color: var(--gold); }

/* ── Menu lateral: pilha de andares com trilho ────────────── */
.sidebar {
  width: 248px; background: var(--nav-bg); border-right: 0; color: var(--nav-text);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, .06);
}
.sidebar-header { padding: 18px 18px 14px; border-bottom: 1px solid var(--nav-line); }
.sidebar-logo-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--gold); color: #fff; }
.sidebar-brand { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; letter-spacing: .06em; color: #fff; }
.sidebar-brand-sub { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--nav-muted); }
.sidebar-close { color: var(--nav-muted); }
.sidebar-close:hover { color: #fff; }

.sidebar-nav { position: relative; padding: 14px 10px 14px 16px; gap: 14px; }
/* o trilho */
.sidebar-nav::before {
  content: ""; position: absolute; left: 9px; top: 18px; bottom: 18px; width: 2px;
  background: var(--nav-line); border-radius: 2px;
}
.sidebar-section-label {
  font-family: var(--font-mono); font-size: .6rem; font-weight: 500; letter-spacing: .16em;
  color: var(--nav-muted); padding: 0 10px 6px 10px;
}
.sidebar-link {
  color: var(--nav-text); padding: 9px 10px; border-radius: 8px; font-size: .86rem; font-weight: 500;
  min-height: 40px; position: relative; transition: background .15s ease-out, color .15s ease-out;
}
.sidebar-link svg { width: 16px; height: 16px; stroke-width: 1.9; opacity: .85; }
.sidebar-link:hover:not(.active) { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar-link.active { background: rgba(255, 255, 255, .11); color: #fff; font-weight: 600; }
.sidebar-link.active svg { opacity: 1; }
/* o andar aceso no trilho */
.sidebar-link.active::before {
  content: ""; position: absolute; left: -9px; top: 9px; bottom: 9px; width: 3px; border-radius: 2px;
  background: var(--nav-lit); box-shadow: 0 0 10px var(--nav-lit);
  transition: top .2s ease-out, bottom .2s ease-out;
}
.sidebar-badge { background: var(--nav-lit); color: var(--nav-bg); }

.sidebar-user { border-top: 1px solid var(--nav-line); padding: 10px; }
.sidebar-user-btn { color: var(--nav-text); }
.sidebar-user-btn:hover { background: rgba(255, 255, 255, .07); border-color: transparent; }
.sidebar-user-avatar { background: var(--gold); color: #fff; border-radius: 8px; font-family: var(--font-display); }
.sidebar-user-name { color: #fff; }
.sidebar-user-role { color: var(--nav-muted); font-family: var(--font-mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; }
.sidebar-user-cog { color: var(--nav-muted); }
.sidebar-logout { border-color: var(--nav-line); color: var(--nav-muted); }
.sidebar-logout:hover { background: rgba(255, 255, 255, .08); color: #fff; border-color: transparent; }
.sidebar-overlay { background: rgba(11, 74, 82, .55); }

/* ── Topo ─────────────────────────────────────────────────── */
.topbar { background: var(--topbar-bg); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); padding: 10px 24px; min-height: 60px; }
.topbar-title { font-family: var(--font-display); font-size: 1.02rem; font-weight: 600; letter-spacing: 0; }
.topbar-search input { background: var(--surface); border-radius: 8px; min-height: 38px; }
.topbar-search input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-light); }
.icon-btn, .topbar-menu-btn { width: 38px; height: 38px; border-radius: 8px; background: var(--surface); }
.icon-btn:hover, .topbar-menu-btn:hover { background: var(--gold-light); color: var(--gold-dim); border-color: transparent; }

/* ── Página ───────────────────────────────────────────────── */
.container { max-width: 1320px; padding: 24px; }
.page-title {
  font-family: var(--font-display); font-size: 1.9rem; font-weight: 600; letter-spacing: -.02em;
  font-variation-settings: "wdth" 92; line-height: 1.1; margin-bottom: 4px;
}
.page-subtitle { font-size: .9rem; color: var(--text-muted); margin-bottom: 20px; max-width: 64ch; }
.page-actions { gap: 8px; }
.section-label { font-family: var(--font-mono); letter-spacing: .12em; font-size: .62rem; }

/* ── Cartões e números ────────────────────────────────────── */
.section { border-radius: var(--radius); box-shadow: none; border: 1px solid var(--border); margin-bottom: 16px; }
.section-header { padding: 14px 18px; }
.section-header h2 { font-family: var(--font-display); font-size: .98rem; font-weight: 600; }
.section-body { padding: 16px 18px; }
.stat-card, .kpi-card { border-radius: var(--radius); padding: 16px 18px; box-shadow: none; }
.stat-card::before, .kpi-card::before { display: none; }
.stat-card .label, .kpi-label { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); }
.stat-card .value, .kpi-value { font-family: var(--font-display); font-size: 1.9rem; font-weight: 600; letter-spacing: -.02em; font-variation-settings: "wdth" 88; margin-top: 6px; line-height: 1; }
.stat-card .value.gold { color: var(--gold-dim); }
.stat-card .detail { margin-top: 6px; font-size: .78rem; color: var(--text-muted); }
.stats-grid { gap: 12px; }

/* ── Botões, chips, campos ────────────────────────────────── */
.btn { border-radius: 8px; font-weight: 600; min-height: 40px; font-family: var(--font); transition: background .15s ease-out, color .15s ease-out, border-color .15s ease-out; }
.btn-gold { background: var(--gold); color: #fff; border: 1px solid transparent; }
.btn-gold:hover { background: var(--gold-dim); color: #fff; transform: none; box-shadow: none; }
.btn-ghost { background: var(--surface); border: 1px solid var(--border); color: var(--text-dim); }
.btn-ghost:hover { background: var(--gold-light); color: var(--gold-dim); border-color: transparent; }
.btn-sm { border-radius: 6px; min-height: 32px; }
.btn-sm:hover { border-color: var(--gold); color: var(--gold-dim); }
.tab:not(.sidebar-link).active, .filter-pills .active, .pill.active, .crm-subtab.active {
  background: var(--gold-dim); color: #fff; font-weight: 600;
}
.badge { font-family: var(--font-mono); font-size: .64rem; letter-spacing: .06em; border-radius: 6px; }
.badge.painel { background: var(--gold-light); color: var(--gold-dim); }
.form-group input, .form-group select, .form-group textarea, .search-input input, .dwv-filtros select {
  border-radius: 8px; background: var(--surface); min-height: 40px; font-family: var(--font);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus, .search-input input:focus {
  border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-light); outline: none;
}
.form-group label { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }

/* ── Listas, vazios, toasts ───────────────────────────────── */
.item-row { border-radius: 8px; }
.item-row:hover { background: var(--surface2); }
.empty { color: var(--text-muted); }
.empty .icon { filter: grayscale(.2); }
.toast { border-radius: 10px; box-shadow: var(--shadow-md); font-family: var(--font); }
.modal { border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.modal h2, .modal h3 { font-family: var(--font-display); }
.timeline .ti-date { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .06em; }

/* ── Estoque em um clique: o cartão principal do Dashboard ── */
.estoque-auto { border-color: var(--gold); border-width: 1px; }
.estoque-auto .section-header { background: var(--info-bg); border-bottom-color: var(--gold-light); }
.estoque-auto .section-header h2 { color: var(--gold-dim); }
.estoque-kpis .stat-card { background: var(--surface2); }
.estoque-progress > i { background: var(--gold); }

/* ── Login ────────────────────────────────────────────────── */
#login-screen { background: radial-gradient(120% 90% at 20% 0%, #0E5661 0%, #0B4A52 45%, #082F35 100%); }
.login-box { border-radius: 16px; border: 0; box-shadow: var(--shadow-lg); padding: 40px 36px; }
.login-box h1 { font-family: var(--font-display); color: var(--gold-dim); letter-spacing: .06em; font-weight: 700; }
.login-box .subtitle { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); }
.login-box input { border-radius: 8px; background: var(--surface2); }
.login-box input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-light); }
.login-box button { background: var(--gold); border-radius: 8px; font-weight: 600; }
.login-box button:hover { background: var(--gold-dim); transform: none; box-shadow: none; }

/* ── Foco e movimento ─────────────────────────────────────── */
.btn:focus-visible, .sidebar-link:focus-visible, .tab:focus-visible, .icon-btn:focus-visible, .topbar-menu-btn:focus-visible,
select:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 2px;
}
.sidebar-link:focus-visible { outline-color: var(--nav-lit); }

/* ── Celular ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { box-shadow: var(--shadow-lg); }
  .topbar { padding: 10px 14px; }
  .container { padding: 16px 14px; }
  .page-title { font-size: 1.6rem; }
}
@media (hover: none) and (pointer: coarse) {
  .icon-btn, .topbar-menu-btn { width: 44px; height: 44px; }
  .btn { min-height: 44px; }
}
