:root {
  --bg: #06070b; --bg2: #0b0d13; --panel: #12141c; --panel2: #1a1d27; --panel3: #232735;
  --line: rgba(255,255,255,.07); --line2: rgba(255,255,255,.12);
  --text: #f3f4f8; --mute: #8a90a2; --dim: #5b6172;
  --accent: #6d6af8; --accent-ink: #fff; --brand: #4f46e5;
  --ok: #22c55e; --amber: #f5a524; --red: #ef4444;
  --paint: #d7dae0; --r: 22px; --r-sm: 14px; --gap: 12px; --rail: 84px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --glow: color-mix(in srgb, var(--accent) 35%, transparent);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #e9ecf2; --bg2: #f2f4f8; --panel: #ffffff; --panel2: #f2f4f8; --panel3: #e6e9f0;
  --line: rgba(16,24,40,.08); --line2: rgba(16,24,40,.14);
  --text: #0d1220; --mute: #5b6374; --dim: #9aa1b0; --shadow: 0 8px 24px rgba(16,24,40,.08);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text); overflow: hidden;
  font: 15px/1.35 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; user-select: none; font-variant-numeric: tabular-nums;
}
body.has-wall { background: var(--bg) var(--wall) center/cover no-repeat; }
body.has-wall .w { background: color-mix(in srgb, var(--panel) 78%, transparent); backdrop-filter: blur(14px); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
svg.i { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.row { display: flex; align-items: center; } .gap { gap: 10px; } .grow { flex: 1; min-width: 0; }
.mute { color: var(--mute); } .small { font-size: 13px; }
.gm-mark { display: inline-block; width: 34px; aspect-ratio: 340/214; background: currentColor; -webkit-mask: url(assets/gm-mark.png) center/contain no-repeat; mask: url(assets/gm-mark.png) center/contain no-repeat; }

/* ---------- Splash ---------- */
#splash { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 14px; background: radial-gradient(circle at 50% 42%, #1b1a4a 0, #06070b 60%); transition: opacity .5s ease .1s, visibility .6s; }
#splash.gone { opacity: 0; visibility: hidden; }
.splash-mark { width: 120px; height: 120px; border-radius: 34px; display: grid; place-items: center; background: linear-gradient(145deg, #6366f1, #4338ca); box-shadow: 0 20px 60px rgba(79,70,229,.55); animation: pop .7s cubic-bezier(.2,1.4,.4,1) both; color: #fff; }
.splash-mark .gm-mark { width: 78px; }
.splash-word { font-size: 34px; font-weight: 300; letter-spacing: .28em; color: #fff; animation: rise .6s .25s both; }
.splash-word b { font-weight: 800; }
.splash-by { color: #a5a8ff; font-size: 13px; letter-spacing: .3em; text-transform: uppercase; animation: rise .6s .4s both; }
@keyframes pop { from { transform: scale(.4) rotate(-12deg); opacity: 0; } }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }

/* ---------- Shell ---------- */
.shell { display: flex; height: 100%; padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(0px, env(safe-area-inset-left)); }
.rail { width: var(--rail); flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 0 4px; }
.rail-clock { font-weight: 700; font-size: 21px; display: flex; align-items: baseline; gap: 2px; }
.rail-clock small { font-size: 10px; color: var(--mute); font-weight: 500; }
.rail-status { display: flex; gap: 6px; color: var(--mute); min-height: 16px; }
.rail-status svg.i { width: 15px; height: 15px; }
.rail-status .on { color: var(--text); } .rail-status .obd-on { color: var(--ok); }
.rail-nav, .rail-dock { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.rail-nav { margin-top: 6px; }
.rail-dock { padding-top: 8px; margin-top: 4px; border-top: 1px solid var(--line); }
.navbtn { position: relative; width: 52px; height: 46px; border-radius: 15px; display: grid; place-items: center; color: var(--mute); transition: background .2s, color .2s, transform .15s; }
.navbtn:hover { color: var(--text); background: var(--panel); }
.navbtn:active { transform: scale(.92); }
.navbtn.active { color: var(--accent-ink); background: var(--accent); box-shadow: 0 6px 18px var(--glow); }
.navbtn .dot { position: absolute; top: 7px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 2px var(--bg); }
.navbtn .dot.red { background: var(--red); }
.appicon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 17px; color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); transition: transform .15s; }
.appicon:active { transform: scale(.9); }
.rail-vol { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 2px; font-weight: 600; }
.ibtn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--mute); }
.ibtn:hover { color: var(--text); background: var(--panel); }
.ibtn:active { transform: scale(.92); }
.rail-brand { width: 52px; height: 36px; border-radius: 12px; color: var(--mute); display: grid; place-items: center; transition: color .2s; }
.rail-brand:hover { color: var(--accent); }
.rail-brand .gm-mark { width: 32px; }

main { position: relative; flex: 1; min-width: 0; height: 100%; }
.view { position: absolute; inset: 0; overflow: auto; opacity: 0; visibility: hidden; transform: translateY(8px) scale(.995); transition: opacity .25s ease, transform .3s ease, visibility .3s; scrollbar-width: thin; }
.view.active { opacity: 1; visibility: visible; transform: none; }
.alerts { position: absolute; z-index: 5; top: 8px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.alert { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 999px; background: color-mix(in srgb, var(--red) 92%, #000); color: #fff; font-weight: 600; box-shadow: var(--shadow); animation: rise .3s; cursor: pointer; }
.alert.amber { background: color-mix(in srgb, var(--amber) 92%, #000); color: #1b1300; }

/* ---------- Grid de widgets ---------- */
.grid { --rows: 6; display: grid; grid-auto-flow: row dense; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: calc((100vh - 20px - (var(--rows) - 1) * var(--gap)) / var(--rows)); grid-auto-rows: calc((100dvh - 20px - (var(--rows) - 1) * var(--gap)) / var(--rows)); gap: var(--gap); padding-bottom: 2px; }
.w { container-type: size; position: relative; grid-column: span var(--w); grid-row: span var(--h); background: var(--panel); border-radius: var(--r); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); transition: transform .2s, box-shadow .2s, opacity .2s; animation: wIn .45s cubic-bezier(.2,.9,.3,1) both; }
.w.nocard { background: transparent; box-shadow: none; }
@keyframes wIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.w-tap { cursor: pointer; }
.w-tap:active { transform: scale(.985); }
.w-title { position: absolute; top: 14px; left: 16px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); display: flex; align-items: center; gap: 6px; z-index: 2; }
.w-title svg.i { width: 15px; height: 15px; }
.editing .w { animation: wiggle .5s ease-in-out infinite alternate; cursor: grab; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 60%, transparent); }
.editing .w:nth-child(2n) { animation-delay: -.25s; }
.editing .w > *:not(.w-edit) { pointer-events: none; }
@keyframes wiggle { from { transform: rotate(-.35deg); } to { transform: rotate(.35deg); } }
.w-edit { position: absolute; z-index: 10; inset: auto 10px 10px auto; display: none; gap: 6px; }
.editing .w-edit { display: flex; }
.w-edit button { height: 34px; padding: 0 12px; border-radius: 10px; background: var(--panel3); color: var(--text); font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; box-shadow: var(--shadow); }
.w-edit button.del { background: var(--red); color: #fff; }
.w.dragging { opacity: .35; }
.w.drop-target { box-shadow: inset 0 0 0 3px var(--accent); }
.drag-ghost { position: fixed; z-index: 60; pointer-events: none; opacity: .9; border-radius: var(--r); box-shadow: 0 25px 60px rgba(0,0,0,.5); transform: rotate(1.5deg) scale(1.02); }
.home-bar { display: flex; align-items: center; gap: 14px; justify-content: space-between; padding: 10px 14px; margin-bottom: var(--gap); background: var(--panel); border-radius: var(--r-sm); color: var(--mute); font-size: 14px; }

/* Auto */
.car-stage { position: absolute; inset: 0; display: grid; place-items: center; perspective: 900px; touch-action: none; cursor: grab; }
.car-stage svg.car { width: 92%; max-height: 82%; overflow: visible; transition: transform .6s cubic-bezier(.2,.9,.3,1.2); filter: drop-shadow(0 14px 18px rgba(0,0,0,.45)); }
.car-stage.dragging svg.car { transition: none; }
.car-name { position: absolute; left: 18px; bottom: 14px; font-weight: 700; font-size: 18px; z-index: 2; }
.car-name small { display: block; font-weight: 500; font-size: 12px; color: var(--mute); }
.chip { position: absolute; z-index: 3; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: color-mix(in srgb, var(--panel3) 88%, transparent); backdrop-filter: blur(6px); font-weight: 700; font-size: 13px; white-space: nowrap; box-shadow: var(--shadow); }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.chip.amber i { background: var(--amber); } .chip.red i { background: var(--red); } .chip.off i { background: var(--dim); }
.road { position: absolute; left: 0; right: 0; bottom: 0; height: 30%; background: linear-gradient(#0000, color-mix(in srgb, var(--panel3) 70%, transparent)); overflow: hidden; }
.road::before { content: ""; position: absolute; left: -10%; right: -10%; top: 46%; height: 6px; background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--text) 55%, transparent) 0 70px, transparent 70px 140px); animation: lines var(--roadDur, 0s) linear infinite; }
@keyframes lines { to { transform: translateX(-140px); } }

/* Velocímetro */
.gauge { position: absolute; inset: 0; display: grid; place-items: center; }
.gauge svg { width: 88%; height: 88%; overflow: visible; }
.gauge .val { font-weight: 800; letter-spacing: -.03em; fill: var(--text); }
.gauge .unit { fill: var(--mute); font-weight: 500; }
.gauge .src { fill: var(--accent); font-weight: 700; letter-spacing: .14em; }
.digital { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.digital b { font-size: min(48cqh, 34cqw); font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.digital span { color: var(--mute); }
.digital em { font-style: normal; color: var(--accent); font-weight: 700; font-size: 12px; letter-spacing: .14em; }
.speedbar { position: absolute; left: 18px; right: 18px; bottom: 20px; height: 10px; border-radius: 99px; background: var(--panel3); overflow: hidden; }
.speedbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 40%, var(--red))); border-radius: inherit; transition: width .4s; }

/* Música */
.music { position: absolute; inset: 0; display: flex; align-items: center; gap: 16px; padding: 14px; }
.art { height: 100%; aspect-ratio: 1; max-width: 45%; border-radius: 16px; flex: none; display: grid; place-items: center; color: var(--dim); background: linear-gradient(145deg, var(--panel3), var(--panel2)); background-size: cover; background-position: center; overflow: hidden; }
.art svg.i { width: 42%; height: 42%; stroke-width: 1.5; }
.art.playing { box-shadow: 0 0 0 2px var(--glow); }
.m-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.m-title { font-weight: 700; font-size: clamp(16px, 2vw, 22px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-sub { color: var(--mute); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-ctrl { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.m-ctrl .ibtn { color: var(--text); }
.play { width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 8px 22px var(--glow); transition: transform .15s; }
.play:active { transform: scale(.9); }
.play svg.i { width: 26px; height: 26px; fill: currentColor; }
.prog { height: 4px; border-radius: 9px; background: var(--panel3); margin-top: 8px; overflow: hidden; }
.prog i { display: block; height: 100%; width: 0; background: var(--accent); }
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.eq i { width: 3px; background: var(--accent); border-radius: 2px; animation: eq .8s ease-in-out infinite alternate; }
.eq i:nth-child(2) { animation-delay: -.3s; } .eq i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { from { height: 3px; } to { height: 12px; } }

/* Mapa */
.mapbox { position: absolute; inset: 0; background: var(--panel2); }
.leaflet-container { background: var(--panel2); font: inherit; }
:root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.6); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--panel) 70%, transparent) !important; color: var(--mute) !important; font-size: 10px; }
.leaflet-control-attribution a { color: var(--mute) !important; }
.me-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 8px var(--glow); }
.me-arrow { width: 0; height: 0; }
.map-btns { position: absolute; z-index: 500; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
.map-btns button { width: 40px; height: 40px; border-radius: 12px; background: color-mix(in srgb, var(--panel) 90%, transparent); display: grid; place-items: center; box-shadow: var(--shadow); color: var(--text); }
.map-btns button.on { color: var(--accent); }
.map-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; gap: 8px; color: var(--text); padding: 20px; z-index: 400; background: color-mix(in srgb, var(--panel) 72%, transparent); backdrop-filter: blur(2px); font-weight: 600; }

/* Clima, viaje, reloj, OBD, llantas (widgets chicos) */
.stat { position: absolute; inset: 0; padding: 36px 14px 12px; gap: 6px; display: flex; flex-direction: column; justify-content: space-between; }
.big { font-size: clamp(30px, 22cqh, 64px); font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; }
.kv div { background: var(--panel2); border-radius: 12px; padding: 8px 10px; }
.kv b { display: block; font-size: 18px; } .kv span { font-size: 11px; color: var(--mute); text-transform: uppercase; letter-spacing: .06em; }
.wx { display: flex; align-items: center; gap: 14px; }
.wx svg.i { width: 48px; height: 48px; stroke-width: 1.6; color: var(--accent); }
.days { display: flex; gap: 8px; }
.days div { flex: 1; text-align: center; background: var(--panel2); border-radius: 10px; padding: 3px 4px; font-size: 12px; line-height: 1.25; }
.days svg.i { width: 16px; height: 16px; color: var(--mute); display: block; margin: 1px auto; }
@container (max-height: 170px) { .days { display: none; } .wx svg.i { width: 44px; height: 44px; } }
.clock-w { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.clock-w b { font-size: min(52cqh, 19cqw); white-space: nowrap; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.clock-w span { color: var(--mute); margin-top: 6px; }

/* ---------- Páginas ---------- */
.page { padding: 6px 6px 24px; max-width: 1200px; margin: 0 auto; }
.page-h { display: flex; align-items: center; gap: 14px; margin: 4px 0 16px; flex-wrap: wrap; }
.page-h h1 { font-size: 28px; font-weight: 800; }
.page-h p { margin: 2px 0 0; color: var(--mute); }
.card { background: var(--panel); border-radius: var(--r); padding: 18px; box-shadow: inset 0 0 0 1px var(--line); }
.cards { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.card h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card h3 .pill { margin-left: auto; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--panel3); color: var(--mute); }
.pill.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.pill.amber { background: color-mix(in srgb, var(--amber) 20%, transparent); color: var(--amber); }
.pill.red { background: color-mix(in srgb, var(--red) 20%, transparent); color: var(--red); }
.btn { height: 44px; padding: 0 18px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .15s, filter .2s; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); } .btn:active { transform: scale(.96); }
.btn.ghost { background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.btn.danger { background: var(--red); color: #fff; }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn svg.i { width: 18px; height: 18px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px; background: var(--panel); border-radius: 16px; margin-bottom: 14px; scrollbar-width: none; }
.tabs button { height: 40px; padding: 0 16px; border-radius: 12px; color: var(--mute); font-weight: 600; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.tabs button.on { background: var(--panel3); color: var(--text); }
.tabs svg.i { width: 17px; height: 17px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 16px; background: var(--panel2); }
.item .grow b { display: block; } .item .grow span { color: var(--mute); font-size: 13px; }
.item.clickable { cursor: pointer; } .item.clickable:hover { background: var(--panel3); }
.item.now { box-shadow: inset 0 0 0 2px var(--accent); }
.empty { text-align: center; color: var(--mute); padding: 30px 10px; }
.empty svg.i { width: 40px; height: 40px; color: var(--dim); display: block; margin: 0 auto 10px; stroke-width: 1.5; }
.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-weight: 700; font-size: 16px; padding: 6px 10px; border-radius: 10px; background: var(--panel3); }
.sev-alta .code { background: color-mix(in srgb, var(--red) 22%, transparent); color: var(--red); }
.sev-media .code { background: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--amber); }
.live { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.live > div { background: var(--panel); border-radius: 18px; padding: 14px 16px; box-shadow: inset 0 0 0 1px var(--line); }
.live b { font-size: 30px; font-weight: 800; letter-spacing: -.02em; } .live small { color: var(--mute); margin-left: 4px; }
.live span { display: block; color: var(--mute); font-size: 13px; margin-bottom: 4px; }
.bar { height: 6px; border-radius: 9px; background: var(--panel3); margin-top: 10px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .4s; }
canvas.chart { width: 100%; height: 320px; display: block; background: var(--panel2); border-radius: 16px; }
.conn { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--dim); display: inline-block; }
.status-dot.on { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 25%, transparent); }
.status-dot.busy { background: var(--amber); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.health { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: var(--gap); align-items: start; }
.topcar { position: relative; background: var(--panel); border-radius: var(--r); padding: 20px; display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--line); }
.topcar svg { width: 100%; max-width: 230px; height: auto; }
.timer { text-align: center; padding: 26px 10px; }
.timer b { font-size: 84px; font-weight: 800; letter-spacing: -.04em; display: block; line-height: 1; }
.tires { display: grid; grid-template-columns: 1fr minmax(160px, 240px) 1fr; gap: 18px; align-items: center; }
.tire { background: var(--panel); border-radius: var(--r); padding: 18px; text-align: center; box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; transition: transform .15s; }
.tire:active { transform: scale(.97); }
.tire b { font-size: 44px; font-weight: 800; letter-spacing: -.03em; display: block; line-height: 1.1; }
.tire.ok { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ok) 45%, transparent); }
.tire.amber { box-shadow: inset 0 0 0 2px var(--amber); } .tire.red { box-shadow: inset 0 0 0 2px var(--red); }
.tire-col { display: flex; flex-direction: column; gap: 18px; }

/* Ajustes */
.set { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); align-items: start; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.card h3 + .field { border-top: 0; }
.field > span { color: var(--text); } .field > span small { display: block; color: var(--mute); font-size: 12px; }
.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--panel2); border-radius: 12px; flex-wrap: wrap; }
.seg button { height: 34px; padding: 0 12px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--mute); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255,255,255,.18); }
.swatches button.on { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--text); }
.swatches input[type=color] { width: 30px; height: 30px; border: 0; padding: 0; border-radius: 50%; overflow: hidden; background: none; cursor: pointer; }
input.txt, select.txt, textarea.txt { width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel2); outline: none; }
textarea.txt { height: 80px; padding: 10px 14px; resize: vertical; }
input.txt:focus, select.txt:focus, textarea.txt:focus { border-color: var(--accent); }
.switch { width: 50px; height: 30px; border-radius: 99px; background: var(--panel3); position: relative; transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.switch.on { background: var(--accent); } .switch.on::after { transform: translateX(20px); }
.about { display: flex; align-items: center; gap: 16px; }
.about .logo { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: linear-gradient(145deg, #6366f1, #4338ca); color: #fff; flex: none; }
.about .logo .gm-mark { width: 42px; }

/* Overlays */
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.55); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: min(760px, 100%); max-height: 90vh; overflow: auto; background: var(--panel); border-radius: 26px; padding: 20px; box-shadow: var(--shadow); animation: rise .25s; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px; }
.app { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 4px; border-radius: 18px; font-size: 13px; font-weight: 600; text-align: center; }
.app:hover { background: var(--panel2); }
.app .appicon { width: 58px; height: 58px; font-size: 22px; }
.hint { color: var(--mute); font-size: 13px; margin: 14px 0 0; }
#parked { position: fixed; inset: 0; z-index: 80; background: #000; color: #e9eaf0; display: grid; place-content: center; text-align: center; cursor: pointer; animation: fade 1s; }
.parked-time { font-size: min(24vw, 46vh); white-space: nowrap; font-weight: 200; letter-spacing: -.04em; line-height: 1; }
.parked-date { font-size: 22px; color: #777b88; margin-top: 10px; }
.parked-time small { font-size: .18em; font-weight: 400; color: #777b88; margin-left: .2em; letter-spacing: 0; }
.parked-brand { position: absolute; bottom: 28px; left: 0; right: 0; display: flex; justify-content: center; align-items: center; gap: 10px; color: #3d4050; font-size: 13px; letter-spacing: .25em; text-transform: uppercase; }
.parked-brand .gm-mark { width: 28px; }
dialog { border: 0; padding: 0; background: var(--panel); color: var(--text); border-radius: 24px; width: min(480px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0,0,0,.6); }
dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
dialog[open] { animation: rise .25s; }
#dlgForm { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
#dlgForm h2 { font-size: 20px; }
#dlgForm p { margin: 0; color: var(--mute); }
#dlgForm label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--mute); font-weight: 600; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
#toast { position: fixed; z-index: 90; left: 50%; bottom: 22px; transform: translate(-50%, 30px); opacity: 0; padding: 12px 20px; border-radius: 16px; background: var(--panel3); color: var(--text); font-weight: 600; box-shadow: var(--shadow); transition: .3s; pointer-events: none; max-width: calc(100vw - 32px); }
#toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- Pantallas chicas / celular vertical ---------- */
@media (max-width: 760px), (orientation: portrait) and (max-width: 1000px) {
  :root { --rail: 0px; --gap: 10px; }
  body { overflow: hidden; }
  .shell { flex-direction: column-reverse; padding: env(safe-area-inset-top) 0 0; }
  .view { inset: 10px 12px 0; padding: 0 0 12px; }
  .page-h > .grow { flex-basis: 100%; }
  .topcar svg { max-height: 220px; }
  .m-vol { display: none !important; }
  .music-head .art { width: 96px !important; height: 96px !important; }
  .rail { width: 100%; height: calc(64px + env(safe-area-inset-bottom)); flex-direction: row; justify-content: space-around; padding: 6px 6px env(safe-area-inset-bottom); background: var(--bg2); border-top: 1px solid var(--line); gap: 0; }
  .rail-clock, .rail-status, .rail-dock, .rail-vol, .rail-brand { display: none; }
  .rail-nav { flex-direction: row; margin: 0; width: 100%; justify-content: space-around; }
  .navbtn { width: 46px; height: 44px; }
  .navbtn[data-v="reminders"], .navbtn[data-v="map"] { display: none; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 84px; }
  .w { grid-column: span var(--mw, 2); grid-row: span var(--mh, 2); }
  .health, .tires { grid-template-columns: 1fr; }
  .tires .tire-col { flex-direction: row; } .tires .tire-col .tire { flex: 1; }
  .set { grid-template-columns: 1fr; }
  .page-h h1 { font-size: 24px; }
  .alerts { top: 4px; width: calc(100% - 24px); }
  #toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
}
@media (max-height: 720px) and (min-width: 761px) {
  .rail { gap: 3px; } .rail-nav { margin-top: 2px; gap: 2px; } .navbtn { height: 40px; }
  .rail-vol { display: none; } .rail-brand { margin-top: auto; }
  .rail-dock .appicon { width: 38px; height: 38px; font-size: 15px; } .rail-dock button:nth-child(n+3) { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
#dlgForm input[type=radio]:checked + .swatch-r { box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--text) !important; }

.map-wait { position: absolute; z-index: 450; left: 50%; top: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--panel); box-shadow: var(--shadow); font-weight: 600; font-size: 13px; }
.map-wait svg.i { width: 16px; height: 16px; color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .editing .w { animation: none !important; } .road::before { animation: none !important; } }
