/* ============================================================
   AM Engenharia — Portal Comercial
   Design system herdado do AM Despesas (identidade 2026):
   grafite #222628 (primária) + ardósia #6F7C84 (secundária),
   escala neutra fria, tipografia Figtree. Light-first, cards
   brancos sobre fundo frio, sidebar grafite no desktop e tab bar
   no mobile. As seções "Portal Comercial" no fim do arquivo
   acrescentam KPIs com variação, gráficos, tabelas padronizadas,
   grupos de menu expansíveis e utilitários de análise.
   ============================================================ */


/* ── Tokens ──────────────────────────────────────────────── */
:root {
  /* Escala da marca (mesma do painel AM Smart) */
  --brand-50:  #F3F7F9;
  --brand-100: #E6EEF2;
  --brand-200: #CDDEE7;
  --brand-300: #ADC7D5;
  --brand-400: #8BA4B1;
  --brand-500: #6F7C84;   /* secundária                        */
  --brand-600: #5A666C;   /* secundária p/ texto branco (AA)   */
  --brand-700: #464F53;
  --brand-800: #32383B;
  --brand-900: #222628;   /* primária                          */

  --white:     #FFFFFF;
  --bg:        var(--brand-50);
  --surface:   #FFFFFF;
  --surface-2: #EDF2F5;
  --surface-3: #E3EAEE;
  --border:    #E0E9EE;
  --border-2:  var(--brand-200);
  --text:      var(--brand-900);
  --text-2:    var(--brand-700);
  --muted:     var(--brand-500);
  --muted-2:   var(--brand-400);
  --accent:    var(--brand-900);
  --accent-2:  var(--brand-800);   /* primária quase preta ⇒ hover clareia */

  /* Semânticas */
  --success:       #127A3B;
  --success-soft:  #E4F3EA;
  --success-line:  #BFE2CD;
  --danger:        #B42318;
  --danger-soft:   #FBEAE8;
  --danger-line:   #F2C6C1;
  --warning:       #B45309;
  --warning-soft:  #FEF3E2;
  --warning-line:  #F8DDB5;
  --info:          #1F66D6;
  --info-soft:     #E7F0FD;
  --info-line:     #C3D8F8;

  /* Gradientes da marca */
  --grad-band: linear-gradient(180deg, #222628 0%, #3B464C 62%, #52616A 100%);
  --grad-card: linear-gradient(135deg, #222628 0%, #464F53 100%);
  --grad-side: linear-gradient(180deg, #222628 0%, #2C3336 100%);

  /* Compatibilidade com classes/estilos antigos */
  --black:    var(--brand-900);
  --gray-900: var(--brand-900);
  --gray-800: var(--brand-800);
  --gray-700: var(--brand-700);
  --gray-600: var(--brand-600);
  --gray-500: var(--brand-500);
  --gray-400: var(--brand-400);
  --gray-300: var(--brand-300);
  --gray-200: var(--brand-200);
  --gray-100: var(--brand-100);
  --gray-50:  var(--brand-50);
  --accent-hover: var(--accent-2);

  --shadow:    0 1px 2px rgba(34,38,40,.05), 0 6px 18px rgba(34,38,40,.07);
  --shadow-md: 0 8px 24px rgba(34,38,40,.12);
  --shadow-lg: 0 14px 40px rgba(34,38,40,.18);
  --radius:    18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --border-r:    var(--radius);
  --border-r-sm: var(--radius-sm);

  --sidebar-w: 268px;
  --topbar-h:  64px;
  --tabbar-h:  66px;
  --safe-top:  env(safe-area-inset-top, 0px);
  --safe-bot:  env(safe-area-inset-bottom, 0px);
  --transition: .18s ease;
  --font: 'Figtree', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Reset / Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
strong { font-weight: 700; }
html, body { overflow-x: clip; max-width: 100%; }

/* ── Layout ───────────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  overflow-x: clip;
}

/* ── Sidebar (desktop) / Drawer (mobile) ─────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--grad-side);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 1000;
  transition: transform .26s cubic-bezier(.2,.8,.2,1);
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(22px + var(--safe-top)) 22px 18px;
}
.sidebar-logo img { height: 36px; width: auto; max-width: 100%; display: block; }
.sidebar-logo .logo-sub {
  font-size: 10.5px;
  color: var(--brand-300);
  font-weight: 600;
  letter-spacing: .9px;
  text-transform: uppercase;
  margin-top: 8px;
}
.sidebar-section {
  padding: 18px 22px 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--brand-400);
}
.sidebar nav { flex: 1; padding: 4px 12px 12px; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin: 2px 0;
  color: var(--brand-200);
  font-size: 14px;
  font-weight: 500;
  border-radius: 12px;
  transition: background var(--transition), color var(--transition);
  position: relative;
}
.sidebar-link svg { width: 19px; height: 19px; flex-shrink: 0; opacity: .85; }
.sidebar-link:hover { background: rgba(255,255,255,.07); color: var(--white); }
.sidebar-link.active {
  background: var(--white);
  color: var(--brand-900);
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(0,0,0,.18);
}
.sidebar-link.active svg { opacity: 1; }
.sidebar-link .badge-count {
  margin-left: auto;
  background: var(--white);
  color: var(--brand-900);
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 99px;
  min-width: 22px;
  text-align: center;
}
.sidebar-link.active .badge-count { background: var(--brand-900); color: var(--white); }
.sidebar-link.link-danger { color: #F6B4AC; }
.sidebar-link.link-danger:hover { background: rgba(180,35,24,.22); color: #FFD3CD; }

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 12px 12px calc(14px + var(--safe-bot));
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  transition: background var(--transition);
}
.sidebar-user:hover { background: rgba(255,255,255,.1); }
.sidebar-user-info { overflow: hidden; }
.sidebar-user-info .name {
  font-size: 13.5px; font-weight: 700; color: var(--white);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-info .role {
  font-size: 10.5px; color: var(--brand-300);
  text-transform: uppercase; letter-spacing: .6px; font-weight: 600;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(34,38,40,.55);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  z-index: 999;
}
.sidebar-overlay.show { display: block; }

/* ── Avatar ───────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px;
  background: var(--brand-100);
  color: var(--brand-800);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .3px;
  flex-shrink: 0;
}
.sidebar .avatar, .topbar .avatar { background: rgba(255,255,255,.14); color: var(--white); }
.avatar-lg { width: 72px; height: 72px; font-size: 24px; }

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: rgba(255,255,255,.86);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-title {
  font-size: 15.5px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: -.1px;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.btn-hamburger, .icon-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  border: none;
  border-radius: 50%;
  color: var(--text-2);
  transition: background var(--transition), color var(--transition);
  position: relative;
  flex-shrink: 0;
}
.btn-hamburger { display: none; }
.btn-hamburger:hover, .icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn svg, .btn-hamburger svg { width: 20px; height: 20px; }
.icon-btn .dot {
  position: absolute; top: 8px; right: 9px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--white);
}
.topbar-logo { height: 24px; width: auto; display: none; }

/* ── Page content ─────────────────────────────────────────── */
.page-content {
  padding: 28px;
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
}
.page-header h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.4px;
  line-height: 1.2;
}
.page-header p { font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.page-header-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
.section-label {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .9px;
  color: var(--muted);
  margin: 4px 0 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.section-label a { font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--brand-600); font-size: 12.5px; }
.section-label a:hover { color: var(--text); }

/* ── Hero band (estilo app bancário) ─────────────────────── */
.hero-band {
  position: relative;
  background: var(--grad-card);
  color: var(--white);
  border-radius: 22px;
  padding: 24px 26px 86px;
  margin-bottom: 0;
  overflow: hidden;
  isolation: isolate;
}
.hero-band::before {
  content: ""; position: absolute; right: -60px; top: -70px;
  width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255,255,255,.05);
  pointer-events: none;
}
.hero-band .hero-logo { position: absolute; right: 24px; top: 24px; height: 22px; width: auto; opacity: .85; }
.hero-hello { font-size: 13px; font-weight: 500; color: var(--brand-300); }
.hero-name { font-size: 24px; font-weight: 800; letter-spacing: -.3px; margin: 2px 0 2px; color: var(--white); }
.hero-sub  { font-size: 13px; color: var(--brand-200); }
.band-overlap { margin-top: -64px; position: relative; z-index: 1; padding: 0 16px; }
@media (max-width: 899px) {
  .hero-band {
    margin: -24px -16px 0;
    border-radius: 0;
    padding: 14px 20px 92px;
  }
  .hero-band::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 30px;
    background: var(--bg); border-radius: 30px 30px 0 0;
  }
  .hero-band .hero-logo { display: none; }
  .band-overlap { margin-top: -84px; padding: 0; }
}

/* Balance card — o card principal que sobrepõe a faixa */
.balance-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.balance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.balance-item .label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
}
.balance-item .label svg { width: 15px; height: 15px; }
.balance-item .value {
  font-size: 26px; font-weight: 800; letter-spacing: -.6px; line-height: 1.15; margin-top: 4px;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.balance-item .value.pos { color: var(--success); }
.balance-item .value.neg { color: var(--danger); }
.balance-item .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.balance-item + .balance-item { border-left: 1px solid var(--border); padding-left: 14px; }
.meter { margin-top: 16px; }
.meter-track {
  height: 30px; border-radius: 99px;
  background: var(--surface-2);
  position: relative; overflow: hidden;
}
.meter-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--grad-card);
  border-radius: 99px;
  min-width: 46px;
  display: flex; align-items: center; padding-left: 12px;
  color: var(--white); font-size: 11.5px; font-weight: 800;
  transition: width .6s cubic-bezier(.2,.8,.2,1);
}
.meter-total {
  position: absolute; right: 12px; top: 0; bottom: 0;
  display: flex; align-items: center;
  font-size: 12px; font-weight: 700; color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.meter-note {
  display: flex; align-items: center; gap: 6px;
  margin-top: 10px; font-size: 12.5px; color: var(--text-2);
}
.meter-note svg { width: 15px; height: 15px; color: var(--success); }

/* ── Quick actions (tiles) ───────────────────────────────── */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.quick-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center;
  color: var(--text);
  font-size: 12.5px; font-weight: 700;
  box-shadow: var(--shadow);
  position: relative;
  transition: transform .12s, box-shadow var(--transition), border-color var(--transition);
}
.quick-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-2); }
.quick-tile .tile-ico {
  width: 44px; height: 44px; border-radius: 14px;
  background: var(--brand-100); color: var(--brand-800);
  display: flex; align-items: center; justify-content: center;
}
.quick-tile .tile-ico svg { width: 22px; height: 22px; }
.quick-tile.primary .tile-ico { background: var(--grad-card); color: var(--white); }
.tile-badge {
  position: absolute; top: 8px; right: 8px;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 99px; background: var(--danger); color: var(--white);
  font-size: 11px; font-weight: 800; line-height: 20px; text-align: center;
}

/* ── Segment / status chips ──────────────────────────────── */
.status-chips-scroll, .segment {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 99px;
  width: fit-content;
  max-width: 100%;
}
.status-chip {
  padding: 7px 14px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-2);
  white-space: nowrap;
  transition: all var(--transition);
}
.status-chip:hover { color: var(--text); background: rgba(255,255,255,.7); }
.status-chip.active { background: var(--brand-900); color: var(--white); box-shadow: 0 4px 12px rgba(34,38,40,.25); }

/* ── Cards métricas (KPI) ────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), transform .12s;
  position: relative;
  overflow: hidden;
}
.metric-card:hover { box-shadow: var(--shadow-md); }
.metric-card .label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.metric-card .label svg { width: 15px; height: 15px; }
.metric-card .value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -.5px;
  font-variant-numeric: tabular-nums;
}
.metric-card .sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.metric-card.accent {
  background: var(--grad-card);
  border-color: transparent;
  color: var(--white);
  box-shadow: 0 10px 28px rgba(34,38,40,.22);
}
.metric-card.accent::before {
  content: ""; position: absolute; right: -40px; top: -50px;
  width: 160px; height: 160px; border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.metric-card.accent .label { color: var(--brand-300); }
.metric-card.accent .value { color: var(--white); }
.metric-card.accent .sub   { color: var(--brand-200); }
.metric-card.accent .sub a { color: var(--white); text-decoration: underline; text-underline-offset: 2px; }
.metric-card.success { border-left: 4px solid var(--success); }
.metric-card.success .value { color: var(--success); }
.metric-card.danger  { border-left: 4px solid var(--danger); }
.metric-card.danger .value { color: var(--danger); }
.metric-card.warning { border-left: 4px solid var(--warning); }
.metric-card.info    { border-left: 4px solid var(--info); }

/* ── Botões ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform .06s, box-shadow var(--transition);
  white-space: nowrap;
  line-height: 1.15;
  text-decoration: none;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: var(--white); border-color: var(--accent); box-shadow: 0 4px 12px rgba(34,38,40,.2); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-2); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--brand-300); }

.btn-outline { background: transparent; color: var(--text); border-color: var(--brand-800); }
.btn-outline:hover { background: var(--brand-900); color: var(--white); }

.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.btn-danger:hover { background: #F6D5D1; }
.btn-danger-solid { background: var(--danger); color: var(--white); border-color: var(--danger); }
.btn-danger-solid:hover { background: #961D13; }

.btn-success { background: var(--success-soft); color: var(--success); border-color: var(--success-line); }
.btn-success:hover { background: #D1EBDA; }
.btn-success-solid { background: var(--success); color: var(--white); border-color: var(--success); }
.btn-success-solid:hover { background: #0E6330; }

.btn-sm { padding: 7px 13px; font-size: 12.5px; }
.btn-lg { padding: 14px 26px; font-size: 15px; }
.btn-icon { padding: 9px; }
.btn-block { display: flex; width: 100%; }

/* Botão de captura rápida (QR / OCR) */
.btn-capture {
  flex-direction: column;
  justify-content: center;
  padding: 18px 12px;
  gap: 8px;
  white-space: normal;
  text-align: center;
  border-radius: 16px;
}
.btn-capture svg { width: 28px; height: 28px; }

/* ── Card / Caixa ─────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-header h2 {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.1px;
}
.card-header a:not(.btn) { font-size: 12.5px; font-weight: 700; color: var(--brand-600); }
.card-header a:not(.btn):hover { color: var(--text); }
.card-body { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--brand-50);
}
.card + .card { margin-top: 16px; }

/* ── Lista de transações (mobile e dashboards) ───────────── */
.tx-list { display: flex; flex-direction: column; }
.tx-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  color: inherit;
  transition: background var(--transition);
}
.tx-row:last-child { border-bottom: none; }
a.tx-row:hover { background: var(--brand-50); }
.tx-icon {
  width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0;
  background: var(--brand-100); color: var(--brand-800);
  display: flex; align-items: center; justify-content: center;
}
.tx-icon svg { width: 21px; height: 21px; }
.tx-icon.cat-hotel       { background: #E7F0FD; color: #1F66D6; }
.tx-icon.cat-alimentacao { background: #FEF3E2; color: #B45309; }
.tx-icon.cat-combustivel { background: #FBEAE8; color: #B42318; }
.tx-icon.cat-pedagio     { background: #EDE9FE; color: #5B3FD6; }
.tx-icon.cat-transporte  { background: #E4F3EA; color: #127A3B; }
.tx-icon.cat-outros      { background: var(--brand-100); color: var(--brand-700); }
.tx-icon.cat-adiantamento{ background: var(--brand-900); color: var(--white); }
.tx-body { flex: 1; min-width: 0; }
.tx-title {
  font-size: 14px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tx-meta {
  font-size: 12px; color: var(--muted); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tx-meta b { color: var(--brand-600); font-weight: 600; }
.tx-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.tx-amount {
  font-size: 14.5px; font-weight: 800; color: var(--text);
  font-variant-numeric: tabular-nums; letter-spacing: -.2px; white-space: nowrap;
}
.tx-amount.pos { color: var(--success); }
.tx-amount.neg { color: var(--danger); }
.tx-actions { display: flex; gap: 6px; align-items: center; }

/* Compat: cards de despesa (mobile) do layout anterior */
.expense-card-item {
  display: block;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  color: inherit;
  transition: background var(--transition);
}
.expense-card-item:last-child { border-bottom: none; }
a.expense-card-item:hover { background: var(--brand-50); }
.expense-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; gap: 10px; }
.expense-card-left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.expense-card-category { font-size: 13.5px; font-weight: 700; color: var(--text); }
.expense-card-user { font-size: 12px; color: var(--muted); }
.expense-card-amount { font-size: 15px; font-weight: 800; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.expense-card-desc { font-size: 12.5px; color: var(--text-2); margin: 2px 0 6px; line-height: 1.4; }
.expense-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* ── Tabela ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left;
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  background: var(--brand-50);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}
tbody td.fw-600, tbody td strong { color: var(--text); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--brand-50); }
.table-desktop { display: block !important; }
.table-mobile  { display: none !important; }

/* ── Badges de status ─────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 7px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: .2px;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge-secondary { background: var(--brand-100); color: var(--brand-700); }
.badge-info      { background: var(--info-soft); color: var(--info); }
.badge-warning   { background: var(--warning-soft); color: var(--warning); }
.badge-success   { background: var(--success-soft); color: var(--success); }
.badge-danger    { background: var(--danger-soft); color: var(--danger); }
.badge-primary   { background: var(--brand-900); color: var(--white); }
.badge-dark      { background: var(--brand-800); color: var(--white); }
.badge-plain::before { display: none; }

/* ── Formulários ─────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 6px;
}
.form-label .required, .required { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--surface-2);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
  min-width: 0;
  max-width: 100%;
}
.form-control:hover { border-color: var(--border-2); }
.form-control:focus {
  border-color: var(--brand-500);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(111,124,132,.16);
}
.form-control:disabled { color: var(--muted); background: var(--brand-50); cursor: not-allowed; }
.form-control::placeholder { color: var(--muted-2); }
input[type="date"].form-control, input[type="time"].form-control { -webkit-appearance: none; appearance: none; }
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236F7C84' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; padding-right: 38px;
}
textarea.form-control { min-height: 96px; resize: vertical; line-height: 1.5; }
.form-hint  { font-size: 12px; color: var(--muted); margin-top: 5px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 5px; font-weight: 600; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.input-prefix { position: relative; display: flex; align-items: center; }
.input-prefix > span {
  position: absolute; left: 14px; font-weight: 700; color: var(--muted); font-size: 14px; pointer-events: none;
}
.input-prefix .form-control { padding-left: 42px; }
.input-affix { position: relative; }
.input-affix .form-control { padding-right: 46px; }
.input-affix .affix-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 50%; border: none; background: transparent;
  color: var(--muted); display: inline-flex; align-items: center; justify-content: center;
}
.input-affix .affix-btn:hover { background: var(--surface-3); color: var(--text); }
.input-affix .affix-btn svg { width: 18px; height: 18px; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--brand-900); }
@media (max-width: 640px) { .form-row, .form-row-3 { grid-template-columns: 1fr; } }

/* ── Alertas ─────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid;
  line-height: 1.45;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-error, .alert-danger { background: var(--danger-soft);  color: var(--danger);  border-color: var(--danger-line); }
.alert-success              { background: var(--success-soft); color: var(--success); border-color: var(--success-line); }
.alert-info                 { background: var(--info-soft);    color: var(--info);    border-color: var(--info-line); }
.alert-warning              { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-line); }

/* Callout (aviso de prazo etc.) */
.callout {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--warning);
  border-radius: var(--radius-sm);
  padding: 13px 16px; margin-bottom: 18px;
  font-size: 13.5px; color: var(--text-2); line-height: 1.5;
  box-shadow: var(--shadow);
}
.callout svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--warning); margin-top: 1px; }
.callout strong { color: var(--text); }
.callout.info { border-left-color: var(--info); }
.callout.info svg { color: var(--info); }

/* ── Timeline (audit) ─────────────────────────────────────── */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 4px; bottom: 4px; width: 2px; background: var(--border); border-radius: 2px; }
.timeline-item { position: relative; margin-bottom: 18px; }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-dot {
  position: absolute; left: -24px; top: 4px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--brand-500);
  border: 3px solid var(--white);
  box-shadow: 0 0 0 2px var(--border-2);
}
.timeline-item.approved .timeline-dot   { background: var(--success); }
.timeline-item.rejected .timeline-dot   { background: var(--danger); }
.timeline-item.submitted .timeline-dot  { background: var(--info); }
.timeline-item.review .timeline-dot     { background: var(--warning); }
.timeline-item.reimbursed .timeline-dot { background: var(--brand-900); }
.timeline-date   { font-size: 11.5px; color: var(--muted); margin-bottom: 2px; font-weight: 600; }
.timeline-action { font-size: 13.5px; font-weight: 700; color: var(--text); }
.timeline-action a { color: var(--brand-600); text-decoration: underline; text-underline-offset: 2px; }
.timeline-note   { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }
.timeline-actor  { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ── Paginação ────────────────────────────────────────────── */
.pagination { display: flex; gap: 4px; align-items: center; justify-content: center; padding: 16px 0 0; }
.page-link {
  min-width: 36px; height: 36px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border);
  border-radius: 99px;
  font-size: 13px; font-weight: 700;
  color: var(--text-2);
  background: var(--surface);
  transition: all var(--transition);
}
.page-link:hover { border-color: var(--brand-800); color: var(--text); }
.page-link.active { background: var(--brand-900); color: var(--white); border-color: var(--brand-900); }
.page-link.disabled { opacity: .4; pointer-events: none; }

/* ── Filtros ─────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 150px; }
.filter-bar .btn { flex-shrink: 0; align-self: flex-end; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(34,38,40,.55);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-backdrop.show { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface);
  border-radius: 22px;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(16px) scale(.98);
  transition: transform .22s cubic-bezier(.2,.8,.2,1);
}
.modal-backdrop.show .modal { transform: translateY(0) scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; font-weight: 800; }
.modal-close {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-2); border: none; cursor: pointer;
  color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; font-size: 14px;
}
.modal-close:hover { background: var(--surface-3); color: var(--text); }
.modal-body { padding: 22px; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--brand-50); }
@media (max-width: 640px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { border-radius: 24px 24px 0 0; max-width: 100%; max-height: 92vh; padding-bottom: var(--safe-bot); }
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; }
}

/* ── Auth pages ──────────────────────────────────────────── */
.auth-page {
  min-height: 100vh; min-height: 100dvh;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center;
  position: relative;
}
.auth-page::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0;
  height: min(46vh, 420px);
  background: var(--grad-band);
}
.auth-hero {
  position: relative; z-index: 1;
  padding: calc(48px + var(--safe-top)) 24px 88px;
  text-align: center; color: var(--white);
  width: 100%;
}
.auth-hero img { height: 40px; width: auto; }
.auth-hero h1 { font-size: 26px; font-weight: 800; letter-spacing: -.4px; margin-top: 22px; }
.auth-hero p  { font-size: 13.5px; color: var(--brand-300); margin-top: 4px; }
.auth-card {
  position: relative; z-index: 1;
  background: var(--surface);
  border-radius: 28px;
  padding: 32px 30px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  margin: -60px 16px 32px;
}
.auth-card h2 { font-size: 19px; font-weight: 800; letter-spacing: -.2px; }
.auth-card .auth-sub { font-size: 13.5px; color: var(--muted); margin: 3px 0 22px; }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo img { height: 40px; width: auto; }
.auth-foot { margin-top: 20px; text-align: center; font-size: 12.5px; color: var(--muted); }
.auth-foot a { font-weight: 700; color: var(--brand-600); }
.auth-foot a:hover { color: var(--text); }
.auth-links { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); text-align: center; }
.auth-links a { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.auth-links a svg { width: 15px; height: 15px; }
.auth-links a:hover { color: var(--text); }
.auth-brandline { margin-top: 18px; text-align: center; font-size: 11px; color: var(--muted-2); letter-spacing: .6px; text-transform: uppercase; font-weight: 700; }

/* ── Bottom nav (mobile) ─────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--tabbar-h) + var(--safe-bot));
  padding-bottom: var(--safe-bot);
  background: rgba(255,255,255,.94);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 22px rgba(34,38,40,.07);
  z-index: 1100;
}
.bottom-nav-inner { display: flex; height: 100%; width: 100%; justify-content: space-around; align-items: stretch; max-width: 560px; margin: 0 auto; }
.bottom-nav-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  color: var(--brand-500);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .1px;
  padding: 6px 0 4px;
  position: relative;
  transition: color var(--transition);
}
.bottom-nav-item svg { width: 23px; height: 23px; flex-shrink: 0; }
.bottom-nav-item span { font-size: 10.5px; line-height: 1.2; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.bottom-nav-item:hover, .bottom-nav-item.active { color: var(--brand-900); }
.bottom-nav-item.active { font-weight: 800; }
.bottom-nav-item.active::after {
  content: ''; position: absolute; bottom: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--brand-900);
}
.bottom-nav-item .nav-count {
  position: absolute; top: 4px; left: calc(50% + 4px);
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 99px;
  background: var(--danger); color: var(--white);
  font-size: 10px; font-weight: 800; line-height: 17px; text-align: center;
}
.bottom-nav-item.new-btn { color: var(--brand-900); font-weight: 800; }
.bottom-nav-item.new-btn .fab {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--grad-card); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  margin-top: -30px; margin-bottom: 2px;
  border: 4px solid var(--bg);
  box-shadow: 0 8px 20px rgba(34,38,40,.32);
  transition: transform .12s, filter var(--transition);
}
.bottom-nav-item.new-btn .fab svg { width: 24px; height: 24px; }
.bottom-nav-item.new-btn:hover .fab, .bottom-nav-item.new-btn.active .fab { filter: brightness(1.15); }
.bottom-nav-item.new-btn:active .fab { transform: scale(.94); }
.bottom-nav-item.new-btn::after { display: none; }

/* ── Utilitários ─────────────────────────────────────────── */
.text-muted    { color: var(--muted); }
.text-sm       { font-size: 12.5px; }
.text-xs       { font-size: 11.5px; }
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-warning  { color: var(--warning); }
.text-info     { color: var(--info); }
.fw-600        { font-weight: 600; }
.fw-700        { font-weight: 700; }
.fw-800        { font-weight: 800; }
.tabular       { font-variant-numeric: tabular-nums; }
.mt-0  { margin-top: 0; }   .mt-8  { margin-top: 8px; }  .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0  { margin-bottom: 0; } .mb-8  { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.d-flex { display: flex; } .d-none { display: none !important; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.w-100 { width: 100%; }
.p-0 { padding: 0; }
.link { color: var(--brand-600); font-weight: 700; }
.link:hover { color: var(--text); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; }
.kv .k { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.kv .v { font-size: 14px; font-weight: 700; color: var(--text); margin-top: 2px; }
.kv .v.big { font-size: 20px; letter-spacing: -.3px; }
.progress { background: var(--surface-2); border-radius: 99px; height: 8px; overflow: hidden; }
.progress > div { background: var(--grad-card); height: 100%; border-radius: 99px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 99px;
  background: var(--brand-900); color: var(--white);
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.chip-soft { background: var(--brand-100); color: var(--brand-700); }

/* ── Loading spinner ─────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border-2);
  border-top-color: var(--brand-900);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state svg { width: 52px; height: 52px; color: var(--brand-300); margin-bottom: 12px; }
.empty-state h3 { font-size: 15.5px; font-weight: 800; color: var(--text-2); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; color: var(--muted); }

/* ── Grids ───────────────────────────────────────────────── */
.admin-dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.show-layout-grid { display: grid; grid-template-columns: 1fr 360px; gap: 18px; align-items: start; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
/* Itens de grid não podem travar na largura mínima do conteúdo (listas com nowrap) */
.admin-dash-grid > *, .show-layout-grid > *, .two-col > *, .metrics-grid > *, .quick-grid > * { min-width: 0; }

/* ── SVGs inline em UI elements ──────────────────────────── */
.topbar svg { flex-shrink: 0; }
.modal svg, .card-header svg, .alert svg { width: 18px; height: 18px; flex-shrink: 0; }
.card-header .badge::before { width: 6px; height: 6px; }

/* ── Tooltip ─────────────────────────────────────────────── */
.tooltip-pop {
  position: fixed; background: var(--brand-900); color: var(--white);
  padding: 6px 10px; border-radius: 8px; font-size: 12px; font-weight: 600;
  z-index: 9999; pointer-events: none; white-space: nowrap;
  box-shadow: var(--shadow-md);
}

/* ── Páginas de erro ─────────────────────────────────────── */
.error-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); text-align: center; padding: 24px; }
.error-page .box { max-width: 420px; }
.error-page .code { font-size: 84px; font-weight: 900; color: var(--brand-900); letter-spacing: -3px; line-height: 1; }
.error-page h2 { font-size: 19px; font-weight: 800; margin: 10px 0 6px; }
.error-page p { color: var(--muted); font-size: 14px; }
.error-page img { height: 30px; margin-bottom: 26px; }

/* ── Responsivo ──────────────────────────────────────────── */
@media (max-width: 899px) {
  .sidebar { transform: translateX(-100%); width: min(300px, 84vw); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main-content { margin-left: 0; }
  .btn-hamburger { display: inline-flex; }

  /* Topbar grafite + "folha" clara arredondada (estilo app) */
  .topbar {
    position: static;
    height: auto;
    background: var(--brand-900);
    color: var(--white);
    border-bottom: none;
    padding: calc(12px + var(--safe-top)) 16px 34px;
    -webkit-backdrop-filter: none; backdrop-filter: none;
    z-index: auto; /* como item flex, z-index pintaria por cima da faixa hero */
  }
  .topbar-title { color: var(--white); font-size: 16px; }
  .topbar .btn-hamburger, .topbar .icon-btn { background: rgba(255,255,255,.1); color: var(--white); }
  .topbar .btn-hamburger:hover, .topbar .icon-btn:hover { background: rgba(255,255,255,.18); }
  .topbar .icon-btn .dot { border-color: var(--brand-900); }
  .topbar .btn-primary { background: var(--white); color: var(--brand-900); border-color: var(--white); box-shadow: none; }
  .topbar-logo { display: block; }
  .topbar-actions .btn span.hide-sm { display: none; }

  .page-content {
    background: var(--bg);
    border-radius: 28px 28px 0 0;
    margin-top: -22px;
    padding: 24px 16px calc(var(--tabbar-h) + 24px + var(--safe-bot));
    position: relative;
    overflow: visible;
  }
  .page-header { flex-direction: column; gap: 10px; margin-bottom: 16px; }
  .page-header h1 { font-size: 21px; }
  .page-header-actions { width: 100%; }
  .page-header-actions .btn { flex: 1; }
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { padding: 15px 16px; }
  .metric-card .value { font-size: 21px; }
  .filter-bar { padding: 12px; gap: 8px; }
  .filter-bar .form-group { min-width: calc(50% - 4px); }
  .filter-bar .form-group:nth-of-type(odd):last-of-type { min-width: 100%; }
  .filter-bar .btn { flex: 1; }
  .card-header, .card-body { padding-left: 16px; padding-right: 16px; }
  .table-desktop { display: none !important; }
  .table-mobile  { display: block !important; }
  .admin-dash-grid, .show-layout-grid, .two-col { grid-template-columns: 1fr; }
  .bottom-nav { display: flex; }
  .status-chips-scroll, .segment {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; width: auto; max-width: none;
    margin-left: -16px; margin-right: -16px; padding: 4px 16px; border-radius: 0; background: transparent;
  }
  .status-chips-scroll::-webkit-scrollbar, .segment::-webkit-scrollbar { display: none; }
  .status-chip { background: var(--surface); border: 1px solid var(--border); }
  .status-chip.active { border-color: var(--brand-900); }
  .auth-card { padding: 26px 22px; }
  /* Evita zoom do iOS ao focar inputs */
  .form-control, select.form-control, textarea.form-control { font-size: 16px; }
}
@media (max-width: 480px) {
  .push-nudge { flex-wrap: wrap; }
  .push-nudge .push-actions { width: 100%; padding-left: 32px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .balance-item .value { font-size: 22px; }
  .quick-grid { grid-template-columns: repeat(3, 1fr); }
  .quick-tile { padding: 12px 8px; font-size: 12px; }
  .kv-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  .hero-band { padding-bottom: 80px; }
  .band-overlap { margin-top: -60px; padding: 0 22px; }
}
@media print {
  .sidebar, .topbar, .bottom-nav, .filter-bar, .btn { display: none !important; }
  .main-content { margin: 0; }
}



/* ═══ Portal Comercial ══════════════════════════════════════════════════ */

/* ── Sidebar: grupos expansíveis (módulos) ───────────────── */
.sidebar-group { margin-top: 4px; }
.sidebar-group-toggle {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin: 2px 0; border: none; background: transparent;
  color: var(--brand-200); font-size: 14px; font-weight: 500; border-radius: 12px;
  cursor: pointer; text-align: left; transition: background var(--transition), color var(--transition);
}
.sidebar-group-toggle svg { width: 19px; height: 19px; flex-shrink: 0; opacity: .85; }
.sidebar-group-toggle .chev { margin-left: auto; width: 15px; height: 15px; transition: transform .2s; opacity: .6; }
.sidebar-group-toggle:hover { background: rgba(255,255,255,.07); color: var(--white); }
.sidebar-group.open .sidebar-group-toggle .chev { transform: rotate(90deg); }
.sidebar-group.has-active .sidebar-group-toggle { color: var(--white); font-weight: 700; }
.sidebar-group-items { display: none; padding-left: 14px; }
.sidebar-group.open .sidebar-group-items { display: block; }
.sidebar-group-items .sidebar-link { padding: 8px 12px 8px 18px; font-size: 13.5px; position: relative; }
.sidebar-group-items .sidebar-link::before {
  content: ""; position: absolute; left: 6px; top: 50%; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; opacity: .45; transform: translateY(-50%);
}
.sidebar-group-items .sidebar-link.active::before { opacity: 1; }
.sidebar-link.is-soon { opacity: .55; cursor: default; pointer-events: none; }
.sidebar-link .soon {
  margin-left: auto; font-size: 9.5px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase;
  padding: 2px 7px; border-radius: 99px; background: rgba(255,255,255,.12); color: var(--brand-200);
}
.sidebar-module {
  display: flex; align-items: center; gap: 8px; padding: 18px 22px 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--brand-400);
}
.sidebar-module .mod-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-300); }

/* ── Barra de período ────────────────────────────────────── */
.period-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.period-bar .segment { margin: 0; }
.period-bar .period-custom { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.period-bar .period-custom .form-control { padding: 7px 10px; font-size: 13px; width: 140px; }
.period-bar .period-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
@media (max-width: 899px) {
  .period-bar { padding: 10px; }
  .period-bar .period-custom { margin-left: 0; width: 100%; }
  .period-bar .period-custom .form-control { flex: 1; width: auto; }
}

/* ── KPI com variação ────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi-grid > * { min-width: 0; }
.kpi { position: relative; }
.kpi .delta {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 8px;
  font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 99px;
  background: var(--brand-100); color: var(--brand-700); font-variant-numeric: tabular-nums;
}
.kpi .delta svg { width: 12px; height: 12px; }
.kpi .delta.up   { background: var(--success-soft); color: var(--success); }
.kpi .delta.down { background: var(--danger-soft);  color: var(--danger); }
.kpi .delta.flat { background: var(--brand-100); color: var(--brand-600); }
.kpi .delta-note { font-size: 11.5px; color: var(--muted-2); margin-left: 6px; font-weight: 600; white-space: nowrap; }
@media (max-width: 480px) { .kpi .delta-note { display: none; } }
.metric-card.accent .delta { background: rgba(255,255,255,.14); color: var(--white); }
.metric-card.accent .delta.up { background: rgba(255,255,255,.18); }
.metric-card.accent .delta-note { color: var(--brand-300); }
.kpi-mini { display: flex; flex-direction: column; gap: 2px; }
.kpi-mini .k { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.kpi-mini .v { font-size: 18px; font-weight: 800; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.kpi-mini .s { font-size: 12px; color: var(--muted); }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px 18px; }

/* ── Gráficos ────────────────────────────────────────────── */
.chart-card .card-body { padding: 14px 18px 18px; }
.chart-box { position: relative; width: 100%; height: 280px; }
.chart-box.sm { height: 220px; }
.chart-box.lg { height: 340px; }
.chart-box canvas { width: 100% !important; height: 100% !important; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 10px; font-size: 12px; color: var(--text-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-empty { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.dash-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.dash-grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; margin-bottom: 18px; }
.dash-grid-2 > *, .dash-grid-3 > * { min-width: 0; }
.dash-grid-2 .card + .card, .dash-grid-3 .card + .card { margin-top: 0; }
@media (max-width: 899px) { .dash-grid-2, .dash-grid-3 { grid-template-columns: 1fr; } .chart-box { height: 240px; } }

/* ── Ranking (barras horizontais) ────────────────────────── */
.rank-list { display: flex; flex-direction: column; gap: 12px; }
.rank-item .rank-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; margin-bottom: 5px; }
.rank-item .rank-head .name { font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rank-item .rank-head .name a { color: inherit; }
.rank-item .rank-head .name a:hover { text-decoration: underline; text-underline-offset: 2px; }
.rank-item .rank-head .val { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-2); font-weight: 600; }
.rank-item .rank-head .val small { color: var(--muted); font-size: 11.5px; margin-left: 4px; }
.rank-item .rank-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.progress.thin { height: 6px; }
.progress > div.success { background: var(--success); }
.progress > div.danger  { background: var(--danger); }
.progress > div.warning { background: var(--warning); }
.progress > div.info    { background: var(--info); }
.progress.stacked { display: flex; }
.progress.stacked > div { border-radius: 0; }

/* ── Funil ───────────────────────────────────────────────── */
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel-step { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 12px; font-size: 13px; }
.funnel-step .fn { font-weight: 700; color: var(--text-2); }
.funnel-step .fb { height: 26px; border-radius: 8px; background: var(--brand-100); overflow: hidden; }
.funnel-step .fb > div { height: 100%; background: var(--grad-card); border-radius: 8px; min-width: 4px; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.funnel-step.approved .fb > div { background: var(--success); }
.funnel-step.refused .fb > div  { background: var(--danger); }
.funnel-step .fv { font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; text-align: right; }
.funnel-step .fv small { display: block; font-weight: 600; color: var(--muted); font-size: 11px; }
@media (max-width: 480px) { .funnel-step { grid-template-columns: 96px 1fr auto; } }

/* ── Tabelas padronizadas ────────────────────────────────── */
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--white);
}
.table-toolbar .count { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.table-toolbar .tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
table.data-table th.sortable { padding: 0; }
table.data-table th.sortable a {
  display: flex; align-items: center; gap: 4px; padding: 11px 16px; color: inherit; white-space: nowrap;
}
table.data-table th.sortable a:hover { color: var(--text); }
table.data-table th.sortable a svg { width: 12px; height: 12px; opacity: .35; }
table.data-table th.sortable.active a { color: var(--text); }
table.data-table th.sortable.active a svg { opacity: 1; }
table.data-table th.num, table.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data-table th.num.sortable a { justify-content: flex-end; }
table.data-table td.num { font-weight: 600; }
table.data-table tfoot td { background: var(--brand-50); font-weight: 800; color: var(--text); border-top: 2px solid var(--border-2); padding: 12px 16px; }
table.data-table tr.is-total td { font-weight: 800; }
table.data-table .cell-sub { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; margin-top: 1px; }
table.data-table td .bar-inline { display: inline-block; vertical-align: middle; width: 70px; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-right: 8px; }
table.data-table td .bar-inline > i { display: block; height: 100%; background: var(--brand-800); border-radius: 99px; }
.table-wrap.sticky thead th { position: sticky; top: 0; z-index: 1; }
.table-compact td { padding: 9px 14px; font-size: 13px; }
.table-compact thead th { padding: 9px 14px; }
.cell-muted { color: var(--muted); font-size: 12.5px; }
.pct { font-variant-numeric: tabular-nums; font-weight: 700; }
.pct.good { color: var(--success); } .pct.bad { color: var(--danger); } .pct.mid { color: var(--warning); }

/* Cards mobile de registros (padrão para qualquer listagem) */
.rec-card { display: block; padding: 14px 16px; border-bottom: 1px solid var(--border); color: inherit; }
.rec-card:last-child { border-bottom: none; }
a.rec-card:hover { background: var(--brand-50); }
.rec-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.rec-title { font-size: 14px; font-weight: 700; color: var(--text); min-width: 0; }
.rec-title small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 1px; }
.rec-amount { font-size: 14.5px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rec-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 8px; font-size: 12px; color: var(--muted); align-items: center; }

/* ── Heatmap mês × ano ───────────────────────────────────── */
.heatmap { display: grid; gap: 4px; font-size: 12px; }
.heatmap .hm-cell {
  border-radius: 8px; padding: 8px 6px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--brand-50); color: var(--text-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.heatmap .hm-cell.l1 { background: #DCE8EE; }
.heatmap .hm-cell.l2 { background: #B8CFDB; }
.heatmap .hm-cell.l3 { background: #8EAEBF; color: var(--white); }
.heatmap .hm-cell.l4 { background: #5E7C8A; color: var(--white); }
.heatmap .hm-cell.l5 { background: var(--brand-900); color: var(--white); }
.heatmap .hm-head { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; text-align: center; padding: 4px 0; }
.heatmap .hm-row { font-size: 12px; font-weight: 800; color: var(--text-2); display: flex; align-items: center; padding-left: 4px; }

/* ── Callouts de qualidade / sincronização ───────────────── */
.sync-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  padding: 5px 11px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.sync-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); display: inline-block; }
.sync-pill.stale i { background: var(--warning); }
.sync-pill.error i { background: var(--danger); }
.sync-pill svg { width: 13px; height: 13px; }
.quality-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.quality-item { background: var(--brand-50); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.quality-item .q { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.quality-item .n { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 2px; }
.quality-item .n small { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.quality-item.warn .n { color: var(--warning); }
.quality-item.bad .n  { color: var(--danger); }

/* ── Badges de status comerciais ─────────────────────────── */
.badge-open { background: var(--info-soft); color: var(--info); }
.badge-none { background: var(--brand-100); color: var(--brand-600); }
.badge-none::before { opacity: .4; }
.badge-lg { font-size: 12.5px; padding: 5px 12px 5px 10px; }

/* ── Tabs de análise ─────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 10px 14px; font-size: 13.5px; font-weight: 700; color: var(--muted); white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color var(--transition), border-color var(--transition);
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--brand-900); }

/* ── Cabeçalho de cliente ────────────────────────────────── */
.client-hero { display: flex; align-items: center; gap: 16px; }
.client-hero .avatar { width: 56px; height: 56px; font-size: 18px; border-radius: 16px; background: var(--grad-card); color: var(--white); }
.client-hero h1 { font-size: 21px; font-weight: 800; letter-spacing: -.3px; line-height: 1.2; }
.client-hero p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.meta-inline { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--text-2); }
.meta-inline span { display: inline-flex; align-items: center; gap: 5px; }
.meta-inline svg { width: 14px; height: 14px; color: var(--muted); }

/* ── Detalhe de proposta ─────────────────────────────────── */
.detail-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.detail-hero .amount { font-size: 30px; font-weight: 800; letter-spacing: -.8px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.detail-hero .amount small { display: block; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; margin-bottom: 4px; }
.raw-box { background: var(--brand-50); border: 1px dashed var(--border-2); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 12.5px; color: var(--text-2); }
.raw-box code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--text); }
.flag-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── Sincronização (admin) ───────────────────────────────── */
.sync-state { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.code-box {
  background: var(--brand-900); color: var(--brand-100); border-radius: var(--radius-sm); padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; overflow-x: auto; white-space: pre; line-height: 1.55;
}
.step-list { counter-reset: s; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.step-list li { position: relative; padding-left: 34px; font-size: 13.5px; color: var(--text-2); line-height: 1.5; counter-increment: s; }
.step-list li::before {
  content: counter(s); position: absolute; left: 0; top: 1px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--brand-900); color: var(--white); font-size: 11.5px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.step-list li strong { color: var(--text); }

/* ── Metas (grade mês a mês) ─────────────────────────────── */
.targets-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.targets-grid .form-group { margin: 0; }
.targets-grid .form-label { font-size: 12px; }

/* ── Skeleton (carregamento) ─────────────────────────────── */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

@media print {
  .period-bar, .table-toolbar .tools, .tabs { display: none !important; }
  .chart-box { height: 260px; }
}
