:root {
  --bg: #f3f1ea;
  --card: #ffffff;
  --ink: #16191d;
  --muted: #5f6670;
  --line: #dcd8cc;
  --blue: #1d5bbf;        /* azul de cartel de parking */
  --blue-ink: #ffffff;
  --yellow: #f2c230;      /* pintura de suelo */
  --ok: #1f8a4c;
  --warn: #c0392b;
  --chip: #ebe8de;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 6px 20px rgba(0,0,0,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181d;
    --card: #1e242b;
    --ink: #eef0f2;
    --muted: #9aa3ad;
    --line: #2f3740;
    --blue: #3b7be0;
    --chip: #283039;
    --ok: #36b36b;
    --warn: #e0604f;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.45 "Atkinson Hyperlegible", system-ui, sans-serif;
}
.app { max-width: 560px; margin: 0 auto; padding: 0 16px calc(32px + env(safe-area-inset-bottom)); }
h1 { font: 800 30px/1.1 "Barlow Condensed", system-ui, sans-serif; letter-spacing: .01em; margin: 18px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
a { color: inherit; }

/* Cabecera */
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 0 6px; }
.brand, .mainnav a { white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 600 22px/1 "Barlow Condensed", sans-serif; }
.brand b { font-weight: 800; }
.mainnav { display: flex; gap: 4px; background: var(--chip); border-radius: 999px; padding: 4px; }
.mainnav a { text-decoration: none; padding: 7px 11px; border-radius: 999px; font-size: 15px; color: var(--muted); }
.mainnav a.on { background: var(--card); color: var(--ink); font-weight: 700; box-shadow: var(--shadow); }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 16px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: 700 16px/1.2 inherit; font-family: inherit; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: var(--blue-ink); }
.btn.ok { color: var(--ok); }
.btn.big { width: 100%; min-height: 60px; font-size: 19px; margin: 16px 0 10px; }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: 14px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); width: 100%; }
.row2, .row3 { display: grid; gap: 8px; }
.row2 { grid-template-columns: 1fr 1fr; margin: 14px 0; }
.row3 { grid-template-columns: repeat(3, 1fr); }
.row3 .btn { padding: 10px 6px; font-size: 15px; }

/* Vacío */
.empty { text-align: center; padding-top: 7vh; }
.empty-sign {
  width: 96px; height: 96px; margin: 0 auto 8px; border-radius: 22px; background: var(--blue); color: #fff;
  font: 800 72px/96px "Barlow Condensed", sans-serif;
}
.empty p { color: var(--muted); max-width: 30em; margin: 0 auto; }

/* Mi coche */
.eyebrow { margin: 18px 0 0; color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: .08em; }
.car-title { margin-top: 2px; }
.car-title:empty { display: none; }

/* Carteles tipo parking */
.signs { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin: 14px 0; }
.signs:empty { display: none; }
.sign {
  border-radius: 14px; padding: 8px 10px 10px; background: var(--blue); color: #fff;
  display: flex; flex-direction: column; justify-content: space-between; min-height: 92px;
}
.sign .k { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; opacity: .85; }
.sign .v { font: 800 44px/1 "Barlow Condensed", sans-serif; word-break: break-word; }
.sign.long .v { font-size: 28px; }
.sign.color { border: 1px solid rgba(0,0,0,.12); }
.signs.compact .sign { min-height: 70px; }
.signs.compact .sign .v { font-size: 34px; }
.signs.compact .sign.long .v { font-size: 22px; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.facts > div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; }
.facts .lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.facts strong { font: 800 26px/1.1 "Barlow Condensed", sans-serif; }
.facts small { color: var(--muted); font-size: 13px; }
.facts .late strong { color: var(--warn); }

.note { background: var(--card); border-left: 4px solid var(--yellow); border-radius: 10px; padding: 10px 12px; margin: 12px 0; white-space: pre-wrap; }

.fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; margin: 12px 0; }
.fotos:empty { display: none; }
.fotos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; display: block; cursor: zoom-in; }
.fotos .ph { position: relative; }
.fotos .del {
  position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 16px; cursor: pointer;
}
.zoom { position: fixed; inset: 0; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; z-index: 50; }
.zoom img { max-width: 100%; max-height: 100%; }

/* Formulario */
.gps { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin: 10px 0 14px; }
.gps-txt { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.gps-txt small { color: var(--muted); font-size: 13px; }
.gps-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); flex: none; }
.gps-dot.busy { background: var(--yellow); animation: pulse 1s infinite alternate; }
.gps-dot.good { background: var(--ok); }
.gps-dot.bad { background: var(--warn); }
@keyframes pulse { to { opacity: .35; } }

fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font: 800 20px/1 "Barlow Condensed", sans-serif; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px; padding: 0; }
legend small { font: 400 14px "Atkinson Hyperlegible", sans-serif; text-transform: none; letter-spacing: 0; color: var(--muted); }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.field > span small { font-weight: 400; color: var(--muted); }
input, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-height: 48px;
}
input:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
input.plaza { font: 800 28px/1 "Barlow Condensed", sans-serif; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip {
  min-width: 44px; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--chip); color: var(--ink); font: 800 20px/1 "Barlow Condensed", sans-serif; cursor: pointer;
}
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.sw {
  width: 52px; height: 52px; border-radius: 12px; border: 2px solid rgba(0,0,0,.15); cursor: pointer; position: relative;
  display: flex; align-items: flex-end; justify-content: center; padding: 0 0 3px; font-size: 10px; font-weight: 700;
}
.sw.on { outline: 3px solid var(--ink); outline-offset: 2px; }
.sw.on::after { content: "✓"; position: absolute; top: 4px; left: 0; right: 0; text-align: center; font-size: 20px; }

/* Llévame */
.compass { position: relative; width: min(72vw, 280px); aspect-ratio: 1; margin: 18px auto 6px; }
.dial { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--line); background: var(--card); box-shadow: var(--shadow); transition: transform .25s linear; }
.dial .n { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); font: 800 18px "Barlow Condensed", sans-serif; color: var(--warn); }
.arrow { position: absolute; inset: 16%; width: 68%; height: 68%; transition: transform .25s linear; }
.arrow path { fill: var(--blue); }
.compass.near .arrow path { fill: var(--ok); }
.dist { text-align: center; margin: 4px 0; }
.dist strong { display: block; font: 800 48px/1 "Barlow Condensed", sans-serif; }
.dist span { color: var(--muted); }
#l-brujula { display: flex; margin: 8px auto; }
.arrive { background: var(--ok); color: #fff; border-radius: 14px; padding: 12px 14px; font-weight: 700; text-align: center; }
.map { height: 260px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); margin-top: 14px; background: var(--chip); }
.map:empty { display: none; }
.car-pin { font-size: 30px; line-height: 1; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
.me-pin { width: 18px; height: 18px; border-radius: 50%; background: #2b7bf0; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(43,123,240,.35); }

/* Historial */
.hist { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 10px; }
.hist li { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.hist .when { font-size: 13px; color: var(--muted); }
.hist .what { font-weight: 700; }
.hist .dir { font-size: 14px; color: var(--muted); }
.hist .acts { display: flex; flex-direction: column; gap: 6px; }
.hist .now { color: var(--blue); font-size: 12px; font-weight: 700; text-transform: uppercase; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); border-radius: 14px; padding: 12px 16px; z-index: 60;
  display: flex; gap: 14px; align-items: center; max-width: calc(100% - 32px); box-shadow: var(--shadow);
}
.toast button { background: none; border: 0; color: var(--yellow); font: 700 16px inherit; font-family: inherit; cursor: pointer; }
@media (max-width: 380px) {
  .brand span { font-size: 19px; }
  .brand img { width: 30px; height: 30px; }
  .mainnav a { padding: 6px 9px; font-size: 14px; }
}
