/*
VOICE: taller ordenado y confiable — directo, botones grandes, nada de ruido.
IDEA: la orden de trabajo del taller: placa grande, etapas como un tablero de bahías.
PICTURE: bahías del taller con cada carro dibujado de perfil en su color real.
COLOUR and TYPE: claro y cálido, rojo del escudo para la acción, grafito para el texto; el azul solo queda en el logo. Bebas Neue (como el logo) + Inter.
LAYOUT: barra lateral blanca fija, contenido en tarjetas blancas; en tablet la barra se encoge a íconos, en teléfono va abajo.
*/
:root {
  color-scheme: light dark;
  --marino: #082D3F;
  --oscuro: light-dark(#22282C, #E9ECEE);
  --oscuro-2: light-dark(#363E43, #FFFFFF);
  --sobre-oscuro: light-dark(#FFFFFF, #121619);
  --rojo: #E52C2A;
  --rojo-2: #C81F1D;
  --crema: #FFF2D8;
  --bg: light-dark(#F6F4F0, #121619);
  --card: light-dark(#FFFFFF, #1A2024);
  --card-2: light-dark(#F9F7F3, #20272B);
  --ink: light-dark(#1C2226, #EEF0F1);
  --muted: light-dark(#6B7378, #9AA4AA);
  --line: light-dark(#E8E3DA, #2E373C);
  --ok: #2E8B57;
  --warn: #C27A12;
  --sombra: 0 1px 2px rgba(20, 20, 20, .05), 0 8px 24px rgba(20, 20, 20, .06);
  --r: 16px;
  --titulo: 'Bebas Neue', 'Oswald', Impact, sans-serif;
}
:root[data-theme=light] { color-scheme: light }
:root[data-theme=dark] { color-scheme: dark }
* { box-sizing: border-box; min-width: 0 }
html, body { height: 100% }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 'Inter', system-ui, sans-serif; overflow-x: clip; -webkit-font-smoothing: antialiased }
button, input, select, textarea { font: inherit; color: inherit }
a { color: inherit }
.ic { flex: none; display: block }
.muted { color: var(--muted) }
.num { font-variant-numeric: tabular-nums; white-space: nowrap }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh }
.lateral { background: var(--card); color: var(--ink); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 14px; gap: 6px }
.marca { display: flex; align-items: center; gap: 12px; padding: 4px 6px 16px; text-decoration: none }
.marca img { width: 54px; height: 54px; border-radius: 12px; background: #fff; padding: 3px; box-shadow: 0 2px 8px rgba(0,0,0,.08) }
.marca b { font: 26px/0.95 var(--titulo); letter-spacing: .5px; color: var(--ink); display: block }
.marca small { font-size: 12px; color: var(--muted) }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; text-decoration: none; color: var(--muted); font-weight: 500; min-height: 46px; position: relative }
.nav a:hover { background: var(--card-2); color: var(--ink) }
.nav a.activo { background: var(--rojo); color: #fff; box-shadow: 0 6px 16px rgba(229, 44, 42, .35) }
.nav a .pronto { margin-left: auto; font-size: 11px; font-style: normal; padding: 2px 8px; border-radius: 99px; background: var(--card-2); color: var(--muted); border: 1px solid var(--line) }
.nav a.activo .pronto { background: rgba(255,255,255,.2); color: #fff; border-color: transparent }
.nav .sep { height: 1px; background: var(--line); margin: 8px 6px }
.nav a .corto { display: none }
.nav-mas { display: none }
.menu-mas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px }
.menu-mas a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 88px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 600; text-align: center; padding: 10px }
.menu-mas a.activo { background: var(--rojo); color: #fff; border-color: var(--rojo) }
.lateral .pie { margin-top: auto; font-size: 12px; color: var(--muted); padding: 10px 8px 0; border-top: 1px solid var(--line) }
.lateral .pie button { width: 100%; justify-content: center; margin-bottom: 10px }

.principal { display: flex; flex-direction: column; min-height: 100vh }
.barra { display: flex; align-items: center; gap: 12px; padding: 14px clamp(16px, 3vw, 32px); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--line) }
.barra h1 { font: 34px/1 var(--titulo); letter-spacing: .5px; margin: 0; color: var(--ink) }
.barra .hoy { color: var(--muted); font-size: 14px }
.barra .esp { flex: 1 }
.quien { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px 4px 4px; cursor: pointer; min-height: 44px }
.quien .rol { font-size: 12px; color: var(--muted); display: block; line-height: 1.1 }
.quien b { font-size: 14px; display: block; line-height: 1.2 }
.vista { padding: clamp(16px, 3vw, 32px); display: grid; gap: 20px; align-content: start; max-width: 1400px; width: 100% }

/* ---------- Piezas ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sombra) }
.card > header, .sec-tit { display: flex; align-items: center; gap: 12px; padding: 16px 20px 0 }
.card h2, .sec-tit h2 { font: 24px/1 var(--titulo); letter-spacing: .4px; margin: 0 }
.card > header .esp { flex: 1 }
.pad { padding: 16px 20px 20px }

.btn { text-decoration: none; display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 12px; padding: 10px 18px; min-height: 44px; font-weight: 600; cursor: pointer; background: var(--rojo); color: #fff; transition: transform .12s, background .12s; white-space: nowrap }
.btn:hover { background: var(--rojo-2) }
.btn:active { transform: scale(.97) }
.btn.sec { background: var(--card-2); color: var(--ink); border: 1px solid var(--line) }
.btn.sec:hover { border-color: var(--muted) }
.btn.marino { background: var(--oscuro); color: var(--sobre-oscuro) }
.btn.marino:hover { background: var(--oscuro-2) }
.btn.rojo { background: var(--rojo) }
.btn.chico { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 10px }
.btn-ic { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-2); cursor: pointer; color: var(--ink) }
.btn-ic:hover { border-color: var(--muted) }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--rojo) 55%, transparent); outline-offset: 2px }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; background: var(--card-2); border: 1px solid var(--line) }
.chip .pt { width: 8px; height: 8px; border-radius: 50%; background: currentColor }
.chip.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--card)); border-color: transparent }
.chip.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, var(--card)); border-color: transparent }
.chip.mal { color: var(--rojo); background: color-mix(in srgb, var(--rojo) 12%, var(--card)); border-color: transparent }

.placa { display: inline-block; font: 20px/1 var(--titulo); letter-spacing: 1.5px; padding: 5px 10px 3px; border-radius: 6px; background: #fff; color: #0B1E28; border: 2px solid #0B1E28; box-shadow: inset 0 3px 0 #2A5DA8; white-space: nowrap }
.placa.chica { font-size: 16px; padding: 3px 7px 2px; border-width: 1.5px; box-shadow: inset 0 2px 0 #2A5DA8 }

.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; flex: none }
.avatar.g { width: 56px; height: 56px; font-size: 19px }

.barra-prog { height: 8px; border-radius: 99px; background: var(--card-2); border: 1px solid var(--line); overflow: hidden }
.barra-prog i { display: block; height: 100%; border-radius: 99px; background: var(--rojo); transition: width .5s }

.campo { display: grid; gap: 6px }
.campo label { font-size: 14px; font-weight: 600 }
.campo input, .campo select, .campo textarea, .buscador input { width: 100%; min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-2); padding: 10px 14px; font-size: 16px }
.campo input:focus, .campo select:focus, .buscador input:focus { border-color: var(--rojo); outline: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--rojo) 15%, transparent) }
.campo .ayuda { font-size: 13px; color: var(--muted) }
.campo.error input { border-color: var(--rojo) }
.form { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)) }
.form .todo { grid-column: 1 / -1 }
.buscador { position: relative; flex: 1; max-width: 420px }
.buscador .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted) }
.buscador input { padding-left: 44px }

.tabs { display: flex; gap: 6px; flex-wrap: wrap }
.tabs button { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 8px 16px; min-height: 40px; cursor: pointer; font-weight: 600 }
.tabs button.on { background: var(--oscuro); color: var(--sobre-oscuro); border-color: var(--oscuro) }

table { width: 100%; border-collapse: collapse }
th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line) }
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle }
tr:last-child td { border-bottom: 0 }
tbody tr { transition: background .12s }
tbody tr.click { cursor: pointer }
tbody tr.click:hover { background: var(--card-2) }
td.der, th.der { text-align: right }
.scroll { overflow-x: auto }

.vacio { text-align: center; padding: 40px 20px; color: var(--muted) }
.vacio b { display: block; color: var(--ink); font-size: 18px; margin-bottom: 4px }

/* ---------- Diálogos y avisos ---------- */
.capa { position: fixed; inset: 0; background: rgba(18, 22, 25, .5); display: grid; place-items: center; padding: 16px; z-index: 50; animation: aparece .18s ease }
.capa.fuera { opacity: 0; transition: opacity .18s }
.dialogo { width: 100%; background: var(--card); border-radius: 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: sube .22s ease }
.dialogo header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 8px }
.dialogo h2 { font: 28px/1 var(--titulo); letter-spacing: .4px; margin: 0 }
.dlg-cuerpo { padding: 8px 20px 16px; overflow-y: auto }
.dialogo footer { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap }
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--bg); z-index: 40; box-shadow: -20px 0 60px rgba(0, 0, 0, .25); overflow-y: auto; animation: entra .25s ease }
.panel-capa { position: fixed; inset: 0; background: rgba(18, 22, 25, .35); z-index: 39; animation: aparece .2s }
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 60 }
.toast { display: flex; align-items: center; gap: 10px; background: #22282C; color: #fff; padding: 12px 18px; border-radius: 14px; box-shadow: 0 12px 30px rgba(0, 0, 0, .3); animation: sube .2s ease; font-weight: 500 }
.toast.ok .ic { color: #7BE0A6 }
.toast.mal .ic { color: #FF8B89 }
.toast.fuera { opacity: 0; transform: translateY(8px); transition: .3s }
@keyframes aparece { from { opacity: 0 } }
@keyframes sube { from { opacity: 0; transform: translateY(14px) } }
@keyframes entra { from { transform: translateX(40px); opacity: 0 } }

.carro { display: block; width: 100%; height: auto; overflow: visible }
.carro-foto { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 12px; background: var(--card-2) }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .app { grid-template-columns: 100px minmax(0, 1fr) }
  .lateral { padding: 14px 8px; align-items: center }
  .marca { padding: 0 0 12px }
  .marca div, .nav a span, .nav a .pronto, .lateral .pie small, .lateral .pie .txt { display: none }
  .nav { width: 100% }
  .nav a { flex-direction: column; justify-content: center; gap: 4px; padding: 10px 4px; width: 100%; min-height: 64px; text-align: center }
  .nav a .corto { display: block; font-size: 12px; font-weight: 600; line-height: 1.1 }
  .lateral .pie { border: 0; padding: 0 }
  .lateral .pie button { width: 64px; padding: 0 }
}
@media (max-width: 680px) {
  .app { grid-template-columns: minmax(0, 1fr) }
  .lateral { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); z-index: 30; box-shadow: 0 -6px 20px rgba(0, 0, 0, .08); border-right: 0; border-top: 1px solid var(--line) }
  .marca, .lateral .pie, .nav .sep { display: none }
  .nav { flex-direction: row; overflow-x: auto; width: 100%; gap: 4px; scroll-snap-type: x mandatory }
  .nav { overflow: visible; justify-content: space-around }
  .nav a, .nav-mas { flex: 1 1 0; width: auto; min-width: 0; min-height: 58px; padding: 6px 2px }
  .nav.con-mas a:nth-of-type(n+5) { display: none }
  .nav-mas { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 0; background: none; border-radius: 12px; color: var(--muted); cursor: pointer }
  .nav-mas.activo { background: var(--rojo); color: #fff }
  .nav a .corto, .nav-mas .corto { display: block; font-size: 11px; font-weight: 600; line-height: 1.1 }
  .principal { padding-bottom: 80px }
  .barra h1 { font-size: 28px }
  .barra .hoy { display: none }
  .quien div { display: none }
  .form { grid-template-columns: minmax(0, 1fr) }
  .vista { gap: 14px }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important } }
