/* ════════════════════════════════════════════════════════════════════════════
   NOVA OPS UI · COMPONENTES
   Requer tokens.css carregado antes.

   Ordem: 1 primitivos · 2 shell · 3 painéis e KPIs · 4 veredito e sinais vivos
          5 listas e tabelas · 6 mapa · 7 carga (caminhão) · 8 formulários
          9 overlays · 10 páginas auxiliares · 11 responsivo
   ════════════════════════════════════════════════════════════════════════════ */

/* ══ 1 · PRIMITIVOS ═════════════════════════════════════════════════════════ */

.eyebrow { margin: 0 0 5px; color: var(--brand); font-size: 10px; font-weight: 850; letter-spacing: .15em; }
.eyebrow.light { color: #a8c7ff; }

/* Botões ─────────────────────────────────────────────────────────────────── */
.button {
  display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 9px;
  border: 1px solid transparent; border-radius: 13px; padding: 10px 17px; cursor: pointer;
  font-size: 13px; font-weight: 800; transition: transform .2s var(--ease), box-shadow .2s, background .2s;
}
.button svg { font-size: 17px; }
.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(0) scale(.98); }
.button:disabled { cursor: not-allowed; opacity: .65; transform: none; }
.button.primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-brand); }
.button.primary:hover { background: var(--brand-strong); }
.button.secondary { border-color: var(--border); background: #fff; box-shadow: var(--shadow-sm); color: var(--text); }
.button.secondary:hover, .button.tertiary:hover { background: var(--brand-soft); border-color: #cbd9fb; color: var(--brand-strong); }
.button.tertiary { border-color: var(--border); background: var(--surface-muted); }
.button.small { min-height: 36px; padding: 8px 13px; font-size: 12px; }
.button.large { min-height: 54px; border-radius: 15px; font-size: 14px; width: 100%; }
.button.loading::before {
  width: 17px; height: 17px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; content: ""; animation: spin .7s linear infinite;
}
.icon-button {
  display: inline-grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center;
  border: 1px solid var(--border); border-radius: 13px; background: #fff; color: var(--text-soft);
  cursor: pointer; transition: .2s var(--ease);
}
.icon-button:hover { border-color: #cbd9fb; background: var(--brand-soft); color: var(--brand); transform: translateY(-1px); }
.icon-button svg { font-size: 19px; }
.link-button, .text-button {
  padding: 0; background: transparent; color: var(--brand); cursor: pointer; font-size: 12px; font-weight: 800;
}
.link-button:hover, .text-button:hover { text-decoration: underline; }

/* Selos e pílulas ────────────────────────────────────────────────────────── */
.status-badge, .live-badge, .estimated-pill, .file-pill {
  display: inline-flex; align-items: center; gap: 6px; width: max-content; padding: 6px 10px;
  border-radius: 999px; font-size: 10px; font-style: normal; font-weight: 850; letter-spacing: .03em;
}
/* Prefira data-status. As classes de cor abaixo existem só para casos legados. */
.status-badge[data-status] { background: var(--tone-soft); color: var(--tone-ink); }
.status-badge[data-status] .pulse-dot { width: 7px; height: 7px; }
.status-badge.green  { background: var(--success-soft); color: #14825d; }
.status-badge.amber  { background: var(--warning-soft); color: #9a6517; }
.status-badge.blue   { background: var(--brand-soft);   color: var(--brand-strong); }
.status-badge.violet { background: var(--violet-soft);  color: #624bd0; }
.status-badge.red    { background: var(--danger-soft);  color: #ba3d4a; }
.live-badge { background: #e8f8f2; color: #18815f; letter-spacing: .08em; }
.live-badge i, .sync-pill > span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 0 4px rgba(39,185,133,.13); animation: pulse 2s infinite;
}
.estimated-pill { background: var(--warning-soft); color: #8c5b13; }
.file-pill { background: var(--danger-soft); color: #ba3d4a; }
.channel-chip {
  padding: 1px 5px; border-radius: 999px; background: var(--surface-muted);
  color: var(--text-soft); font-size: 7px; font-weight: 850; letter-spacing: .02em;
}
.metric-up { color: var(--success); font-size: 12px; font-weight: 850; }
kbd {
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; padding: 3px 6px;
  background: #fff; color: #7d899f; font-family: inherit; font-size: 9px; font-weight: 800;
}

/* Ícone de estatística ───────────────────────────────────────────────────── */
.stat-icon {
  display: inline-grid; width: 37px; height: 37px; flex: 0 0 37px; place-items: center;
  border-radius: 11px; font-size: 16px; font-style: normal; font-weight: 900;
}
.stat-icon[data-status] { background: var(--tone-soft); color: var(--tone-ink); }
.stat-icon.blue   { background: var(--brand-soft);   color: var(--brand); }
.stat-icon.green  { background: var(--success-soft); color: var(--success); }
.stat-icon.amber  { background: var(--warning-soft); color: var(--warning); }
.stat-icon.violet { background: var(--violet-soft);  color: var(--violet); }
.stat-icon.red    { background: var(--danger-soft);  color: var(--danger); }

/* Esqueleto de carregamento ──────────────────────────────────────────────── */
.skeleton { position: relative; overflow: hidden; border-radius: var(--radius-md); background: #e6ebf3; }
.skeleton::after {
  position: absolute; inset: 0; content: ""; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.68), transparent);
  animation: shimmer 1.4s infinite;
}
.kpi-skeleton { min-height: 127px; }
.cargo-skeleton { min-height: 320px; border-radius: 0; }
.trip-skeleton { min-height: 260px; border-radius: 0; }

/* Barra de progresso fina (herda --tone) ─────────────────────────────────── */
.micro-progress { height: 4px; overflow: hidden; border-radius: 99px; background: #e6ebf3; }
.micro-progress i {
  display: block; width: 100%; height: 100%; border-radius: inherit; background: var(--tone, var(--brand));
  clip-path: inset(0 calc(100% - var(--progress)) 0 0); transition: clip-path .6s var(--ease);
}

/* Explicação em linguagem comum: um indicador não deveria exigir domínio do
   jargão para ser entendido. */
.plain { margin: 4px 0 0; color: var(--text-soft); font-size: 10px; line-height: 1.35; }
.has-hint { position: relative; }
.has-hint > .hint {
  position: absolute; z-index: 40; bottom: calc(100% + 9px); left: 0; width: max-content; max-width: 250px;
  padding: 9px 11px; border-radius: 10px; background: var(--navy); color: #fff; font-size: 10px;
  font-weight: 600; line-height: 1.4; opacity: 0; pointer-events: none; transform: translateY(4px);
  transition: .18s var(--ease);
}
.has-hint:hover > .hint, .has-hint:focus-within > .hint { opacity: 1; transform: none; }

/* Sinais de vida ─────────────────────────────────────────────────────────── */
.value-changed { border-radius: 7px; animation: value-changed 1.6s var(--ease); }
.pulse-dot { position: relative; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--tone); }
.pulse-dot::after {
  position: absolute; inset: 0; border-radius: 50%; background: var(--tone); content: "";
  animation: pulse-out 2.2s ease-out infinite;
}
[data-status="critical"] .pulse-dot::after { animation-duration: 1.2s; }
[data-status="neutral"] .pulse-dot::after { animation: none; }

/* Entrada em cascata: dá a leitura de "o painel está montando os dados", em vez
   de tudo aparecer de uma vez sem hierarquia. */
.stagger > * { animation: card-in .45s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .08s; }
.stagger > *:nth-child(3) { animation-delay: .14s; }
.stagger > *:nth-child(4) { animation-delay: .2s; }
.stagger > *:nth-child(5) { animation-delay: .26s; }
.stagger > *:nth-child(6) { animation-delay: .32s; }
.stagger > *:nth-child(7) { animation-delay: .38s; }
.stagger > *:nth-child(8) { animation-delay: .44s; }

/* ══ 2 · SHELL DA APLICAÇÃO ═════════════════════════════════════════════════ */

.app-page { min-height: 100vh; min-height: 100dvh; }

.app-sidebar {
  position: fixed; z-index: 100; top: 14px; bottom: 14px; left: 14px; display: flex; width: var(--sidebar);
  flex-direction: column; align-items: center; padding: 15px 10px; border-radius: 25px;
  background: linear-gradient(180deg, #111d40, #0c1633); box-shadow: 0 18px 50px rgba(10,22,51,.25);
}
.sidebar-brand { display: grid; place-items: center; margin-bottom: 18px; }
.sidebar-nav { display: flex; width: 100%; flex: 1; flex-direction: column; gap: 4px; overflow-y: auto; scrollbar-width: none; }
.sidebar-nav::-webkit-scrollbar { display: none; }
.nav-item {
  position: relative; display: flex; width: 100%; min-height: 52px; align-items: center; justify-content: center;
  border-radius: 14px; background: transparent; color: #8290b5; cursor: pointer; transition: .2s var(--ease);
}
.nav-item svg { font-size: 20px; }
.nav-item > span { display: none; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; box-shadow: 0 10px 23px rgba(45,99,246,.38); }
/* A sidebar é só de ícones; o rótulo aparece no hover, via data-tooltip. */
.nav-item::after {
  position: absolute; left: calc(100% + 14px); z-index: 120; padding: 7px 10px; border-radius: 8px;
  background: var(--navy); color: #fff; content: attr(data-tooltip); font-size: 10px; font-weight: 800;
  opacity: 0; pointer-events: none; transform: translateX(-5px); transition: .16s; white-space: nowrap;
}
.nav-item:hover::after { opacity: 1; transform: translateX(0); }
.sidebar-footer { display: flex; width: 100%; flex-direction: column; gap: 7px; }
.sidebar-avatar, .avatar {
  display: grid; place-items: center; border-radius: 50%;
  background: linear-gradient(145deg, #e9b292, #b96f51); color: #fff; font-weight: 900;
}
.sidebar-avatar { width: 45px; height: 45px; margin: 6px auto 0; border: 3px solid rgba(255,255,255,.16); cursor: pointer; font-size: 12px; }

.app-main { min-height: 100vh; min-height: 100dvh; margin-left: calc(var(--sidebar) + 28px); padding: 14px 26px 45px 8px; }

.app-topbar {
  position: sticky; z-index: 80; top: 10px; display: flex; min-height: 68px; align-items: center;
  justify-content: space-between; gap: 20px; margin-bottom: 25px; padding: 10px 13px 10px 21px;
  border: 1px solid rgba(226,232,242,.8); border-radius: 20px; background: rgba(255,255,255,.88);
  box-shadow: var(--shadow-sm); backdrop-filter: blur(15px);
}
.page-context { display: flex; align-items: center; gap: 12px; }
.page-context p { margin: 0 0 2px; color: var(--text-soft); font-size: 8px; font-weight: 850; letter-spacing: .14em; }
.page-context h1 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.mobile-back { display: none; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.search-trigger {
  display: flex; width: clamp(215px, 24vw, 360px); min-height: 42px; align-items: center; gap: 10px;
  padding: 0 10px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-muted);
  color: #939eb1; cursor: pointer; text-align: left;
}
.search-trigger svg { font-size: 16px; }
.search-trigger span { flex: 1; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
/* Selo de sincronia: mostra a IDADE REAL do payload e funciona como botão de
   recarregar. Nunca troque só o texto do relógio: isso sugere dado fresco que
   nunca foi buscado. */
.sync-pill {
  display: flex; align-items: center; gap: 8px; padding: 0 8px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text-soft); cursor: pointer; white-space: nowrap; transition: .2s var(--ease);
}
.sync-pill:hover { background: var(--surface-muted); }
.sync-pill b { font-size: 9px; }
.sync-pill.is-stale { color: var(--danger); }
.sync-pill.is-stale > span { background: var(--danger); }
.notification-button { position: relative; }
.notification-button > span {
  position: absolute; top: -4px; right: -3px; display: grid; width: 18px; height: 18px; place-items: center;
  border: 2px solid #fff; border-radius: 50%; background: var(--danger); color: #fff; font-size: 8px; font-weight: 900;
}
.notification-button span[hidden] { display: none; }
.topbar-profile { display: flex; align-items: center; gap: 9px; padding: 4px 7px 4px 4px; border-radius: 13px; background: transparent; cursor: pointer; text-align: left; }
.topbar-profile:hover { background: var(--surface-muted); }
.topbar-profile .avatar, .popover-user .avatar { width: 36px; height: 36px; font-size: 10px; }
.topbar-profile strong, .topbar-profile small { display: block; }
.topbar-profile strong { max-width: 130px; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.topbar-profile small { color: var(--text-soft); font-size: 8px; }
.topbar-profile i { color: var(--text-soft); font-size: 11px; font-style: normal; }
.mobile-bar, .mobile-nav { display: none; }

/* Views e sub-navegação ──────────────────────────────────────────────────── */
.app-view { display: none; animation: enter .42s var(--ease); }
.app-view.active { display: block; }
.hero-row, .view-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 4px 2px 23px; }
.hero-row h2, .view-heading h2 { margin: 0; font-size: clamp(24px, 2.3vw, 35px); letter-spacing: -.035em; line-height: 1.1; }
.hero-row p, .view-heading > div > p:last-child { margin: 7px 0 0; color: var(--text-soft); font-size: 12px; }
.hero-row p strong { color: var(--danger); }
.hero-actions, .view-actions { display: flex; align-items: center; gap: 9px; }

/* Sub-navegação ÚNICA: uma só barra em todas as seções. Não conviva com
   segmented, cartões-atalho e abas ao mesmo tempo — três padrões de navegação
   na mesma tela é o que a folha original passou a limpo. */
.view-tabs {
  display: flex; gap: 6px; align-items: center; max-width: 100%; margin-bottom: 18px; padding: 5px;
  overflow-x: auto; scrollbar-width: none; border: 1px solid var(--border); border-radius: 15px;
  background: rgba(255,255,255,.72); backdrop-filter: blur(6px);
}
.view-tabs::-webkit-scrollbar { display: none; }
.view-tabs > button[role="tab"] {
  min-height: 38px; padding: 8px 16px; border-radius: 11px; background: transparent; color: var(--text-soft);
  cursor: pointer; white-space: nowrap; font-size: 11px; font-weight: 800; transition: .2s var(--ease);
}
.view-tabs > button[role="tab"]:hover { background: var(--surface-muted); color: var(--text); }
.view-tabs > button[role="tab"].active { background: var(--navy); color: #fff; box-shadow: 0 8px 20px rgba(17,29,64,.2); }
.view-tabs-actions { margin-left: auto; padding-left: 10px; }
.view-tabs-actions .button { white-space: nowrap; }
.subview { display: none; animation: enter .3s var(--ease); }
.subview.active { display: block; }
.subview.panel.active { display: flex; flex-direction: column; }

/* Segmentado: filtro DENTRO de um painel, nunca navegação de página. */
.segmented { display: inline-flex; align-items: center; padding: 4px; border-radius: 10px; background: var(--surface-muted); }
.segmented button { min-height: 29px; padding: 5px 10px; border-radius: 8px; background: transparent; color: var(--text-soft); cursor: pointer; font-size: 9px; font-weight: 800; }
.segmented button.active { background: #fff; color: var(--brand); box-shadow: 0 3px 9px rgba(25,42,77,.08); }

/* ══ 3 · PAINÉIS E KPIs ═════════════════════════════════════════════════════ */

.panel {
  border: 1px solid rgba(225,231,241,.82); border-radius: var(--radius-md);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 18px 19px 15px; }
.panel-heading.compact { align-items: center; }
.panel-heading h3, .table-heading h3 { margin: 0; font-size: 14px; letter-spacing: -.015em; }
.panel-heading p, .table-heading p { margin: 4px 0 0; color: var(--text-soft); font-size: 10px; }
.heading-line { display: flex; align-items: center; gap: 9px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 17px; }

/* KPI dirigido pela SITUAÇÃO: faixa superior na cor do estado, número em
   tabular-nums (não treme durante a contagem) e uma frase em linguagem comum. */
.kpi-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  border-top: 3px solid var(--tone); padding: 17px 17px 15px;
  transition: transform .2s var(--ease), box-shadow .2s;
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
/* Círculo decorativo: fica ATRÁS do conteúdo e nunca corta a frase. */
.kpi-card::after {
  position: absolute; right: -25px; bottom: -42px; width: 100px; height: 100px; border-radius: 50%;
  background: var(--tone-soft); content: ""; opacity: .4;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-head { display: flex; align-items: center; gap: 7px; }
.kpi-delta { display: flex; align-items: center; gap: 5px; color: var(--tone-ink); font-size: 9px; font-weight: 800; }
.kpi-value {
  position: relative; z-index: 2; margin: 12px 0 1px; margin-top: auto;
  font-size: 27px; font-weight: 900; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums;
}
.kpi-value small { margin-left: 3px; color: var(--text-soft); font-size: 12px; }
.kpi-label {
  position: relative; z-index: 2; color: var(--text-soft); font-size: 9px; font-weight: 800;
  letter-spacing: .035em; text-transform: uppercase;
}
.kpi-card .plain { position: relative; z-index: 2; min-height: 2.7em; }

/* Cartões de estatística em linha ────────────────────────────────────────── */
.status-summary, .client-insights { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.status-summary { grid-template-columns: repeat(4, 1fr); }
.fleet-status-card { display: flex; align-items: center; gap: 12px; padding: 15px; }
.fleet-status-card p { margin: 0; }
.fleet-status-card small { display: block; color: var(--text-soft); font-size: 8px; font-weight: 800; text-transform: uppercase; }
.fleet-status-card strong { font-size: 20px; }
.insight-card { display: flex; align-items: center; gap: 12px; padding: 16px; }
.insight-card div small, .insight-card div strong, .insight-card div p { display: block; margin: 0; }
.insight-card div small { color: var(--text-soft); font-size: 8px; text-transform: uppercase; }
.insight-card div strong { margin: 2px 0; font-size: 14px; }
.insight-card div p { color: var(--text-soft); font-size: 8px; }

.executive-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.executive-kpi { display: flex; min-width: 0; align-items: center; gap: 12px; padding: 15px; }
.executive-kpi-icon { display: grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; border-radius: 13px; background: var(--tone-soft); color: var(--tone); }
.executive-kpi-icon svg { width: 19px; height: 19px; }
.executive-kpi > div { min-width: 0; }
.executive-kpi small { color: var(--text-soft); font-size: 8px; font-weight: 800; text-transform: uppercase; }
.executive-kpi strong { display: block; margin: 4px 0 2px; overflow: hidden; font-size: 20px; letter-spacing: -.03em; text-overflow: ellipsis; white-space: nowrap; }
.executive-kpi div > span { color: var(--tone); font-size: 8px; font-weight: 800; }

/* Grades de conteúdo ─────────────────────────────────────────────────────── */
.command-grid, .operations-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(315px, .75fr); gap: 17px; align-items: stretch; }
.right-stack { display: flex; flex-direction: column; gap: 17px; }
.right-stack > .panel { min-height: 0; }
.bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; margin-top: 17px; align-items: start; }
.executive-grid { display: grid; grid-template-columns: repeat(3, 1fr); align-items: stretch; gap: 16px; }
.span-2 { grid-column: span 2; }
.chart { width: 100%; min-height: 305px; }
.chart-short { min-height: 205px; }
.chart-panel { overflow: hidden; }

/* ══ 4 · VEREDITO E LEITURA DE 3 SEGUNDOS ═══════════════════════════════════
   Primeira coisa da página. Responde "está tudo bem?" antes de qualquer número,
   em uma frase e uma cor. */

.command-head { display: flex; align-items: stretch; gap: 14px; margin-bottom: 13px; }
.command-head > .verdict { flex: 1; min-width: 0; margin-bottom: 0; }
.command-head > .hero-actions { display: flex; align-items: center; gap: 10px; }

.verdict {
  display: grid; align-items: center; gap: clamp(12px, 1.2vw, 22px);
  grid-template-columns: auto minmax(0, 1fr) auto; margin-bottom: 17px;
  padding: clamp(14px, 1.1vw, 22px) clamp(16px, 1.3vw, 26px);
  border: 1px solid color-mix(in srgb, var(--tone) 28%, transparent);
  border-left: 5px solid var(--tone); border-radius: var(--radius-md);
  background: linear-gradient(100deg, var(--tone-soft), color-mix(in srgb, var(--tone-soft) 35%, #fff));
  animation: verdict-in .5s var(--ease) both;
}
.verdict-mark {
  display: grid; width: clamp(40px, 3vw, 54px); height: clamp(40px, 3vw, 54px);
  place-items: center; border-radius: 15px; background: var(--tone); color: #fff;
  font-size: clamp(19px, 1.4vw, 25px); font-weight: 900;
}
.verdict-copy strong { display: block; color: var(--tone-ink); font-size: clamp(15px, 1.1vw, 21px); letter-spacing: -.02em; }
.verdict-copy p { margin: 3px 0 0; color: var(--text-soft); font-size: var(--ui-sm, 12px); }
.verdict-meta { display: flex; gap: clamp(10px, 1vw, 24px); }
.verdict-meta > div { text-align: right; }
.verdict-meta small { display: block; color: var(--text-soft); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.verdict-meta strong { font-size: clamp(15px, 1.1vw, 22px); }
/* O crítico é o ÚNICO estado que se move: movimento rouba atenção sem depender
   de leitura. Se tudo pulsar, nada significa nada. */
.verdict[data-status="critical"] .verdict-mark { animation: pulse-ring 1.9s ease-out infinite; }

/* Anel de progresso: "quanto do prometido já foi entregue". ──────────────── */
.progress-ring { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: clamp(14px, 1.2vw, 26px); }
.ring {
  position: relative; display: grid; width: clamp(96px, 7vw, 136px); aspect-ratio: 1; place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--tone) calc(var(--value, 0) * 1%), var(--neutral-soft) 0);
  transition: background 1s var(--ease);
}
.ring::after { position: absolute; inset: 11%; border-radius: 50%; background: var(--surface); content: ""; }
.ring > div { position: relative; z-index: 1; text-align: center; }
.ring strong { display: block; color: var(--tone-ink); font-size: clamp(20px, 1.6vw, 30px); letter-spacing: -.04em; }
.ring small { color: var(--text-soft); font-size: 9px; font-weight: 800; }

/* ══ 5 · LISTAS, TABELAS E FEED ═════════════════════════════════════════════ */

/* Viagem/registro em destaque ────────────────────────────────────────────── */
.active-trip-card { overflow: hidden; }
.active-trip-top { padding: 18px 18px 15px; background: linear-gradient(145deg, var(--navy), #20366e); color: #fff; }
.active-trip-top header { display: flex; align-items: flex-start; justify-content: space-between; }
.active-trip-top small { display: block; color: #9fb0d3; font-size: 8px; font-weight: 800; letter-spacing: .08em; }
.active-trip-top h3 { margin: 3px 0 0; font-size: 17px; }
.active-trip-route { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 7px; margin-top: 17px; }
.active-trip-route div:last-child { text-align: right; }
.active-trip-route p { margin: 0; font-size: 9px; font-weight: 800; }
.active-trip-route span { color: #8fa3cb; font-size: 7px; }
.active-trip-route i { position: relative; width: 45px; height: 1px; background: #5b709d; }
.active-trip-route i::after { position: absolute; right: 0; top: -2px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); content: ""; }
.active-trip-progress { margin-top: 16px; }
.active-trip-progress > div { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 8px; }
.active-trip-progress strong { color: var(--accent); }
.active-trip-progress .micro-progress { background: rgba(255,255,255,.13); }
.active-trip-progress .micro-progress i { background: linear-gradient(90deg, var(--brand), var(--accent)); }
.trip-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 8px; padding: 15px 18px; }
.trip-detail-grid small, .trip-detail-grid strong { display: block; }
.trip-detail-grid small { margin-bottom: 2px; color: var(--text-soft); font-size: 7px; font-weight: 750; text-transform: uppercase; }
.trip-detail-grid strong { font-size: 10px; }
.trip-card-action { display: flex; gap: 8px; padding: 0 18px 17px; }
.trip-card-action .button { flex: 1; min-height: 36px; font-size: 10px; }

/* Linha do tempo e alertas ───────────────────────────────────────────────── */
.activity-panel { overflow: hidden; }
.timeline-list { overflow: auto; padding: 0 18px 10px; }
.timeline-item { display: grid; grid-template-columns: 30px 1fr auto; gap: 9px; padding: 10px 0; border-top: 1px solid var(--border); }
.timeline-icon { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 9px; background: var(--tone-soft); color: var(--tone); font-size: 11px; font-weight: 900; }
.timeline-item strong, .timeline-item small { display: block; }
.timeline-item strong { font-size: 9px; }
.timeline-item small { max-width: 210px; margin-top: 2px; overflow: hidden; color: var(--text-soft); font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.timeline-item time { color: var(--text-soft); font-size: 7px; }
.alert-row { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 10px 18px; border-top: 1px solid var(--border); }
.alert-row .alert-symbol { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 10px; background: var(--tone-soft); color: var(--tone); font-size: 12px; font-weight: 900; }
.alert-row strong, .alert-row small { display: block; }
.alert-row strong { font-size: 9px; }
.alert-row small { margin-top: 2px; color: var(--text-soft); font-size: 7px; }
.alert-row time { color: var(--text-soft); font-size: 7px; }

/* Feed unificado: pendências + eventos num painel só. Dois painéis separados
   custam dois cabeçalhos e um vão, e as listas acabam com rolagem interna —
   informação escondida dentro de um cartão de 130px é pior que ausente. */
.live-feed { display: flex; flex-direction: column; overflow: hidden; }
.live-feed-body { display: flex; min-height: 0; flex: 1; flex-direction: column; }
.live-feed-block { display: flex; min-height: 0; flex-direction: column; }
.live-feed-block + .live-feed-block { border-top: 1px solid var(--border); }
.live-feed-label {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin: 0; padding: 10px 18px 4px; color: var(--text-soft);
  font-size: 8px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase;
}
.live-feed-label .link-button { font-size: 8px; letter-spacing: 0; text-transform: none; }
.live-feed .timeline-list { padding: 0 18px 8px; }
.live-feed-actions { display: inline-flex; align-items: baseline; gap: 8px; }
.live-feed-actions b:empty { display: none; }
.live-feed-actions b {
  padding: 1px 6px; border-radius: 999px; background: var(--surface-muted);
  color: var(--text-soft); font-size: 8px; font-weight: 850; letter-spacing: 0;
}

/* Kanban de eventos: colunas que avançam sozinhas a cada refresh. Cada coluna
   rola dentro de si, em vez de esconder cartões sem avisar. */
.event-kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 18px 10px; min-height: 0; }
.kanban-column { display: flex; min-height: 0; flex-direction: column; gap: 4px; }
.kanban-column > header { color: var(--text-soft); font-size: 7px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.kanban-column-body { display: flex; flex-direction: column; gap: 5px; max-height: 190px; overflow: auto; }
.kanban-card { border-left: 2px solid var(--tone, var(--border)); border-radius: 8px; background: var(--surface-muted); padding: 6px 8px; }
.kanban-card strong { display: block; overflow: hidden; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.kanban-card small { display: block; margin-top: 2px; overflow: hidden; color: var(--text-soft); font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.kanban-column-empty { padding: 6px 0; color: var(--text-soft); font-size: 7px; }

/* Barra de filtros ───────────────────────────────────────────────────────── */
.filter-bar { display: grid; grid-template-columns: minmax(230px, 1.5fr) repeat(2, minmax(150px, .65fr)) auto; align-items: end; gap: 12px; margin-bottom: 16px; padding: 14px; }
.search-field .input-wrap svg { font-size: 15px; }
.search-field input { background: var(--surface-muted); }
.search-field.compact { width: min(300px, 100%); }
.filter-chips { display: flex; gap: 6px; margin: 11px 0; }
.filter-chips button { padding: 7px 9px; border-radius: 9px; background: var(--surface-muted); color: var(--text-soft); cursor: pointer; font-size: 8px; font-weight: 800; }
.filter-chips button.active { background: var(--brand-soft); color: var(--brand); }
/* Contagem real dentro do chip — nunca um chip sem número. */
.filter-chips button span, .drawer-filters button span {
  display: inline-block; margin-left: 4px; padding: 1px 5px; border-radius: 999px;
  background: rgba(17,29,64,.08); font-size: inherit;
}

/* Tabelas ────────────────────────────────────────────────────────────────── */
.table-panel { overflow: hidden; }
.table-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.table-heading-actions { display: flex; align-items: center; gap: 10px; }
.table-heading-actions .button { white-space: nowrap; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { padding: 11px 15px; background: #fafbfd; color: #8490a7; font-size: 8px; font-weight: 850; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
td { padding: 13px 15px; border-top: 1px solid var(--border); font-size: 10px; }
tbody tr { transition: background .15s; }
.table-panel tbody tr:hover { background: #fafcff; }
td strong, .table-sub { display: block; }
.table-sub { margin-top: 2px; color: var(--text-soft); font-size: 8px; }
.person-cell { display: flex; align-items: center; gap: 8px; }
.mini-avatar { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-size: 9px; font-weight: 900; }
.table-inline-select { padding: 5px 7px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); font-size: 9px; }
.route-cell { min-width: 155px; }
.route-cell span { color: var(--text-soft); }
.progress-cell { min-width: 130px; }
.progress-cell > div:first-child { display: flex; justify-content: space-between; margin-bottom: 5px; }
.progress-cell b { font-size: 9px; }
.progress-cell span { color: var(--text-soft); font-size: 8px; }
.row-action { width: 31px; height: 31px; border-radius: 9px; background: var(--surface-muted); color: var(--text-soft); cursor: pointer; font-weight: 900; }
.row-action:hover { background: var(--brand-soft); color: var(--brand); }

/* Estado vazio ───────────────────────────────────────────────────────────── */
.empty-state { padding: 50px 20px; text-align: center; }
.empty-state > span { display: grid; width: 50px; height: 50px; margin: auto; place-items: center; border-radius: 16px; background: var(--brand-soft); color: var(--brand); font-size: 24px; }
.empty-state h3 { margin: 14px 0 4px; }
.empty-state p { margin: 0; color: var(--text-soft); font-size: 11px; }
.empty-state.compact { padding: 34px 20px; }
.empty-state.compact h3 { margin: 6px 0 2px; }

/* Ranking ────────────────────────────────────────────────────────────────── */
.ranking-panel { display: flex; overflow: hidden; flex-direction: column; }
.ranking-table > div { display: grid; grid-template-columns: 30px minmax(0, 1fr) 105px 110px; align-items: center; gap: 10px; padding: 13px 18px; border-top: 1px solid var(--border); }
.ranking-table > div > span { color: #a2acbc; font-size: 11px; font-weight: 900; }
.ranking-table p { margin: 0; }
.ranking-table strong, .ranking-table small { display: block; }
.ranking-table strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.ranking-table small { color: var(--text-soft); font-size: 8px; }
.ranking-table b { color: var(--success); font-size: 9px; }
.ranking-table em { color: var(--text-soft); font-size: 8px; font-style: normal; }

/* Cartões de relatório / atalho ──────────────────────────────────────────── */
.report-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.report-card { display: grid; grid-template-columns: 45px 1fr 36px; align-items: center; gap: 12px; padding: 16px; transition: .2s; }
.report-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.report-icon { display: grid; width: 45px; height: 45px; place-items: center; border-radius: 13px; font-size: 11px; font-weight: 900; }
.report-icon.blue { background: var(--brand-soft); color: var(--brand); }
.report-icon.green { background: var(--success-soft); color: var(--success); }
.report-icon.violet { background: var(--violet-soft); color: var(--violet); }
.report-icon.amber { background: var(--warning-soft); color: var(--warning); }
.report-icon.red { background: var(--danger-soft); color: var(--danger); }
.report-icon.navy { background: var(--navy); color: #fff; }
.report-card h3, .report-card p { margin: 0; }
.report-card h3 { font-size: 11px; }
.report-card p, .report-card small { display: block; color: var(--text-soft); font-size: 8px; }
.report-card p { margin: 3px 0 5px; }

/* ══ 6 · MAPA ═══════════════════════════════════════════════════════════════ */

.map-panel { display: flex; flex-direction: column; overflow: hidden; }
.map-panel > .map-stage { flex: 1; min-height: 340px; }
.map-panel > .map-stage > .map-canvas { height: 100%; min-height: 340px; }
.map-stage { position: relative; margin: 0 12px; overflow: hidden; border-radius: 16px; }
.map-canvas { min-height: 330px; background: #dfe8ef; }

/* Fallback puramente CSS: a área nunca fica em branco enquanto o mapa carrega
   nem quando ele falha. */
.map-fallback { position: absolute; inset: 0; overflow: hidden; background: linear-gradient(145deg, #e4eaf0, #d6e4e7); }
.map-fallback::before {
  position: absolute; inset: -20%; content: "";
  background-image: linear-gradient(27deg, transparent 45%, rgba(255,255,255,.9) 46%, rgba(255,255,255,.9) 49%, transparent 50%),
                    linear-gradient(-32deg, transparent 44%, rgba(255,255,255,.8) 45%, rgba(255,255,255,.8) 48%, transparent 49%);
  background-size: 130px 100px, 180px 150px;
}
.fallback-road { position: absolute; width: 130%; height: 14px; border: 4px solid #fff; background: #c9d3d8; transform-origin: left; }
.road-one { top: 60%; left: -10%; transform: rotate(-16deg); }
.road-two { top: 15%; left: 22%; transform: rotate(60deg); }
.fallback-route { position: absolute; left: 11%; top: 60%; width: 74%; height: 4px; border-radius: 99px; background: var(--brand); transform: rotate(-17deg); box-shadow: 0 0 0 2px #fff; }
.fallback-pin { position: absolute; width: 15px; height: 15px; border: 3px solid #fff; border-radius: 50%; background: var(--brand); box-shadow: 0 3px 10px rgba(25,42,77,.3); }
.pin-one { left: 12%; top: 69%; }
.pin-two { right: 14%; top: 29%; background: var(--success); }

.map-legend { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 12px; padding: 8px 10px; border: 1px solid rgba(255,255,255,.8); border-radius: 10px; background: rgba(255,255,255,.9); box-shadow: var(--shadow-sm); backdrop-filter: blur(8px); font-size: 8px; font-weight: 750; }
.map-legend span { display: flex; align-items: center; gap: 5px; }
.map-legend i { width: 6px; height: 6px; border-radius: 50%; }
i.green { background: var(--success); } i.amber { background: var(--warning); } i.violet { background: var(--violet); }
.map-provider { position: absolute; top: 12px; left: 12px; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid rgba(255,255,255,.8); border-radius: 10px; background: rgba(255,255,255,.92); box-shadow: var(--shadow-sm); }
.provider-icon { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 8px; background: var(--warning-soft); color: var(--warning); font-weight: 900; }
.map-provider strong, .map-provider small { display: block; }
.map-provider strong { font-size: 9px; }
.map-provider small { color: var(--text-soft); font-size: 7px; }
.map-expand { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; }
.maplibregl-ctrl-logo { opacity: .45; }
.maplibregl-ctrl-attrib { font-size: 8px !important; }

/* Marcadores. O que precisa de decisão PULSA; o resto fica quieto. */
.truck-marker, .headquarters-marker {
  position: relative; display: grid; width: 38px; height: 38px; place-items: center; padding: 0;
  border: 3px solid var(--surface); border-radius: 12px; background: var(--brand); color: var(--surface);
  box-shadow: 0 5px 14px rgba(25,42,77,.25); cursor: pointer;
  transition: background .2s var(--ease), box-shadow .2s var(--ease);
}
.marker-glyph { display: grid; width: 22px; height: 22px; place-items: center; transition: transform .2s var(--ease); }
.marker-glyph svg { width: 100%; height: 100%; }
.truck-marker:hover .marker-glyph, .truck-marker.selected .marker-glyph, .headquarters-marker:hover .marker-glyph { transform: scale(1.14); }
.truck-marker.selected { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent), 0 7px 18px rgba(25,42,77,.28); }
.truck-marker[data-status] { background: var(--tone); }
.truck-marker[data-status="attention"]::before,
.truck-marker[data-status="critical"]::before {
  position: absolute; inset: 0; border-radius: inherit; background: var(--tone); content: "";
  animation: pulse-out 2s ease-out infinite;
}
.truck-marker[data-status="critical"]::before { animation-duration: 1.2s; }
.truck-marker > * { position: relative; z-index: 1; }
.headquarters-marker { z-index: 5; width: 42px; height: 42px; border-radius: 14px; background: var(--navy); }
.headquarters-marker em {
  position: absolute; top: calc(100% + 5px); padding: 3px 7px; border-radius: 7px;
  background: var(--navy); color: var(--surface); box-shadow: var(--shadow-sm);
  font-size: 8px; font-style: normal; font-weight: 850; white-space: nowrap;
}

/* Faixa e cartões de frota ───────────────────────────────────────────────── */
.fleet-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: 12px; border-top: 1px solid var(--border); background: var(--border); }
.fleet-mini { padding: 12px 13px; background: #fff; cursor: pointer; transition: background .2s; }
.fleet-mini:hover, .fleet-mini.active { background: var(--brand-soft); }
.fleet-mini-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.fleet-mini strong { font-size: 10px; }
.fleet-mini .status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tone); }
.fleet-mini p { margin: 4px 0; color: var(--text-soft); font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.occupancy-meter { display: flex; align-items: center; gap: 6px; }
.occupancy-meter .micro-progress { flex: 1; }
.occupancy-meter span { min-width: 30px; color: var(--text-soft); font-size: 8px; text-align: right; }

.map-page-grid { display: grid; grid-template-columns: 330px 1fr; gap: 16px; }
.vehicle-browser { max-height: 675px; overflow: hidden; padding: 14px; }
.vehicle-list { height: 565px; overflow: auto; }
.vehicle-card { display: grid; grid-template-columns: 38px 1fr auto; gap: 9px; margin-bottom: 7px; padding: 11px; border: 1px solid var(--border); border-radius: 13px; cursor: pointer; transition: .18s; }
.vehicle-card:hover, .vehicle-card.active { border-color: #bfd0ff; background: var(--brand-soft); transform: translateX(2px); }
.vehicle-card .vehicle-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 11px; background: #fff; color: var(--tone); box-shadow: var(--shadow-sm); }
.vehicle-card strong, .vehicle-card small { display: block; }
.vehicle-card strong { font-size: 10px; }
.vehicle-card small { color: var(--text-soft); font-size: 8px; }
.vehicle-card em { color: var(--tone); font-size: 8px; font-style: normal; font-weight: 850; }
.map-full-panel { position: relative; overflow: hidden; padding: 10px; }
.map-full { min-height: 655px; border-radius: 15px; }
.map-floating-stats { position: absolute; top: 22px; left: 22px; display: flex; gap: 6px; }
.map-floating-stats > div { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 11px; background: rgba(255,255,255,.94); box-shadow: var(--shadow-sm); }
.map-floating-stats .stat-icon { width: 30px; height: 30px; flex-basis: 30px; }
.map-floating-stats small, .map-floating-stats strong { display: block; }
.map-floating-stats small { color: var(--text-soft); font-size: 6px; text-transform: uppercase; }
.map-floating-stats strong { font-size: 12px; }

/* ══ 7 · PAINEL DE CARGA (caminhão) ═════════════════════════════════════════
   A peça mais autoral do sistema: foto do veículo em corte, malha de zonas do
   baú desenhada por cima em porcentagem do artboard, e manifesto ao lado.
   O texto escala pela largura do PRÓPRIO painel (container query), não pela
   janela — com vw o mesmo painel recebia fontes diferentes conforme a coluna. */

.app-cargo-panel { margin-bottom: 17px; overflow: hidden; container-type: inline-size; container-name: cargo; }
.cargo-panel-heading {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: clamp(16px, 1.25vw, 25px) clamp(18px, 1.45vw, 30px); border-bottom: 1px solid var(--border);
}
.cargo-panel-heading > div { min-width: 0; }
.cargo-panel-heading .eyebrow { color: var(--brand); }
.cargo-panel-heading h3 { margin: .2em 0 .08em; overflow: hidden; font-size: clamp(18px, 1.35vw, 28px); letter-spacing: -.04em; text-overflow: ellipsis; white-space: nowrap; }
.cargo-panel-heading p { margin: 0; overflow: hidden; color: var(--text-soft); font-size: clamp(10px, .72vw, 15px); text-overflow: ellipsis; white-space: nowrap; }
.cargo-panel-heading > .status-badge { flex: none; white-space: nowrap; }
.cargo-panel-body { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(350px, .72fr); min-height: clamp(280px, 23vw, 410px); }

.cargo-truck-stage { position: relative; min-width: 0; overflow: hidden; background: radial-gradient(circle at 50% 60%, #fff 0, #f6f9ff 48%, #edf3fd 100%); }
/* Área tracejada com a malha do baú ao fundo, atrás da foto. */
.cargo-truck-stage::before {
  position: absolute; inset: 12% 7% 17% 28%; border: 1px dashed #cad8f4; border-radius: 20px;
  background-image: linear-gradient(90deg, transparent 49.5%, rgba(45,99,246,.08) 50%),
                    linear-gradient(transparent 49.5%, rgba(45,99,246,.08) 50%);
  background-size: 25% 50%; content: "";
}
/* Sombra de contato sob o veículo. */
.cargo-truck-stage::after {
  position: absolute; right: 10%; bottom: 8%; left: 10%; height: 9%; border-radius: 50%;
  background: rgba(26,45,78,.14); filter: blur(18px); content: "";
}
.cargo-truck-artboard { position: absolute; z-index: 2; top: 50%; left: 50%; width: 72%; aspect-ratio: 1706 / 863; transform: translate(-50%, -48%); }
.cargo-truck-artboard > img { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 16px 10px rgba(23,42,75,.13)); }
/* Malha de 5×2 zonas alinhada ao baú da foto. Os percentuais são calibrados
   para truck-cutaway-v1.png — trocar a foto exige recalibrar. */
.cargo-load-map {
  position: absolute; z-index: 3; top: 27.35%; right: 6.9%; bottom: 32.45%; left: 37.75%;
  display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(2, 1fr);
  column-gap: 1.55%; row-gap: 10.8%; pointer-events: none;
}
.cargo-load-cell {
  position: relative; display: flex; min-width: 0; flex-direction: column; align-items: center;
  justify-content: center; overflow: hidden; color: var(--brand-strong); text-align: center;
}
/* Halo branco: o texto fica legível sobre qualquer região da foto. */
.cargo-load-cell small, .cargo-load-cell strong, .cargo-load-cell em {
  position: relative; z-index: 1; display: block;
  text-shadow: 0 1px 0 rgba(255,255,255,.98), 0 0 5px rgba(255,255,255,.95), 0 0 10px rgba(255,255,255,.9);
}
.cargo-load-cell small { font-size: clamp(5px, 1.35cqw, 10px); font-weight: 950; letter-spacing: .05em; }
.cargo-load-cell strong { margin-top: .08em; font-size: clamp(7px, 1.9cqw, 13px); line-height: 1; }
.cargo-load-cell em { margin-top: .18em; font-size: clamp(5px, 1.2cqw, 9px); font-style: normal; font-weight: 850; line-height: 1; }
.cargo-load-cell.overloaded { color: var(--danger); }
@container cargo (max-width: 460px) {
  /* Coluna estreita: sobra a quantidade, que é o dado lido de relance. */
  .cargo-load-cell small, .cargo-load-cell em { display: none; }
}

.cargo-content-chip {
  position: absolute; z-index: 4; top: clamp(14px, 1.2vw, 24px); left: clamp(14px, 1.2vw, 24px);
  display: inline-flex; align-items: center; gap: 8px; max-width: calc(100% - 24px); padding: 8px 12px;
  border: 1px solid #c5d5f7; border-radius: 999px; background: rgba(255,255,255,.92);
  color: var(--brand); box-shadow: var(--shadow-sm); font-size: clamp(10px, .72vw, 14px); font-weight: 850;
}
.cargo-content-chip, .cargo-content-chip > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cargo-content-chip i { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.cargo-load-summary {
  position: absolute; z-index: 4; bottom: clamp(14px, 1.2vw, 24px); left: clamp(14px, 1.2vw, 24px);
  max-width: 38%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: var(--shadow-sm); backdrop-filter: blur(8px);
}
.cargo-load-summary small, .cargo-load-summary strong, .cargo-load-summary span { display: block; }
.cargo-load-summary small { color: var(--brand); font-size: clamp(7px, .46vw, 10px); font-weight: 900; letter-spacing: .07em; }
.cargo-load-summary strong { margin-top: 2px; font-size: clamp(10px, .75vw, 15px); }
.cargo-load-summary span { margin-top: 1px; color: var(--text-soft); font-size: clamp(8px, .55vw, 11px); }
.cargo-load-summary.overloaded { border-color: var(--danger); background: var(--danger-soft); }
.cargo-load-summary.overloaded small, .cargo-load-summary.overloaded strong { color: var(--danger); }
.cargo-route-chip {
  position: absolute; z-index: 4; right: clamp(14px, 1.2vw, 24px); bottom: clamp(14px, 1.2vw, 24px);
  max-width: 56%; padding: 9px 12px; border: 1px solid rgba(216,225,240,.95); border-radius: 13px;
  background: rgba(255,255,255,.94); box-shadow: var(--shadow-sm); backdrop-filter: blur(8px);
}
.cargo-route-chip small, .cargo-route-chip strong { display: block; }
.cargo-route-chip small { color: var(--text-soft); font-size: 8px; font-weight: 850; letter-spacing: .08em; }
.cargo-route-chip strong { margin-top: 2px; overflow: hidden; font-size: clamp(10px, .75vw, 15px); text-overflow: ellipsis; white-space: nowrap; }

.cargo-manifest { padding: clamp(18px, 1.5vw, 32px); border-left: 1px solid var(--border); background: #fff; }
.cargo-manifest-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 15px; }
.cargo-manifest-title > div { min-width: 0; }
.cargo-manifest-title small, .cargo-manifest-title strong { display: block; }
.cargo-manifest-title small { color: var(--brand); font-size: 9px; font-weight: 900; letter-spacing: .09em; }
.cargo-manifest-title strong { margin-top: 4px; overflow: hidden; font-size: clamp(14px, 1vw, 20px); text-overflow: ellipsis; white-space: nowrap; }
.cargo-manifest-title > span { flex: none; color: var(--brand); font-size: clamp(22px, 1.8vw, 36px); font-weight: 900; white-space: nowrap; }
.cargo-manifest-title > span small { margin-top: 1px; color: var(--text-soft); font-size: 8px; font-weight: 800; text-align: right; text-transform: uppercase; }
.cargo-manifest-title > span.danger { color: var(--danger); }
.cargo-load-progress { height: 7px; margin: 15px 0 18px; overflow: hidden; border-radius: 99px; background: var(--brand-soft); }
.cargo-load-progress i {
  display: block; width: 100%; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #52a7ff);
  clip-path: inset(0 calc(100% - var(--progress)) 0 0); transition: clip-path .7s var(--ease);
}
.cargo-load-progress.overloaded { background: var(--danger-soft); }
.cargo-load-progress.overloaded i { background: var(--danger); }
.cargo-capacity-note {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -5px 0 14px;
  min-width: 0; color: var(--text-soft); font-size: clamp(9px, .6vw, 12px);
}
.cargo-capacity-note > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cargo-capacity-note strong { color: var(--success); font-size: inherit; white-space: nowrap; }
.cargo-capacity-note.warning strong { color: var(--warning); }
.cargo-metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cargo-metric-grid > div { min-width: 0; padding: clamp(11px, .9vw, 17px); border: 1px solid var(--border); border-radius: 13px; background: var(--surface-muted); }
.cargo-metric-grid small, .cargo-metric-grid strong { display: block; }
.cargo-metric-grid small { color: var(--text-soft); font-size: clamp(9px, .62vw, 13px); }
.cargo-metric-grid strong { margin-top: 4px; overflow: hidden; font-size: clamp(12px, .86vw, 17px); text-overflow: ellipsis; white-space: nowrap; }

/* ══ 8 · FORMULÁRIOS ════════════════════════════════════════════════════════ */

.field, .select-control { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label, .field > span, .select-control > span, .field > .label-row { font-size: 11px; font-weight: 800; }
.select-control > span { color: var(--text-soft); font-size: 8px; letter-spacing: .04em; text-transform: uppercase; }
.select-control.standalone { min-width: 170px; }
.label-row { display: flex; justify-content: space-between; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > span, .input-wrap > svg { position: absolute; left: 15px; z-index: 1; color: #9aa7bc; font-size: 15px; }
.input-wrap input { padding-left: 43px !important; }
input, select, textarea {
  width: 100%; min-height: 46px; border: 1px solid var(--border); border-radius: 12px; padding: 11px 14px;
  outline: 0; background: #fff; font-size: 13px; transition: border .2s, box-shadow .2s, background .2s;
}
textarea { resize: vertical; }
select {
  appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, #71809d 50%), linear-gradient(135deg, #71809d 50%, transparent 50%);
  background-position: calc(100% - 17px) 51%, calc(100% - 12px) 51%; background-repeat: no-repeat; background-size: 5px 5px;
}
input:hover, select:hover, textarea:hover { border-color: #cbd5e5; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(45,99,246,.1); }
input::placeholder, textarea::placeholder { color: #a4aec0; }
.password-toggle { position: absolute; right: 12px; background: transparent; color: var(--brand); cursor: pointer; font-size: 10px; font-weight: 850; }
.field-hint { color: var(--text-soft); font-size: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid .span-2 { grid-column: span 2; }
.check-control { display: flex; align-items: center; gap: 9px; width: max-content; cursor: pointer; color: var(--text-soft); font-size: 11px; font-weight: 700; }
.check-control input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.check-control > span { display: grid; width: 18px; height: 18px; place-items: center; border: 1px solid var(--border); border-radius: 5px; background: #fff; }
.check-control input:checked + span { border-color: var(--brand); background: var(--brand); }
.check-control input:checked + span::after { color: #fff; content: "✓"; font-size: 11px; font-weight: 900; }

.form-alert { display: flex; gap: 11px; margin-bottom: 20px; padding: 12px; border-radius: 13px; font-size: 12px; }
.form-alert.error { background: var(--danger-soft); color: #9b2f3c; }
.form-alert > span { display: grid; width: 25px; height: 25px; flex: 0 0 25px; place-items: center; border-radius: 50%; background: #fff; font-weight: 900; }
.form-alert strong, .form-alert p { margin: 0; }
.form-alert p { margin-top: 2px; }
.validation-banner { display: flex; gap: 10px; margin-top: 15px; padding: 13px; border-radius: 12px; background: var(--success-soft); color: #157453; }
.validation-banner > span { display: grid; width: 26px; height: 26px; flex: 0 0 26px; place-items: center; border-radius: 8px; background: #fff; font-weight: 900; }
.validation-banner strong, .validation-banner p { margin: 0; }
.validation-banner strong { font-size: 9px; }
.validation-banner p { margin-top: 2px; font-size: 8px; }

/* Escolha em cartão (rádio disfarçado) ───────────────────────────────────── */
.vehicle-choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.vehicle-choice-grid input { position: absolute; opacity: 0; }
.vehicle-choice { display: flex; min-height: 120px; flex-direction: column; padding: 14px; border: 1.5px solid var(--border); border-radius: 14px; cursor: pointer; transition: .2s; }
.vehicle-choice-grid input:checked + .vehicle-choice { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px rgba(45,99,246,.08); }
.vehicle-choice i { width: 7px; height: 7px; margin-bottom: 12px; border-radius: 50%; }
.vehicle-choice b { font-size: 10px; }
.vehicle-choice small { margin-top: 3px; color: var(--text-soft); font-size: 8px; }
.vehicle-choice em { margin-top: auto; color: var(--text-soft); font-size: 8px; font-style: normal; }
.event-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 0; padding: 0; border: 0; }
.event-types legend { margin-bottom: 7px; font-size: 11px; font-weight: 800; }
.event-types input { position: absolute; opacity: 0; }
.event-types label span { display: flex; min-height: 72px; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; font-size: 17px; }
.event-types b { font-size: 8px; }
.event-types input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); box-shadow: 0 0 0 3px rgba(45,99,246,.08); }

/* Upload ─────────────────────────────────────────────────────────────────── */
.upload-drop {
  display: grid; min-height: 175px; place-items: center; align-content: center; gap: 5px; padding: 20px;
  border: 1px dashed #aebfe4; border-radius: 18px; background: linear-gradient(145deg,#f9fbff,#eef3ff);
  cursor: pointer; text-align: center; transition: .2s var(--ease);
}
.upload-drop:hover, .upload-drop:focus-within { border-color: var(--brand); background: var(--brand-soft); transform: translateY(-2px); }
.upload-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-drop > span { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 15px; background: #fff; color: var(--brand); box-shadow: var(--shadow-sm); font-size: 24px; }
.upload-drop strong { font-size: 13px; }
.upload-drop small { color: var(--text-soft); font-size: 9px; }
.import-type-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.import-type-card {
  display: grid; min-height: 132px; align-content: center; justify-items: start; gap: 5px; padding: 18px;
  cursor: pointer; text-align: left; transition: transform .2s var(--ease), border-color .2s, box-shadow .2s;
}
.import-type-card:hover { transform: translateY(-3px); border-color: #bed0fb; box-shadow: var(--shadow-md); }
.import-type-card > span { display: grid; width: 38px; height: 38px; margin-bottom: 4px; place-items: center; border-radius: 12px; background: var(--brand-soft); color: var(--brand); font-size: 10px; font-weight: 900; }
.import-type-card strong { font-size: 12px; }
.import-type-card small { color: var(--text-soft); font-size: 8px; }
.import-preview { margin-top: 18px; padding: 16px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface-muted); }
.import-preview h3 { margin: 0 0 4px; font-size: 13px; }
.import-preview p { margin: 0 0 12px; color: var(--text-soft); font-size: 9px; }
.mapping-list { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.mapping-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 11px; border-radius: 10px; background: #fff; font-size: 9px; }
.mapping-item span { color: var(--text-soft); }
.mapping-item strong { color: var(--success); }

/* Autocomplete de endereço: a lista flutua sobre o formulário, como num mapa. */
.place-search { position: relative; }
.place-results {
  position: absolute; z-index: 70; top: calc(100% - 14px); right: 0; left: 0;
  max-height: 260px; overflow-y: auto; padding: 6px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: var(--shadow-md);
}
.place-result {
  display: grid; width: 100%; grid-template-columns: 26px minmax(0, 1fr); align-items: center; gap: 10px;
  padding: 8px 9px; border-radius: 10px; background: transparent; cursor: pointer; text-align: left;
}
.place-result:hover, .place-result.active { background: var(--brand-soft); }
.place-result svg { color: var(--brand); font-size: 17px; }
.place-result strong, .place-result small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-result strong { font-size: 11px; }
.place-result small { margin-top: 1px; color: var(--text-soft); font-size: 9px; }

/* ══ 9 · OVERLAYS ═══════════════════════════════════════════════════════════ */

.popover { position: fixed; z-index: 500; top: 83px; right: 26px; width: 260px; padding: 9px; border: 1px solid var(--border); border-radius: 15px; background: #fff; box-shadow: var(--shadow-md); animation: pop .18s var(--ease); }
.popover-user { display: flex; align-items: center; gap: 10px; padding: 8px 7px 13px; border-bottom: 1px solid var(--border); }
.popover-user strong, .popover-user small { display: block; }
.popover-user strong { font-size: 10px; }
.popover-user small { color: var(--text-soft); font-size: 8px; }
.popover > button, .popover form button { display: flex; width: 100%; align-items: center; gap: 9px; padding: 10px; border-radius: 9px; background: transparent; cursor: pointer; font-size: 9px; font-weight: 750; text-align: left; }
.popover > button:hover, .popover form button:hover { background: var(--surface-muted); }
.popover svg { color: var(--text-soft); font-size: 15px; }

.drawer {
  position: fixed; z-index: 1001; top: 0; right: 0; display: flex; width: min(430px, 100%);
  height: 100vh; height: 100dvh; flex-direction: column; padding: 22px; background: #fff;
  box-shadow: -20px 0 60px rgba(16,29,64,.18); transform: translateX(105%); transition: transform .3s var(--ease);
}
.drawer.open { transform: translateX(0); }
.drawer > header { display: flex; justify-content: space-between; }
.drawer h2 { margin: 0; font-size: 24px; letter-spacing: -.04em; }
.drawer-filters { display: flex; gap: 7px; margin: 20px 0 8px; }
.drawer-filters button { padding: 8px 11px; border-radius: 10px; background: var(--surface-muted); color: var(--text-soft); font-size: 9px; font-weight: 800; }
.drawer-filters button.active { background: var(--brand-soft); color: var(--brand); }
.drawer-alerts { flex: 1; overflow: auto; }
.drawer-alert { position: relative; margin: 10px 0; padding: 14px 14px 14px 34px; border: 1px solid var(--border); border-radius: 12px; }
.drawer-alert::before { position: absolute; top: 17px; left: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 0 4px var(--tone-soft); content: ""; }
.drawer-alert > div { display: flex; justify-content: space-between; }
.drawer-alert strong { font-size: 11px; }
.drawer-alert time { color: var(--text-soft); font-size: 8px; }
.drawer-alert p { margin: 5px 0 12px; color: var(--text-soft); font-size: 9px; }
.drawer-alert button { background: transparent; color: var(--brand); font-size: 8px; font-weight: 800; }
.drawer > footer .button { width: 100%; }
.drawer-backdrop { position: fixed; z-index: 1000; inset: 0; background: rgba(10,21,51,.38); backdrop-filter: blur(3px); }

dialog { border: 0; }
dialog::backdrop { background: rgba(11,21,51,.55); backdrop-filter: blur(5px); }
.app-modal { width: min(830px, calc(100% - 30px)); max-height: 90vh; overflow: hidden; padding: 0; border-radius: 23px; background: #fff; box-shadow: 0 30px 90px rgba(10,21,51,.28); }
.record-modal { width: min(720px, calc(100% - 30px)); }
.record-modal input[type="checkbox"] { accent-color: var(--brand); }
.modal-shell { display: flex; max-height: 90vh; flex-direction: column; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 21px 23px 17px; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 0; font-size: 24px; letter-spacing: -.035em; }
.modal-header p:last-child { margin: 5px 0 0; color: var(--text-soft); font-size: 10px; }
.stepper { display: flex; align-items: center; justify-content: center; padding: 16px 20px; background: #fafbfd; }
.stepper button { display: flex; align-items: center; gap: 6px; background: transparent; color: var(--text-soft); font-size: 8px; font-weight: 800; }
.stepper button span { display: grid; width: 25px; height: 25px; place-items: center; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.stepper button.active, .stepper button.done { color: var(--brand); }
.stepper button.active span, .stepper button.done span { border-color: var(--brand); background: var(--brand); color: #fff; }
.stepper i { width: 55px; height: 1px; margin: 0 7px; background: var(--border); }
.modal-content { overflow: auto; padding: 22px 24px; }
.form-step { display: none; animation: enter .3s var(--ease); }
.form-step.active { display: block; }
.step-copy { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.step-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 900; }
.step-copy h3, .step-copy p { margin: 0; }
.step-copy h3 { font-size: 14px; }
.step-copy p { margin-top: 3px; color: var(--text-soft); font-size: 9px; }
.modal-footer { display: flex; align-items: center; gap: 8px; padding: 14px 23px; border-top: 1px solid var(--border); background: #fafbfd; }
.modal-footer > span { flex: 1; }

/* Revisão de rota: linha vertical ligando as paradas. */
.route-review { display: grid; grid-template-columns: 1fr 200px; gap: 16px; }
.route-preview { position: relative; display: grid; gap: 14px; padding: 16px; border-radius: 15px; background: var(--surface-muted); }
.route-preview::before { position: absolute; top: 35px; bottom: 35px; left: 29px; width: 2px; background: #cbd7ed; content: ""; }
.route-preview > span { position: relative; z-index: 1; display: grid; grid-template-columns: 26px 1fr; column-gap: 9px; }
.route-preview i { grid-row: span 2; display: grid; width: 26px; height: 26px; place-items: center; border: 3px solid var(--surface-muted); border-radius: 50%; background: var(--brand); color: #fff; font-size: 8px; font-style: normal; font-weight: 900; }
.route-preview b { font-size: 9px; }
.route-preview small { color: var(--text-soft); font-size: 8px; }
.route-numbers { display: grid; gap: 8px; }
.route-numbers div { padding: 12px; border: 1px solid var(--border); border-radius: 12px; }
.route-numbers small, .route-numbers strong { display: block; }
.route-numbers small { color: var(--text-soft); font-size: 7px; text-transform: uppercase; }
.route-numbers strong { margin-top: 3px; font-size: 15px; }

/* Paleta de comandos (⌘K) ────────────────────────────────────────────────── */
.command-dialog { width: min(600px, calc(100% - 28px)); padding: 0; border-radius: 18px; box-shadow: 0 25px 80px rgba(10,21,51,.3); }
.command-input { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.command-input svg { color: var(--text-soft); font-size: 20px; }
.command-input input { min-height: 34px; flex: 1; border: 0; box-shadow: none; font-size: 15px; }
.command-results { padding: 10px; }
.command-label { margin: 5px 8px; color: var(--text-soft); font-size: 8px; font-weight: 850; letter-spacing: .1em; }
.command-results button { display: grid; width: 100%; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; padding: 9px; border-radius: 11px; background: transparent; cursor: pointer; text-align: left; }
.command-results button:hover { background: var(--surface-muted); }
.command-results strong, .command-results small { display: block; }
.command-results strong { font-size: 10px; }
.command-results small { color: var(--text-soft); font-size: 8px; }

/* Toast ──────────────────────────────────────────────────────────────────── */
.toast-region { position: fixed; z-index: 3000; right: 22px; bottom: 22px; display: grid; gap: 8px; pointer-events: none; }
.toast {
  position: relative; min-width: 270px; max-width: 400px; padding: 12px 14px 12px 36px; border-radius: 12px;
  background: var(--navy); box-shadow: var(--shadow-md); color: #fff; font-size: 10px; font-weight: 750;
  opacity: 0; transform: translateY(10px); transition: .25s;
}
.toast::before { position: absolute; top: 50%; left: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(39,185,133,.18); content: ""; transform: translateY(-50%); }
.toast.error::before { background: var(--danger); box-shadow: 0 0 0 4px rgba(230,93,104,.18); }
.toast.visible { opacity: 1; transform: translateY(0); }

/* ══ 10 · PÁGINAS AUXILIARES ════════════════════════════════════════════════ */

/* Calendário ─────────────────────────────────────────────────────────────── */
.calendar-shell { padding: 16px; }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.calendar-nav { display: flex; align-items: center; gap: 8px; }
.calendar-nav h3 { min-width: 150px; margin: 0; font-size: 15px; }
.calendar-nav .icon-button { width: 34px; height: 34px; flex-basis: 34px; font-size: 20px; }
.calendar-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
.weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.weekdays span { padding: 10px; color: var(--text-soft); font-size: 8px; font-weight: 850; text-align: center; }
.calendar-grid { overflow: hidden; border: 1px solid var(--border); border-radius: 15px; }
.calendar-day {
  position: relative; width: 100%; min-height: 102px; padding: 9px; border: 0;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  background: #fff; color: inherit; cursor: pointer; font: inherit; text-align: left;
  transition: background .18s var(--ease);
}
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day:nth-last-child(-n+7) { border-bottom: 0; }
.calendar-day:hover { background: var(--brand-soft); }
.calendar-day.muted { background: #fafbfd; color: #b2bac8; }
.calendar-day.today { background: #f6f9ff; }
.calendar-day.selected { box-shadow: inset 0 0 0 2px var(--brand); }
.calendar-day > b { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 8px; font-size: 9px; }
.calendar-day.today > b { background: var(--brand); color: #fff; }
.calendar-event { position: relative; display: block; margin-top: 5px; overflow: hidden; border-radius: 5px; padding: 4px 5px 4px 13px; background: var(--tone-soft); color: var(--text); font-size: 7px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.calendar-event::before { position: absolute; top: 50%; left: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--tone); content: ""; transform: translateY(-50%); }
.calendar-more { display: block; margin-top: 4px; color: var(--text-soft); font-size: 7px; font-weight: 800; }
.day-agenda { padding: 15px; border-radius: 16px; background: var(--navy); color: #fff; }
.date-badge { display: flex; align-items: center; gap: 8px; }
.date-badge strong { font-size: 38px; line-height: 1; }
.date-badge span { color: #9badd1; font-size: 8px; font-weight: 800; }
.day-agenda h3 { margin: 0; font-size: 18px; }
.agenda-list { margin-top: 20px; }
.agenda-item { display: grid; grid-template-columns: 40px 1fr; gap: 10px; padding: 12px 0; border-top: 1px solid rgba(255,255,255,.1); }
.agenda-item time { color: var(--accent); font-size: 9px; font-weight: 850; }
.agenda-item strong, .agenda-item small { display: block; }
.agenda-item strong { font-size: 10px; }
.agenda-item small { margin-top: 3px; color: #91a2c8; font-size: 8px; }

/* Ajustes / cartões de configuração ──────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-card { padding: 18px; }
.settings-card > header { display: flex; align-items: center; gap: 11px; margin-bottom: 18px; }
.settings-card > header > div { flex: 1; }
.settings-card h3, .settings-card header p { margin: 0; }
.settings-card h3 { font-size: 12px; }
.settings-card header p { color: var(--text-soft); font-size: 8px; }
.integration-state { margin-bottom: 15px; padding: 13px; border-radius: 12px; background: var(--surface-muted); }
.integration-state span, .integration-state strong { display: block; }
.integration-state span { color: var(--text-soft); font-size: 8px; text-transform: uppercase; }
.integration-state strong { margin: 3px 0; font-size: 10px; }
.integration-state p { margin: 0; color: var(--text-soft); font-size: 8px; }
.settings-row { display: flex; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--border); font-size: 9px; }
.settings-row span { color: var(--text-soft); }
.security-list { display: grid; gap: 9px; }
.security-list span { color: var(--text-soft); font-size: 9px; }
.security-list i { display: inline-grid; width: 18px; height: 18px; margin-right: 6px; place-items: center; border-radius: 6px; background: var(--success-soft); color: var(--success); font-style: normal; font-weight: 900; }
.color-swatches { display: flex; gap: 7px; margin-bottom: 18px; }
.color-swatches span { width: 38px; height: 38px; border: 4px solid #fff; border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px var(--border), var(--shadow-sm); }

/* Locais / sedes ─────────────────────────────────────────────────────────── */
.branches-panel { margin-bottom: 16px; overflow: visible; }
.branches-layout { display: grid; grid-template-columns: minmax(240px, .8fr) minmax(0, 1.5fr); gap: 18px; padding: 18px; }
.branch-list { display: flex; max-height: 520px; flex-direction: column; gap: 8px; overflow-y: auto; }
.branch-item {
  display: block; padding: 12px 14px; border: 1px solid var(--border); border-left: 4px solid var(--tone);
  border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; text-align: left; transition: .2s var(--ease);
}
.branch-item:hover { border-color: #cbd9fb; background: var(--brand-soft); }
.branch-item.active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.branch-kind { display: inline-block; margin-bottom: 5px; padding: 2px 7px; border-radius: 999px; background: var(--tone-soft); color: var(--tone-ink); font-size: 8px; font-weight: 850; text-transform: uppercase; }
.branch-item strong { display: block; font-size: 13px; }
.branch-item small { display: block; margin-top: 2px; color: var(--text-soft); font-size: 10px; }
.branch-item em { display: block; margin-top: 5px; color: var(--text-soft); font-size: 9px; font-style: normal; font-weight: 750; }
.branch-item .branch-warning { color: var(--attention-ink); font-weight: 850; }
.branch-form { display: flex; flex-direction: column; gap: 14px; }
.branch-form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.branch-map-wrap { display: flex; flex-direction: column; gap: 6px; }
.branch-map { min-height: 230px; border: 1px solid var(--border); border-radius: var(--radius-sm); }

/* Login ──────────────────────────────────────────────────────────────────── */
.login-page { overflow-x: hidden; background: #fff; }
.login-shell { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(460px, 1.18fr) minmax(380px, .82fr); }
.login-story {
  position: relative; display: flex; min-height: 720px; flex-direction: column; overflow: hidden; padding: 38px 48px;
  background:
    radial-gradient(circle at 75% 36%, rgba(66, 115, 255, .34), transparent 30%),
    radial-gradient(circle at 20% 88%, rgba(112, 224, 180, .15), transparent 28%),
    linear-gradient(145deg, #0b1533, #14265b 56%, #153776);
  color: #fff;
}
.login-story > * { position: relative; z-index: 2; }
.login-story > header { display: flex; align-items: center; justify-content: space-between; }
.login-brand-lockup { display: block; width: clamp(230px, 18vw, 285px); }
.login-brand-lockup img { display: block; width: 100%; height: auto; filter: brightness(0) invert(1); }
.secure-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid rgba(255,255,255,.14); border-radius: 999px; background: rgba(255,255,255,.07); color: #c7d5f3; font-size: 11px; font-weight: 700; }
.secure-chip span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.login-copy { width: min(650px, 90%); margin-top: clamp(70px, 12vh, 126px); }
.login-copy h1 { max-width: 650px; margin: 0; font-size: clamp(40px, 4.1vw, 67px); letter-spacing: -.035em; line-height: 1.03; }
.login-copy > p:last-child { max-width: 560px; margin: 24px 0 0; color: #bdcae5; font-size: 16px; line-height: 1.75; }
/* Palco do herói. Sangra nas laterais para a estrada encostar nas bordas, mas
   nunca embaixo: .login-story tem overflow hidden e cortaria as rodas. */
.login-stage { position: relative; min-height: clamp(290px, 44vh, 500px); margin: auto -48px 0; }
.login-stage canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.login-stage[data-mode="3d"] .stage-fallback { opacity: 0; transition: opacity .6s var(--ease); }
.stage-glow { position: absolute; right: 4%; bottom: 4%; left: 4%; height: 46%; pointer-events: none; background: radial-gradient(ellipse at 50% 100%, rgba(45,99,246,.36), transparent 65%); }
.stage-fallback { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; }
.stage-fallback img { width: min(78%, 520px); height: auto; filter: drop-shadow(0 26px 40px rgba(0,0,0,.45)); }
.stage-road { position: absolute; right: 6%; bottom: 12%; left: 6%; display: flex; gap: 22px; height: 3px; overflow: hidden; opacity: .55; }
.stage-road i { flex: 0 0 46px; border-radius: 99px; background: linear-gradient(90deg, transparent, #5e97ff); animation: road-run 1.5s linear infinite; }
.stage-road i:nth-child(2) { animation-delay: -.25s; }
.stage-road i:nth-child(3) { animation-delay: -.5s; }
.stage-road i:nth-child(4) { animation-delay: -.75s; }
.stage-road i:nth-child(5) { animation-delay: -1s; }
.stage-road i:nth-child(6) { animation-delay: -1.25s; }
.login-story > footer { display: flex; gap: 26px; color: #7f92b9; font-size: 10px; font-weight: 700; letter-spacing: .03em; }
.login-story > footer span::before { margin-right: 7px; color: var(--accent); content: "✓"; }
.login-panel { display: flex; min-height: 720px; flex-direction: column; justify-content: center; padding: 40px clamp(36px, 6vw, 100px); background: #fff; }
.login-form-wrap { width: min(430px, 100%); margin: auto; }
.mobile-login-logo { display: none; }
.welcome-mark { display: block; width: 52px; height: 52px; margin-bottom: 26px; }
.welcome-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.login-heading h2 { margin: 0; font-size: clamp(27px, 3vw, 37px); letter-spacing: -.04em; line-height: 1.1; }
.login-heading > p:last-child { margin: 12px 0 30px; color: var(--text-soft); font-size: 14px; }
.login-form { display: flex; flex-direction: column; gap: 18px; }
.login-help { margin: 24px 0 0; text-align: center; color: var(--text-soft); font-size: 11px; }
.login-panel > footer { width: 100%; margin: 30px auto 0; text-align: center; color: #a0aabd; font-size: 9px; }
.login-panel > footer span { margin: 0 5px; }

/* Erro ───────────────────────────────────────────────────────────────────── */
.error-page { display: grid; min-height: 100vh; min-height: 100dvh; place-items: center; padding: 30px; text-align: center; }
.error-page main { max-width: 480px; }
.error-code { display: block; color: var(--brand); font-size: 70px; font-weight: 900; }
.error-page h1 { margin: 0; }
.error-page p { margin: 10px 0 24px; color: var(--text-soft); }

/* ══ 11 · RESPONSIVO ════════════════════════════════════════════════════════ */

/* Densidade legível em desktop e monitores 2K/4K. */
@media (min-width: 992px) {
  .app-main { padding-right: clamp(20px, 1.7vw, 52px); }
  .page-context p, .eyebrow { font-size: var(--ui-xs); }
  .page-context h1 { font-size: clamp(18px, 1.15vw, 28px); }
  .hero-row p, .view-heading > div > p:last-child { font-size: var(--ui-sm); }
  .panel-heading h3, .table-heading h3 { font-size: var(--ui-md); }
  .panel-heading p, .table-heading p { font-size: var(--ui-xs); }
  .kpi-value { font-size: clamp(29px, 2vw, 48px); }
  .kpi-value small { font-size: var(--ui-sm); }
  .kpi-label, .kpi-delta { font-size: var(--ui-xs); }
  th { padding-block: clamp(12px, .85vw, 20px); font-size: var(--ui-xs); }
  td { padding-block: clamp(14px, .95vw, 23px); font-size: var(--ui-sm); }
  .table-sub { font-size: var(--ui-xs); }
  .status-badge, .file-pill, .estimated-pill { font-size: var(--ui-xs); }
  .button { min-height: clamp(42px, 2.8vw, 56px); font-size: var(--ui-sm); }
  input, select, textarea { min-height: clamp(46px, 3vw, 60px); font-size: var(--ui-sm); }
  .field > label, .field > span, .select-control > span, .field > .label-row { font-size: var(--ui-sm); }
  .topbar-profile strong, .popover-user strong { font-size: var(--ui-sm); }
  .topbar-profile small, .popover-user small, .sync-pill b { font-size: var(--ui-xs); }
  .nav-item::after { font-size: var(--ui-xs); }
  .map-legend, .map-provider strong, .fleet-mini p, .active-trip-top small, .active-trip-route span,
  .active-trip-progress > div, .trip-detail-grid small, .timeline-item small, .timeline-item time,
  .alert-row small, .alert-row time { font-size: var(--ui-xs); }
  .fleet-mini strong, .active-trip-route p, .trip-detail-grid strong, .timeline-item strong,
  .alert-row strong { font-size: var(--ui-sm); }
  .active-trip-top h3 { font-size: clamp(18px, 1.25vw, 28px); }
}

@media (max-width: 1180px) {
  .sync-pill { display: none; }
  .command-grid, .operations-grid { grid-template-columns: 1fr; }
  .right-stack { display: grid; grid-template-columns: 1fr 1fr; }
  .bottom-grid { grid-template-columns: 1fr; }
  .map-page-grid { grid-template-columns: 285px 1fr; }
  .calendar-layout { grid-template-columns: 1fr; }
  .day-agenda { display: grid; grid-template-columns: auto 1fr 2fr; gap: 15px; }
  .agenda-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 14px; margin-top: 0; }
  .report-grid { grid-template-columns: 1fr 1fr; }
  .import-type-grid { grid-template-columns: repeat(3, 1fr); }
  .executive-grid { grid-template-columns: 1fr 1fr; }
  .executive-grid .span-2 { grid-column: span 2; }
}

@media (max-width: 900px) {
  :root { --sidebar: 74px; }
  .app-sidebar { left: 8px; top: 8px; bottom: 8px; border-radius: 22px; }
  .app-main { margin-left: calc(var(--sidebar) + 18px); padding-right: 14px; }
  .search-trigger { width: 44px; flex: 0 0 44px; justify-content: center; }
  .search-trigger span, .search-trigger kbd, .topbar-profile > span:not(.avatar), .topbar-profile > i { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .map-page-grid { grid-template-columns: 1fr; }
  .vehicle-browser { max-height: none; }
  .vehicle-list { display: grid; height: auto; grid-template-columns: 1fr 1fr; gap: 8px; }
  .vehicle-card { margin: 0; }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .filter-bar .search-field { grid-column: span 2; }
  .executive-kpis { grid-template-columns: 1fr 1fr; }
  .calendar-day { min-height: 85px; }
  .cargo-panel-body { grid-template-columns: 1fr; }
  .cargo-truck-stage { min-height: 300px; }
  .cargo-manifest { border-top: 1px solid var(--border); border-left: 0; }
  .branches-layout { grid-template-columns: 1fr; }
  .branch-list { max-height: 260px; }
  .login-shell { grid-template-columns: 1fr; }
  .login-story { display: none; }
  .mobile-login-logo { display: block; width: min(270px, 78vw); margin-bottom: 45px; }
  .mobile-login-logo img { display: block; width: 100%; height: auto; }
  .login-panel { min-height: 100vh; min-height: 100dvh; }
}

@media (max-width: 680px) {
  body.app-page { padding-bottom: 75px; }
  .app-sidebar { display: none; }
  .mobile-bar { display: flex; height: 64px; align-items: center; justify-content: space-between; padding: 10px 15px; background: #fff; }
  .mobile-bar img { width: 160px; }
  .mobile-bar .icon-button { border: 0; }
  .mobile-bar .icon-button span, .mobile-back span { display: block; width: 18px; height: 2px; margin: 2px; border-radius: 99px; background: var(--text); }
  .app-main { margin: 0; padding: 0 12px 25px; }
  .app-topbar { position: static; min-height: 58px; margin: 10px 0 18px; padding: 9px 11px; }
  .page-context p { display: none; }
  .page-context h1 { font-size: 15px; }
  .topbar-actions > .icon-button:nth-of-type(1), .topbar-profile { display: none; }
  .topbar-actions { gap: 5px; }
  .mobile-nav {
    position: fixed; z-index: 800; right: 8px; bottom: 8px; left: 8px; display: grid; height: 65px;
    grid-template-columns: repeat(5, 1fr); align-items: center; padding: 5px;
    border: 1px solid rgba(225,231,241,.8); border-radius: 20px; background: rgba(255,255,255,.95);
    box-shadow: 0 12px 35px rgba(10,21,51,.2); backdrop-filter: blur(15px);
  }
  .mobile-nav button { display: flex; min-width: 0; flex-direction: column; align-items: center; gap: 3px; background: transparent; color: var(--text-soft); font-size: 7px; }
  .mobile-nav svg { font-size: 18px; }
  .mobile-nav button.active { color: var(--brand); }
  .mobile-nav .mobile-create { width: 47px; height: 47px; justify-self: center; justify-content: center; border-radius: 16px; background: var(--brand); color: #fff; box-shadow: var(--shadow-brand); }
  .mobile-nav .mobile-create svg { font-size: 22px; }
  .hero-row, .view-heading { align-items: flex-start; flex-direction: column; margin-bottom: 18px; }
  .hero-row h2, .view-heading h2 { font-size: 26px; }
  .hero-actions, .view-actions { width: 100%; }
  .hero-actions .button, .view-actions .button { flex: 1; }
  .view-actions { flex-wrap: wrap; }
  .view-actions .select-control { width: 100%; flex: 1 0 100%; }
  .kpi-grid { gap: 9px; }
  .kpi-card { min-height: 0; padding: 13px; }
  .kpi-card .plain { min-height: 0; }
  .kpi-value { font-size: 23px; }
  .kpi-delta { display: none; }
  .cargo-panel-heading { align-items: flex-start; }
  .cargo-panel-heading h3 { font-size: 20px; }
  .cargo-truck-stage { min-height: 230px; }
  .cargo-content-chip { max-width: 82%; }
  .cargo-truck-artboard { width: 94%; }
  .cargo-load-cell small, .cargo-load-cell em { display: none; }
  .cargo-load-cell strong { font-size: 7px; }
  .cargo-load-summary { display: none; }
  .cargo-route-chip { right: 10px; bottom: 10px; left: 10px; max-width: none; }
  .cargo-manifest { padding: 16px; }
  .cargo-metric-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .panel-heading { flex-direction: column; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; }
  .map-canvas { min-height: 300px; }
  .map-provider { top: 8px; left: 8px; }
  .map-legend { right: 8px; bottom: 8px; left: 8px; justify-content: space-between; }
  .fleet-strip { grid-template-columns: 1fr 1fr; }
  .right-stack { grid-template-columns: 1fr; }
  .bottom-grid { grid-template-columns: 1fr; gap: 12px; }
  .filter-bar { grid-template-columns: 1fr; }
  .filter-bar .search-field { grid-column: auto; }
  .map-floating-stats { right: 18px; flex-wrap: wrap; }
  .map-floating-stats > div { flex: 1; min-width: 95px; }
  .map-full { min-height: 500px; }
  .vehicle-list { grid-template-columns: 1fr; }
  .calendar-toolbar { align-items: flex-start; flex-direction: column; }
  .calendar-layout { display: block; }
  .calendar-day { min-height: 65px; padding: 5px; }
  .calendar-event { width: 6px; height: 6px; padding: 0; border: 0; border-radius: 50%; background: var(--tone); font-size: 0; }
  .day-agenda, .agenda-list { display: block; margin-top: 15px; }
  .status-summary, .client-insights, .executive-kpis, .report-grid, .settings-grid { grid-template-columns: 1fr; }
  .status-summary { grid-template-columns: 1fr 1fr; }
  .import-type-grid { grid-template-columns: 1fr; }
  .executive-grid { grid-template-columns: 1fr; }
  .executive-grid .span-2 { grid-column: auto; }
  .ranking-table > div { grid-template-columns: 25px 1fr; }
  .ranking-table b, .ranking-table em { grid-column: 2; }
  .report-card { grid-template-columns: 45px 1fr 34px; }
  .popover { top: 70px; right: 12px; }
  .form-grid, .vehicle-choice-grid, .route-review { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .event-types { grid-template-columns: 1fr 1fr; }
  .stepper button b { display: none; }
  .stepper i { width: 25px; }
  .modal-content, .modal-header { padding: 18px; }
  .modal-footer { padding: 12px 18px; }
  .mapping-list { grid-template-columns: 1fr; }
  .login-panel { padding: 30px 22px; }
  .mobile-login-logo { margin-bottom: 35px; }
  .welcome-mark { display: none; }
  .login-heading h2 { font-size: 28px; }
  .toast-region { right: 12px; bottom: 82px; left: 12px; }
  .toast { min-width: 0; }
  /* No celular o veredito empilha: em três colunas o texto fica estreito demais
     para ser lido de relance, que é justamente o seu propósito. */
  .verdict { grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 14px; }
  .verdict-meta { grid-column: 1 / -1; justify-content: space-between; padding-top: 10px; border-top: 1px solid color-mix(in srgb, var(--tone) 22%, transparent); }
  .verdict-meta > div { text-align: left; }
  .view-tabs { position: sticky; top: 0; z-index: 60; margin-bottom: 14px; }
  .view-tabs-actions { position: static; margin-left: auto; }
  .view-tabs-actions .button span { display: none; }
  .table-heading-actions { width: 100%; }
  .table-heading-actions .search-field { flex: 1; }
  /* O hambúrguer abre a sidebar como painel deslizante. */
  .menu-open .app-sidebar {
    position: fixed; z-index: 1200; top: 10px; bottom: 10px; left: 10px; display: flex;
    border-radius: 22px; box-shadow: 0 25px 70px rgba(10,21,51,.35);
  }
  .menu-open::after { position: fixed; z-index: 1100; inset: 0; background: rgba(10,21,51,.45); content: ""; }
}
