/* ==========================================================================
   APROC · Estilos de la aplicación
   Orden: base · acceso · estructura · página · componentes · módulos · móvil
   ========================================================================== */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
::selection { background: var(--gold); color: var(--on-gold); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--mute); }
.tr { text-align: right; }
.nowrap { white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

/* ---------- Acceso ---------- */
.login {
  position: fixed; inset: 0; z-index: 50;
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 520px);
  background: var(--asphalt); color: var(--asphalt-ink);
}
.road { position: relative; overflow: hidden; perspective: 520px; }
.road-plane {
  position: absolute; left: 50%; bottom: -12%;
  width: 70%; height: 150%;
  transform: translateX(-50%) rotateX(72deg);
  transform-origin: 50% 100%;
  background:
    linear-gradient(90deg, transparent calc(50% - 3px), var(--gold) calc(50% - 3px), var(--gold) calc(50% + 3px), transparent calc(50% + 3px)) 0 0 / 100% 120px,
    linear-gradient(90deg, transparent 6%, rgba(233,234,230,.55) 6%, rgba(233,234,230,.55) calc(6% + 3px), transparent calc(6% + 3px), transparent calc(94% - 3px), rgba(233,234,230,.55) calc(94% - 3px), rgba(233,234,230,.55) 94%, transparent 94%),
    linear-gradient(#1B1C1F, #121315);
  -webkit-mask: linear-gradient(transparent, #000 35%);
          mask: linear-gradient(transparent, #000 35%);
  animation: drive 1.1s linear infinite;
}
.road-plane::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(transparent 0 60px, var(--asphalt) 60px 120px) 0 0 / 100% 120px;
  -webkit-mask: linear-gradient(90deg, transparent calc(50% - 4px), #000 calc(50% - 4px), #000 calc(50% + 4px), transparent calc(50% + 4px));
          mask: linear-gradient(90deg, transparent calc(50% - 4px), #000 calc(50% - 4px), #000 calc(50% + 4px), transparent calc(50% + 4px));
  animation: inherit;
}
@keyframes drive { to { background-position: 0 120px, 0 0, 0 0; } }
.road::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(60% 40% at 50% 100%, rgba(230,195,74,.18), transparent 70%),
              linear-gradient(var(--asphalt) 0%, transparent 45%);
  pointer-events: none;
}
.road-copy { position: absolute; left: clamp(24px, 5vw, 64px); top: clamp(24px, 6vh, 64px); right: 24px; z-index: 2; display: flex; flex-direction: column; gap: 14px; max-width: 560px; }
.road-copy img { width: 64px; height: 64px; border-radius: 12px; mix-blend-mode: lighten; }
.road-copy h1 { margin: 0; font: 800 clamp(34px, 4.4vw, 58px)/.98 var(--font); letter-spacing: -.035em; }
.road-copy h1 span { color: var(--gold); }
.road-copy p { margin: 0; color: var(--asphalt-mute); font-size: 15px; max-width: 46ch; }
.login-panel {
  position: relative; display: flex; flex-direction: column; justify-content: center; gap: 22px;
  padding: 40px max(24px, env(safe-area-inset-right)) 40px clamp(24px, 4vw, 48px);
  background: var(--asphalt-2); border-left: 1px solid var(--asphalt-line);
}
.login-panel h2 { margin: 0; font: 700 22px/1.2 var(--font); letter-spacing: -.01em; }
.login-panel .muted { color: var(--asphalt-mute); }
.users { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.user-card {
  display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; text-align: left;
  border: 1px solid var(--asphalt-line); border-radius: var(--r); background: var(--asphalt-3); color: var(--asphalt-ink);
  transition: border-color .2s, transform .25s var(--spring);
}
.user-card:hover { border-color: #4A4C52; transform: translateY(-2px); }
.user-card[aria-pressed="true"] { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.user-card b { font-size: 16px; font-weight: 700; }
.user-card span { font: 500 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--asphalt-mute); }
.pin-row { display: flex; gap: 10px; }
.pin-row input {
  width: 56px; height: 64px; text-align: center; font: 600 26px var(--mono);
  border-radius: var(--r); border: 1px solid var(--asphalt-line); background: var(--asphalt); color: var(--asphalt-ink);
}
.pin-row input:focus { border-color: var(--gold); outline: none; }
.login-err { min-height: 20px; color: #F06B60; font-size: 13px; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.demo-note { padding: 12px 14px; border-radius: var(--r); border: 1px dashed var(--asphalt-line); font-size: 12px; color: var(--asphalt-mute); line-height: 1.6; }
.demo-note code { font-family: var(--mono); color: var(--asphalt-ink); }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100%; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; gap: 18px; padding: 18px 14px 14px;
  background: var(--asphalt); color: var(--asphalt-ink); z-index: 20;
}
.side::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 2px;
  background: linear-gradient(var(--gold) 0 18px, transparent 18px 38px) 0 var(--lane, 0px) / 2px 38px repeat-y;
  opacity: .55; transition: background-position .9s var(--ease);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 10px; }
.brand img { width: 40px; height: 40px; border-radius: 9px; mix-blend-mode: lighten; flex: none; }
.brand b { display: block; font: 800 17px/1 var(--font); letter-spacing: .12em; }
.brand span { font: 500 10px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--asphalt-mute); }
.nav { display: flex; flex-direction: column; gap: 16px; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-label { padding: 0 10px 6px; font: 500 10px var(--mono); letter-spacing: .16em; text-transform: uppercase; color: #6E7177; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px; min-height: 36px; padding: 0 10px;
  border: 0; border-radius: 8px; background: none; color: #B4B7BC; text-decoration: none; font-size: 13.5px; font-weight: 500;
  transition: background .2s, color .2s;
}
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav-item:hover { background: var(--asphalt-2); color: var(--asphalt-ink); }
.nav-item[aria-current="page"] { background: var(--asphalt-3); color: #fff; }
.nav-item[aria-current="page"] svg { color: var(--gold); opacity: 1; }
.nav-item[aria-current="page"]::before {
  content: ""; position: absolute; left: -14px; top: 50%; width: 8px; height: 14px; margin-top: -7px;
  background: var(--gold); clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.nav-item .count { margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; background: var(--crit); color: #fff; font: 600 11px/18px var(--mono); text-align: center; }
.side-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r); border: 1px solid var(--asphalt-line); }
.side-user .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.side-user .who b { font-size: 13px; }
.side-user .who span { font: 500 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--asphalt-mute); }
.side-user button { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--asphalt-mute); }
.side-user button:hover { background: var(--asphalt-3); color: #fff; }
.av { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; font: 700 14px var(--font); color: var(--on-gold); background: var(--gold); }
.av.sm { width: 26px; height: 26px; font-size: 11px; }
.av.legal { background: #9DB4E8; } .av.taller { background: #F0A05A; } .av.propietario { background: #C9B8E8; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 10px;
  min-height: 60px; padding: 10px clamp(16px, 2.6vw, 32px);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar .menu-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; margin-right: auto; font: 500 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--mute); }
.crumbs b { color: var(--ink); font-weight: 600; }
.search-btn {
  display: flex; align-items: center; gap: 10px; height: 38px; min-width: 280px; padding: 0 8px 0 12px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--mute); font-size: 13px;
}
.search-btn:hover { border-color: var(--line-2); }
.search-btn kbd { margin-left: auto; padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; font: 500 11px var(--mono); }
.icon-btn {
  position: relative; width: 38px; height: 38px; flex: none; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink-2);
}
.icon-btn:hover { border-color: var(--line-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--crit); color: #fff; font: 600 10px/16px var(--mono); }
.view { flex: 1; padding: 24px clamp(16px, 2.6vw, 32px) 64px; }

/* ---------- Página ---------- */
.page { display: flex; flex-direction: column; gap: 20px; animation: enter .45s var(--ease) both; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; }
.page-head .eyebrow { margin: 0 0 6px; }
.title { margin: 0; font: 800 clamp(26px, 3vw, 36px)/1.05 var(--font); letter-spacing: -.03em; text-wrap: balance; }
.title em { font-style: normal; color: var(--gold-ink); }
.lede { margin: 6px 0 0; color: var(--mute); max-width: 70ch; }
.eyebrow { font: 500 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.g-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.g-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); align-items: start; }
.card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow); }
.card-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 0; }
.card-title { margin: 0; font: 700 15px/1.3 var(--font); letter-spacing: -.005em; }
.card-b { padding: 16px 18px 18px; }
.card-b.flush { padding: 8px 0 0; }
.lane-rule { height: 2px; border: 0; margin: 0; background: linear-gradient(90deg, var(--line-2) 0 14px, transparent 14px 26px) 0 0 / 26px 2px repeat-x; }

/* ---------- Indicadores ---------- */
.kpi { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; overflow: hidden; }
.kpi-label { font: 500 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--mute); }
.kpi-value { font: 700 30px/1.05 var(--mono); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 14px; font-weight: 500; color: var(--mute); margin-left: 4px; }
.kpi-sub { font-size: 12.5px; color: var(--mute); }
.kpi-spark { position: absolute; right: 14px; bottom: 14px; width: 96px; height: 32px; }
.trend { display: inline-flex; align-items: center; gap: 4px; font: 600 12px var(--mono); }
.trend.up { color: var(--ok); } .trend.down { color: var(--crit); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); color: var(--ink);
  font-size: 13.5px; font-weight: 600; white-space: nowrap; text-decoration: none;
  transition: background .2s, border-color .2s, transform .15s;
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.btn-primary:hover { background: #F0D06A; border-color: #F0D06A; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn-dark:hover { opacity: .9; border-color: var(--ink); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-danger { color: var(--crit); }
.btn-danger:hover { border-color: var(--crit); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-icon { width: 34px; padding: 0; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ---------- Señales y placas ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px;
  border-radius: 5px; font: 600 11px var(--mono); letter-spacing: .04em; white-space: nowrap;
  background: var(--surface-3); color: var(--ink-2);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 1px; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.crit { background: var(--crit-soft); color: var(--crit); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.gold { background: var(--gold-soft); color: var(--gold-ink); }
.pill.plain::before { display: none; }
.plate {
  display: inline-flex; flex-direction: column; align-items: center; flex: none; white-space: nowrap;
  padding: 2px 8px 3px; border-radius: 4px; background: #F2EFE6; color: #151410;
  box-shadow: inset 0 0 0 1.2px #151410, inset 0 0 0 2.6px #F2EFE6;
}
.plate small { font: 600 6px/1.2 var(--font); letter-spacing: .34em; color: #5F5A4D; }
.plate b { font: 600 14px/1 var(--mono); letter-spacing: .03em; }
.plate.lg { padding: 5px 14px 7px; border-radius: 7px; box-shadow: inset 0 0 0 2px #151410, inset 0 0 0 4px #F2EFE6, 0 10px 24px -14px rgba(0,0,0,.6); }
.plate.lg small { font-size: 8px; }
.plate.lg b { font-size: 30px; }

/* ---------- Avisos de alerta ---------- */
.alert { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.alert .ic { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; }
.alert .ic svg { width: 16px; height: 16px; }
.alert .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.alert .tx b { font-size: 13.5px; font-weight: 600; }
.alert .tx span { font-size: 12.5px; color: var(--mute); }
.alert > svg { width: 16px; height: 16px; flex: none; color: var(--mute); }
.alert.crit .ic { background: var(--crit-soft); color: var(--crit); }
.alert.warn .ic { background: var(--warn-soft); color: var(--warn); }
.alert.info .ic { background: var(--info-soft); color: var(--info); }
.alert.ok .ic { background: var(--ok-soft); color: var(--ok); }
.hazard {
  position: relative; padding-left: 22px; overflow: hidden;
}
.hazard::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 8px;
  background: repeating-linear-gradient(-45deg, var(--gold) 0 6px, #131416 6px 12px);
}

/* ---------- Tablas ---------- */
.tbl-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.tbl-tools .grow { flex: 1 1 220px; min-width: 0; }
.input-search { position: relative; }
.input-search svg { position: absolute; left: 11px; top: 50%; width: 15px; height: 15px; margin-top: -7.5px; color: var(--mute); pointer-events: none; }
.input-search input { padding-left: 34px; }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  position: sticky; top: 0; padding: 10px 14px; text-align: left; white-space: nowrap;
  font: 600 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--mute);
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.tbl th button { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; }
.tbl th button:hover { color: var(--ink); }
.tbl th[aria-sort] button { color: var(--ink); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.tbl th.num { text-align: right; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .strong { font-weight: 600; }
.tbl .sub { display: block; font-size: 12px; color: var(--mute); }
.tbl-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 18px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--mute); }
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 20px; text-align: center; color: var(--mute); }
.empty svg { width: 28px; height: 28px; opacity: .6; }
.empty b { color: var(--ink); font-weight: 600; }

/* ---------- Formularios ---------- */
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--surface); color: var(--ink); font-size: 13.5px; transition: border-color .2s, box-shadow .2s;
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2363666B' stroke-width='2'><path d='m6 9 6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 11px center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 35%, transparent); }
.input.sm, .select.sm { height: 32px; font-size: 12.5px; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label, .field .lbl { font: 600 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--mute); }
.field .err { font-size: 12px; color: var(--crit); }
.field.invalid .input, .field.invalid .select, .field.invalid .textarea { border-color: var(--crit); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--surface-3); }
.seg button { height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: none; color: var(--mute); font-size: 12.5px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 30px; padding: 0 12px; border-radius: 15px; border: 1px solid var(--line-2); background: var(--surface); font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; }
.check input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--ink); flex: none; }

/* ---------- Capas: panel lateral, ventana, confirmación ---------- */
.layer { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: flex-end; }
.layer.center { justify-content: center; align-items: center; padding: 16px; }
.scrim { position: absolute; inset: 0; background: var(--scrim); animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: relative; width: min(560px, 100%); height: 100%; display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--overlay);
  animation: slide .38s var(--ease);
}
.drawer.wide { width: min(760px, 100%); }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.drawer-h { display: flex; align-items: flex-start; gap: 14px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.drawer-h .t { flex: 1; min-width: 0; }
.drawer-h h2 { margin: 2px 0 0; font: 800 22px/1.15 var(--font); letter-spacing: -.02em; }
.drawer-b { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 18px; }
.drawer-f { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 14px 22px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface-2); }
.modal {
  position: relative; width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--overlay);
  animation: pop .3s var(--spring);
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal .drawer-h { border-radius: var(--r-l) var(--r-l) 0 0; }
.modal .drawer-f { border-radius: 0 0 var(--r-l) var(--r-l); }
.dl { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.dl dt, .dl dd { margin: 0; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.dl dt { font: 600 10.5px/1.9 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); background: var(--surface-2); }
.dl dt:nth-last-of-type(1), .dl dd:last-child { border-bottom: 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { position: relative; height: 40px; padding: 0 14px; border: 0; background: none; color: var(--mute); font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--gold); }

/* ---------- Notificaciones flotantes y paleta ---------- */
.toasts { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 400px; padding: 12px 14px;
  border-radius: var(--r); background: var(--asphalt); color: var(--asphalt-ink); font-size: 13.5px;
  box-shadow: var(--overlay); animation: toastIn .4s var(--spring); pointer-events: auto;
}
.toast::before { content: ""; flex: none; width: 4px; align-self: stretch; border-radius: 2px; background: var(--gold); }
.toast.crit::before { background: #F06B60; }
.toast.ok::before { background: #52C485; }
.toast.bye { animation: toastOut .3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }
.palette { position: fixed; inset: 0; z-index: 80; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.pal { position: relative; width: min(620px, 100%); border-radius: var(--r-l); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--overlay); overflow: hidden; animation: pop .25s var(--spring); }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.pal-in svg { width: 18px; height: 18px; color: var(--mute); flex: none; }
.pal-in input { flex: 1; height: 54px; border: 0; background: none; font-size: 15px; outline: none; }
.pal ul { list-style: none; margin: 0; padding: 6px; max-height: 54vh; overflow-y: auto; }
.pal li button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-radius: 8px; background: none; text-align: left; font-size: 13.5px; }
.pal li button svg { width: 16px; height: 16px; color: var(--mute); flex: none; }
.pal li button .k { margin-left: auto; font: 500 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.pal li button[aria-selected="true"] { background: var(--surface-2); }
.pal-head { padding: 8px 12px 4px; font: 600 10px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); }

/* ---------- Gráficos ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .ax { font: 500 10.5px var(--mono); fill: var(--mute); }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart .bar { transition: opacity .2s; transform-box: fill-box; transform-origin: 50% 100%; animation: growY .8s var(--ease) backwards; }
.chart .bar:hover { opacity: .8; }
@keyframes growY { from { transform: scaleY(0); } }
.chart .line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: drawLine 1.2s var(--ease) forwards; }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
.chart .area { animation: fade 1.2s ease; }
.chart-tip {
  position: absolute; top: 0; left: 0; z-index: 3; padding: 7px 10px; border-radius: 7px; pointer-events: none;
  background: var(--asphalt); color: var(--asphalt-ink); font-size: 12px; white-space: nowrap; box-shadow: var(--overlay);
  opacity: 0; transition: opacity .15s;
}
.chart-tip b { display: block; font: 600 13px var(--mono); }
.chart-tip.show { opacity: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 2px; vertical-align: -1px; }
.ring { transform: rotate(-90deg); }
.ring .arc { transition: stroke-dashoffset 1.3s var(--ease); }
.meter { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 3px; transform-origin: left; animation: growX 1s var(--ease) backwards; }
@keyframes growX { from { transform: scaleX(0); } }

/* ---------- Panel ---------- */
.hello { position: relative; overflow: hidden; padding: 22px 24px; background: var(--asphalt); color: var(--asphalt-ink); border-color: var(--asphalt-line); }
.hello::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, var(--gold) 0 26px, transparent 26px 46px) 0 0 / 46px 3px repeat-x;
  animation: laneMove 1.6s linear infinite;
}
@keyframes laneMove { to { background-position: -46px 0; } }
.hello h1 { margin: 0; font: 800 clamp(24px, 2.6vw, 32px)/1.1 var(--font); letter-spacing: -.03em; }
.hello h1 span { color: var(--gold); }
.hello p { margin: 8px 0 0; color: var(--asphalt-mute); max-width: 68ch; }
.hello .stats { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 18px; }
.hello .stats div { display: flex; flex-direction: column; gap: 2px; }
.hello .stats b { font: 700 22px var(--mono); }
.hello .stats span { font: 500 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--asphalt-mute); }
.fleet-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.unit {
  display: flex; flex-direction: column; gap: 8px; padding: 12px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); transition: border-color .2s, transform .25s var(--spring);
}
.unit:hover { border-color: var(--line-2); transform: translateY(-2px); }
.unit .r { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.unit .n { font-size: 13px; font-weight: 600; }
.sig { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.sig.ok { background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: beacon 2.2s ease-out infinite; }
.sig.warn { background: var(--warn); }
.sig.crit { background: var(--crit); }
@keyframes beacon { 70% { box-shadow: 0 0 0 7px transparent; } }
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-top: 1px solid var(--line); }
.li:first-child { border-top: 0; }
.li .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.li .tx b { font-weight: 600; font-size: 13.5px; }
.li .tx span { font-size: 12.5px; color: var(--mute); }
.li .time { flex: none; width: 50px; font: 600 13px var(--mono); color: var(--gold-ink); }

/* ---------- Flota y garaje 3D ---------- */
.garage { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 16px; }
.stage {
  position: relative; height: 470px; overflow: hidden; border-radius: var(--r-l); border: 1px solid var(--asphalt-line);
  background: radial-gradient(110% 90% at 50% 110%, #24211A 0%, #121315 55%, #0D0E10 100%); color: var(--asphalt-ink);
}
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: pan-y; }
.stage canvas:active { cursor: grabbing; }
.stage-hud { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; gap: 12px; padding: 18px 20px; pointer-events: none; }
.stage-hud .who b { display: block; font: 800 26px/1.05 var(--font); letter-spacing: -.02em; }
.stage-hud .eyebrow, .stage-foot .eyebrow { color: var(--asphalt-mute); }
.stage-foot { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; padding: 18px 20px; pointer-events: none; background: linear-gradient(transparent, rgba(13,14,16,.85)); }
.tele { display: flex; flex-wrap: wrap; gap: 24px; }
.tele div { display: flex; flex-direction: column; gap: 2px; }
.tele b { font: 600 24px/1 var(--mono); }
.odo { display: inline-flex; height: 1em; line-height: 1; overflow: hidden; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.odo .col { display: flex; flex-direction: column; transition: transform 1.6s cubic-bezier(.12, .82, .18, 1); }
.odo .col span, .odo .sep { display: block; height: 1em; }
.hint { font: 500 11px var(--mono); letter-spacing: .06em; color: var(--asphalt-mute); }
.hot { position: absolute; left: 0; top: 0; z-index: 3; width: 26px; height: 26px; margin: -13px 0 0 -13px; padding: 0; display: grid; place-items: center; border-radius: 50%; border: 1.5px solid var(--gold); background: rgba(13,14,16,.6); transition: opacity .25s; }
.hot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.hot::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 1px solid var(--gold); animation: halo 2.4s ease-out infinite; }
@keyframes halo { to { transform: scale(2); opacity: 0; } }
.hot.far { opacity: .15; pointer-events: none; }
.hot[aria-expanded="true"] { background: var(--gold); }
.hot[aria-expanded="true"]::before { background: var(--on-gold); }
.hot-card { position: absolute; left: 0; top: 0; z-index: 4; width: 240px; padding: 12px 14px; border-radius: var(--r); background: rgba(24,25,28,.94); border: 1px solid var(--asphalt-line); color: var(--asphalt-ink); opacity: 0; pointer-events: none; transition: opacity .2s; }
.hot-card.show { opacity: 1; pointer-events: auto; }
.hot-card b { display: block; margin: 2px 0 4px; font-size: 14px; }
.hot-card p { margin: 0; font-size: 12.5px; color: #B9BCC1; line-height: 1.5; }
.no3d { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--asphalt-mute); font-size: 13px; text-align: center; padding: 20px; }
.stage.sin3d .no3d { display: flex; }
.gauges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.gauge { display: flex; align-items: center; gap: 10px; min-width: 0; }
.gauge div { display: flex; flex-direction: column; min-width: 0; }
.gauge small { font-size: 11.5px; color: var(--mute); }
.gauge b { font: 600 16px/1.3 var(--mono); }

/* ---------- Rastreo ---------- */
.track { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; }
.map { position: relative; height: 600px; border-radius: var(--r-l); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.map .leaflet-container { width: 100%; height: 100%; background: var(--surface-2); font-family: var(--font); }
.map-pin { display: flex; flex-direction: column; align-items: center; gap: 3px; transform: translate(-50%, -100%); }
.map-pin .plate { box-shadow: inset 0 0 0 1.2px #151410, inset 0 0 0 2.6px #F2EFE6, 0 6px 14px -6px rgba(0,0,0,.6); }
.map-pin i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 4px rgba(230,195,74,.35); }
.map-badge { position: absolute; left: 12px; top: 12px; z-index: 500; padding: 8px 12px; border-radius: 8px; background: var(--asphalt); color: var(--asphalt-ink); font: 500 11px var(--mono); letter-spacing: .06em; }
.map-badge i { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--gold); animation: blink 1.2s steps(1) infinite; }
@keyframes blink { 50% { opacity: .2; } }
.veh-list { display: flex; flex-direction: column; max-height: 600px; overflow-y: auto; }
.veh { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; width: 100%; }
.veh:first-child { border-top: 0; }
.veh:hover, .veh[aria-pressed="true"] { background: var(--surface-2); }
.veh .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.veh .tx span { font-size: 12px; color: var(--mute); }
.veh .spd { font: 600 13px var(--mono); text-align: right; }

/* ---------- Taller ---------- */
.roadmap { position: relative; padding: 10px 0 4px; overflow-x: auto; }
.roadmap-in { position: relative; min-width: 640px; height: 130px; }
.roadmap .asph { position: absolute; left: 0; right: 0; top: 78px; height: 12px; border-radius: 6px; background: var(--surface-3); }
.roadmap .paint { position: absolute; left: 0; right: 0; top: 83px; height: 2px; background: linear-gradient(90deg, var(--gold) 0 16px, transparent 16px 30px) 0 0 / 30px 2px repeat-x; transform-origin: left; animation: growX 1.6s var(--ease) backwards; }
.roadmap .car { position: absolute; top: 58px; left: 0; width: 44px; color: var(--ink); transition: transform 1s var(--ease); }
.mile { position: absolute; top: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 96px; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); }
.mile b { font: 700 16px/1 var(--mono); }
.mile span { font-size: 11.5px; color: var(--mute); white-space: nowrap; }
.mile[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--surface); }
.mile[aria-pressed="true"] span { color: inherit; opacity: .75; }

/* ---------- Legal (tablero) ---------- */
.kanban { display: grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); gap: 14px; overflow-x: auto; }
.kcol { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 12px; border-radius: var(--r-l); background: var(--surface-2); border: 1px solid var(--line); min-height: 200px; }
.kcol.over { border-color: var(--gold); background: color-mix(in srgb, var(--gold-soft) 45%, var(--surface-2)); }
.kcol-h { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 4px; }
.kcard { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); cursor: grab; text-align: left; width: 100%; }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .4; }
.kcard b { font-size: 13.5px; font-weight: 600; }
.kcard .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--mute); }
.stamp { display: inline-block; padding: 4px 8px; border: 2px solid currentColor; border-radius: 4px; font: 700 12px var(--mono); letter-spacing: .14em; transform: rotate(-6deg); animation: stamp .5s var(--spring) both; }
@keyframes stamp { from { opacity: 0; transform: scale(2) rotate(-2deg); } }

/* ---------- Agenda ---------- */
.cal { display: grid; grid-template-columns: 56px repeat(7, minmax(110px, 1fr)); min-width: 840px; }
.cal-wrap { overflow-x: auto; }
.cal-h { position: sticky; top: 0; z-index: 1; padding: 10px 8px; border-bottom: 1px solid var(--line); background: var(--surface-2); font: 600 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); text-align: center; }
.cal-h.today { color: var(--ink); box-shadow: inset 0 -2px 0 var(--gold); }
.cal-t { height: 52px; padding: 2px 8px 0 0; border-right: 1px solid var(--line); font: 500 10.5px var(--mono); color: var(--mute); text-align: right; }
.cal-c { position: relative; height: 52px; border-bottom: 1px dashed var(--line); border-right: 1px solid var(--line); }
.cal-ev { position: absolute; left: 4px; right: 4px; z-index: 2; padding: 5px 7px; border-radius: 6px; border: 0; text-align: left; font-size: 11.5px; line-height: 1.3; overflow: hidden; background: var(--info-soft); color: var(--ink); }
.cal-ev b { display: block; font-weight: 600; }
.cal-ev.taller { background: var(--warn-soft); }
.cal-ev.legal { background: color-mix(in srgb, #9DB4E8 30%, var(--surface)); }
.cal-ev.gerencia { background: var(--gold-soft); }
.cal-now { position: absolute; left: 0; right: 0; z-index: 3; border-top: 2px solid var(--crit); }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--crit); }

/* ---------- Avisos ---------- */
.reads { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.read { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line); font-size: 13px; transition: border-color .3s, background .3s; }
.read .st { font: 600 10.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
.read.leido { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.read.leido .st { color: var(--ok); }
.read.pop { animation: pop .35s var(--spring); }

/* ---------- Bóveda ---------- */
.vault-gate { display: grid; place-items: center; padding: 44px 20px; text-align: center; }
.vault-gate .dial { width: 150px; height: 150px; margin-bottom: 18px; }
.vault-gate .spin { transform-origin: 75px 75px; animation: spin 26s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.vault-gate form { display: flex; flex-direction: column; gap: 12px; width: min(340px, 100%); }
.secret { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; min-width: 150px; }
.secret code { font: 600 15px var(--mono); letter-spacing: .06em; }
.timer { width: 100%; height: 2px; border-radius: 1px; background: var(--surface-3); overflow: hidden; }
.timer i { display: block; height: 100%; background: var(--gold); transform-origin: left; animation: countdown 30s linear forwards; }
@keyframes countdown { to { transform: scaleX(0); } }
.lock-ic .shackle { transform-box: fill-box; transform-origin: 100% 100%; transition: transform .5s var(--spring); }
.open .lock-ic .shackle { transform: translateY(-2px) rotate(-24deg); }
.open .lock-ic { color: var(--gold-ink); }

/* ---------- Reportes ---------- */
.report { padding: 28px; }
.report-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding-bottom: 18px; border-bottom: 2px solid var(--ink); }
.report-h img { width: 56px; height: 56px; border-radius: 10px; background: #000; }
.report h3 { margin: 22px 0 10px; font: 700 14px var(--font); letter-spacing: .02em; text-transform: uppercase; }

/* ---------- Móvil y tableta ---------- */
@media (max-width: 1100px) {
  .garage, .track, .g-main { grid-template-columns: minmax(0, 1fr); }
  .veh-list { max-height: none; }
  .map { height: 460px; }
}
@media (max-width: 860px) {
  .login { grid-template-columns: minmax(0, 1fr); grid-template-rows: 40vh auto; overflow-y: auto; }
  .login-panel { border-left: 0; border-top: 1px solid var(--asphalt-line); justify-content: flex-start; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(290px, 86vw); transform: translateX(-102%); transition: transform .35s var(--ease); box-shadow: var(--overlay); }
  .app.nav-open .side { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 19; background: var(--scrim); }
  .topbar .menu-btn { display: grid; }
  .search-btn { min-width: 0; width: 38px; padding: 0; justify-content: center; }
  .search-btn span, .search-btn kbd { display: none; }
  .form { grid-template-columns: minmax(0, 1fr); }
  .stage { height: 380px; }
  .kanban { grid-template-columns: repeat(3, minmax(250px, 80vw)); }
  .dl { grid-template-columns: minmax(0, 1fr); }
  .dl dt { border-bottom: 0; padding-bottom: 0; background: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
