/* ================================================================
   FarmaGov — Design System v3
   Tema: Institucional refinado — azul governo + verde saúde
   ================================================================ */



:root {
  /* ════════════════════════════════════════════════
     Design System v4 (2026) — tokens --fi-*
     Telas migradas usam estes; os nomes antigos abaixo
     permanecem como alias p/ não quebrar telas legadas.
     ════════════════════════════════════════════════ */
  /* Teal — primária (saúde) */
  --fi-teal-50:  #E1F5EE;
  --fi-teal-100: #9FE1CB;
  --fi-teal-200: #5DCAA5;
  --fi-teal-500: #1D9E75;
  --fi-teal-700: #0F6E56;
  --fi-teal-900: #04342C;
  /* Azul — institucional / SIGAF / info */
  --fi-blue-50:  #E6F1FB;
  --fi-blue-500: #378ADD;
  --fi-blue-600: #185FA5;
  --fi-blue-900: #042C53;
  /* Âmbar — atenção / vencimento próximo */
  --fi-amber-50:  #FAEEDA;
  --fi-amber-200: #FAC775;
  --fi-amber-500: #EF9F27;
  --fi-amber-700: #854F0B;
  /* Vermelho — crítico / zerado / vencido */
  --fi-red-50:  #FCEBEB;
  --fi-red-200: #F09595;
  --fi-red-500: #E24B4A;
  --fi-red-700: #A32D2D;
  /* Roxo — IA / inteligência */
  --fi-purple-50:  #EEEDFE;
  --fi-purple-500: #534AB7;
  --fi-purple-900: #26215C;
  /* Neutros */
  --fi-bg:       #F0F2F7;
  --fi-card:     #FFFFFF;
  --fi-border:   rgba(15,23,42,.08);
  --fi-text:     #0F172A;
  --fi-muted:    #64748B;
  --fi-radius:    12px;
  --fi-radius-sm: 8px;
  --fi-shadow:    0 1px 3px rgba(15,23,42,.06);

  /* ── Paleta FarmaInteligente ── */
  /* Azul profundo (texto logo + sidebar) */
  --blue-50:  #eef4fb;
  --blue-100: #d0e4f5;
  --blue-200: #a8ccec;
  --blue-500: #2d7ab5;
  --blue-600: #1a5f96;
  --blue-700: #154d7d;
  --blue-800: #103d65;
  --blue-900: #0c2d4e;

  /* Teal/Verde (acento logo) */
  --teal-50:  #e6faf8;
  --teal-100: #b3f0ea;
  --teal-200: #66e0d5;
  --teal-400: #17c3b2;
  --teal-500: #00b894;
  --teal-600: #009d7d;
  --teal-700: #007a61;

  /* Verde saúde (mapeado para green) */
  --green-50:  #e6faf8;
  --green-100: #b3f0ea;
  --green-500: #00b894;
  --green-600: #009d7d;
  --green-700: #007a61;

  --amber-50:  #fffbeb;
  --amber-100: #fef3c7;
  --amber-500: #f59e0b;
  --amber-600: #d97706;

  --red-50:  #fef2f2;
  --red-100: #fee2e2;
  --red-500: #ef4444;
  --red-600: #dc2626;

  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  /* Semânticos — agora apontando p/ a paleta v4 (alias) */
  --primary:        var(--fi-teal-500);
  --primary-dark:   var(--fi-teal-700);
  --primary-light:  var(--fi-teal-50);
  --primary-navy:   #1e3a5f;
  --success:        var(--fi-teal-700);
  --warning:        var(--fi-amber-700);
  --danger:         var(--fi-red-700);
  --text:           var(--fi-text);
  --text-muted:     var(--fi-muted);
  --border:         var(--fi-border);
  --bg-page:        var(--fi-bg);
  --bg-card:        var(--fi-card);
  --sidebar-w:      240px;
  --topbar-h:       58px;

  /* Tipografia */
  --font:       'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono:  'DM Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;

  /* Sombras */
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow:    0 1px 3px rgba(15,23,42,.08), 0 4px 16px rgba(15,23,42,.06);
  --shadow-md: 0 4px 8px rgba(15,23,42,.08), 0 12px 32px rgba(15,23,42,.08);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-page);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Scrollbar refinada ─────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 99px; }

/* ══════════════════════════════════════════════════
   TOPBAR
══════════════════════════════════════════════════ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--topbar-h);
  background: linear-gradient(90deg, #0c2d4e 0%, #1a5f96 65%, #009d7d 100%);
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px 0 calc(var(--sidebar-w) + 20px);
  gap: 16px;
}

.topbar-left { display: flex; align-items: center; gap: 12px; flex: 1; }
.topbar-logo-mobile { display: none; } /* visível só em mobile via @media */

.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius);
  padding: 6px 12px;
  width: 280px;
  transition: border .2s;
}
.topbar-search:focus-within { border-color: var(--blue-500); }
.topbar-search input {
  background: none; border: none; outline: none;
  color: #fff; font-family: var(--font); font-size: 13px;
  width: 100%;
}
.topbar-search input::placeholder { color: var(--slate-500); }
.topbar-search svg { color: var(--slate-500); flex-shrink: 0; }

.topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar-badge {
  position: relative; cursor: pointer;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  color: var(--slate-400);
  transition: background .15s, color .15s;
}
.topbar-badge:hover { background: rgba(255,255,255,.08); color: #fff; }
.topbar-badge .dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--red-500);
  border-radius: 50%;
  border: 2px solid var(--slate-900);
}

.topbar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s;
}
.topbar-user:hover { background: rgba(255,255,255,.08); }
.topbar-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--blue-600);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.topbar-user-name { font-size: 13px; font-weight: 500; color: #fff; }
.topbar-user-role { font-size: 11px; color: var(--slate-400); }

/* ══════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════ */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 300;
  width: var(--sidebar-w);
  background: linear-gradient(175deg, #0c2d4e 0%, #1a3d5c 55%, #0e3d35 100%);
  border-right: 1px solid rgba(0,184,148,.12);
  display: flex; flex-direction: column;
  overflow-y: auto;
}

.sidebar-brand {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sidebar-brand-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.sidebar-brand-icon img {
  width: 40px; height: 40px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}
.sidebar-brand-text { line-height: 1.2; }
.sidebar-brand-name { font-size: 13px; font-weight: 700; color: #fff; letter-spacing: -.2px; }
.sidebar-brand-name em { color: var(--teal-400); font-style: normal; }
.sidebar-brand-sub  { font-size: 10px; color: var(--slate-400); text-transform: uppercase; letter-spacing: .06em; }

.sidebar-nav { padding: 12px 10px; flex: 1; }

.nav-section {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--slate-600);
  padding: 14px 8px 5px;
}

.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--slate-400);
  text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  margin-bottom: 1px;
  transition: background .15s, color .15s;
  position: relative;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #e2e8f0; }
.nav-link.active {
  background: rgba(0,184,148,.15);
  color: #7fffd4;
}
.nav-link.active::before {
  content: '';
  position: absolute; left: 0; top: 25%; bottom: 25%;
  width: 3px; background: var(--teal-500);
  border-radius: 0 3px 3px 0;
}
.nav-link .icon { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--red-500);
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 99px;
  min-width: 18px; text-align: center;
}

.sidebar-footer {
  padding: 10px;
  border-top: 1px solid rgba(255,255,255,.06);
}

/* ══════════════════════════════════════════════════
   LAYOUT PRINCIPAL
══════════════════════════════════════════════════ */
.layout {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  min-height: calc(100vh - var(--topbar-h));
}

.page { padding: 24px 28px; max-width: 1400px; }

.page-header { margin-bottom: 24px; }
.page-header h1 {
  font-size: 22px; font-weight: 700;
  color: var(--text); letter-spacing: -.3px;
  margin-bottom: 3px;
}
.page-header p { color: var(--text-muted); font-size: 13.5px; }

.page-header-row {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 16px;
  margin-bottom: 24px;
}

/* ══════════════════════════════════════════════════
   CARDS KPI
══════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.kpi-card::after {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
}
.kpi-card.blue::after   { background: var(--blue-500); }
.kpi-card.green::after  { background: var(--green-500); }
.kpi-card.amber::after  { background: var(--amber-500); }
.kpi-card.red::after    { background: var(--red-500); }

.kpi-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 14px;
}
.kpi-card.blue  .kpi-icon { background: var(--blue-50); }
.kpi-card.green .kpi-icon { background: var(--green-50); }
.kpi-card.amber .kpi-icon { background: var(--amber-50); }
.kpi-card.red   .kpi-icon { background: var(--red-50); }

.kpi-value {
  font-size: 26px; font-weight: 700;
  color: var(--text); line-height: 1.1;
  letter-spacing: -.5px;
}
.kpi-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.kpi-trend {
  margin-top: 8px;
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center; gap: 3px;
}
.kpi-trend.up   { color: var(--green-600); }
.kpi-trend.down { color: var(--red-600); }
.kpi-trend.neutral { color: var(--text-muted); }

/* ══════════════════════════════════════════════════
   PANEL / CARD
══════════════════════════════════════════════════ */
.panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}
.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
}
.panel-title {
  font-size: 14px; font-weight: 600;
  color: var(--text);
}
.panel-body { padding: 20px; }
.panel-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--slate-50);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ══════════════════════════════════════════════════
   FORMULÁRIOS
══════════════════════════════════════════════════ */
.form-grid   { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.col-full { grid-column: 1/-1; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--slate-500);
}
.field input,
.field select,
.field textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius);
  font-family: var(--font); font-size: 13.5px;
  color: var(--text); background: #fff;
  transition: border .15s, box-shadow .15s;
  width: 100%;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.field input.error { border-color: var(--red-500); }
.field .hint { font-size: 11px; color: var(--text-muted); }

/* Input com ícone */
.input-wrap { position: relative; }
.input-wrap input { padding-left: 36px; }
.input-wrap .input-icon {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--slate-400); font-size: 15px; pointer-events: none;
}

/* ══════════════════════════════════════════════════
   BOTÕES
══════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px;
  border: none; border-radius: var(--radius);
  font-family: var(--font); font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: all .15s; white-space: nowrap;
  user-select: none;
}
.btn:active { transform: scale(.97); }

.btn-primary { background: var(--blue-600); color: #fff; }
.btn-primary:hover { background: var(--blue-700); }

.btn-success { background: var(--green-600); color: #fff; }
.btn-success:hover { background: var(--green-700); }

.btn-danger  { background: var(--red-600); color: #fff; }
.btn-danger:hover  { background: #b91c1c; }

.btn-outline {
  background: transparent;
  color: var(--blue-600);
  border: 1.5px solid var(--blue-200);
}
.btn-outline:hover { background: var(--blue-50); border-color: var(--blue-400); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--slate-100); color: var(--text); }

.btn-sm  { padding: 5px 10px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg  { padding: 11px 22px; font-size: 14px; }
.btn-icon { padding: 8px; width: 34px; height: 34px; justify-content: center; }

/* ══════════════════════════════════════════════════
   TABELAS
══════════════════════════════════════════════════ */
.table-wrap {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden; margin-bottom: 20px;
}
.table-wrap table { width: 100%; border-collapse: collapse; }

.table-wrap thead tr {
  background: var(--slate-50);
  border-bottom: 1px solid var(--border);
}
.table-wrap th {
  padding: 10px 14px;
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--slate-400); text-align: left;
}
.table-wrap td {
  padding: 11px 14px;
  font-size: 13.5px;
  border-bottom: 1px solid #f8fafc;
  vertical-align: middle;
}
.table-wrap tbody tr:last-child td { border-bottom: none; }
.table-wrap tbody tr:hover td { background: #fafbfc; }

.td-mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.td-actions { white-space: nowrap; text-align: right; }

/* Linha de alerta na tabela */
.row-danger td  { background: var(--red-50) !important; }
.row-warning td { background: var(--amber-50) !important; }

/* ══════════════════════════════════════════════════
   BADGES / STATUS
══════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 600;
}
.badge-green  { background: var(--green-100); color: #15803d; }
.badge-blue   { background: var(--blue-100);  color: #1d4ed8; }
.badge-amber  { background: var(--amber-100); color: #b45309; }
.badge-red    { background: var(--red-100);   color: #b91c1c; }
.badge-gray   { background: var(--slate-100); color: var(--slate-600); }
.badge-dot::before {
  content: ''; width: 5px; height: 5px;
  border-radius: 50%; background: currentColor;
}

/* ══════════════════════════════════════════════════
   ALERTAS FLASH
══════════════════════════════════════════════════ */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 13.5px; margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
  border-left: 4px solid;
}
.alert-success { background: var(--green-50); color: #14532d; border-color: var(--green-500); }
.alert-error   { background: var(--red-50);   color: #7f1d1d; border-color: var(--red-500); }
.alert-warning { background: var(--amber-50); color: #78350f; border-color: var(--amber-500); }
.alert-info    { background: var(--blue-50);  color: #1e3a8a; border-color: var(--blue-500); }

/* ══════════════════════════════════════════════════
   BANNERS DE ALERTA (no topo da página)
══════════════════════════════════════════════════ */
.alert-banner {
  background: var(--red-50);
  border: 1px solid #fca5a5;
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex; align-items: flex-start; gap: 14px;
}
.alert-banner-icon { font-size: 22px; flex-shrink: 0; margin-top: 1px; }
.alert-banner-title { font-size: 14px; font-weight: 600; color: #991b1b; margin-bottom: 4px; }
.alert-banner-body  { font-size: 13px; color: #7f1d1d; }
.alert-banner-list  { margin: 6px 0 0 16px; }
.alert-banner-list li { margin-bottom: 2px; }

.alert-banner.amber {
  background: var(--amber-50); border-color: #fcd34d;
}
.alert-banner.amber .alert-banner-title { color: #92400e; }
.alert-banner.amber .alert-banner-body  { color: #78350f; }

/* ══════════════════════════════════════════════════
   CHARTS
══════════════════════════════════════════════════ */
.chart-container {
  position: relative; width: 100%;
}
.chart-container canvas { max-width: 100%; }

/* Grid de charts */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.chart-grid-3 {
  grid-template-columns: 2fr 1fr;
}

/* ══════════════════════════════════════════════════
   UPLOAD ZONE (NF-e)
══════════════════════════════════════════════════ */
.upload-zone {
  border: 2px dashed var(--slate-300);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--slate-50);
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--blue-400);
  background: var(--blue-50);
}
.upload-zone input[type=file] { display: none; }
.upload-icon { font-size: 40px; margin-bottom: 12px; }
.upload-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.upload-sub   { font-size: 12.5px; color: var(--text-muted); }

/* ══════════════════════════════════════════════════
   CURVA ABC
══════════════════════════════════════════════════ */
.abc-a { background: #dcfce7; color: #15803d; }
.abc-b { background: #dbeafe; color: #1d4ed8; }
.abc-c { background: #f3f4f6; color: #374151; }

/* ══════════════════════════════════════════════════
   IA CARD (insights)
══════════════════════════════════════════════════ */
.ia-card {
  background: linear-gradient(135deg, var(--blue-900) 0%, #1a1a3e 100%);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  color: #fff;
  margin-bottom: 20px;
  position: relative; overflow: hidden;
}
.ia-card::before {
  content: '';
  position: absolute; top: -30px; right: -30px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(99,102,241,.4), transparent 70%);
  border-radius: 50%;
}
.ia-card-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.ia-badge {
  background: rgba(99,102,241,.3);
  border: 1px solid rgba(99,102,241,.5);
  color: #a5b4fc;
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 99px;
  text-transform: uppercase; letter-spacing: .08em;
}
.ia-card-title { font-size: 14px; font-weight: 600; }
.ia-insight { font-size: 13.5px; color: #c7d2fe; line-height: 1.6; }
.ia-insights-list { list-style: none; }
.ia-insights-list li {
  padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.07);
  font-size: 13px; color: #c7d2fe; display: flex; gap: 8px;
}
.ia-insights-list li:last-child { border-bottom: none; }
.ia-insights-list li::before { content: '→'; color: #818cf8; flex-shrink: 0; }

/* ══════════════════════════════════════════════════
   PROGRESS BAR
══════════════════════════════════════════════════ */
.progress {
  height: 6px; background: var(--slate-100);
  border-radius: 99px; overflow: hidden;
}
.progress-bar {
  height: 100%; border-radius: 99px;
  transition: width .4s ease;
}
.progress-bar.blue  { background: var(--blue-500); }
.progress-bar.green { background: var(--green-500); }
.progress-bar.amber { background: var(--amber-500); }
.progress-bar.red   { background: var(--red-500); }

/* ══════════════════════════════════════════════════
   TABS
══════════════════════════════════════════════════ */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.tab {
  padding: 10px 18px;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
  text-decoration: none;
}
.tab:hover  { color: var(--text); }
.tab.active { color: var(--blue-600); border-color: var(--blue-600); font-weight: 600; }

/* ══════════════════════════════════════════════════
   LOGIN
══════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh; background: var(--slate-900);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-split {
  display: grid; grid-template-columns: 1fr 420px;
  max-width: 900px; width: 100%;
  background: var(--slate-800);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.login-left {
  padding: 48px;
  background: linear-gradient(145deg, var(--blue-800) 0%, var(--slate-900) 100%);
  display: flex; flex-direction: column; justify-content: space-between;
}
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.login-logo-icon {
  width: 44px; height: 44px;
  background: rgba(255,255,255,.1); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.login-logo-name { font-size: 20px; font-weight: 800; color: #fff; letter-spacing: -.4px; }
.login-headline { font-size: 28px; font-weight: 700; color: #fff; line-height: 1.2; margin-bottom: 12px; }
.login-sub { font-size: 14px; color: var(--blue-200); line-height: 1.6; }
.login-features { list-style: none; margin-top: 28px; }
.login-features li {
  padding: 8px 0; font-size: 13.5px; color: var(--blue-200);
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.login-features li:last-child { border-bottom: none; }
.login-features li span { font-size: 16px; }

.login-right {
  padding: 48px 40px;
  background: var(--slate-800);
  display: flex; flex-direction: column; justify-content: center;
}
.login-right h2 { font-size: 22px; font-weight: 700; color: #fff; margin-bottom: 6px; }
.login-right p  { font-size: 13px; color: var(--slate-400); margin-bottom: 28px; }

.login-field { margin-bottom: 16px; }
.login-field label { display: block; font-size: 11.5px; font-weight: 600; color: var(--slate-400); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.login-field input {
  width: 100%; padding: 11px 14px;
  background: rgba(255,255,255,.06);
  border: 1.5px solid rgba(255,255,255,.1);
  border-radius: var(--radius); font-family: var(--font); font-size: 14px; color: #fff;
  transition: border .15s;
}
.login-field input:focus { outline: none; border-color: var(--blue-500); background: rgba(255,255,255,.09); }
.login-field input::placeholder { color: var(--slate-500); }

.login-btn {
  width: 100%; padding: 13px; border: none; border-radius: var(--radius);
  background: var(--blue-600); color: #fff; font-family: var(--font);
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: background .15s;
}
.login-btn:hover { background: var(--blue-700); }

/* ══════════════════════════════════════════════════
   UTILITIES
══════════════════════════════════════════════════ */
.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: 12px; }
.text-xs      { font-size: 11px; }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.font-mono    { font-family: var(--font-mono); }
.font-bold    { font-weight: 700; }
.flex         { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-4  { gap: 4px; }  .gap-8  { gap: 8px; }  .gap-12 { gap: 12px; }  .gap-16 { gap: 16px; }
.mt-8   { margin-top: 8px; }  .mt-16  { margin-top: 16px; }  .mt-24  { margin-top: 24px; }
.mb-8   { margin-bottom: 8px; } .mb-16  { margin-bottom: 16px; }
.hidden { display: none !important; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Spinner */
.spinner {
  width: 20px; height: 20px; border: 2.5px solid var(--slate-200);
  border-top-color: var(--blue-600); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--slate-100) 25%, var(--slate-200) 50%, var(--slate-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ══════════════════════════════════════════════════
   IMPRESSÃO
══════════════════════════════════════════════════ */
@media print {
  .sidebar, .topbar, .btn, .no-print, .ia-card { display: none !important; }
  .layout { margin: 0; }
  .page   { padding: 0; }
  .panel  { box-shadow: none; border: 1px solid #ddd; }
  body    { background: #fff; font-size: 12px; }
}

/* ══════════════════════════════════════════════════
   RESPONSIVO
══════════════════════════════════════════════════ */
/* ══════════════════════════════════════════════════
   RESPONSIVO — Tablet (≤1024px)
══════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  :root { --sidebar-w: 210px; }
  .cols-3  { grid-template-columns: 1fr 1fr; }
  .cols-4  { grid-template-columns: 1fr 1fr; }
  .chart-grid   { grid-template-columns: 1fr; }
  .chart-grid-3 { grid-template-columns: 1fr 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .page { padding: 20px; }
  .panel-body { padding: 16px; }
}

/* ══════════════════════════════════════════════════
   RESPONSIVO — Mobile (≤768px)
══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  /* ── Sidebar: oculta por padrão, desliza ao abrir ── */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    width: 260px;
    z-index: 400;
  }
  .sidebar.open { transform: translateX(0); }

  /* Overlay escuro ao abrir sidebar */
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 399;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(2px);
  }
  .sidebar-overlay.open { display: block; }

  /* ── Topbar ── */
  .topbar {
    padding-left: 16px;
    padding-right: 12px;
  }
  .topbar-search { display: none; }
  .topbar-user-role { display: none; }

  /* ── Hamburger button ── */
  .menu-toggle {
    display: flex;
    align-items: center; justify-content: center;
    width: 36px; height: 36px;
    background: rgba(255,255,255,.1);
    border: none; border-radius: 8px;
    cursor: pointer; color: #fff; font-size: 20px;
    margin-right: 10px; flex-shrink: 0;
    transition: background .15s;
  }
  .menu-toggle:hover { background: rgba(255,255,255,.18); }

  /* ── Layout principal ── */
  .layout { margin-left: 0; }
  .page   { padding: 14px; }

  /* ── Grids → coluna única ── */
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; }
  .col-full { grid-column: 1 / -1; }
  .chart-grid, .chart-grid-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* ── Page header: empilhar título e botão ── */
  .page-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
  }

  /* ── Paineis ── */
  .panel-body { padding: 14px; }
  .panel-header { padding: 12px 14px; }

  /* ── Tabelas: scroll horizontal ── */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 580px; }

  /* ── Formulários ── */
  .form-grid.cols-2,
  .form-grid.cols-3 { grid-template-columns: 1fr; }
  .flex-between { flex-wrap: wrap; gap: 10px; }

  /* ── Botões ── */
  .btn-lg { width: 100%; justify-content: center; }

  /* ── BI: KPI menor ── */
  .kpi-card { padding: 14px; }
  .kpi-value { font-size: 22px; }
  .kpi-icon  { width: 36px; height: 36px; font-size: 16px; }

  /* ── Topbar: logo na topbar em mobile ── */
  .topbar-logo-mobile {
    display: flex;
    align-items: center; gap: 8px;
    flex: 1;
  }
  .topbar-logo-mobile img {
    height: 28px; width: auto;
    filter: brightness(0) invert(1);
    opacity: .9;
  }
  .topbar-logo-mobile span {
    font-size: 13px; font-weight: 700; color: #fff;
    letter-spacing: -.2px;
  }
  .topbar-logo-mobile em { color: #17c3b2; font-style: normal; }
}

/* ══════════════════════════════════════════════════
   RESPONSIVO — Mobile pequeno (≤480px)
══════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .page { padding: 10px; }
  .panel-body { padding: 12px; }
  .topbar-badge .dot { display: none; }

  /* Tabela: fonte menor */
  .table-wrap td, .table-wrap th { padding: 8px 10px; font-size: 12px; }

  /* Botões de ação nas tabelas em linha */
  .td-actions { text-align: left; }
  .td-actions .btn { margin-bottom: 4px; }
}

/* ── Esconder hamburger em desktop ── */
.menu-toggle { display: none; }

/* ══════════════════════════════════════════════════
   FarmaInteligente — Identidade Visual
══════════════════════════════════════════════════ */

/* Botão primário: teal */
.btn-primary {
  background: linear-gradient(135deg, var(--teal-500) 0%, var(--teal-600) 100%);
  border-color: var(--teal-600);
  box-shadow: 0 2px 8px rgba(0,184,148,.30);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--teal-400) 0%, var(--teal-500) 100%);
  box-shadow: 0 4px 14px rgba(0,184,148,.40);
  transform: translateY(-1px);
}

/* Sidebar: seção labels mais visíveis */
.sidebar .nav-section {
  color: rgba(23,195,178,.55);
  letter-spacing: .12em;
}

/* Sidebar hover: teal sutil */
.sidebar .nav-link:hover {
  background: rgba(0,184,148,.10);
  color: #a7f3ed;
}

/* Sidebar footer: separador teal */
.sidebar-footer {
  border-top: 1px solid rgba(0,184,148,.18);
}

/* Brand: linha teal embaixo */
.sidebar-brand {
  border-bottom: 1px solid rgba(0,184,148,.20);
  background: rgba(0,0,0,.15);
}

/* Panel header: acento teal na borda */
.panel-header {
  border-bottom: 1px solid var(--border);
}

/* Badge verde → teal */
.badge-green {
  background: rgba(0,184,148,.12);
  color: var(--teal-600);
  border: 1px solid rgba(0,184,148,.25);
}

/* Link primário */
a.text-primary, .text-primary { color: var(--teal-500); }

/* Scrollbar teal */
::-webkit-scrollbar-thumb { background: rgba(0,184,148,.35); }
::-webkit-scrollbar-thumb:hover { background: var(--teal-500); }

/* Login page — logo centralizada */
.login-logo {
  display: block;
  width: 180px;
  margin: 0 auto 8px;
}
.login-card-header {
  background: linear-gradient(135deg, #0c2d4e, #009d7d);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 28px 32px 20px;
  text-align: center;
}

/* ══════════════════════════════════════════════════
   DESIGN SYSTEM v4 — componentes (telas migradas)
   Usa tokens --fi-*. Classes novas, não substituem as
   legadas; telas não migradas seguem intactas.
══════════════════════════════════════════════════ */

/* Ícones Tabler dentro de .icon (sidebar) ainda usam .icon p/ tamanho */
.icon.ti { font-size: 18px; line-height: 1; }

/* — Tipografia de página v4 (sentence case, pesos 400/500) — */
.fi-page-title { font-size: 20px; font-weight: 500; letter-spacing: -.2px; color: var(--fi-text); }
.fi-page-sub   { font-size: 13px; font-weight: 400; color: var(--fi-muted); margin-top: 2px; }
.fi-section    { font-size: 14px; font-weight: 500; color: var(--fi-text); display:flex; align-items:center; gap:8px; }
.fi-section .ti { font-size: 17px; color: var(--fi-muted); }

/* — KPI card v4 (barra vertical de status à esquerda) — */
.fi-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.fi-kpi {
  position: relative;
  background: var(--fi-card);
  border: 0.5px solid var(--fi-border);
  border-radius: var(--fi-radius);
  box-shadow: var(--fi-shadow);
  padding: 16px 16px 16px 18px;
  overflow: hidden;
}
.fi-kpi::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--fi-teal-500);
}
.fi-kpi.is-ok::before    { background: var(--fi-teal-500); }
.fi-kpi.is-info::before  { background: var(--fi-blue-500); }
.fi-kpi.is-warn::before  { background: var(--fi-amber-500); }
.fi-kpi.is-crit::before  { background: var(--fi-red-500); }
.fi-kpi-head { display: flex; align-items: center; gap: 7px; color: var(--fi-muted); }
.fi-kpi-head .ti { font-size: 16px; }
.fi-kpi-label { font-size: 12px; font-weight: 400; }
.fi-kpi-value { font-size: 24px; font-weight: 500; color: var(--fi-text); line-height: 1.15; margin-top: 6px; letter-spacing: -.3px; }
.fi-kpi-foot  { font-size: 12px; margin-top: 4px; display:flex; align-items:center; gap:5px; }
.fi-kpi.is-ok   .fi-kpi-foot { color: var(--fi-teal-700); }
.fi-kpi.is-info .fi-kpi-foot { color: var(--fi-blue-600); }
.fi-kpi.is-warn .fi-kpi-foot { color: var(--fi-amber-700); }
.fi-kpi.is-crit .fi-kpi-foot { color: var(--fi-red-700); }

/* — Chips de filtro/atalho — */
.fi-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.fi-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px;
  font-size: 12px; font-weight: 400; text-decoration: none;
  border: 0.5px solid transparent; cursor: pointer;
  background: var(--slate-100); color: var(--slate-600);
}
.fi-chip .ti { font-size: 14px; }
.fi-chip-count { font-weight: 500; }
.fi-chip.is-active { background: var(--fi-teal-500); color: #fff; }
.fi-chip.c-amber { background: var(--fi-amber-50);  color: var(--fi-amber-700); }
.fi-chip.c-red   { background: var(--fi-red-50);    color: var(--fi-red-700); }
.fi-chip.c-blue  { background: var(--fi-blue-50);   color: var(--fi-blue-600); }
.fi-chip.c-teal  { background: var(--fi-teal-50);   color: var(--fi-teal-700); }
.fi-chip:hover { filter: brightness(.98); }

/* — Card genérico v4 — */
.fi-card {
  background: var(--fi-card);
  border: 0.5px solid var(--fi-border);
  border-radius: var(--fi-radius);
  box-shadow: var(--fi-shadow);
}
.fi-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 0.5px solid var(--fi-border);
}
.fi-card-body { padding: 16px; }

/* — Donut "Saúde do estoque" — */
.fi-health { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.fi-donut {
  --p-ok: 0deg; --p-warn: 0deg;
  width: 132px; height: 132px; flex-shrink: 0; border-radius: 50%;
  background: conic-gradient(
    var(--fi-teal-500) 0 var(--p-ok),
    var(--fi-amber-500) var(--p-ok) var(--p-warn),
    var(--fi-red-500)   var(--p-warn) 360deg);
  display: grid; place-items: center;
}
.fi-donut-hole {
  width: 92px; height: 92px; border-radius: 50%; background: var(--fi-card);
  display: grid; place-items: center; text-align: center;
}
.fi-donut-pct { font-size: 22px; font-weight: 500; color: var(--fi-text); line-height: 1; }
.fi-donut-cap { font-size: 11px; color: var(--fi-muted); margin-top: 3px; }
.fi-legend { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 180px; }
.fi-legend-row { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--fi-text); }
.fi-legend-row .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.fi-legend-row .n { margin-left: auto; font-weight: 500; }
.fi-legend-row .lbl-sub { color: var(--fi-muted); font-size: 12px; }

/* — Painel de IA v4 (roxo) — */
.fi-ai {
  background: var(--fi-purple-50);
  border: 0.5px solid rgba(83,74,183,.18);
  border-radius: var(--fi-radius);
  padding: 16px 18px; margin-bottom: 18px;
}
.fi-ai-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.fi-ai-ico {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: var(--fi-purple-500); color: #fff;
  display: grid; place-items: center; font-size: 17px;
}
.fi-ai-title { font-size: 14px; font-weight: 500; color: var(--fi-purple-900); }
.fi-ai-text  { font-size: 13px; color: var(--fi-text); line-height: 1.6; }
.fi-ai-list  { list-style: none; margin: 10px 0 0; padding: 0; }
.fi-ai-list li {
  font-size: 13px; color: var(--fi-text); padding: 7px 0;
  border-top: 0.5px solid rgba(83,74,183,.14); display: flex; gap: 8px;
}
.fi-ai-list li::before { content: '→'; color: var(--fi-purple-500); flex-shrink: 0; }
.fi-ai-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.fi-ai-tag {
  background: var(--fi-red-50); color: var(--fi-red-700);
  padding: 4px 11px; border-radius: 999px; font-size: 12px;
}

/* — Lista de produtos (linhas-cartão) — */
.fi-list { display: flex; flex-direction: column; }
.fi-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; border-top: 0.5px solid var(--fi-border);
}
.fi-row:first-child { border-top: none; }
.fi-row-ico {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 18px;
  background: var(--fi-teal-50); color: var(--fi-teal-700);
}
.fi-row-ico.c-amber { background: var(--fi-amber-50); color: var(--fi-amber-700); }
.fi-row-ico.c-red   { background: var(--fi-red-50);   color: var(--fi-red-700); }
.fi-row-ico.c-blue  { background: var(--fi-blue-50);  color: var(--fi-blue-600); }
.fi-row-main { min-width: 0; flex: 1; }
.fi-row-name { font-size: 13.5px; font-weight: 500; color: var(--fi-text); display:flex; align-items:center; gap:7px; flex-wrap:wrap; }
.fi-row-sub  { font-size: 12px; color: var(--fi-muted); margin-top: 2px; }
.fi-row-end  { text-align: right; flex-shrink: 0; }
.fi-row-val  { font-size: 16px; font-weight: 500; color: var(--fi-text); line-height: 1.1; }
.fi-row-tag  { font-size: 11px; color: var(--fi-muted); margin-top: 2px; }

/* Badge CATMAT / validade v4 */
.fi-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 400;
}
.fi-badge.catmat { background: var(--fi-blue-50); color: var(--fi-blue-600); }
.fi-badge.venc   { background: var(--fi-amber-50); color: var(--fi-amber-700); }

/* Banner de alerta v4 (crítico no topo) */
.fi-banner {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--fi-red-50); border: 0.5px solid var(--fi-red-200);
  border-radius: var(--fi-radius); padding: 14px 16px; margin-bottom: 18px;
}
.fi-banner .ti { font-size: 22px; color: var(--fi-red-500); flex-shrink: 0; }
.fi-banner-title { font-size: 13.5px; font-weight: 500; color: var(--fi-red-700); }
.fi-banner-list { margin: 6px 0 0 0; padding-left: 18px; font-size: 12.5px; color: var(--fi-red-700); }
.fi-banner-list li { margin-bottom: 2px; }

/* Grid de painéis (charts / listas) */
.fi-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.fi-grid-21 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 18px; }
@media (max-width: 1024px) {
  .fi-grid-2, .fi-grid-21 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .fi-kpis { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .fi-kpis { grid-template-columns: 1fr; }
  .fi-health { justify-content: center; }
}

/* ════════════════════════════════════════════════════════════
   v4 extras — dispensação (stepper, banner info, saldo após)
   + linha-cartão com status à direita (posição de estoque)
   ════════════════════════════════════════════════════════════ */

/* Banner informativo (azul) — variante do .fi-banner */
.fi-banner.is-info { background: var(--fi-blue-50); border-color: rgba(55,138,221,.25); }
.fi-banner.is-info .ti { color: var(--fi-blue-500); }
.fi-banner.is-info .fi-banner-title { color: var(--fi-blue-600); }

/* Badge de status do relay/SIGAF */
.fi-relay-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 500; }
.fi-relay-badge .dot { width: 7px; height: 7px; border-radius: 50%; }
.fi-relay-badge.on  { background: var(--fi-teal-50); color: var(--fi-teal-700); }
.fi-relay-badge.on  .dot { background: var(--fi-teal-500); }
.fi-relay-badge.off { background: var(--slate-100); color: var(--fi-muted); }
.fi-relay-badge.off .dot { background: var(--fi-muted); }

/* Stepper guiado (dispensação) */
.fi-steps { display: flex; align-items: center; gap: 0; margin-bottom: 18px; }
.fi-step { display: flex; align-items: center; gap: 10px; }
.fi-step-num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 500; background: var(--slate-100); color: var(--fi-muted); flex-shrink: 0; }
.fi-step.is-active .fi-step-num { background: var(--fi-teal-500); color: #fff; }
.fi-step-label { font-size: 12.5px; color: var(--fi-muted); }
.fi-step.is-active .fi-step-label { color: var(--fi-text); font-weight: 500; }
.fi-step-line { flex: 1; height: 2px; background: var(--fi-border); margin: 0 10px; min-width: 16px; }
@media (max-width: 768px) { .fi-step-label { display: none; } }

/* Saldo após a saída (tempo real) */
.fi-saldo-apos { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-radius: var(--fi-radius-sm); background: var(--fi-teal-50); color: var(--fi-teal-700); font-size: 13px; }
.fi-saldo-apos .sa-val { font-size: 16px; font-weight: 500; }
.fi-saldo-apos.is-neg { background: var(--fi-red-50); color: var(--fi-red-700); }

/* Linha-cartão: status à direita com bolinha + barra de status à esquerda */
.fi-row-status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; margin-top: 3px; justify-content: flex-end; }
.fi-row-status .dot { width: 7px; height: 7px; border-radius: 50%; }
.fi-row.is-crit { border-left: 3px solid var(--fi-red-500); }
.fi-row.is-warn { border-left: 3px solid var(--fi-amber-500); }
.fi-row-actions { display: flex; gap: 4px; flex-shrink: 0; margin-left: 4px; }

/* ════════════════════════════════════════════════════════════════
   TABELA v4 — padrão único de LISTA (reutilizável em todas as telas)
   Uso: .fi-table  (defina as colunas via  style="--fi-cols: …")
        cabeçalho  .fi-thead > .fi-th(.is-right)
        linha      .fi-tr(.is-warn|.is-crit) > .fi-status-bar + .fi-td(s)
   Auto-placement: as células preenchem as faixas na ordem do HTML,
   então no mobile basta marcar .fi-hide-sm e definir --fi-cols-sm.
   ════════════════════════════════════════════════════════════════ */
.fi-table {
  background: var(--fi-card);
  border: 0.5px solid var(--fi-border);
  border-radius: var(--fi-radius-lg, 14px);
  overflow: hidden;
  --fi-cols: 8px 2fr 1fr 110px 130px;   /* fallback — cada view sobrescreve */
}
.fi-thead, .fi-tr {
  display: grid;
  grid-template-columns: var(--fi-cols);
  align-items: center;
  column-gap: 14px;
  padding: 0 16px;
}
.fi-thead {
  background: var(--fi-bg);
  border-bottom: 0.5px solid var(--fi-border);
  min-height: 38px;
}
.fi-th {
  font-size: 11px; font-weight: 500; color: var(--fi-muted);
  text-transform: uppercase; letter-spacing: .3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fi-th.is-right { text-align: right; }
.fi-th.is-center { text-align: center; }

.fi-tr {
  border-bottom: 0.5px solid var(--fi-border);
  min-height: 56px;
  padding-top: 9px; padding-bottom: 9px;
  transition: background .12s ease;
}
.fi-tr:last-child { border-bottom: none; }
.fi-tr:hover { background: rgba(15,23,42,.018); }
.fi-tr.is-crit { background: #FCFAFA; }

/* barra de status à esquerda (8px) */
.fi-status-bar { width: 8px; height: 34px; border-radius: 3px; background: var(--fi-teal-500); }
.fi-status-bar.is-ok   { background: var(--fi-teal-500); }
.fi-status-bar.is-warn { background: var(--fi-amber-500); }
.fi-status-bar.is-crit { background: var(--fi-red-500); }
.fi-status-bar.is-muted{ background: var(--slate-300); }

.fi-td { min-width: 0; font-size: 13px; color: var(--fi-text); }
.fi-td.is-right  { text-align: right; }
.fi-td.is-center { text-align: center; }

/* coluna principal: nome + subtexto */
.fi-td-name { font-size: 13px; font-weight: 500; color: var(--fi-text);
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.fi-td-name .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.fi-td-sub  { font-size: 11px; color: var(--slate-400); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* coluna saldo */
.fi-td-val { font-size: 14px; font-weight: 500; color: var(--fi-text); white-space: nowrap; }
.fi-td-val small { font-size: 12px; font-weight: 400; color: var(--fi-muted); }
.fi-td-val.is-crit { color: var(--fi-red-700); }
.fi-td-val.is-warn { color: var(--fi-amber-700); }

/* badge de status OK/Atenção/Crítico */
.fi-st-badge { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 99px;
  background: var(--fi-teal-50); color: var(--fi-teal-700); }
.fi-st-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.fi-st-badge.is-warn { background: var(--fi-amber-50); color: var(--fi-amber-700); }
.fi-st-badge.is-crit { background: var(--fi-red-50);   color: var(--fi-red-700); }
.fi-st-badge.is-muted{ background: var(--slate-100);   color: var(--slate-500); }

/* coluna ações */
.fi-td-actions { display: flex; gap: 4px; align-items: center; justify-content: flex-end; }

/* rodapé */
.fi-table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; font-size: 12px; color: var(--fi-muted);
  border-top: 0.5px solid var(--fi-border); background: var(--fi-card); }

/* estado vazio */
.fi-table-empty { text-align: center; color: var(--fi-muted); padding: 36px 16px; font-size: 13px; }

/* responsivo: colunas menos importantes ocultam; nome+saldo+status ficam */
@media (max-width: 860px) {
  .fi-thead, .fi-tr { grid-template-columns: var(--fi-cols-sm, var(--fi-cols)); column-gap: 10px; }
  .fi-hide-sm { display: none !important; }
}
