/* ============================================================
   bitácora. — estilos
   ============================================================ */

:root {
  --paper: #f2efe6;
  --surface: #fbf9f3;
  --surface-2: #f6f2e8;
  --ink: #1a1b16;
  --muted: #5b594e;
  --faint: #6f6d60;
  --line: #dcd6c7;
  --line-strong: #c7c0ae;
  --accent: #bf3f1e;
  --accent-ink: #fff8f4;
  --accent-soft: #f5d9cf;
  --green: #2c5e44;
  --green-soft: #dce8dc;
  --amber: #8a5a00;
  --amber-soft: #f3e3ba;
  --red: #a93424;
  --red-soft: #f2d3cb;
  --blue: #2f5677;
  --blue-soft: #dbe4ec;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(26, 27, 22, .04), 0 8px 24px -20px rgba(26, 27, 22, .35);
  color-scheme: light;
}

html[data-theme="dark"] {
  --paper: #111310;
  --surface: #191b16;
  --surface-2: #1e211b;
  --ink: #efede3;
  --muted: #b5b2a4;
  --faint: #8f8c80;
  --line: #2d3029;
  --line-strong: #3c4037;
  --accent: #ff6a3d;
  --accent-ink: #1a0e08;
  --accent-soft: #3a2119;
  --green: #8fc79e;
  --green-soft: #1d3023;
  --amber: #e0b45e;
  --amber-soft: #342a16;
  --red: #ef8a78;
  --red-soft: #3a1e19;
  --blue: #93b8d6;
  --blue-soft: #1b2a36;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 16px 40px -28px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }
img, svg { display: block; }
::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ic {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip {
  position: fixed;
  left: 12px;
  top: -80px;
  z-index: 200;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: 8px;
  transition: top .15s;
}
.skip:focus { top: 12px; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.serif { font-family: var(--serif); }
.num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------
   Estructura
   ------------------------------------------------------------ */

.app { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px 16px 20px;
  background: var(--paper);
  border-right: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  padding: 0 10px;
  font-family: var(--serif);
  font-size: 31px;
  line-height: 1;
  letter-spacing: -.02em;
}
.brand .dot { color: var(--accent); }
.brand-sub {
  padding: 6px 10px 26px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--faint);
}

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a, .nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
  text-align: left;
}
.nav a:hover, .nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.nav a[aria-current="page"] .ic { stroke-width: 1.9; }

.sidebar-foot { margin-top: auto; padding-top: 24px; display: grid; gap: 12px; }
.storage-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 0 11px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--faint);
}
.storage-note .ic { width: 14px; height: 14px; margin-top: 1px; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 34px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
}
.topbar-left { display: flex; align-items: baseline; gap: 16px; min-width: 0; }
.topbar-note {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}
.brand-mobile { display: none; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.mobile-nav { display: none; }

.view {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 34px 34px 64px;
  outline: none;
}

.app-foot {
  margin-top: auto;
  padding: 26px 34px 34px;
  font-size: 11.5px;
  color: var(--faint);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------
   Cabeceras y tipografía
   ------------------------------------------------------------ */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}
.kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--faint);
}
.kicker .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.page-head h1 {
  max-width: 760px;
  font-family: var(--serif);
  font-size: clamp(34px, 4.2vw, 52px);
  line-height: 1.02;
  letter-spacing: -.015em;
  font-weight: 400;
}
.page-head .lede {
  max-width: 620px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14.5px;
}
.head-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; padding-bottom: 3px; }

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 34px 0 14px;
}
.section-title h2 { font-size: 18px; letter-spacing: -.01em; }
.section-title .faint { font-size: 12px; }

/* ------------------------------------------------------------
   Botones, etiquetas
   ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn .ic { width: 16px; height: 16px; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--line)); background: transparent; }
.btn-danger:hover { border-color: var(--red); background: var(--red-soft); }
.btn-sm { min-height: 32px; padding: 5px 11px; font-size: 12px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--muted);
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.icon-btn .ic { width: 16px; height: 16px; }

.linkish {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.linkish:hover { color: var(--accent); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid transparent;
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill.overdue, .pill.expired { background: var(--red-soft); color: var(--red); }
.pill.soon { background: var(--amber-soft); color: var(--amber); }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.done { background: var(--surface-2); color: var(--faint); }
.pill.snoozed { background: var(--blue-soft); color: var(--blue); }
.pill.compact { padding: 2px 8px; font-size: 10.5px; }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

/* ------------------------------------------------------------
   Métricas
   ------------------------------------------------------------ */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.stat {
  padding: 18px 20px 20px;
  border-left: 1px solid var(--line);
  min-width: 0;
}
.stat:first-child { border-left: 0; }
.stat-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 7px;
}
.stat-label .ic { width: 13px; height: 13px; }
.stat-value {
  font-family: var(--serif);
  font-size: clamp(27px, 2.7vw, 38px);
  line-height: 1.05;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-value small { font-family: var(--sans); font-size: 11px; font-weight: 500; color: var(--faint); letter-spacing: 0; }
.stat-sub { margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.stat.alert .stat-value { color: var(--accent); }
.stat.alert .stat-label { color: var(--red); }

/* ------------------------------------------------------------
   Paneles
   ------------------------------------------------------------ */

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; }
.grid-2.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 0;
}
.panel-head h2 { font-size: 15px; letter-spacing: -.005em; }
.panel-head .panel-sub { font-size: 11.5px; color: var(--faint); }
.panel-body { padding: 16px 20px 20px; }
.panel-body.tight { padding: 10px 12px 14px; }
.panel-foot { border-top: 1px solid var(--line); padding: 11px 20px; }

.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 8px; }

/* ------------------------------------------------------------
   Filas / listas
   ------------------------------------------------------------ */

.row-list { display: flex; flex-direction: column; }
.row {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 12px 8px;
  border-top: 1px solid var(--line);
  text-align: left;
  border-radius: 7px;
  transition: background .12s;
  min-width: 0;
}
.row-list > .row:first-child { border-top: 0; }
.row:hover { background: var(--surface-2); }
.row[data-action] { cursor: pointer; }
.attention-row { flex-wrap: wrap; }
.attention-row .row-main { flex-basis: 160px; }
.row-main { flex: 1; min-width: 0; }
.row-main strong {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-main small {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-side { text-align: right; flex: none; }
.row-side strong { display: block; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.row-side small { font-size: 11px; color: var(--faint); }

.date-block {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  padding: 5px 0 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  line-height: 1;
}
.date-block strong { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.date-block small { margin-top: 3px; font-size: 9px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); }

.row-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
}
.row-icon .ic { width: 17px; height: 17px; }

.amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.amount.zero { color: var(--faint); font-weight: 400; }

.reminder-row { gap: 11px; }
.reminder-row .due { flex: none; max-width: 190px; text-align: right; font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.reminder-row .due strong { display: block; font-size: 12px; color: var(--ink); font-weight: 600; }
.reminder-row .due.overdue strong { color: var(--red); }
.reminder-row .due.soon strong { color: var(--amber); }
.reminder-actions { display: flex; gap: 2px; flex: none; }

.checkbtn {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  color: transparent;
  transition: border-color .15s, background .15s, color .15s;
}
.checkbtn:hover { border-color: var(--green); color: var(--green); }
.checkbtn .ic { width: 14px; height: 14px; stroke-width: 2.2; }
.checkbtn.on { background: var(--green); border-color: var(--green); color: var(--paper); }

/* actividad */
.activity-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 2px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
}
.activity-row:first-child { border-top: 0; }
.activity-row time { flex: none; width: 68px; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.activity-row .what { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-row .what strong { font-weight: 600; }
.activity-row .cost { flex: none; font-variant-numeric: tabular-nums; color: var(--muted); }

/* ------------------------------------------------------------
   Gráfico de barras
   ------------------------------------------------------------ */

.bars {
  display: flex;
  align-items: stretch;
  gap: 7px;
  height: 168px;
  padding-top: 8px;
}
.bar-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
}
.bar-track { width: 100%; flex: 1; display: flex; align-items: flex-end; justify-content: center; }
.bar {
  width: min(100%, 26px);
  min-height: 2px;
  border-radius: 4px 4px 2px 2px;
  background: color-mix(in srgb, var(--ink) 18%, transparent);
  transition: background .15s;
}
.bar-col:hover .bar { background: var(--accent); }
.bar-col.current .bar { background: var(--accent); }
.bar-label { font-size: 9.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.bar-col.current .bar-label { color: var(--ink); font-weight: 600; }
.chart-foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
}
.chart-foot strong { font-family: var(--serif); font-size: 22px; font-weight: 400; color: var(--ink); }

/* donut */
.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.donut {
  position: relative;
  width: 164px;
  height: 164px;
  flex: none;
  border-radius: 50%;
}
.donut-hole {
  position: absolute;
  inset: 26px;
  border-radius: 50%;
  background: var(--surface);
  display: grid;
  place-items: center;
  text-align: center;
  line-height: 1.1;
}
.donut-hole strong { font-family: var(--serif); font-size: 25px; font-weight: 400; }
.donut-hole small { font-size: 9.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); }
.legend { display: grid; gap: 9px; flex: 1; min-width: 150px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.legend-item .swatch { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.legend-item .legend-name { flex: 1; color: var(--muted); }
.legend-item strong { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------
   Garaje
   ------------------------------------------------------------ */

.vehicle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.vehicle-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .18s ease, border-color .18s;
}
.vehicle-card:hover { transform: translateY(-2px); border-color: var(--line-strong); }

.vehicle-art {
  position: relative;
  height: 108px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--tone-bg, var(--surface-2));
  color: var(--tone-ink, var(--muted));
}
.vehicle-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(currentColor 1px, transparent 1px);
  background-size: 14px 14px;
  opacity: .14;
  pointer-events: none;
}
.vehicle-art > .ic { width: 58px; height: 58px; stroke-width: 1.15; opacity: .9; }
.vehicle-art .status-pill { position: absolute; top: 11px; right: 11px; z-index: 1; }
.vehicle-art .energy-tag {
  position: absolute;
  left: 12px;
  bottom: 10px;
  z-index: 1;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  opacity: .7;
}

.vehicle-body { display: flex; flex-direction: column; flex: 1; padding: 16px 18px 15px; }
.vehicle-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.vehicle-title h2 {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plate {
  flex: none;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .07em;
  padding: 2px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.vehicle-body .meta { margin-top: 3px; font-size: 11.5px; color: var(--faint); }
.odometer { display: flex; align-items: baseline; gap: 7px; margin-top: 15px; }
.odometer strong { font-family: var(--serif); font-size: 29px; font-weight: 400; line-height: 1; letter-spacing: -.01em; }
.odometer small { font-size: 11px; color: var(--faint); }
.vehicle-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
}
.vehicle-foot .grow { flex: 1; }
.vehicle-foot strong { color: var(--ink); font-weight: 600; }
.vehicle-foot .open { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--ink); }
.vehicle-foot .open:hover { color: var(--accent); }
.vehicle-foot .ic { width: 14px; height: 14px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone-ink, var(--ink)) 16%, transparent);
  color: var(--tone-ink, var(--muted));
  font-size: 10.5px;
  font-weight: 600;
  backdrop-filter: blur(4px);
}
.status-pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-pill.alert { background: var(--red-soft); color: var(--red); border-color: transparent; }
.status-pill.ok { background: var(--green-soft); color: var(--green); border-color: transparent; }

.add-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 250px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: border-color .15s, color .15s, background .15s;
}
.add-card:hover { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 3%, transparent); }
.add-card .plus-ring {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid currentColor;
}
.add-card small { font-size: 11px; font-weight: 400; color: var(--faint); }

/* tonos */
.tone-0 { --tone-bg: #dfe7d7; --tone-ink: #33502d; }
.tone-1 { --tone-bg: #f1d9cf; --tone-ink: #7f3721; }
.tone-2 { --tone-bg: #dbe4ec; --tone-ink: #2c4d68; }
.tone-3 { --tone-bg: #f0e5c5; --tone-ink: #6d5412; }
.tone-4 { --tone-bg: #e6dbe4; --tone-ink: #5d3552; }
.tone-5 { --tone-bg: #e2e1d9; --tone-ink: #43453c; }
html[data-theme="dark"] .tone-0 { --tone-bg: #243224; --tone-ink: #c7ddc0; }
html[data-theme="dark"] .tone-1 { --tone-bg: #38251e; --tone-ink: #efb49f; }
html[data-theme="dark"] .tone-2 { --tone-bg: #1e2d39; --tone-ink: #b4cfe2; }
html[data-theme="dark"] .tone-3 { --tone-bg: #332c18; --tone-ink: #dfc98c; }
html[data-theme="dark"] .tone-4 { --tone-bg: #2f222d; --tone-ink: #d8b6d1; }
html[data-theme="dark"] .tone-5 { --tone-bg: #2a2c25; --tone-ink: #c8c7b9; }

/* mini tarjetas del panel */
.garage-mini {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 6px;
  border-top: 1px solid var(--line);
  text-align: left;
  border-radius: 7px;
  transition: background .12s;
}
.garage-mini:first-child { border-top: 0; }
.garage-mini:hover { background: var(--surface-2); }
.mini-art {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 10px;
  background: var(--tone-bg);
  color: var(--tone-ink);
}
.mini-art .ic { width: 20px; height: 20px; }
.mini-main { flex: 1; min-width: 0; }
.mini-main strong { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-main small { display: block; font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-side { flex: none; text-align: right; font-size: 11px; color: var(--muted); }
.mini-side strong { display: block; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink); }

/* ------------------------------------------------------------
   Detalle de vehículo
   ------------------------------------------------------------ */

.back { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 18px; }
.back:hover { color: var(--accent); }
.back .ic { width: 15px; height: 15px; }

.detail-head { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 26px; }
.detail-art {
  flex: none;
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 18px;
  background: var(--tone-bg);
  color: var(--tone-ink);
}
.detail-art .ic { width: 38px; height: 38px; stroke-width: 1.3; }
.detail-identity { flex: 1; min-width: 0; }
.detail-identity h1 {
  font-family: var(--serif);
  font-size: clamp(32px, 3.8vw, 46px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -.015em;
}
.detail-identity .meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 7px; font-size: 12.5px; color: var(--muted); }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .count { font-size: 12px; color: var(--faint); }

.field-inline { position: relative; display: flex; align-items: center; }
.field-inline .ic { position: absolute; left: 10px; width: 15px; height: 15px; color: var(--faint); pointer-events: none; }
.field-inline input {
  height: 36px;
  width: 210px;
  padding: 0 12px 0 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12.5px;
  outline: none;
}
.field-inline input:focus { border-color: var(--ink); }

select.select {
  height: 36px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12.5px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  max-width: 100%;
}

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  transition: background .13s, color .13s, border-color .13s;
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip .n { margin-left: 4px; opacity: .6; font-weight: 500; }

/* ------------------------------------------------------------
   Documentos
   ------------------------------------------------------------ */

.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.doc-card {
  display: flex;
  flex-direction: column;
  padding: 16px 17px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  text-align: left;
  transition: border-color .15s, transform .15s;
}
.doc-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.doc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.doc-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
}
.doc-icon .ic { width: 17px; height: 17px; }
.doc-card h3 { margin-top: 12px; font-size: 15px; letter-spacing: -.005em; }
.doc-card .doc-vehicle { margin-top: 2px; font-size: 11.5px; color: var(--faint); }
.doc-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 14px; }
.doc-date { font-size: 11px; color: var(--muted); line-height: 1.35; }
.doc-date strong { display: block; font-size: 12.5px; color: var(--ink); font-weight: 600; }
.doc-date.overdue strong { color: var(--red); }
.doc-date.soon strong { color: var(--amber); }
.doc-cost { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ------------------------------------------------------------
   Vida útil / mantenimiento
   ------------------------------------------------------------ */

.life { display: flex; align-items: center; gap: 10px; }
.life-track {
  display: block;
  flex: 1;
  height: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.life-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--green);
  transition: width .35s ease;
}
.life-fill.soon { background: var(--amber); }
.life-fill.overdue { background: var(--red); }
.life-pct {
  flex: none;
  min-width: 40px;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.life-pct.soon { color: var(--amber); }
.life-pct.overdue { color: var(--red); }

.life-list { display: grid; gap: 0; }
.life-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 5px;
  border-top: 1px solid var(--line);
  border-radius: 7px;
  transition: background .12s;
}
.life-item:first-child { border-top: 0; }
.life-item:hover { background: var(--surface-2); }
.life-item-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--muted);
}
.life-item-icon .ic { width: 16px; height: 16px; }
.life-item-main { flex: 1; min-width: 0; }
.life-item-main strong {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.life-item-main small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.life-item .life-track { flex: 0 1 150px; height: 6px; }
.life-item .life-pct { min-width: 37px; font-size: 11px; }

.maint-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.maint-card {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 16px 18px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.maint-card.overdue { border-color: color-mix(in srgb, var(--red) 38%, var(--line)); }
.maint-top { display: flex; align-items: flex-start; gap: 11px; }
.maint-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--muted);
}
.maint-icon .ic { width: 18px; height: 18px; }
.maint-title { flex: 1; min-width: 0; }
.maint-title h3 {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.maint-title p { margin-top: 2px; font-size: 11px; color: var(--muted); line-height: 1.35; }
.maint-top .pill { flex: none; }
.maint-card .life-pct { font-size: 13px; }
.maint-remaining { font-size: 12.5px; font-weight: 500; color: var(--ink); }
.maint-remaining span { font-size: 11px; font-weight: 400; color: var(--faint); }
.maint-next { font-size: 11px; color: var(--faint); }
.maint-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.maint-actions .grow { flex: 1; }

/* ------------------------------------------------------------
   Informes
   ------------------------------------------------------------ */

.report-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px; }
.report-table { font-size: 12.5px; }
.table-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.report-table th {
  padding: 7px 8px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--faint);
  border-bottom: 1px solid var(--line-strong);
}
.report-table td { padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.report-table tr:first-child td { border-top: 0; }
.report-table .right { text-align: right; font-variant-numeric: tabular-nums; }
.report-table .strong { font-weight: 600; }
.report-table .vehicle-cell { display: flex; align-items: center; gap: 8px; }
.report-table .dot-mark { width: 7px; height: 7px; border-radius: 2px; flex: none; }

.rank-list { display: grid; gap: 12px; }
.rank-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.rank-item .rank-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.rank-bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.rank-bar span { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
.rank-item .rank-value { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------
   Vacíos y avisos
   ------------------------------------------------------------ */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 54px 24px 58px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.empty-art {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin-bottom: 20px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  background: var(--surface-2);
}
.empty-art .ic { width: 32px; height: 32px; stroke-width: 1.3; }
.empty h2 { font-family: var(--serif); font-size: 32px; font-weight: 400; letter-spacing: -.01em; }
.empty p { max-width: 420px; margin-top: 8px; color: var(--muted); font-size: 13.5px; }
.empty-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: center; margin-top: 22px; }
.empty-features {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  width: 100%;
  max-width: 620px;
  font-size: 11.5px;
  color: var(--faint);
}
.empty-features span { display: inline-flex; align-items: center; gap: 6px; }
.empty-features .ic { width: 14px; height: 14px; }

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.notice .ic { width: 16px; height: 16px; margin-top: 1px; flex: none; }
.notice strong { color: var(--ink); }
.notice.warm { background: var(--amber-soft); border-color: transparent; color: color-mix(in srgb, var(--amber) 70%, var(--ink)); }

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.settings-actions .btn { flex: 0 1 auto; }

/* ------------------------------------------------------------
   Formularios / modal
   ------------------------------------------------------------ */

dialog#modal {
  width: min(600px, calc(100vw - 24px));
  max-width: none;
  max-height: min(88vh, 820px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .45);
  overflow: hidden;
}
dialog#modal::backdrop { background: rgba(16, 17, 13, .5); backdrop-filter: blur(3px); }
dialog#modal[open] { animation: modal-in .16s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

.modal-card { display: flex; flex-direction: column; max-height: min(88vh, 820px); }
.modal-card form { display: flex; flex-direction: column; min-height: 0; max-height: inherit; }
.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
}
.modal-head-main { flex: 1; min-width: 0; }
.modal-kicker { font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-bottom: 4px; }
.modal-head h2 { font-family: var(--serif); font-size: 27px; font-weight: 400; line-height: 1.1; letter-spacing: -.01em; }
.modal-head p { margin-top: 4px; font-size: 12px; color: var(--muted); }
.modal-body { padding: 18px 22px 20px; overflow-y: auto; min-height: 0; }
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  flex-wrap: wrap;
}
.modal-foot .left { margin-right: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 11px; font-weight: 600; letter-spacing: .055em; text-transform: uppercase; color: var(--muted); }
.field label .opt { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--faint); }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 39px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13.5px;
  outline: none;
  transition: border-color .13s, box-shadow .13s;
}
.field textarea { min-height: 76px; resize: vertical; line-height: 1.45; }
.field input::placeholder, .field textarea::placeholder { color: var(--faint); opacity: .75; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 7%, transparent); }
.field input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; accent-color: var(--accent); }
.field .check-line { display: flex; align-items: center; gap: 9px; min-height: 39px; font-size: 13px; color: var(--ink); }
.field .check-line label { font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--ink); font-weight: 500; }
.field .hint { font-size: 10.5px; color: var(--faint); line-height: 1.4; }
.input-money { position: relative; }
.input-money .cur { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--faint); pointer-events: none; }
.input-money input { padding-left: 30px; }
.form-note { margin-top: 14px; }
.subhead {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
}
.form-error { margin-top: 12px; padding: 9px 11px; border-radius: 8px; background: var(--red-soft); color: var(--red); font-size: 12px; display: none; }
.form-error.show { display: block; margin-bottom: 4px; }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  text-align: left;
  transition: border-color .14s, background .14s;
}
.choice:hover { border-color: var(--accent); background: var(--surface-2); }
.choice .row-icon { width: 38px; height: 38px; background: var(--surface); border: 1px solid var(--line); }
.choice strong { display: block; font-size: 13px; }
.choice small { display: block; font-size: 11px; color: var(--faint); }

/* ------------------------------------------------------------
   Toast
   ------------------------------------------------------------ */

.toasts {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: min(440px, calc(100vw - 24px));
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .45);
  animation: toast-in .18s ease-out;
  pointer-events: auto;
}
.toast .ic { width: 15px; height: 15px; color: var(--green); }
.toast.error .ic { color: #ff8d7d; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------
   Impresión
   ------------------------------------------------------------ */

.print-report { display: none; }

@media print {
  body { background: #fff; color: #111; }
  .app, .toasts, dialog, #import-file { display: none !important; }
  .print-report { display: block; }
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */

@media (max-width: 1060px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .stat:nth-child(4) { border-top: 1px solid var(--line); }
  .grid-2, .report-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .brand-mobile { display: inline-flex; padding: 0; font-size: 27px; }
  .topbar-note { display: none; }
  .topbar { padding: 10px 18px; }
  .mobile-nav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 7px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
    position: sticky;
    top: 57px;
    z-index: 29;
    scrollbar-width: none;
  }
  .mobile-nav::-webkit-scrollbar { display: none; }
  .mobile-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
  }
  .mobile-nav a .ic { width: 15px; height: 15px; }
  .mobile-nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }
  .view { padding: 24px 18px 56px; }
  .app-foot { padding: 24px 18px 30px; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 16px; }
  .head-actions { justify-content: flex-start; }
  .detail-head { flex-wrap: wrap; }
  .detail-actions { width: 100%; justify-content: flex-start; }
  .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .topbar-actions .btn { min-height: 34px; padding: 6px 12px; font-size: 12px; }
  .page-head h1 { font-size: 33px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat { padding: 14px 14px 16px; }
  .stat-value { font-size: 26px; }
  .stat-label { font-size: 9.5px; }
  .panel-head { padding: 14px 15px 0; }
  .panel-body { padding: 13px 15px 16px; }
  .panel-body.tight { padding: 7px 8px 10px; }
  .reminder-row { flex-wrap: wrap; }
  .reminder-row .due { max-width: none; text-align: left; order: 4; width: 100%; padding-left: 39px; }
  .reminder-row .pill { order: 3; }
  .reminder-row .reminder-actions { order: 5; margin-left: auto; }
  .attention-row .due { width: 100%; text-align: left; padding-left: 48px; }
  .attention-row .pill { order: 5; margin-left: 48px; }
  .life-item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 6px 10px;
    align-items: center;
  }
  .life-item-icon { grid-row: 1; }
  .life-item-main { grid-column: 2; }
  .life-item .life-pct { grid-column: 3; }
  .life-item .life-track { grid-column: 1 / -1; width: 100%; flex: none; height: 5px; }
  .row .tag { display: none; }
  .row { gap: 10px; padding: 11px 5px; }
  .row-side { min-width: 58px; }
  .date-block { width: 37px; }
  .date-block strong { font-size: 14px; }
  .vehicle-grid { grid-template-columns: 1fr; }
  .empty { padding: 40px 18px 44px; }
  .empty h2 { font-size: 27px; }
  .form-grid { grid-template-columns: 1fr; }
  .choice-grid { grid-template-columns: 1fr; }
  .modal-head { padding: 17px 17px 12px; }
  .modal-body { padding: 15px 17px 18px; }
  .modal-foot { padding: 12px 17px; }
  .modal-foot .btn { flex: 1; }
  .modal-foot .left { width: 100%; }
  .doc-grid { grid-template-columns: 1fr; }
  .field-inline input { width: 100%; }
  .toolbar { align-items: stretch; }
  .toolbar-left, .toolbar-right { width: 100%; }
  .toolbar-right .btn, .toolbar-left .select { flex: 1; }
  .log-filters { width: 100%; }
  .toasts { bottom: 16px; }
  .report-table .hide-sm { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------------------
   Informe imprimible
   ------------------------------------------------------------ */

.print-report { padding: 12mm 14mm; font-family: var(--sans); color: #111; }
.pr-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #111; padding-bottom: 10px; }
.pr-brand { font-family: var(--serif); font-size: 28px; letter-spacing: -.02em; }
.pr-brand span { color: #d64b27; }
.pr-meta { text-align: right; font-size: 9px; text-transform: uppercase; letter-spacing: .1em; color: #666; }
.pr-title { font-family: var(--serif); font-size: 30px; font-weight: 400; margin: 18px 0 4px; }
.pr-sub { font-size: 10px; color: #555; margin-bottom: 16px; }
.pr-vehicle { margin-top: 20px; break-inside: avoid-page; }
.pr-vehicle-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid #999; padding-bottom: 5px; margin-bottom: 8px; }
.pr-vehicle-head h3 { font-size: 15px; }
.pr-vehicle-head span { font-size: 10px; color: #555; }
.pr-summary { display: flex; gap: 22px; margin: 8px 0 12px; font-size: 10px; }
.pr-summary b { display: block; font-size: 15px; }
.pr-table { width: 100%; border-collapse: collapse; font-size: 9.5px; margin-top: 6px; }
.pr-table th { text-align: left; border-bottom: 1px solid #aaa; padding: 4px 5px; font-size: 8px; text-transform: uppercase; letter-spacing: .08em; color: #555; }
.pr-table td { border-bottom: 1px solid #e2e2e2; padding: 4px 5px; }
.pr-table .r { text-align: right; }
.pr-empty { font-size: 10px; color: #777; font-style: italic; }
.pr-foot { margin-top: 24px; padding-top: 8px; border-top: 1px solid #aaa; font-size: 8.5px; color: #666; display: flex; justify-content: space-between; }

/* ============================================================
   v2 — auth, sync y features
   ============================================================ */

.auth-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
  background:
    radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 34%),
    radial-gradient(circle at 90% 90%, color-mix(in srgb, var(--blue) 10%, transparent), transparent 38%),
    var(--paper);
}
.auth-screen[hidden] { display: none; }
.auth-card {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: clamp(24px, 6vw, 44px);
  box-shadow: var(--shadow);
}
.auth-kicker {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 10px;
}
.auth-card h1 { font-family: var(--serif); font-size: clamp(34px, 9vw, 54px); line-height: .98; letter-spacing: -.02em; margin-bottom: 12px; }
.auth-lede { color: var(--muted); font-size: 14px; margin-bottom: 22px; max-width: 40ch; }
.auth-main { width: 100%; justify-content: center; margin-bottom: 4px; }
.auth-links { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 18px; }
.auth-links .linkish { font-size: 13px; }
.auth-form { display: grid; gap: 8px; }
.auth-form label { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 8px; }
.auth-form input {
  width: 100%; border: 1px solid var(--line-strong); background: var(--paper);
  border-radius: 10px; padding: 11px 12px; font-size: 16px;
}
.auth-form .btn { margin-top: 16px; justify-content: center; }
.auth-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 16px 0 20px; }
.auth-codes code {
  background: var(--paper); border: 1px dashed var(--line-strong); border-radius: 8px;
  padding: 9px 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; letter-spacing: .08em; text-align: center;
}
.sync-chip {
  font-size: 10.5px; letter-spacing: .03em; padding: 4px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.sync-chip.ok { color: var(--green); border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
.sync-chip.pending, .sync-chip.offline { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 35%, var(--line)); }
.sync-chip.conflict { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--line)); }
.priority-panel { border-color: var(--line-strong); }
.priority-row { text-decoration: none; }
.priority-row:hover { background: var(--surface-2); }
.measure-positions { display: grid; gap: 7px; margin: 10px 0 4px; }
.measure-position { display: grid; grid-template-columns: minmax(90px, 1fr) 2fr auto; align-items: center; gap: 8px; font-size: 11.5px; }
.measure-pos-label { color: var(--muted); }
.measure-position small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.measure-detail { padding: 10px 0; border-bottom: 1px solid var(--line); }
.measure-detail:last-child { border-bottom: 0; }
.measure-detail-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.fund-compare { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fund-compare > div { border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.fund-compare strong { display: block; font-size: 18px; margin-top: 3px; }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.scenario-list { display: grid; gap: 10px; }
.scenario { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.scenario p { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.scenario-cost { font-weight: 700; }
.share-url { display: flex; gap: 8px; align-items: center; }
.share-url input {
  flex: 1; min-width: 0; border: 1px solid var(--line-strong); background: var(--paper);
  border-radius: 8px; padding: 9px 10px; font-size: 12px;
}
.notice.danger { border-color: color-mix(in srgb, var(--red) 40%, var(--line)); background: var(--red-soft); color: var(--ink); }
.conflict-list { display: grid; gap: 10px; }
.conflict { display: flex; justify-content: space-between; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.conflict small { display: block; color: var(--muted); font-size: 11px; }
@media (max-width: 520px) {
  .fund-compare { grid-template-columns: 1fr; }
  .measure-position { grid-template-columns: 1fr auto; }
  .measure-position .life-track { grid-column: 1 / -1; }
  .conflict { flex-direction: column; align-items: stretch; }
  .auth-codes { grid-template-columns: 1fr; }
}

.share-page { max-width: 900px; margin: 0 auto; padding: clamp(20px, 5vw, 56px) 18px 80px; }
.share-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 16px; }
.share-head h1 { font-family: var(--serif); font-size: clamp(40px, 9vw, 72px); line-height: .95; letter-spacing: -.02em; }
.share-head .lede { color: var(--muted); margin-top: 8px; font-size: 13px; }
.share-brand { font-family: var(--serif); font-size: 28px; white-space: nowrap; }
.share-brand .dot { color: var(--accent); }
.share-page .panel { margin-top: 16px; }
@media (max-width: 620px) { .share-head { flex-direction: column-reverse; } }
[hidden] { display: none !important; }
.toast-action {
  margin-left: 10px; padding: 3px 8px; border: 1px solid currentColor; border-radius: 999px;
  font-size: 11px; font-weight: 600; color: inherit;
}
