/*
VOICE: taller de luces de auto de noche — negro profundo, metal cepillado y rojo encendido.
IDEA: el tablero de un auto: números grandes que se leen de un vistazo, botones firmes.
PICTURE: el logo RS metálico arriba y las cifras del día como velocímetro.
COLOUR and TYPE: negro #0a0a0b, plata, rojo del logo; Saira (títulos y cifras) + Inter.
LAYOUT: una columna para el celular, barra de pestañas abajo, hojas que suben desde abajo.
*/
:root {
  color-scheme: dark;
  --bg: #0a0a0b; --bg2: #101012; --card: #151517; --card2: #1c1c1f; --line: #26262a; --line2: #34343a;
  --ink: #f4f4f5; --ink2: #b6b6bd; --ink3: #85858d;
  --red: #e3262e; --red2: #b71d24; --redbg: rgba(227, 38, 46, .13); --redline: rgba(227, 38, 46, .45);
  --ok: #43c271; --okbg: rgba(67, 194, 113, .13); --warn: #f2a93b; --warnbg: rgba(242, 169, 59, .14);
  --metal: linear-gradient(180deg, #fafafa 0%, #c9c9cd 45%, #8d8d93 55%, #e4e4e7 100%);
  --r: 14px; --r2: 10px;
  --f1: 'Saira', 'Inter', system-ui, sans-serif;
  --f2: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
:root[data-theme=light], :root[data-theme=dark] { color-scheme: dark; }
* { box-sizing: border-box; min-width: 0; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.45 var(--f2); overflow-x: clip; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3 { font-family: var(--f1); margin: 0; line-height: 1.1; letter-spacing: .01em; }
.num { font-family: var(--f1); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mut { color: var(--ink2); } .mut2 { color: var(--ink3); } .peq { font-size: 13px; }
.rojo { color: var(--red); } .verde { color: var(--ok); } .ambar { color: var(--warn); }
.oculto, [hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card2); font-weight: 600; cursor: pointer; text-decoration: none; transition: transform .12s, background .2s; white-space: nowrap; }
.btn:active { transform: scale(.98); }
.btn.pri { background: linear-gradient(180deg, #ec3038, #b9191f); border-color: #ff4a51; color: #fff; box-shadow: 0 6px 22px -8px rgba(227, 38, 46, .7); }
.btn.pri:disabled { opacity: .55; }
.btn.ver { background: #1f6f3f; border-color: #2c8a52; color: #fff; }
.btn.lin { background: transparent; }
.btn.chico { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.ancho { width: 100%; }
.btn svg { width: 18px; height: 18px; flex: none; }
.ico { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.ico svg { width: 20px; height: 20px; }

/* Formularios */
label.c { display: block; font-size: 13px; color: var(--ink2); margin: 14px 0 6px; font-weight: 500; }
.in, select.in, textarea.in { width: 100%; min-height: 46px; padding: 11px 13px; border-radius: 11px; border: 1px solid var(--line2); background: var(--bg2); font-size: 16px; outline: none; }
.in:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--redbg); }
textarea.in { min-height: 76px; resize: vertical; }
.fila { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.fila3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ayuda { font-size: 12.5px; color: var(--ink3); margin-top: 6px; }

/* Chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip { flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line2); background: var(--card); color: var(--ink2); font-size: 14px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chip.on { background: var(--redbg); border-color: var(--red); color: #fff; }
.chip:disabled { opacity: .4; text-decoration: line-through; }
.chip small { color: var(--ink3); font-weight: 500; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--bg2); border: 1px solid var(--line2); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--ink2); font-weight: 600; font-size: 14px; cursor: pointer; }
.seg button.on { background: var(--card2); color: #fff; box-shadow: inset 0 -2px 0 var(--red); }

/* Etiquetas */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--card2); color: var(--ink2); border: 1px solid var(--line); white-space: nowrap; }
.tag.rojo { background: var(--redbg); color: #ff6b71; border-color: var(--redline); }
.tag.verde { background: var(--okbg); color: var(--ok); border-color: rgba(67, 194, 113, .4); }
.tag.ambar { background: var(--warnbg); color: var(--warn); border-color: rgba(242, 169, 59, .4); }

/* Tarjetas */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.lista { display: grid; gap: 8px; }
.item { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; cursor: pointer; text-align: left; width: 100%; }
.item:active { background: var(--card2); }
.item .cuerpo { flex: 1; }
.item .t { font-weight: 600; line-height: 1.25; }
.item .s { font-size: 13px; color: var(--ink3); margin-top: 2px; }
.thumb { width: 54px; height: 54px; border-radius: 10px; overflow: hidden; flex: none; background: #111; border: 1px solid var(--line); }
.thumb img, .thumb svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.vacio { text-align: center; padding: 34px 16px; color: var(--ink3); border: 1px dashed var(--line2); border-radius: var(--r); }

/* Hoja que sube desde abajo */
.velo { position: fixed; inset: 0; background: rgba(0, 0, 0, .62); backdrop-filter: blur(3px); z-index: 50; opacity: 0; transition: opacity .2s; }
.velo.abierta { opacity: 1; }
.hoja { position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column; background: var(--bg2); border-top: 1px solid var(--line2); border-radius: 20px 20px 0 0; transform: translateY(100%); transition: transform .26s cubic-bezier(.2, .8, .2, 1); max-width: 640px; margin: 0 auto; }
.hoja.abierta { transform: none; }
.hoja .cab { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.hoja .cab h2 { font-size: 20px; flex: 1; }
.hoja .cont { overflow-y: auto; padding: 4px 16px 16px; overscroll-behavior: contain; }
.hoja .pie { padding: 12px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--bg2); display: flex; gap: 10px; }
.hoja .pie .btn { flex: 1; }
.hoja.alta { height: 92vh; height: 92dvh; }

/* Aviso */
#aviso { position: fixed; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translate(-50%, 20px); z-index: 80; background: #232327; border: 1px solid var(--line2); padding: 12px 16px; border-radius: 12px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
#aviso.ver { opacity: 1; transform: translate(-50%, 0); }
#aviso.mal { border-color: var(--red); background: #2a1416; }
#aviso.bien { border-color: rgba(67, 194, 113, .6); }

.cargando { display: grid; place-items: center; padding: 40px; color: var(--ink3); }
.giro { width: 26px; height: 26px; border: 3px solid var(--line2); border-top-color: var(--red); border-radius: 50%; animation: giro .8s linear infinite; }
@keyframes giro { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: 2s !important; } }
