:root {
  color-scheme: light;

  /* ---------------------------------------------------------------------
     CAMADA DE TOKENS — fonte única de verdade do sistema visual.
     Os tokens de marca são substituídos em tempo de execução pelo Tenant
     Branding; todos os restantes são estruturais e não dependem do cliente.
     --------------------------------------------------------------------- */

  /* Superfícies */
  --bg-app: #f4f7fc;
  --bg-sidebar: #061638;
  --bg-surface: #ffffff;
  --bg-surface-secondary: #f7faff;
  --bg-overlay: rgb(4 17 48 / 62%);

  /* Texto */
  --text-primary: #0c1d3a;
  --text-secondary: #40516d;
  --text-muted: #66758d;
  --text-on-sidebar: #eff7ff;
  --text-on-sidebar-muted: #9fb7da;
  /* Acento legível sobre a barra lateral escura: o verde semântico (--success)
     não tem contraste suficiente contra #102848. */
  --accent-on-dark: #20d7ff;

  /* Fronteiras */
  --border: #dce5f2;
  --border-strong: #c5d2e5;

  /* Semântica de estado */
  --success: #087a5b;
  --success-soft: #dcf7ed;
  --warning: #8b5d05;
  --warning-soft: #fff2ce;
  --danger: #a82943;
  --danger-soft: #fce8ec;
  --info: #075fd8;
  --info-soft: #e7f2ff;

  /* Raios */
  --radius-sm: 9px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  /* Sombras */
  --shadow-sm: 0 1px 2px rgb(6 22 56 / 5%), 0 5px 16px rgb(6 22 56 / 5%);
  --shadow-md: 0 14px 38px rgb(6 22 56 / 10%);
  --shadow-lg: 0 28px 72px rgb(6 22 56 / 20%);

  /* Escala de espaçamento */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Tipografia */
  --font-size-xs: 12px;
  --font-size-sm: 13px;
  --font-size-md: 15px;
  --font-size-lg: 18px;
  --font-size-xl: 24px;
  --font-size-2xl: 30px;
  --line-tight: 1.2;
  --line-normal: 1.5;

  /* Layout */
  --sidebar-width: 246px;
  --topbar-height: 68px;
  --content-max: 1280px;

  /* Aliases herdados: o design system anterior continua a funcionar sem alterações. */
  --ink: var(--text-primary);
  --muted: var(--text-muted);
  --line: var(--border);
  --page: var(--bg-app);
  --surface: var(--bg-surface);
  --surface-soft: var(--bg-surface-secondary);
  /* Tokens de marca. Os valores por omissão são a identidade CVLogistica; a marca da
     organização substitui-os em tempo de execução via custom properties, sem CSS por
     empresa. Os componentes consomem estes tokens, nunca hexadecimais fixos. */
  --brand-primary: #0a66ff;
  --brand-secondary: #082454;
  --brand-accent: #00bfe8;
  --brand-on-primary: #ffffff;
  --brand-on-secondary: #ffffff;
  --brand-on-accent: #ffffff;
  --brand-on-surface: #075fd8;
  --brand-focus: #075fd8;
  /* Aliases mantidos para não reescrever o design system existente. */
  --brand: var(--brand-primary);
  --brand-dark: var(--brand-secondary);
  --green: var(--success);
  --green-soft: var(--success-soft);
  --gold: var(--warning);
  --gold-soft: var(--warning-soft);
  --violet: var(--info);
  --shadow: var(--shadow-md);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; background: var(--page); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
[hidden] { display: none !important; }

/* O anel de foco tem contraste próprio contra a superfície em que assenta
   (WCAG 2.1 §1.4.11): azul sobre fundos claros, âmbar sobre a barra lateral e
   outros fundos escuros. Não usa a cor da marca: o tenant não pode degradar a
   visibilidade do foco. */
:focus-visible {
  outline: 3px solid #0759dc;
  outline-offset: 3px;
}
.shell-sidebar :focus-visible,
.sidebar :focus-visible,
.bottom-nav :focus-visible,
.on-dark :focus-visible {
  outline-color: #ffd166;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #ffffff;
  color: var(--brand-dark);
  box-shadow: var(--shadow);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.offline-banner {
  position: sticky;
  z-index: 20;
  top: 0;
  padding: 10px 18px;
  background: #fff1c7;
  color: #614100;
  border-bottom: 1px solid #e2c66d;
  text-align: center;
  font-size: 13px;
  font-weight: 750;
}

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 18px 22px;
  background: var(--bg-sidebar);
  color: var(--text-on-sidebar);
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 34px;
  color: #ffffff;
  text-decoration: none;
  font-size: 16px;
  font-weight: 850;
  letter-spacing: .01em;
}
.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-on-dark);
  color: #062b38;
  font-size: 12px;
  font-weight: 900;
}
.sidebar nav { display: grid; gap: 7px; }
.nav-link {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  border-radius: 9px;
  color: var(--text-on-sidebar);
  text-decoration: none;
  font-size: 14px;
}
.nav-link.active { background: rgb(255 255 255 / 14%); color: #ffffff; font-weight: 750; box-shadow: inset 3px 0 0 var(--accent-on-dark); }
.nav-link span:last-child { color: var(--text-on-sidebar-muted); font-size: 10px; }
.sidebar-footer {
  margin-top: auto;
  padding: 15px 11px 0;
  border-top: 1px solid rgb(255 255 255 / 16%);
  color: var(--text-on-sidebar-muted);
  font-size: 12px;
}
.online-dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--accent-on-dark); }

main { min-width: 0; max-width: 1700px; width: 100%; margin-inline: auto; padding: 32px clamp(22px, 3.4vw, 58px) 52px; }
.mobile-nav { display: none; }
.topbar, .top-actions, .panel-heading, .panel-actions, .dialog-heading, .dialog-actions, .row-actions, .alert-actions {
  display: flex;
  align-items: center;
}
.topbar { justify-content: space-between; gap: 24px; margin-bottom: 25px; }
.top-actions, .panel-actions, .row-actions, .alert-actions { gap: 9px; }
.eyebrow { margin: 0 0 5px; color: var(--brand); font-size: 11px; font-weight: 850; letter-spacing: .11em; }
h1, h2, h3 { margin: 0; color: var(--ink); line-height: 1.15; letter-spacing: -.03em; }
h1 { font-size: clamp(27px, 3vw, 38px); }
h2 { font-size: clamp(20px, 2vw, 24px); }
h3 { font-size: 17px; }
.muted-copy, .form-hint { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

.primary-button, .secondary-button, .progress-button, .text-button, .icon-button {
  min-height: 40px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-weight: 750;
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}
.primary-button { padding: 10px 16px; background: var(--brand); color: #ffffff; box-shadow: 0 7px 17px rgb(7 89 220 / 18%); }
.primary-button:hover { background: #004bc0; transform: translateY(-1px); }
.secondary-button { padding: 9px 13px; border-color: #cbd6e2; background: #ffffff; color: #324860; }
.secondary-button:hover { border-color: #9fb2c7; background: #f4f7fa; }
.progress-button { min-height: 35px; padding: 7px 10px; background: #e8f1ff; color: #084cae; }
.progress-button:hover { background: #d8e8ff; }
.text-button { min-height: 35px; padding: 6px 8px; background: transparent; color: #15519f; }
.text-button:hover { background: #edf3fb; }
.danger-text { color: var(--danger); }
.icon-button { display: grid; place-items: center; width: 40px; padding: 0; background: #eef2f6; color: #526278; font-size: 24px; line-height: 1; }

.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid #c8d6e3;
  border-radius: 999px;
  background: #ffffff;
  color: #455a71;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}
.connection-icon { width: 8px; height: 8px; border-radius: 50%; background: #78889b; }
.connection-state.live { color: #086649; border-color: #a6dccb; background: #e9f8f2; }
.connection-state.live .connection-icon { background: #15946d; box-shadow: 0 0 0 4px rgb(21 148 109 / 13%); }
.connection-state.reconnecting, .connection-state.polling { color: #704a00; border-color: #ead191; background: #fff8e4; }
.connection-state.reconnecting .connection-icon, .connection-state.polling .connection-icon { background: #d08c09; }
.connection-state.offline { color: #8c263c; border-color: #e8b7c1; background: #fff1f3; }
.connection-state.offline .connection-icon { background: #bb3852; }

.message:empty, .message[hidden] { display: none !important; }
.message { min-height: 0; margin: 0 0 18px; color: var(--green); font-size: 13px; font-weight: 700; }
.message.info { color: #315e93; }
.message.error { color: var(--danger); }
.message:not(:empty) { padding: 11px 13px; border: 1px solid currentColor; border-radius: 9px; background: #ffffff; }

.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(135px, 1fr)); gap: 13px; margin-bottom: 24px; }
.metric-card {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-top: 3px solid #66758a;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 4px 15px rgb(20 35 58 / 5%);
}
.metric-card.accent-blue { border-top-color: var(--brand); }
.metric-card.accent-green { border-top-color: var(--green); }
.metric-card.accent-gold { border-top-color: #c28308; }
.metric-card.accent-violet { border-top-color: var(--violet); }
.metric-card.accent-danger { border-top-color: var(--danger); }
.metric-card span, .metric-card small { display: block; color: var(--muted); font-size: 11px; line-height: 1.35; }
.metric-card strong { display: block; margin: 9px 0 5px; font-size: clamp(25px, 2.4vw, 32px); letter-spacing: -.05em; }

.map-panel, .operations-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.map-panel, .queue-panel { margin-bottom: 22px; }
.alerts-panel { margin-bottom: 20px; }
.panel-heading { justify-content: space-between; gap: 20px; padding: 21px 23px 17px; }
.map-content { display: grid; grid-template-columns: minmax(0, 1fr) 220px; border-top: 1px solid var(--line); }
.map-canvas {
  position: relative;
  min-height: 260px;
  overflow: hidden;
  background-color: #eef3fa;
  background-image: linear-gradient(#dbe6f3 1px, transparent 1px), linear-gradient(90deg, #dbe6f3 1px, transparent 1px);
  background-size: 26px 26px;
}
.map-canvas::before {
  content: '';
  position: absolute;
  top: -21%;
  left: 13%;
  width: 70%;
  height: 130%;
  border-radius: 48% 38% 44% 52%;
  background: #d7e5ca;
  opacity: .92;
  transform: rotate(-11deg);
}
.map-watermark { position: absolute; z-index: 1; left: 17px; bottom: 13px; color: var(--text-secondary); font-size: 9px; font-weight: 850; letter-spacing: .09em; }
.map-empty { position: relative; z-index: 1; padding: 100px 20px; color: var(--muted); text-align: center; }
.map-marker { position: absolute; z-index: 2; transform: translate(-50%, -50%); }
/* A cor vem do estado operacional, calculado em operations.js — a folha de
   estilos não tem tabela de cores própria para não haver duas verdades sobre
   o que é «ocupado». O valor de recurso só se usa se o estado não chegar. */
.map-marker.driver { display: grid; place-items: center; width: 29px; height: 29px; border: 3px solid #ffffff; border-radius: 50%; background: var(--estado-cor, var(--brand)); box-shadow: 0 2px 8px rgb(16 40 72 / 38%); color: #ffffff; font-size: 0; }
.map-marker.driver::after { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #ffffff; }
/* Posição antiga acrescenta-se ao estado em vez de o substituir: o contorno
   passa a tracejado e a cor do estado mantém-se. */
.map-marker.driver[data-posicao-antiga='sim'] { border-style: dashed; }
.map-marker.pickup, .map-marker.dropoff { width: 16px; height: 16px; border: 3px solid #ffffff; box-shadow: 0 1px 6px rgb(16 40 72 / 38%); }
.map-marker.pickup { border-radius: 50%; background: #14966e; }
.map-marker.dropoff { border-radius: 3px; background: #d33d58; transform: translate(-50%, -50%) rotate(45deg); }
.map-summary { display: grid; align-content: center; gap: 15px; padding: 20px 18px; }
.map-summary div { display: grid; gap: 1px; }
.map-summary strong { font-size: 25px; letter-spacing: -.04em; }
.map-summary span, .map-summary p { margin: 0; color: var(--muted); font-size: 11px; }
.legend { display: inline-block; width: 8px; height: 8px; margin: 0 3px 0 8px; border-radius: 50%; }
.legend:first-child { margin-left: 0; }
.driver-dot { background: var(--brand); }
.pickup-dot { background: #14966e; }
.dropoff-dot { background: #d33d58; }
.map-list { display: grid; gap: 0; margin: 0; padding: 0; border-top: 1px solid var(--line); list-style: none; }
.map-list li { display: flex; justify-content: space-between; gap: 20px; padding: 12px 22px; border-bottom: 1px solid var(--line); font-size: 12px; }
.map-list span { color: var(--muted); white-space: nowrap; }

.filter-bar {
  display: grid;
  grid-template-columns: minmax(190px, 1.5fr) repeat(3, minmax(130px, .75fr)) auto;
  gap: 12px;
  padding: 0 23px 20px;
}
.filter-bar label, .form-grid label, .inline-form label { display: grid; gap: 6px; color: #40516a; font-size: 12px; font-weight: 750; }
.filter-bar input, .filter-bar select, .form-grid input, .form-grid select, .form-grid textarea, .inline-form input, .inline-form select, .inline-form textarea {
  min-width: 0;
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid #c8d3df;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}
.filter-bar input:hover, .filter-bar select:hover, .form-grid input:hover, .form-grid select:hover, .form-grid textarea:hover, .inline-form input:hover, .inline-form select:hover, .inline-form textarea:hover { border-color: #98acc1; }
.filter-reset { align-self: end; }

.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 870px; border-collapse: collapse; }
th, td { padding: 15px 18px; border-top: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: #f9fbfd; color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
td { font-size: 13px; }
td strong { display: block; font-size: 13px; }
td small { display: block; margin-top: 4px; color: var(--muted); }
.route { max-width: 250px; color: #40516a; }
.clamp { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unassigned { color: var(--gold); font-weight: 750; }
.status { display: inline-block; padding: 6px 8px; border-radius: 999px; font-size: 10px; font-weight: 850; white-space: nowrap; }
.status-ready-for-dispatch, .status-assigned { color: #6e4b03; background: var(--gold-soft); }
.status-accepted, .status-arrived-at-pickup, .status-picked-up { color: #0752ae; background: #e4efff; }
.status-in-transit, .status-arrived-at-dropoff { color: #663592; background: #f1e9f8; }
.status-delivered { color: #086149; background: var(--green-soft); }
.status-cancelled, .status-delivery-failed { color: #97263d; background: var(--danger-soft); }
.queue-cards { display: none; }
.queue-footer { display: flex; justify-content: space-between; align-items: center; min-height: 48px; padding: 10px 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.empty-state { padding: 30px; color: var(--muted); text-align: center; }
.loading-state::before { content: ''; display: inline-block; width: 13px; height: 13px; margin-right: 8px; border: 2px solid #b9c8d7; border-top-color: var(--brand); border-radius: 50%; vertical-align: -2px; animation: spin .8s linear infinite; }
.error-state { color: var(--danger); }

.count-badge { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px; background: #edf2f7; color: #43566d; font-size: 12px; font-weight: 850; }
.alert-list { display: grid; }
.alert-item { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 16px 22px; border-top: 1px solid var(--line); border-left: 4px solid #7890aa; }
.alert-item.severity-critical { border-left-color: var(--danger); }
.alert-item.severity-warning { border-left-color: #bd7a00; }
.alert-item strong, .alert-item small { display: block; }
.alert-item strong { margin: 4px 0; font-size: 13px; }
.alert-item small, .alert-meta { color: var(--muted); font-size: 11px; }

dialog { width: min(610px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; overflow: auto; border: 0; border-radius: 15px; background: #ffffff; color: var(--ink); box-shadow: 0 26px 70px rgb(16 40 72 / 38%); }
dialog::backdrop { background: rgb(9 27 52 / 66%); backdrop-filter: blur(2px); }
.dialog-heading { position: sticky; z-index: 2; top: 0; justify-content: space-between; gap: 20px; padding: 21px 23px 18px; border-bottom: 1px solid var(--line); background: #ffffff; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; padding: 22px 23px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid textarea, .inline-form textarea { resize: vertical; }
.dialog-actions { justify-content: flex-end; gap: 10px; margin: 6px -23px -22px; padding: 17px 23px; border-top: 1px solid var(--line); background: #f9fbfd; }
.selection-summary, .confirmation-copy, .courier-summary { margin: 0; padding: 11px 13px; border-radius: 8px; background: #f4f7fa; color: #40516a; font-size: 12px; line-height: 1.5; }
.confirmation-copy { border-left: 3px solid var(--brand); }

.drawer { width: min(760px, calc(100vw - 16px)); max-width: none; height: calc(100vh - 16px); max-height: none; margin: 8px 8px 8px auto; border-radius: 15px 0 0 15px; }
.drawer-shell { min-height: 100%; }
.drawer-content { padding: 23px; }
.detail-grid { display: grid; gap: 25px; }
.detail-grid > section { padding-bottom: 23px; border-bottom: 1px solid var(--line); }
.detail-grid > section:last-child { padding-bottom: 0; border-bottom: 0; }
.detail-summary dl { display: grid; grid-template-columns: minmax(100px, .6fr) 1.6fr; gap: 9px 18px; margin: 17px 0; }
.detail-summary dt { color: var(--muted); font-size: 12px; font-weight: 750; }
.detail-summary dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: 13px; }
.detail-actions { margin-top: 14px; }
.timeline { position: relative; display: grid; gap: 0; margin: 16px 0 0; padding: 0 0 0 24px; list-style: none; }
.timeline::before { content: ''; position: absolute; top: 7px; bottom: 7px; left: 6px; width: 2px; background: #dce5ee; }
.timeline li { position: relative; display: grid; gap: 3px; padding: 0 0 17px; }
.timeline li::before { content: ''; position: absolute; top: 4px; left: -22px; width: 10px; height: 10px; border: 2px solid #ffffff; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 2px #bfd1e5; }
.timeline span, .timeline small { color: var(--muted); font-size: 11px; }
.notes-list { display: grid; gap: 9px; margin-top: 15px; }
.notes-list article { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.notes-list p { margin: 0 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
.notes-list small { color: var(--muted); }
.inline-form { display: grid; gap: 12px; margin-top: 16px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1220px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
  .filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-reset { justify-self: start; }
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  main { padding: 0 23px 42px; }
  .mobile-nav { display: flex; align-items: center; gap: 18px; margin: 0 -23px 26px; padding: 12px 23px; border-bottom: 1px solid var(--line); background: #102848; }
  .mobile-nav .brand { margin-right: auto; padding: 0; }
  .mobile-nav a:not(.brand) { color: #dce8f9; text-decoration: none; font-size: 13px; }
  .topbar { margin-top: 0; }
  .map-content { grid-template-columns: minmax(0, 1fr); }
  .map-summary { grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
  .map-summary p { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  main { padding-right: 14px; padding-left: 14px; }
  .mobile-nav { gap: 13px; margin-right: -14px; margin-left: -14px; padding-right: 14px; padding-left: 14px; }
  .mobile-nav .brand span:last-child { display: none; }
  .topbar { align-items: flex-start; flex-direction: column; gap: 15px; }
  .top-actions { width: 100%; flex-wrap: wrap; }
  .top-actions .connection-state { margin-right: auto; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .metric-card { padding: 14px; }
  .panel-heading { align-items: flex-start; padding: 18px 16px 14px; }
  .panel-heading:not(.queue-heading) { flex-wrap: wrap; }
  .queue-heading { align-items: center; }
  .filter-bar { grid-template-columns: minmax(0, 1fr); padding: 0 16px 17px; }
  .filter-reset { width: 100%; }
  .table-wrap { display: none; }
  .queue-cards:not([hidden]) { display: grid; }
  .queue-card { display: grid; gap: 13px; padding: 16px; border-top: 1px solid var(--line); }
  .queue-card header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .queue-card dl { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 7px 12px; margin: 0; }
  .queue-card dt { color: var(--muted); font-size: 11px; font-weight: 750; }
  .queue-card dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: 12px; }
  .queue-card .row-actions { justify-content: flex-end; }
  .map-canvas { min-height: 240px; }
  .map-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 16px; }
  .map-list li { align-items: flex-start; flex-direction: column; gap: 4px; padding: 12px 16px; }
  .map-list span { white-space: normal; }
  .alert-item { align-items: flex-start; flex-direction: column; gap: 12px; padding: 15px 16px; }
  .alert-actions { width: 100%; justify-content: flex-end; }
  .form-grid { grid-template-columns: minmax(0, 1fr); padding: 18px; }
  .form-grid .wide { grid-column: auto; }
  .dialog-actions { margin: 6px -18px -18px; padding: 15px 18px; }
  .drawer { width: 100vw; height: 100vh; margin: 0; border-radius: 0; }
  .drawer-content { padding: 18px; }
  .detail-summary dl { grid-template-columns: minmax(85px, .7fr) minmax(0, 1.4fr); }
}

@media (max-width: 390px) {
  .mobile-nav { gap: 10px; }
  .mobile-nav a:not(.brand) { font-size: 12px; }
  .top-actions .connection-state { flex-basis: 100%; width: fit-content; }
  .metric-grid { grid-template-columns: minmax(0, 1fr); }
  .metric-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 12px; }
  .metric-card strong { grid-column: 2; grid-row: 1 / span 2; margin: 0; }
  .metric-card small { grid-column: 1; }
  .queue-heading { align-items: flex-start; flex-direction: column; }
  .panel-actions, .panel-actions .secondary-button { width: 100%; }
  .dialog-actions { align-items: stretch; flex-direction: column-reverse; }
  .dialog-actions button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (forced-colors: active) {
  .status, .connection-state, .metric-card, .alert-item { border: 1px solid CanvasText; }
  .connection-icon, .legend, .timeline li::before { forced-color-adjust: none; }
}

/* Acompanhamento público do destinatário (tracking.html).
   Reutiliza os tokens do design system; não introduz paleta nova. */
.tracking-body { background: var(--page); }
.tracking-page { max-width: 720px; margin: 0 auto; padding: 28px 18px 48px; display: flex; flex-direction: column; gap: 16px; }
.tracking-header h1 { margin: 4px 0 6px; font-size: 26px; letter-spacing: -.4px; }
.tracking-subtitle { margin: 0; color: var(--muted); font-size: 14px; }
.tracking-main { display: flex; flex-direction: column; gap: 16px; }
.tracking-main:focus-visible { outline-offset: 6px; }

.tracking-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.tracking-card h2 { margin: 0 0 10px; font-size: 15px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.tracking-card p { margin: 0 0 6px; }
.tracking-card--muted { background: var(--surface-soft); box-shadow: none; }
/* O erro é comunicado por título, texto e ícone textual, não apenas por cor. */
.tracking-card--error { border-color: #e7b3bf; background: var(--danger-soft); }
.tracking-card--error h2 { color: var(--danger); }
.tracking-card--error h2::before { content: "! "; font-weight: 800; }

.tracking-loading-text { color: var(--muted); }
.tracking-reference { font-size: 13px; color: var(--muted); letter-spacing: .4px; }
.tracking-status { font-size: 24px; font-weight: 760; line-height: 1.25; margin: 2px 0 4px; color: var(--brand-dark); }
.tracking-status-code { font-size: 12px; color: var(--muted); }
.tracking-eta { margin: 14px 0 8px; padding: 12px 14px; border-radius: 10px; background: var(--green-soft); }
.tracking-eta dt { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--green); font-weight: 700; }
.tracking-eta dd { margin: 4px 0 0; font-size: 17px; font-weight: 700; color: var(--ink); }
.tracking-updated { font-size: 12px; color: var(--muted); margin: 0; }
.tracking-note { font-size: 12px; color: var(--muted); }
.tracking-coords { font-size: 13px; font-variant-numeric: tabular-nums; }

.tracking-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.tracking-timeline-item { position: relative; padding: 8px 0 12px 20px; border-left: 2px solid var(--line); }
.tracking-timeline-item:last-child { border-left-color: transparent; }
.tracking-timeline-item::before {
  content: ""; position: absolute; left: -6px; top: 12px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--brand);
}
.tracking-timeline-item:first-child::before { background: var(--brand); }
.tracking-timeline-label { font-weight: 650; margin: 0; }
.tracking-timeline-time { font-size: 12px; color: var(--muted); margin: 2px 0 0; font-variant-numeric: tabular-nums; }
.tracking-timeline-reason { font-size: 12px; color: var(--danger); margin: 4px 0 0; }

.tracking-footer p { font-size: 12px; color: var(--muted); text-align: center; margin: 0; }

@media (max-width: 560px) {
  .tracking-page { padding: 18px 12px 36px; gap: 12px; }
  .tracking-card { padding: 16px; border-radius: 12px; }
  .tracking-status { font-size: 21px; }
  .tracking-header h1 { font-size: 22px; }
}

/* Componentes de marca partilhados por todas as interfaces. */
.brand-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-identity img { display: block; max-height: 34px; max-width: 132px; object-fit: contain; }
.brand-identity-text { display: flex; flex-direction: column; min-width: 0; }
.brand-identity-name { font-weight: 760; letter-spacing: -.2px; line-height: 1.15; overflow-wrap: anywhere; }
.brand-identity-slogan { font-size: 12px; color: var(--muted); line-height: 1.25; }
.brand-powered-by { font-size: 11px; color: var(--muted); letter-spacing: .2px; }
.brand-powered-by[hidden] { display: none !important; }

/* Pré-visualização da marca no portal da empresa. */
.brand-preview { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.brand-preview-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--brand-primary); color: var(--brand-on-primary); }
.brand-preview-sidebar { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 10px; background: var(--brand-secondary); color: var(--brand-on-secondary); }
.brand-preview-button { display: inline-block; padding: 10px 16px; border: 0; border-radius: 8px; background: var(--brand-primary); color: var(--brand-on-primary); font-weight: 700; }
.brand-preview-accent { display: inline-block; padding: 6px 12px; border-radius: 999px; background: var(--brand-accent); color: var(--brand-on-accent); font-size: 12px; font-weight: 700; }
.brand-preview-card { padding: 14px; border: 1px solid var(--line); border-left: 4px solid var(--brand-primary); border-radius: 10px; background: var(--surface-soft); }
.brand-preview-link { color: var(--brand-on-surface); font-weight: 650; }
/* Na pré-visualização, a barra lateral simulada é escura: o slogan herda a cor
   "on-secondary" da marca em vez do cinzento de superfície clara, que só chegaria
   a 2.36:1. */
.brand-preview-sidebar .brand-identity-slogan,
.brand-preview-header .brand-identity-slogan { color: inherit; }
.brand-warnings { margin: 0; padding-left: 18px; font-size: 13px; color: var(--gold); }

.brand-upload-previews { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; margin: 16px 0; }
.brand-upload-preview { min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.brand-upload-preview figcaption { display: grid; gap: 4px; font-size: 14px; }
.brand-upload-preview figcaption span { color: var(--text-muted); font-size: 12px; }
.brand-upload-image { display: flex; align-items: center; justify-content: center; min-height: 148px; margin: 12px 0; padding: 16px; background: var(--surface-soft); border: 1px dashed var(--line); border-radius: 12px; overflow: hidden; }
.brand-upload-image img { display: block; max-width: 100%; max-height: 122px; object-fit: contain; }
.brand-upload-image img[hidden] { display: none; }
.brand-upload-image span { color: var(--text-muted); text-align: center; font-size: 13px; }
.brand-upload-preview p { margin: 0; font-size: 12px; color: var(--text-muted); }


@media (max-width: 560px) {
  .brand-identity img { max-height: 28px; max-width: 104px; }
  .brand-preview { padding: 12px; }
}

/* =====================================================================
   COMPONENTES DO SISTEMA VISUAL
   Um único sistema partilhado pelas seis páginas. Nenhum estilo é
   específico de uma empresa: a identidade entra pelos tokens de marca.
   ===================================================================== */

/* --- Classes que o HTML usava sem definição -------------------------- */
.search-field { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.search-field input {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
}
.wide-field { grid-column: 1 / -1; }
.map-live { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--font-size-xs); font-weight: 700; color: var(--success); }
.map-live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--success); }

/* --- Aparência aplicacional partilhada ------------------------------- */
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); background: var(--bg-app); }
.identity-entry { min-height: 100vh; display: grid; align-content: center; justify-items: center; gap: var(--space-5); padding: var(--space-5); background: var(--bg-app); }
.identity-brand { display: grid; justify-items: center; gap: 2px; color: var(--text-primary); }
.identity-brand strong { font-size: var(--font-size-2xl); letter-spacing: -.5px; }
.identity-brand span { color: var(--text-muted); font-size: var(--font-size-sm); }
.identity-card { width: min(100%, 440px); }
.identity-card h1 { margin-top: 0; }
.shell-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-5) var(--space-4);
  background: var(--bg-sidebar);
  color: var(--text-on-sidebar);
}
.shell-main { min-width: 0; display: flex; flex-direction: column; }
.shell-content { flex: 1; padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-5); max-width: var(--content-max); width: 100%; }

.shell-nav { display: flex; flex-direction: column; gap: var(--space-1); }
.shell-nav a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-on-sidebar);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: 650;
}
.shell-nav a:hover { background: rgb(255 255 255 / 8%); }
/* O item ativo é marcado por barra e peso, nunca apenas por cor. */
.shell-nav a[aria-current="page"] { background: rgb(255 255 255 / 14%); box-shadow: inset 3px 0 0 var(--accent-on-dark); }
.shell-nav-group { font-size: var(--font-size-xs); text-transform: uppercase; letter-spacing: .8px; color: var(--text-on-sidebar-muted); padding: var(--space-3) 12px var(--space-1); }
/* Dentro da barra lateral escura o texto secundário usa o tom próprio: o cinzento
   de superfície clara (--text-muted) só chega a 2.98:1 sobre #102848. */
.shell-sidebar .brand-identity-slogan,
.shell-sidebar .brand-powered-by,
.sidebar .brand-identity-slogan,
.sidebar .brand-powered-by { color: var(--text-on-sidebar-muted); }
.shell-sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: var(--space-2); color: var(--text-on-sidebar-muted); font-size: var(--font-size-xs); }

.shell-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
.shell-topbar h1 { margin: 0; font-size: var(--font-size-xl); line-height: var(--line-tight); letter-spacing: -.4px; }
.breadcrumb { display: flex; gap: var(--space-2); margin: 0 0 2px; padding: 0; list-style: none; font-size: var(--font-size-xs); color: var(--text-muted); }
.breadcrumb li + li::before { content: "/"; margin-right: var(--space-2); color: var(--border-strong); }
.topbar-actions { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.shell-footer { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border); color: var(--text-muted); font-size: var(--font-size-xs); }

/* --- Cartões e secções ----------------------------------------------- */
.card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: var(--space-5); }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); }
.card-title { margin: 0; font-size: var(--font-size-lg); letter-spacing: -.2px; }
.card-subtitle { margin: var(--space-1) 0 0; color: var(--text-muted); font-size: var(--font-size-sm); }
.card-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.stat-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-4); background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.stat-label { font-size: var(--font-size-xs); text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); font-weight: 700; }
.stat-value { font-size: var(--font-size-2xl); font-weight: 760; line-height: var(--line-tight); font-variant-numeric: tabular-nums; }
.stat-hint { font-size: var(--font-size-xs); color: var(--text-muted); }
.stat--accent { border-left: 4px solid var(--brand-primary); }

/* --- Status pills: cor, texto e forma; nunca só cor ------------------ */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-pill); border: 1px solid transparent; font-size: var(--font-size-xs); font-weight: 750; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill--neutral { background: var(--bg-surface-secondary); color: var(--text-secondary); border-color: var(--border); }
.pill--info { background: var(--info-soft); color: var(--info); }
.pill--progress { background: var(--warning-soft); color: var(--warning); }
.pill--success { background: var(--success-soft); color: var(--success); }
.pill--danger { background: var(--danger-soft); color: var(--danger); }
/* Marca de forma distinta, para o estado ser percetível sem cor. */
.pill--danger::before { border-radius: 2px; }
.pill--progress::before { border-radius: 2px; transform: rotate(45deg); }

/* --- Tabela que se converte em cartões ------------------------------- */
.table-scroll { width: 100%; max-width: 100%; overflow-x: auto; }
/* `table-layout: fixed` obriga as colunas a partilhar a largura do cartão:
   moradas longas quebram em vez de empurrarem a página para o lado. */
.data-table { width: 100%; min-width: 0; table-layout: fixed; border-collapse: collapse; font-size: var(--font-size-sm); }
.data-table th, .data-table td { overflow-wrap: anywhere; }
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: var(--space-3);
  background: var(--bg-surface-secondary);
  border-bottom: 1px solid var(--border);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
}
.data-table tbody td { padding: var(--space-3); border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:hover { background: var(--bg-surface-secondary); }
.data-table .numeric { text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  /* Em ecrã estreito a tabela vira lista de cartões: nenhuma operação
     essencial passa a exigir scroll horizontal. */
  .data-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .data-table tbody tr { display: grid; gap: var(--space-2); margin-bottom: var(--space-3); padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-surface); }
  .data-table tbody td { display: flex; justify-content: space-between; gap: var(--space-3); padding: 0; border: 0; }
  .data-table tbody td::before { content: attr(data-label); font-size: var(--font-size-xs); text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); font-weight: 700; }
  .data-table .numeric { text-align: left; }
  .data-table { table-layout: auto; }
  .table-scroll { overflow-x: visible; }
}

/* --- Estados de interface -------------------------------------------- */
.state { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-6) var(--space-4); text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius-md); background: var(--bg-surface-secondary); color: var(--text-secondary); }
.state-title { margin: 0; font-size: var(--font-size-md); font-weight: 700; color: var(--text-primary); }
.state-detail { margin: 0; font-size: var(--font-size-sm); color: var(--text-muted); max-width: 46ch; }
.state--error { border-style: solid; border-color: var(--danger); background: var(--danger-soft); }
.state--error .state-title::before { content: "! "; color: var(--danger); font-weight: 800; }

.skeleton { display: grid; gap: var(--space-3); }
.skeleton-line { height: 14px; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--bg-surface-secondary) 25%, #eef2f7 37%, var(--bg-surface-secondary) 63%); background-size: 400% 100%; animation: skeleton-shimmer 1.4s ease infinite; }
.skeleton-line:nth-child(2) { width: 82%; }
.skeleton-line:nth-child(3) { width: 64%; }
@keyframes skeleton-shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* --- Toasts ----------------------------------------------------------- */
.toast-region { position: fixed; z-index: 60; right: var(--space-4); bottom: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); width: min(360px, calc(100vw - var(--space-6))); }
.toast { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); border: 1px solid var(--border); border-left-width: 4px; background: var(--bg-surface); box-shadow: var(--shadow-lg); font-size: var(--font-size-sm); }
.toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-close { border: 0; background: transparent; color: var(--text-muted); font-size: var(--font-size-lg); line-height: 1; padding: 0 var(--space-1); }
/* Prefixo textual: o tipo é percetível sem depender de cor. */
.toast::before { font-weight: 800; }
.toast--success { border-left-color: var(--success); }
.toast--success::before { content: "OK"; color: var(--success); }
.toast--error { border-left-color: var(--danger); }
.toast--error::before { content: "!"; color: var(--danger); }
.toast--warning { border-left-color: var(--warning); }
.toast--warning::before { content: "!"; color: var(--warning); }
.toast--info { border-left-color: var(--info); }
.toast--info::before { content: "i"; color: var(--info); }

/* --- Modal de confirmação -------------------------------------------- */
.modal { border: 0; padding: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); max-width: min(480px, calc(100vw - var(--space-6))); }
.modal::backdrop { background: var(--bg-overlay); }
.modal-body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.modal-title { margin: 0; font-size: var(--font-size-lg); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--space-3); flex-wrap: wrap; }

/* --- Formulários ------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: var(--font-size-sm); font-weight: 650; color: var(--text-secondary); }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: var(--font-size-md);
}
.field textarea { min-height: 88px; resize: vertical; }
.field input:disabled, .field select:disabled, .field textarea:disabled { background: var(--bg-surface-secondary); color: var(--text-muted); }
.field-help { font-size: var(--font-size-xs); color: var(--text-muted); }
.field-error { font-size: var(--font-size-xs); color: var(--danger); font-weight: 650; }
.field-error::before { content: "! "; font-weight: 800; }
.field[data-invalid="true"] input, .field[data-invalid="true"] select, .field[data-invalid="true"] textarea { border-color: var(--danger); }
.field-row { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; }
.detail-stack { display: grid; gap: var(--space-4); max-width: 1120px; }
.detail-section { display: grid; gap: var(--space-4); padding: var(--space-5); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-surface-secondary); }
.detail-section > h3 { margin: 0; }
.stacked-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.stacked-form > .form-field { display: grid; gap: var(--space-2); min-width: 0; color: var(--text-muted); font-size: var(--font-size-sm); font-weight: 700; }
.stacked-form > .form-field input, .stacked-form > .form-field select { width: 100%; min-width: 0; }
.stacked-form > .form-hint, .stacked-form > .form-actions { grid-column: 1 / -1; }
.fleet-list { display: grid; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.fleet-item { display: grid; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-surface); }
.fleet-item-summary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.fleet-item-summary > :first-child { margin-right: auto; font-weight: 700; }
.fleet-editor { border-top: 1px solid var(--border); padding-top: var(--space-3); }
.fleet-editor summary { cursor: pointer; color: var(--brand-primary); font-weight: 700; }
.fleet-edit-form { margin-top: var(--space-3); }
.report-filters { margin-bottom: var(--space-5); }
.location-picker { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }

/* --- Stepper do assistente ------------------------------------------- */
.stepper { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-5); padding: 0; list-style: none; }
.stepper li { flex: 1 1 140px; display: flex; flex-direction: column; gap: 4px; padding-top: var(--space-2); border-top: 3px solid var(--border); color: var(--text-muted); font-size: var(--font-size-xs); font-weight: 700; }
.stepper li[aria-current="step"] { border-top-color: var(--brand-primary); color: var(--brand-on-surface); }
.stepper li[data-complete="true"] { border-top-color: var(--success); color: var(--success); }

/* --- Timeline vertical ------------------------------------------------ */
.vtimeline { list-style: none; margin: 0; padding: 0; }
.vtimeline li { position: relative; padding: 0 0 var(--space-4) var(--space-5); border-left: 2px solid var(--border); }
.vtimeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.vtimeline li::before { content: ""; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg-surface); border: 2px solid var(--brand-primary); }
.vtimeline li[data-current="true"]::before { background: var(--brand-primary); }
.vtimeline-label { font-weight: 650; }
.vtimeline-time { font-size: var(--font-size-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* --- Navegação inferior da PWA --------------------------------------- */
.bottom-nav { position: sticky; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-1); padding: var(--space-2); background: var(--bg-surface); border-top: 1px solid var(--border); }
.bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  /* Alvo táctil confortável para uso com uma só mão. */
  min-height: 52px;
  padding: var(--space-2);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  font-weight: 700;
}
.bottom-nav button[aria-current="page"] { background: var(--bg-surface-secondary); color: var(--brand-on-surface); box-shadow: inset 0 -3px 0 var(--brand-primary); }

/* --- Ações grandes do estafeta --------------------------------------- */
.action-stack { display: grid; gap: var(--space-3); }
.action-button { min-height: 60px; padding: var(--space-4); border: 0; border-radius: var(--radius-md); background: var(--brand-primary); color: var(--brand-on-primary); font-size: var(--font-size-lg); font-weight: 760; }
.action-button--secondary { background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border-strong); }
.action-button--danger { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); }

/* --- Responsividade da aparência aplicacional ------------------------- */
@media (max-width: 1024px) {
  .shell { grid-template-columns: 1fr; }
  .shell-sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: var(--space-4); overflow-x: auto; padding: var(--space-3) var(--space-4); }
  .shell-nav { flex-direction: row; gap: var(--space-2); }
  .shell-nav-group, .shell-sidebar-footer { display: none; }
  .shell-content { padding: var(--space-4); }
}

@media (max-width: 560px) {
  .shell-topbar { flex-direction: column; align-items: flex-start; gap: var(--space-2); padding: var(--space-3) var(--space-4); }
  .shell-topbar h1 { font-size: var(--font-size-lg); }
  .shell-content { padding: var(--space-3); gap: var(--space-4); }
  .card { padding: var(--space-4); }
  .toast-region { right: var(--space-2); left: var(--space-2); width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-line { animation: none; }
}

@media (forced-colors: active) {
  .pill, .card, .stat, .toast, .state { border: 1px solid CanvasText; }
  .shell-nav a[aria-current="page"] { outline: 2px solid CanvasText; }
}

/* Progresso público da entrega. O estado é dado por posição, texto e cor —
   nunca só por cor (WCAG 2.1 §1.4.1). */
.tracking-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
.tracking-progress li {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  text-align: center;
}
.tracking-progress li::before {
  position: absolute;
  z-index: 0;
  top: 7px;
  left: -50%;
  width: 100%;
  height: 3px;
  background: var(--border-strong);
  content: "";
}
.tracking-progress li:first-child::before { display: none; }
.tracking-progress li > span {
  z-index: 1;
  width: 17px;
  height: 17px;
  border: 3px solid var(--border-strong);
  border-radius: 50%;
  background: var(--bg-surface);
}
.tracking-progress li[data-state="done"] { color: var(--text-secondary); }
.tracking-progress li[data-state="done"]::before,
.tracking-progress li[data-state="current"]::before { background: var(--success); }
.tracking-progress li[data-state="done"] > span { border-color: var(--success); background: var(--success); }
.tracking-progress li[data-state="current"] {
  color: var(--text-primary);
  font-weight: 720;
}
.tracking-progress li[data-state="current"] > span {
  border-color: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft);
}

@media (max-width: 430px) {
  .tracking-progress li small { font-size: 10px; }
}

@media (forced-colors: active) {
  .tracking-progress li > span { forced-color-adjust: none; border-color: CanvasText; }
  .tracking-progress li[data-state="done"] > span { background: CanvasText; }
}

/* =====================================================================
   CVLogistica product polish · identidade comercial 2026
   Camada estritamente visual: os tokens de tenant continuam soberanos.
   ===================================================================== */

body { font-synthesis: none; -webkit-font-smoothing: antialiased; }
a, button, input, select, textarea, .card, .stat, .metric-card, .toast, dialog {
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, box-shadow 180ms ease, transform 180ms ease, opacity 160ms ease;
}

.primary-button {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(105deg, var(--brand-primary), var(--brand-accent));
  box-shadow: 0 9px 24px color-mix(in srgb, var(--brand-primary) 24%, transparent);
  font-weight: 750;
}
.primary-button:hover { background: linear-gradient(105deg, color-mix(in srgb, var(--brand-primary) 88%, #001b43), var(--brand-accent)); box-shadow: 0 12px 28px color-mix(in srgb, var(--brand-primary) 30%, transparent); }
.secondary-button { min-height: 42px; border-color: var(--border-strong); border-radius: 10px; background: var(--bg-surface); color: var(--text-primary); font-weight: 680; }
.secondary-button:hover { border-color: color-mix(in srgb, var(--brand-primary) 36%, var(--border)); background: var(--info-soft); color: var(--brand-on-surface); }
.text-button { color: var(--brand-on-surface); font-weight: 720; }

.card, .operations-panel, .map-panel, .tracking-card {
  border-color: color-mix(in srgb, var(--border) 84%, white);
  box-shadow: var(--shadow-sm);
}
.card:hover { border-color: color-mix(in srgb, var(--brand-primary) 16%, var(--border)); box-shadow: 0 8px 28px rgb(6 22 56 / 7%); }
.card-header { margin-bottom: var(--space-5); }
.card-title { letter-spacing: -.25px; }
.card-subtitle { line-height: 1.55; }

.field > span:first-child { color: var(--text-secondary); font-weight: 700; }
.field input, .field select, .field textarea {
  min-height: 46px;
  border-color: var(--border);
  border-radius: 10px;
  background: #fbfdff;
  box-shadow: inset 0 1px 2px rgb(6 22 56 / 3%);
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--border-strong); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand-primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-primary) 12%, transparent); }

.pill, .status, .connection-state { border: 1px solid currentColor; border-color: color-mix(in srgb, currentColor 18%, transparent); font-weight: 750; letter-spacing: .01em; }
.pill--success, .status-delivered { background: var(--success-soft); color: var(--success); }
.pill--progress, .status-in-transit, .status-assigned { background: var(--info-soft); color: var(--info); }
.pill--danger, .status-delivery-failed, .status-cancelled { background: var(--danger-soft); color: var(--danger); }

/* Entrada única -------------------------------------------------------- */
.identity-entry {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(400px, 42%) minmax(0, 58%);
  align-content: stretch;
  justify-items: stretch;
  gap: 0;
  padding: 0;
  background: #ffffff;
}
.identity-login-panel { display: grid; align-items: center; padding: clamp(32px, 6vw, 88px); background: #fff; }
.identity-login-inner { width: min(100%, 460px); margin: 0 auto; }
.identity-logo { display: block; width: min(100%, 310px); height: 112px; margin: 0 0 clamp(32px, 5vh, 58px); object-fit: cover; object-position: center; }
.identity-intro { margin-bottom: 28px; }
.identity-intro .eyebrow { margin-bottom: 10px; color: var(--brand-on-surface); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.identity-intro h1 { margin: 0 0 10px; color: var(--text-primary); font-size: clamp(30px, 3vw, 42px); letter-spacing: -.045em; line-height: 1.08; }
.identity-intro p:last-child { max-width: 42ch; margin: 0; color: var(--text-muted); line-height: 1.6; }
.identity-form { gap: 18px; }
.identity-submit { width: 100%; min-height: 50px; justify-content: center; font-size: 15px; }
.identity-submit span { margin-left: auto; font-size: 20px; }
.identity-recovery-trigger { display: block; margin: 18px auto 0; }
.identity-flow { margin-top: 22px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-surface-secondary); }
.identity-flow-title { margin: 0 0 14px; font-weight: 780; }
.identity-assurance { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 28px 0 0; color: var(--text-muted); font-size: 12px; }
.identity-assurance span { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; background: var(--success-soft); color: var(--success); font-weight: 900; }
.identity-hero { position: relative; min-height: 100svh; overflow: hidden; background: #061638; color: white; }
.identity-hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 62% center; }
.identity-hero-overlay { position: absolute; inset: 0; background: linear-gradient(90deg, rgb(3 14 41 / 84%) 0%, rgb(3 14 41 / 40%) 48%, rgb(3 14 41 / 20%) 100%), linear-gradient(0deg, rgb(3 14 41 / 72%) 0%, transparent 58%); }

/* Faixa de capacidades no hero do login.
   Mantém-se dentro da identidade CVLogistica e não depende da marca do tenant. */
.identity-feature-rail {
  position: absolute;
  z-index: 2;
  inset: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  min-height: 112px;
  margin: 0;
  padding: 15px clamp(14px, 2vw, 26px);
  list-style: none;
  border-bottom: 1px solid rgb(97 229 255 / 18%);
  background:
    linear-gradient(90deg, rgb(4 22 58 / 96%), rgb(5 37 91 / 91%)),
    radial-gradient(circle at 14% 0%, rgb(44 220 255 / 16%), transparent 36%);
  box-shadow: 0 8px 32px rgb(1 11 32 / 20%);
  backdrop-filter: blur(12px);
}
.identity-feature-rail li {
  min-width: 0;
  display: grid;
  grid-template-rows: 29px auto auto;
  align-content: center;
  justify-items: center;
  gap: 4px;
  padding: 3px 12px;
  text-align: center;
}
.identity-feature-rail li + li { border-left: 1px solid rgb(173 215 255 / 18%); }
.identity-feature-icon { width: 27px; height: 27px; color: #2cdcff; }
.identity-feature-rail strong {
  display: block;
  color: #ffffff;
  font-size: 12px;
  font-weight: 780;
  line-height: 1.2;
  letter-spacing: -.01em;
}
.identity-feature-rail span {
  display: block;
  max-width: 150px;
  color: rgb(239 247 255 / 68%);
  font-size: 10px;
  line-height: 1.35;
}
.identity-hero--with-features .identity-hero-content {
  /* Mantém a mensagem principal livre da faixa superior em ecrãs menos altos. */
  max-height: calc(100svh - 150px);
}
.identity-hero-content { position: absolute; z-index: 1; right: clamp(30px, 7vw, 96px); bottom: clamp(40px, 8vh, 98px); left: clamp(30px, 7vw, 96px); max-width: 720px; }
.hero-kicker { margin: 0 0 18px; color: #61e5ff; font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.identity-hero h2 { max-width: 720px; margin: 0; color: #fff; font-size: clamp(40px, 5vw, 74px); letter-spacing: -.055em; line-height: .98; text-wrap: balance; }
.identity-hero h2 span { color: #2cdcff; }
.identity-hero-content > p:not(.hero-kicker, .platform-status) { max-width: 54ch; margin: 24px 0; color: rgb(239 247 255 / 82%); font-size: clamp(15px, 1.4vw, 18px); line-height: 1.65; }
.identity-benefits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 30px 0; padding: 0; list-style: none; }
.identity-benefits li { padding: 16px; border: 1px solid rgb(120 210 255 / 22%); border-radius: 14px; background: rgb(4 23 58 / 52%); backdrop-filter: blur(12px); }
.identity-benefits strong, .identity-benefits span { display: block; }
.identity-benefits strong { margin-bottom: 4px; color: white; font-size: 13px; }
.identity-benefits span { color: rgb(239 247 255 / 68%); font-size: 11px; line-height: 1.4; }
.platform-status { display: inline-flex; align-items: center; gap: 9px; margin: 0; padding: 9px 13px; border: 1px solid rgb(41 214 156 / 25%); border-radius: var(--radius-pill); background: rgb(4 28 46 / 64%); color: #aaf4d8; font-size: 12px; font-weight: 720; }
.platform-status span { width: 8px; height: 8px; border-radius: 50%; background: #20dc9a; box-shadow: 0 0 0 5px rgb(32 220 154 / 14%); }

/* Shell autenticada --------------------------------------------------- */
.shell { background: linear-gradient(135deg, #f7faff 0%, var(--bg-app) 55%, #eef5ff 100%); }
.shell-sidebar, .sidebar { background: radial-gradient(circle at 20% 0%, #0d3270 0, var(--bg-sidebar) 38%, #04112d 100%); }
.shell-sidebar { padding: 24px 18px; border-right: 1px solid rgb(85 173 255 / 12%); }
.shell-sidebar .brand-identity { min-height: 70px; margin-bottom: 16px; }
.brand-base-logo { display: block; width: 100%; max-width: 202px; height: 68px; object-fit: cover; object-position: center; border-radius: 10px; }
.shell-sidebar .brand-identity > img[data-branding="logo"] { max-width: 190px; max-height: 64px; object-fit: contain; }
.shell-nav { gap: 5px; }
.shell-nav a { min-height: 44px; border: 1px solid transparent; border-radius: 10px; }
.shell-nav a:hover { border-color: rgb(80 196 255 / 14%); background: rgb(33 151 255 / 10%); color: #fff; transform: translateX(2px); }
.shell-nav a[aria-current="page"] { background: linear-gradient(90deg, rgb(10 102 255 / 32%), rgb(0 191 232 / 10%)); box-shadow: inset 3px 0 0 #27d8ff; color: #fff; }
.shell-topbar { min-height: 82px; padding: 15px 28px; background: rgb(255 255 255 / 88%); box-shadow: 0 1px 0 var(--border); backdrop-filter: blur(16px); }
.shell-topbar h1 { font-size: 22px; letter-spacing: -.55px; }
.shell-content { max-width: 1480px; padding: 28px; gap: 24px; }
.shell-footer { background: rgb(255 255 255 / 48%); }
.stat-grid { gap: 14px; }
.stat { position: relative; overflow: hidden; min-height: 120px; padding: 20px; }
.stat::before { position: absolute; inset: 0 auto 0 0; width: 4px; background: linear-gradient(var(--brand-primary), var(--brand-accent)); content: ""; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-value { color: var(--text-primary); font-size: clamp(26px, 2.4vw, 36px); letter-spacing: -.05em; }
.stat-hint { margin-top: auto; }

/* Torre de controlo --------------------------------------------------- */
.operations-page .app-shell { background: linear-gradient(135deg, #f7faff, #eef5ff); }
.operations-page .sidebar { padding: 22px 18px; }
.brand-logo-link img { display: block; width: 205px; height: 76px; object-fit: contain; border-radius: 10px; }
.mobile-nav .brand img { width: 34px; height: 34px; border-radius: 9px; }
.operations-page main { max-width: 1680px; }
.operations-page .topbar { padding-top: 8px; }
.metric-grid { gap: 12px; }
.metric-card { min-height: 116px; border-top-width: 0; border-radius: 14px; box-shadow: var(--shadow-sm); }
.metric-card::before { display: block; width: 30px; height: 4px; margin-bottom: 10px; border-radius: 4px; background: var(--brand-primary); content: ""; }
.metric-card.accent-green::before { background: var(--success); }
.metric-card.accent-gold::before { background: var(--warning); }
.metric-card.accent-violet::before { background: var(--info); }
.metric-card.accent-danger::before { background: var(--danger); }
.operations-page .map-panel { padding: 22px; border-radius: 18px; box-shadow: var(--shadow-md); }
.operations-page .map-canvas { min-height: clamp(390px, 47vh, 640px); border: 1px solid #bcd4ee; border-radius: 16px; background: radial-gradient(circle at 75% 28%, rgb(0 191 232 / 18%), transparent 30%), linear-gradient(145deg, #dcecff, #f5faff 50%, #e7f2ff); }
.operations-page .map-canvas::after { position: absolute; inset: 12% 10%; border: 1px dashed rgb(10 102 255 / 28%); border-radius: 45% 55% 38% 62%; content: ""; transform: rotate(-4deg); }
.queue-panel { border-radius: 18px; }
.drawer { box-shadow: -24px 0 70px rgb(4 17 45 / 20%); transform-origin: right center; }

/* Portal e wizard ----------------------------------------------------- */
#view-dashboard { grid-template-columns: 1fr; }
#view-dashboard > .stat-grid { grid-column: 1 / -1; }
#view-wizard { max-width: 980px; margin: 0 auto; padding: clamp(22px, 4vw, 42px); }
.stepper { counter-reset: product-step; gap: 0; }
.stepper li { position: relative; padding: 40px 10px 0; border-top: 2px solid var(--border); text-align: center; }
.stepper li::before { position: absolute; top: -16px; left: 50%; display: grid; width: 32px; height: 32px; place-items: center; border: 2px solid var(--border); border-radius: 50%; background: white; content: counter(product-step); counter-increment: product-step; transform: translateX(-50%); }
.stepper li[aria-current="step"]::before { border-color: var(--brand-primary); background: var(--brand-primary); color: white; box-shadow: 0 0 0 5px var(--info-soft); }
.stepper li[data-complete="true"]::before { border-color: var(--success); background: var(--success); color: white; }
#wizard-form fieldset { min-height: 320px; padding: 26px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-surface-secondary); }
#wizard-form legend { padding: 0 8px; color: var(--text-primary); font-size: 14px; font-weight: 760; }

/* Tracking público ---------------------------------------------------- */
.tracking-body { background: radial-gradient(circle at 50% 0%, #0f438b 0, #061638 28%, #eef5ff 28.2%); }
.tracking-page { max-width: 880px; padding-top: 42px; }
.tracking-header { padding: 8px 10px 24px; color: #fff; text-align: center; }
.tracking-header .brand-identity { justify-content: center; }
.tracking-header .brand-base-logo { width: min(100%, 300px); height: 92px; margin: 0 auto 14px; }
.tracking-header h1 { margin-top: 12px; color: white; font-size: clamp(28px, 5vw, 42px); letter-spacing: -.04em; }
.tracking-subtitle { color: rgb(239 247 255 / 72%); }
.tracking-main { gap: 18px; }
.tracking-card { padding: clamp(20px, 4vw, 32px); border-radius: 18px; box-shadow: 0 16px 46px rgb(6 22 56 / 10%); }
.tracking-hero { position: relative; overflow: hidden; border-top: 4px solid var(--brand-primary); }
.tracking-hero::after { position: absolute; top: -80px; right: -70px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--brand-accent) 16%, transparent), transparent 70%); content: ""; pointer-events: none; }
.tracking-status { color: var(--brand-on-surface); font-size: clamp(28px, 5vw, 40px); letter-spacing: -.035em; }
.tracking-eta { padding: 18px; border: 1px solid color-mix(in srgb, var(--success) 18%, transparent); border-radius: 14px; }
.tracking-eta dd { font-size: 22px; }
#tracking-courier-card { min-height: 180px; background: radial-gradient(circle at 82% 20%, color-mix(in srgb, var(--brand-accent) 18%, transparent), transparent 26%), linear-gradient(135deg, #f8fbff, #eaf3ff); }
.tracking-timeline-item { padding: 10px 0 18px 26px; border-left-width: 3px; }
.tracking-timeline-item::before { left: -7px; width: 12px; height: 12px; box-shadow: 0 0 0 4px #fff; }

@media (max-width: 1024px) {
  .identity-entry { grid-template-columns: minmax(360px, 48%) minmax(0, 52%); }
  .identity-feature-rail { grid-template-columns: repeat(3, minmax(0, 1fr)); min-height: 166px; padding-block: 11px; }
  .identity-feature-rail li:nth-child(4) { border-left: 0; }
  .identity-feature-rail li:nth-child(n+4) { border-top: 1px solid rgb(173 215 255 / 14%); }
  .identity-login-panel { padding: 36px; }
  .identity-hero-content { right: 34px; bottom: 46px; left: 34px; }
  .identity-benefits { grid-template-columns: 1fr; max-width: 340px; }
  .identity-benefits li:nth-child(n+3) { display: none; }
  .brand-base-logo { max-width: 180px; }
}

@media (max-width: 768px) {
  .stacked-form { grid-template-columns: minmax(0, 1fr); }
  .stacked-form > .form-hint, .stacked-form > .form-actions { grid-column: auto; }
  .detail-section { padding: var(--space-4); }
  .identity-entry { grid-template-columns: 1fr; }
  .identity-login-panel { min-height: 100svh; padding: 34px 22px; }
  .identity-logo { width: 250px; height: 92px; margin-bottom: 34px; }
  .identity-hero { display: none; }
  .shell-topbar { padding-inline: 20px; }
  .shell-content { padding: 20px; }
  .operations-page .map-canvas { min-height: 340px; }
  #wizard-form fieldset { min-height: 0; padding: 20px; }
}

@media (max-width: 430px) {
  .identity-login-panel { padding: 26px 18px; }
  .identity-logo { width: 220px; height: 80px; margin-bottom: 26px; }
  .identity-intro h1 { font-size: 30px; }
  .identity-assurance { align-items: flex-start; text-align: left; }
  .shell-content { padding: 14px; }
  .stat { min-height: 104px; }
  .tracking-page { padding-top: 24px; }
  .tracking-header .brand-base-logo { width: 230px; height: 72px; }
  .stepper li { min-width: 72px; padding-inline: 4px; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Estado comercial da subscrição. Âmbar para restrição (reversível, o cliente
   pode agir) e vermelho para revogação (encerramento). Nunca aparece por
   indisponibilidade da plataforma comercial. */
.limit-warning {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid #e2c66d;
  border-radius: var(--radius-md);
  background: var(--warning-soft);
  color: #5a3d02;
  font-size: var(--font-size-sm);
}
.limit-warning[data-state="OVER_LIMIT"],
.limit-warning[data-state="LIMIT_REACHED"] {
  border-color: #e7b3bf;
  background: var(--danger-soft);
  color: #6e1a2c;
}

/* --- Capacidades e credenciais ----------------------------------------
   Uma capacidade bloqueada continua visível: esconder deixaria o cliente sem
   saber que existe, e sem saber que plano a dá. */
.plan-capabilities { display: grid; gap: var(--space-3); margin-bottom: var(--space-5); }
.plan-capability { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2); padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-md); }
.plan-capability[data-available="false"] { background: var(--bg-muted, #f4f7fb); color: var(--text-muted); }
.plan-capability-name { font-weight: 730; }
.plan-capability-hint { font-size: var(--font-size-sm); }
.api-clients { margin-top: var(--space-4); }
.webhook-form { display: grid; gap: var(--space-3); margin: var(--space-4) 0; }
.webhook-form .secondary-button { justify-self: start; }
.api-secret { padding: var(--space-3) var(--space-4); border: 1px solid #8fd6bb; border-radius: var(--radius-md); background: var(--success-soft); color: #14513b; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--font-size-sm); word-break: break-all; }

/* --- Plano e utilização ----------------------------------------------
   Cartões de comparação. O plano atual é distinguido por texto e moldura,
   nunca só por cor. */
.plan-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.plan-status { margin: 0 0 var(--space-4); font-size: var(--font-size-sm); color: var(--text-secondary); }
.plan-status[data-restricted="true"] { padding: var(--space-3) var(--space-4); border: 1px solid #e7b3bf; border-radius: var(--radius-md); background: var(--danger-soft); color: #6e1a2c; }
.plan-entitlements { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }
.plan-entitlement { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--radius-pill); font-size: var(--font-size-xs); font-weight: 700; }
.plan-entitlement[data-granted="true"] { border-color: #8fd6bb; background: var(--success-soft); color: #14513b; }
.plan-entitlement[data-granted="false"] { color: var(--text-muted); }
.plan-compare-title { margin: var(--space-6) 0 var(--space-3); font-size: var(--font-size-base); }
.plan-catalogue { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.plan-card { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-surface); }
.plan-card[data-current="true"] { border-color: var(--brand-primary); border-width: 2px; box-shadow: var(--shadow-sm); }
.plan-card-name { font-weight: 780; }
.plan-card-badge { align-self: flex-start; padding: 2px 8px; border-radius: var(--radius-pill); background: var(--brand-primary); color: #fff; font-size: var(--font-size-xs); font-weight: 750; }
.plan-card-price { font-size: var(--font-size-sm); color: var(--text-secondary); }
.plan-card-limits { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; font-size: var(--font-size-xs); color: var(--text-secondary); }

@media (max-width: 560px) {
  .plan-actions { width: 100%; }
  .plan-actions > * { flex: 1 1 auto; }
}

/* --- Consumo do plano ------------------------------------------------
   Barras informativas. O estado é sempre dito por texto além da cor: uma
   barra vermelha sozinha não comunica nada a quem não distingue cores. */
.usage-bars { display: grid; gap: var(--space-4); }
.usage-metric { display: grid; gap: 6px; }
.usage-metric-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2); }
.usage-metric-label { font-weight: 720; font-size: var(--font-size-sm); }
.usage-metric-value { font-variant-numeric: tabular-nums; font-weight: 760; color: var(--text-secondary); }
.usage-metric-definition { font-size: var(--font-size-xs); color: var(--text-muted); }
.usage-track { height: 10px; border-radius: var(--radius-pill); background: var(--bg-muted, #eef2f9); overflow: hidden; }
.usage-fill { height: 100%; border-radius: var(--radius-pill); background: var(--brand-primary); transition: width .3s ease; }
.usage-metric[data-status="WARNING"] .usage-fill { background: #c98a05; }
.usage-metric[data-status="LIMIT_REACHED"] .usage-fill,
.usage-metric[data-status="OVER_LIMIT"] .usage-fill { background: #b3243c; }
.usage-metric[data-status="UNKNOWN"] .usage-track { background: repeating-linear-gradient(135deg, #eef2f9, #eef2f9 6px, #e3e9f3 6px, #e3e9f3 12px); }
.usage-freshness { margin: var(--space-4) 0 0; font-size: var(--font-size-xs); color: var(--text-muted); }

@media (prefers-reduced-motion: reduce) {
  .usage-fill { transition: none; }
}

/* Unified Dashboard / App Shell -------------------------------------- */
.shell-nav-link { position: relative; }
.shell-nav-icon { display: grid; width: 24px; height: 24px; flex: 0 0 24px; place-items: center; border-radius: 7px; background: rgb(255 255 255 / 7%); font-size: 15px; }
.shell-menu-button { display: none; }
.shell-drawer-overlay { position: fixed; z-index: 39; inset: 0; display: none; border: 0; background: rgb(3 13 34 / 58%); }
.shell-user-menu { display: inline-flex; align-items: center; gap: 8px; color: var(--text-primary); text-decoration: none; font-size: var(--font-size-sm); font-weight: 700; }
.shell-user-avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent)); color: white; font-size: 11px; letter-spacing: .04em; }
.shell-logout { font-size: 18px; }
.dashboard-primary-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(430px, 1fr); gap: 18px; margin-top: 18px; }
.dashboard-support-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.dashboard-activity-card { margin-top: 18px; }
.map-dashboard-card { position: relative; min-height: 430px; }
.unified-map-canvas { position: relative; min-height: 330px; overflow: hidden; border: 1px solid #bdd4eb; border-radius: 14px; background: radial-gradient(circle at 75% 25%, rgb(0 191 232 / 17%), transparent 25%), linear-gradient(145deg, #deecfc, #f8fbff 55%, #e7f3ff); }
.unified-map-canvas::before { position: absolute; inset: 12% 8%; border: 1px dashed rgb(10 102 255 / 24%); border-radius: 40% 60% 54% 46%; content: ""; transform: rotate(-5deg); }
.unified-map-marker { position: absolute; z-index: 2; width: 14px; height: 14px; border: 3px solid white; border-radius: 50%; background: var(--brand-primary); box-shadow: 0 3px 10px rgb(6 22 56 / 28%); transform: translate(-50%, -50%); }
/* Verde fixo pintava de «disponível» quem estava ocupado, offline ou com um
   problema. A cor passa a vir do estado, calculado em courier-state.js. */
.unified-map-marker--driver { width: 18px; height: 18px; background: var(--estado-cor, var(--success)); }
.unified-map-marker--dropoff { border-radius: 3px; background: var(--danger); transform: translate(-50%, -50%) rotate(45deg); }
.unified-map-grid-label { position: absolute; right: 12px; bottom: 10px; color: var(--text-muted); font-size: 10px; }
.compact-plan-alert { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; padding: 10px 14px; border: 1px solid #e2c66d; border-radius: 10px; background: var(--warning-soft); color: #5a3d02; font-size: var(--font-size-sm); }
.compact-plan-alert[hidden] { display: none; }
.stat--primary::before { background: var(--brand-primary); }
.stat--success::before { background: var(--success); }
.dashboard-alert { display: flex; align-items: center; gap: 10px; padding-block: 8px; border-bottom: 1px solid var(--border); }

@media (max-width: 1024px) {
  .shell { grid-template-columns: 1fr; }
  .shell-sidebar { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: min(290px, 88vw); height: 100vh; align-items: stretch; flex-direction: column; overflow-y: auto; transform: translateX(-105%); transition: transform .2s ease; }
  .shell-nav { flex-direction: column; }
  .shell-nav-group, .shell-sidebar-footer { display: block; }
  .shell-nav-open .shell-sidebar { transform: translateX(0); }
  .shell-nav-open .shell-drawer-overlay { display: block; }
  .shell-menu-button { display: inline-grid; place-items: center; flex: 0 0 auto; }
  .dashboard-primary-grid { grid-template-columns: 1fr; }
  .operations-page .mobile-nav { display: none; }
}

@media (max-width: 768px) {
  .shell-topbar { flex-direction: row; align-items: center; }
  .topbar-actions { margin-left: auto; }
  .operations-page .shell-topbar { align-items: flex-start; flex-direction: column; }
  .operations-page .topbar-actions { width: 100%; margin-left: 0; }
  .topbar-actions > .pill, .shell-user-name, .shell-primary-action { display: none; }
  .dashboard-support-grid { grid-template-columns: 1fr; }
  .map-dashboard-card { min-height: 350px; }
  .unified-map-canvas { min-height: 260px; }
}

.entitlement-banner {
  position: sticky;
  z-index: 19;
  top: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: var(--warning-soft);
  color: #5a3d02;
  border-bottom: 1px solid #e2c66d;
  font-size: var(--font-size-sm);
}
.entitlement-banner[data-mode="REVOKED"] {
  background: var(--danger-soft);
  color: #6e1a2c;
  border-bottom-color: #e7b3bf;
}
.entitlement-banner-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.entitlement-banner-text strong { font-weight: 780; }
.entitlement-banner .secondary-button { flex: 0 0 auto; }

@media (max-width: 560px) {
  .entitlement-banner { padding: var(--space-3) var(--space-4); }
  .entitlement-banner .secondary-button { width: 100%; }
}

/* --- Páginas públicas: perfil e convite (Fase 8F) -------------------------- */
/*
   Servem quem ainda não tem conta. A marca da empresa entra como cor de
   destaque; a identidade da página continua a ser da CVLogistica — sem isso,
   uma página forjada seria indistinguível.
*/
:root { --public-accent: #6048c0; }
.public-page { display: flex; flex-direction: column; min-height: 100vh; align-items: center; justify-content: center; gap: 1.5rem; padding: 2rem 1rem; }
.public-card { width: min(34rem, 100%); background: var(--surface, #fff); border: 1px solid var(--border, #e3e3ec); border-radius: 1rem; padding: 2rem; box-shadow: 0 1px 3px rgb(0 0 0 / 8%); border-top: 4px solid var(--public-accent); }
.public-platform { margin: 0 0 .75rem; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--public-accent); font-weight: 600; }
.public-card h1 { margin: 0 0 .5rem; font-size: 1.5rem; line-height: 1.25; }
.public-type { margin: 0 0 1rem; color: var(--muted, #666); font-size: .9rem; }
.public-facts { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 1.25rem 0 0; font-size: .9rem; }
.public-facts dt { color: var(--muted, #666); }
.public-facts dd { margin: 0; font-weight: 500; }
.public-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; align-items: center; }
.public-actions .primary-action { background: var(--public-accent); color: #fff; padding: .7rem 1.15rem; border-radius: .5rem; text-decoration: none; font-weight: 600; }
.public-state { margin: 1.25rem 0 0; font-size: .85rem; color: var(--muted, #666); }
.public-footer { width: min(34rem, 100%); font-size: .8rem; color: var(--muted, #666); text-align: center; }

/* --- Seletor e comutador de organização (Fase 8F) -------------------------- */
.org-overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgb(20 18 32 / 55%); padding: 1.5rem; }
.org-picker { width: min(30rem, 100%); background: var(--surface, #fff); border-radius: 1rem; padding: 1.75rem; box-shadow: 0 10px 30px rgb(0 0 0 / 20%); }
.org-picker h2 { margin: 0 0 .35rem; font-size: 1.25rem; }
.org-picker p { margin: 0 0 1.25rem; color: var(--muted, #666); font-size: .9rem; }
.org-card-list { display: grid; gap: .6rem; }
.org-card { display: flex; align-items: center; gap: .85rem; width: 100%; text-align: left; padding: .85rem 1rem; border: 1px solid var(--border, #e3e3ec); border-radius: .7rem; background: transparent; cursor: pointer; }
.org-card:hover, .org-card:focus-visible { border-color: var(--public-accent, #6048c0); }
.org-card[disabled] { opacity: .5; cursor: progress; }
.org-card-avatar { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: .55rem; background: var(--public-accent, #6048c0); color: #fff; font-weight: 700; font-size: .8rem; }
.org-card-copy { display: flex; flex-direction: column; }
.org-card-copy small { color: var(--muted, #666); }
.org-switcher-select { border: 1px solid var(--border, #e3e3ec); border-radius: .5rem; padding: .4rem .6rem; background: var(--surface, #fff); font: inherit; max-width: 16rem; }
.qr-block { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; margin-top: 1rem; padding: 1rem; border: 1px dashed var(--border, #e3e3ec); border-radius: .7rem; }
.qr-block code { word-break: break-all; font-size: .85rem; }

/* Ha quanto tempo uma entrega espera por uma decisao humana. Discreto, mas
   sempre visivel: e o que ordena a fila de despacho. */
.waiting-since { display: block; color: var(--warning, #8B5D05); font-size: 0.75rem; margin-top: 0.15rem; }

/* Mapa real da Torre. Mesma altura do esquemático, para a troca entre os dois
   não empurrar o resto do painel. */
.google-map { width: 100%; height: 320px; border-radius: 14px; overflow: hidden; }

/* --- Navegação interna da Torre -------------------------------------------
 *
 * Os quatro módulos da Torre. Estavam com a classe do Portal Empresa, cujo CSS
 * esta página não carrega: saíam como texto solto, sem forma nem estado.
 *
 * Barra própria, construída sobre os tokens existentes. Largura repartida em
 * partes iguais, com um teto — em ecrãs largos os botões param de crescer em
 * vez de se esticarem de margem a margem. O foco herda o contorno global.
 */
.ops-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-5);
  padding: 0 0 var(--space-4);
  border-bottom: 1px solid var(--border);
}

.ops-tabs a {
  flex: 1 1 0;
  min-width: 148px;
  max-width: 232px;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.ops-tabs a:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface-secondary);
  color: var(--text-primary);
}

/* O módulo selecionado é o único preenchido: distingue-se sem depender de cor
 * sozinha — muda o fundo, o contraste e a sombra ao mesmo tempo. */
.ops-tabs a[aria-current="page"] {
  border-color: var(--brand-primary);
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  box-shadow: var(--shadow-sm);
}

.ops-tabs a[aria-current="page"]:hover {
  border-color: var(--brand-primary);
  background: var(--brand-primary);
  color: var(--brand-on-primary);
}

/* Em ecrãs estreitos passam a duas colunas, e nunca a uma linha que transborde. */
@media (max-width: 720px) {
  .ops-tabs a {
    flex: 1 1 calc(50% - var(--space-2));
    min-width: 0;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ops-tabs a { transition: none; }
}

/* --- Listas de cartões da Torre --------------------------------------------
 *
 * A equipa usava `.business-list`, que vive em `business.css` — ficheiro que a
 * Torre não carrega. Os cartões saíam sem moldura e com o nome colado ao email.
 * Foi o mesmo engano dos separadores: emprestar uma classe de outra página.
 */
.ops-list { display: grid; gap: var(--space-3); }

.ops-list article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
}

.ops-list article > div:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ops-list article strong { color: var(--text-primary); }
.ops-list article small { color: var(--text-muted); }

.ops-subheading { margin: var(--space-5) 0 var(--space-3); }

@media (max-width: 720px) {
  .ops-list article { align-items: flex-start; }
}

/* Filtros de painel da Torre: pesquisa e estado lado a lado, e em coluna quando
 * não cabem. Reutiliza `.field`, que já existe. */
.ops-filters { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-bottom: var(--space-4); }
.ops-filters .field { flex: 1 1 220px; min-width: 0; margin: 0; }

/* Ações do mapa operacional: enquadrar e seguir, ao lado da alternativa em lista. */
.map-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.map-actions .secondary-button[aria-pressed="true"] {
  border-color: var(--brand-primary);
  background: var(--brand-primary);
  color: var(--brand-on-primary);
}
.map-actions .secondary-button[disabled] { opacity: .55; cursor: not-allowed; }
.google-map { width: 100%; min-height: 380px; border-radius: var(--radius-sm); }
.map-info { font-size: var(--font-size-sm); line-height: 1.5; color: #202124; }
/* A idade da posição e o problema ativo distinguem-se do resto da ficha sem
   competir com a cor do pino — a cor do estado decide-se em courier-state.js e
   não se repete aqui. */
.map-info-stale { color: var(--text-muted); }
.map-info-problema { color: var(--danger); font-weight: 600; }

/* Legenda do mapa: a cor diz o estado, o desenho diz o veículo, e o texto diz
 * ambos — para quem não distingue as cores. */
.map-legend { display: grid; gap: var(--space-2); margin: var(--space-3) 0 0; padding: 0; list-style: none; }
.map-legend li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
}
.map-legend strong { color: var(--text-primary); font-weight: 700; }
.map-legend small { grid-column: 2 / -1; color: var(--text-muted); }
.map-legend .legend-count { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text-primary); }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.legend-disponivel { background: #0f9d58; }
.legend-ocupado { background: #db4437; }
.legend-problema { background: #e8710a; }
.legend-offline { background: #8492a6; }
.map-legend-note { margin: var(--space-2) 0 0; font-size: var(--font-size-xs); color: var(--text-muted); }

/* Ficha do veículo — painéis internos dentro do módulo Veículos. */
.fleet-detail { margin-top: var(--space-4); padding: var(--space-4); border: 1px solid var(--border-subtle, #e2e8f0); border-radius: var(--radius-md, 10px); background: var(--surface-raised, #fff); }
.fleet-tabs { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-3) 0; }
.fleet-tabs button { padding: var(--space-2) var(--space-3); border: 1px solid var(--border-subtle, #e2e8f0); border-radius: 999px; background: transparent; cursor: pointer; font-size: var(--font-size-sm); }
.fleet-tabs button[aria-current='true'] { background: var(--brand); color: #fff; border-color: var(--brand); }
.fleet-detail-list { display: grid; gap: var(--space-2); margin: var(--space-2) 0 0; padding: 0; list-style: none; }
.fleet-detail-list li { display: grid; gap: 2px; padding: var(--space-2) 0; border-bottom: 1px solid var(--border-subtle, #eef2f7); }
.fleet-detail-list li span { color: var(--text-muted); font-size: var(--font-size-sm); }
.fleet-total { margin-top: var(--space-3); font-weight: 700; }
.fleet-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--space-3); margin: var(--space-3) 0; }
.fleet-summary div { display: grid; gap: 2px; }
.fleet-summary strong { font-size: var(--font-size-lg); }
.fleet-summary span { color: var(--text-muted); font-size: var(--font-size-sm); }
.ops-filters { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: end; margin: var(--space-3) 0; }
.fleet-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: end; margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px dashed var(--border-subtle, #e2e8f0); }
.fleet-actions .field { min-width: 140px; }
.fleet-actions .form-error { flex-basis: 100%; }

/* Remuneração — mesma linguagem nas duas superfícies, estafetas e equipa. */
.compensation-panel { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--border-subtle, #eef2f7); }
.compensation-panel h4 { margin: 0 0 var(--space-2); font-size: var(--font-size-sm); text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.compensation-summary { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--space-3); margin: 0; }
.compensation-summary dt { color: var(--text-muted); font-size: var(--font-size-sm); }
.compensation-summary dd { margin: 0; font-weight: 600; }
.compensation-history { margin-top: var(--space-3); }
.compensation-history h5 { margin: 0 0 var(--space-2); font-size: var(--font-size-sm); color: var(--text-muted); }
.compensation-history ul { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.compensation-history li { display: grid; gap: 2px; padding-left: var(--space-3); border-left: 2px solid var(--border-subtle, #e2e8f0); }
.compensation-history li span { color: var(--text-muted); font-size: var(--font-size-sm); }
.compensation-form { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: end; margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px dashed var(--border-subtle, #e2e8f0); }
.compensation-form .field { min-width: 150px; }
.compensation-form .form-error { flex-basis: 100%; }

/* --- Resultado operacional -------------------------------------------------
 *
 * Uma tabela de dinheiro lê-se pela coluna, não pela linha: os olhos descem os
 * montantes à procura do que destoa. Por isso os números alinham à direita e em
 * tabular-nums, para que as casas fiquem umas por cima das outras.
 */
.finance-result { display: grid; gap: var(--space-5); margin-bottom: var(--space-6); }
.finance-result .section-title { margin: 0; font-size: var(--font-size-lg); color: var(--text-primary); }

.finance-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.finance-table .muted { color: var(--text-muted); font-weight: 400; }
.finance-table tbody th { text-align: left; font-weight: 600; padding: var(--space-3); border-bottom: 1px solid var(--border); }

/* A decomposição da remuneração é recuada e mais discreta: são as duas
 * naturezas da linha acima, não parcelas irmãs. Quem as somasse ao total
 * contaria a remuneração duas vezes, e o recuo é o que evita esse erro de
 * leitura. */
.finance-table .sub-row th { padding-left: var(--space-6); font-weight: 400; color: var(--text-secondary); }
.finance-table .sub-row td { color: var(--text-secondary); }
.finance-table .sub-row { background: var(--bg-surface-secondary); }

.finance-table .total-row th, .finance-table .total-row td {
  border-top: 2px solid var(--border-strong);
  border-bottom: none;
  font-weight: 700;
  color: var(--text-primary);
}

/* O que falta apurar diz-se em texto e à vista, não num rodapé: o resultado
 * ainda não é final e quem o lê tem de o saber antes de decidir. */
.finance-caveat {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border-left: 3px solid var(--border-strong);
  background: var(--bg-surface-secondary);
  border-radius: 0 var(--radius-sm, 6px) var(--radius-sm, 6px) 0;
}


/* Gestao canonica: lista, selecao, barra global, detalhe. */
.mgmt-row { cursor: pointer; }
.mgmt-row.is-selected { outline: 2px solid var(--accent, #c9a227); background: color-mix(in srgb, var(--accent, #c9a227) 12%, transparent); }
.mgmt-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0; }
.mgmt-detail { margin-top: 1rem; padding: 1rem; border: 1px solid var(--border, #d8d2c4); border-radius: 8px; }
.mgmt-filters { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0.75rem 0; }
tr.is-selected, .queue-card.is-selected { outline: 2px solid var(--accent, #c9a227); }

/* Gestao: tabela compacta com selecao e barra global. */
.mgmt-table { width: 100%; min-width: 0; }
.mgmt-table .mgmt-select-cell { width: 2.25rem; text-align: center; }
.mgmt-table tbody tr { cursor: pointer; }
.mgmt-table tbody tr.is-selected { background: #eef5ff; }
.mgmt-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0 0.75rem; min-height: 2.25rem; }
.mgmt-bar button:disabled { opacity: 0.45; cursor: not-allowed; }

/* CVL-UI-10BE: approved sidebar visual */
.shell .shell-sidebar {
  background: #101B32;
  color: #DCE5F2;
  border-right: 1px solid #263753;
}

.shell .shell-sidebar .brand-identity {
  padding-bottom: 16px;
  margin-bottom: 2px;
  border-bottom: 1px solid #33435E;
}

.shell .shell-sidebar .brand-identity-name {
  color: #FFFFFF;
  letter-spacing: .035em;
}

.shell .shell-sidebar .brand-identity-slogan,
.shell .shell-sidebar .brand-powered-by {
  color: #9EADC5;
}

.shell .shell-nav {
  gap: 16px;
}

.shell .shell-nav-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.shell .shell-nav-section-title {
  margin: 0;
  padding: 5px 12px;
  color: #9EADC5;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .09em;
  line-height: 1.5;
}

.shell .shell-nav-section-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.shell .shell-nav-section-links > .shell-nav-link {
  display: flex;
  align-items: center;
  min-height: 43px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  box-shadow: none;
  color: #DCE5F2;
  font-size: 13px;
  font-weight: 550;
  text-decoration: none;
  transform: none;
}

.shell .shell-nav-section-links > .shell-nav-link:hover {
  background: #1B3157;
  border-color: #334D72;
  color: #FFFFFF;
  transform: none;
}

.shell .shell-sidebar-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 9px;
  background: transparent;
  color: #DCE5F2;
  text-align: left;
  cursor: pointer;
  font: inherit;
  appearance: none;
}

.shell .shell-sidebar-logout .shell-nav-icon {
  color: #FFB4B4;
}

.shell .shell-sidebar-logout:hover {
  background: rgb(190 45 45 / 18%);
  border-color: rgb(255 110 110 / 30%);
  color: #FFFFFF;
}

.shell .shell-nav-section-links > .shell-nav-link[aria-current="page"] {
  background: #0A66FF;
  border-color: #0A66FF;
  box-shadow: none;
  color: #FFFFFF;
  font-weight: 700;
}

.shell .shell-nav-section-links .shell-nav-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  background: transparent;
  color: #B9C8DE;
}

.shell .shell-nav-section-links
.shell-nav-link[aria-current="page"] .shell-nav-icon {
  color: #FFFFFF;
}

.shell .shell-nav-section-links .shell-nav-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.shell .shell-nav-group[hidden] {
  display: none !important;
}

.shell .shell-main {
  background: #F4F7FC;
}

.shell .shell-content .card,
.shell .shell-content .stat-card {
  border-radius: 14px;
}

@media (max-width: 1024px) {
  .shell .shell-sidebar {
    background: #101B32;
  }

  .shell .shell-nav {
    flex-direction: column;
  }
}

@media (forced-colors: active) {
  .shell .shell-nav-section-links
  > .shell-nav-link[aria-current="page"] {
    outline: 2px solid Highlight;
    background: Highlight;
    color: HighlightText;
  }
}

/* CVL-UI-10BF: disabled future modules */
.shell .shell-nav-section-links > .shell-nav-link--disabled {
  display: flex;
  align-items: center;
  min-height: 43px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #8193B1;
  background: transparent;
  cursor: not-allowed;
  opacity: .68;
  font-size: 13px;
  font-weight: 550;
}

.shell .shell-nav-section-links
> .shell-nav-link--disabled:hover {
  background: transparent;
  border-color: transparent;
  color: #8193B1;
  transform: none;
}

.shell .shell-nav-link--disabled .shell-nav-icon {
  color: #8193B1;
}

.shell .shell-nav-section-links > .shell-nav-link[aria-current="page"] {
  background: #0A66FF;
  color: #FFFFFF;
}

/* CVL-UI-10BH: accordion navigation */

.shell .shell-nav-section {
  gap: 4px;
}

.shell .shell-nav-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #FFFFFF;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.shell .shell-nav-section-toggle:hover,
.shell .shell-nav-section-toggle[aria-expanded="true"] {
  background: #1B3157;
}

.shell .shell-nav-section-toggle .shell-nav-section-title {
  padding: 0;
  color: #DCE5F2;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .065em;
}

.shell .shell-nav-chevron {
  color: #9EADC5;
  font-size: 20px;
  line-height: 1;
  transition: transform .2s ease;
}

.shell .shell-nav-section-toggle[aria-expanded="true"]
.shell-nav-chevron {
  transform: rotate(180deg);
}

.shell .shell-nav-section-links {
  padding-left: 12px;
}

.shell .shell-nav-section-links[hidden] {
  display: none !important;
}

/* Cabeçalho compacto para nomes longos de organizações. */
.shell .shell-sidebar .brand-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  max-width: 100%;
}

.shell .shell-sidebar .brand-identity-text {
  flex: 1;
  min-width: 0;
  max-width: 100%;
}

.shell .shell-sidebar .brand-identity-name {
  font-size: 13px;
  line-height: 1.3;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.shell .shell-sidebar .brand-identity-slogan {
  font-size: 11px;
  line-height: 1.35;
}

.shell .shell-sidebar .brand-base-logo {
  width: 88px;
  height: 48px;
  max-width: 88px;
  flex: 0 0 88px;
  object-fit: contain;
}

.shell .shell-sidebar {
  overflow-y: auto;
}

@media (prefers-reduced-motion: reduce) {
  .shell .shell-nav-chevron {
    transition: none;
  }
}

/* CVL-UI-10BI: compact sidebar refinements */

.shell .shell-sidebar {
  gap: 10px;
  padding-top: 14px;
}

.shell .shell-nav {
  gap: 4px;
}

.shell .shell-nav-section {
  gap: 2px;
}

.shell .shell-nav-section-toggle {
  min-height: 42px;
  padding: 9px 11px;
}

.shell .shell-nav-section-toggle .shell-nav-section-title {
  font-size: 11px;
  letter-spacing: .06em;
}

.shell .shell-nav-section-links > .shell-nav-link,
.shell .shell-nav-section-links > .shell-nav-link--disabled {
  min-height: 38px;
  padding: 7px 10px;
  font-size: 12px;
}

.shell .shell-sidebar .brand-identity {
  gap: 8px;
  min-height: 54px;
  padding-bottom: 10px;
  margin-bottom: 0;
}

.shell .shell-sidebar .brand-base-logo {
  width: 74px;
  max-width: 74px;
  height: 40px;
  flex-basis: 74px;
}

.shell .shell-sidebar .brand-identity-name {
  font-size: 11px;
  line-height: 1.2;
  font-weight: 650;
}

.shell .shell-sidebar .brand-identity-slogan {
  font-size: 10px;
  line-height: 1.2;
}

.shell .shell-sidebar .brand-identity-text {
  overflow: hidden;
}

.shell .shell-sidebar .brand-identity-name,
.shell .shell-sidebar .brand-identity-slogan {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.shell .shell-sidebar-footer {
  padding-top: 10px;
}

@media (max-width: 1024px) {
  .shell .shell-sidebar {
    gap: 10px;
  }
}

/* CVL-UI-10BK: vertical sidebar branding */

/* Logótipo no topo e identificação da organização abaixo. */
.shell .shell-sidebar .brand-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-height: 0;
  margin: 0 0 8px;
  padding: 6px 4px 15px;
  border-bottom: 1px solid #33435E;
  text-align: center;
}

/* Utilizar o logótipo original da CVLogistica. */
.shell .shell-sidebar .brand-base-logo {
  display: block;
  width: min(170px, 100%);
  max-width: 170px;
  height: 58px;
  flex: 0 0 auto;
  object-fit: contain;
  object-position: center;
}

/* Identidade da organização, sem competir com o logótipo. */
.shell .shell-sidebar .brand-identity-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: visible;
  text-align: center;
}

.shell .shell-sidebar .brand-identity-name {
  display: block;
  width: 100%;
  margin: 0;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

/* Slogan secundário, limitado a duas linhas. */
.shell .shell-sidebar .brand-identity-slogan {
  display: -webkit-box;
  width: 100%;
  margin: 0;
  color: #9EADC5;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

/* Compatibilidade com logótipos personalizados. */
.shell .shell-sidebar
.brand-identity > img[data-branding="logo"]:not([hidden]) {
  display: block;
  width: auto;
  max-width: 170px;
  max-height: 58px;
  height: auto;
  object-fit: contain;
}

/* Preservar o estado hidden de qualquer logótipo. */
.shell .shell-sidebar .brand-identity img[hidden] {
  display: none !important;
}

@media (max-width: 1024px) {
  .shell .shell-sidebar .brand-identity {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

/* CVL186O: internal company branding must show the configured slogan in full. */
.business-page .shell-sidebar .brand-identity-slogan,
.operations-page .shell-sidebar .brand-identity-slogan {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
}


/* CVL119: professional courier onboarding and detail; responsive, keyboard-first */
.courier-create-shell,.courier-detail-layout { width:min(1100px,100%); margin:0 auto; padding:14px; }
.courier-create-header {padding:16px 18px; margin-bottom:14px; border:1px solid var(--line,#dce4ee);border-radius:16px;background:#fff}
.courier-create-header h2 {margin:0 0 6px;font-size:24px}
.courier-create-form {display:grid;gap:16px}
.courier-form-block,.courier-profile-sheet,.courier-profile-header {border:1px solid var(--line,#dce4ee);border-radius:16px;background:#fff;padding:20px}
.courier-form-block h3 {margin:0 0 16px;color:#102543}
.courier-contact-grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.courier-contact-grid .form-field {min-width:0;display:grid;gap:6px}
.courier-contact-grid input,.courier-contact-grid select,.courier-photo-region input {min-height:44px;min-width:0;width:100%;padding:9px 12px;border-radius:9px;border:1px solid #b9c8d8;background:white;color:#122642}
.courier-contact-grid .form-field:focus-within {position:relative;z-index:8}
.courier-profile-save {display:flex;justify-content:flex-end;gap:12px;align-items:center;padding:14px 0 0}
.courier-profile-header {display:flex;align-items:center;gap:18px;margin-bottom:14px}
.courier-profile-avatar {width:72px;height:72px;display:grid;place-items:center;flex-shrink:0;border-radius:20px;font-weight:800;font-size:30px;background:#e9f1ff;color:#075bc7}
.courier-profile-identity {flex:1;min-width:0}
.courier-profile-identity h2 {margin:0 0 5px;font-size:22px;color:#102543}
.courier-profile-identity p {margin:3px 0}
.courier-profile-tabs {display:flex;gap:6px;align-items:center;overflow-x:auto;scrollbar-width:thin;padding:5px 3px 12px}
.courier-profile-tab {border:1px solid #d1dbe7;border-radius:10px;padding:11px 14px;background:white;color:#384a63;font-weight:700;cursor:pointer;white-space:nowrap}
.courier-profile-tab[aria-selected="true"] {background:#0863e5;border-color:#0863e5;color:white;box-shadow:0 4px 15px rgba(0,75,180,.17)}
.courier-profile-tab:focus-visible {outline:3px solid #8db9ff;outline-offset:2px}
.courier-profile-sheet {min-height:240px}
.courier-profile-sheet[hidden] {display:none}
.courier-profile-sheet .detail-section {padding:0 0 22px;margin:0 0 24px;border-bottom:1px solid #e3e9f0;background:transparent}
.courier-profile-sheet .detail-section:last-child {border-bottom:0;margin-bottom:0;padding-bottom:0}
.courier-profile-sheet .detail-section h3 {font-size:17px;color:#122642;margin:0 0 18px}
.courier-contact-form {display:grid;gap:16px}
.courier-photo-region {display:grid;grid-template-columns:100px minmax(0,1fr);gap:18px;align-items:center}
.courier-photo-region .form-field {min-width:0}
.courier-photo-preview,.courier-vehicle-photo-preview {overflow:hidden;display:grid;place-items:center;background:#ecf3ff;color:#315583;border-radius:14px;border:1px dashed #b2c8e3;min-height:90px}
.courier-photo-preview {width:100px;height:100px}
.courier-photo-preview img {width:100%;height:100%;object-fit:cover}
.courier-photo-consent {display:flex;align-items:center;gap:9px;margin:10px 0;line-height:1.45}
.courier-photo-consent input {flex-shrink:0}
.courier-vehicle-photo-grid {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,250px),1fr));gap:14px}
.courier-vehicle-photo-card {display:grid;gap:11px;border:1px solid #dce4ee;border-radius:12px;padding:14px;background:#fbfdff}
.courier-vehicle-photo-card input[type=file] {max-width:100%}
.courier-vehicle-photo-preview {height:155px}
.courier-vehicle-photo-preview img {width:100%;height:100%;object-fit:cover}
.courier-rating-profile {display:grid;gap:12px}
.courier-rating-item {border:1px solid #e2e8f0;border-radius:10px;padding:12px;background:#fbfdff}
.courier-rating-item p {margin:6px 0 0}
@media(max-width:760px){.courier-contact-grid{grid-template-columns:1fr}.courier-profile-header{flex-wrap:wrap}.courier-profile-tabs{margin-inline:-8px}.courier-profile-sheet{padding:14px}.courier-photo-region{grid-template-columns:80px 1fr}.courier-photo-preview{width:80px;height:80px}}

/* CVL120 — shared Enterprise SaaS surfaces. 2026-11-02.
   Glass is reserved for panels and filters; inputs and data tables retain
   opaque backgrounds for contrast, readability and reliable native selects. */
:root {
  --cvl120-page: #e9f1fb;
  --cvl120-glass: rgb(255 255 255 / 82%);
  --cvl120-glass-border: rgb(255 255 255 / 85%);
  --cvl120-shadow: 0 14px 46px rgb(21 49 97 / 9%), 0 2px 9px rgb(28 51 93 / 5%);
  --cvl120-radius: 20px;
}
body:not(.tracking-body):not(.login-page) {
  background-color: var(--cvl120-page);
  background-image:
    radial-gradient(ellipse 75% 55% at 86% 5%, rgb(108 171 253 / 18%), transparent 85%),
    radial-gradient(ellipse 60% 50% at 12% 65%, rgb(89 202 211 / 12%), transparent 85%),
    linear-gradient(145deg, #eff5fc, #e7eff9 55%, #edf5fb);
  background-attachment: fixed;
}
.operations-page .app-shell { background: transparent; }
.operations-page .operations-panel,
.operations-page .map-panel,
.operations-page .fleet-detail,
.operations-page .mgmt-detail,
.operations-page .card,
.business-page .card,
.business-page .business-section,
.operations-page .ops-filters,
.operations-page .fleet-summary {
  background: var(--cvl120-glass);
  border: 1px solid var(--cvl120-glass-border);
  border-radius: var(--cvl120-radius);
  box-shadow: var(--cvl120-shadow);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.operations-page .operations-panel { overflow: visible; }
.operations-page :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea),
.business-page :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  background: rgb(255 255 255 / 96%);
  border-color: #c8d6eb;
  color: #12243e;
  min-width: 0;
}
.operations-page :is(input, select, textarea):focus-visible,
.business-page :is(input, select, textarea):focus-visible {
  outline: 3px solid rgb(16 104 239 / 24%);
  outline-offset: 1px;
  border-color: #256bec;
}
.operations-page .panel-heading .eyebrow {
  letter-spacing: .085em;
}
.operations-page .ops-filters { padding: 12px; gap: 12px; }
.operations-page :is(.data-table, .mgmt-table) { background: rgb(255 255 255 / 97%); }
.operations-page :is(.mgmt-row, .data-table tr) { transition: background-color .16s ease; }
.operations-page :is(.mgmt-row, .data-table tbody tr):hover { background: #f0f6ff; }
.operations-page dialog { border: 1px solid #d5e3f4; border-radius: 20px; box-shadow: 0 28px 90px rgb(3 18 46 / 25%); max-height: min(90vh, 880px); overflow: auto; }
.operations-page dialog::backdrop { background: rgb(6 21 49 / 54%); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.cvl120-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.cvl120-form-grid > .wide { grid-column: 1 / -1; }
.cvl120-form-grid fieldset { min-width: 0; border: 1px solid #d9e4f3; border-radius: 14px; padding: 15px; }
.cvl120-form-grid legend { padding: 0 7px; font-weight: 750; color: #173056; }
.cvl120-form-grid .field { display: grid; gap: 6px; margin: 0; }
.cvl120-form-grid .field span { font-size: .87rem; font-weight: 650; color: #425b80; }
.cvl120-form-note { grid-column: 1 / -1; color: #566b87; font-size: .9rem; }
.cvl120-dialog-intro { margin: -4px 0 18px; color: #566b87; line-height: 1.55; }
.cvl120-tab-switch { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.cvl120-tab-switch button { border: 1px solid #cedbf0; border-radius: 9px; background: #fff; padding: 9px 13px; }
.cvl120-tab-switch button[aria-selected="true"] { color: #0f60d7; border-color: #0f73ee; background: #e9f3ff; font-weight: 750; }
.cvl120-photo-thumb { width: 66px; height: 56px; border-radius: 10px; object-fit: cover; background: #e4edf9; }
.cvl120-vehicle-identity { display: flex; align-items: center; gap: 12px; }
.cvl120-vehicle-meta { display: grid; gap: 4px; }
.cvl120-vehicle-meta small { color: #5b718e; }
.cvl120-divider { border: 0; border-top: 1px solid #dce7f4; margin: 12px 0; }
.operations-page #ops-message { display: none !important; }
@media (max-width: 720px) {
  .cvl120-form-grid { grid-template-columns: minmax(0,1fr); }
  .cvl120-form-grid > .wide { grid-column: auto; }
  .operations-page :is(.operations-panel,.card,.fleet-detail,.mgmt-detail) { border-radius: 14px; }
  .operations-page dialog { width: min(96vw, 680px); }
}
@media (prefers-reduced-transparency: reduce) {
  .operations-page :is(.operations-panel,.map-panel,.fleet-detail,.mgmt-detail,.card,.ops-filters,.fleet-summary),
  .business-page :is(.card,.business-section) { background: #fff; backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  .operations-page :is(.mgmt-row,.data-table tr) { transition: none; }
}

/* CVL120 portfolio statistics, private notes and fleet photo gallery. */
.cvl120-kpi-grid { display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px;margin:16px 0 20px; }
.cvl120-kpi {background:rgb(255 255 255 / 90%);border:1px solid #dbe6f6;border-radius:14px;display:grid;gap:4px;padding:14px 16px; }
.cvl120-kpi strong {font-size:clamp(1.5rem,2.4vw,2rem);line-height:1.15;color:#0c2855;font-variant-numeric:tabular-nums;}
.cvl120-kpi span {color:#5d728e;font-size:.84rem;font-weight:650;}
.cvl120-relationship-notes {border-top:1px solid #dbe5f3;margin-top:20px;padding-top:16px;}
.cvl120-note-entry {padding:12px 14px;margin:9px 0;border:1px solid #dde7f3;border-radius:12px;background:#f8fbff;}
.cvl120-note-entry p {white-space:pre-wrap;overflow-wrap:anywhere;margin:0 0 5px;}
.cvl120-note-entry small {color:#647992;}
.cvl120-photo-gallery {display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:14px;}
.cvl120-photo-tile {margin:0;border:1px solid #dce6f3;border-radius:12px;overflow:hidden;background:#fff;}
.cvl120-photo-tile img {width:100%;height:160px;object-fit:cover;display:block;}
.cvl120-photo-tile figcaption {padding:9px 12px;color:#39577b;}
.cvl120-photo-gallery > form {grid-column:1/-1;}
.cvl120-entry {padding:9px 12px;border-bottom:1px solid #e3ebf5;}
.cvl120-enterprise-panel > h4 {margin:0 0 14px;}

/* Cross-portal CVL120: retain opaque tabular content over glass panels. */
.business-page :is(.card,.business-section,.business-panel,.ops-filters,.mgmt-detail),
.platform-page :is(.card,.platform-panel,.platform-section,.mgmt-detail),
body:not(.tracking-body) .shell-main > .card {
  border: 1px solid rgb(255 255 255 / 82%);
  background: rgb(255 255 255 / 80%);
  box-shadow: var(--cvl120-shadow);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.business-page :is(table,.data-table,.mgmt-table),
.platform-page :is(table,.data-table,.mgmt-table) {
  background: rgb(255 255 255 / 97%);
}
.toast-region { top: 20px; bottom: auto; }
@media (max-width: 720px) {
  .toast-region { top: 12px; bottom: auto; }
}
@media (prefers-reduced-transparency: reduce) {
  .business-page :is(.card,.business-section,.business-panel,.ops-filters,.mgmt-detail),
  .platform-page :is(.card,.platform-panel,.platform-section,.mgmt-detail) {
    background:#fff;-webkit-backdrop-filter:none;backdrop-filter:none;
  }
}

/* CVL120-F: global visual continuity. Preserve dashboard density and readable
   opaque tables and controls; avoid material glass on authentication screens. */
body:not(.tracking-body):not(.login-page) :is(.shell-content,.operations-content) { isolation:isolate; }
body:not(.tracking-body):not(.login-page) :is(.shell-content,.operations-content) > .card,
body.platform-page .platform-metrics,
body.platform-page :is(.platform-state,.platform-list,.platform-split,.platform-finance,.card),
body:not([class]):has(.shell-main) :is(.card,.metric-card,.stat),
body:not([class]):has(.shell-main) .shell-content > section,
body:has(.shell-main) :is(.form-grid,.card-grid) > .card {
  background: var(--cvl120-glass, rgb(255 255 255 / 88%));
  border: 1px solid var(--cvl120-glass-border, #e0ebf6);
  border-radius: var(--cvl120-radius, 20px);
  box-shadow: var(--cvl120-shadow, 0 8px 24px rgb(21 49 97 / 8%));
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
body.platform-page :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea),
body:has(.shell-main) :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea) {
  background: #fff;
  border: 1px solid #c8d6eb;
  color: #12243e;
  min-width: 0;
}
body.platform-page :is(.data-table,.platform-table,.mgmt-table),
body:has(.shell-main) :is(.data-table,.mgmt-table,table) { background: #fff; }
@media (prefers-reduced-transparency: reduce) {
  body.platform-page :is(.platform-state,.platform-list,.platform-split,.platform-finance,.card),
  body:has(.shell-main) :is(.card,.metric-card,.stat) {
    background: #fff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* CVL120-CRM: accessible contact/address cards in the shared enterprise shell. */
.cvl120-directory { display:grid;gap:16px;margin-top:18px; }
.cvl120-directory-card { display:grid;gap:12px;padding:18px;border-radius:16px;
  background:rgb(255 255 255 / 90%);border:1px solid #d7e4f4; }
.cvl120-directory-entry { display:flex;align-items:start;justify-content:space-between;gap:16px;
  padding:12px 0;border-bottom:1px solid #e4ebf5; }
.cvl120-directory-values {display:grid;gap:5px;min-width:0;overflow-wrap:anywhere;}
.cvl120-directory-values p {margin:0;line-height:1.5;}
.cvl120-directory-entry button {flex:none;}
.cvl120-defect-dialog {width:min(94vw,740px);max-height:88vh;overflow:auto;border-radius:18px;
  border:1px solid #c8d6eb;padding:24px;box-shadow:0 24px 80px rgb(9 27 57 / 25%);}
.cvl120-defect-dialog::backdrop {background:rgb(9 24 51 / 52%);}
.cvl120-defect-dialog .cvl120-form-grid > h3 {grid-column:1/-1;margin:0;}
.cvl120-defect-dialog .cvl120-form-grid textarea {min-height:90px;}
@media (max-width:640px) {
  .cvl120-directory-entry {flex-direction:column;}
  .cvl120-defect-dialog {padding:16px;}
}

.cvl120-directory-actions {display:flex;gap:8px;align-items:center;flex:none;}
.cvl120-directory-entry {flex-wrap:wrap;}
.cvl120-directory-entry > .cvl120-form-grid {width:100%;flex:1 1 100%;
  padding:14px;border:1px solid #d7e4f4;border-radius:14px;background:#f8fbff;}
.cvl120-directory-entry > .cvl120-form-grid[hidden] {display:none;}

/* CVL120: compact and accessible administrative actions for Fleet. */
.fleet-action-menu {
  position: relative;
  display: inline-block;
  min-width: 150px;
}
.fleet-action-menu > summary {
  cursor: pointer;
  list-style-position: inside;
  border-radius: var(--radius-md, 14px);
  border: 1px solid var(--border-strong, #c5d2e5);
  color: var(--text-primary, #0c1d3a);
  background: var(--bg-surface, #fff);
  padding: 10px 14px;
  font-weight: 600;
  min-height: 42px;
}
.fleet-action-menu > summary:focus-visible,
.fleet-action-menu-items button:focus-visible {
  outline: 3px solid var(--brand-focus, #075fd8);
  outline-offset: 2px;
}
.fleet-action-menu[open] > summary {
  border-color: var(--brand-primary, #0a66ff);
}
.fleet-action-menu-items {
  position: absolute;
  z-index: 100;
  top: calc(100% + 7px);
  right: 0;
  min-width: 245px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: var(--bg-surface, #fff);
  border: 1px solid var(--border-strong, #c5d2e5);
  border-radius: var(--radius-md, 14px);
  box-shadow: var(--shadow-md, 0 14px 38px rgb(6 22 56 / 10%));
}
.fleet-action-menu-items > button {
  width: 100%;
  text-align: left;
  white-space: normal;
}
@media (max-width: 600px) {
  .fleet-action-menu { width: 100%; }
  .fleet-action-menu-items { left: 0; right: auto; min-width: min(280px, 92vw); }
}


/* CVL125 — consistent pricing and internal team administration. */
#ops-pricing-panel,
[data-ops-view="equipa"] { isolation: isolate; }
#pricing-form-host { position: relative; z-index: 2; margin-top: var(--space-4); }
.pricing-edit-form {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 1.7vw, 20px);
  padding: clamp(18px, 2.4vw, 28px);
  border: 1px solid var(--border, #dbe4f2);
  border-radius: 20px;
  background: linear-gradient(140deg, rgba(255,255,255,.92), rgba(241,245,253,.84));
  box-shadow: 0 18px 45px rgba(22,38,75,.08), inset 0 1px 0 rgba(255,255,255,.9);
  overflow: visible;
}
.pricing-edit-form .wide { grid-column: 1 / -1; min-width: 0; }
.pricing-edit-form .field { min-width: 0; }
.pricing-edit-form :is(input,select,.portal-select-trigger) { width: 100%; min-width: 0; }
.pricing-edit-form label[hidden] { display: none !important; }
.pricing-edit-form .dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.portal-select-original {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.portal-select-trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  min-height: 48px;
  gap: 12px;
  padding: 11px 42px 11px 15px;
  color: var(--text-primary, #172a45);
  background: var(--bg-surface, #fff);
  border: 1px solid var(--border, #ccd7e9);
  border-radius: 12px;
  font: inherit;
  cursor: pointer;
}
.portal-select-trigger::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 42%;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}
.portal-select-trigger.is-placeholder { color: var(--text-muted, #64748b); }
.portal-select-trigger:focus-visible {
  outline: 3px solid rgba(35,98,235,.24);
  outline-offset: 2px;
  border-color: var(--brand-primary, #2464e8);
}
.portal-select-list {
  position: fixed;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  padding: 6px;
  border: 1px solid #ccd7e9;
  border-radius: 14px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 24px 54px rgba(18,39,83,.19);
  overflow-y: auto;
  overscroll-behavior: contain;
  color: #14243e;
}
.portal-select-option {
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 11px 12px;
  text-align: left;
  min-height: 42px;
  cursor: pointer;
}
.portal-select-option:hover,
.portal-select-option:focus-visible,
.portal-select-option[aria-selected="true"] { background: #eaf1ff; color: #143c9a; }
.portal-select-option:disabled { opacity: .45; cursor: not-allowed; }
.portal-select-empty { margin: 10px; font-size: .9rem; color: #64748b; }
.pricing-search-row { display: flex; align-items: center; gap: 12px; margin: 16px 0 12px; }
.pricing-search-wrap { position: relative; display: flex; align-items: center; width: min(100%, 430px); }
.pricing-search-wrap #pricing-search {
  width: 100%;
  min-height: 44px;
  padding: 10px 40px 10px 42px;
  margin: 0;
  background: rgba(255,255,255,.94);
  border: 1px solid var(--border,#cbd6e8);
  border-radius: 12px;
  font-size: .95rem;
  box-shadow: 0 3px 10px rgba(20,45,75,.04);
}
.pricing-search-wrap #pricing-search:focus { border-color: #4570d7; outline: 3px solid rgba(69,112,215,.13); }
.pricing-search-icon { position:absolute; left:14px; pointer-events:none; color:#60799e; font-size:1.65rem; line-height:1; }
.pricing-search-clear { position:absolute; right:9px; min-width:30px; height:30px; border:0; background:transparent; border-radius:7px; cursor:pointer; color:#64748b; font-size:1.35rem; }
.pricing-search-clear[hidden] { display:none; }
#pricing-actions { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-bottom:16px; }
#pricing-list { min-width:0; overflow-x:auto; }
#pricing-list .mgmt-table { min-width:550px; }
.team-invite-form {
  padding: clamp(16px,2vw,26px);
  margin: 16px 0;
  border:1px solid var(--border, #dbe3f2);
  border-radius:18px;
  background:linear-gradient(128deg,rgba(255,255,255,.95),rgba(241,246,255,.85));
  box-shadow:0 12px 30px rgba(18,43,86,.055);
}
.team-invite-form[hidden] { display:none !important; }
.team-form-heading h3 { margin: 0 0 5px; font-size:1.15rem; }
.team-form-heading p { margin:0 0 18px; font-size:.92rem; color:var(--text-muted,#64748b); }
.team-invite-grid { display:grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap:16px; }
.team-invite-grid .field { min-width:0; display:flex; flex-direction:column; gap:7px; }
.team-invite-grid :is(input,select) { width:100%; min-width:0; min-height:46px; padding:10px 14px; border:1px solid var(--border,#cbd6e8); border-radius:11px; background:var(--bg-surface,#fff); color:var(--text-primary,#172a45); }
.team-invite-grid :is(input,select):focus-visible { outline:3px solid rgba(69,112,215,.13); border-color:#4570d7; }
.team-invite-form .field-help { font-size:.83rem; font-weight:400; line-height:1.4; color:var(--text-muted,#64748b); }
.team-invite-footer { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:16px; margin-top:18px; padding-top:16px; border-top:1px solid var(--border,#dde5ef); }
.team-invite-footer p { flex:1 1 250px; margin:0; }
.team-action-bar { align-items:center; gap:8px; min-height:56px; padding:12px 0; border-bottom:1px solid var(--border,#e2e8f0); }
.team-action-bar button { flex:0 0 auto; max-width:100%; }
.team-action-bar button:disabled { opacity:.53; filter:saturate(.5); cursor:not-allowed; }
.team-toolbar-hint { color:var(--text-muted,#64748b); font-size:.86rem; line-height:1.4; margin:15px 0 5px; }
.team-search-wrap { position:relative; }
.team-search-wrap input { padding-left:42px !important; }
.team-search-icon { position:absolute; left:14px; top:50%; transform:translateY(-50%); line-height:1; font-size:1.6rem; pointer-events:none; color:#667fa4; }
.team-detail { border-radius:16px; padding:clamp(16px,2vw,24px); background:rgba(255,255,255,.94); box-shadow:0 10px 30px rgba(24,50,94,.06); }
.team-detail-content { display:grid; gap:12px; }
.team-detail-help { margin:0; color:var(--text-muted,#64748b); font-size:.89rem; }
.team-detail-content form.form-grid { display:flex; flex-wrap:wrap; gap:12px; align-items:end; }
.team-detail-content form.form-grid .field { flex:1 1 220px; min-width:0; }
.team-detail-content form.form-grid button { flex:0 0 auto; }
[data-ops-view="equipa"] .mgmt-table { min-width:790px; }
#team-list { overflow-x:auto; }
#team-invites-block { margin-top:24px; }
@media (max-width:720px) {
  .pricing-edit-form,.team-invite-grid { grid-template-columns:minmax(0,1fr); }
  .pricing-edit-form .wide { grid-column:1; }
  .team-invite-footer .primary-button { width:100%; }
  .team-action-bar { overflow-x:auto; flex-wrap:nowrap; padding-bottom:16px; }
  .team-action-bar button { white-space:nowrap; }
}
@media (prefers-reduced-motion:reduce) {
  .portal-select-trigger,.portal-select-option { transition:none; }
}


/* CVL126/127 — professional courier profile, logistics client onboarding and regional coverage. */
.service-areas-card {
  margin: 24px 0;
  padding: clamp(18px, 2.3vw, 28px);
  border-radius: 20px;
  border: 1px solid var(--border, #d8e4f4);
  background: linear-gradient(137deg,rgba(255,255,255,.96),rgba(244,248,255,.85));
  box-shadow: 0 14px 38px rgba(32,58,101,.07);
}
.service-areas-card .panel-heading { margin: 0 0 8px; }
.service-areas-card .panel-heading h3 { margin:0; font-size:1.2rem; }
.service-area-list { display:grid; gap:10px; margin:20px 0; }
.service-area-card { display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; padding:14px 16px; border:1px solid var(--border,#d9e4f2); border-radius:13px; background:rgba(255,255,255,.91); }
.service-area-card-info { display:grid; gap:5px; min-width:0; }
.service-area-card-info strong { color:var(--text-primary,#162a48); }
.service-area-card-info small { color:var(--text-muted,#687b98); }
.service-area-form { display:grid; gap:15px; padding:20px; border:1px solid var(--border,#d9e4f2); border-radius:16px; background:rgba(246,250,255,.8); }
.service-area-form > h4 { margin:0; font-size:1.05rem; }
.service-area-form > p { margin:0; }
.service-area-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.service-area-grid .field { min-width:0; display:grid; gap:7px; }
.service-area-grid :is(input,select) { min-width:0; width:100%; min-height:46px; padding:10px 12px; border:1px solid var(--border,#cbd9e9); border-radius:10px; background:var(--bg-surface,#fff); color:var(--text-primary,#172a45); }
.service-area-form > button { justify-self:start; }
.service-area-form .form-error:empty { display:none; }
.courier-profile-header {
  background: linear-gradient(120deg,rgba(255,255,255,.96),rgba(237,244,255,.88));
  box-shadow:0 12px 32px rgba(24,52,99,.07);
  border-radius:20px;
  padding:clamp(18px,2.2vw,30px);
}
.courier-profile-avatar {
  width:96px; height:96px; overflow:hidden; border-radius:24px;
  background:linear-gradient(145deg,#e4efff,#d5e4fa);
  box-shadow:0 8px 24px rgba(38,65,118,.12);
  border:2px solid rgba(255,255,255,.96);
}
.courier-profile-avatar img { width:100%; height:100%; object-fit:cover; display:block; }
.courier-profile-identity { flex:1; min-width:200px; }
.courier-profile-identity > h2 { margin:0 0 6px; }
.courier-hero-metrics { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.courier-hero-metric { display:inline-flex; align-items:center; min-height:34px; padding:6px 12px; border-radius:999px; color:#1a416b; background:#e9f2ff; border:1px solid #d5e4f9; font-size:.82rem; font-weight:650; }
.courier-operations-metrics { display:grid; grid-template-columns:repeat(auto-fit,minmax(155px,1fr)); gap:12px; margin:12px 0; }
.courier-operations-metrics article { display:grid; gap:6px; padding:15px; border:1px solid var(--border,#d9e3f2); border-radius:13px; background:linear-gradient(155deg,#fff,#f5f8ff); }
.courier-operations-metrics article span { color:var(--text-muted,#62728d); font-size:.82rem; }
.courier-operations-metrics article strong { color:var(--text-primary,#192a45); font-size:1rem; overflow-wrap:anywhere; }
#clients-new-dialog { width:min(750px,calc(100vw - 28px)); max-width:100%; max-height:min(88dvh,900px); overflow-y:auto; border-radius:22px; }
#clients-new-dialog .dialog-heading { position:sticky; top:0; z-index:2; background:rgba(255,255,255,.96); backdrop-filter:blur(14px); padding:20px 24px; }
#clients-new-dialog #clients-new-form { padding:20px 24px 24px; }
.client-onboard-intro { background:linear-gradient(130deg,#f2f7ff,#fff); border-left:4px solid #2563eb; border-radius:12px; padding:16px 19px; }
.client-onboard-intro strong { color:#12294c; }
.client-onboard-intro p { margin:6px 0 0; font-size:.93rem; line-height:1.55; color:#49617c; }
.client-onboard-next { margin-top:7px; padding:17px; background:#f5f8ff; border:1px solid #dae5f6; border-radius:15px; }
.client-onboard-next > strong { display:block; color:#193152; margin-bottom:12px; }
.client-onboard-next-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.client-onboard-next-grid > div { padding:12px; background:#fff; border:1px solid #dce6f4; border-radius:11px; display:grid; gap:7px; }
.client-onboard-next-grid span { color:#213b60; font-weight:700; }
.client-onboard-next-grid small { color:#62728b; line-height:1.45; }
.client-onboard-next > p { margin:12px 0 0; font-size:.88rem; color:#596f89; }
.client-logistics-help { margin:16px 0; padding:14px 16px; border-left:3px solid #477fe5; background:#f1f6ff; color:#244262; border-radius:0 10px 10px 0; line-height:1.5; }
@media (max-width:720px) {
  .service-area-grid { grid-template-columns:1fr; }
  .client-onboard-next-grid { grid-template-columns:1fr; }
  .courier-profile-avatar { width:78px; height:78px; border-radius:19px; }
  #clients-new-dialog .dialog-heading { padding:15px; }
  #clients-new-dialog #clients-new-form { padding:14px; }
}

.courier-delivery-overview { display:grid; gap:14px; }
.courier-recent-deliveries { display:grid; gap:10px; }
.courier-recent-deliveries h4 { margin:0 0 3px; font-size:1rem; }
.courier-recent-row { display:grid; grid-template-columns:minmax(160px,1.5fr) minmax(100px,1fr) auto; gap:10px; align-items:center; border:1px solid var(--border,#d8e4f0); border-radius:11px; padding:12px 15px; background:rgba(255,255,255,.95); font-size:.9rem; }
.courier-recent-row span { color:var(--text-muted,#64748b); }
.courier-recent-row time { color:var(--text-muted,#64748b); font-variant-numeric:tabular-nums; }
@media(max-width:640px){.courier-recent-row{grid-template-columns:1fr}.courier-recent-row time{font-size:.82rem}}


/* CVL152 — one-time invitation credential. The QR is the bearer link itself. */
.invite-credential-card { display:grid; grid-template-columns:minmax(0,1fr) 220px; gap:20px; align-items:center; margin:16px 0; padding:18px; border:1px solid var(--border,#dbe3f2); border-radius:16px; background:linear-gradient(135deg,#fff,#f3f7ff); }
.invite-credential-copy { display:grid; gap:10px; min-width:0; }
.invite-credential-copy code { overflow-wrap:anywhere; white-space:normal; }
.invite-qr-wrap { display:grid; place-items:center; gap:8px; padding:12px; background:#fff; border:1px solid #dce5f1; border-radius:14px; }
.invite-qr-image { width:196px; max-width:100%; height:auto; aspect-ratio:1; display:block; }
.invite-qr-caption { margin:0; text-align:center; color:var(--text-muted,#64748b); font-size:.78rem; line-height:1.35; }
@media(max-width:680px){ .invite-credential-card{grid-template-columns:1fr}.invite-qr-wrap{justify-self:stretch}.invite-qr-image{width:min(220px,75vw)} }


/* CVL154 — professional delivery rate-card builder. */
.pricing-form-host { margin-top:18px; }
.pricing-builder {
  display:grid;
  gap:18px;
  margin-top:18px;
  padding:clamp(18px,2.2vw,30px);
  border:1px solid var(--border,#dbe4f2);
  border-radius:22px;
  background:linear-gradient(138deg,rgba(255,255,255,.97),rgba(241,247,255,.9));
  box-shadow:0 20px 52px rgba(21,43,82,.09),inset 0 1px 0 rgba(255,255,255,.96);
}
.pricing-builder-header {
  display:flex;
  justify-content:space-between;
  gap:18px;
  align-items:flex-start;
}
.pricing-builder-header h3 { margin:4px 0 6px; font-size:clamp(1.25rem,2vw,1.65rem); }
.pricing-builder-header p { margin:0; }
.pricing-builder-section {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px 18px;
  padding:18px;
  border:1px solid var(--border,#dbe4f2);
  border-radius:17px;
  background:rgba(255,255,255,.83);
  box-shadow:0 8px 24px rgba(25,55,95,.045);
}
.pricing-builder-section > .wide,
.pricing-builder-section > .pricing-section-heading,
.pricing-builder-section > .pricing-section-heading-row,
.pricing-builder-section > .pricing-route-table,
.pricing-builder-section > .pricing-warning,
.pricing-builder-section > .field-help {
  grid-column:1/-1;
}
.pricing-builder .field {
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:7px;
  font-weight:650;
  color:var(--text-primary,#172a45);
}
.pricing-builder :is(input,select) {
  width:100%;
  min-width:0;
  min-height:46px;
  padding:10px 13px;
  border:1px solid var(--border,#cad7e9);
  border-radius:11px;
  background:rgba(255,255,255,.97);
  color:var(--text-primary,#172a45);
  font:inherit;
}
.pricing-builder :is(input,select):focus {
  border-color:#3e6ee8;
  outline:3px solid rgba(62,110,232,.13);
}
.pricing-section-heading {
  font-size:1.02rem;
  font-weight:800;
  color:var(--text-primary,#132744);
}
.pricing-section-heading-row {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
}
.pricing-section-heading-row p { margin:5px 0 0; }
.pricing-inline-actions {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.pricing-file-button {
  position:relative;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}
.pricing-warning {
  padding:12px 14px;
  border:1px solid #f0cc7a;
  border-radius:12px;
  background:#fff8e7;
  color:#6b4c08;
}
.pricing-route-table {
  min-width:0;
  overflow-x:auto;
  border:1px solid var(--border,#dbe4f2);
  border-radius:14px;
  background:#fff;
}
.pricing-route-head,
.pricing-route-row {
  display:grid;
  grid-template-columns:
    minmax(170px,1.2fr)
    minmax(155px,1fr)
    minmax(155px,1fr)
    minmax(110px,.65fr)
    minmax(110px,.65fr)
    minmax(215px,1.1fr)
    42px;
  gap:8px;
  align-items:center;
  min-width:1050px;
  padding:10px 12px;
}
.pricing-route-head {
  background:#f4f7fc;
  border-bottom:1px solid var(--border,#dbe4f2);
  color:var(--text-muted,#60718c);
  font-size:.76rem;
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase;
}
.pricing-route-row { border-bottom:1px solid var(--border,#edf1f7); }
.pricing-route-row:last-child { border-bottom:0; }
.pricing-route-row :is(input,select) { min-height:40px; padding:8px 9px; }
.pricing-route-notes {
  grid-column:1/-1;
  min-height:40px !important;
  background:#f9fbff !important;
}
.pricing-time-window {
  display:grid;
  grid-template-columns:minmax(80px,1fr) auto minmax(80px,1fr);
  gap:5px;
  align-items:center;
}
.pricing-time-window input { min-width:0; }
.pricing-time-window span { color:var(--text-muted,#64748b); }
.pricing-check {
  display:flex;
  align-items:center;
  gap:9px;
  min-height:46px;
  align-self:end;
}
.pricing-check input { width:18px; min-height:18px; height:18px; flex:0 0 auto; }
.pricing-simulator {
  background:linear-gradient(135deg,rgba(239,246,255,.94),rgba(250,252,255,.94));
}
.pricing-simulation-result {
  grid-column:1/-1;
  display:flex;
  gap:12px 18px;
  flex-wrap:wrap;
  align-items:center;
  min-height:50px;
  padding:12px 14px;
  border:1px solid var(--border,#d5e0ef);
  border-radius:12px;
  background:#fff;
}
.pricing-simulation-result strong { font-size:1.08rem; color:var(--text-primary,#142541); }
.pricing-builder-status {
  min-height:22px;
  margin:0;
  padding:0 4px;
}
.pricing-builder-actions {
  margin-top:0;
  padding-top:16px;
  border-top:1px solid var(--border,#dbe4f2);
}
.pricing-detail-routes {
  display:grid;
  gap:8px;
  margin-top:10px;
}
.pricing-detail-route {
  display:grid;
  grid-template-columns:minmax(150px,1fr) minmax(150px,1fr) minmax(180px,1.2fr);
  gap:10px;
  padding:10px 12px;
  border:1px solid var(--border,#e0e7f1);
  border-radius:11px;
  background:#fbfdff;
  font-size:.88rem;
}
.pricing-detail-route span { color:var(--text-muted,#65758f); }

@media (max-width:820px) {
  .pricing-builder-section { grid-template-columns:minmax(0,1fr); }
  .pricing-builder-section > * { grid-column:1 !important; }
  .pricing-section-heading-row { flex-direction:column; }
  .pricing-inline-actions { justify-content:flex-start; }
  .pricing-detail-route { grid-template-columns:minmax(0,1fr); }
}
@media (max-width:560px) {
  .pricing-builder { padding:14px; border-radius:16px; }
  .pricing-builder-section { padding:14px; }
  .pricing-search-row { align-items:stretch; flex-direction:column; }
  .pricing-search-wrap { width:100%; }
  .pricing-search-row > .secondary-button { width:100%; }
}


/* CVL154 — nested tariff-zone management. */
.service-area-block {
  display:grid;
  gap:10px;
}
.service-area-card-actions {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.service-zone-manager {
  display:grid;
  gap:14px;
  padding:16px;
  margin:-2px 8px 12px;
  border:1px solid var(--border,#dce5f1);
  border-radius:15px;
  background:linear-gradient(135deg,rgba(247,250,255,.98),rgba(255,255,255,.96));
}
.service-zone-manager[hidden] { display:none !important; }
.service-zone-heading { display:grid; gap:4px; }
.service-zone-title {
  font-size:1rem;
  font-weight:800;
  color:var(--text-primary,#142743);
}
.service-zone-heading p { margin:0; }
.service-zone-list { display:grid; gap:8px; }
.service-zone-card {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:11px 13px;
  border:1px solid var(--border,#e0e7f1);
  border-radius:11px;
  background:#fff;
}
.service-zone-card-info { display:grid; gap:3px; min-width:0; }
.service-zone-card-info strong { color:var(--text-primary,#172a45); }
.service-zone-card-info small { color:var(--text-muted,#697993); }
.service-zone-form {
  display:grid;
  gap:12px;
  padding:15px;
  border:1px solid var(--border,#dbe4f0);
  border-radius:13px;
  background:rgba(255,255,255,.9);
}
.service-zone-form h5 { margin:0; font-size:.98rem; }
.service-zone-map,
.service-area-map {
  height:340px;
  min-height:260px;
  border:1px solid var(--border,#cbd7e8);
  border-radius:12px;
  overflow:hidden;
  background:#eef4fb;
}
.service-zone-map[hidden],
.service-area-map[hidden] { display:none !important; }

@media (max-width:680px) {
  .service-area-card,
  .service-zone-card { align-items:stretch; flex-direction:column; }
  .service-area-card-actions { justify-content:flex-start; }
  .service-area-card-actions > button,
  .service-zone-card > button { width:100%; }
  .service-zone-manager { margin-left:0; margin-right:0; }
}


/* CVL186A — Business shell: sidebar retrátil, logout no rodapé e logo íntegro. */
.shell-sidebar-collapse {
  width: 100%;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 9px;
  background: rgb(255 255 255 / 4%);
  color: #dce8f8;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.shell-sidebar-collapse:hover,
.shell-sidebar-collapse:focus-visible {
  border-color: rgb(76 201 255 / 35%);
  background: rgb(33 151 255 / 10%);
  color: #fff;
}
.shell-sidebar-collapse:focus-visible {
  outline: 2px solid #59d7ff;
  outline-offset: 2px;
}

.shell .shell-sidebar .brand-base-logo {
  width: min(184px, 100%);
  max-width: 184px;
  height: 62px;
  object-fit: contain;
  object-position: center;
  border-radius: 0;
}
.shell .shell-sidebar .brand-identity > img[data-branding="logo"]:not([hidden]) {
  width: auto;
  max-width: min(184px, 100%);
  max-height: 62px;
  height: auto;
  object-fit: contain;
  object-position: center;
}

.shell-sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgb(255 255 255 / 10%);
}
.shell-sidebar-logout {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 10px;
  background: rgb(255 255 255 / 5%);
  color: #f3f7fd;
  font: inherit;
  font-size: 12px;
  font-weight: 720;
  text-align: left;
  cursor: pointer;
}
.shell-sidebar-logout:hover,
.shell-sidebar-logout:focus-visible {
  border-color: rgb(255 124 145 / 38%);
  background: rgb(211 61 88 / 14%);
  color: #fff;
}
.shell-sidebar-logout:focus-visible {
  outline: 2px solid #ff9caf;
  outline-offset: 2px;
}

@media (min-width: 1025px) {
  body.shell-sidebar-collapsed .shell {
    grid-template-columns: 78px minmax(0, 1fr);
  }
  body.shell-sidebar-collapsed .shell-sidebar {
    align-items: center;
    padding-inline: 10px;
  }
  body.shell-sidebar-collapsed .shell-sidebar .brand-identity {
    width: 100%;
    padding: 5px 0 11px;
  }
  body.shell-sidebar-collapsed .shell-sidebar .brand-base-logo {
    width: 48px;
    max-width: 48px;
    height: 42px;
  }
  body.shell-sidebar-collapsed .shell-sidebar .brand-identity > img[data-branding="logo"]:not([hidden]) {
    max-width: 48px;
    max-height: 42px;
  }
  body.shell-sidebar-collapsed .shell-sidebar .brand-identity-text,
  body.shell-sidebar-collapsed .shell-sidebar .shell-nav,
  body.shell-sidebar-collapsed .shell-sidebar .brand-powered-by {
    display: none !important;
  }
  body.shell-sidebar-collapsed .shell-sidebar-collapse {
    width: 46px;
    justify-content: center;
    padding-inline: 0;
    font-size: 24px;
    line-height: 1;
  }
  body.shell-sidebar-collapsed .shell-sidebar-footer {
    width: 100%;
  }
  body.shell-sidebar-collapsed .shell-sidebar-logout {
    width: 46px;
    justify-content: center;
    margin-inline: auto;
    padding-inline: 0;
  }
  body.shell-sidebar-collapsed .shell-sidebar-logout .shell-nav-label {
    display: none;
  }
}

@media (max-width: 1024px) {
  .shell-sidebar-collapse {
    display: none !important;
  }
  body.shell-sidebar-collapsed .shell {
    grid-template-columns: 1fr;
  }
  body.shell-sidebar-collapsed .shell-sidebar .brand-identity-text {
    display: flex !important;
  }
  body.shell-sidebar-collapsed .shell-sidebar .shell-nav {
    display: flex !important;
  }
  body.shell-sidebar-collapsed .shell-sidebar .brand-powered-by {
    display: block;
  }
}


/* CVL186B — sidebar principal fixa; apenas submenus são retráteis. */
.shell-sidebar-collapse {
  display: none !important;
}

@media (min-width: 1025px) {
  body.shell-sidebar-collapsed .shell {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }
  body.shell-sidebar-collapsed .shell-sidebar {
    align-items: stretch;
    padding: 24px 18px;
  }
  body.shell-sidebar-collapsed .shell-sidebar .brand-identity-text {
    display: flex !important;
  }
  body.shell-sidebar-collapsed .shell-sidebar .shell-nav {
    display: flex !important;
  }
  body.shell-sidebar-collapsed .shell-sidebar .brand-powered-by {
    display: block !important;
  }
  body.shell-sidebar-collapsed .shell-sidebar .brand-base-logo {
    width: min(184px, 100%);
    max-width: 184px;
    height: 62px;
  }
  body.shell-sidebar-collapsed .shell-sidebar .brand-identity > img[data-branding="logo"]:not([hidden]) {
    max-width: min(184px, 100%);
    max-height: 62px;
  }
  body.shell-sidebar-collapsed .shell-sidebar-footer {
    width: auto;
  }
  body.shell-sidebar-collapsed .shell-sidebar-logout {
    width: 100%;
    justify-content: flex-start;
    margin-inline: 0;
    padding-inline: 11px;
  }
  body.shell-sidebar-collapsed .shell-sidebar-logout .shell-nav-label {
    display: inline;
  }
}

.shell .shell-nav-section {
  display: grid;
  gap: 4px;
}

.shell .shell-nav-section-toggle {
  min-height: 50px;
  padding: 11px 12px;
  border-radius: 10px;
}

.shell .shell-nav-section-toggle .shell-nav-section-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .055em;
}

.shell .shell-nav-chevron {
  margin-left: auto;
  font-size: 22px;
}

.shell .shell-nav-section-links {
  display: grid;
  gap: 3px;
  padding: 2px 0 7px 14px;
}

.shell .shell-nav-section-links[hidden] {
  display: none !important;
}

.shell .shell-nav-section-links > .shell-nav-link,
.shell .shell-nav-section-links > .shell-nav-link--disabled {
  min-height: 38px;
  padding: 8px 10px;
}

.shell .shell-sidebar-footer {
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgb(4 17 45 / 0%), #04112d 18%, #04112d 100%);
  padding-top: 18px;
  padding-bottom: 4px;
}
