/* Syncra dashboards — design system Tech-Minimalist (paleta_colores_syncra.txt)
   Cyan #06B6D4 para acentos; #0891B2 (mismo tono, más oscuro) para acciones con
   texto blanco y barras — el cyan puro no alcanza contraste legible sobre blanco. */
:root {
  --bg: #f1f5f9;            /* Soft Slate */
  --surface: #ffffff;
  --ink: #1e293b;           /* Deep Indigo */
  --ink-2: #64748b;         /* Neutral Gray */
  --ink-3: #94a3b8;
  --line: #e2e8f0;
  --brand: #0891b2;         /* acciones (cyan-600, legible con texto blanco) */
  --brand-2: #0e7490;
  --brand-bright: #06b6d4;  /* Electric Cyan: acentos, focus, iconos */
  --brand-soft: #ecfeff;
  --sidebar: #1e293b;       /* Deep Indigo */
  --sidebar-ink: #cbd5e1;
  --good-ink: #047857;   --good-bg: #ecfdf5;   /* Success Green #10B981 (tinta accesible) */
  --warn-ink: #b45309;   --warn-bg: #fffbeb;
  --bad-ink: #be123c;    --bad-bg: #fff1f2;    /* Alert Red #F43F5E (tinta accesible) */
  --neutral-ink: #64748b;--neutral-bg: #f1f5f9;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(30, 41, 59, .08);
}
* { box-sizing: border-box; margin: 0; }
body {
  font: 14px/1.5 Inter, "Plus Jakarta Sans", Roboto, "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--ink);
}
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }
svg { flex: none; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 380px; max-width: 100%; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); padding: 32px;
}
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card .sub { color: var(--ink-2); margin-bottom: 24px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px; background: var(--brand-bright);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 20px;
  margin-bottom: 16px;
}

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar); color: var(--sidebar-ink);
  display: flex; flex-direction: column; padding: 20px 12px; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .logo {
  display: flex; align-items: center; gap: 10px; color: #fff;
  font-weight: 700; font-size: 17px; padding: 4px 12px 18px;
}
.sidebar .logo .brand-mark { width: 32px; height: 32px; font-size: 15px; margin: 0; border-radius: 9px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px;
  color: var(--sidebar-ink); background: none; border: 0; width: 100%; text-align: left;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.sidebar .spacer { flex: 1; }
.sidebar .who { padding: 10px 12px; font-size: 12px; color: var(--ink-3); border-top: 1px solid rgba(255,255,255,.08); }
.sidebar .who b { display: block; color: #fff; font-size: 13px; }

.main { padding: 28px 32px; max-width: 1200px; width: 100%; }
.main-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.main-head h2 { font-size: 20px; }
.main-head .sub { color: var(--ink-2); font-size: 13px; }

/* ---------- Cards / tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.tile .t-head { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; }
.tile .t-head .ic { color: var(--brand-2); background: var(--brand-soft); border-radius: 8px; padding: 6px; display: grid; place-items: center; }
.tile .t-value { font-size: 26px; font-weight: 700; margin-top: 10px; font-variant-numeric: tabular-nums; }
.tile .t-foot { color: var(--ink-3); font-size: 12px; margin-top: 2px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px;
}
.card h3 { font-size: 15px; margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } .shell { grid-template-columns: 64px 1fr; } .nav-item span, .sidebar .logo span, .sidebar .who { display: none; } }

/* ---------- Gráfico de barras (una serie) ---------- */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar {
  width: 100%; max-width: 46px; background: var(--brand); border-radius: 4px 4px 0 0;
  min-height: 2px; transition: opacity .15s; position: relative;
}
.bar:hover { opacity: .8; }
.bar .tip {
  display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; z-index: 2;
}
.bar:hover .tip { display: block; }
.bar-label { font-size: 11px; color: var(--ink-3); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--ink-2); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fafbfc; }
.num { text-align: right; }
.muted { color: var(--ink-3); }
.mono { font-family: Consolas, monospace; font-size: 12px; }

/* ---------- Chips de estado (icono + texto, nunca solo color) ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip.good { color: var(--good-ink); background: var(--good-bg); }
.chip.warn { color: var(--warn-ink); background: var(--warn-bg); }
.chip.bad { color: var(--bad-ink); background: var(--bad-bg); }
.chip.neutral { color: var(--neutral-ink); background: var(--neutral-bg); }

/* ---------- Formularios / botones ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--ink-2); }
.field input, .field select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff;
}
.field input:focus, .field select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand-bright); }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); margin-bottom: 10px; }
.check input { width: auto; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px;
  border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.btn:hover { background: var(--neutral-bg); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.small { padding: 5px 9px; font-size: 12px; border-radius: 7px; }
.btn.icon-only { padding: 6px; }
.btn:disabled { opacity: .5; cursor: default; }
.actions { display: flex; gap: 6px; }

.error-msg { color: var(--bad-ink); background: var(--bad-bg); border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-top: 12px; display: none; }

/* ---------- Modal ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .5); display: none;
  place-items: center; z-index: 50; padding: 20px;
}
.modal-bg.open { display: grid; }
.modal {
  background: var(--surface); border-radius: 16px; padding: 24px; width: 480px; max-width: 100%;
  max-height: 90vh; overflow-y: auto;
}
.modal h3 { margin-bottom: 4px; }
.modal .sub { color: var(--ink-2); font-size: 13px; margin-bottom: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- Tabs (sección Comprobantes) ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.tab:hover { border-color: var(--brand); color: var(--brand); }
.tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.tab-n {
  background: var(--bg); color: var(--neutral-ink);
  font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px;
}
.tab.active .tab-n { background: rgba(255, 255, 255, .22); color: #fff; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 13px; display: none; z-index: 99; box-shadow: 0 4px 12px rgba(0,0,0,.25);
  max-width: 90vw;
}
#toast.bad { background: var(--bad-ink); }
#toast.show { display: block; }

.filters { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filters input, .filters select { padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; }
.empty { text-align: center; color: var(--ink-3); padding: 40px 0; }
