/* ============================================================
   Cards & section headers
   ============================================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
}

.card + .card {
  margin-top: var(--sp-4);
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: var(--sp-6) 0 var(--sp-3);
}

.section-title h2 {
  font-size: 18px;
}

.section-title a {
  font-size: 13px;
  font-weight: 700;
  color: var(--cone);
  text-decoration: none;
}

/* ============================================================
   ITV hero card (dashboard signature)
   ============================================================ */

.itv-hero {
  position: relative;
  display: block;
  overflow: hidden;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--r-lg);
  background:
    radial-gradient(500px 240px at 90% -20%, rgba(255, 107, 44, 0.16), transparent 60%),
    linear-gradient(160deg, var(--rose) 0%, var(--surface-2) 100%);
  border: 1px solid var(--line);
  padding: var(--sp-6);
  box-shadow: var(--shadow-md);
  --mood: var(--road);
  --rose: #20202a;
}

.itv-hero[data-mood="warning"] {
  --mood: var(--amber);
  --rose: #2a251a;
}

.itv-hero[data-mood="danger"] {
  --mood: var(--signal);
  --rose: #2a1717;
}

.itv-hero[data-mood="ok"] {
  --mood: var(--road);
  --rose: #142826;
}

.itv-hero[data-mood="none"] {
  --mood: var(--text-3);
  --rose: #1d1d24;
}

.itv-hero__tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mood);
}

.itv-hero__tag .pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mood);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mood) 22%, transparent);
  animation: pulse-dot 1.8s ease-in-out infinite;
}

.itv-hero__count {
  font-family: var(--font-display);
  font-size: clamp(44px, 14vw, 64px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: var(--sp-3) 0 2px;
  font-variant-numeric: tabular-nums;
}

.itv-hero__unit {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
}

.itv-hero__date {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px dashed var(--line);
  font-size: 13px;
  color: var(--text-2);
}

.itv-hero__date strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Progress rail */
.rail {
  margin-top: var(--sp-6);
}

.rail__track {
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}

.rail__fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--mood);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.rail__labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* Reminder chips */
.reminders {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
  flex-wrap: wrap;
}

.rem-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--line);
}

.rem-chip.is-hot {
  background: color-mix(in srgb, var(--amber) 14%, var(--surface));
  color: var(--amber);
  border-color: color-mix(in srgb, var(--amber) 30%, transparent);
}

.rem-chip.is-due {
  background: color-mix(in srgb, var(--signal) 14%, var(--surface));
  color: var(--signal);
  border-color: color-mix(in srgb, var(--signal) 32%, transparent);
}

.rem-chip.is-ok {
  background: color-mix(in srgb, var(--road) 14%, var(--surface));
  color: var(--road);
  border-color: color-mix(in srgb, var(--road) 30%, transparent);
}

.rem-chip time {
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ============================================================
   Empty states
   ============================================================ */

.empty {
  text-align: center;
  padding: var(--sp-8) var(--sp-5);
  border: 1.5px dashed var(--line);
  border-radius: var(--r-lg);
}

.empty__glyph {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--sp-4);
  border-radius: 20px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  color: var(--text-3);
}

.empty__glyph svg {
  width: 30px;
  height: 30px;
}

.empty h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.empty p {
  font-size: 13.5px;
  color: var(--text-2);
  max-width: 280px;
  margin: 0 auto;
}

/* ============================================================
   Stats band
   ============================================================ */

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-3);
  text-align: center;
}

.stat b {
  display: block;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat small {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-top: 2px;
  display: inline-block;
}

.stat--cone b { color: var(--cone); }
.stat--road b { color: var(--road); }
.stat--dim b { color: var(--text-2); }

/* ---------- Sync status chip ---------- */

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.sync-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.sync-chip:active {
  transform: scale(0.97);
}

.sync-chip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-3);
  flex: 0 0 auto;
}

.sync-chip[data-state="ok"] { color: var(--road); border-color: color-mix(in srgb, var(--road) 35%, var(--line)); }
.sync-chip[data-state="ok"] .sync-chip__dot { background: var(--road); box-shadow: 0 0 8px color-mix(in srgb, var(--road) 60%, transparent); }
.sync-chip[data-state="syncing"] .sync-chip__dot { background: var(--cone); animation: pulse-dot 1s ease-in-out infinite; }
.sync-chip[data-state="offline"] .sync-chip__dot { background: var(--amber); }
.sync-chip[data-state="error"] { color: var(--signal); border-color: color-mix(in srgb, var(--signal) 40%, var(--line)); }
.sync-chip[data-state="error"] .sync-chip__dot { background: var(--signal); }

@media (max-width: 1099px) {
  .sync-chip__text { display: none; }
}

/* ============================================================
   Vehicle bar (multi-coche)
   ============================================================ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.vehicle-bar {
  flex: 0 0 auto;
  padding: 0 var(--sp-4) var(--sp-3);
  background: linear-gradient(180deg, var(--bg) 72%, transparent);
}

.vehicle-bar__chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 2px;
}
.vehicle-bar__chips::-webkit-scrollbar { display: none; }

.v-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}
.v-chip:active { transform: scale(0.97); }
.v-chip svg { color: var(--cone); }

.v-chip.is-active {
  background: var(--grad-cone);
  border-color: transparent;
  color: var(--cone-ink);
  box-shadow: var(--shadow-cone);
}
.v-chip.is-active svg { color: var(--cone-ink); }

.v-chip--add {
  border-style: dashed;
  color: var(--text-3);
  font-size: 13px;
}
.v-chip--add .v-chip__plus {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text);
  font-size: 13px;
  line-height: 1;
}

/* ============================================================
   Vehicle list (hoja de gestión)
   ============================================================ */

.v-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: var(--sp-5);
  max-height: 46vh;
  overflow-y: auto;
}

.v-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.v-item__mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--grad-cone);
  color: var(--cone-ink);
}

.v-item__info {
  flex: 1;
  min-width: 0;
}
.v-item__name {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v-item__meta {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
}

.v-item__actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.v-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.v-btn:hover { color: var(--text); border-color: var(--text-3); }
.v-btn--danger:hover, .v-btn--danger:focus-visible {
  color: var(--signal);
  border-color: color-mix(in srgb, var(--signal) 50%, var(--line));
}

.v-edit__row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.v-edit__input { flex: 1; min-width: 0; }
.v-edit__btn { white-space: nowrap; }

@media (max-width: 1099px) {
  .v-edit__row { flex-wrap: nowrap; }
}

/* ============================================================
   Vehicle summary (resumen en home)
   ============================================================ */

.section-title--vehicles {
  margin-bottom: var(--sp-3);
}

.link-btn {
  background: none;
  border: none;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cone);
  padding: 4px 8px;
  border-radius: var(--r-pill);
  transition: background 0.2s ease;
}
.link-btn:hover, .link-btn:focus-visible {
  background: color-mix(in srgb, var(--cone) 12%, transparent);
}

.vsummary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: var(--sp-5);
}

.vsum {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color 0.2s ease, transform 0.15s ease;
}
.vsum:active { transform: scale(0.98); }
.vsum.is-active {
  border-color: color-mix(in srgb, var(--cone) 60%, var(--line));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cone) 18%, transparent);
}

.vsum__mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--grad-cone);
  color: var(--cone-ink);
}

.vsum__info { flex: 1; min-width: 0; }
.vsum__name {
  display: block;
  font-weight: 800;
  font-size: 14.5px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vsum__meta {
  display: block;
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vsum__itv {
  flex: 0 0 auto;
  max-width: 45%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: var(--r-pill);
  line-height: 1;
}
.vsum__itv--none { color: var(--text-3); background: var(--surface-2); }
.vsum__itv--ok   { color: var(--road);   background: color-mix(in srgb, var(--road) 14%, transparent); }
.vsum__itv--warning { color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, transparent); }
.vsum__itv--danger  { color: var(--signal); background: color-mix(in srgb, var(--signal) 14%, transparent); }

@media (min-width: 1100px) {
  .vsum { padding: 14px 16px; }
  .vsum__mark { width: 38px; height: 38px; }
  .vsum__name { font-size: 15.5px; }
}