/* ============================================================
   Palantír — Sistema de Fechamento Dental (Ativa)
   Tema visual: "obsidiana + brilho teal". Foco gerencial,
   leitura financeira limpa e layout responsivo (mobile-friendly).
   ============================================================ */

:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --line: #e6eaf1;
  --line-strong: #cdd5e1;

  --text: #0f1b2d;
  --text-soft: #45526a;
  --muted: #6b7890;

  --primary: #0d9488;
  --primary-strong: #0f766e;
  --primary-soft: #d6f5ef;
  --accent: #6366f1;

  --ok: #0f9d6b;
  --ok-soft: #d8f6e9;
  --warn: #d97706;
  --warn-soft: #fdf0d6;
  --danger: #dc2626;
  --danger-soft: #fde4e4;

  --sidebar-1: #0a1422;
  --sidebar-2: #122036;
  --sidebar-text: #aeb9cc;
  --sidebar-muted: #6b7894;

  --r: 16px;
  --r-sm: 10px;
  --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15, 27, 45, 0.06);
  --shadow: 0 12px 30px rgba(15, 27, 45, 0.08);
  --shadow-lg: 0 20px 45px rgba(15, 27, 45, 0.12);
  --ring: 0 0 0 3px rgba(13, 148, 136, 0.18);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(13, 148, 136, 0.06), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; }

/* ============================== Shell ============================== */

.app-shell {
  display: grid;
  grid-template-columns: 256px 1fr;
  min-height: 100vh;
}

/* ============================== Sidebar ============================== */

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 16px;
  color: var(--sidebar-text);
  background:
    radial-gradient(420px 220px at 20% 0%, rgba(13, 148, 136, 0.20), transparent 60%),
    linear-gradient(180deg, var(--sidebar-2), var(--sidebar-1));
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.brand img {
  width: 42px; height: 42px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18), 0 0 16px rgba(45, 212, 191, 0.28);
}
.brand strong {
  display: block;
  font-size: 18px;
  letter-spacing: 0.3px;
  color: #fff;
  background: linear-gradient(90deg, #ffffff, #8ee7da);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand span {
  display: block;
  font-size: 11.5px;
  color: var(--sidebar-muted);
  margin-top: 2px;
}

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-label {
  margin: 14px 10px 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--sidebar-muted);
}
.nav-item {
  position: relative;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--sidebar-text);
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(13, 148, 136, 0.28), rgba(13, 148, 136, 0.05));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.25);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0; top: 18%; bottom: 18%;
  width: 3px; border-radius: 3px;
  background: linear-gradient(180deg, #2dd4bf, #0d9488);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

/* ============================== Main ============================== */

.main { min-width: 0; padding: 26px 32px 60px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: -26px -32px 24px;
  padding: 18px 32px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topbar-title { min-width: 180px; }
.period-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.period-custom { display: flex; align-items: center; gap: 6px; }
.period-custom input[type="date"] { width: auto; padding: 6px 8px; font-size: 12.5px; }
.period-custom span { color: var(--muted); }
.topbar h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.2px; }
.topbar p { color: var(--muted); font-size: 13.5px; margin-top: 3px; }

.user-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-sm);
}
.user-box #userEmail { font-size: 13px; color: var(--text-soft); }
.user-box #userRole {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--primary-strong);
}

/* ============================== Badge ============================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: var(--sidebar-text);
}
.badge::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}
.badge.ok { background: rgba(16, 185, 129, 0.16); color: #5ee9b5; }
.badge.error { background: rgba(220, 38, 38, 0.16); color: #fca5a5; }
.badge.muted { background: rgba(255, 255, 255, 0.08); color: var(--sidebar-muted); }

/* ============================== Cards / KPIs ============================== */

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 2px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
}
.section-title::before {
  content: "";
  width: 16px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), transparent);
}
.section-title::after {
  content: "";
  flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

.metrics-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  margin-bottom: 18px;
}
.metrics-grid.wide { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); }

.metric {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  overflow: hidden;
}
.metric::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
  opacity: 0;
  transition: opacity 0.15s;
}
.metric:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.metric:hover::after { opacity: 1; }
.metric span {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
}
.metric strong {
  display: block;
  margin: 8px 0 3px;
  font-size: clamp(18px, 1.5vw, 23px);
  font-weight: 750;
  letter-spacing: -0.3px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.metric small { font-size: 11.5px; color: var(--muted); line-height: 1.3; display: block; }
.metric.attention strong { color: var(--primary-strong); }
.metric.attention::after { opacity: 1; }
.metric.danger strong { color: var(--danger); }
.metric.danger::after { opacity: 1; background: linear-gradient(180deg, #f87171, var(--danger)); }

/* ============================== Dashboard toolbar ============================== */

.dash-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.period-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.period-chip {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-soft);
  border-radius: var(--r-pill);
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  transition: border-color 0.12s, color 0.12s, background 0.12s, box-shadow 0.12s;
}
.period-chip:hover { border-color: var(--primary); color: var(--primary-strong); }
.period-chip.active {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25);
}
.dash-toolbar-right { display: flex; align-items: center; gap: 12px; }
.period-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  white-space: nowrap;
}

/* ============================== Panels ============================== */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 18px;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.panel-header.compact { margin-bottom: 12px; }
.panel-header h2 { font-size: 16px; font-weight: 700; }
.panel-header p { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* ============================== Charts ============================== */

.chart-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.chart-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 16px;
  min-width: 0;
}
.chart-box h3 {
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 12px;
}
.chart-box canvas { max-width: 100%; }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* ============================== Tabelas ============================== */

.table-wrap { overflow-x: auto; border-radius: var(--r-sm); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 520px; }
thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--text-soft); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }
.empty-cell, .empty-state { text-align: center; color: var(--muted); padding: 22px; font-size: 13px; }
.empty-state { background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--r-sm); }

/* ============================== Status ============================== */

.status-ok { color: var(--ok); font-weight: 600; }
.status-alert { color: var(--warn); font-weight: 600; }
.status-error { color: var(--danger); font-weight: 600; }

/* ============================== Alertas ============================== */

.alert-list { display: flex; flex-direction: column; gap: 10px; }
.alert-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: var(--warn-soft);
  border: 1px solid #f3dca8;
  border-left: 4px solid var(--warn);
  border-radius: var(--r-sm);
}
.alert-item strong { display: block; font-size: 13.5px; color: #7c4a03; }
.alert-item span { font-size: 13px; color: #92611a; }

/* ============================== Botões ============================== */

.primary, .secondary, .ghost {
  border-radius: var(--r-sm);
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s, border-color 0.12s;
}
.primary {
  color: #fff;
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
  box-shadow: 0 6px 16px rgba(13, 148, 136, 0.28);
}
.primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(13, 148, 136, 0.34); }
.primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
.secondary { background: var(--surface); border-color: var(--line-strong); color: var(--text-soft); }
.secondary:hover { border-color: var(--primary); color: var(--primary-strong); }
.ghost { background: rgba(255, 255, 255, 0.06); color: var(--sidebar-text); border-color: rgba(255, 255, 255, 0.12); }
.ghost:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

/* ============================== Forms / Auth ============================== */

.auth-panel { display: flex; justify-content: center; align-items: flex-start; padding: 48px 16px; }
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-card h2 { font-size: 22px; }
.auth-card p { color: var(--muted); font-size: 13.5px; margin-top: -6px; }
.auth-card label, label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
}
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-weight: 400;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.form-message { font-size: 13px; color: var(--danger); min-height: 18px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-form input { width: auto; flex: 1 1 220px; }

.rule-form { margin-bottom: 14px; }
.rule-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.rule-form-grid label { font-size: 12px; }

/* Cards de grupos de regra (operadora · tipo) */
.rule-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
.rule-group-card {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
}
.rule-group-card:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.rule-group-card strong { font-size: 14px; color: var(--text); }
.rule-group-card span { font-size: 12.5px; color: var(--text-soft); }
.rule-group-card small { font-size: 11.5px; color: var(--muted); }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  background: rgba(15, 27, 45, 0.45);
  overflow-y: auto;
}
.modal {
  width: 100%;
  max-width: 720px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.modal-header h3 { font-size: 17px; }
.modal-header .ghost { background: var(--surface-2); color: var(--text-soft); border-color: var(--line-strong); }
.modal-header .ghost:hover { color: var(--primary-strong); border-color: var(--primary); background: var(--primary-soft); }
.modal-body { padding: 20px 22px; }
.modal-subtitle { margin: 18px 0 10px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }

/* ============================== Import / utilidades ============================== */

.import-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.import-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.file-drop {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-sm);
  padding: 22px;
  text-align: center;
  color: var(--muted);
  background: var(--surface-2);
  transition: border-color 0.12s, background 0.12s;
}
.file-drop:hover { border-color: var(--primary); background: var(--primary-soft); }
.summary-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.summary-pill {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-soft);
  border-radius: var(--r-pill);
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
}
.summary-pill.active { border-color: var(--primary); color: var(--primary-strong); background: var(--primary-soft); }
.summary-pill.active.error { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.summary-note { font-size: 12.5px; color: var(--muted); }
.rule-preview, .status-list {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-soft);
}
.status-list { display: flex; flex-direction: column; gap: 8px; }

/* ============================== Notices ============================== */

.notice { border-radius: var(--r); padding: 16px 18px; margin-bottom: 18px; border: 1px solid var(--line); background: var(--surface); }
.notice strong { display: block; margin-bottom: 4px; }
.notice p { color: var(--muted); font-size: 13.5px; }
.notice.warning { background: var(--warn-soft); border-color: #f3dca8; }
.notice.info { background: #e8f0fe; border-color: #c7d7f5; }

/* ============================== Repasses: ciclo / resumo / split ============================== */

.cycle-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 12px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r);
}
.cycle-bar label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.cycle-bar select, .cycle-bar input[type="date"] {
  padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--text);
}
.cycle-info { font-size: 13px; color: var(--primary-strong); font-weight: 600; }
.cycle-override { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }

.repasse-resumo { margin-bottom: 14px; }
.resumo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 10px; }
.resumo-grid > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.resumo-grid span.muted { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.resumo-grid strong { font-size: 16px; }
.resumo-ops { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip { background: var(--primary-soft); color: var(--primary-strong); border: 1px solid var(--primary); border-radius: 999px; padding: 4px 12px; font-size: 13px; }
.resumo-aprov { font-size: 13px; font-weight: 600; }

.split-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.split-row .split-vend { flex: 1; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--text); }
.split-row .split-pct { width: 90px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--text); }

.item-block { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.item-block:last-child { border-bottom: none; }
.item-block h4 { width: 100%; font-size: 13px; margin: 0 0 2px; color: var(--text); }
.item-block input, .item-block select { padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--text); }
.item-block input[type="text"] { flex: 1; min-width: 140px; }
.item-block.item-inline { gap: 8px; }

/* ============================== Ordenação de tabelas ============================== */

th[data-sort-wired]:hover { color: var(--primary-strong); }
.sort-ind { font-size: 11px; color: var(--primary-strong); }

/* ============================== Ficha do contrato ============================== */

.cd-sec { margin: 18px 0 8px; font-size: 14px; font-weight: 700; color: var(--primary-strong); border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.cd-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 16px; }
.cd-grid.cd-ro { margin-top: 10px; }
.cd-field { display: flex; flex-direction: column; gap: 3px; }
.cd-field span { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); }
.cd-field strong { font-size: 14px; }
.cd-field input, .cd-field select { padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--text); }

/* ============================== Busca ============================== */

.search-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.search-bar input[type="search"] {
  flex: 1; min-width: 240px; padding: 9px 12px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--text);
}

/* ============================== Fechamento ============================== */

.fech-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.fech-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.fech-card span { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.fech-card strong { font-size: 20px; }
.fech-card.ok { border-color: var(--primary); background: var(--primary-soft); }
.fech-card.ok strong { color: var(--primary-strong); }
.fech-card.alert strong { color: #b45309; }

/* ============================== Views ============================== */

.view { display: none; animation: fade 0.18s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.hidden { display: none !important; }
.fit { width: 100%; }

/* ============================== Scrollbar ============================== */

.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 8px; }
.table-wrap::-webkit-scrollbar { height: 9px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; }

/* ============================== Responsivo ============================== */

@media (max-width: 1100px) {
  .chart-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .import-grid { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: column;
    gap: 12px;
    padding: 12px 16px;
    z-index: 30;
  }
  .brand { padding: 4px 4px 12px; }
  .nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .nav-label { display: none; }
  .nav-item { flex: 0 0 auto; white-space: nowrap; padding: 8px 14px; }
  .nav-item.active::before { display: none; }
  .sidebar-footer { margin-top: 0; flex-direction: row; align-items: center; justify-content: space-between; padding-top: 12px; }
  .main { padding: 18px 16px 48px; }
  .topbar { margin: -18px -16px 18px; padding: 14px 16px; }
  .topbar h1 { font-size: 19px; }
}

@media (max-width: 560px) {
  .metrics-grid, .metrics-grid.wide { grid-template-columns: repeat(2, 1fr); }
  .metric strong { font-size: 22px; }
  .panel { padding: 16px; }
  .user-box { align-items: flex-start; }
}

@media (max-width: 380px) {
  .metrics-grid, .metrics-grid.wide { grid-template-columns: 1fr; }
}

