﻿/* Norte Telemetria — Design Tokens */

:root {
  /* ── Color: Light theme ──────────────────────────── */
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f6f6f7;
  --surface-3: #f0f0f2;
  --hover: #f4f4f5;
  --border: #e8e8eb;
  --border-strong: #d4d4d8;
  --divider: #efeff2;

  --text: #09090b;
  --text-2: #52525b;
  --text-3: #71717a;
  --text-4: #a1a1aa;

  /* Norte brand */
  --brand-navy: #141936;
  --brand-navy-2: #1d2247;
  --brand-navy-3: #252b54;
  --brand-blue: #4f7fab;
  --brand-blue-2: #6a98c4;
  --brand-blue-soft: #eaf1f8;

  --accent: #3b6fa8;
  --accent-hover: #2c5d92;
  --accent-soft: #eaf1f8;
  --accent-border: #c4d6e8;

  /* Status — operational palette */
  --ok: #047857;
  --ok-bg: #ecfdf5;
  --ok-border: #a7f3d0;

  --warn: #b45309;
  --warn-bg: #fffbeb;
  --warn-border: #fde68a;

  --crit: #b91c1c;
  --crit-bg: #fef2f2;
  --crit-border: #fecaca;

  --info: #2c5d92;
  --info-bg: #eaf1f8;
  --info-border: #c4d6e8;

  --neutral-bg: #f4f4f5;
  --neutral-border: #e4e4e7;
  --neutral-text: #3f3f46;

  /* Typography */
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Radii */
  --r-sm: 4px;
  --r: 6px;
  --r-lg: 8px;
  --r-xl: 12px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);

  /* Density — "comfortable" defaults */
  --row-h: 40px;
  --pad-card: 18px;
  --gap: 16px;
  --font-base: 13.5px;
  --font-sm: 12.5px;
  --font-xs: 11.5px;
  --sidebar-w: 224px;
}

/* Density: compact */
:root[data-density="compact"] {
  --row-h: 32px;
  --pad-card: 12px;
  --gap: 10px;
  --font-base: 12.5px;
  --font-sm: 11.5px;
  --font-xs: 10.5px;
}

/* Dark theme */
:root[data-theme="dark"] {
  --bg: #09090b;
  --surface: #0f0f11;
  --surface-2: #161618;
  --surface-3: #1c1c1f;
  --hover: #1a1a1d;
  --border: #232327;
  --border-strong: #2e2e33;
  --divider: #1e1e22;

  --text: #fafafa;
  --text-2: #a1a1aa;
  --text-3: #71717a;
  --text-4: #52525b;

  --brand-navy: #0c1024;
  --brand-navy-2: #161b3d;
  --brand-navy-3: #1e2451;
  --brand-blue: #6a98c4;
  --brand-blue-2: #84a9cf;
  --brand-blue-soft: #1a2342;

  --accent: #6a98c4;
  --accent-hover: #84a9cf;
  --accent-soft: #1a2342;
  --accent-border: #2a3a66;

  --ok: #34d399;
  --ok-bg: #052e22;
  --ok-border: #0e4d3a;

  --warn: #fbbf24;
  --warn-bg: #2a1f04;
  --warn-border: #5a3f08;

  --crit: #f87171;
  --crit-bg: #2b0808;
  --crit-border: #5a1212;

  --info: #84a9cf;
  --info-bg: #1a2342;
  --info-border: #2a3a66;

  --neutral-bg: #1c1c1f;
  --neutral-border: #2a2a2e;
  --neutral-text: #d4d4d8;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* ── Reset / base ───────────────────────────────── */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--font-base);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}
#app { height: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font: inherit; color: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* ── App shell ──────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  min-height: 100vh;
}

.sidebar {
  background: var(--brand-navy);
  border-right: 1px solid var(--brand-navy-2);
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  gap: 4px;
  overflow: hidden;
  color: #cbd2e6;
  --hover: var(--brand-navy-2);
  --surface-2: var(--brand-navy-2);
  --surface-3: var(--brand-navy-3);
  --surface: var(--brand-navy-2);
  --text: #f1f3fb;
  --text-2: #b6bfdb;
  --text-3: #8a93b8;
  --text-4: #6f78a0;
  --border: rgba(255,255,255,0.06);
  --divider: rgba(255,255,255,0.06);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 18px 8px;
}
.brand-mark {
  width: 28px; height: 28px;
  background: #ffffff;
  border-radius: 6px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.brand-mark svg { width: 22px; height: 22px; display: block; }
.brand-name {
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0;
  color: #f1f3fb;
  line-height: 1.15;
}
.brand-name .tag {
  display: block;
  font-size: 10px;
  color: var(--brand-blue-2);
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-top: 2px;
}

.nav-section {
  display: flex; flex-direction: column; gap: 1px;
  padding: 8px 0;
}
.nav-section + .nav-section { border-top: 1px solid var(--divider); margin-top: 4px; }
.nav-label {
  padding: 8px 10px 4px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-4);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 10px;
  border-radius: var(--r);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active {
  background: var(--brand-navy-3);
  color: #ffffff;
  box-shadow: inset 2px 0 0 var(--brand-blue-2);
}
.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.9; }
.nav-item .badge-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: var(--brand-blue);
  color: #ffffff;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 500;
}
.nav-item.active .badge-count { background: var(--brand-blue-2); }

.sidebar-footer {
  margin-top: auto;
  padding: 10px;
  border-top: 1px solid var(--divider);
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-2));
  display: grid; place-items: center;
  color: white; font-size: 11px; font-weight: 600;
  border: 1px solid rgba(255,255,255,0.15);
}
.sidebar-footer .who { flex: 1; min-width: 0; }
.sidebar-footer .who-name { font-size: 12.5px; font-weight: 500; }
.sidebar-footer .who-org { font-size: 11px; color: var(--text-3); }

/* Main content area */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text-2);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn svg { width: 14px; height: 14px; }

.view {
  flex: 1;
  overflow: auto;
  padding: 20px;
}
.view.no-pad { padding: 0; }

/* ── Headings & section headers ─────────────────── */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 18px;
  gap: 16px;
}
.page-head h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0;
}
.page-head .sub {
  margin-top: 4px;
  color: var(--text-3);
  font-size: 13px;
}
.page-head .actions {
  display: flex; align-items: center; gap: 8px;
}

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 0 10px 0;
}
.section-head h2 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.01em;
}
.section-head .link {
  font-size: 12px; color: var(--text-3);
  display: inline-flex; align-items: center; gap: 3px;
}
.section-head .link:hover { color: var(--text); }

/* ── Card ───────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--pad-card);
}
.card-flush { padding: 0; overflow-x: auto; }
.chart-card {
  position: relative;
  overflow: visible;
  z-index: 1;
}
.chart-card:hover {
  z-index: 1000;
}
.chart-card.card-flush,
.chart-card .card-body,
.chart-plot {
  overflow: visible;
}
.chart-plot {
  position: relative;
  z-index: 2;
}
.chart-tooltip {
  position: absolute;
  z-index: 9999;
  pointer-events: none;
  isolation: isolate;
}
.apexcharts-tooltip,
.recharts-tooltip-wrapper,
.chartjs-tooltip {
  z-index: 9999 !important;
  pointer-events: none;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px var(--pad-card);
  border-bottom: 1px solid var(--divider);
}
.card-header h3 {
  margin: 0; font-size: 13px; font-weight: 600; letter-spacing: 0;
}
.card-header .meta { font-size: 11.5px; color: var(--text-3); }
.card-body { padding: var(--pad-card); }

/* KPI tile */
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
  min-width: 0;
}
.kpi-label {
  font-size: 11.5px;
  color: var(--text-3);
  display: flex; align-items: center; gap: 6px;
  font-weight: 500;
}
.kpi-label svg { width: 12px; height: 12px; opacity: 0.7; }
.kpi-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0;
  font-feature-settings: "tnum";
  line-height: 1.1;
  margin-top: 2px;
}
.kpi-value .unit { font-size: 12px; color: var(--text-3); margin-left: 4px; font-weight: 400; }
.kpi-delta {
  font-size: 11.5px;
  display: inline-flex; align-items: center; gap: 3px;
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
}
.kpi-delta.up { color: var(--ok); }
.kpi-delta.down { color: var(--crit); }
.kpi-delta.flat { color: var(--text-3); }
.kpi-sub { font-size: 11.5px; color: var(--text-3); }

/* ── Badges ─────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--neutral-border);
  background: var(--neutral-bg);
  color: var(--neutral-text);
  white-space: nowrap;
  line-height: 1.5;
}
.badge .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.badge.ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-border); }
.badge.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-border); }
.badge.crit { color: var(--crit); background: var(--crit-bg); border-color: var(--crit-border); }
.badge.info { color: var(--info); background: var(--info-bg); border-color: var(--info-border); }
.badge.solid {
  color: var(--surface);
  background: var(--text);
  border-color: var(--text);
}

/* Plate */
.plate {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-block;
  color: var(--text);
}
.plate.lg { font-size: 16px; padding: 4px 10px; letter-spacing: 0.05em; }

/* ── Buttons ────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px;
  padding: 0 11px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
}
.btn:hover { background: var(--hover); }
.btn svg { width: 13px; height: 13px; }
.btn.primary {
  background: var(--brand-navy); color: #ffffff; border-color: var(--brand-navy);
}
.btn.primary:hover { background: var(--brand-navy-2); border-color: var(--brand-navy-2); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; }

.period-filter {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
  margin: -6px 0 16px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.period-filter label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-3);
  font-size: 11.5px;
}
.period-filter input {
  height: 30px;
  min-width: 142px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text);
  color-scheme: dark;
  font-size: 12.5px;
}
.period-filter input:focus {
  outline: none;
  border-color: var(--border-strong);
  background: var(--surface);
}

/* ── Table ──────────────────────────────────────── */
.tbl-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.tbl-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--divider);
  flex-wrap: wrap;
}
.tbl-toolbar .search {
  position: relative;
  flex: 1; min-width: 200px;
  max-width: 320px;
}
.tbl-toolbar .search input {
  width: 100%; height: 28px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 8px 0 28px;
  font-size: 12px;
  outline: none;
}
.tbl-toolbar .search input:focus { background: var(--surface); border-color: var(--border-strong); }
.tbl-toolbar .search svg { position: absolute; left: 8px; top: 7px; width: 13px; height: 13px; color: var(--text-3); }
.tbl-filter {
  display: inline-flex; align-items: center; gap: 5px;
  height: 28px; padding: 0 9px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r);
  color: var(--text-2);
  font-size: 12px;
  background: transparent;
}
.tbl-filter:hover { background: var(--hover); color: var(--text); }
.tbl-filter.active { border-style: solid; background: var(--surface-2); color: var(--text); }
.tbl-filter .v { color: var(--text); font-weight: 500; margin-left: 3px; }
.tbl-filter svg { width: 12px; height: 12px; }

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-sm);
}
/* Wrapper para scroll horizontal em telas menores */
.tbl-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tbl thead th {
  text-align: left;
  font-weight: 500;
  color: var(--text-3);
  font-size: 11.5px;
  padding: 8px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}
.tbl thead th.sortable { cursor: pointer; }
.tbl thead th.sortable:hover { color: var(--text); }
.tbl thead th .sort {
  display: inline-block; margin-left: 4px; opacity: 0.5;
}
/* Alinha cabeçalho numérico igual à célula — este era o bug raiz */
.tbl thead th.num {
  text-align: right;
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
}
.tbl tbody td {
  padding: 0 12px;
  height: var(--row-h);
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
  color: var(--text);
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr { cursor: default; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:hover { background: var(--surface-2); }
.tbl td.num { font-family: var(--font-mono); font-feature-settings: "tnum"; text-align: right; }
.tbl td.muted { color: var(--text-3); }
.tbl td.actions { width: 1%; white-space: nowrap; }
/* Célula de data: fonte menor, cor discreta */
.tbl td.date { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.tbl thead th.date { font-size: 11px; }
/* Célula de status/badge: largura mínima, sem quebra */
.tbl td.cell-badge { white-space: nowrap; }
.tbl-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid var(--divider);
  font-size: 11.5px;
  color: var(--text-3);
}
.tbl-footer .pager { display: flex; gap: 4px; }
.tbl-footer .pager button {
  height: 24px; min-width: 24px; padding: 0 6px;
  border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--r-sm); color: var(--text-2); font-size: 11.5px;
}
.tbl-footer .pager button:hover { background: var(--hover); color: var(--text); }
.tbl-footer .pager button.active { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }

/* Mini bar (sparkline-like) */
.minibar {
  display: flex; align-items: flex-end; gap: 2px;
  height: 22px;
}
.minibar i {
  width: 4px;
  background: var(--text-4);
  border-radius: 1px;
  display: block;
}
.minibar.accent i { background: var(--brand-blue); }

/* Charts */
.chart-bars {
  display: grid;
  gap: 6px;
}
.chart-bars .row {
  display: grid;
  grid-template-columns: 140px 1fr 50px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.chart-bars .row .label { color: var(--text-2); }
.chart-bars .row .bar-track {
  height: 8px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.chart-bars .row .bar-fill {
  height: 100%;
  background: var(--brand-blue);
  border-radius: 3px;
}
.chart-bars .row .bar-fill.crit { background: var(--crit); }
.chart-bars .row .bar-fill.warn { background: var(--warn); }
.chart-bars .row .bar-fill.info { background: var(--info); }
.chart-bars .row .bar-fill.ok { background: var(--ok); }
.chart-bars .row .val {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text-2); text-align: right;
  font-feature-settings: "tnum";
}

/* Empty / loading */
.muted { color: var(--text-3); }
.dim { color: var(--text-4); }
.num { font-family: var(--font-mono); font-feature-settings: "tnum"; }

/* Tabs */
.tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tab {
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--text-3);
  border: none;
  background: none;
  border-bottom: 1.5px solid transparent;
  margin-bottom: -1px;
  font-weight: 500;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--text); }
.tab .count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
  margin-left: 4px;
}

/* Dividers, dots */
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.crit { background: var(--crit); }
.dot.info { background: var(--info); }
.dot.off { background: var(--text-4); }

/* Timeline */
.timeline { position: relative; padding-left: 18px; }
.timeline::before {
  content: ""; position: absolute; left: 4px; top: 4px; bottom: 4px;
  width: 1px; background: var(--divider);
}
.timeline-item {
  position: relative;
  padding: 0 0 14px 0;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: ""; position: absolute; left: -18px; top: 5px;
  width: 9px; height: 9px;
  background: var(--surface); border: 1.5px solid var(--text-4);
  border-radius: 50%;
}
.timeline-item.crit::before { border-color: var(--crit); background: var(--crit-bg); }
.timeline-item.warn::before { border-color: var(--warn); background: var(--warn-bg); }
.timeline-item.ok::before { border-color: var(--ok); background: var(--ok-bg); }
.timeline-item.info::before { border-color: var(--info); background: var(--info-bg); }
.timeline-item .when {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-3);
}
.timeline-item .what {
  font-size: 12.5px; margin-top: 1px; color: var(--text);
}
.timeline-item .where {
  font-size: 11.5px; color: var(--text-3); margin-top: 2px;
}

/* Map screen */
.map-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  height: 100%;
}
.map-canvas {
  position: relative;
  background: var(--surface-2);
  overflow: hidden;
}
.map-canvas .leaflet-container {
  width: 100%; height: 100%;
  background: var(--surface-2);
}
.map-panel {
  border-left: 1px solid var(--border);
  background: var(--surface);
  display: flex; flex-direction: column;
  min-height: 0;
}
.map-panel-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--divider);
}
.map-search {
  position: relative;
  width: 100%;
}
.map-search input {
  width: 100%;
  height: 30px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 10px 0 30px;
  font-size: 12.5px;
  outline: none;
}
.map-search input:focus {
  border-color: var(--border-strong);
  background: var(--surface);
}
.map-search svg {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 13px;
  height: 13px;
  color: var(--text-3);
}
.map-panel-filters {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--divider);
}
.map-panel-list {
  flex: 1; overflow: auto;
}
.map-veh-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
}
.map-veh-row:hover { background: var(--surface-2); }
.map-veh-row.selected { background: var(--accent-soft); }
.map-veh-row .meta { flex: 1; min-width: 0; }
.map-veh-row .top {
  display: flex; align-items: center; gap: 6px;
}
.map-veh-row .driver { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.map-veh-row .loc {
  font-size: 11.5px; color: var(--text-3); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Map vehicle popover (in-map detail) */
.map-detail {
  position: absolute;
  left: 16px; bottom: 16px;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 14px;
  z-index: 1000;
}
.map-detail h4 { margin: 0; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.map-detail .grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px;
  margin-top: 10px;
}
.map-detail .grid .k { font-size: 11px; color: var(--text-3); }
.map-detail .grid .v { font-size: 12.5px; font-family: var(--font-mono); margin-top: 1px; }

/* Vehicle detail header */
.veh-head {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 16px;
}
.veh-head .veh-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  color: var(--text-2);
}
.veh-head .veh-icon svg { width: 22px; height: 22px; }
.veh-head .veh-meta { flex: 1; }
.veh-head .veh-title { display: flex; align-items: center; gap: 10px; }
.veh-head .veh-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; display: flex; gap: 12px; flex-wrap: wrap; }
.veh-head .veh-sub span b { color: var(--text-2); font-weight: 500; }

/* Status pill (large) */
.stat-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
}

/* Grid helpers */
.grid { display: grid; gap: var(--gap); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.grid.cols-6 { grid-template-columns: repeat(6, 1fr); }
.grid.cols-2-1 { grid-template-columns: 2fr 1fr; }
.grid.cols-1-2 { grid-template-columns: 1fr 2fr; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 6px; }
.gap-sm { gap: 8px; }
.gap-md { gap: 12px; }
.gap-lg { gap: 16px; }

/* Severity row left border */
tr.row-crit td:first-child { box-shadow: inset 3px 0 0 var(--crit); }
tr.row-warn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
tr.row-info td:first-child { box-shadow: inset 3px 0 0 var(--info); }
tr.row-ok td:first-child { box-shadow: inset 3px 0 0 var(--ok); }

/* Donut */
.donut {
  --p: 70; --c: var(--ok); --size: 88px; --thick: 10px;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  background:
    conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-2) 0);
  display: grid; place-items: center;
  position: relative;
}
.donut::before {
  content: ""; position: absolute; inset: var(--thick);
  background: var(--surface);
  border-radius: 50%;
}
.donut .donut-val {
  position: relative;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  font-feature-settings: "tnum";
}

/* Leaflet customization (light feel) */
.leaflet-popup-content-wrapper {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: var(--shadow-lg) !important;
  border: 1px solid var(--border);
}
.leaflet-popup-tip { background: var(--surface) !important; }
.leaflet-control-attribution {
  background: rgba(255,255,255,0.7) !important;
  font-size: 10px !important;
}
:root[data-theme="dark"] .leaflet-control-attribution {
  background: rgba(0,0,0,0.5) !important;
  color: var(--text-2) !important;
}
:root[data-theme="dark"] .leaflet-tile {
  filter: invert(1) hue-rotate(180deg) brightness(0.95) contrast(0.9);
}

/* Truck marker */
.truck-marker {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--brand-navy);
  display: grid; place-items: center;
  color: var(--brand-navy);
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.truck-marker.ok { border-color: var(--ok); color: var(--ok); }
.truck-marker.warn { border-color: var(--warn); color: var(--warn); }
.truck-marker.crit { border-color: var(--crit); color: var(--crit); }
.truck-marker svg { width: 14px; height: 14px; }
.truck-marker .pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0.4;
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.5; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* Subtle striping for monospace data */
.spec {
  display: grid; grid-template-columns: 110px 1fr;
  font-size: 12px;
  gap: 2px 14px;
}
.spec dt { color: var(--text-3); }
.spec dd { margin: 0; color: var(--text); font-family: var(--font-mono); font-feature-settings: "tnum"; }

/* Integration log */
.log {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 12px;
  color: var(--text-2);
  max-height: 180px;
  overflow: auto;
  line-height: 1.55;
}
.log .err { color: var(--crit); }
.log .ok { color: var(--ok); }
.log .ts { color: var(--text-3); }

/* Tweaks panel scoped tweaks (in case starter doesn't include them) */
.tweaks-panel { font-family: var(--font-sans); }

/* ── Movimentação de Pneus ──────────────────────────────────────────────────── */

.pneus-view { display: flex; flex-direction: column; gap: var(--gap); padding-bottom: 40px; }

/* Seletor de veículo */
.pneus-selector-card { padding: var(--pad-card); }
.pneus-selector-row  { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.vehicle-info-chips  { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding-bottom: 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 100px; font-size: var(--font-xs); font-weight: 500;
  background: var(--accent-soft); color: var(--brand-blue); border: 1px solid var(--accent-border);
}
.chip-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border); }

/* Layout principal */
.pneus-main-area { display: grid; grid-template-columns: 1fr 150px; gap: var(--gap); align-items: start; }
.pneus-schematic-card { padding: var(--pad-card); overflow-x: auto; }

/* Estado vazio */
.pneus-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 48px; text-align: center;
}

/* ── Esquema visual ── */
.truck-schematic { min-width: 300px; }
.truck-cab-label {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--font-sm); font-weight: 600; color: var(--brand-blue);
  padding-bottom: 12px; border-bottom: 2px solid var(--brand-blue); margin-bottom: 16px;
}
.truck-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 32px; color: var(--text-3); }
.axle-list   { display: flex; flex-direction: column; gap: 10px; }

/* Linha de eixo */
.axle-row   { display: flex; align-items: center; gap: 6px; }
.axle-side  { display: flex; gap: 4px; }
.axle-left  { flex: 1; justify-content: flex-end; }
.axle-right { flex: 1; justify-content: flex-start; }
.axle-center { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 52px; flex-shrink: 0; }
.axle-eixo-label { font-size: 9px; color: var(--text-4); white-space: nowrap; }
.axle-bar   { height: 6px; width: 100%; background: var(--border-strong); border-radius: 3px; }

/* Estepe */
.spare-row        { display: flex; align-items: center; gap: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.spare-label-text { font-size: var(--font-xs); color: var(--text-3); white-space: nowrap; width: 52px; text-align: center; }
.spare-slots      { display: flex; gap: 4px; }

/* ── Slot de posição ── */
.pslot {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 5px 4px; border-radius: var(--r-lg);
  border: 1.5px dashed var(--border); cursor: pointer;
  min-width: 80px; max-width: 110px;
  transition: border-color 120ms, background 120ms, box-shadow 120ms;
  text-align: center;
}
.pslot:hover         { border-color: var(--brand-blue); background: var(--accent-soft); }
.pslot-dragover      { border-color: var(--brand-blue) !important; background: var(--accent-soft) !important; box-shadow: 0 0 0 3px var(--accent-border); }
.pslot-target        { border-style: solid; border-color: var(--brand-blue); }
.pslot-filled        { border-style: solid; border-color: var(--border-strong); background: var(--surface); }
.pslot-selecionado   { border-color: var(--brand-blue) !important; border-style: solid; box-shadow: 0 0 0 2px var(--accent-border); }

.pslot-label {
  font-size: 9px; font-weight: 700; color: var(--text-3);
  letter-spacing: 0.06em; text-transform: uppercase; width: 100%;
}

.pslot-vazio {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: 52px; color: var(--text-4); font-size: 10px;
}

/* ── Card do pneu dentro do slot ──
   Número do pneu é o elemento dominante — jamais truncado. */
.slot-tire-card {
  width: 100%; border-radius: var(--r); border-left: 3px solid var(--border-strong);
  padding: 5px 5px 5px 6px; background: var(--surface-2); cursor: pointer;
  transition: background 100ms;
}
.slot-tire-card:hover { background: var(--hover); }
.slot-tire-selected { background: var(--accent-soft); border-left-color: var(--brand-blue); }

/* Número/código do pneu — GRANDE, nunca truncado, quebra linha */
.slot-tire-num {
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 800;
  color: var(--text);
  word-break: break-all; white-space: normal;
  line-height: 1.25;
  letter-spacing: 0;
}

.slot-tire-bar-wrap { height: 3px; background: var(--surface-3); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.slot-tire-bar      { height: 100%; border-radius: 2px; transition: width 300ms; }
.slot-tire-brand    { font-size: 9.5px; color: var(--text-3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Destinos (drag/drop desktop) ── */
.pneus-destinos-col { display: flex; flex-direction: column; gap: 8px; }
.destinos-label     { font-size: var(--font-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.dest-area {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 12px 6px; border-radius: var(--r-lg); border: 2px dashed var(--border);
  cursor: pointer; text-align: center; font-size: var(--font-xs); font-weight: 500; color: var(--text-3);
  transition: all 120ms;
}
.dest-info    { border-color: var(--info-border);  color: var(--info);  background: var(--info-bg);  }
.dest-warn    { border-color: var(--warn-border);  color: var(--warn);  background: var(--warn-bg);  }
.dest-crit    { border-color: var(--crit-border);  color: var(--crit);  background: var(--crit-bg);  }
.dest-active  { border-style: solid; }
.dest-drag-over { transform: scale(1.05); border-style: solid; }
.dest-label   { font-weight: 700; }

/* ── Estoque ── */
.pneus-estoque-card { padding: var(--pad-card); }
.estoque-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.estoque-card {
  width: 130px; padding: 10px 12px; border-radius: var(--r-lg);
  border: 1.5px solid var(--border); background: var(--surface);
  cursor: pointer; transition: border-color 120ms, box-shadow 120ms;
}
.estoque-card:hover { border-color: var(--brand-blue); box-shadow: var(--shadow); }
.estoque-card-num {
  font-family: var(--font-mono); font-size: 13px; font-weight: 800;
  color: var(--text); word-break: break-all; white-space: normal; line-height: 1.3;
}
.estoque-card-info { font-size: var(--font-xs); color: var(--text-3); margin-top: 4px; }

/* ── Action Sheet (mobile) ── */
.action-sheet-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 300;
  display: flex; align-items: flex-end; justify-content: center;
}
.action-sheet {
  background: var(--surface); border-radius: 20px 20px 0 0;
  width: 100%; max-width: 520px; max-height: 85vh;
  display: flex; flex-direction: column; overflow: hidden;
  padding: 0 0 env(safe-area-inset-bottom, 16px);
  box-shadow: 0 -8px 32px rgba(0,0,0,0.18);
  animation: sheet-up 220ms ease;
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

.action-sheet-handle {
  width: 40px; height: 4px; background: var(--border-strong);
  border-radius: 2px; margin: 12px auto 8px; flex-shrink: 0;
}
.action-sheet-head {
  padding: 4px 20px 12px; border-bottom: 1px solid var(--divider); flex-shrink: 0;
}
.action-sheet-pos-badge {
  display: inline-block; background: var(--accent-soft); color: var(--brand-blue);
  border: 1px solid var(--accent-border); border-radius: 6px;
  font-size: 11px; font-weight: 700; padding: 2px 8px; letter-spacing: .04em;
  margin-bottom: 4px;
}
.action-sheet-pos-nome    { font-size: var(--font-xs); color: var(--text-3); }
.action-sheet-pneu-num    { font-family: var(--font-mono); font-size: 22px; font-weight: 900; color: var(--text); margin-top: 4px; word-break: break-all; line-height: 1.2; }
.action-sheet-vazio-hint  { font-size: var(--font-sm); color: var(--text-3); margin-top: 4px; font-style: italic; }

.action-sheet-info { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 20px; flex-shrink: 0; }
.as-info-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 9px; border-radius: 100px; font-size: var(--font-xs); font-weight: 500;
  background: var(--neutral-bg); color: var(--neutral-text); border: 1px solid var(--neutral-border);
}
.as-chip-ok   { background: var(--ok-bg);   color: var(--ok);   border-color: var(--ok-border);   }
.as-chip-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.as-chip-crit { background: var(--crit-bg); color: var(--crit); border-color: var(--crit-border); }

.action-sheet-section-label { font-size: var(--font-xs); font-weight: 600; color: var(--text-3); padding: 4px 20px 8px; flex-shrink: 0; }

.action-sheet-destinos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 20px 12px; flex-shrink: 0; }
.as-destino-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 8px; border-radius: var(--r-lg); border: 1.5px solid; font-size: var(--font-sm); font-weight: 600;
  cursor: pointer; transition: opacity 120ms, transform 80ms;
}
.as-destino-btn:active { transform: scale(0.97); }
.as-btn-info  { background: var(--info-bg);  color: var(--info);  border-color: var(--info-border);  }
.as-btn-warn  { background: var(--warn-bg);  color: var(--warn);  border-color: var(--warn-border);  }
.as-btn-crit  { background: var(--crit-bg);  color: var(--crit);  border-color: var(--crit-border);  }

.as-detalhes-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  margin: 0 20px 8px; padding: 12px; border-radius: var(--r-lg);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: var(--font-sm); font-weight: 500; cursor: pointer;
  flex-shrink: 0;
}
.as-detalhes-btn:hover { background: var(--hover); }

.as-estoque-list { flex: 1; overflow-y: auto; padding: 0 8px; }
.as-estoque-item {
  width: 100%; display: flex; flex-direction: column; gap: 2px; text-align: left;
  padding: 12px; border-radius: var(--r-lg); background: none; border: none; cursor: pointer;
  border-bottom: 1px solid var(--divider);
}
.as-estoque-item:hover { background: var(--hover); }
.as-estoque-num  { font-family: var(--font-mono); font-size: 15px; font-weight: 800; color: var(--text); word-break: break-all; }
.as-estoque-info { font-size: var(--font-xs); color: var(--text-3); }
.as-estoque-item:last-child { border-bottom: none; }

.as-cancelar-btn {
  margin: 8px 20px 4px; padding: 14px; border-radius: var(--r-lg);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: var(--font-sm); font-weight: 600; cursor: pointer; color: var(--text-2);
  flex-shrink: 0;
}
.as-cancelar-btn:hover { background: var(--hover); }

/* ── Histórico ── */
.historico-panel { padding: 0; overflow: hidden; }
.historico-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: var(--pad-card); background: none; border: none; cursor: pointer;
  font-size: var(--font-sm); font-weight: 500; border-radius: var(--r-xl);
}
.historico-toggle:hover { background: var(--hover); }
.historico-body { padding: 0 var(--pad-card) var(--pad-card); }

/* ── Modais ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center; z-index: 200; padding: 16px;
}
.modal-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-movimento { max-width: 420px; }
.modal-historico-pneu { max-width: 720px; }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--divider); flex-shrink: 0;
}
.modal-head h2 { margin: 0; font-size: 15px; }
.modal-close {
  padding: 4px; background: none; border: none; cursor: pointer;
  color: var(--text-3); border-radius: var(--r); flex-shrink: 0;
}
.modal-close:hover { background: var(--hover); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.modal-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 14px 20px; border-top: 1px solid var(--divider); flex-shrink: 0;
}

/* Detalhes */
.detail-grid { display: flex; flex-direction: column; gap: 8px; }
.detail-row  { display: flex; gap: 12px; align-items: baseline; }
.detail-row.full { flex-direction: column; gap: 3px; }
.detail-label { font-size: var(--font-xs); color: var(--text-3); min-width: 110px; flex-shrink: 0; }
.detail-value { font-size: var(--font-sm); color: var(--text); }

/* Resumo movimentação */
.movimento-resumo { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; }
.mov-row   { display: flex; gap: 10px; align-items: baseline; }
.mov-label { font-size: var(--font-xs); color: var(--text-3); min-width: 65px; flex-shrink: 0; }
.mov-value { font-size: var(--font-sm); font-weight: 500; }
.mov-destino { color: var(--brand-blue); }

/* Formulário */
.form-field    { display: flex; flex-direction: column; gap: 5px; }
.field-label   { font-size: var(--font-xs); font-weight: 500; color: var(--text-2); }
.field-required { color: var(--crit); margin-left: 2px; }
.field-input, .field-select, .field-textarea {
  width: 100%; padding: 8px 10px; border-radius: var(--r);
  border: 1.5px solid var(--border); background: var(--surface); font-size: var(--font-sm); color: var(--text);
  transition: border-color 120ms;
}
.field-input:focus, .field-select:focus, .field-textarea:focus { outline: none; border-color: var(--brand-blue); }
.field-textarea { resize: vertical; min-height: 56px; }
.form-error {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: var(--r);
  background: var(--crit-bg); color: var(--crit); font-size: var(--font-xs); border: 1px solid var(--crit-border);
}

/* Autocomplete */
.autocomplete-wrap { position: relative; }
.autocomplete-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-3); cursor: pointer; padding: 2px; border-radius: 3px;
}
.autocomplete-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 100;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); max-height: 240px; overflow-y: auto;
}
.autocomplete-item {
  width: 100%; text-align: left; padding: 9px 13px;
  background: none; border: none; cursor: pointer; color: var(--text); font-size: var(--font-sm);
}
.autocomplete-item:hover { background: var(--hover); }

/* Badges */
.badge-ok   { background: var(--ok-bg);   color: var(--ok);   border: 1px solid var(--ok-border);   }
.badge-warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); }
.badge-crit { background: var(--crit-bg); color: var(--crit); border: 1px solid var(--crit-border); }
.badge-info { background: var(--info-bg); color: var(--info); border: 1px solid var(--info-border); }

/* Seletor de veículo */
.pneus-selector-card { padding: var(--pad-card); }
.pneus-selector-row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.pneus-vehicle-field { flex: 1; min-width: 240px; }
.vehicle-info-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding-bottom: 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 100px; font-size: var(--font-xs); font-weight: 500;
  background: var(--accent-soft); color: var(--brand-blue); border: 1px solid var(--accent-border);
}
.chip-neutral { background: var(--neutral-bg); color: var(--neutral-text); border-color: var(--neutral-border); }
.chip-ok      { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border); }

/* Banner de pneu selecionado */
.pneu-selecionado-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 14px; border-radius: var(--r-lg);
  background: var(--accent-soft); border: 1px solid var(--accent-border);
  color: var(--brand-blue); font-size: var(--font-sm);
}

/* Layout principal */
.pneus-main-area {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: var(--gap);
  align-items: start;
}
.pneus-schematic-card { padding: var(--pad-card); overflow-x: auto; }

/* Estado vazio */
.pneus-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 48px; text-align: center;
}

/* Esquema do veículo */
.truck-schematic { min-width: 320px; }
.truck-cab {
  display: flex; align-items: center; gap: 8px; padding-bottom: 12px;
  border-bottom: 2px solid var(--brand-blue); margin-bottom: 16px;
  font-size: var(--font-sm); font-weight: 600; color: var(--brand-blue);
}
.truck-empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 32px; color: var(--text-3); text-align: center;
}
.axle-list { display: flex; flex-direction: column; gap: 12px; }

/* Linha de eixo */
.axle-row { display: flex; align-items: center; gap: 8px; }
.axle-side { display: flex; gap: 4px; }
.axle-left  { justify-content: flex-end; flex: 1; }
.axle-right { justify-content: flex-start; flex: 1; }
.axle-center {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 60px; flex-shrink: 0;
}
.axle-label { font-size: 10px; color: var(--text-3); white-space: nowrap; }
.axle-bar { height: 6px; width: 100%; background: var(--border-strong); border-radius: 3px; }

/* Estepe */
.spare-row { display: flex; align-items: center; gap: 10px; padding-top: 8px; border-top: 1px dashed var(--border); }
.spare-label { font-size: var(--font-xs); color: var(--text-3); white-space: nowrap; width: 60px; text-align: center; }
.spare-slots { display: flex; gap: 4px; }

/* Slot de posição */
.position-slot {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px; border-radius: var(--r-lg);
  border: 1.5px dashed var(--border);
  cursor: pointer; transition: all 120ms ease;
  min-width: 68px;
}
.position-slot:hover { border-color: var(--brand-blue); background: var(--accent-soft); }
.slot-drag-over { border-color: var(--brand-blue) !important; background: var(--accent-soft) !important; box-shadow: 0 0 0 2px var(--accent-border); }
.slot-target { border-color: var(--brand-blue); border-style: solid; }
.slot-filled { border-style: solid; border-color: var(--border-strong); }
.slot-label { font-size: 10px; font-weight: 600; color: var(--text-3); letter-spacing: 0.04em; }
.slot-placeholder {
  width: 60px; height: 44px; display: flex; align-items: center; justify-content: center;
  color: var(--text-4);
}
.slot-dash { font-size: 18px; color: var(--text-4); }

/* Card do pneu */
.tire-card {
  position: relative; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r); padding: 6px 8px;
  width: 60px; min-height: 44px;
  display: flex; flex-direction: column; gap: 2px;
  transition: all 120ms ease;
  user-select: none;
}
.tire-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.tire-selected { border-color: var(--brand-blue) !important; box-shadow: 0 0 0 2px var(--accent-border); background: var(--accent-soft) !important; }
.tire-warn  { border-left: 3px solid var(--warn); }
.tire-crit  { border-left: 3px solid var(--crit); }
.tire-ok    { border-left: 3px solid var(--ok); }

.tire-header { display: flex; align-items: center; justify-content: space-between; gap: 3px; }
.tire-code   { font-size: 10px; font-weight: 700; color: var(--text); font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tire-badge  { font-size: 9px; font-weight: 600; padding: 1px 4px; border-radius: 10px; white-space: nowrap; flex-shrink: 0; }
.tire-brand  { font-size: 9.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tire-km     { font-size: 9px; color: var(--text-2); }
.tire-recap  { font-size: 9px; color: var(--warn); }
.tire-detail-btn {
  position: absolute; top: 2px; right: 2px; padding: 1px;
  background: none; border: none; color: var(--text-4);
  cursor: pointer; border-radius: 3px;
}
.tire-detail-btn:hover { color: var(--brand-blue); }

/* Cards de pneus em estoque (maiores — sem veículo selecionado) */
.estoque-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.estoque-grid .tire-card {
  width: 148px; min-height: auto; padding: 10px 12px;
  font-size: var(--font-sm);
}
.estoque-grid .tire-code { font-size: var(--font-sm); }
.estoque-grid .tire-brand { font-size: var(--font-xs); }
.estoque-grid .tire-km    { font-size: var(--font-xs); }
.estoque-grid .tire-recap { font-size: var(--font-xs); }

/* Painéis de destino */
.pneus-destinos-col { display: flex; flex-direction: column; gap: 8px; }
.destinos-label { font-size: var(--font-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; padding: 0 2px; }
.dest-area {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 8px; border-radius: var(--r-lg);
  border: 2px dashed var(--border); cursor: pointer;
  transition: all 120ms ease; text-align: center;
  font-size: var(--font-xs); font-weight: 500; color: var(--text-3);
}
.dest-area:hover, .dest-active:hover { transform: scale(1.02); }
.dest-drag-over { transform: scale(1.04); }
.dest-info    { border-color: var(--info-border);  color: var(--info);  background: var(--info-bg); }
.dest-warn    { border-color: var(--warn-border);  color: var(--warn);  background: var(--warn-bg); }
.dest-crit    { border-color: var(--crit-border);  color: var(--crit);  background: var(--crit-bg); }
.dest-active  { border-style: solid; }
.dest-label   { font-weight: 600; }

/* Estoque card */
.pneus-estoque-card { padding: var(--pad-card); }

/* Histórico */
.historico-panel { padding: 0; overflow: hidden; }
.historico-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: var(--pad-card); background: none; border: none; cursor: pointer;
  font-size: var(--font-sm); font-weight: 500;
  border-radius: var(--r-xl);
}
.historico-toggle:hover { background: var(--hover); }
.historico-body { padding: 0 var(--pad-card) var(--pad-card); }

.pneu-history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 180px;
  color: var(--text-3);
  text-align: center;
}

.pneu-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pneu-history-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.pneu-history-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.pneu-history-route {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: var(--font-sm);
  font-weight: 600;
  line-height: 1.35;
}

.pneu-history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.pneu-history-meta span {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-3);
  font-size: var(--font-xs);
}

.pneu-history-obs {
  margin-top: 8px;
  color: var(--text-2);
  font-size: var(--font-xs);
  line-height: 1.4;
}

/* Modais */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 16px;
}
.modal-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 480px; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-movimento { max-width: 420px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--divider); flex-shrink: 0;
}
.modal-head h2 { margin: 0; font-size: 15px; }
.modal-close {
  padding: 4px; background: none; border: none; cursor: pointer;
  color: var(--text-3); border-radius: var(--r); transition: background 100ms;
}
.modal-close:hover { background: var(--hover); color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.modal-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 14px 20px; border-top: 1px solid var(--divider); flex-shrink: 0;
}

/* Detalhes do pneu */
.detail-grid { display: flex; flex-direction: column; gap: 8px; }
.detail-row { display: flex; gap: 12px; align-items: baseline; }
.detail-row.full { flex-direction: column; gap: 3px; }
.detail-label { font-size: var(--font-xs); color: var(--text-3); min-width: 110px; flex-shrink: 0; }
.detail-value { font-size: var(--font-sm); color: var(--text); }

/* Resumo da movimentação no modal */
.movimento-resumo {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 7px;
}
.mov-row { display: flex; gap: 10px; align-items: baseline; }
.mov-label { font-size: var(--font-xs); color: var(--text-3); min-width: 65px; flex-shrink: 0; }
.mov-value { font-size: var(--font-sm); font-weight: 500; }
.mov-destino { color: var(--brand-blue); }

/* Formulário nos modais */
.form-field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: var(--font-xs); font-weight: 500; color: var(--text-2); }
.field-required { color: var(--crit); margin-left: 2px; }
.field-input, .field-select, .field-textarea {
  width: 100%; padding: 8px 10px; border-radius: var(--r);
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: var(--font-sm); color: var(--text);
  transition: border-color 120ms;
}
.field-input:focus, .field-select:focus, .field-textarea:focus {
  outline: none; border-color: var(--brand-blue);
}
.field-textarea { resize: vertical; min-height: 56px; }
.form-error {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: var(--r);
  background: var(--crit-bg); color: var(--crit);
  font-size: var(--font-xs); border: 1px solid var(--crit-border);
}

/* Autocomplete */
.autocomplete-wrap { position: relative; }
.autocomplete-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-3); cursor: pointer;
  padding: 2px; border-radius: 3px;
}
.autocomplete-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 100;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  max-height: 220px; overflow-y: auto;
}
.autocomplete-item {
  width: 100%; text-align: left; padding: 8px 12px;
  background: none; border: none; cursor: pointer; color: var(--text);
  font-size: var(--font-sm);
}
.autocomplete-item:hover { background: var(--hover); }

/* responsive: tablet */
@media (max-width: 960px) {
  .app-shell { --sidebar-w: 56px; }
  .sidebar { padding: 14px 6px; }
  .nav-item span.lbl, .nav-label, .brand-name, .sidebar-footer .who, .nav-item .badge-count { display: none; }
  .nav-item { justify-content: center; padding: 8px; }
  .sidebar-brand { justify-content: center; padding: 6px 0 18px 0; }
  .sidebar-footer { justify-content: center; padding: 10px 4px; }
  .map-layout { grid-template-columns: 1fr; }
  .map-panel { display: none; }
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-5 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-6 { grid-template-columns: repeat(3, 1fr); }
  /* Pneus — tablet: destinos vão embaixo */
  .pneus-main-area { grid-template-columns: 1fr; }
  .pneus-destinos-col { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .dest-area { flex: 1; min-width: 100px; flex-direction: row; justify-content: center; }
}

/* responsive: mobile */
@media (max-width: 640px) {
  .pneus-selector-row { flex-direction: column; align-items: stretch; }
  /* Slots maiores para toque */
  .pslot { min-width: 90px; }
  .slot-tire-num { font-size: 13px; }
  /* Modal como bottom sheet */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-box { max-width: 100%; border-radius: 20px 20px 0 0; position: fixed; bottom: 0; left: 0; right: 0; max-height: 90vh; }
  /* Estoque: 2 colunas */
  .estoque-grid { gap: 8px; }
  .estoque-card { width: calc(50% - 4px); }
}

/* Pneus - conferencia espacada e legivel */
.pneus-view {
  gap: 18px;
}

.pneus-main-area {
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 18px;
}

.pneus-schematic-card {
  padding: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-gutter: stable;
}

.truck-schematic {
  width: max-content;
  min-width: 640px;
  margin: 0 auto;
  padding: 2px 4px 8px;
}

.truck-cab-label {
  margin-bottom: 22px;
  padding-bottom: 14px;
  font-size: 14px;
}

.axle-list {
  gap: 20px;
}

.axle-row {
  gap: 16px;
}

.axle-side {
  gap: 12px;
}

.axle-center {
  width: 76px;
  gap: 5px;
}

.axle-eixo-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
}

.axle-bar {
  height: 8px;
  border-radius: 999px;
}

.spare-row {
  gap: 14px;
  padding-top: 16px;
  margin-top: 2px;
}

.spare-label-text {
  width: 76px;
  font-weight: 700;
}

.spare-slots {
  gap: 12px;
}

.pslot {
  min-width: 124px;
  max-width: 148px;
  min-height: 124px;
  gap: 7px;
  padding: 9px;
  border-radius: 8px;
  background: var(--surface);
}

.pslot-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--brand-blue);
  line-height: 1.1;
}

.pslot-empty {
  border-color: var(--accent-border);
  background: linear-gradient(180deg, var(--surface), var(--accent-soft));
}

.pslot-vazio {
  min-height: 82px;
  width: 100%;
  border-radius: 7px;
  border: 1px solid var(--accent-border);
  color: var(--brand-blue);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 700;
}

.pslot-vazio span {
  line-height: 1.2;
}

.slot-tire-card {
  min-height: 86px;
  padding: 10px 10px 9px 11px;
  border-radius: 7px;
  border-left-width: 5px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
}

.slot-tire-num {
  font-size: 20px;
  line-height: 1.12;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  word-break: normal;
  color: var(--text);
}

.slot-tire-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 7px;
}

.slot-tire-pos {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--brand-blue);
  font-size: 11px;
  font-weight: 800;
}

.slot-tire-pct {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.slot-pct-ok { color: var(--ok); border-color: var(--ok-border); background: var(--ok-bg); }
.slot-pct-warn { color: var(--warn); border-color: var(--warn-border); background: var(--warn-bg); }
.slot-pct-crit { color: var(--crit); border-color: var(--crit-border); background: var(--crit-bg); }
.slot-pct-neutro { color: var(--text-3); }

.slot-tire-bar-wrap {
  height: 5px;
  margin-top: 8px;
  border-radius: 999px;
}

.slot-tire-bar {
  border-radius: 999px;
}

.slot-tire-brand {
  margin-top: 7px;
  font-size: 10.5px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
}

.vehicle-layout {
  width: max-content;
  min-width: 720px;
  margin: 0 auto;
  padding: 2px 8px 10px;
}

.vehicle-layout-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--accent-border);
  color: var(--brand-blue);
}

.vehicle-nose {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
}

.vehicle-nose-trailer {
  width: 54px;
  border-radius: 6px;
}

.vehicle-layout-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.vehicle-layout-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-3);
}

.vehicle-body-frame {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(90deg, transparent 0, transparent 47%, var(--surface-2) 47%, var(--surface-2) 53%, transparent 53%);
}

.layout-carreta .vehicle-body-frame {
  border-radius: 8px;
  background: linear-gradient(90deg, transparent 0, transparent 48%, var(--surface-2) 48%, var(--surface-2) 52%, transparent 52%);
}

.vehicle-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.vehicle-section-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0;
}

.vehicle-axles {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.vehicle-axle-row {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) 86px minmax(250px, 1fr);
  align-items: center;
  gap: 16px;
}

.vehicle-side {
  display: flex;
  gap: 12px;
  align-items: center;
}

.vehicle-side-left {
  justify-content: flex-end;
}

.vehicle-side-right {
  justify-content: flex-start;
}

.vehicle-axle-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 800;
}

.vehicle-axle-line {
  width: 78px;
  height: 8px;
  border-radius: 999px;
  background: var(--border-strong);
}

.vehicle-axle-steer .vehicle-axle-line {
  width: 58px;
  background: var(--accent-border);
}

.vehicle-axle-trailer .vehicle-axle-line {
  background: var(--border-strong);
}

.vehicle-spares-section {
  display: grid;
  grid-template-columns: 88px 1fr;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.vehicle-spares-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.layout-cavalo .vehicle-section-front,
.layout-truck .vehicle-section-front,
.layout-bitruck .vehicle-section-front {
  padding-bottom: 4px;
}

.pneus-destinos-col {
  gap: 8px;
}

.destinos-label {
  letter-spacing: 0;
}

.dest-area {
  min-height: 46px;
  flex-direction: row;
  justify-content: center;
  gap: 7px;
  padding: 9px 10px;
  border-width: 1.5px;
  border-radius: 8px;
}

.dest-label {
  font-size: 12px;
}

.estoque-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}

.estoque-card {
  width: auto;
  min-height: 104px;
  padding: 12px 14px;
  border-radius: 8px;
}

.estoque-card-num {
  font-size: 18px;
  line-height: 1.16;
  overflow-wrap: anywhere;
  word-break: normal;
}

.estoque-card-info {
  font-size: 12px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.estoque-card-subtitle {
  margin-top: 5px;
  font-size: 11.5px;
  line-height: 1.25;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 960px) {
  .pneus-main-area {
    grid-template-columns: 1fr;
  }

  .truck-schematic {
    min-width: 660px;
  }

  .vehicle-layout {
    min-width: 740px;
    margin: 0;
  }

  .pneus-destinos-col {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .dest-area {
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .pneus-view {
    gap: 12px;
    padding-bottom: 104px;
  }

  .pneus-schematic-card {
    padding: 12px;
    margin-left: 0;
    margin-right: 0;
    border-radius: 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }

  .truck-schematic {
    min-width: 0;
    width: 100%;
    margin: 0;
  }

  .vehicle-layout {
    width: 100%;
    min-width: 0;
    padding: 0;
  }

  .vehicle-body-frame {
    padding: 12px;
    gap: 18px;
    background: linear-gradient(180deg, transparent 0, transparent 48%, var(--surface-2) 48%, var(--surface-2) 52%, transparent 52%);
  }

  .vehicle-axle-row {
    grid-template-columns: 1fr 48px 1fr;
    grid-template-areas:
      "left left left"
      "center center center"
      "right right right";
    gap: 8px;
    padding: 4px 0 10px;
    border-bottom: 1px solid var(--divider);
  }

  .vehicle-axle-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .vehicle-side {
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    min-width: 0;
  }

  .vehicle-side-left { grid-area: left; justify-content: center; }
  .vehicle-side-right { grid-area: right; justify-content: center; }

  .vehicle-axle-center {
    grid-area: center;
    flex-direction: row;
    justify-content: center;
    gap: 8px;
  }

  .vehicle-axle-line {
    width: 54px;
    height: 6px;
  }

  .vehicle-spares-section {
    grid-template-columns: 1fr;
    padding: 12px;
    text-align: center;
  }

  .vehicle-spares-grid {
    justify-content: center;
  }

  .pslot {
    width: min(128px, calc(50vw - 58px));
    min-width: 112px;
    min-height: 116px;
  }

  .slot-tire-num {
    font-size: 18px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .pneus-destinos-col {
    position: fixed;
    left: var(--sidebar-w, 56px);
    right: 0;
    bottom: 0;
    z-index: 180;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.12);
  }

  .pneus-destinos-col .destinos-label {
    display: none;
  }

  .pneus-destinos-col .dest-area {
    min-height: 46px;
    padding: 7px 3px;
    flex-direction: column;
    gap: 3px;
    border-style: solid;
    font-size: 11px;
  }

  .pneus-destinos-col .dest-label {
    font-size: 10.5px;
    line-height: 1.1;
  }

  .estoque-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .estoque-card {
    width: auto;
    min-height: 110px;
    padding: 12px;
  }

  .section-head {
    align-items: flex-start;
    gap: 10px;
  }
}

/* Overrides finais: pneus mobile, sem afetar desktop. */
@media (max-width: 640px) {
  .app-shell { --sidebar-w: 44px; }
  .sidebar { padding: 8px 4px; }
  .sidebar-brand { padding: 4px 0 12px; }
  .sidebar-brand img { max-width: 30px; max-height: 26px !important; object-fit: contain; }
  .nav-section { gap: 5px; }
  .nav-item { min-height: 38px; padding: 7px; border-radius: 8px; }
  .sidebar-footer { padding: 8px 2px; }
  .main { min-width: 0; }

  .pneus-view {
    gap: 12px;
    padding: 14px 10px 112px;
    overflow-x: hidden;
  }

  .pneus-view .page-head {
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 0;
  }

  .pneus-view .page-head h1 {
    max-width: 190px;
    font-size: 22px;
    line-height: 1.12;
  }

  .pneus-view .page-head .sub {
    max-width: 220px;
    font-size: 12.5px;
    line-height: 1.35;
  }

  .pneus-view .page-head .actions {
    margin-left: auto;
    padding-top: 42px;
  }

  .pneus-view .page-head .actions .btn {
    min-height: 36px;
    padding: 6px 10px;
    font-size: 12px;
  }

  .pneus-selector-card {
    padding: 12px;
    border-radius: 8px;
  }

  .pneus-selector-row { gap: 10px; }
  .pneus-vehicle-field { width: 100%; min-width: 0 !important; }
  .pneus-vehicle-field input { height: 38px !important; font-size: 12.5px !important; }
  .vehicle-info-chips { gap: 6px; }
  .chip { max-width: 100%; font-size: 11.5px; line-height: 1.15; overflow-wrap: anywhere; }

  .pneus-main-area {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .pneus-schematic-card {
    padding: 10px;
    margin-left: 0;
    margin-right: 0;
    border-radius: 8px;
    overflow-x: hidden;
    overflow-y: visible;
  }

  .truck-schematic,
  .vehicle-layout {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
  }

  .vehicle-layout-head {
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 12px;
  }

  .vehicle-nose {
    width: 38px;
    height: 32px;
    border-radius: 7px;
  }

  .vehicle-layout-title { font-size: 14px; }
  .vehicle-layout-sub { font-size: 11.5px; }

  .vehicle-body-frame {
    padding: 12px;
    gap: 16px;
    border-radius: 8px;
    background: linear-gradient(180deg, transparent 0, transparent 48%, var(--surface-2) 48%, var(--surface-2) 52%, transparent 52%);
  }

  .vehicle-section { gap: 10px; }
  .vehicle-section-title { padding-left: 2px; font-size: 11px; line-height: 1.15; }
  .vehicle-axles { gap: 14px; }

  .vehicle-axle-row {
    grid-template-columns: 1fr;
    grid-template-areas: "left" "center" "right";
    gap: 7px;
    padding: 3px 0 12px;
    border-bottom: 1px solid var(--divider);
  }

  .vehicle-axle-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .vehicle-side {
    min-width: 0;
    gap: 7px;
    justify-content: center;
    flex-wrap: wrap;
  }

  .vehicle-side-left { grid-area: left; justify-content: center; }
  .vehicle-side-right { grid-area: right; justify-content: center; }

  .vehicle-axle-center {
    grid-area: center;
    flex-direction: row;
    justify-content: center;
    gap: 7px;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
  }

  .vehicle-axle-line {
    width: 50px;
    height: 5px;
  }

  .vehicle-spares-section {
    grid-template-columns: 1fr;
    padding: 12px;
    text-align: center;
  }

  .vehicle-spares-grid { justify-content: center; }

  .pslot {
    width: min(112px, calc(50vw - 34px));
    min-width: 96px;
    max-width: 112px;
    min-height: 104px;
    padding: 7px;
    gap: 5px;
    border-radius: 8px;
  }

  .pslot-label {
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    word-break: keep-all;
    overflow-wrap: normal;
    hyphens: none;
  }

  .pslot-vazio {
    min-height: 70px;
    font-size: 12px;
  }

  .slot-tire-card {
    min-height: 76px;
    padding: 8px 8px 7px 9px;
    border-left-width: 5px;
  }

  .slot-tire-num {
    font-size: 18px;
    line-height: 1.05;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .slot-tire-meta {
    gap: 5px;
    margin-top: 6px;
  }

  .slot-tire-pos,
  .slot-tire-pct {
    min-height: 19px;
    padding: 2px 6px;
    font-size: 10.5px;
    line-height: 1;
    white-space: nowrap;
    word-break: keep-all;
    overflow-wrap: normal;
    hyphens: none;
  }

  .slot-tire-bar-wrap {
    height: 4px;
    margin-top: 7px;
  }

  .pneus-destinos-col {
    position: fixed;
    left: var(--sidebar-w, 44px);
    right: 0;
    bottom: 0;
    z-index: 180;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    padding: 7px 7px calc(7px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.12);
  }

  .pneus-destinos-col .destinos-label { display: none; }

  .pneus-destinos-col .dest-area {
    min-width: 0;
    min-height: 48px;
    padding: 6px 2px;
    flex-direction: column;
    gap: 3px;
    border-style: solid;
    font-size: 11px;
  }

  .pneus-destinos-col .dest-label {
    font-size: 10px;
    line-height: 1.1;
    white-space: nowrap;
  }
}

@media (max-width: 390px) {
  .pneus-view {
    padding-left: 8px;
    padding-right: 8px;
  }

  .pneus-schematic-card { padding: 8px; }
  .vehicle-body-frame { padding: 10px 8px; }

  .pslot {
    width: min(104px, calc(50vw - 30px));
    min-width: 92px;
    max-width: 104px;
  }

  .slot-tire-num { font-size: 17px; }

  .slot-tire-pos,
  .slot-tire-pct {
    padding-left: 5px;
    padding-right: 5px;
    font-size: 10px;
  }

  .pneus-destinos-col {
    gap: 4px;
    padding-left: 5px;
    padding-right: 5px;
  }

  .pneus-destinos-col .dest-label { font-size: 9.5px; }
}
