/* ==========================================================================
   TANKO 1.4 · Hoja de estilos
   Paleta oficial (IDENTIDAD_TANKO.md), superficies planas, bordes discretos.
   Tipografía: Manrope (marca, títulos, cifras) e Inter (interfaz, formularios).
   Iconos: Tabler Icons (MIT), trazo 1.75.
   ========================================================================== */

@font-face {
  font-family: "Manrope";
  src: url("fonts/manrope-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Marca */
  --onyx: #111719;
  --onyx-2: #1A2225;          /* superficie elevada sobre ónix */
  --onyx-line: #2C3538;
  --forest: #063D2A;
  --ruta: #0B5C41;
  --amber: #FFB715;
  --ivory: #F9F2E8;
  --asphalt: #464A4B;

  /* Interfaz */
  --bg: #F5F2EC;
  --surface: #FFFEFA;
  --sunken: #F0ECE3;
  --border: #E4DFD5;
  --border-strong: #D3CCBF;
  --text: #1A2123;
  --muted: #596661;
  --faint: #6E7A75;
  --danger: #A63B35;
  --danger-soft: #F8EBE8;
  --ruta-soft: #E6EFE8;
  --ruta-line: #C6D9CB;
  --amber-soft: #FFF3D1;

  /* Sobre ónix */
  --on-dark: #F9F2E8;
  --on-dark-muted: #A9B3AE;

  /* Tipografía */
  --font-ui: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Manrope", "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Forma */
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 10px;
  --r-xs: 8px;

  --ease: cubic-bezier(.16, 1, .3, 1);

  font-synthesis: none;
  color-scheme: light;
  accent-color: var(--ruta);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scrollbar-color: var(--border-strong) transparent; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--amber); color: var(--onyx); }
a { color: inherit; text-decoration: none; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button { -webkit-tap-highlight-color: transparent; }
input, select { max-width: 100%; caret-color: var(--ruta); }
img { max-width: 100%; }
svg.icon { flex-shrink: 0; vertical-align: middle; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--font-display); color: var(--onyx); text-wrap: balance; }
p { text-wrap: pretty; }

:focus-visible { outline: 2px solid var(--ruta); outline-offset: 2px; border-radius: 4px; }
.sidebar :focus-visible, .readout :focus-visible, .setup-hero :focus-visible, .auth-aside :focus-visible { outline-color: var(--amber); }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  padding: 10px 14px; border-radius: var(--r-xs);
  background: var(--onyx); color: var(--on-dark); font-weight: 650;
}
.skip-link:focus { top: 12px; }

.muted { color: var(--muted); }
.tiny { font-size: 12.5px !important; margin-top: 14px; }

/* ---------- Marca ---------- */
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  flex: 0 0 44px; width: 44px; height: 44px; display: block;
  border-radius: 12px; object-fit: cover; background: var(--ivory);
}
.brand strong {
  display: block; font-family: var(--font-display);
  font-size: 18px; line-height: 1.1; font-weight: 800; letter-spacing: .06em;
}
.brand small { display: block; margin-top: 4px; font-size: 12px; line-height: 1.3; opacity: .72; white-space: nowrap; }

/* ---------- Estructura de la app ---------- */
.app-shell { min-height: 100vh; min-height: 100dvh; display: flex; }

.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  flex: 0 0 248px; max-width: 248px;
  display: flex; flex-direction: column;
  padding: 24px 14px 18px;
  color: var(--on-dark); background: var(--onyx);
  z-index: 10;
}
.brand-sidebar { padding: 4px 8px 32px; }
.brand-sidebar .brand-mark { border: 1px solid rgba(255,255,255,.08); }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  width: 100%; min-height: 46px;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--on-dark-muted);
  font-size: 14.5px; font-weight: 560; text-align: left;
  transition: background-color .15s ease, color .15s ease;
}
.nav-link:hover { background: var(--onyx-2); color: var(--on-dark); }
.nav-link.is-active { background: var(--forest); color: #fff; font-weight: 650; }
.nav-link.is-active svg { color: var(--amber); }

.sidebar-bottom { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--onyx-line); }
.account-row { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px 10px 12px; }
.account-text { display: block; min-width: 0; }
.account-text strong { display: block; font-size: 14px; font-weight: 620; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.account-text small { display: block; color: var(--on-dark-muted); font-size: 12.5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.logout-form { margin: 0; }

.avatar {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ivory); color: var(--forest);
  font-family: var(--font-display); font-size: 15px; font-weight: 800;
}
.avatar-small { width: 36px; height: 36px; font-size: 14px; }

.main-shell { flex: 1; min-width: 0; width: 100%; }
.topbar { display: none; }
.mobile-brand { display: none; }

.main-content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 36px 40px 64px; }

.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
h1 { margin: 0; font-size: 30px; line-height: 1.15; font-weight: 800; letter-spacing: -.025em; }
h2 { margin-bottom: 4px; font-size: 18px; line-height: 1.3; font-weight: 750; letter-spacing: -.012em; }
h3 { font-size: 16px; font-weight: 750; }

.content-footer { margin-top: 32px; color: var(--faint); font-size: 12.5px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  font-size: 14.5px; font-weight: 650; line-height: 1.2; text-align: center; white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .12s var(--ease);
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--ruta); border-color: var(--ruta); color: #fff; }
.btn-primary:hover { background: var(--forest); border-color: var(--forest); }
.btn-light { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-light:hover { background: var(--sunken); }
.btn-danger { background: var(--surface); border-color: #E3BEB9; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-small { min-height: 36px; padding: 7px 12px; font-size: 13.5px; }
.btn-large { min-height: 50px; font-size: 15.5px; }
.btn-full { width: 100%; }
.btn-apply { display: none; }

.icon-btn {
  flex-shrink: 0; width: 40px; height: 40px; display: grid; place-items: center;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--muted);
  transition: background-color .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--ruta-soft); color: var(--ruta); }

.text-link, .action-link {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--ruta); font-size: 14px; font-weight: 650; white-space: nowrap;
}
.text-link:hover, .action-link:hover { text-decoration: underline; }
.action-link { border: 0; padding: 6px 2px; background: transparent; cursor: pointer; }
.action-link.danger { color: var(--danger); }

/* ---------- Avisos ---------- */
.alert {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px; padding: 13px 16px;
  border: 1px solid; border-radius: var(--r-sm);
  font-size: 14.5px; font-weight: 550; overflow-wrap: anywhere;
}
.alert-success { background: var(--ruta-soft); border-color: var(--ruta-line); color: var(--forest); }
.alert-error { background: var(--danger-soft); border-color: #E8C5C0; color: #8A2F2A; }

.hint, .setup-tip {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 18px; padding: 13px 14px;
  border-radius: var(--r-sm); background: var(--sunken);
  color: var(--muted); font-size: 13.5px; line-height: 1.6;
}
.hint > span, .setup-tip > .icon { color: var(--ruta); flex-shrink: 0; margin-top: 1px; }
.hint p { margin: 0; }
.hint strong, .setup-tip strong { color: var(--text); font-weight: 650; }

/* ---------- Filtros ---------- */
.filter-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 20px; }
.filter-field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
.filter-field input, .filter-field select {
  min-height: 42px; padding: 8px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--r-xs);
  background: var(--surface); color: var(--text);
  font-size: 14.5px; font-weight: 550;
}
.filter-field input { width: 180px; }
.filter-field select { min-width: 210px; max-width: 300px; }

/* ---------- Lectura de bomba (firma de TANKO) ----------
   Las bombas muestran Importe, Litros y Precio en ventanas separadas.
   Aquí el gasto del mes ocupa la ventana grande en ámbar sobre ónix. */
.readout {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.6fr);
  margin-bottom: 18px; overflow: hidden;
  border-radius: var(--r-lg); background: var(--onyx); color: var(--on-dark);
}
.readout-main { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 28px 30px; }
.readout-label { color: var(--on-dark-muted); font-size: 14px; font-weight: 550; }
.readout-label::first-letter { text-transform: uppercase; }
.readout-amount {
  font-family: var(--font-display); color: var(--amber);
  font-size: clamp(36px, 4.2vw, 52px); line-height: 1.02; font-weight: 800; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.readout-caption { color: var(--on-dark-muted); font-size: 13.5px; }
.readout-windows {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px; margin: 0; background: var(--onyx-line); border-left: 1px solid var(--onyx-line);
}
.readout-window { display: flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 0; padding: 22px 22px; background: var(--onyx-2); }
.readout-window dt { color: var(--on-dark-muted); font-size: 13px; font-weight: 550; }
.readout-window dd {
  margin: 0; font-family: var(--font-display); color: #fff;
  font-size: clamp(20px, 2vw, 26px); font-weight: 750; letter-spacing: -.02em; line-height: 1.2;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.readout-window dd small { color: var(--on-dark-muted); font-size: 14px; font-weight: 600; letter-spacing: 0; }
.readout-empty { color: var(--on-dark-muted); font-size: 16px; font-weight: 600; letter-spacing: 0; }
.readout-note { color: var(--on-dark-muted); font-size: 12.5px; }

/* ---------- Paneles ---------- */
.content-columns { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .9fr); gap: 18px; align-items: start; }
.panel { min-width: 0; padding: 24px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.panel-heading h2 { margin: 0 0 2px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 13.5px; }

/* Gráfico */
.expense-chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart-base { stroke: var(--border); stroke-width: 2; }
.chart-current { fill: var(--ruta); }
.chart-previous { fill: #DCE4D8; }
.chart-label, .chart-value { font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
.chart-label { font-size: 14px; font-weight: 550; fill: var(--muted); }
.chart-value { font-size: 13px; font-weight: 600; fill: var(--muted); }
.chart-label.is-current, .chart-value.is-current { fill: var(--onyx); font-weight: 750; }
.chart-legend { display: flex; align-items: center; gap: 8px; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--ruta); }

.detail-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.detail-line:first-of-type { padding-top: 0; }
.detail-line span { color: var(--muted); }
.detail-line strong { font-weight: 700; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Recientes */
.recent-panel { margin-top: 18px; }
.recent-list { display: flex; flex-direction: column; }
.recent-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); }
.recent-row:first-child { border-top: 0; padding-top: 0; }
.recent-row:last-child { padding-bottom: 0; }
.recent-icon, .record-icon, .vehicle-symbol {
  flex-shrink: 0; width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: var(--r-sm); background: var(--ruta-soft); color: var(--ruta);
}
.recent-main, .record-main, .vehicle-main { flex: 1; min-width: 0; }
.recent-main strong, .record-main strong, .vehicle-main strong {
  display: block; font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.recent-main small, .record-main small, .vehicle-main small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }
.recent-right { flex-shrink: 0; text-align: right; }
.recent-right strong { display: block; font-family: var(--font-display); font-size: 16px; font-weight: 750; font-variant-numeric: tabular-nums; }
.recent-right small { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.recent-empty { padding: 8px 0 2px; color: var(--muted); font-size: 14.5px; }
.recent-empty a { color: var(--ruta); font-weight: 650; text-decoration: underline; }

/* Estado vacío */
.empty-state { padding: 56px 24px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); text-align: center; }
.empty-state h2 { margin: 0 0 8px; font-size: 22px; }
.empty-state p { max-width: 420px; margin: 0 auto 22px; color: var(--muted); font-size: 15px; }
.empty-icon { width: 64px; height: 64px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 18px; background: var(--ruta-soft); color: var(--ruta); }

/* ---------- Formularios ---------- */
.fuel-layout { display: grid; grid-template-columns: minmax(340px, .9fr) minmax(0, 1.1fr); gap: 18px; align-items: start; }
.form-stack { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { color: var(--text); font-size: 14px; font-weight: 600; }
.field em { color: var(--danger); font-style: normal; }
.field input, .field select {
  display: block; width: 100%; min-width: 0; min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--r-xs);
  background: #fff; color: var(--text);
  font-size: 15px; font-weight: 500; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input[type="number"], .field input[type="datetime-local"] { font-variant-numeric: tabular-nums; }
.field input::placeholder { color: #848C87; font-weight: 400; }
.field input:hover, .field select:hover { border-color: #BFB7A8; }
.field input:focus, .field select:focus, .filter-field input:focus, .filter-field select:focus {
  border-color: var(--ruta); box-shadow: 0 0 0 3px rgba(11, 92, 65, .16); outline: none;
}
.field input:user-invalid { border-color: var(--danger); }
.field small { color: var(--muted); font-size: 13px; line-height: 1.45; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

/* Ventana de precio por litro: mini lectura de bomba */
.price-preview {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: -4px; padding: 12px 16px;
  border-radius: var(--r-sm); background: var(--onyx); color: var(--on-dark-muted);
  font-size: 14px; font-weight: 550;
}
.price-preview strong.is-empty { color: var(--on-dark-muted); font-family: var(--font-ui); font-size: 14.5px; font-weight: 600; }
.price-preview strong { font-family: var(--font-display); color: var(--amber); font-size: 20px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }

.checkbox-card {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: #fff; cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.checkbox-card:hover { border-color: var(--ruta-line); }
.checkbox-card:has(input:checked) { border-color: var(--ruta); background: var(--ruta-soft); }
.checkbox-card input { flex-shrink: 0; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--ruta); }
.checkbox-card strong { display: block; margin-bottom: 2px; font-size: 14.5px; font-weight: 650; }
.checkbox-card small { display: block; color: var(--muted); font-size: 13px; line-height: 1.5; }

/* ---------- Historial de recargas (filas, sin tarjetas anidadas) ---------- */
.record-list { display: flex; flex-direction: column; }
.record-card { padding: 16px 0; border-top: 1px solid var(--border); }
.record-card:first-child { padding-top: 0; border-top: 0; }
.record-card:last-child { padding-bottom: 0; }
.record-top { display: flex; align-items: center; gap: 12px; }
.record-price { font-family: var(--font-display); font-size: 18px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--onyx); }
.record-stats {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px;
  padding: 10px 0 0 54px; color: var(--muted); font-size: 13.5px; font-weight: 550; font-variant-numeric: tabular-nums;
}
.record-note { margin: 8px 0 0 54px; color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.record-actions { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin-top: 6px; }
.record-actions form { margin: 0; }
.record-actions .action-link { font-size: 13.5px; }

.pill { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 650; white-space: nowrap; }
.pill-green { background: var(--ruta-soft); color: var(--forest); }
.pill-grey { background: var(--sunken); color: var(--muted); }

/* ---------- Vehículos ---------- */
.vehicles-layout, .settings-layout { grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); }
.vehicle-card { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-top: 1px solid var(--border); }
.vehicle-card:first-of-type { border-top: 0; padding-top: 0; }
.vehicle-symbol { width: 48px; height: 48px; border-radius: var(--r-md); background: var(--sunken); color: var(--asphalt); }
.vehicle-actions { display: flex; align-items: center; gap: 4px; }
.vehicle-actions .action-link { width: 40px; height: 40px; justify-content: center; border-radius: var(--r-xs); padding: 0; }
.vehicle-actions .action-link:hover { background: var(--ruta-soft); text-decoration: none; }
.count-badge {
  min-width: 34px; height: 34px; padding: 4px 8px; display: grid; place-items: center;
  border-radius: 999px; background: var(--sunken); color: var(--onyx);
  font-family: var(--font-display); font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums;
}

/* ---------- Perfil y usuarios ---------- */
.settings-layout { align-items: start; }
.profile-admin-link { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; }
.profile-admin-link h2 { margin: 0 0 2px; }
.profile-admin-link p { margin: 0; color: var(--muted); font-size: 14px; }
.mobile-signout { display: none; }

.users-list { display: flex; flex-direction: column; }
.user-card { padding: 16px 0; border-top: 1px solid var(--border); }
.user-card:first-child { padding-top: 0; border-top: 0; }
.user-summary { display: flex; align-items: center; gap: 12px; }
.user-main { flex: 1; min-width: 0; }
.user-main strong { display: block; font-size: 15px; font-weight: 650; line-height: 1.4; }
.user-main strong small { color: var(--muted); font-size: 13px; font-weight: 500; }
.user-main small { color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.user-meta { margin: 6px 0 0 48px; color: var(--muted); font-size: 13px; }
.user-details { margin: 10px 0 0 48px; }
.user-details summary { display: inline-flex; padding: 4px 0; color: var(--ruta); font-size: 14px; font-weight: 650; cursor: pointer; }
.user-details[open] summary { margin-bottom: 12px; }
.user-details[open] { padding: 14px; border-radius: var(--r-sm); background: var(--sunken); }
.user-actions-form { display: grid; gap: 10px; margin-bottom: 12px; }

/* ---------- Primeros pasos ---------- */
.setup-hero {
  display: flex; align-items: center; gap: 22px;
  margin-bottom: 16px; padding: 26px 28px;
  border-radius: var(--r-lg); background: var(--forest); color: #fff;
}
.setup-hero-icon {
  flex: 0 0 58px; width: 58px; height: 58px; display: grid; place-items: center;
  border-radius: 16px; background: rgba(255,255,255,.1); color: var(--amber);
}
.setup-kicker { margin-bottom: 6px; color: var(--amber); font-size: 14px; font-weight: 700; }
.setup-hero h2 { margin: 0 0 6px; color: #fff; font-size: clamp(21px, 2.4vw, 27px); line-height: 1.25; letter-spacing: -.02em; }
.setup-hero p { max-width: 68ch; margin: 0; color: #DCE7DF; font-size: 15px; line-height: 1.6; }

.setup-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 18px; padding: 0; list-style: none; }
.setup-step {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface);
}
.setup-step-number {
  flex: 0 0 34px; width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 50%; background: var(--sunken); color: var(--muted);
  font-family: var(--font-display); font-size: 15px; font-weight: 800;
}
.setup-step-copy { min-width: 0; }
.setup-step-copy strong { display: block; color: var(--onyx); font-size: 14.5px; font-weight: 650; line-height: 1.3; }
.setup-step-copy small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.3; }
.setup-step.is-current { border-color: var(--ruta); }
.setup-step.is-current .setup-step-number { background: var(--ruta); color: #fff; }
.setup-step.is-done .setup-step-number { background: var(--ruta-soft); color: var(--ruta); }
.setup-step.is-next .setup-step-copy strong { color: var(--muted); }

.setup-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .7fr); gap: 18px; align-items: start; }
.setup-layout .setup-main { min-width: 0; }
.setup-submit { margin-top: 4px; min-height: 50px; }
.setup-info { padding: 24px; }
.setup-info-icon { width: 44px; height: 44px; margin-bottom: 14px; display: grid; place-items: center; border-radius: var(--r-sm); background: var(--ruta-soft); color: var(--ruta); }
.setup-info h3 { margin: 0 0 8px; }
.setup-info > p { margin: 0 0 4px; color: var(--muted); font-size: 14.5px; line-height: 1.65; }

.setup-vehicle-done {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px; padding: 13px 16px;
  border: 1px solid var(--ruta-line); border-radius: var(--r-md); background: var(--ruta-soft);
}
.setup-done-icon { flex: 0 0 36px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--ruta); color: #fff; }
.setup-vehicle-done div { flex: 1; min-width: 0; }
.setup-vehicle-done strong { display: block; color: var(--forest); font-size: 14.5px; }
.setup-vehicle-done small { color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.setup-later { display: flex; align-items: center; justify-content: center; gap: 4px; margin: 14px auto; padding: 10px; color: var(--ruta); font-size: 14.5px; font-weight: 650; }
.setup-later:hover { text-decoration: underline; }
.setup-complete { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 20px; text-align: center; }
.setup-complete-icon { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 20px; background: var(--ruta-soft); color: var(--ruta); }
.setup-complete h2 { margin: 4px 0 0; font-size: 24px; }
.setup-complete p { margin: 0 0 6px; color: var(--muted); font-size: 15px; }

.setup-reminder {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 18px; padding: 14px 16px;
  border: 1px solid var(--ruta-line); border-radius: var(--r-md); background: var(--ruta-soft);
}
.setup-reminder-mark { flex: 0 0 38px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: var(--r-sm); background: var(--surface); color: var(--ruta); }
.setup-reminder div { flex: 1; min-width: 0; }
.setup-reminder strong { font-size: 15px; color: var(--forest); }
.setup-reminder p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }

/* ---------- Navegación inferior (móvil) ---------- */
.bottom-nav { display: none; }

/* ---------- Acceso: iniciar sesión, registro, instalador, sin conexión ---------- */
.auth-body { min-height: 100vh; min-height: 100dvh; margin: 0; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.auth-wrap { width: 100%; max-width: 460px; }
.auth-card { padding: 32px 34px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.auth-card .brand { color: var(--onyx); }
.auth-heading { margin: 28px 0 24px; }
.auth-heading h1 { margin-bottom: 8px; font-size: 28px; }
.auth-heading p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.auth-switch { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; margin-top: 22px; color: var(--muted); font-size: 14.5px; }
.auth-switch a { display: inline-flex; align-items: center; gap: 2px; padding: 6px 2px; color: var(--ruta); font-weight: 700; }
.auth-switch a:hover { text-decoration: underline; }
.auth-footnote { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; text-align: center; }
.auth-footnote svg { color: var(--ruta); }
.honey-field { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip-path: inset(50%) !important; white-space: nowrap !important; }

.installer-card h1, .install-success h1 { margin: 24px 0 8px; font-size: 26px; }
.installer-card p { font-size: 14.5px; }
.installer-card .form-stack { margin-top: 20px; }
.install-success .btn { margin-top: 18px; }

/* Pantalla dividida: ilustración oficial a la izquierda, formulario a la derecha */
.auth-body-split { display: block; padding: 0; }
.auth-split { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-aside {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  padding: 40px 48px; background: var(--onyx); color: var(--on-dark); overflow: hidden;
}
.auth-aside-brand strong { display: block; font-family: var(--font-display); font-size: 22px; font-weight: 800; letter-spacing: .08em; }
.auth-aside-brand span { display: block; margin-top: 4px; color: var(--on-dark-muted); font-size: 14.5px; }
.auth-illustration {
  width: min(100%, 400px); height: auto; aspect-ratio: 1; align-self: center;
  clip-path: inset(2.2% round 19%); /* el PNG trae esquinas blancas */
}
.auth-aside-line { max-width: 30ch; margin: 0; font-family: var(--font-display); font-size: 24px; font-weight: 750; line-height: 1.3; letter-spacing: -.015em; color: var(--on-dark); }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 32px; }
.auth-form-wrap { width: 100%; max-width: 400px; }
.auth-mobile-brand { display: none; color: var(--onyx); }
.auth-body-split .auth-heading { margin-top: 0; }

/* ---------- Adaptación ---------- */
@media (max-width: 1260px) {
  .sidebar { flex-basis: 228px; max-width: 228px; }
  .main-content { padding: 30px 28px 56px; }
  .readout-main { padding: 24px; }
  .readout-window { padding: 18px; }
  .panel { padding: 20px; }
}

@media (max-width: 1100px) {
  .readout { grid-template-columns: 1fr; }
  .readout-windows { border-left: 0; border-top: 1px solid var(--onyx-line); }
}

@media (max-width: 1020px) {
  .sidebar { flex-basis: 212px; max-width: 212px; }
  .main-content { padding: 26px 22px 56px; }
  .content-columns, .fuel-layout { grid-template-columns: 1fr; }
  .setup-layout { grid-template-columns: 1fr; }
  .auth-aside { padding: 32px; }
  .auth-aside-line { font-size: 20px; }
}

@media (max-width: 760px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-panel { align-items: flex-start; padding: 28px 20px max(28px, env(safe-area-inset-bottom)); }
  .auth-mobile-brand { display: flex; margin-bottom: 28px; }
  .auth-mobile-brand .brand-mark { flex-basis: 48px; width: 48px; height: 48px; }
}

@media (max-width: 700px) {
  body { font-size: 15px; }
  .sidebar { display: none; }
  .app-shell { display: block; }

  .topbar {
    position: sticky; top: 0; z-index: 9;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 60px; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top));
    background: var(--onyx); color: var(--on-dark);
  }
  .mobile-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 17px; font-weight: 800; letter-spacing: .07em; }
  .brand-small { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 9px; }
  .topbar-account { display: flex; }
  .topbar-account .avatar { width: 34px; height: 34px; }

  .main-content { padding: 20px 16px calc(112px + env(safe-area-inset-bottom)); }
  .page-heading { margin-bottom: 16px; }
  h1 { font-size: 25px; }
  .new-fuel { display: none; }

  .filter-toolbar { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 14px; }
  .filter-field > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .filter-field { min-width: 0; }
  .filter-field input, .filter-field select { width: 100%; min-width: 0; max-width: none; min-height: 46px; font-size: 16px; }

  .readout { border-radius: var(--r-md); margin-bottom: 14px; }
  .readout-main { padding: 20px 18px 18px; }
  .readout-amount { font-size: clamp(34px, 11vw, 44px); }
  .readout-window { padding: 14px 12px; }
  .readout-window dt { font-size: 12px; }
  .readout-window dd { font-size: 17px; }
  .readout-window dd small { font-size: 12px; }
  .readout-empty { font-size: 14px; }
  .readout-note { font-size: 11.5px; line-height: 1.35; }

  .content-columns, .fuel-layout { gap: 14px; }
  .panel { padding: 18px 16px; border-radius: var(--r-md); }
  .panel-heading { margin-bottom: 16px; }
  .panel-heading h2 { font-size: 17px; }
  .chart-panel { overflow: hidden; }
  .chart-label { font-size: 17px; }
  .chart-value { font-size: 16px; }
  .recent-panel { margin-top: 14px; }

  .field input, .field select { min-height: 48px; font-size: 16px; }
  .record-stats, .record-note { padding-left: 0; margin-left: 0; }
  .record-actions { justify-content: flex-start; gap: 18px; }

  .setup-hero { align-items: flex-start; gap: 14px; padding: 20px 18px; border-radius: var(--r-md); }
  .setup-hero-icon { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 12px; }
  .setup-hero h2 { font-size: 21px; }
  .setup-hero p { font-size: 14.5px; }
  .setup-steps { gap: 8px; margin-bottom: 14px; }
  .setup-step { flex-direction: column; gap: 6px; padding: 12px 6px; text-align: center; }
  .setup-step-number { flex: 0 0 30px; width: 30px; height: 30px; font-size: 14px; }
  .setup-step-copy strong { font-size: 13px; }
  .setup-step-copy small { display: none; }
  .setup-info { padding: 18px 16px; }
  .setup-reminder { flex-wrap: wrap; }
  .setup-reminder .btn { width: 100%; }

  .profile-admin-link { flex-direction: column; align-items: stretch; }
  .mobile-signout { display: block; margin-top: 16px; }
  .content-footer { text-align: center; }

  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end;
    min-height: 68px; padding: 6px 6px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border); background: var(--surface);
  }
  .bottom-nav-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .bottom-link, .bottom-action {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px;
    min-height: 54px; padding-bottom: 2px;
    color: var(--faint); font-size: 12px; font-weight: 600;
  }
  .bottom-link.is-active { color: var(--forest); font-weight: 700; }
  .bottom-link.is-active svg { color: var(--ruta); stroke-width: 2.25; }
  .bottom-action { color: var(--forest); font-weight: 700; }
  .bottom-action-disc {
    width: 54px; height: 54px; margin-top: -26px; display: grid; place-items: center;
    border: 4px solid var(--surface); border-radius: 50%;
    background: var(--ruta); color: #fff;
    box-shadow: 0 4px 10px rgba(17, 23, 25, .18);
    transition: transform .12s var(--ease), background-color .15s ease;
  }
  .bottom-action:active .bottom-action-disc { transform: scale(.94); background: var(--forest); }
}

@media (max-width: 370px) {
  .main-content { padding-left: 12px; padding-right: 12px; }
  .readout-window { padding: 12px 8px; }
  .readout-window dd { font-size: 15px; }
  .record-price { font-size: 16px; }
  .auth-card { padding: 22px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
  .btn:active, .bottom-action:active .bottom-action-disc { transform: none; }
}

@media print {
  .sidebar, .topbar, .bottom-nav, .filter-toolbar, .new-fuel, .record-actions { display: none !important; }
  .main-content { padding: 0; }
  .readout { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
