:root {
  --brand-red: #E3001B;
  --brand-red-600: #C70018;
  --brand-red-700: #A90014;
  --brand-red-900: #69000D;
  --brand-gold: #D4AF37;
  --brand-gold-2: #B68A18;
  --brand-gold-soft: #FFF6D9;
  --white: #FFFFFF;
  --paper: #F8F9FA;
  --paper-2: #F2F4F7;
  --ink: #171717;
  --ink-2: #323741;
  --muted: #667085;
  --line: #E6E8EC;
  --green: #16803C;
  --green-soft: #E8F7EE;
  --green-line: #9ED8AE;
  --amber: #B7791F;
  --amber-soft: #FFF2D2;
  --danger: #D92D20;
  --danger-soft: #FDECEC;
  --blue: #196989;
  --blue-soft: #E8F5FA;
  --purple: #7C3AED;
  --purple-soft: #F2EDFF;
  --queued: #8A5A00;
  --queued-soft: #FFF1C2;
  --shadow-sm: 0 8px 24px rgba(16, 24, 40, .08);
  --shadow-md: 0 18px 52px rgba(16, 24, 40, .14);
  --shadow-red: 0 14px 34px rgba(227, 0, 27, .28);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --focus: 0 0 0 4px rgba(227, 0, 27, .14);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { min-height: 100%; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -20%, rgba(227,0,27,.08), transparent 36%),
    linear-gradient(180deg, #fff 0%, var(--paper) 45%, #fff 100%);
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: auto -40px 70px auto;
  width: min(60vw, 520px);
  aspect-ratio: 1;
  pointer-events: none;
  background: url('../img/marranito-watermark.png') center / contain no-repeat;
  opacity: .035;
  z-index: 0;
  transform: translateZ(0);
}
body::after {
  content: "B";
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) translateZ(0);
  font-size: min(72vw, 680px);
  font-weight: 950;
  line-height: .75;
  color: rgba(0, 0, 0, .025);
  pointer-events: none;
  z-index: 0;
}

button, input, select, textarea, a { font: inherit; }
button, a, input, select, textarea, .vehicle-card, .surface-card, .menu-card, .tire-btn, tr {
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out), border-color .2s var(--ease-out), background-color .2s var(--ease-out), color .2s var(--ease-out), opacity .2s var(--ease-out);
}
button { min-height: 48px; cursor: pointer; touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
.reset-btn { border: 0; background: transparent; padding: 0; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 4px; color: var(--brand-red); font-size: .72rem; font-weight: 950; letter-spacing: .1em; text-transform: uppercase; }

.install-required {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}
.install-card { width: min(460px, 100%); padding: 28px; text-align: center; }
.install-card h1 { margin: 18px 0 10px; font-size: 1.8rem; }

.surface-card {
  position: relative;
  z-index: 1;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(230, 232, 236, .92);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}
.surface-card:hover { box-shadow: var(--shadow-md); }

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  color: var(--white);
  box-shadow: 0 18px 42px rgba(16, 24, 40, .14);
  transform: translateZ(0);
}
.safebar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 34px;
  padding: calc(6px + env(safe-area-inset-top, 0px)) clamp(16px, 4vw, 32px) 6px;
  background: linear-gradient(180deg, #272727, #141414);
}
.brandbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px clamp(16px, 4vw, 42px);
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.20), transparent 32%),
    linear-gradient(135deg, var(--brand-red) 0%, var(--brand-red-700) 70%, var(--brand-red-900) 100%);
  overflow: hidden;
}
.brandbar::before {
  content: "B";
  position: absolute;
  left: clamp(10px, 8vw, 120px);
  top: 10px;
  font-size: clamp(88px, 18vw, 260px);
  font-weight: 950;
  line-height: .75;
  color: rgba(255,255,255,.065);
  pointer-events: none;
}
.brand-title { position: relative; display: flex; align-items: center; text-align: left; }
.brand-copy small, .brand-copy strong { display: block; }
.brand-copy small { font-size: clamp(.82rem, 2vw, .95rem); font-weight: 800; opacity: .92; }
.brand-copy strong { font-size: clamp(1.05rem, 3vw, 1.35rem); font-weight: 950; line-height: 1.1; }
.brand-lockup { display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }
.brand-lockup.center { justify-content: center; }
.brand-lockup.right strong { font-size: clamp(1.1rem, 3vw, 1.8rem); font-weight: 950; letter-spacing: -.03em; }
.brand-badge {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 3px solid currentColor;
  border-radius: 50%;
  font-size: 1.55rem;
  font-weight: 950;
  line-height: 1;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.15);
}
.gold-line { height: 6px; background: linear-gradient(90deg, #9A6B00, var(--brand-gold), #F6D76B); }
.date-strip {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px clamp(16px, 4vw, 42px);
  color: var(--ink);
  background: rgba(248, 249, 250, .94);
  border-bottom: 1px solid rgba(0,0,0,.08);
}
.nav-back {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--brand-red);
  font-weight: 900;
  background: rgba(227, 0, 27, .08);
}
.nav-back:hover { background: rgba(227, 0, 27, .14); }
.date-compact { display: flex; align-items: center; gap: 8px; color: var(--ink); min-width: 0; }
.date-compact span { font-size: .78rem; color: var(--muted); font-weight: 850; }
.date-compact input { min-height: 34px; padding: 0; border: 0; background: transparent; font-weight: 800; color: var(--ink); }
.version-chip { margin-left: auto; color: var(--ink-2); font-weight: 800; white-space: nowrap; }

.network-chip {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  color: rgba(255,255,255,.92);
  background: rgba(255,255,255,.12);
  font-size: .85rem;
  font-weight: 800;
}
.sync-glyph { width: 14px; height: 14px; border: 2px solid currentColor; border-left-color: transparent; border-radius: 50%; display: inline-block; }
.network-chip.syncing .sync-glyph { animation: spin .9s linear infinite; }
.network-chip.offline { color: #FFD166; }
.network-chip.pending { color: #F6D76B; }
@keyframes spin { to { transform: rotate(360deg); } }

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 18px clamp(12px, 3vw, 32px) calc(96px + var(--safe-bottom));
}
.view { display: none; animation: viewIn .22s var(--ease-out); }
.view.active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.btn {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 950;
  white-space: nowrap;
  box-shadow: none;
  user-select: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active, .menu-card:active, .tire-btn:active { transform: scale(.98); }
.btn.primary { color: var(--white); background: linear-gradient(135deg, var(--brand-red), var(--brand-red-700)); box-shadow: var(--shadow-red); }
.btn.secondary { color: var(--brand-red); background: rgba(227,0,27,.08); border: 1px solid rgba(227,0,27,.18); }
.btn.accent { color: #402A00; background: linear-gradient(135deg, #FFE291, var(--brand-gold)); border: 1px solid rgba(180, 138, 24, .3); }
.btn.ghost { color: var(--ink-2); background: var(--white); border: 1px solid var(--line); }
.btn.install { min-height: 30px; padding: 4px 10px; color: var(--white); background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.22); }
.btn.compact { min-height: 38px; padding: 9px 12px; border-radius: 12px; }
.btn.full { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: var(--white);
  animation: spin .75s linear infinite;
}
.btn.secondary.is-loading::after, .btn.ghost.is-loading::after { color: var(--brand-red); }

.menu-hero {
  min-height: min(620px, calc(100vh - 230px));
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 26px;
  padding: clamp(24px, 7vw, 72px) clamp(16px, 5vw, 64px);
  text-align: center;
  overflow: hidden;
}
.menu-hero::before {
  content: "";
  position: absolute;
  inset: 10px;
  background: url('../img/marranito-watermark.png') center / min(72%, 560px) no-repeat;
  opacity: .055;
  pointer-events: none;
}
.menu-copy { position: relative; max-width: 760px; }
.menu-copy h1 { margin: 0; font-size: clamp(2rem, 7vw, 4.8rem); letter-spacing: -.06em; line-height: .96; }
.menu-copy p:last-child { margin: 14px auto 0; max-width: 680px; color: var(--muted); font-weight: 650; line-height: 1.45; }
.menu-grid {
  position: relative;
  width: min(680px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.menu-card {
  min-height: 116px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px;
  border: 0;
  border-radius: 20px;
  text-align: left;
  color: var(--white);
  background: linear-gradient(135deg, var(--brand-red), var(--brand-red-700));
  box-shadow: var(--shadow-red);
  will-change: transform;
}
.menu-card:hover { transform: translateY(-3px); box-shadow: 0 20px 48px rgba(227,0,27,.34); }
.menu-card.blue { background: linear-gradient(135deg, #1F6F9E, #154E77); box-shadow: 0 14px 34px rgba(31, 111, 158, .24); }
.menu-card.ghost-action { color: var(--ink); background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.menu-card strong, .menu-card small { display: block; }
.menu-card strong { font-size: clamp(1.05rem, 3vw, 1.4rem); letter-spacing: -.02em; }
.menu-card small { margin-top: 4px; opacity: .85; font-weight: 700; }
.menu-icon {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 17px;
  background: rgba(255,255,255,.18);
  position: relative;
  display: grid;
  place-items: center;
}
.ghost-action .menu-icon { background: rgba(227,0,27,.08); }
.menu-icon::before, .menu-icon::after { content: ""; position: absolute; }
.tire-icon::before { width: 32px; height: 32px; border: 6px solid currentColor; border-radius: 50%; opacity: .95; }
.tire-icon::after { width: 8px; height: 8px; background: currentColor; border-radius: 50%; }
.history-icon::before { width: 28px; height: 32px; border: 4px solid currentColor; border-radius: 5px; }
.history-icon::after { width: 20px; height: 4px; background: currentColor; top: 19px; box-shadow: 0 10px 0 currentColor; }
.download-icon::before { width: 26px; height: 26px; border: 4px solid currentColor; border-top: 0; bottom: 11px; border-radius: 0 0 8px 8px; }
.download-icon::after { width: 16px; height: 16px; border-right: 5px solid currentColor; border-bottom: 5px solid currentColor; transform: rotate(45deg); top: 13px; }
.refresh-icon::before { width: 30px; height: 30px; border: 4px solid var(--brand-red); border-left-color: transparent; border-radius: 50%; }
.refresh-icon::after { width: 10px; height: 10px; border-top: 4px solid var(--brand-red); border-right: 4px solid var(--brand-red); transform: rotate(45deg); right: 10px; top: 9px; }

.kpi-dock {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.mini-kpi {
  min-height: 92px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.mini-kpi strong, .mini-kpi b, .mini-kpi small { display: block; }
.mini-kpi strong { font-size: .87rem; color: var(--ink-2); }
.mini-kpi b { font-size: 1.35rem; letter-spacing: -.04em; }
.mini-kpi small { color: var(--muted); font-weight: 750; }
.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  flex: 0 0 auto;
  background: rgba(0,0,0,.08);
  position: relative;
}
.kpi-icon.fleet { background: var(--paper-2); }
.kpi-icon.progress, .kpi-icon.ok { background: var(--green-soft); }
.kpi-icon.low { background: var(--amber-soft); }
.kpi-icon::before { content: ""; position: absolute; inset: 12px; border: 3px solid currentColor; border-radius: 5px; color: var(--ink); }
.kpi-icon.progress::before, .kpi-icon.ok::before { color: var(--green); border-radius: 50%; }
.kpi-icon.low::before { color: var(--amber); clip-path: polygon(50% 0, 100% 100%, 0 100%); border-radius: 0; background: currentColor; border: 0; }

.sync-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 18px;
  border-left: 6px solid var(--green);
}
.sync-panel.offline { border-left-color: var(--amber); background: linear-gradient(90deg, var(--amber-soft), #fff 44%); }
.sync-panel.pending, .sync-panel.syncing { border-left-color: var(--brand-gold); background: linear-gradient(90deg, var(--brand-gold-soft), #fff 44%); }
.sync-copy { display: flex; align-items: center; gap: 14px; min-width: 0; }
.sync-copy strong { display: block; }
.sync-copy p { margin: 3px 0 0; color: var(--muted); line-height: 1.35; }
.sync-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 35%, var(--white) 0 7px, transparent 8px), linear-gradient(135deg, var(--green), #0E5F2A);
  box-shadow: 0 10px 22px rgba(22, 128, 60, .18);
}
.sync-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.queue-pill { min-height: 34px; display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 999px; color: var(--brand-red); background: rgba(227,0,27,.08); font-weight: 900; }

.toolbar, .visual-panel, .history-card, .excel-zone { padding: clamp(16px, 3vw, 24px); margin-bottom: 18px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 16px; }
.section-head h2 { margin: 0; font-size: clamp(1.3rem, 3vw, 2rem); letter-spacing: -.04em; }
.section-head p { margin: 0; }
.section-head .muted { margin-top: 5px; line-height: 1.35; }
.toolbar-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}
label span { display: block; margin-bottom: 6px; font-size: .76rem; font-weight: 950; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
input, select, textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid #D7DCE3;
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--ink);
  background: var(--white);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}
input:focus, select:focus, textarea:focus { border-color: var(--brand-red); box-shadow: var(--focus); }
input::placeholder, textarea::placeholder { color: #98A2B3; }
textarea { resize: vertical; min-height: 92px; }

.legend { display: flex; align-items: center; justify-content: flex-end; gap: 10px 14px; flex-wrap: wrap; color: var(--muted); font-size: .82rem; font-weight: 850; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.pending { background: #C9CED6; }
.dot.ok { background: var(--green); }
.dot.low { background: var(--amber); }
.dot.high { background: var(--purple); }
.dot.queued { background: var(--queued); }

.desktop-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 18px; background: var(--white); }
.pressure-table, .history-table { width: 100%; border-collapse: collapse; min-width: 980px; }
th { padding: 16px 14px; color: var(--ink); text-align: left; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; background: linear-gradient(180deg, #fff, #F7F8FA); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 16px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: #FFF9F9; }
.table-plate { font-weight: 950; font-size: 1.1rem; letter-spacing: -.03em; }
.table-meta { color: var(--muted); font-weight: 650; font-size: .82rem; }
.tire-chip {
  min-width: 84px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #F6F7F9;
  font-weight: 950;
  color: var(--ink);
}
.tire-chip.ok { background: var(--green-soft); border-color: var(--green-line); color: #0D5C2D; }
.tire-chip.low { background: var(--amber-soft); border-color: #F0C36A; color: #7C4C00; }
.tire-chip.high { background: var(--purple-soft); border-color: #D5C7FF; color: #5424B8; }
.tire-chip.queued { background: var(--queued-soft); border-color: #E7C25F; color: var(--queued); }
.tire-chip.pending { color: var(--muted); }
.status-pill, .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 9px;
  font-size: .78rem;
  font-weight: 950;
  text-transform: uppercase;
  border: 1px solid var(--line);
}
.status-pill.calibrado, .badge.OK { color: #0D5C2D; background: var(--green-soft); border-color: var(--green-line); }
.status-pill.sin-calibrar, .badge.PENDIENTE { color: #A11212; background: var(--danger-soft); border-color: #FFB4AC; }
.status-pill.local, .badge.LOCAL { color: var(--queued); background: var(--queued-soft); border-color: #E7C25F; }
.badge.BAJA { color: #7C4C00; background: var(--amber-soft); border-color: #F0C36A; }
.badge.ALTA { color: #5424B8; background: var(--purple-soft); border-color: #D5C7FF; }
.action-check { color: var(--green); font-weight: 950; font-size: 1.3rem; }
.action-calibrate { min-height: 44px; min-width: 44px; padding: 8px 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--white); color: var(--ink); font-weight: 950; }
.action-calibrate:hover { color: var(--brand-red); border-color: rgba(227,0,27,.22); }

.vehicle-grid { display: none; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.vehicle-card { padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: var(--white); box-shadow: var(--shadow-sm); overflow: hidden; }
.vehicle-card:hover { transform: translateY(-2px); }
.vehicle-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.plate { margin: 0; font-size: 1.65rem; line-height: 1; letter-spacing: -.05em; }
.meta { margin: 4px 0 0; color: var(--ink-2); font-weight: 700; }
.vehicle-progress { text-align: right; }
.vehicle-progress strong { display: block; font-size: 1.15rem; }
.vehicle-progress span { color: var(--muted); font-size: .75rem; font-weight: 900; text-transform: uppercase; }
.tire-map { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tire-btn {
  min-height: 86px;
  display: grid;
  gap: 3px;
  justify-items: start;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  text-align: left;
  background: #F8F9FA;
  color: var(--ink);
  will-change: transform;
}
.tire-btn b { font-size: .85rem; }
.tire-btn small { color: var(--muted); font-weight: 800; }
.tire-status { font-weight: 950; font-size: .98rem; }
.tire-btn.ok { background: var(--green-soft); border-color: var(--green-line); }
.tire-btn.low { background: var(--amber-soft); border-color: #F0C36A; }
.tire-btn.high { background: var(--purple-soft); border-color: #D5C7FF; }
.tire-btn.queued { background: var(--queued-soft); border-color: #E7C25F; }
.tire-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.vehicle-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.text-btn { border: 0; background: transparent; color: var(--brand-red); font-weight: 950; min-height: 42px; padding: 6px 0; }
.text-btn:hover { color: var(--brand-red-700); }

.excel-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.import-result { margin-top: 14px; padding: 12px 14px; border-radius: 14px; color: var(--blue); background: var(--blue-soft); font-weight: 800; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 18px; background: var(--white); }
.history-table th, .history-table td { white-space: nowrap; }
.empty { display: grid; gap: 4px; place-items: center; min-height: 220px; text-align: center; color: var(--muted); }
.empty strong { color: var(--ink); font-size: 1.2rem; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
}
.modal.hidden { display: none !important; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(16, 24, 40, .52); backdrop-filter: blur(6px); opacity: 0; animation: fadeIn .18s var(--ease-out) forwards; }
.modal-panel {
  position: relative;
  width: min(560px, 100%);
  max-height: min(92vh, 740px);
  overflow: auto;
  padding: 20px;
  border-radius: 24px;
  background: var(--white);
  box-shadow: 0 28px 90px rgba(16, 24, 40, .28);
  transform: translateY(12px) scale(.98);
  opacity: 0;
  animation: modalIn .2s var(--ease-out) forwards;
  will-change: transform, opacity;
}
.modal-handle { display: none; width: 44px; height: 5px; margin: 0 auto 12px; border-radius: 999px; background: #D0D5DD; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { margin: 0; font-size: 1.6rem; letter-spacing: -.04em; }
.icon-btn { width: 48px; height: 48px; display: grid; place-items: center; border: 0; border-radius: 14px; background: var(--paper-2); color: var(--ink); font-size: 1.65rem; }
.icon-btn:hover { background: rgba(227,0,27,.08); color: var(--brand-red); }
.calibration-form, .vehicle-form { display: grid; gap: 14px; }
.number-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.number-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.target-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; border-radius: 18px; color: #402A00; background: linear-gradient(135deg, var(--brand-gold-soft), #fff); border: 1px solid rgba(212, 175, 55, .42); }
.target-box span { font-size: .8rem; font-weight: 950; text-transform: uppercase; letter-spacing: .06em; }
.target-box strong { font-size: 2.2rem; letter-spacing: -.06em; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes modalIn { to { opacity: 1; transform: translateY(0) scale(1); } }

.toast {
  position: fixed;
  left: 50%;
  top: calc(14px + env(safe-area-inset-top, 0px));
  z-index: 100;
  max-width: min(540px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 999px;
  color: var(--white);
  background: var(--ink);
  box-shadow: var(--shadow-md);
  font-weight: 850;
  transform: translate(-50%, -20px) translateZ(0);
  opacity: 0;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0) translateZ(0); }
.toast.success { background: var(--green); }
.toast.error { background: var(--danger); }
.toast.offline { color: #402A00; background: var(--brand-gold); }
.toast.sync { background: var(--blue); }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(10px + var(--safe-bottom));
  z-index: 50;
  width: min(620px, calc(100vw - 20px));
  min-height: 66px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(230,232,236,.92);
  border-radius: 24px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 20px 60px rgba(16,24,40,.18);
  backdrop-filter: blur(14px);
  transform: translateX(-50%) translateZ(0);
}
.bottom-nav button {
  min-height: 50px;
  display: grid;
  place-items: center;
  gap: 3px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 950;
}
.bottom-nav button.active { color: var(--white); background: linear-gradient(135deg, var(--brand-red), var(--brand-red-700)); }
.nav-ico { width: 18px; height: 18px; border: 2px solid currentColor; border-radius: 5px; display: block; position: relative; }
.nav-ico.tire { border-radius: 50%; border-width: 4px; }
.nav-ico.list::before { content: ""; position: absolute; left: 4px; right: 4px; top: 4px; height: 2px; background: currentColor; box-shadow: 0 5px 0 currentColor; }
.nav-ico.file::before { content: ""; position: absolute; left: 4px; right: 4px; bottom: -6px; height: 2px; background: currentColor; }

@media (max-width: 1080px) {
  .toolbar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-dock { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  body::before { width: 88vw; right: -28vw; bottom: 78px; opacity: .028; }
  .safebar { min-height: 30px; padding-inline: 14px; }
  .brandbar { min-height: 66px; padding: 10px 14px; }
  .brand-lockup.right strong { font-size: 1.15rem; }
  .brand-badge { width: 36px; height: 36px; font-size: 1.3rem; border-width: 3px; }
  .date-strip { padding: 5px 14px; gap: 8px; }
  .version-chip { font-size: .82rem; }
  .app-shell { padding-inline: 10px; padding-top: 12px; }
  .sync-panel { display: none; }
  .menu-hero { min-height: calc(100vh - 270px); padding: 28px 14px; border-radius: 22px; }
  .menu-copy h1 { font-size: 2.15rem; }
  .menu-grid { grid-template-columns: 1fr; max-width: 360px; gap: 14px; }
  .menu-card { min-height: 76px; padding: 14px 16px; border-radius: 16px; }
  .menu-icon { width: 42px; height: 42px; border-radius: 14px; }
  .kpi-dock { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .mini-kpi { min-height: 74px; padding: 10px; gap: 8px; }
  .mini-kpi.warning { display: none; }
  .kpi-icon { width: 34px; height: 34px; border-radius: 12px; }
  .mini-kpi strong { font-size: .72rem; }
  .mini-kpi b { font-size: 1rem; }
  .mini-kpi small { font-size: .68rem; }
  .section-head, .compact-head { display: grid; gap: 12px; }
  .toolbar-grid { grid-template-columns: 1fr; }
  .legend { justify-content: flex-start; }
  .desktop-table-wrap { display: none; }
  .vehicle-grid { display: grid; grid-template-columns: 1fr; }
  .visual-panel, .history-card, .toolbar, .excel-zone { padding: 14px; border-radius: 20px; }
  .excel-actions { display: grid; grid-template-columns: 1fr; }
  .number-grid, .number-grid.three { grid-template-columns: 1fr; }
  .modal { align-items: end; padding: 0; }
  .modal-panel.sheet {
    width: 100%;
    max-height: 88vh;
    border-radius: 26px 26px 0 0;
    padding: 16px 16px calc(18px + var(--safe-bottom));
    transform: translateY(100%) translateZ(0);
    animation: sheetIn .24s var(--ease-out) forwards;
  }
  .modal-handle { display: block; }
  .modal-actions { grid-template-columns: 1fr; }
  .history-table { min-width: 720px; }
  @keyframes sheetIn { to { opacity: 1; transform: translateY(0) translateZ(0); } }
}
@media (max-width: 420px) {
  .brand-copy small { font-size: .78rem; }
  .brand-copy strong { font-size: .95rem; }
  .brand-lockup.right strong { display: none; }
  .kpi-dock { grid-template-columns: 1fr 1fr; }
  .mini-kpi.success { grid-column: span 2; }
  .tire-map { grid-template-columns: 1fr 1fr; }
  .plate { font-size: 1.45rem; }
  .bottom-nav { width: calc(100vw - 12px); border-radius: 20px; }
}
@media (min-width: 821px) {
  .desktop-table-wrap { display: block; }
  .vehicle-grid { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* === Ajustes V6: filtros compactos, periodo mensual y experiencia Excel .xlsx === */
.hidden-date {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  clip-path: inset(50%);
}
.clean-strip { gap: 10px; }
.period-chip {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--ink-2);
  background: var(--white);
  border: 1px solid var(--line);
  font-weight: 900;
  box-shadow: 0 2px 10px rgba(16,24,40,.05);
}
.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}
.compact-filter-toolbar .section-head { margin-bottom: 10px; }
.active-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
  padding-top: 2px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--ink-2);
  background: #FFFFFF;
  border: 1px solid var(--line);
  font-size: .82rem;
  font-weight: 850;
}
.filter-chip strong { color: var(--brand-red); }
.filter-chip.soft {
  color: var(--muted);
  background: var(--paper);
}
.filter-form { display: grid; gap: 14px; }
.filter-sheet { width: min(680px, 100%); }
.filter-actions { grid-template-columns: 1.1fr 1fr 1fr; }
.btn.danger-soft {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #FFB4AC;
}
.btn.danger-soft:hover { background: #FFE1DD; }
.pressure-table { min-width: 1120px; }
.table-meta strong { color: var(--brand-red); }
@media (max-width: 820px) {
  .toolbar-actions { justify-content: stretch; display: grid; grid-template-columns: 1fr; }
  .toolbar-actions .btn { width: 100%; }
  .active-filters { gap: 6px; }
  .filter-chip { max-width: 100%; }
  .filter-actions { grid-template-columns: 1fr; }
  .period-chip { font-size: .82rem; }
}

/* === Ajuste V6.1: mes y año separados dentro del filtro === */
.period-filter-grid { align-items: end; }
.period-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(118px, .85fr);
  gap: 12px;
}
.period-fields label { min-width: 0; }
.period-fields select { width: 100%; }
@media (max-width: 640px) {
  .period-fields { grid-template-columns: 1fr 1fr; gap: 10px; }
}
@media (max-width: 380px) {
  .period-fields { grid-template-columns: 1fr; }
}
