:root {
  --ink: #111111;
  --ink-soft: #232323;
  --surface: #ffffff;
  --surface-soft: #f6f5f2;
  --surface-muted: #eceae4;
  --border: #d8d5ce;
  --text: #1d1d1b;
  --muted: #6b6b66;
  --brand: #b89b5e;
  --brand-dark: #745f32;
  --brand-soft: #f1eadc;
  --success: #2f7d4f;
  --success-soft: #e8f4ec;
  --warning: #a96013;
  --warning-soft: #fff1dc;
  --danger: #a53030;
  --danger-soft: #fdeaea;
  --info: #2673b8;
  --shadow: 0 8px 24px rgba(16, 16, 16, 0.08);
  --radius: 10px;
  --topbar-height: 68px;
  /* Trecho da barra do painel que corresponde a pontos ainda sem coordenada.
     Precisa ser nitidamente mais escuro que o trilho, senão o comprimento da
     barra — que é a quantidade de pontos — deixa de ser legível. */
  --bar-uncovered: #cfcabb;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--surface-soft);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
svg { display: block; fill: currentColor; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  height: var(--topbar-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
  position: sticky;
  top: 0;
  z-index: 1200;
  background: var(--ink);
  color: #fff;
  border-bottom: 1px solid #303030;
}
.brand {
  min-width: 224px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: #fff;
}
.brand-emblem {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #363636;
}
.brand-copy { display: grid; gap: 3px; line-height: 1.05; }
.brand-copy strong { font-size: 14px; letter-spacing: 0.04em; }
.brand-copy small { color: #aaa; font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em; }
.main-nav { height: 100%; display: flex; align-items: center; gap: 5px; flex: 1; }
.main-nav a {
  min-height: 42px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #bdbdbd;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
}
.main-nav a svg { width: 18px; height: 18px; }
.main-nav a:hover, .main-nav a.active { background: #292929; color: #fff; }
.main-nav a.active { box-shadow: inset 0 -2px 0 var(--brand); }

.account-menu { position: relative; }
.account-menu summary {
  min-height: 44px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border-radius: 8px;
  padding: 4px 7px;
  color: #ddd;
}
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary:hover { background: #292929; }
.account-menu summary > svg { width: 17px; height: 17px; }
.account-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: var(--ink);
  font-weight: 900;
}
.account-name { font-size: 12px; font-weight: 700; }
.account-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow);
}
.account-popover a, .account-popover button {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  display: flex;
  align-items: center;
  padding: 0 10px;
  cursor: pointer;
  color: var(--text);
  font-weight: 650;
}
.account-popover a:hover, .account-popover button:hover { background: var(--surface-soft); }
.account-popover form { margin: 0; }

.page-shell { max-width: 1380px; margin: 0 auto; padding: 28px; }
.messages { position: fixed; z-index: 2000; top: 82px; right: 20px; display: grid; gap: 8px; width: min(380px, calc(100vw - 40px)); }
.message { padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: #fff; box-shadow: var(--shadow); transition: opacity 0.2s, transform 0.2s; }
.message.success { border-color: #b8d9c3; background: var(--success-soft); }
.message.error { border-color: #edb7b7; background: var(--danger-soft); color: var(--danger); }
.message-leaving { opacity: 0; transform: translateY(-6px); }

.page-heading {
  margin-bottom: 20px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}
.page-heading h1 { margin: 4px 0 4px; font-size: clamp(27px, 4vw, 38px); letter-spacing: -0.035em; }
.page-heading p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--brand-dark); text-transform: uppercase; letter-spacing: 0.14em; font-size: 10px; font-weight: 900; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  font-weight: 800;
  line-height: 1;
}
.button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid rgba(184, 155, 94, 0.45);
  outline-offset: 2px;
}
.button.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.button.primary:hover { background: #2a2a2a; }
.button.secondary { background: #fff; color: var(--text); border-color: var(--border); }
.button.secondary:hover { background: var(--surface-soft); }
.button.full { width: 100%; }

.card, .table-card, .form-card, .toolbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card { padding: 22px; }
.section-title { margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-title h2 { margin: 0; font-size: 19px; }
.section-title a { color: var(--brand-dark); font-size: 13px; font-weight: 850; }
.empty-state, .muted { color: var(--muted); }
.empty-state { margin: 12px 0 0; }

.dashboard-shell {
  width: 100%;
  max-width: none;
  height: calc(100vh - var(--topbar-height));
  padding: 0;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  grid-template-areas: "panel map";
  background: var(--surface-muted);
}
.dashboard-panel {
  grid-area: panel;
  padding: 22px;
  overflow-y: auto;
  background: #fff;
  border-right: 1px solid var(--border);
}
.dashboard-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 17px; }
.dashboard-heading h1 { margin: 3px 0 3px; font-size: 27px; letter-spacing: -0.035em; }
.dashboard-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.dashboard-heading .button { flex: 0 0 auto; }
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-bottom: 13px; }
.kpi-card { min-height: 78px; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-soft); }
.kpi-card span { display: block; color: var(--muted); font-size: 11px; font-weight: 750; }
.kpi-card strong { display: block; margin-top: 4px; font-size: 26px; line-height: 1; color: var(--ink); }
.kpi-card.warning { background: var(--warning-soft); border-color: #efcf9f; }
.kpi-card.warning strong { color: var(--warning); }
.filter-card { padding: 0; border: 1px solid var(--border); border-radius: 9px; background: #fff; }
.filter-card > summary { min-height: 44px; padding: 0 13px; display: flex; align-items: center; cursor: pointer; font-size: 12px; font-weight: 850; }
.filter-card > summary::marker { color: var(--brand-dark); }
.filter-grid { padding: 0 13px 13px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.filter-search { grid-column: 1 / -1; }
.filter-grid label, .toolbar label, .field label, .stack-form label { display: block; margin-bottom: 5px; color: #4d4d49; font-size: 11px; font-weight: 800; }
.filter-grid input, .filter-grid select, .toolbar input, .toolbar select, .form-control, .stack-form input, .app-form input, .app-form select, .app-form textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #c9c6bf;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 9px 11px;
}
.app-form textarea { min-height: 112px; resize: vertical; }
.map-legend { padding: 0 13px 13px; display: flex; flex-wrap: wrap; gap: 7px 12px; color: var(--muted); font-size: 10px; }
.map-legend span { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.legend-dot.ice { background: #2673b8; }
.legend-dot.beverage { background: #c56520; }
.legend-dot.mixed { background: #348252; }
.legend-dot.unknown { background: #6d7278; }
.upcoming-section { margin-top: 18px; }
.upcoming-list { display: grid; }
.map-wrap { grid-area: map; min-width: 0; position: relative; background: #d9d8d3; }
.map-wrap #map { width: 100%; height: 100%; min-height: 480px; }
.map-count { position: absolute; z-index: 600; top: 15px; right: 15px; padding: 9px 12px; border-radius: 8px; background: rgba(17, 17, 17, 0.92); color: #fff; font-size: 12px; font-weight: 800; box-shadow: var(--shadow); }

.toolbar { margin-bottom: 16px; padding: 12px; display: flex; align-items: end; gap: 10px; }
.toolbar > div { min-width: 190px; }
.toolbar .toolbar-search { flex: 1; }
.compact-toolbar { width: fit-content; }
.table-card { overflow: hidden; }
.table-responsive { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid #ebe9e3; vertical-align: middle; text-align: left; }
th { background: #f3f2ee; color: #66645e; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
td { font-size: 13px; }
td strong { display: block; }
td small { display: block; margin-top: 3px; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #faf9f6; }
.table-action { width: 178px; text-align: right; }

/* Duas ações na linha da tabela, lado a lado e com a mesma forma. Empilhadas numa
   coluna estreita elas pareciam duas linhas soltas de texto em vez de dois botões. */
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.row-actions form { display: contents; }
.row-action {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--brand-dark);
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
  cursor: pointer;
}
.row-action:hover { border-color: var(--brand); background: var(--brand-soft); }
.row-action.danger { color: var(--danger); }
.row-action.danger:hover { border-color: #d9a3a3; background: var(--danger-soft); }
/* Enquanto a edição rápida está aberta, o botão mostra que é ele que a controla. */
.client-row.editando .quick-edit-toggle { border-color: var(--brand); background: var(--brand-soft); }
.table-link { color: var(--brand-dark); font-weight: 850; }
.empty-cell { padding: 28px; text-align: center; color: var(--muted); }
.status { display: inline-flex; min-height: 26px; padding: 0 8px; align-items: center; border-radius: 999px; background: #ededeb; color: #555; font-size: 10px; font-weight: 850; white-space: nowrap; }
.status.success, .status.completed { background: var(--success-soft); color: var(--success); }
.status.pending, .status.scheduled { background: var(--warning-soft); color: var(--warning); }
.status.cancelled { background: var(--danger-soft); color: var(--danger); }
.status.rescheduled { background: #eaf0fb; color: #315f9f; }
/* "Aproximado" fica no azul, e não no âmbar de "Pendente": não é a mesma fila de
   trabalho. Pendente é cadastro que falta; aproximado é coordenada que existe e
   precisa de refinamento. */
.status.warning { background: #eaf0fb; color: #315f9f; }
.pagination { min-height: 52px; display: flex; justify-content: center; align-items: center; gap: 16px; color: var(--muted); font-size: 13px; }
.pagination a { color: var(--brand-dark); font-weight: 800; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: 16px; }
.span-2 { grid-column: 1 / -1; }
.info-list { margin: 0; }
.info-list > div { padding: 11px 0; border-bottom: 1px solid #eceae4; }
.info-list dt { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; }
.info-list dd { margin: 4px 0 0; font-weight: 650; overflow-wrap: anywhere; }
.client-notes { margin: 16px 0; padding: 13px; border-radius: 8px; background: var(--surface-soft); }
.client-notes p { margin: 5px 0 0; }
.timeline article { position: relative; display: grid; grid-template-columns: 14px 1fr; gap: 9px; margin-bottom: 16px; }
.timeline article:not(:last-child)::after { content: ""; position: absolute; left: 4px; top: 15px; bottom: -15px; width: 1px; background: #dfdcd5; }
.timeline-dot { width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: var(--brand-dark); box-shadow: 0 0 0 4px var(--brand-soft); }
.timeline time { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.timeline p { margin: 6px 0 0; line-height: 1.5; }

.form-heading { max-width: 920px; margin-inline: auto; }
.form-card { max-width: 920px; margin: 0 auto; padding: 22px; }
.app-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field small { display: block; margin-top: 5px; color: var(--muted); }
.field-error { display: block; margin-top: 5px; color: var(--danger); font-size: 12px; }
.field-error + .field-error { margin-top: 2px; }
.form-global-error { padding: 12px; border: 1px solid #edb7b7; border-radius: 8px; background: var(--danger-soft); color: var(--danger); }
.form-global-error ul { margin: 0; padding-left: 18px; }
.form-actions { padding-top: 8px; display: flex; justify-content: flex-end; gap: 8px; }

.login-page { min-height: 100vh; background: #0d0d0d; }
.login-shell { max-width: none; min-height: 100vh; padding: 0; }
.login-stage { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, 0.9fr); }
.login-brand-panel { padding: clamp(36px, 7vw, 92px); display: flex; align-items: flex-end; gap: 24px; background: radial-gradient(circle at 25% 20%, #36301f 0, #161616 40%, #080808 100%); color: #fff; }
.login-hero-logo { width: clamp(100px, 13vw, 170px); aspect-ratio: 1; object-fit: cover; border-radius: 18px; border: 1px solid #434343; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35); }
.login-brand-panel h1 { margin: 5px 0; font-size: clamp(34px, 5vw, 62px); letter-spacing: -0.045em; }
.login-brand-panel p { margin: 0; color: #bfbfbf; }
.login-card { padding: clamp(30px, 7vw, 88px); display: flex; flex-direction: column; justify-content: center; background: #fff; }
.login-card h2 { margin: 20px 0 16px; font-size: 30px; }
.login-combo-logo { width: min(240px, 80%); max-height: 86px; object-fit: contain; object-position: left center; }
.stack-form { display: grid; gap: 8px; }
.stack-form .message { margin-bottom: 5px; box-shadow: none; }
.stack-form .button { margin-top: 8px; }

.popup-card { min-width: 230px; border-top: 4px solid var(--popup-color, var(--brand)); padding-top: 6px; }
.popup-title { margin-bottom: 3px; color: var(--ink); font-weight: 900; font-size: 15px; }
.popup-meta { color: var(--muted); font-size: 11px; }
.popup-profile { display: inline-flex; margin: 8px 0; padding: 3px 7px; border-radius: 999px; color: #fff; font-size: 10px; font-weight: 800; }
.popup-info { margin-top: 5px; line-height: 1.4; }
.popup-info a { color: var(--brand-dark); font-weight: 750; }
.popup-actions { margin-top: 11px; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.popup-actions a { min-height: 38px; border: 1px solid #d5d1c8; border-radius: 7px; display: grid; place-items: center; font-weight: 800; font-size: 11px; }
.leaflet-popup-content-wrapper { border-radius: 10px; }
.leaflet-control-zoom a { color: var(--ink); }

.mobile-nav { display: none; }

@media (max-width: 980px) {
  .topbar { padding: 0 16px; }
  .brand { min-width: auto; }
  .brand-copy small { display: none; }
  .account-name { display: none; }
  .dashboard-shell { grid-template-columns: 320px minmax(0, 1fr); }
  .page-shell:not(.dashboard-shell):not(.login-shell) { padding: 22px; }
}

@media (max-width: 760px) {
  :root { --topbar-height: 58px; }
  body { padding-bottom: 66px; }
  .topbar { height: var(--topbar-height); padding: 0 14px; position: sticky; }
  .brand-emblem { width: 36px; height: 36px; }
  .brand-copy strong { font-size: 13px; }
  .main-nav { display: none; }
  .account-menu { margin-left: auto; }
  .account-menu summary > svg, .account-name { display: none; }
  .account-popover { top: calc(100% + 5px); }
  .mobile-nav {
    height: 66px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    position: fixed;
    z-index: 1600;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
  }
  .mobile-nav a { min-height: 62px; display: grid; place-content: center; justify-items: center; gap: 3px; color: var(--muted); font-size: 10px; font-weight: 800; }
  .mobile-nav a svg { width: 21px; height: 21px; }
  .mobile-nav a.active { color: var(--ink); box-shadow: inset 0 3px 0 var(--brand); }
  .page-shell:not(.dashboard-shell):not(.login-shell) { padding: 18px 14px 24px; }
  .page-heading { align-items: flex-start; }
  .page-heading h1 { font-size: 29px; }
  .client-heading { display: grid; }
  .client-heading .actions { width: 100%; }
  .client-heading .actions .button { flex: 1; }

  .dashboard-shell {
    height: auto;
    min-height: calc(100vh - var(--topbar-height) - 66px);
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas: "map" "panel";
  }
  .map-wrap #map { height: 54vh; min-height: 380px; }
  .dashboard-panel { padding: 16px 14px 24px; border-right: 0; border-top: 1px solid var(--border); overflow: visible; }
  .dashboard-heading h1 { font-size: 25px; }
  .dashboard-heading p { display: none; }
  .dashboard-heading .button { min-height: 40px; padding-inline: 12px; }
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); overflow-x: auto; padding-bottom: 2px; }
  .kpi-card { min-width: 95px; min-height: 70px; }
  .kpi-card strong { font-size: 23px; }
  .filter-grid { grid-template-columns: 1fr; }
  .filter-search { grid-column: auto; }
  .map-count { top: 12px; right: 12px; }

  .toolbar { align-items: stretch; display: grid; grid-template-columns: 1fr; }
  .toolbar > div { min-width: 0; }
  .toolbar .button { width: 100%; }
  .compact-toolbar { width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .app-form { grid-template-columns: 1fr; }
  .form-actions { position: sticky; bottom: 74px; z-index: 20; margin: 0 -22px -22px; padding: 12px 22px; background: rgba(255, 255, 255, 0.96); border-top: 1px solid var(--border); }
  .form-actions .button { flex: 1; }

  .responsive-table thead { display: none; }
  .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
  /* O `display: block` acima vence o `display: none` que o navegador aplica ao
     atributo `hidden`, e sem esta linha as 30 linhas de edição rápida da lista
     apareciam todas abertas no celular — a página inteira virava um formulário e
     o botão "Editar" não tinha o que abrir. Regra por atributo tem especificidade
     maior, então não precisa de `!important`. */
  .responsive-table tr[hidden], .responsive-table td[hidden] { display: none; }
  .responsive-table tr { padding: 13px 14px; border-bottom: 1px solid var(--border); }
  .responsive-table tr:last-child { border-bottom: 0; }
  .responsive-table td { min-height: 30px; padding: 4px 0; border: 0; display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 10px; align-items: baseline; }
  .responsive-table td::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }
  .responsive-table td:first-child { display: block; padding-bottom: 8px; }
  .responsive-table td:first-child::before, .responsive-table .table-action::before, .responsive-table .empty-cell::before { display: none; }
  /* `display: block` é necessário: a célula herdaria o grid de duas colunas de
     `.responsive-table td`, e o grupo de botões cairia na primeira coluna, de
     100px, transbordando em vez de dividir a largura. */
  .responsive-table .table-action { display: block; width: 100%; text-align: left; padding-top: 10px; }
  .responsive-table .table-link { min-height: 40px; border: 1px solid var(--border); border-radius: 7px; display: flex; align-items: center; justify-content: center; }
  /* Lado a lado também no celular, dividindo a largura: dois blocos de altura
     cheia empilhados ocupariam metade da tela por linha da tabela. */
  .responsive-table .row-actions { gap: 8px; }
  .responsive-table .row-action { flex: 1 1 0; min-height: 40px; font-size: 13px; }
  .responsive-table .empty-cell { display: block; text-align: center; }

  .login-page { padding-bottom: 0; }
  .login-stage { grid-template-columns: 1fr; }
  .login-brand-panel { min-height: 30vh; padding: 28px 22px; align-items: center; }
  .login-hero-logo { width: 82px; border-radius: 13px; }
  .login-brand-panel h1 { font-size: 32px; }
  .login-brand-panel p { display: none; }
  .login-card { min-height: 70vh; padding: 30px 22px; justify-content: flex-start; }
  .login-combo-logo { width: 190px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* =========================================================
   v0.5.0 — Workspace de mapa e painel operacional separado
   ========================================================= */
.form-intro {
  max-width: 920px;
  margin: -8px auto 16px;
  color: var(--muted);
  line-height: 1.55;
}

body.map-workspace-page {
  height: 100vh;
  padding-bottom: 0;
  overflow: hidden;
  background: #d9d8d3;
}
.map-workspace-shell {
  width: 100%;
  max-width: none;
  height: calc(100vh - var(--topbar-height));
  padding: 0;
  overflow: hidden;
}
.map-workspace {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #d9d8d3;
}
.workspace-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.map-search-card {
  position: absolute;
  z-index: 700;
  top: 16px;
  left: 82px;
  width: min(420px, calc(100vw - 600px));
  min-width: 280px;
  height: 50px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(8px);
}
.map-search-card svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  color: var(--muted);
}
.map-search-card input {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}
.map-search-card input::placeholder { color: #8a8983; }

.map-filter-rail {
  position: absolute;
  z-index: 760;
  top: 16px;
  left: 16px;
  display: grid;
  gap: 8px;
}
.map-filter-anchor { position: relative; }
.map-filter-button {
  position: relative;
  width: 50px;
  height: 50px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(17, 17, 17, 0.13);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.97);
  color: #393936;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.13);
  transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.map-filter-button:hover { transform: translateY(-1px); border-color: rgba(17, 17, 17, 0.28); }
.map-filter-button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.map-filter-button.danger { color: var(--danger); }
.map-filter-button.danger:hover { background: var(--danger-soft); border-color: #e8bcbc; }
.map-filter-button svg { width: 22px; height: 22px; }
.map-filter-button::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  min-width: max-content;
  padding: 7px 9px;
  border-radius: 7px;
  background: rgba(17, 17, 17, 0.94);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.map-filter-button:hover::after,
.map-filter-button:focus-visible::after { opacity: 1; transform: translateY(-50%) translateX(0); }
.city-filter-popover {
  position: absolute;
  left: 62px;
  top: 0;
  width: 250px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.17);
}
.city-filter-popover label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.city-filter-popover select {
  width: 100%;
  min-height: 43px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.map-status-cluster {
  position: absolute;
  z-index: 650;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.map-active-filter,
.map-status-cluster .map-count {
  position: static;
  padding: 9px 12px;
  border-radius: 9px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
  font-size: 11px;
  font-weight: 800;
}
.map-active-filter { background: rgba(255, 255, 255, 0.96); color: var(--text); }
.map-status-cluster .map-count { background: rgba(17, 17, 17, 0.93); color: #fff; }
.map-compact-legend {
  position: absolute;
  z-index: 620;
  left: 16px;
  bottom: 16px;
  padding: 8px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  border: 1px solid rgba(17, 17, 17, 0.1);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.93);
  color: var(--muted);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.1);
  font-size: 10px;
  font-weight: 700;
}
.map-compact-legend span { display: flex; align-items: center; gap: 5px; }

.client-drawer {
  position: absolute;
  z-index: 900;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: min(390px, calc(100vw - 32px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid rgba(17, 17, 17, 0.13);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.985);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.23);
  transform: translateX(calc(100% + 34px));
  visibility: hidden;
  transition: transform 0.24s ease, visibility 0.24s;
  overflow: hidden;
}
.client-drawer.open { transform: translateX(0); visibility: visible; }
.client-drawer-header {
  min-height: 102px;
  padding: 20px 20px 17px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(145deg, #161616, #29261f);
  color: #fff;
}
.drawer-eyebrow {
  color: #d2c7af;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.client-drawer-header h2 {
  margin: 5px 0 4px;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: -0.025em;
}
.client-drawer-header p { margin: 0; color: #bbb; font-size: 12px; }
.drawer-close {
  width: 38px;
  height: 38px;
  padding: 0;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid #4a4a4a;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  cursor: pointer;
}
.drawer-close:hover { background: rgba(255, 255, 255, 0.14); }
.drawer-close svg { width: 18px; height: 18px; }
.client-drawer-body { min-height: 0; padding: 18px 20px; overflow-y: auto; overscroll-behavior: contain; }
.drawer-section + .drawer-section { margin-top: 20px; }
.drawer-section h3 {
  margin: 0 0 9px;
  color: #5f5e59;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.drawer-contact-section {
  padding: 2px 0 4px;
  border-bottom: 1px solid #ece9e2;
}
.drawer-data-row { padding: 10px 0; display: grid; gap: 4px; }
.drawer-data-row span,
.drawer-timeline-card span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.drawer-data-row strong,
.drawer-data-row a { color: var(--text); font-size: 13px; font-weight: 760; line-height: 1.45; overflow-wrap: anywhere; }
.drawer-data-row a:not(.disabled) { color: var(--brand-dark); }
.drawer-data-row a.disabled { pointer-events: none; color: var(--muted); }
.drawer-timeline-card {
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-soft);
}
.drawer-timeline-card + .drawer-timeline-card { margin-top: 8px; }
.drawer-timeline-card.accent { border-color: #d6c393; background: var(--brand-soft); }
.drawer-timeline-card strong { display: block; margin-top: 4px; font-size: 13px; }
.drawer-timeline-card small { display: block; margin-top: 3px; color: var(--muted); }
.drawer-note-card,
.drawer-empty-data {
  padding: 13px;
  border-radius: 9px;
  background: #f4f3ef;
}
.drawer-note-card span { color: var(--brand-dark); font-size: 10px; font-weight: 850; }
.drawer-note-card p { margin: 7px 0 0; line-height: 1.5; font-size: 13px; }
.drawer-empty-data { display: grid; gap: 4px; border: 1px dashed #d2cec3; }
.drawer-empty-data strong { font-size: 13px; }
.drawer-empty-data span { color: var(--muted); font-size: 11px; line-height: 1.45; }
.client-drawer-actions {
  padding: 13px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border-top: 1px solid var(--border);
  background: #fff;
}
.drawer-action {
  min-height: 42px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #fff;
  color: var(--text);
  font-size: 11px;
  font-weight: 850;
}
.drawer-action:hover { background: var(--surface-soft); }
.drawer-action.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.drawer-action.disabled { pointer-events: none; opacity: 0.5; }
.drawer-backdrop { display: none; }
.map-workspace.drawer-open .map-status-cluster { right: 422px; }
.map-workspace.drawer-open .leaflet-control-zoom { margin-right: 410px; }
.map-status-cluster,
.leaflet-control-zoom { transition: right 0.24s ease, margin-right 0.24s ease; }

/* Painel operacional separado */
body.operations-page { height: 100vh; overflow: hidden; }
.operations-shell {
  width: 100%;
  max-width: 1500px;
  height: calc(100vh - var(--topbar-height));
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.operations-heading {
  margin-bottom: 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex: 0 0 auto;
}
.operations-heading h1 { margin: 4px 0 4px; font-size: 34px; letter-spacing: -0.04em; }
.operations-heading p { margin: 0; color: var(--muted); }
.operations-kpis {
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  flex: 0 0 auto;
}
.operations-kpis article {
  min-height: 88px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  box-shadow: var(--shadow);
}
.operations-kpis article span { display: block; color: var(--muted); font-size: 11px; font-weight: 750; }
.operations-kpis article strong { display: block; margin-top: 5px; font-size: 29px; line-height: 1; }
.operations-kpis article.warning { background: var(--warning-soft); border-color: #efcf9f; }
.operations-kpis article.warning strong { color: var(--warning); }
.operations-content-grid {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr) minmax(160px, 0.55fr);
  gap: 14px;
}
.operations-card {
  min-height: 0;
  padding: 17px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.operations-card.span-two { grid-column: 1 / -1; }
.operations-card.warning-card { border-color: #eac896; }
.operations-card > header { margin-bottom: 10px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.operations-card h2 { margin: 3px 0 0; font-size: 19px; }
.operations-card header > a { color: var(--brand-dark); font-size: 12px; font-weight: 850; }
.operations-scroll-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.operations-scroll-list.compact { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; column-gap: 18px; }
.operations-list-row {
  min-height: 58px;
  padding: 10px 4px;
  border-bottom: 1px solid #e8e6df;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.operations-list-row span { min-width: 0; display: grid; gap: 2px; }
.operations-list-row strong,
.operations-list-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.operations-list-row strong { font-size: 13px; }
.operations-list-row small { color: var(--muted); }
.operations-list-row time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.operations-empty { margin: 14px 0; color: var(--muted); }

@media (max-width: 1100px) {
  .map-search-card { width: min(360px, calc(100vw - 520px)); }
  .map-active-filter { display: none; }
  .operations-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body.map-workspace-page {
    height: 100dvh;
    padding-bottom: 0;
  }
  .map-workspace-shell {
    height: calc(100dvh - var(--topbar-height) - 66px);
  }
  .map-search-card {
    top: 10px;
    left: 64px;
    right: 10px;
    width: auto;
    min-width: 0;
    height: 46px;
  }
  .map-filter-rail { top: 10px; left: 10px; gap: 7px; }
  .map-filter-button { width: 46px; height: 46px; border-radius: 11px; }
  .map-filter-button::after { display: none; }
  .city-filter-popover { left: 54px; width: min(245px, calc(100vw - 74px)); }
  .map-status-cluster { top: 64px; right: 10px; }
  .map-status-cluster .map-count { padding: 7px 9px; }
  .map-compact-legend { left: 10px; bottom: 10px; max-width: calc(100vw - 78px); }
  .client-drawer {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: min(78%, 680px);
    border-radius: 18px 18px 0 0;
    transform: translateY(105%);
  }
  .client-drawer.open { transform: translateY(0); }
  .client-drawer-header { min-height: 90px; padding: 16px 18px 14px; }
  .client-drawer-header h2 { font-size: 20px; }
  .client-drawer-body { padding: 15px 18px; }
  .client-drawer-actions { padding: 11px; }
  .drawer-action { min-height: 44px; }
  .drawer-backdrop {
    position: absolute;
    z-index: 850;
    inset: 0;
    border: 0;
    background: rgba(0, 0, 0, 0.28);
    opacity: 0;
    pointer-events: none;
    display: block;
    transition: opacity 0.2s ease;
  }
  .drawer-backdrop.open { opacity: 1; pointer-events: auto; }
  .map-workspace.drawer-open .map-status-cluster { right: 10px; }
  .map-workspace.drawer-open .leaflet-control-zoom { margin-right: 10px; }
  .mobile-nav { grid-template-columns: repeat(4, 1fr); }

  body.operations-page { height: auto; min-height: 100dvh; overflow: hidden; }
  .operations-shell {
    height: calc(100dvh - var(--topbar-height) - 66px);
    padding: 16px 12px;
    overflow-y: auto;
  }
  .operations-heading { align-items: flex-start; }
  .operations-heading h1 { font-size: 28px; }
  .operations-heading p { display: none; }
  .operations-heading .actions { justify-content: flex-end; }
  .operations-heading .button { min-height: 40px; padding: 0 11px; font-size: 11px; }
  .operations-kpis {
    grid-template-columns: repeat(5, 112px);
    overflow-x: auto;
    padding-bottom: 3px;
  }
  .operations-kpis article { min-height: 76px; }
  .operations-kpis article strong { font-size: 24px; }
  .operations-content-grid {
    min-height: 650px;
    grid-template-columns: 1fr;
    grid-template-rows: repeat(3, minmax(210px, 1fr));
  }
  .operations-card.span-two { grid-column: auto; }
  .operations-scroll-list.compact { grid-template-columns: 1fr; }
}

/* =========================================================
   ML Rotas v0.6.0 — representantes, territórios e dashboard
   ========================================================= */

/* Gestão geral */
.management-page { background: #f3f2ee; }
.management-view {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 26px 28px 34px;
}
.management-heading {
  margin-bottom: 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}
.management-heading h1 { margin: 4px 0 4px; font-size: clamp(29px, 3vw, 42px); letter-spacing: -0.045em; }
.management-heading p { margin: 0; color: var(--muted); }
.management-summary-row {
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.management-summary-row.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.management-summary-row article {
  min-height: 92px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}
.management-summary-row article span { display: block; color: var(--muted); font-size: 11px; font-weight: 800; }
.management-summary-row article strong { display: block; margin-top: 6px; font-size: 27px; letter-spacing: -0.035em; }
.management-summary-row article a { display: inline-block; margin-top: 6px; color: var(--brand-dark); font-size: 11px; font-weight: 850; }
.management-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}
.management-card > header {
  margin-bottom: 14px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.management-card h2 { margin: 3px 0 0; font-size: 19px; }
.management-card header > a { color: var(--brand-dark); font-size: 12px; font-weight: 850; }
.management-help { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
/* `position: relative` não é decoração: um `.sr-only` é `position: absolute`, e
   sem um ancestral posicionado ele se resolve contra o documento em vez do
   container que rola. O rótulo invisível da coluna "Ações" da tabela de tipos
   escapava assim e esticava a página inteira em 146px no celular.
   O `max-width` garante que a caixa não seja empurrada pelo min-width da tabela. */
.management-table-wrap,
.dashboard-table-scroll {
  position: relative;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}
.table-responsive { position: relative; }
.management-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.management-table th,
.management-table td { padding: 12px 11px; border-bottom: 1px solid #ece9e1; text-align: left; vertical-align: middle; }
.management-table th { color: var(--muted); font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.management-table td a { color: var(--text); }
.management-table td a small { display: block; margin-top: 2px; color: var(--muted); }
.management-table.compact th,
.management-table.compact td { padding: 10px 8px; }
.text-button { padding: 0; border: 0; background: none; font: inherit; font-weight: 850; cursor: pointer; }
.text-button.danger { color: #9e2b2b; }
.span-two { grid-column: span 2; }
.span-three { grid-column: span 3; }
.span-all { grid-column: 1 / -1; }

/* Representantes */
.representative-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}
.representative-card {
  position: relative;
  min-height: 132px;
  padding: 18px 52px 18px 24px;
  border: 1px solid var(--border);
  border-radius: 15px;
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.representative-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--rep-color) 48%, #d9d5ca); box-shadow: 0 14px 30px rgba(24, 24, 22, .10); }
.representative-color { width: 7px; min-height: 100%; border-radius: 99px; background: var(--rep-color); }
.representative-color.large { width: 12px; height: 56px; min-height: 56px; }
.representative-card-title { display: flex; align-items: center; gap: 9px; }
.representative-card-title h2 { margin: 0; font-size: 20px; }
.representative-card-copy > p { margin: 6px 0 15px; color: var(--muted); font-size: 12px; }
.representative-card-metrics { display: flex; flex-wrap: wrap; gap: 12px 18px; }
.representative-card-metrics span { color: var(--muted); font-size: 11px; }
.representative-card-metrics strong { color: var(--text); }
.representative-card-arrow { position: absolute; top: 50%; right: 20px; transform: translateY(-50%); font-size: 24px; }
.demo-badge {
  padding: 4px 7px;
  border-radius: 999px;
  background: #fff2c7;
  color: #765a00;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.representative-heading-copy { display: flex; align-items: center; gap: 15px; }
.representative-detail-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 14px; }
.inline-form { display: flex; align-items: flex-end; gap: 9px; }
.inline-form label { flex: 1; }
.inline-form label > span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 850; }
.inline-form input,
.inline-form select { width: 100%; min-height: 42px; }
.inline-form .state-field { max-width: 84px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.territory-city-list { margin-top: 14px; }
.territory-chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 8px 7px 11px; border: 1px solid color-mix(in srgb, var(--rep-color) 35%, #ddd8cc); border-radius: 999px; background: color-mix(in srgb, var(--rep-color) 9%, #fff); }
.territory-chip span { font-size: 11px; font-weight: 800; }
.territory-chip button { width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(0,0,0,.07); cursor: pointer; }
.client-checklist { max-height: 305px; margin-bottom: 12px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.client-checklist > div { display: grid; }
.client-checklist label { padding: 9px 10px; border-bottom: 1px solid #ece9e1; display: flex; align-items: center; gap: 8px; font-size: 11px; }
.client-checklist label:last-child { border-bottom: 0; }
.client-checklist input { width: 16px; height: 16px; }
.full { width: 100%; }

/* Dashboard compacto em tela própria */
.dashboard-v2-shell {
  max-width: none;
  padding: 0;
}
.dashboard-v2 {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  background: #f3f2ee;
  overflow: hidden;
}
.dashboard-v2-header {
  padding: 18px 24px 14px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.dashboard-v2-header h1 { margin: 3px 0 3px; font-size: 29px; letter-spacing: -.04em; }
.dashboard-v2-header p { margin: 0; color: var(--muted); font-size: 12px; }
.dashboard-filter-form { display: flex; align-items: flex-end; gap: 8px; }
.dashboard-filter-form label { display: grid; gap: 4px; }
.dashboard-filter-form label > span { color: var(--muted); font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.dashboard-filter-form select { min-width: 142px; height: 39px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.demo-banner {
  min-height: 38px;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff4cd;
  border-bottom: 1px solid #e8d79a;
  color: #614d07;
  font-size: 11px;
}
.demo-banner strong { white-space: nowrap; }
.dashboard-tabs {
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 3px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  overflow-x: auto;
  scrollbar-width: none;
}
.dashboard-tabs::-webkit-scrollbar { display: none; }
.dashboard-tabs a { padding: 12px 13px 10px; border-bottom: 3px solid transparent; color: var(--muted); font-size: 11px; font-weight: 850; white-space: nowrap; }
.dashboard-tabs a.active { color: var(--text); border-color: var(--brand); }
.dashboard-v2-content { min-height: 0; padding: 16px 22px 22px; overflow: auto; overscroll-behavior: contain; }
.dashboard-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.dashboard-kpis article { min-height: 92px; padding: 14px 15px; border: 1px solid var(--border); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.dashboard-kpis article > span { display: block; color: var(--muted); font-size: 10px; font-weight: 850; }
.dashboard-kpis article > strong { display: block; margin: 6px 0 3px; font-size: 25px; line-height: 1.05; letter-spacing: -.035em; }
.dashboard-kpis article > strong.kpi-text { font-size: 16px; line-height: 1.2; }
.dashboard-kpis article > small { color: var(--muted); font-size: 10px; }
.dashboard-grid { margin-top: 12px; display: grid; gap: 12px; }
.dashboard-grid.summary-grid,
.dashboard-grid.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dashboard-grid.three-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dashboard-card { min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: 13px; background: #fff; box-shadow: var(--shadow); }
.dashboard-card > header { margin-bottom: 12px; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.dashboard-card h2 { margin: 3px 0 0; font-size: 18px; }
.dashboard-card header > a { color: var(--brand-dark); font-size: 11px; font-weight: 850; }
.dashboard-card.action-card { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.dashboard-card.action-card p { color: var(--muted); line-height: 1.5; }
.warning-card { background: var(--warning-soft); border-color: #eccb94; }
.big-stat { display: block; margin: 8px 0; font-size: 34px; letter-spacing: -.04em; }
.rank-list { display: grid; gap: 10px; }
.rank-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(100px, 1.4fr) 38px; align-items: center; gap: 9px; font-size: 11px; }
.rank-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 750; }
.rank-row > strong { text-align: right; }
.rank-bar { height: 8px; border-radius: 99px; background: #ece9e1; overflow: hidden; }
/* A largura do <i> é a quantidade de pontos da linha, relativa à maior linha da
   lista. O gradiente inline dentro dele separa a parte já localizada da que
   falta. Ver o comentário de _apply_bar_shares em core/services/dashboard.py. */
.rank-bar i { display: block; height: 100%; min-width: 3px; border-radius: inherit; background: var(--brand); }
.representative-rank > span,
.table-representative { display: inline-flex; align-items: center; gap: 7px; }
.representative-rank > span i,
.table-representative i { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; }
.demo-dot { display: inline-block; width: 7px; height: 7px; margin-left: 5px; border-radius: 50%; background: #d0a82d; }

/* Filtros territoriais dentro do mapa */
.representative-filter-popover { width: 280px; }
.territory-toggle { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--border); display: flex !important; align-items: center; gap: 8px; color: var(--text) !important; font-size: 11px !important; text-transform: none !important; letter-spacing: 0 !important; }
.territory-toggle input { width: 16px; height: 16px; }
.representative-legend { max-width: min(690px, calc(100vw - 520px)); display: flex; flex-wrap: wrap; align-items: center; gap: 7px 11px; }
.representative-legend span { display: inline-flex; align-items: center; gap: 5px; }
.representative-legend small { flex-basis: 100%; color: var(--muted); font-size: 9px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.legend-dot.unknown { background: #6d7278; }

@media (max-width: 1120px) {
  .dashboard-v2-header { align-items: flex-start; }
  .dashboard-filter-form { flex-wrap: wrap; justify-content: flex-end; }
  .dashboard-filter-form select { min-width: 122px; }
  .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .management-summary-row.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .mobile-nav { grid-template-columns: repeat(5, 1fr); }
  .mobile-nav a { min-width: 0; }
  .mobile-nav span { max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .management-view { padding: 16px 12px 86px; }
  .management-heading { align-items: flex-start; }
  .management-heading p { display: none; }
  .management-summary-row,
  .management-summary-row.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .representative-grid,
  .representative-detail-grid { grid-template-columns: 1fr; }
  .representative-card { min-height: 118px; }
  .manual-assignment-card { order: 3; }
  .representative-clients-card { grid-column: auto; }
  .inline-form { flex-wrap: wrap; }
  .inline-form .state-field { max-width: 76px; }
  .dashboard-v2 { height: calc(100dvh - var(--topbar-height) - 66px); }
  .dashboard-v2-header { padding: 12px; display: block; }
  .dashboard-v2-header h1 { font-size: 24px; }
  .dashboard-v2-header p { display: none; }
  .dashboard-filter-form { margin-top: 10px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-filter-form label:first-of-type { grid-column: span 2; }
  .dashboard-filter-form select { width: 100%; min-width: 0; }
  .dashboard-filter-form .button { grid-column: span 2; }
  .demo-banner { padding: 7px 12px; align-items: flex-start; }
  .demo-banner span { display: none; }
  .dashboard-tabs { padding: 0 10px; }
  .dashboard-v2-content { padding: 12px 10px 18px; }
  .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-kpis article { min-height: 82px; }
  .dashboard-kpis article > strong { font-size: 21px; }
  .dashboard-grid.summary-grid,
  .dashboard-grid.two-columns,
  .dashboard-grid.three-columns { grid-template-columns: 1fr; }
  .dashboard-card.span-two,
  .dashboard-card.span-three { grid-column: auto; }
  .rank-row { grid-template-columns: minmax(100px, 1fr) 90px 32px; }
  .representative-legend { display: none; }
  .management-table { min-width: 560px; }
}

/* =========================================================
   ML Rotas v0.8.0 — cobertura territorial
   ========================================================= */

/* O resumo tem cinco indicadores, então a grade precisa acomodar
   mais que as quatro colunas fixas do painel anterior. */
.dashboard-kpis { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); }
.dashboard-kpis article > a { display: inline-block; margin-top: 4px; color: #9b4a15; font-size: 10px; font-weight: 900; }
.dashboard-kpis article.kpi-pending { border-color: #edc58c; background: #fffaf1; }
.dashboard-kpis article.kpi-pending > strong { color: #9b5700; }

.card-footnote { margin: 12px 0 0; color: var(--muted); font-size: 10px; }

.rank-row.pending > span { color: #8a5a20; }
.representative-rank > span { display: flex; align-items: center; gap: 7px; }
.representative-rank > span i { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; }

.pending-link { color: #9b4a15; font-weight: 900; }
.pending-text { color: #8a5a20; font-size: 11px; font-weight: 800; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid var(--border); border-radius: 999px; background: #f6f4ef; color: var(--text); font-size: 11px; font-weight: 800; }
.chip strong { font-size: 11px; }
.chip.pending { border-color: #edc58c; background: #fffaf1; color: #8a5a20; }

.coverage-card > header .eyebrow { display: inline-flex; align-items: center; gap: 6px; }
.coverage-stats { margin-bottom: 13px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.coverage-stats > div { padding: 10px 11px; border: 1px solid var(--border); border-radius: 10px; background: #fbfaf7; }
.coverage-stats > div.pending { border-color: #edc58c; background: #fffaf1; }
.coverage-stats span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; }
.coverage-stats strong { display: block; margin-top: 4px; font-size: 21px; letter-spacing: -.03em; }
.coverage-stats small { color: var(--muted); font-size: 10px; }

.dashboard-card.action-card.pending { border-color: #edc58c; background: #fffaf1; }

.management-summary-row article.pending { border-color: #edc58c; background: #fffaf1; }
.management-summary-row article.pending strong { color: #9b5700; }

.pending-callout { margin-top: 14px; padding: 14px; border: 1px solid #edc58c; border-radius: 12px; background: #fffaf1; }
.pending-callout strong { display: block; color: #9b5700; font-size: 13px; }
.pending-callout p { margin: 5px 0 12px; color: #7c5a2a; font-size: 11px; line-height: 1.5; }
.pending-callout.approximate { border-color: #b9cbe6; background: #f4f8fd; }
.pending-callout.approximate strong { color: #26537f; }
.pending-callout.approximate p { color: #3c5a80; }
.pending-callout.approximate .button + .button { margin-top: 8px; }

/* Origem da coordenada, na ficha, embaixo do número. */
.coordinate-origin { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 700; }

/* Aviso no painel do mapa. Só aparece quando a coordenada é a do município. */
.drawer-approximate {
  margin: 8px 0 0;
  padding: 9px 11px;
  border: 1px solid #b9cbe6;
  border-radius: 9px;
  background: #f4f8fd;
  color: #3c5a80;
  font-size: 11px;
  line-height: 1.5;
}
.drawer-approximate strong { color: #26537f; }

.map-pending-link { padding: 5px 10px; border: 1px solid #edc58c; border-radius: 999px; background: #fffaf1; color: #9b5700; font-size: 10px; font-weight: 900; white-space: nowrap; }
/* Mesma forma do aviso de pendência, no azul do refinamento: é informação sobre
   o enquadramento, não cadastro faltando. */
.map-distant-link { padding: 5px 10px; border: 1px solid #b9cbe6; border-radius: 999px; background: #f4f8fd; color: #26537f; font-size: 10px; font-weight: 900; white-space: nowrap; cursor: pointer; }
.map-distant-link:hover { border-color: #8fb0d6; background: #eaf2fb; }

@media (max-width: 850px) {
  .coverage-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .coverage-stats > div { padding: 9px; }
  .coverage-stats strong { font-size: 18px; }
}

/* =========================================================
   ML Rotas v0.9.0 — tipos de cliente e WhatsApp
   ========================================================= */

/* A legenda e o seletor de leitura ficam juntos no canto inferior esquerdo,
   porque um explica o outro. */
.map-legend-stack {
  position: absolute;
  z-index: 630;
  left: 16px;
  bottom: 16px;
  display: grid;
  justify-items: start;
  gap: 7px;
}
.map-legend-stack .map-compact-legend { position: static; left: auto; bottom: auto; }
/* .map-compact-legend e .representative-legend declaram display:flex, que vence o
   [hidden] da folha do navegador. Esta regra tem especificidade maior e devolve
   o efeito do atributo, que é como o JS troca de legenda. */
.map-compact-legend[hidden] { display: none; }

.map-view-switch {
  padding: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(6px);
}
.map-view-switch-label { padding: 0 7px 0 6px; color: var(--muted); font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.map-view-switch button {
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}
.map-view-switch button:hover { background: #f1efe9; }
.map-view-switch button.active { background: #171715; color: #fff; }

.territory-toggle input:disabled { opacity: .45; }
.territory-toggle:has(input:disabled) { color: var(--muted) !important; }

/* WhatsApp — verde da marca, usado só aqui e nunca como cor de série. */
.drawer-whatsapp {
  margin: 0 0 4px;
  min-height: 46px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 11px;
  background: #1f8f4d;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}
.drawer-whatsapp svg { width: 18px; height: 18px; flex: 0 0 auto; fill: currentColor; }
.drawer-whatsapp:hover { background: #1a7b42; }
.drawer-whatsapp.disabled { background: #e8e6df; color: #8a8983; pointer-events: none; }

.button.whatsapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-color: #1f8f4d;
  background: #1f8f4d;
  color: #fff;
}
.button.whatsapp svg { width: 18px; height: 18px; fill: currentColor; }
.button.whatsapp:hover { border-color: #1a7b42; background: #1a7b42; }

.drawer-type { display: inline-flex; align-items: center; gap: 7px; }
.drawer-type .legend-dot { flex: 0 0 auto; background: #6d7278; }

.color-code { padding: 2px 6px; border-radius: 6px; background: #f3f2ee; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; font-weight: 800; }

.table-action form { display: inline; }

/* =========================================================
   ML Rotas v0.11.0 — carteira por representante
   ========================================================= */

/* Lista de candidatos ao vínculo manual. Antes era um checkbox por ponto de
   venda da base inteira; agora é o resultado paginado de uma busca. */
.candidate-form { margin-top: 12px; display: grid; gap: 12px; }
.candidate-list { max-height: 320px; overflow-y: auto; display: grid; gap: 6px; padding-right: 4px; }
.candidate {
  min-height: 46px;
  padding: 8px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.candidate:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); background: #fdfcf9; }
.candidate:has(input:checked) { border-color: #171715; background: #f6f4ef; }
.candidate input { width: 17px; height: 17px; flex: 0 0 auto; }
.candidate > span { min-width: 0; display: grid; gap: 2px; }
.candidate strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.candidate small { color: var(--muted); font-size: 10px; }

.inline-form label.grow { flex: 1 1 auto; min-width: 0; }

/* Etiqueta do papel do usuário, ao lado do nome na barra superior. */
.scope-badge {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #e9e7e0;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}

.access-warning {
  margin: 0 auto;
  padding: 22px 24px;
  max-width: 640px;
  border: 1px solid #edc58c;
  border-radius: 14px;
  background: #fffaf1;
}
.access-warning strong { display: block; color: #9b5700; font-size: 15px; }
.access-warning p { margin: 8px 0 0; color: #7c5a2a; font-size: 12px; line-height: 1.55; }

@media (max-width: 620px) {
  .candidate-list { max-height: 260px; }
  .scope-badge { display: none; }
}

/* =========================================================
   ML Rotas v0.12.0 — edição rápida na lista
   ========================================================= */

.pending-banner {
  margin-bottom: 14px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #edc58c;
  border-radius: 12px;
  background: #fffaf1;
  color: #7c5a2a;
}
.pending-banner:hover { border-color: #d9a95e; background: #fff6e6; }
.pending-banner strong { font-size: 24px; font-weight: 900; color: #9b5700; line-height: 1; }
.pending-banner span { font-size: 12px; line-height: 1.4; }
.pending-banner.active { border-color: #9b5700; background: #fdf1dd; }

/* Mesma forma do aviso de pendência, cor do refinamento. Duas filas distintas
   lado a lado precisam ser distinguíveis num relance. */
.pending-banner.approximate { border-color: #b9cbe6; background: #f4f8fd; color: #3c5a80; }
.pending-banner.approximate:hover { border-color: #8fb0d6; background: #eaf2fb; }
.pending-banner.approximate strong { color: #26537f; }
.pending-banner.approximate.active { border-color: #26537f; background: #e3eefa; }

.client-row.editando > td { background: #fbf9f4; }
.client-row.salvo > td { animation: linha-salva 1.6s ease; }
@keyframes linha-salva {
  0% { background: #dff0e4; }
  100% { background: transparent; }
}

.quick-edit-row > td { padding: 0 !important; background: #fbf9f4; border-bottom: 1px solid var(--border); }
.quick-edit { padding: 16px; display: grid; gap: 14px; }
.quick-edit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.quick-field { display: grid; gap: 5px; min-width: 0; }
.quick-field.span-2 { grid-column: span 2; }
.quick-field > span { color: var(--muted); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .04em; }
.quick-field > small { color: var(--muted); font-size: 10px; }
.quick-field input,
.quick-field select { width: 100%; min-height: 40px; }
.quick-field.has-error input,
.quick-field.has-error select { border-color: var(--danger); background: #fdf6f6; }
.field-error { color: var(--danger); font-size: 10px; font-style: normal; font-weight: 800; }
.field-error:empty { display: none; }

.quick-edit-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.quick-edit-status { margin-right: auto; font-size: 11px; font-weight: 800; color: var(--muted); }
.quick-edit-status.sucesso { color: var(--success); }
.quick-edit-status.erro { color: var(--danger); }

.table-link.ghost { color: var(--muted); font-weight: 800; }
button.table-link { border: 0; background: none; cursor: pointer; font: inherit; }
.button.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.button.ghost:hover { border-color: var(--border); background: #fff; color: var(--text); }

@media (max-width: 900px) {
  .quick-edit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .quick-edit-grid { grid-template-columns: 1fr; }
  .quick-field.span-2 { grid-column: auto; }
  .quick-edit-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .quick-edit-actions .button { width: 100%; text-align: center; }
  .quick-edit-status { grid-column: 1 / -1; margin: 0 0 4px; }
  .quick-edit-actions .button.ghost { grid-column: 1 / -1; }
}

/* A pilha cresce de baixo para cima a partir da base: ancorar pelo `bottom` e
   deixar o conteúdo empilhar para cima evita que a legenda, que ganha uma
   segunda linha com o texto de apoio, saia pela borda inferior do mapa. */
.map-legend-stack { max-height: calc(100% - 32px); }
.map-legend-stack .map-compact-legend { max-width: min(690px, calc(100vw - 500px)); }

@media (max-width: 1120px) {
  .map-legend-stack .map-compact-legend { max-width: calc(100vw - 120px); }
}

@media (max-width: 760px) {
  .map-legend-stack { left: 10px; bottom: 10px; max-width: calc(100vw - 78px); }
  .map-legend-stack .map-compact-legend { max-width: calc(100vw - 78px); }
  .map-view-switch-label { display: none; }
  .map-view-switch button { padding: 0 10px; font-size: 10px; }

  /* Cabeçalho de gestão: no celular os botões de ação ficavam ao lado do título
     e se sobrepunham a ele. Empilha e ocupa a largura toda. */
  .management-heading { flex-direction: column; align-items: stretch; gap: 12px; }
  .management-heading .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .management-heading .actions .button { width: 100%; text-align: center; }
  .page-heading { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-heading .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .page-heading .actions .button { width: 100%; text-align: center; }
}

/* =========================================================
   Telas de confirmação de exclusão
   ========================================================= */

/* O vermelho é reservado para o que não tem volta. `ghost` mantém o botão
   discreto na ficha — excluir não deve competir em destaque com editar. */
.button.danger { border-color: #d9a3a3; background: var(--danger-soft); color: var(--danger); }
.button.danger:hover { border-color: var(--danger); background: #f8dcdc; }
.button.danger.ghost { border-color: transparent; background: transparent; color: var(--danger); }
.button.danger.ghost:hover { border-color: #d9a3a3; background: var(--danger-soft); }

.confirm-card { max-width: 640px; }
.confirm-card h2 { margin: 0; font-size: 20px; }
.confirm-meta { margin: 4px 0 14px; color: var(--muted); font-size: 12px; }

/* O caminho menos destrutivo vem antes do botão vermelho, e não depois: quem lê
   de cima para baixo encontra a alternativa antes de encontrar a porta sem volta. */
.confirm-alternative {
  margin: 16px 0;
  padding: 14px;
  border: 1px solid #b9cbe6;
  border-radius: 12px;
  background: #f4f8fd;
}
.confirm-alternative strong { display: block; color: #26537f; font-size: 13px; }
.confirm-alternative p { margin: 6px 0 12px; color: #3c5a80; font-size: 12px; line-height: 1.55; }

.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
@media (max-width: 520px) {
  .confirm-actions { flex-direction: column-reverse; }
  .confirm-actions .button { width: 100%; }
}

/* =========================================================
   Verificação em duas etapas
   ========================================================= */

.two-factor-card { max-width: 460px; margin: 0 auto; }
.two-factor-lead { margin: 6px 0 18px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.two-factor-form { display: grid; gap: 8px; }
.two-factor-form label { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }

/* O código é curto e lido em voz alta do celular. Fonte monoespaçada e espaçada
   para o olho não trocar 6 por 8 ao conferir dígito por dígito. */
.code-input {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.32em;
  text-align: center;
}
.code-input.wide { font-size: 19px; letter-spacing: 0.12em; }

.two-factor-remember { display: flex; align-items: flex-start; gap: 9px; margin: 6px 0 4px; }
.two-factor-remember input { margin-top: 2px; }
.two-factor-remember span { color: var(--text); font-size: 12px; font-weight: 600; line-height: 1.5; text-transform: none; letter-spacing: 0; }

.two-factor-help { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); display: grid; gap: 8px; font-size: 12px; }
.two-factor-help a { color: var(--brand-dark); font-weight: 850; }
.two-factor-note { color: var(--muted); font-size: 11px; line-height: 1.55; }

.two-factor-steps { margin: 0; padding-left: 22px; display: grid; gap: 20px; }
.two-factor-steps strong { display: block; margin-bottom: 4px; font-size: 14px; }
.two-factor-steps p { margin: 4px 0 8px; color: var(--muted); font-size: 12px; line-height: 1.6; }

/* A chave é digitada à mão no celular quando o QR não é opção. Monoespaçada,
   grande e selecionável de uma vez. */
.two-factor-secret {
  margin: 8px 0 6px;
  padding: 12px 14px;
  border: 1px dashed var(--border);
  border-radius: 9px;
  background: var(--surface-soft);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text) !important;
  overflow-wrap: anywhere;
  user-select: all;
}

/* Os códigos de recuperação existem para serem impressos ou copiados. */
.recovery-codes {
  margin: 16px 0;
  padding: 16px;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  user-select: all;
}
@media (max-width: 480px) {
  .recovery-codes { grid-template-columns: 1fr; }
}

/* =========================================================
   Contas de usuário
   ========================================================= */

.login-ajuda { margin: 14px 0 0; text-align: center; font-size: 12px; }
.login-ajuda a { color: var(--brand-dark); font-weight: 800; }

.campo-ajuda { margin: -2px 0 6px; color: var(--muted); font-size: 11px; line-height: 1.5; text-transform: none; letter-spacing: 0; font-weight: 500; }
.form-errors { margin-bottom: 12px; }
.form-error { margin: 0 0 6px; padding: 9px 11px; border: 1px solid #d9a3a3; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: 12px; line-height: 1.5; }

/* Usuário e senha provisória são para copiar ou ditar. Monoespaçado, grande, e
   selecionável com um clique. */
.dado-copiavel {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 15px;
  letter-spacing: 0.04em;
  user-select: all;
}
.dado-copiavel.senha { font-size: 17px; letter-spacing: 0.08em; }

/* =========================================================
   Conferência do cadastro
   ========================================================= */

/* O aviso de conferência usa o âmbar de "pendente": é fila de trabalho, igual às
   outras — mas vem primeiro na página porque é a mais grave. Ali o dado pode
   estar errado, não apenas incompleto. */
.pending-banner.review { border-color: #edc58c; background: #fff6ea; }
.pending-banner.review strong { color: #8a4b00; }

.row-action.conferir { border-color: #a9c9b4; color: var(--success); }
.row-action.conferir:hover { border-color: var(--success); background: var(--success-soft); }

.conferir-cidade {
  margin-bottom: 14px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 13px;
}

.drawer-nao-conferido {
  margin: 8px 0 0;
  padding: 9px 11px;
  border: 1px solid #edc58c;
  border-radius: 9px;
  background: #fff6ea;
  color: #7c5a2a;
  font-size: 11px;
  line-height: 1.5;
}
.drawer-nao-conferido strong { color: #8a4b00; }

/* Cidades atendidas, à vista no cartão do representante. */
.cidade-etiquetas { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 5px; }
.cidade-etiqueta {
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.representative-sem-cidade { margin: 10px 0 0; color: var(--muted); font-size: 11px; }

/* Campo de filtro com sugestão. Substitui listas longas: com 95 cidades, rolar
   até a certa era mais lento que digitar três letras. */
.filtro-busca { width: 100%; min-height: 38px; padding: 0 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); font: inherit; font-size: 13px; }
.filtro-busca:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

.filtro-sugestoes { margin: 6px 0 0; padding: 0; list-style: none; max-height: 232px; overflow-y: auto; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.filtro-sugestoes li + li { border-top: 1px solid var(--surface-muted); }
.filtro-sugestoes button { width: 100%; min-height: 36px; padding: 0 11px; border: 0; background: none; text-align: left; font: inherit; font-size: 13px; color: var(--text); cursor: pointer; }
.filtro-sugestoes button:hover { background: var(--brand-soft); }
.filtro-vazio { padding: 9px 11px; color: var(--muted); font-size: 12px; }
