/* admin.lidergorila.com — Paleta Stripe (navy + blue-violet)
   Sidebar navy profundo + main casi blanco + acento #635BFF */

:root {
  --navy: #0A2540;
  --navy-soft: #425466;
  --accent: #635BFF;
  --accent-dark: #4F46E5;
  --accent-soft: #EEF0FF;
  --cyan: #00D4FF;
  --ink: #0A2540;
  --ink-soft: #425466;
  --muted: #8898AA;
  --line: #E3E8EE;
  --bg: #F6F9FC;
  --card: #FFFFFF;
  --ok: #00875A;
  --ok-soft: #D4F4E2;
  --warn: #B54708;
  --warn-soft: #FEF0C7;
  --danger: #B42318;
  --danger-soft: #FEE4E2;
  --shadow: 0 1px 2px rgba(10, 37, 64, 0.04), 0 1px 3px rgba(10, 37, 64, 0.06);
  --shadow-md: 0 4px 12px rgba(10, 37, 64, 0.08);
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 12px 0;
  letter-spacing: -0.01em;
}
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

/* Layout */
.layout { display: flex; min-height: 100vh; }

/* Sidebar — navy */
.sidebar {
  width: 240px;
  background: var(--navy);
  color: white;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar__brand {
  padding: 22px 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar__brand-title {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
  color: white;
}
.sidebar__brand-sub {
  font-size: 10px;
  color: rgba(255,255,255,0.55);
  margin-top: 3px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  font-weight: 500;
}
.sidebar__nav { padding: 12px 12px; flex: 1; overflow-y: auto; }
.sidebar__section {
  font-size: 10px;
  color: rgba(255,255,255,0.40);
  padding: 14px 12px 6px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 600;
}
.sidebar__link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 12px;
  border-radius: 6px;
  color: rgba(255,255,255,0.78);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 1px;
  transition: background 0.12s, color 0.12s;
}
.sidebar__link:hover { background: rgba(255,255,255,0.06); color: white; text-decoration: none; }
.sidebar__link.is-active {
  background: var(--accent);
  color: white;
  box-shadow: 0 1px 3px rgba(99, 91, 255, 0.4);
}
.sidebar__link.is-disabled { opacity: 0.40; cursor: not-allowed; }
.sidebar__link.is-disabled:hover { background: transparent; color: rgba(255,255,255,0.40); }
.sidebar__link svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.9; }
.sidebar__link.is-active svg { opacity: 1; }
.sidebar__link-tag {
  font-size: 9px;
  background: rgba(255,255,255,0.10);
  padding: 2px 7px;
  border-radius: 10px;
  margin-left: auto;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
}
.sidebar__footer {
  padding: 14px 22px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.sidebar__logout {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}
.sidebar__logout:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

/* Main */
.main { flex: 1; min-width: 0; background: var(--bg); }
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar__title { font-size: 18px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.topbar__subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }
.content { padding: 24px 28px 60px; max-width: 1280px; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card__head h2 { margin: 0; }

/* KPIs */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  position: relative;
}
.kpi::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-top-left-radius: var(--radius);
  border-bottom-left-radius: var(--radius);
}
.kpi--ok::before { background: var(--ok); }
.kpi--warn::before { background: var(--warn); }
.kpi--muted::before { background: var(--muted); }
.kpi__label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600; margin-bottom: 8px; }
.kpi__value { font-family: 'Inter', sans-serif; font-size: 24px; font-weight: 600; color: var(--ink); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg); }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--accent-soft); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table a { color: var(--accent); font-weight: 500; }
.table a:hover { color: var(--accent-dark); text-decoration: none; }

/* Badges (estados) */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}
.badge--emitida { background: var(--accent-soft); color: var(--accent-dark); }
.badge--pagada { background: var(--ok-soft); color: var(--ok); }
.badge--vencida { background: var(--danger-soft); color: var(--danger); }
.badge--borrador { background: #F2F4F7; color: #475467; }
.badge--anulada { background: var(--warn-soft); color: var(--warn); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(99, 91, 255, 0.25);
  transition: background 0.12s;
  font-family: inherit;
}
.btn:hover { background: var(--accent-dark); color: white; text-decoration: none; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn--sm svg { width: 14px; height: 14px; }
.btn--ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); box-shadow: none; }
.btn--ghost:hover { background: var(--bg); color: var(--ink); border-color: var(--accent); }
.btn--danger { background: var(--danger); box-shadow: 0 1px 2px rgba(180, 35, 24, 0.25); }
.btn--danger:hover { background: #91261A; }
.btn--sm { padding: 5px 10px; font-size: 12px; }

/* === Forms === */
.form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 22px;
  max-width: 820px;
  margin: 0 auto;
}
.form.card { padding: 32px 36px; }
.form__group { display: flex; flex-direction: column; min-width: 0; }
.form__group--full { grid-column: 1 / -1; }
.form__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 7px;
  letter-spacing: 0.2px;
}
.form__label .req { color: #DC2626; margin-left: 2px; font-weight: 700; }
.form__hint { font-size: 11px; color: var(--muted); margin-top: 5px; line-height: 1.4; }
.form input[type="text"],
.form input[type="email"],
.form input[type="tel"],
.form input[type="url"],
.form input[type="search"],
.form input[type="password"],
.form input[type="date"],
.form input[type="number"],
.form select,
.form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14.5px;
  font-family: inherit;
  background: white;
  color: var(--ink);
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
  box-sizing: border-box;
  line-height: 1.4;
}
.form input::placeholder, .form textarea::placeholder { color: #B0BEC8; font-weight: 400; }
.form input:hover:not(:focus), .form select:hover:not(:focus), .form textarea:hover:not(:focus) {
  border-color: #C9D1DC;
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(99, 91, 255, 0.14);
}
.form select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='none' stroke='%23425466' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.form textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.form__section {
  grid-column: 1 / -1;
  margin-top: 14px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--accent);
}
.form__section:first-child { margin-top: 0; }
.form__actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 8px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.form__actions .form__actions-left { margin-right: auto; }

/* Totales / resumen factura */
.totales { background: var(--bg); border-radius: var(--radius); padding: 16px 20px; }
.totales__row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; }
.totales__row--big { font-weight: 700; font-size: 16px; padding-top: 10px; margin-top: 6px; border-top: 1px solid var(--line); color: var(--ink); }
.totales__row .label { color: var(--ink-soft); }
.totales__row .val { font-variant-numeric: tabular-nums; }

/* Datos cliente / detalle */
.dl { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; }
.dl dt { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 600; }
.dl dd { margin: 0; font-size: 14px; color: var(--ink); }

/* Cartera secciones */
.cartera-section { margin-bottom: 20px; }
.cartera-section__title { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--ink-soft); margin-bottom: 10px; }
.cartera-section__title .badge { font-size: 10px; }
.cartera-section--vencidas .cartera-section__title { color: var(--danger); }
.cartera-section--semana .cartera-section__title { color: var(--warn); }

/* Filtros */
.filter-bar { display: flex; gap: 6px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filter-chip {
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: none;
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.filter-chip.is-active { background: var(--accent); color: white; border-color: var(--accent); }

/* Vacío */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
}
.empty__title { font-size: 16px; color: var(--ink-soft); margin-bottom: 6px; font-weight: 600; }

/* Placeholder modulos */
.placeholder-box {
  background: var(--card);
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 60px 30px;
  text-align: center;
}
.placeholder-box h2 { margin-bottom: 8px; }
.placeholder-box p { color: var(--muted); max-width: 540px; margin: 0 auto 18px; }
.placeholder-box .tag {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* Inline form helper */
.inline-form { display: inline-flex; gap: 6px; }
.inline-form input[type="date"], .inline-form input[type="text"] { padding: 5px 9px; font-size: 12px; border: 1px solid var(--line); border-radius: 6px; }

/* === Pivot tables (heatmap) === */
.pivot-card { padding: 14px 14px 8px; }
.pivot-scroll { overflow-x: auto; margin: 0 -14px; padding: 0 14px 4px; }
.pivot { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.pivot thead th {
  background: var(--bg);
  color: var(--muted);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 8px 6px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.pivot__cat-head { text-align: left !important; padding-left: 12px !important; position: sticky; left: 0; background: var(--bg); z-index: 2; }
.pivot__total-head { text-align: right !important; padding-right: 12px !important; }
.pivot tbody td {
  padding: 7px 6px;
  text-align: center;
  border-bottom: 1px solid #F2F4F7;
  color: var(--ink);
  white-space: nowrap;
}
.pivot tbody tr:hover td:not(.pivot__cat) { filter: brightness(0.95); }
.pivot__cat {
  text-align: left !important;
  padding-left: 12px !important;
  font-weight: 500;
  color: var(--ink);
  position: sticky;
  left: 0;
  background: var(--card);
  z-index: 1;
  min-width: 130px;
  box-shadow: 1px 0 0 var(--line);
}
.pivot__val { font-weight: 500; }
.pivot__val--empty { color: var(--muted); font-weight: 400; }
.pivot__unit { font-size: 10px; color: var(--muted); margin-left: 1px; font-weight: 400; }
.pivot__total {
  text-align: right !important;
  padding-right: 12px !important;
  font-weight: 600;
  font-size: 11px;
}
.pivot__row-total td {
  border-top: 2px solid var(--ink);
  font-weight: 700;
  background: var(--bg);
}
.pivot__row-total .pivot__cat { background: var(--bg); }
.pivot__row-avg td {
  font-style: italic;
  color: var(--ink-soft);
  background: var(--bg);
  font-size: 11px;
}
.pivot__row-avg .pivot__cat { background: var(--bg); }
.pivot-legend {
  font-size: 11px;
  color: var(--muted);
  padding: 6px 4px 0;
  font-style: italic;
}
.year-select {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: white;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

/* === Histórico chart (gastos vs ingresos) === */
.historico-chart__wrap {
  width: 100%;
  overflow: visible;
  padding-top: 4px;
}
.historico-chart {
  width: 100%;
  height: auto;
  display: block;
}
.historico-chart__hot rect:hover ~ * { opacity: 1; }
.historico-chart__hot:hover rect { fill: rgba(99, 91, 255, 0.05); }
.historico-chart__legend {
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 10px;
  font-variant-numeric: tabular-nums;
}
.historico-chart__legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}
.dot-color {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* === Bar chart simple (gasto diario) === */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 4px 4px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--line);
}
.bar-chart__col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  height: 180px;
}
.bar-chart__val {
  font-size: 10px;
  color: var(--ink-soft);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
  height: 14px;
}
.bar-chart__bar-wrap {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: flex-end;
  min-height: 0;
}
.bar-chart__stack {
  width: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
  min-height: 6px;
}
.bar-chart__seg {
  width: 100%;
  transition: opacity 0.15s;
  min-height: 1px;
}
.bar-chart__col:hover .bar-chart__stack { opacity: 0.85; box-shadow: 0 0 0 1px var(--accent-dark); }
.bar-chart__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 14px;
  padding: 10px 4px 2px;
  font-size: 11px;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
}
.bar-chart__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}
.bar-chart__legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.bar-chart__lbl {
  font-size: 10px;
  color: var(--muted);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

/* Status dot */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot--ok { background: var(--ok); box-shadow: 0 0 0 2px rgba(0, 135, 90, 0.15); }
.dot--off { background: var(--muted); opacity: 0.5; }

/* Stack cards (vps-map) */
.stack-card { padding: 14px 18px; }
.stack-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.stack-card__name { font-size: 15px; font-weight: 600; color: var(--ink); font-family: 'Inter', sans-serif; }
.stack-card__desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stack-card__domains { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.stack-card__domain {
  font-size: 11px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 3px 9px;
  border-radius: 12px;
  text-decoration: none;
  word-break: break-all;
}
.stack-card__domain:hover { background: var(--accent); color: white; text-decoration: none; }

/* Static site link */
.static-site-link {
  display: block;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  color: var(--ink-soft);
  text-decoration: none;
  word-break: break-all;
}
.static-site-link:hover { background: var(--accent-soft); color: var(--accent-dark); border-color: var(--accent); text-decoration: none; }

/* === Vehículos === */
.vehiculo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 16px; }
.vehiculo-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s, transform 0.15s;
}
.vehiculo-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); text-decoration: none; color: inherit; border-color: var(--accent); }
.vehiculo-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.vehiculo-card__nombre { font-size: 15px; font-weight: 600; color: var(--ink); }
.vehiculo-card__sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.vehiculo-card__proximo { padding-top: 10px; border-top: 1px solid var(--line); }
.vehiculo-card__proximo-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; font-weight: 600; margin-bottom: 4px; }
.vehiculo-card__proximo-tipo { font-size: 13px; font-weight: 500; color: var(--ink); }
.vehiculo-card__proximo-fecha { font-size: 12px; margin-top: 2px; }

/* Section head (separadores en dashboard) */
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 12px; }
.section-head h2 { margin: 0; font-size: 14px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600; }

/* KPI extras */
.kpi__sub { font-size: 11px; color: var(--muted); margin-top: 4px; }
.kpi__topcats { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.topcat { display: flex; justify-content: space-between; font-size: 12px; gap: 8px; }
.topcat__name { color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topcat__val { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-grid--compact { grid-template-columns: minmax(220px, 320px); margin-bottom: 14px; }

/* Tabs */
.tabs { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 3px; margin-bottom: 16px; }
.tab { padding: 6px 16px; font-size: 13px; font-weight: 500; color: var(--ink-soft); border-radius: 6px; text-decoration: none; }
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.is-active { background: var(--accent); color: white; }

/* Badge categoría (neutro) */
.badge--cat { background: #EEF2F6; color: #344054; font-weight: 500; text-transform: none; letter-spacing: 0; }

/* Filter bar as form (con inputs y selects) */
.filter-bar--form { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; box-shadow: var(--shadow); }
.filter-bar--form select,
.filter-bar--form input[type="text"] {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: white;
  color: var(--ink);
}
.filter-bar--form select:focus,
.filter-bar--form input:focus { outline: none; border-color: var(--accent); }

/* Topbar mobile (hamburger) */
.topbar__menu {
  display: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  margin-right: 12px;
  color: var(--ink);
}
.topbar__menu svg { width: 18px; height: 18px; }
.topbar__left { display: flex; align-items: center; }
.sidebar__close { display: none; }

/* Sidebar overlay (mobile) */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 37, 64, 0.5);
  z-index: 40;
}

/* === Responsive === */
@media (max-width: 900px) {
  .form { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi__value { font-size: 18px; }
  .content { padding: 16px 14px 60px; }
  .topbar { padding: 12px 14px; }
}

@media (max-width: 720px) {
  /* Body: prevenir overflow horizontal */
  html, body { overflow-x: hidden; max-width: 100vw; }
  .layout { width: 100%; max-width: 100vw; overflow-x: hidden; }
  .main { width: 100%; max-width: 100vw; min-width: 0; overflow-x: hidden; }
  .content { width: 100%; max-width: 100vw; min-width: 0; box-sizing: border-box; }
  .card { max-width: 100%; min-width: 0; box-sizing: border-box; }
  .kpi-grid { width: 100%; max-width: 100%; box-sizing: border-box; }

  /* Sidebar como drawer */
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    width: 260px;
    height: 100vh;
  }
  body.menu-open .sidebar { transform: translateX(0); }
  body.menu-open .sidebar-backdrop { display: block; }
  .sidebar__close {
    display: block;
    position: absolute;
    top: 14px; right: 14px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 10px;
  }

  .topbar__menu { display: inline-flex; align-items: center; justify-content: center; }
  .main { width: 100%; }

  /* Tablas responsive — convertir filas en cards apiladas */
  .table--responsive thead { display: none; }
  .table--responsive,
  .table--responsive tbody,
  .table--responsive tr,
  .table--responsive td { display: block; width: 100%; }
  .table--responsive tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 6px 0;
    background: var(--card);
  }
  .table--responsive tr:hover td { background: transparent; }
  .table--responsive td {
    border: none;
    padding: 6px 14px;
    text-align: left;
  }
  .table--responsive td.num { text-align: left; }
  .table--responsive td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted);
    margin-bottom: 2px;
    font-weight: 600;
  }

  /* KPIs full width single column en mobile chico */
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-grid--compact { grid-template-columns: 1fr; }
  .kpi { min-width: 0; }
  .kpi__value { font-size: 20px; }

  /* Cards: padding más compacto */
  .card { padding: 14px 14px; margin-bottom: 12px; }

  /* Filtros: stack */
  .filter-bar--form { flex-direction: column; align-items: stretch; gap: 8px; }
  .filter-bar--form select,
  .filter-bar--form input { width: 100%; }

  /* Topbar actions: shrink y compactar */
  .topbar { gap: 8px; }
  .topbar__title { font-size: 15px; }
  .topbar__subtitle { font-size: 11px; }
  .topbar .btn { padding: 6px 10px; font-size: 12px; }
  .topbar .btn__label { display: none; }

  /* Detalle factura: stack columnas */
  .ver-factura-grid { grid-template-columns: 1fr !important; }

  /* Tabs: full width */
  .tabs { display: flex; }
  .tab { flex: 1; text-align: center; }
}
