/* Cabina de camión: el tacógrafo es el objeto central (plástico oscuro, LCD retroiluminado);
   alrededor, un panel de trabajo sobrio en gris asfalto con acento ámbar de señalización. */
:root {
  --bg: #e4e7e2;
  --surface: #f3f5f0;
  --surface-2: #d9ded6;
  --ink: #1b211f;
  --muted: #55605a;
  --line: #c1c9bf;
  --accent: #b86500;
  --accent-ink: #ffffff;
  --accent-soft: #f2dcbb;
  --ok: #1f7a4a;
  --ok-soft: #d3eadb;
  --warn: #a86d00;
  --warn-soft: #f4e3bd;
  --bad: #b8382a;
  --bad-soft: #f4d4cf;

  --a-drive: #d4632a;
  --a-work: #3b6db0;
  --a-avail: #8a68b8;
  --a-rest: #2e9460;
  --a-unknown: #9aa39e;

  /* hardware: igual en tema claro y oscuro */
  --dev: #2a2d30;
  --dev-2: #1b1d1f;
  --dev-hi: #45494d;
  --dev-ink: #b9bec2;
  --lcd: #e2e9ed;
  --lcd-off: #8d969c;
  --lcd-ink: #101417;
  --lcd-ghost: rgba(16, 20, 23, 0.055);
  --paper: #fbfaf5;
  --paper-ink: #24221e;
  --card-white: #f4f5f7;
  --card-yellow: #f2cd3c;
  --card-blue: #4f86c9;

  --f-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --f-body: "Barlow", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --f-lcd: "DotGothic16", "Courier New", monospace;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --r: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1312; --surface: #171c1a; --surface-2: #212725; --ink: #e2e7e3; --muted: #98a39d; --line: #2c3431;
    --accent: #f0a43c; --accent-ink: #1d1206; --accent-soft: #3b2b14;
    --ok: #4cc285; --ok-soft: #173326; --warn: #e6b347; --warn-soft: #3a2e12; --bad: #ef6b5a; --bad-soft: #3d1c18;
    --a-unknown: #6f7974;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1312; --surface: #171c1a; --surface-2: #212725; --ink: #e2e7e3; --muted: #98a39d; --line: #2c3431;
  --accent: #f0a43c; --accent-ink: #1d1206; --accent-soft: #3b2b14;
  --ok: #4cc285; --ok-soft: #173326; --warn: #e6b347; --warn-soft: #3a2e12; --bad: #ef6b5a; --bad-soft: #3d1c18;
  --a-unknown: #6f7974;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--f-body);
  padding-inline: 16px;
  padding-block: 0 40px;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
kbd {
  font: 600 0.78em var(--f-mono);
  border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 4px; padding: 0 0.35em; background: var(--surface);
}
h1, h2, h3 { font-family: var(--f-display); font-weight: 600; letter-spacing: 0.01em; text-wrap: balance; margin: 0; }

/* ---------- Cabecera ---------- */
.topbar {
  max-width: 1320px; margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  padding-block: 18px 14px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background:
    radial-gradient(circle at 50% 50%, var(--bg) 0 24%, transparent 25%),
    conic-gradient(var(--a-drive) 0 32%, var(--a-rest) 0 45%, var(--a-work) 0 70%, var(--a-avail) 0 78%, var(--a-rest) 0 100%);
}
.brand h1 { font-size: 1.75rem; line-height: 1; text-transform: uppercase; letter-spacing: 0.03em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }
.clock { display: flex; gap: 18px; align-items: baseline; flex-wrap: wrap; }
.clock > div { display: flex; flex-direction: column; }
.clock strong { font: 600 1.5rem/1 var(--f-display); font-variant-numeric: tabular-nums; }
.clock-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.clock-date { color: var(--muted); font-size: 0.9rem; }

/* ---------- Distribución ---------- */
.layout {
  max-width: 1320px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 24px; align-items: start;
}
@media (max-width: 1020px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.cab { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* ---------- Unidad del tacógrafo ---------- */
.unit-wrap { display: flex; flex-direction: column; gap: 8px; }
.unit {
  container-type: inline-size;
  background: linear-gradient(180deg, #2b2d2f, #121314);
  border-radius: 10px;
  padding: 1.2cqw;
  box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset, 0 16px 34px -16px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,0,0,0.5);
}
/* Frente 1-DIN: pantalla y teclas de menú arriba, lectores 1 y 2 en el centro,
   interfaz de descarga e impresora abajo */
.face {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0) 40%),
    linear-gradient(180deg, #1f2123, #17181a);
  border-radius: 6px;
  padding: 2.6cqw 3cqw 2.2cqw;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-areas:
    "lcd lcd lcd lcd lcd lcd lcd keys keys keys keys keys"
    "r1 r1 r1 r1 r1 r1 r2 r2 r2 r2 r2 r2"
    "ifc ifc prn prn prn prn prn prn prn prn prn prn";
  gap: 2.2cqw 2.4cqw;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.04) inset;
}
.lcd-bezel {
  grid-area: lcd;
  background: #060707; border-radius: 0.8cqw; padding: 0.9cqw;
  box-shadow: 0 0 0 0.3cqw #2c2f31, 0 0 0 1px #000 inset;
}
.lcd {
  container-type: inline-size;
  background: radial-gradient(130% 160% at 35% 20%, #f6f9fb, var(--lcd) 60%, #c3ccd2);
  border-radius: 2px;
  padding: 2.6cqw 2.4cqw;
  display: flex; flex-direction: column; gap: 2cqw;
  transition: filter 0.4s;
}
.lcd.off { filter: brightness(0.55) contrast(0.9); }
.lcd-row { display: grid; grid-template-columns: repeat(16, 1fr); gap: 0.55cqw; }
.cell {
  aspect-ratio: 5 / 8;
  display: grid; place-items: center;
  font: 7.6cqw/1 var(--f-lcd);
  color: var(--lcd-ink);
  background-image: radial-gradient(circle, var(--lcd-ghost) 42%, transparent 46%);
  background-size: 20% 12.5%;
  overflow: hidden;
}
.cell .g { width: 92%; fill: var(--lcd-ink); }
.cell.blink > * { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.menu-keys {
  grid-area: keys;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.3cqw; align-content: center;
}
.key {
  border: 0; border-radius: 1cqw;
  background: linear-gradient(180deg, #3a3d40, #26282a);
  color: #f1f3f4;
  aspect-ratio: 1.15 / 1;
  display: grid; place-items: center;
  font: 700 2.4cqw/1 var(--f-body);
  box-shadow: 0 0.45cqw 0 #0a0b0c, 0 0 0 1px rgba(0,0,0,0.7), 0 1px 0 rgba(255,255,255,0.14) inset;
  transform: translateY(0); transition: transform 0.05s, box-shadow 0.05s;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.key svg { width: 40%; fill: currentColor; }
.key:active, .key.down { transform: translateY(0.35cqw); box-shadow: 0 0.1cqw 0 #0a0b0c, 0 0 0 1px rgba(0,0,0,0.7); }

/* Lectores de tarjeta, cada uno con su tecla combinada */
.reader { display: flex; align-items: center; gap: 1.4cqw; min-width: 0; }
.reader.r1 { grid-area: r1; }
.reader.r2 { grid-area: r2; }
.mouth {
  position: relative; flex: 1; height: 5.4cqw;
  background: linear-gradient(180deg, #26282a, #1a1b1d);
  border-radius: 0.8cqw;
  box-shadow: 0 0 0 1px #000 inset, 0 1px 0 rgba(255,255,255,0.07);
}
.mouth::after {
  content: ""; position: absolute; left: 14%; right: 5%; top: 44%; height: 0.55cqw; background: #000; border-radius: 1cqw;
  box-shadow: 0 1px 0 rgba(255,255,255,0.08);
}
.mouth-n {
  position: absolute; left: 3%; top: 50%; transform: translateY(-50%);
  width: 3.4cqw; height: 3.4cqw; border-radius: 50%;
  border: 0.25cqw solid #8b9095; color: #c9cdd0;
  display: grid; place-items: center; font: 700 2cqw/1 var(--f-body);
}
.key-num { width: 6.6cqw; flex: none; aspect-ratio: 1 / 1; position: relative; font-size: 2.8cqw; }
.key-num .kp {
  position: absolute; right: 16%; bottom: 16%; width: 1.3cqw; height: 0.9cqw;
  border: 0.22cqw solid currentColor; border-radius: 0.15cqw; opacity: 0.7;
}
.card-edge {
  position: absolute; left: 14%; right: 5%; top: 46%; height: 78%;
  border-radius: 0.3cqw 0.3cqw 0.6cqw 0.6cqw;
  z-index: 1;
  font: 600 1.3cqw/1 var(--f-display); letter-spacing: 0.04em; text-transform: uppercase;
  display: flex; align-items: flex-end; justify-content: space-between; padding: 0 1.2cqw 0.35cqw;
  color: #2a2f35;
  box-shadow: 0 0.4cqw 0.8cqw rgba(0,0,0,0.5);
  animation: slidein 0.35s ease-out;
}
.card-edge.white { background: linear-gradient(180deg, #d9dde2, var(--card-white)); }
.card-edge.yellow { background: linear-gradient(180deg, #d9b52c, var(--card-yellow)); }
.card-edge.blue { background: linear-gradient(180deg, #3e6fae, var(--card-blue)); color: #fff; }
.card-edge.reading::before { content: ""; position: absolute; left: 50%; top: -6px; width: 6px; height: 6px; border-radius: 50%; background: var(--a-rest); }
@keyframes slidein { from { transform: translateY(-60%); opacity: 0.4; } }

/* Interfaz de descarga (tapa) e impresora: ranura de salida con canto de corte y cajón */
.iface {
  grid-area: ifc;
  background: linear-gradient(180deg, #2b2e30, #1c1d1f);
  border-radius: 0.8cqw;
  box-shadow: 0 0 0 1px #000 inset, 0 1px 0 rgba(255,255,255,0.06);
  display: grid; place-items: center;
}
.iface span { width: 46%; height: 26%; border: 0.22cqw solid #4c5155; border-radius: 0.4cqw; }
.printer { grid-area: prn; display: flex; flex-direction: column; }
.printer-slot {
  position: relative; height: 2.6cqw;
  background: #0c0d0e;
  border-radius: 0.8cqw 0.8cqw 0 0;
}
.tear {
  position: absolute; left: 3%; right: 3%; top: 0; height: 0.7cqw;
  background: repeating-linear-gradient(90deg, #6d7276 0 0.5cqw, #3b3f42 0.5cqw 1cqw);
}
.paper-out {
  position: absolute; left: 6%; right: 6%; bottom: 40%; height: 0;
  background: repeating-linear-gradient(180deg, var(--paper) 0 5px, #ecebe4 5px 6px);
  border-radius: 2px 2px 0 0;
  box-shadow: 0 -4px 10px rgba(0,0,0,0.3);
  z-index: 2;
}
.tray {
  height: 5.6cqw;
  background: linear-gradient(180deg, #303336, #1d1f21);
  border-radius: 0 0 0.8cqw 0.8cqw;
  box-shadow: 0 0 0 1px #000 inset, 0 1px 0 rgba(255,255,255,0.06) inset;
  display: flex; align-items: center; justify-content: space-between; padding: 0 2cqw;
}
.grip { width: 8cqw; height: 1.4cqw; border-radius: 1cqw; background: #0e0f10; box-shadow: 0 1px 0 rgba(255,255,255,0.08); }
.engrave { font: 500 1.35cqw/1 var(--f-body); color: #7b8186; letter-spacing: 0.16em; text-transform: uppercase; }

@container (max-width: 560px) {
  .face {
    grid-template-columns: 1fr;
    grid-template-areas: "lcd" "keys" "r1" "r2" "prn";
    gap: 3.2cqw; padding: 4cqw;
  }
  .iface { display: none; }
  .menu-keys { gap: 2.6cqw; }
  .key { font-size: 4.4cqw; border-radius: 2cqw; box-shadow: 0 0.9cqw 0 #0a0b0c, 0 0 0 1px rgba(0,0,0,0.7); }
  .key-num { width: 12cqw; font-size: 5cqw; }
  .key-num .kp { width: 2.4cqw; height: 1.6cqw; }
  .mouth { height: 9cqw; }
  .mouth-n { width: 6cqw; height: 6cqw; font-size: 3.4cqw; }
  .card-edge { font-size: 2.4cqw; }
  .printer-slot { height: 4cqw; }
  .tray { height: 9cqw; }
  .grip { width: 14cqw; height: 2.4cqw; }
  .engrave { font-size: 2.4cqw; }
}

.keys-legend { margin: 0; color: var(--muted); font-size: 0.82rem; line-height: 1.9; }

/* ---------- Mandos de cabina ---------- */
.console {
  display: grid; grid-template-columns: auto minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px;
}
@media (max-width: 760px) { .console { grid-template-columns: 1fr; } }
.ctl { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ctl + .ctl { border-left: 1px solid var(--line); padding-left: 14px; }
@media (max-width: 760px) { .ctl + .ctl { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 12px; } }
.ctl-label { font: 600 0.72rem/1 var(--f-body); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.ctl-help { font-size: 0.78rem; color: var(--muted); }
.ign {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px;
  padding: 6px 14px 6px 6px; font-weight: 600;
}
.ign-key {
  width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle, #6d7377 0 30%, #3a3e41 32% 100%);
  position: relative; transition: transform 0.25s;
}
.ign-key::after { content: ""; position: absolute; left: 13px; top: 4px; width: 4px; height: 22px; background: #c6cbcf; border-radius: 2px; }
.ign[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.ign[aria-pressed="true"] .ign-key { transform: rotate(60deg); }
.speed-row { display: flex; align-items: center; gap: 12px; }
.speedo { font: 700 2rem/1 var(--f-display); font-variant-numeric: tabular-nums; min-width: 4.6ch; }
.speedo small { font-size: 0.8rem; color: var(--muted); margin-left: 3px; font-weight: 500; }
.speedo.over { color: var(--bad); }
input[type="range"] { flex: 1; min-width: 0; accent-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 4px 11px; font-size: 0.84rem; font-weight: 500; font-variant-numeric: tabular-nums;
}
.chip:hover { border-color: var(--muted); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip-warn { color: var(--bad); }
.geo { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.ctl-sub { font-size: 0.78rem; color: var(--muted); }
select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 5px 8px; max-width: 100%; }
.chip.sound { align-self: flex-start; }
.chip.sound[aria-pressed="false"] { color: var(--muted); text-decoration: line-through; }

/* ---------- Bloques ---------- */
.block { display: flex; flex-direction: column; gap: 10px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.block-head h2 { font-size: 1.3rem; text-transform: uppercase; letter-spacing: 0.04em; }
.block-note { color: var(--muted); font-size: 0.85rem; }

/* ---------- Cartera de tarjetas ---------- */
.wallet { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tcard {
  position: relative; text-align: left;
  border: 0; border-radius: 10px; padding: 12px 14px 10px;
  aspect-ratio: 85.6 / 54; max-width: 100%;
  display: flex; flex-direction: column; justify-content: space-between;
  color: #1f252b;
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset, 0 6px 14px -8px rgba(0,0,0,0.45), 0 0 0 1px rgba(0,0,0,0.12);
  transition: transform 0.15s, opacity 0.2s;
  overflow: hidden;
}
.tcard:hover { transform: translateY(-2px); }
.tcard.white { background: linear-gradient(135deg, #fff, #e8ebef); }
.tcard.yellow { background: linear-gradient(135deg, #f8dc63, #e9bf2a); }
.tcard.blue { background: linear-gradient(135deg, #6a9bd8, #3f72b3); color: #fff; }
.tcard .eu {
  position: absolute; right: 12px; top: 10px; width: 30px; height: 20px; border-radius: 3px;
  background: #284d9a; display: grid; place-items: center;
  font: 700 0.62rem/1 var(--f-display); color: #f3d23c; letter-spacing: 0.05em;
}
.tcard .ttype { font: 600 0.68rem/1 var(--f-body); text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.75; }
.tcard .tname { font: 600 1.15rem/1.1 var(--f-display); text-transform: uppercase; }
.tcard .tnum { font: 400 0.78rem/1.2 var(--f-mono); opacity: 0.8; }
.tcard .chip-gold {
  width: 30px; height: 23px; border-radius: 4px;
  background: linear-gradient(135deg, #e6c771, #b8913a); box-shadow: 0 0 0 1px rgba(0,0,0,0.2) inset;
}
.tcard.inserted { opacity: 0.45; }
.tcard-state {
  position: absolute; inset: auto 8px 8px auto;
  font: 600 0.7rem/1 var(--f-body); text-transform: uppercase; letter-spacing: 0.06em;
  background: rgba(0,0,0,0.75); color: #fff; padding: 4px 7px; border-radius: 4px;
}
.picker {
  position: absolute; inset: 0; background: rgba(20,24,22,0.86); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border-radius: 10px;
  padding: 10px;
}
.picker p { margin: 0; font-size: 0.85rem; }
.picker .row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.picker button { border: 0; border-radius: 6px; padding: 7px 14px; font-weight: 600; background: #fff; color: #1b211f; }
.picker button.ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.5); }

/* ---------- Tickets ---------- */
.tickets { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 640px) { .tickets { grid-template-columns: minmax(0, 1fr); } }
.tickets .empty { grid-column: 1 / -1; margin: 0; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); padding: 14px; }
.paper {
  background: var(--paper); color: var(--paper-ink);
  font: 13px/1.45 var(--f-mono);
  padding: 14px 16px 18px;
  white-space: pre-wrap; word-break: break-word;
  box-shadow: 0 10px 22px -12px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,0,0,0.06);
  position: relative;
  max-height: 640px; overflow: auto;
  -webkit-mask: linear-gradient(#000, #000);
}
.paper::after {
  content: ""; display: block; height: 10px; margin: 10px -16px -18px;
  background: linear-gradient(-45deg, transparent 6px, var(--paper) 0) 0 0 / 12px 10px repeat-x, linear-gradient(45deg, transparent 6px, var(--paper) 0) 0 0 / 12px 10px repeat-x;
}
.paper .ln { min-height: 1.45em; }
.paper .gi { width: 0.62em; height: 0.9em; fill: var(--paper-ink); vertical-align: -0.08em; margin: 0 0.06em; }
.paper .sign { font-family: "Brush Script MT", "Segoe Script", cursive; font-size: 22px; color: #1d3d8f; line-height: 1; }
.ticket-list { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ticket-item {
  text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r);
  padding: 8px 10px; display: flex; flex-direction: column; gap: 2px;
}
.ticket-item.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.ticket-item b { font-family: var(--f-display); font-size: 1.02rem; font-weight: 600; }
.ticket-item span { color: var(--muted); font-size: 0.8rem; }
.ticket-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  border-radius: var(--r); padding: 7px 14px; font-weight: 600;
}
.btn.ghost { background: transparent; color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ---------- Panel lateral ---------- */
.side {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + 12px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  display: flex; flex-direction: column; min-width: 0;
  max-height: calc(100vh - 24px);
}
@media (max-width: 1020px) { .side { position: static; max-height: none; } }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1; border: 0; background: transparent; padding: 12px 8px 10px;
  font: 600 1rem/1 var(--f-display); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
  border-bottom: 3px solid transparent;
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.panel { padding: 16px; overflow: auto; flex: 1; min-height: 0; }
.side-foot { border-top: 1px solid var(--line); padding: 10px 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.foot-note { font-size: 0.8rem; color: var(--muted); }
.foot-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.link-btn { border: 0; background: none; color: var(--muted); text-decoration: underline; font-size: 0.85rem; padding: 0; }

/* Ejercicios */
.lesson-list { display: flex; flex-direction: column; gap: 8px; }
.lesson-btn {
  text-align: left; border: 1px solid var(--line); background: var(--bg); border-radius: var(--r);
  padding: 10px 12px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center;
}
.lesson-btn:hover { border-color: var(--accent); }
.lesson-btn b { font: 600 1.08rem/1.15 var(--f-display); }
.lesson-btn small { color: var(--muted); grid-column: 1; }
.tag { font: 600 0.66rem/1 var(--f-body); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.done-badge { grid-row: 1 / span 2; grid-column: 2; font: 600 0.7rem/1 var(--f-body); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ok); background: var(--ok-soft); padding: 4px 7px; border-radius: 4px; }
.lesson-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.lesson-head h3 { font-size: 1.45rem; line-height: 1.1; }
.lesson-head p { margin: 0; color: var(--muted); max-width: 60ch; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; counter-reset: st; }
.steps li {
  counter-increment: st;
  display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 8px 8px; border-radius: var(--r);
}
.steps li::before {
  content: counter(st);
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font: 600 0.8rem/1 var(--f-body); border: 1.5px solid var(--line); color: var(--muted);
}
.steps li.ok { color: var(--muted); }
.steps li.ok::before { content: "✓"; background: var(--ok); border-color: var(--ok); color: #fff; }
.steps li.now { background: var(--accent-soft); }
.steps li.now::before { border-color: var(--accent); color: var(--accent); }
.steps li.todo { opacity: 0.6; }
.steps .hint { display: block; font-size: 0.85rem; color: var(--muted); margin-top: 4px; }
.steps li.now .hint { color: var(--ink); }
.steps .gi, .help .gi, .glossary .gi { width: 0.62em; height: 0.9em; fill: currentColor; vertical-align: -0.08em; }
.lesson-done { margin-top: 12px; padding: 12px; border-radius: var(--r); background: var(--ok-soft); color: var(--ink); }
.lesson-done b { color: var(--ok); }
.lesson-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.panel-intro { margin: 0 0 12px; color: var(--muted); }

/* Tiempos */
.who { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.meter { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; margin-bottom: 14px; }
.meter .m-name { font-weight: 600; }
.meter .m-val { font: 600 1rem/1.4 var(--f-mono); font-variant-numeric: tabular-nums; }
.meter .m-bar { grid-column: 1 / -1; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; position: relative; }
.meter .m-bar i { position: absolute; inset: 0 auto 0 0; background: var(--ok); border-radius: 4px; }
.meter.warn .m-bar i { background: var(--warn); }
.meter.bad .m-bar i { background: var(--bad); }
.meter.bad .m-val { color: var(--bad); }
.meter .m-note { grid-column: 1 / -1; font-size: 0.8rem; color: var(--muted); }
.strip-wrap { margin: 6px 0 16px; }
.strip { position: relative; height: 34px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.strip i { position: absolute; top: 0; bottom: 0; }
.strip i.drive { background: var(--a-drive); top: 0; }
.strip i.work { background: var(--a-work); top: 8px; }
.strip i.avail { background: var(--a-avail); top: 14px; }
.strip i.rest { background: var(--a-rest); top: 22px; }
.strip i.unknown { background: var(--a-unknown); top: 22px; }
.strip .nowline { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); }
.strip-axis { display: flex; justify-content: space-between; font: 0.72rem var(--f-mono); color: var(--muted); margin-top: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.8rem; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; background: var(--c); }
.callout { padding: 10px 12px; border-radius: var(--r); background: var(--bg); border: 1px solid var(--line); font-size: 0.88rem; margin-bottom: 12px; }
.callout b { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.sub { font: 600 0.72rem/1 var(--f-body); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin: 18px 0 8px; }

/* Ayuda */
.help table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.help td { padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.help td:first-child { white-space: nowrap; font-weight: 600; width: 1%; padding-right: 12px; }
.glossary { display: grid; grid-template-columns: 34px 1fr; gap: 6px 10px; font-size: 0.9rem; align-items: center; }
.glossary .sym { font: 600 1.2rem/1 var(--f-mono); text-align: center; background: var(--lcd); color: var(--lcd-ink); border-radius: 3px; padding: 4px 0; }
.glossary .sym .gi { fill: var(--lcd-ink); }
.rules-list { margin: 0; padding-left: 18px; font-size: 0.9rem; }
.rules-list li { margin-bottom: 5px; }

/* Modo examen */
.exam-card { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 12px; margin-bottom: 14px; border-radius: var(--r); background: var(--accent-soft); border: 1px solid var(--accent); }
.exam-card b { display: block; font: 600 1.15rem/1.15 var(--f-display); margin: 2px 0; }
.exam-card small { color: var(--muted); }
@media (max-width: 420px) { .exam-card { grid-template-columns: 1fr; } }
.exam-bar { height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.exam-bar i { display: block; height: 100%; background: var(--accent); }
.exam-practical { font-size: 0.82rem; color: var(--accent); font-weight: 600; }
.exam-q { font-size: 1.25rem; line-height: 1.2; }
.exam-opts { display: flex; flex-direction: column; gap: 8px; }
.exam-opt { text-align: left; border: 1px solid var(--line); background: var(--bg); border-radius: var(--r); padding: 10px 12px; font-weight: 500; }
.exam-opt:hover:not(:disabled) { border-color: var(--accent); }
.exam-opt:disabled { cursor: default; }
.exam-opt.right { border-color: var(--ok); background: var(--ok-soft); }
.exam-opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.exam-opt.dim { opacity: 0.55; }
.exam-opt .gi, .exam-q .gi, .exam-expl .gi { width: 0.62em; height: 0.9em; fill: currentColor; vertical-align: -0.08em; }
.exam-expl { margin-top: 12px; padding: 10px 12px; border-radius: var(--r); font-size: 0.9rem; }
.exam-expl.ok { background: var(--ok-soft); }
.exam-expl.ok b { color: var(--ok); }
.exam-expl.ko { background: var(--bad-soft); }
.exam-expl.ko b { color: var(--bad); }

/* Control: infracciones */
.ctrl-title { font-size: 1.4rem; line-height: 1.1; margin-bottom: 6px; }
.tab { font-size: 0.92rem; padding-inline: 4px; }
.sev-sum { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.sev-pill { font: 600 0.74rem/1 var(--f-body); padding: 5px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink); }
.sev-pill.sev-mg { background: var(--bad); color: #fff; }
.sev-pill.sev-g { background: var(--warn); color: #1b1206; }
.sev-pill.sev-l { background: var(--warn-soft); color: var(--ink); }
.sev-pill.sev-aviso { background: var(--accent-soft); color: var(--ink); }
.inf-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.inf { border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: var(--r); padding: 9px 11px; background: var(--bg); display: flex; flex-direction: column; gap: 3px; }
.inf.sev-mg { border-left-color: var(--bad); }
.inf.sev-g { border-left-color: var(--warn); }
.inf.sev-l { border-left-color: var(--warn-soft); }
.inf.sev-aviso { border-left-color: var(--accent); }
.inf.sev-evento { border-left-color: var(--a-avail); }
.inf p { margin: 0; font-size: 0.86rem; }
.inf b { font-family: var(--f-display); font-size: 1.05rem; font-weight: 600; }
.inf-head { display: flex; justify-content: space-between; gap: 8px; }
.sev-tag { font: 600 0.68rem/1.4 var(--f-body); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.inf.sev-mg .sev-tag { color: var(--bad); }
.inf.sev-g .sev-tag { color: var(--warn); }
.inf-when { font: 0.76rem var(--f-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.inf-rule { font-size: 0.74rem; color: var(--muted); }
.inf-ok { padding: 12px; border-radius: var(--r); background: var(--ok-soft); }
.inf-ok b { color: var(--ok); }

.legal { max-width: 1320px; margin: 28px auto 0; color: var(--muted); font-size: 0.78rem; }

@media (prefers-reduced-motion: reduce) {
  .cell.blink > *, .card-edge { animation: none !important; }
  * { transition: none !important; }
}
