/* ======================================================================
   COWBOYS AC FLEET — STYLE.CSS  (dark Cowboys theme, v2)
   Generated by Michael Scott Lopez for Cowboys AC and Heating
   ----------------------------------------------------------------------
   Matches existing Cowboys AC Fleet Viewer styling:
     bg #070b16 with blue + red radial glows
     red #E63946 accent (Cowboys)
     glass panels rgba(255,255,255,.08), hairline rgba(255,255,255,.16)
     22px radius, shimmer animation, backdrop-blur
   ====================================================================== */

/* ---------- 1. RESET + TYPE FOUNDATION ---------- */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust:100%; scroll-behavior:smooth; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(1200px 800px at 15% 15%, rgba(47,111,237,.20), transparent 60%),
    radial-gradient(900px 650px at 85% 25%, rgba(230,57,70,.16), transparent 55%),
    linear-gradient(180deg, #050815, #070b16 40%, #050815);
  min-height: 100dvh;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* Animated faint grid behind everything */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 72px 72px;
  opacity: .10;
  mask-image: radial-gradient(65% 60% at 50% 30%, #000 55%, transparent 100%);
  pointer-events: none;
  animation: gridFloat 14s ease-in-out infinite;
  z-index: 0;
}
@keyframes gridFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(12px); } }

/* ---------- 2. DESIGN TOKENS ---------- */
:root {
  --bg:          #070b16;
  --panel:       rgba(255,255,255,.08);
  --panel-2:     rgba(255,255,255,.05);
  --stroke:      rgba(255,255,255,.16);
  --stroke-2:    rgba(255,255,255,.10);
  --text:        rgba(255,255,255,.92);
  --muted:       rgba(255,255,255,.70);
  --muted2:      rgba(255,255,255,.55);
  --red:         #E63946;
  --red-glow:    rgba(230,57,70,.25);
  --good:        #2bd576;
  --warn:        #ffcc00;
  --bad:         #ff5c5c;
  --info:        #4cb5ff;
  --shadow:      0 18px 60px rgba(0,0,0,.45);
  --shadow-up:   0 26px 80px rgba(0,0,0,.55);
  --radius:      22px;
  --radius-md:   16px;
  --radius-sm:   12px;
  --font:        'Geist', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial;
  --font-mono:   'Geist Mono', ui-monospace, "SF Mono", monospace;
  --ease-out:    cubic-bezier(0.32,0.72,0,1);
}

/* ---------- 3. LAYOUT SHELL ---------- */
.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 14px 70px;
  position: relative;
  z-index: 1;
}
@media (max-width: 768px) {
  .shell { padding: 14px 12px 70px; }
}

/* ---------- 4. NAV (Glass pill, top-floating) ---------- */
.nav-shell {
  position: sticky; top: 14px; z-index: 50;
  display: flex; justify-content: center;
  pointer-events: none;
  margin-bottom: 24px;
}
.nav {
  pointer-events: auto;
  display: flex; align-items: center; gap: 4px;
  padding: 6px 6px 6px 14px;
  background: rgba(7,11,22,0.78);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 14px;
}
.nav-brand {
  display: inline-flex; align-items: center; gap: 10px;
  padding-right: 8px;
  font-weight: 900; letter-spacing: .3px;
  color: var(--text);
}
.nav-brand .logo-dot {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(0,0,0,.35);
}
.nav-brand .logo-dot img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.nav-brand .accent { color: var(--red); }
.nav-divider { width: 1px; height: 18px; background: var(--stroke); margin: 0 4px; }
.nav-link {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--muted);
  transition: all .35s var(--ease-out);
  font-weight: 700;
  white-space: nowrap;
}
.nav-link:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.nav-link.active {
  background: linear-gradient(180deg, rgba(230,57,70,.95), rgba(230,57,70,.78));
  color: white;
  border: 1px solid rgba(230,57,70,.55);
  box-shadow: 0 14px 30px rgba(230,57,70,.18);
}
@media (max-width: 768px) {
  .nav { padding: 4px; gap: 2px; font-size: 12px; }
  .nav-brand { padding-right: 4px; padding-left: 6px; }
  .nav-brand .label-long { display: none; }
  .nav-link { padding: 7px 10px; }
  .nav-divider { display: none; }
}

/* ---------- 5. HEADER / EYEBROW ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--stroke-2);
  border-radius: 999px;
  font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
  backdrop-filter: blur(10px);
}
.eyebrow .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 14px rgba(43,213,118,.55);
  animation: pulse 2.4s var(--ease-out) infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(43,213,118,.4); }
  50%     { box-shadow: 0 0 0 6px rgba(43,213,118,0); }
}
.headline {
  font-family: var(--font);
  font-size: clamp(36px, 5.5vw, 64px);
  line-height: .98; letter-spacing: -.02em;
  font-weight: 900;
  color: var(--text);
  margin-top: 16px;
}
.headline em {
  font-style: normal;
  color: var(--red);
  text-shadow: 0 0 18px rgba(230,57,70,.25);
  animation: redPulse 2.6s ease-in-out infinite;
}
@keyframes redPulse {
  0%,100% { filter: drop-shadow(0 0 0 rgba(230,57,70,0)); }
  50%     { filter: drop-shadow(0 0 14px rgba(230,57,70,.35)); }
}
.subheadline {
  margin-top: 16px;
  max-width: 640px;
  color: var(--muted);
  font-size: 15px;
}

/* ---------- 6. KPI STRIP ---------- */
.kpi-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin: 28px 0 24px;
}
@media (max-width: 900px) { .kpi-row { grid-template-columns: repeat(2,1fr); } }

.kpi {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 18px 20px 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  overflow: hidden;
  transition: transform .55s var(--ease-out), box-shadow .55s var(--ease-out);
}
.kpi::before {
  content: '';
  position: absolute; inset: -40% -40% auto -40%; height: 160%;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.10), transparent 70%);
  transform: translateX(-40%) rotate(6deg);
  opacity: .35;
  pointer-events: none;
  animation: shimmer 8.5s ease-in-out infinite;
}
@keyframes shimmer {
  0%,100% { transform: translateX(-45%) rotate(6deg); }
  50%     { transform: translateX(45%) rotate(6deg); }
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-up); }
.kpi-label {
  font-size: 10px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted2); font-weight: 700;
  position: relative; z-index: 1;
}
.kpi-value {
  font-family: var(--font);
  font-size: 42px; font-weight: 900; line-height: 1; letter-spacing: -.04em;
  margin-top: 10px; color: var(--text);
  position: relative; z-index: 1;
}
.kpi-sub { margin-top: 8px; font-size: 12px; color: var(--muted2); position: relative; z-index: 1; }
.kpi.alert .kpi-value { color: var(--red); text-shadow: 0 0 18px var(--red-glow); }
.kpi.warn  .kpi-value { color: var(--warn); text-shadow: 0 0 18px rgba(255,204,0,.30); }
.kpi.good  .kpi-value { color: var(--good); text-shadow: 0 0 18px rgba(43,213,118,.30); }
.kpi.brand .kpi-value { color: var(--text); }

/* ---------- 7. SECTION HEADER ---------- */
.section-head {
  display: flex; align-items: end; justify-content: space-between;
  gap: 20px; margin: 44px 0 14px;
}
.section-head h2 {
  font-family: var(--font);
  font-size: clamp(20px, 2.4vw, 28px);
  letter-spacing: -.02em; font-weight: 900;
  color: var(--text);
}
.section-head h2 em { font-style: normal; color: var(--red); }
.section-head p { color: var(--muted); font-size: 13px; }
.section-head .actions { display: flex; gap: 8px; }

/* ---------- 8. ALERT TILES ---------- */
.alert-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}
.alert-card {
  grid-column: span 6;
  position: relative;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  overflow: hidden;
  transition: transform .55s var(--ease-out), box-shadow .55s var(--ease-out);
  display: flex; flex-direction: column; gap: 10px;
}
.alert-card::before {
  content: '';
  position: absolute; inset: -40% -40% auto -40%; height: 160%;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.06), transparent 70%);
  transform: translateX(-40%) rotate(6deg);
  pointer-events: none;
  animation: shimmer 9s ease-in-out infinite;
}
.alert-card > * { position: relative; z-index: 1; }
.alert-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-up); }
.alert-card.critical { border-color: rgba(230,57,70,.45); box-shadow: 0 18px 60px rgba(230,57,70,.20); }
.alert-card.warn     { border-color: rgba(255,204,0,.40); }
.alert-card.good     { border-color: rgba(43,213,118,.40); }
.alert-card-inner    { display: contents; }
.alert-row1 { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.alert-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 999px;
  font-size: 10px; letter-spacing: .18em; text-transform: uppercase; font-weight: 800;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.30);
}
.alert-tag.critical { background: rgba(230,57,70,.18); color: #ffb3ba; border-color: rgba(230,57,70,.55); }
.alert-tag.warn     { background: rgba(255,204,0,.16); color: #ffe066; border-color: rgba(255,204,0,.45); }
.alert-tag.info     { background: rgba(76,181,255,.16); color: #a8d8ff; border-color: rgba(76,181,255,.45); }
.alert-tag.good     { background: rgba(43,213,118,.16); color: #88e7b3; border-color: rgba(43,213,118,.45); }
.alert-unit {
  font-family: var(--font-mono);
  font-size: 13px; color: var(--muted); font-weight: 700;
}
.alert-title {
  font-size: 19px; font-weight: 800; letter-spacing: -.01em; color: var(--text);
}
.alert-meta { font-size: 13px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.alert-meta .pip { width: 3px; height: 3px; border-radius: 50%; background: var(--muted2); align-self: center; }
.alert-issues { margin-top: 4px; display: flex; flex-direction: column; gap: 4px; }
.alert-issues li {
  font-size: 13px;
  padding-left: 14px;
  position: relative;
  color: var(--text);
  list-style: none;
}
.alert-issues li::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--red);
  position: absolute; left: 0; top: 7px;
  box-shadow: 0 0 8px rgba(230,57,70,.55);
}
.alert-card.warn .alert-issues li::before { background: var(--warn); box-shadow: 0 0 8px rgba(255,204,0,.55); }
.alert-card.good .alert-issues li::before { background: var(--good); box-shadow: 0 0 8px rgba(43,213,118,.55); }

@media (max-width: 900px) { .alert-card { grid-column: span 12; } }

/* ---------- 9. TOOLBAR + FLEET GRID ---------- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin: 14px 0 18px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.toolbar input[type="text"] {
  flex: 1; min-width: 220px;
  height: 42px;
  padding: 0 16px;
  background: rgba(0,0,0,.30);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  font-size: 14px; color: var(--text);
  outline: none;
  transition: all .3s var(--ease-out);
}
.toolbar input[type="text"]::placeholder { color: rgba(255,255,255,.45); }
.toolbar input[type="text"]:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(230,57,70,.20); }
.chip-set { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 38px;
  padding: 0 14px;
  background: rgba(255,255,255,.06);
  color: var(--muted);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  font-size: 12px; font-weight: 800; letter-spacing: .02em;
  cursor: pointer;
  transition: all .14s ease;
  user-select: none;
}
.chip:hover { transform: translateY(-1px); filter: brightness(1.1); }
.chip.active {
  background: linear-gradient(180deg, rgba(230,57,70,.95), rgba(230,57,70,.78));
  color: white;
  border-color: rgba(230,57,70,.55);
  box-shadow: 0 14px 30px rgba(230,57,70,.18);
}
.chip .ct { margin-left: 4px; opacity: .8; font-weight: 600; }

.fleet-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}
.veh {
  position: relative;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  transition: transform .55s var(--ease-out), box-shadow .55s var(--ease-out);
  cursor: pointer;
  text-align: left;
  display: flex; flex-direction: column; gap: 8px;
  width: 100%;
  overflow: hidden;
  color: var(--text);
}
.veh::before {
  content: '';
  position: absolute; inset: -40% -40% auto -40%; height: 160%;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.06), transparent 70%);
  transform: translateX(-40%) rotate(6deg);
  pointer-events: none;
  opacity: .35;
  animation: shimmer 8.5s ease-in-out infinite;
}
.veh > * { position: relative; z-index: 1; }
.veh:hover { transform: translateY(-3px); box-shadow: var(--shadow-up); }
.veh.has-critical { border-color: rgba(230,57,70,.55); box-shadow: 0 18px 60px rgba(230,57,70,.20); }
.veh.has-warn     { border-color: rgba(255,204,0,.40); }
.veh.totaled { filter: grayscale(.7); opacity: .55; }
.veh-inner { display: contents; }
.veh-row1 { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.veh-unit {
  font-family: var(--font-mono);
  font-size: 28px; font-weight: 900;
  letter-spacing: -.04em; line-height: 1;
  color: var(--red);
  text-shadow: 0 0 18px rgba(230,57,70,.25);
}
.veh-status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase; font-weight: 800;
  background: rgba(255,255,255,.06); color: var(--muted2);
  border: 1px solid var(--stroke);
}
.veh-status.ok        { background: rgba(43,213,118,.16); color: #88e7b3; border-color: rgba(43,213,118,.45); }
.veh-status.parked    { background: rgba(43,213,118,.16); color: #88e7b3; border-color: rgba(43,213,118,.45); }
.veh-status.enroute   { background: rgba(76,181,255,.16); color: #a8d8ff; border-color: rgba(76,181,255,.45); }
.veh-status.offline   { background: rgba(255,255,255,.06); color: var(--muted2); }
.veh-status.unplugged { background: rgba(255,204,0,.16); color: #ffe066; border-color: rgba(255,204,0,.45); }
.veh-status.totaled   { background: rgba(230,57,70,.16); color: #ffb3ba; border-color: rgba(230,57,70,.55); }
.veh-driver { font-size: 16px; font-weight: 800; letter-spacing: -.01em; color: var(--text); }
.veh-driver .temp-tag {
  display: inline-block;
  font-size: 9px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--warn);
  background: rgba(255,204,0,.14);
  border: 1px solid rgba(255,204,0,.40);
  padding: 2px 6px; border-radius: 4px;
  margin-left: 6px; vertical-align: middle;
}
.veh-meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.veh-meta .pip { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .5; align-self: center; }
.veh-vehicle {
  font-family: var(--font-mono);
  font-size: 13px; color: var(--muted);
}
.veh-tags { margin-top: auto; padding-top: 10px; display: flex; flex-wrap: wrap; gap: 5px; }
.veh-tag {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 800; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--stroke);
}
.veh-tag.dtc-c    { background: rgba(230,57,70,.18); color: #ffb3ba; border-color: rgba(230,57,70,.55); }
.veh-tag.dtc-w    { background: rgba(255,204,0,.16); color: #ffe066; border-color: rgba(255,204,0,.45); }
.veh-tag.maint    { background: rgba(76,181,255,.16); color: #a8d8ff; border-color: rgba(76,181,255,.45); }
.veh-tag.discrep  { background: rgba(186,104,200,.16); color: #e1bee7; border-color: rgba(186,104,200,.45); }
.veh-tag.dept     { background: rgba(255,255,255,.06); color: var(--muted); }
.veh-tag.totaled  { background: rgba(0,0,0,.50); color: white; }

/* ---------- 10. FOOTER ---------- */
.footer {
  margin-top: 60px;
  padding: 24px 0 12px;
  border-top: 1px solid var(--stroke-2);
  display: flex; flex-direction: column; gap: 10px;
  font-size: 12px; color: var(--muted2);
}
.footer-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.footer .sig { font-family: var(--font); color: var(--red); font-weight: 800; text-shadow: 0 0 14px rgba(230,57,70,.25); }
.footer .ip-line {
  display: inline-flex; gap: 8px; align-items: center;
  padding: 5px 12px; border-radius: 999px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--stroke);
  font-family: var(--font-mono);
  color: var(--muted);
}
.footer .ip-line strong { color: var(--text); }
.footer .ip-line .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px rgba(43,213,118,.55); }

/* ---------- 11. BUTTONS ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px;
  padding: 0 16px 0 18px;
  background: linear-gradient(180deg, rgba(230,57,70,.95), rgba(230,57,70,.78));
  color: white;
  border-radius: 999px; border: 1px solid rgba(230,57,70,.55); cursor: pointer;
  font-size: 14px; font-weight: 800; letter-spacing: -.005em;
  transition: all .14s ease;
  box-shadow: 0 14px 30px rgba(230,57,70,.18);
  white-space: nowrap; user-select: none;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn:active { transform: scale(.98); }
.btn .icon-pill {
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255,255,255,.18);
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .35s var(--ease-out);
}
.btn:hover .icon-pill { transform: translate(2px, -1px) scale(1.06); }
.btn.ghost {
  background: rgba(255,255,255,.06);
  color: var(--text);
  border: 1px solid var(--stroke);
  box-shadow: none;
}
.btn.ghost:hover { background: rgba(255,255,255,.12); }
.btn.ghost .icon-pill { background: rgba(255,255,255,.10); color: var(--text); }
.btn.danger { background: var(--red); }

/* ---------- 12. ENTRY ANIMATION ---------- */
[data-reveal] {
  opacity: 0; transform: translateY(20px); filter: blur(4px);
  transition: opacity .8s var(--ease-out), transform .8s var(--ease-out), filter .8s var(--ease-out);
}
[data-reveal].is-visible { opacity: 1; transform: translateY(0); filter: blur(0); }

/* ---------- 13. UTILITY ---------- */
.muted { color: var(--muted2); }
.mono  { font-family: var(--font-mono); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ---------- 14. VEHICLE DETAIL PAGE ---------- */
.detail-hero {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px;
  margin-bottom: 32px;
}
@media (max-width: 900px) { .detail-hero { grid-template-columns: 1fr; gap: 14px; } }
.detail-card {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  position: relative; overflow: hidden;
}
.detail-card::before {
  content: '';
  position: absolute; inset: -40% -40% auto -40%; height: 160%;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.06), transparent 70%);
  transform: translateX(-40%) rotate(6deg);
  pointer-events: none;
  animation: shimmer 9s ease-in-out infinite;
}
.detail-card > * { position: relative; z-index: 1; }
.detail-card.dark {
  background: linear-gradient(135deg, rgba(230,57,70,.20) 0%, rgba(7,11,22,.95) 60%);
  border-color: rgba(230,57,70,.45);
  box-shadow: 0 26px 80px rgba(230,57,70,.25);
}
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; margin-top: 16px; }
.kv .label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 800; color: var(--muted2); align-self: center; }
.kv .value { font-family: var(--font-mono); font-size: 14px; color: var(--text); }
.unit-mega {
  font-family: var(--font-mono);
  font-size: clamp(80px, 14vw, 180px);
  font-weight: 900; line-height: .9; letter-spacing: -.06em;
  color: var(--text);
  text-shadow: 0 0 38px rgba(230,57,70,.40);
}
.unit-mega .hash { opacity: .5; color: var(--red); }
.dtc-list { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.dtc-row {
  display: grid; grid-template-columns: 90px 1fr auto; gap: 14px;
  padding: 12px 16px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--stroke-2);
  border-radius: var(--radius-md);
  align-items: center;
}
.dtc-row.critical { background: rgba(230,57,70,.12); border-color: rgba(230,57,70,.40); }
.dtc-row.warn     { background: rgba(255,204,0,.10); border-color: rgba(255,204,0,.35); }
.dtc-row.info     { background: rgba(76,181,255,.10); border-color: rgba(76,181,255,.35); }
.dtc-row .code { font-family: var(--font-mono); font-weight: 800; color: var(--text); }
.dtc-row .desc { font-size: 13px; color: var(--muted); }
.dtc-row .date { font-family: var(--font-mono); font-size: 11px; color: var(--muted2); }

/* ---------- 15. PHOTO UPLOAD ---------- */
.upload-shell { max-width: 720px; margin: 0 auto; }
.upload-card {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.upload-drop {
  border: 2px dashed rgba(255,255,255,.28);
  border-radius: var(--radius);
  padding: 44px 24px;
  text-align: center;
  transition: all .3s var(--ease-out);
  cursor: pointer;
  background: rgba(0,0,0,.20);
}
.upload-drop:hover { border-color: var(--red); background: rgba(230,57,70,.06); }
.upload-drop.drag { border-color: var(--red); background: rgba(230,57,70,.10); }
.upload-drop input[type="file"] { display: none; }
.upload-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 16px; }
.upload-thumb { aspect-ratio: 1; background: rgba(0,0,0,.30); border: 1px solid var(--stroke); border-radius: var(--radius-sm); overflow: hidden; position: relative; }
.upload-thumb img { width: 100%; height: 100%; object-fit: cover; }
.upload-thumb .x {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,.80); color: white;
  border: 1px solid rgba(255,255,255,.20); cursor: pointer; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
}
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.gallery a {
  display: block; aspect-ratio: 1;
  border-radius: var(--radius-md); overflow: hidden;
  background: rgba(0,0,0,.30); border: 1px solid var(--stroke);
}
.gallery a img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease-out); }
.gallery a:hover img { transform: scale(1.05); }

/* Form fields on upload page */
#unit-pick {
  width: 100%;
  margin-top: 12px;
  height: 48px;
  padding: 0 16px;
  background: rgba(0,0,0,.30) !important;
  border: 1px solid var(--stroke) !important;
  border-radius: var(--radius-md);
  font-size: 16px; font-family: var(--font-mono); color: var(--text);
  outline: none; appearance: none;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2216%22 height=%2216%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23E63946%22 stroke-width=%221.5%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><polyline points=%226 9 12 15 18 9%22/></svg>') !important;
  background-repeat: no-repeat !important;
  background-position: right 16px center !important;
}
#unit-pick option { background: #070b16; color: var(--text); }
textarea[name="note"] {
  width: 100%; margin-top: 12px;
  padding: 14px 16px;
  background: rgba(0,0,0,.30); border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  font-size: 14px; color: var(--text); resize: vertical;
  outline: none; font-family: var(--font);
}

/* ---------- 16. COMPARE TABLE ---------- */
.cmp-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  font-size: 13px;
  color: var(--text);
}
.cmp-table th, .cmp-table td {
  text-align: left; padding: 12px 14px;
  border-bottom: 1px solid var(--stroke-2);
}
.cmp-table th {
  font-size: 10px; letter-spacing: .18em; text-transform: uppercase; font-weight: 800;
  color: var(--muted2); background: rgba(0,0,0,.30);
}
.cmp-table tr:last-child td { border-bottom: 0; }
.cmp-table tr.discrep { background: rgba(186,104,200,.08); }
.cmp-cell-mismatch { color: #e1bee7; font-weight: 700; }

/* ---------- 17. EDIT DRAWER (vehicle.php) ---------- */
.edit-drawer {
  margin: 0 0 24px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  position: relative; overflow: hidden;
}
.edit-drawer::before {
  content: '';
  position: absolute; inset: -40% -40% auto -40%; height: 160%;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.06), transparent 70%);
  transform: translateX(-40%) rotate(6deg);
  pointer-events: none;
  animation: shimmer 9s ease-in-out infinite;
}
.edit-drawer > * { position: relative; z-index: 1; }
.edit-title {
  font-family: var(--font);
  font-size: 22px; font-weight: 900; letter-spacing: -.02em;
  margin-bottom: 4px;
  color: var(--text);
}
.edit-title::before { content: '✎  '; color: var(--red); }
.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 720px) { .edit-grid { grid-template-columns: 1fr; gap: 14px; } }
.edit-grid .field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.edit-grid .field.full { grid-column: 1 / -1; }
.field-label {
  font-size: 10px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted); font-weight: 800;
}
.field select, .field input[type="text"], .field textarea {
  width: 100%;
  padding: 12px 14px;
  background: rgba(0,0,0,.30);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field select { appearance: none; padding-right: 44px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2216%22 height=%2216%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23E63946%22 stroke-width=%221.5%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><polyline points=%226 9 12 15 18 9%22/></svg>');
  background-repeat: no-repeat; background-position: right 14px center;
  font-family: var(--font-mono);
}
.field select option { background: #070b16; color: var(--text); }
.field textarea { resize: vertical; min-height: 64px; }
.field select:focus, .field input[type="text"]:focus, .field textarea:focus {
  border-color: var(--red); box-shadow: 0 0 0 3px rgba(230,57,70,.20);
}

.state-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.state-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: rgba(0,0,0,.30);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px; font-weight: 700;
  color: var(--muted);
  transition: all .2s ease;
  user-select: none;
  position: relative;
}
.state-pill input { position: absolute; opacity: 0; pointer-events: none; }
.state-pill:hover { color: var(--text); border-color: rgba(255,255,255,.30); }
.state-pill.active { color: white; border-color: rgba(230,57,70,.55); background: rgba(230,57,70,.16); box-shadow: 0 0 0 2px rgba(230,57,70,.30); }
.state-pill.state-active.active   { border-color: rgba(43,213,118,.55); background: rgba(43,213,118,.16); box-shadow: 0 0 0 2px rgba(43,213,118,.30); }
.state-pill.state-garage.active   { border-color: rgba(255,204,0,.55);  background: rgba(255,204,0,.16);  box-shadow: 0 0 0 2px rgba(255,204,0,.30); }
.state-pill.state-oos.active      { border-color: rgba(230,57,70,.55);  background: rgba(230,57,70,.16);  box-shadow: 0 0 0 2px rgba(230,57,70,.30); }
.state-pill.state-totaled.active  { border-color: rgba(0,0,0,.80);      background: rgba(0,0,0,.50);      box-shadow: 0 0 0 2px rgba(255,255,255,.16); }
.state-pill::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted2);
}
.state-pill.state-active::before  { background: var(--good); }
.state-pill.state-garage::before  { background: var(--warn); }
.state-pill.state-oos::before     { background: var(--red); }
.state-pill.state-totaled::before { background: rgba(255,255,255,.5); }

.edit-actions {
  display: flex; gap: 10px; align-items: center; margin-top: 18px; flex-wrap: wrap;
}
@media (max-width: 480px) {
  .edit-actions .btn { flex: 1; justify-content: center; }
}

/* Hide drawer cleanly when closed */
.edit-drawer[hidden] { display: none; }
.edit-drawer.is-visible { animation: drawerSlideIn .5s var(--ease-out) both; }
@keyframes drawerSlideIn {
  from { opacity: 0; transform: translateY(-14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Lifecycle dim on fleet grid */
.veh.state-garage   { opacity: .92; }
.veh.state-garage::after {
  content: 'IN GARAGE'; position: absolute; top: 10px; right: 10px;
  font-size: 8px; letter-spacing: .18em; font-weight: 800; color: var(--warn);
  background: rgba(255,204,0,.16); padding: 3px 7px; border-radius: 999px;
  border: 1px solid rgba(255,204,0,.45);
  z-index: 2;
}
.veh.state-oos { filter: saturate(.4); opacity: .65; }
.veh.state-oos::after {
  content: 'OUT OF SERVICE'; position: absolute; top: 10px; right: 10px;
  font-size: 8px; letter-spacing: .18em; font-weight: 800; color: var(--red);
  background: rgba(230,57,70,.18); padding: 3px 7px; border-radius: 999px;
  border: 1px solid rgba(230,57,70,.55);
  z-index: 2;
}
.veh-tag.warn-tag { background: rgba(255,204,0,.16); color: #ffe066; border-color: rgba(255,204,0,.45); }

/* ---------- 18. RESPONSIVE POLISH (phone / tablet / desktop) ---------- */
@media (max-width: 1100px) {
  .alert-card { grid-column: span 6; }
}
@media (max-width: 768px) {
  /* Mobile-first tightening */
  .shell { padding: 12px 12px 60px; }
  .nav-shell { top: 8px; margin-bottom: 18px; }
  .nav { padding: 4px; }
  .headline { font-size: clamp(30px, 9vw, 44px); margin-top: 12px; }
  .subheadline { font-size: 14px; margin-top: 12px; }
  .kpi-row { gap: 10px; margin: 22px 0 18px; grid-template-columns: 1fr 1fr; }
  .kpi { padding: 14px 16px 12px; }
  .kpi-value { font-size: 32px; }
  .kpi-label { font-size: 9px; }
  .section-head { margin: 32px 0 12px; flex-direction: column; align-items: flex-start; gap: 8px; }
  .section-head .actions { width: 100%; }
  .section-head .actions .btn { flex: 1; justify-content: center; }
  .alert-grid { grid-template-columns: 1fr; gap: 10px; }
  .alert-card { grid-column: span 12; padding: 14px; }
  .alert-title { font-size: 16px; }
  .toolbar { padding: 8px; gap: 8px; }
  .toolbar input[type="text"] { min-width: 100%; height: 44px; }
  .chip-set { width: 100%; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .chip { flex: 0 0 auto; height: 36px; padding: 0 12px; font-size: 11px; }
  .fleet-grid { grid-template-columns: 1fr; gap: 10px; }
  .veh { padding: 14px; }
  .veh-unit { font-size: 24px; }
  .veh-driver { font-size: 15px; }
  .critical-banner { padding: 18px; }
  .critical-banner h3 { font-size: 18px; }
  .detail-card { padding: 18px; }
  .unit-mega { font-size: clamp(64px, 22vw, 120px); }
  .kv { grid-template-columns: 90px 1fr; gap: 6px 10px; }
  .dtc-row { grid-template-columns: 70px 1fr auto; padding: 10px 12px; gap: 10px; font-size: 12px; }
  .footer { margin-top: 40px; padding: 18px 0 8px; }
  .footer-row { gap: 10px; }
  .upload-card { padding: 18px; }
  .upload-drop { padding: 30px 16px; }
  .edit-drawer { padding: 16px; }
}
@media (min-width: 769px) and (max-width: 1100px) {
  /* Tablet — 2 column fleet grid feels best */
  .fleet-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-row { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .kpi-value { font-size: 36px; }
}

/* Tap target ergonomics */
.btn, .chip, .nav-link, .state-pill { min-height: 38px; }
@media (pointer: coarse) {
  .btn, .nav-link.active, .chip.active { min-height: 44px; }
  .state-pill { padding: 12px 16px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  [data-reveal] { opacity: 1; transform: none; filter: none; }
  body::before { display: none; }
}

/* iOS safe areas */
@supports (padding: max(0px)) {
  .shell { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); padding-bottom: max(60px, env(safe-area-inset-bottom)); }
}

/* ---------- 19. CRITICAL BANNER ---------- */
.critical-banner {
  background: linear-gradient(135deg, rgba(230,57,70,.30) 0%, rgba(7,11,22,.90) 100%);
  border: 1px solid rgba(230,57,70,.55);
  color: var(--text);
  border-radius: var(--radius);
  padding: 24px 28px;
  display: flex; gap: 22px; align-items: center;
  margin-bottom: 24px;
  position: relative; overflow: hidden;
  box-shadow: 0 26px 80px rgba(230,57,70,.25);
  backdrop-filter: blur(14px);
}
.critical-banner::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 80% 0%, rgba(255,255,255,.10), transparent 50%);
  pointer-events: none;
}
.critical-banner svg { flex-shrink: 0; color: var(--red); filter: drop-shadow(0 0 14px rgba(230,57,70,.55)); }
.critical-banner h3 { font-family: var(--font); font-size: 22px; font-weight: 900; letter-spacing: -.02em; }
.critical-banner p { font-size: 13px; color: var(--muted); margin-top: 4px; }
.critical-banner .badge {
  margin-left: auto;
  padding: 6px 14px;
  background: var(--red);
  color: white;
  border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase;
  box-shadow: 0 8px 22px rgba(230,57,70,.30);
}
@media (max-width: 700px) {
  .critical-banner { flex-direction: column; align-items: flex-start; gap: 12px; padding: 20px; }
  .critical-banner .badge { margin-left: 0; }
}

/* ---------- EDIT DRAWER (vehicle.php) ---------- */
.edit-drawer {
  margin: 0 0 24px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  position: relative; overflow: hidden;
}
.edit-drawer[hidden] { display: none; }
.edit-title {
  font-family: var(--font);
  font-size: 22px; font-weight: 900; letter-spacing: -.02em;
  margin-bottom: 4px; color: var(--text);
}
.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 720px) { .edit-grid { grid-template-columns: 1fr; gap: 14px; } }
.edit-grid .field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.edit-grid .field.full { grid-column: 1 / -1; }
.field-label {
  font-size: 10px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted); font-weight: 800;
}
.field select, .field input[type="text"], .field textarea {
  width: 100%; padding: 12px 14px;
  background: rgba(0,0,0,.30);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  color: var(--text); font-size: 14px;
  font-family: var(--font); outline: none;
}
.field select { appearance: none; padding-right: 44px; font-family: var(--font-mono); }
.field select option { background: #070b16; color: var(--text); }
.field textarea { resize: vertical; min-height: 64px; }
.field select:focus, .field input[type="text"]:focus, .field textarea:focus {
  border-color: var(--red); box-shadow: 0 0 0 3px rgba(230,57,70,.20);
}
.state-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.state-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: rgba(0,0,0,.30);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  cursor: pointer; font-size: 13px; font-weight: 700;
  color: var(--muted); user-select: none;
  transition: all .2s ease;
}
.state-pill input { position: absolute; opacity: 0; pointer-events: none; }
.state-pill:hover { color: var(--text); border-color: rgba(255,255,255,.30); }
.state-pill.active { color: white; border-color: rgba(230,57,70,.55); background: rgba(230,57,70,.16); }
.state-pill.state-active.active   { border-color: rgba(43,213,118,.55); background: rgba(43,213,118,.16); }
.state-pill.state-garage.active   { border-color: rgba(255,204,0,.55);  background: rgba(255,204,0,.16); }
.state-pill.state-oos.active      { border-color: rgba(230,57,70,.55);  background: rgba(230,57,70,.16); }
.state-pill.state-totaled.active  { border-color: rgba(255,255,255,.40); background: rgba(0,0,0,.50); }
.state-pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--muted2); }
.state-pill.state-active::before  { background: var(--good); }
.state-pill.state-garage::before  { background: var(--warn); }
.state-pill.state-oos::before     { background: var(--red); }
.state-pill.state-totaled::before { background: rgba(255,255,255,.5); }
.edit-actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
@media (max-width: 480px) { .edit-actions .btn { flex: 1; justify-content: center; } }

.veh.state-garage::after {
  content: 'IN GARAGE'; position: absolute; top: 10px; right: 10px;
  font-size: 8px; letter-spacing: .18em; font-weight: 800; color: var(--warn);
  background: rgba(255,204,0,.16); padding: 3px 7px; border-radius: 999px;
  border: 1px solid rgba(255,204,0,.45); z-index: 2;
}
.veh.state-oos { filter: saturate(.4); opacity: .65; }
.veh.state-oos::after {
  content: 'OUT OF SERVICE'; position: absolute; top: 10px; right: 10px;
  font-size: 8px; letter-spacing: .18em; font-weight: 800; color: #ffb3ba;
  background: rgba(230,57,70,.18); padding: 3px 7px; border-radius: 999px;
  border: 1px solid rgba(230,57,70,.55); z-index: 2;
}
.veh-tag.warn-tag { background: rgba(255,204,0,.16); color: #ffe066; border-color: rgba(255,204,0,.45); }

/* ---------- RESPONSIVE POLISH ---------- */
@media (max-width: 768px) {
  .shell { padding: 12px 12px 60px; }
  .nav-shell { top: 8px; margin-bottom: 
/* ---------- POLISH PASS ---------- */
.veh-tag.photo-progress { background: rgba(76,181,255,.12); color: #a8d8ff; border: 1px solid rgba(76,181,255,.35); }
.veh-tag.photo-progress[data-pct="100"] { background: rgba(43,213,118,.16); color: #88e7b3; border-color: rgba(43,213,118,.45); }
.veh-tag.photo-progress[data-pct="0"] { background: rgba(255,255,255,.04); color: var(--muted2); border-color: var(--stroke-2); }
.activity-feed { display: flex; flex-direction: column; gap: 8px; }
.activity-row { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; background: var(--panel-2); border: 1px solid var(--stroke-2); border-radius: 14px; text-decoration: none; color: var(--text); transition: all .25s var(--ease-out); }
.activity-row:hover { background: var(--panel); border-color: var(--stroke); transform: translateX(2px); }
.activity-icon { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; background: rgba(255,255,255,.06); border: 1px solid var(--stroke-2); }
.activity-photo .activity-icon   { background: rgba(76,181,255,.12);  color: #a8d8ff; border-color: rgba(76,181,255,.35); }
.activity-receipt .activity-icon { background: rgba(255,204,0,.14);   color: #ffe066; border-color: rgba(255,204,0,.40); }
.activity-repair .activity-icon  { background: rgba(230,57,70,.14);   color: #ffb3ba; border-color: rgba(230,57,70,.40); }
.activity-line1 { font-size: 13px; font-weight: 700; }
.activity-line2 { font-size: 11px; margin-top: 2px; }
.activity-time  { font-size: 11px; white-space: nowrap; }
@media (max-width: 600px) {
  .activity-row { grid-template-columns: 32px 1fr; padding: 10px 12px; }
  .activity-time { grid-column: 2; padding-top: 4px; font-size: 10px; }
  .activity-icon { width: 32px; height: 32px; }
}
.nav-link:hover { transform: translateY(-1px); }
