/* ==========================================================================
   CarFinder — Dashboard web (Fase 7)
   Identidade visual: design_system/design-system.html — preto/zinco +
   vermelho #ef233c, Manrope (títulos) / Inter (corpo), bordas dashed,
   badges com glow. Fontes servidas localmente (zero CDN).
   ========================================================================== */

/* ---------- Fontes variáveis (copiadas do DS; pesos 300–800) ---------- */

@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('assets/fonts/manrope-var-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('assets/fonts/manrope-var-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('assets/fonts/inter-var-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens (tema escuro = default do DS) ---------- */

:root {
  color-scheme: dark;

  /* Marca — vermelhos NÃO mudam entre temas. */
  --primary: #ef233c;
  --primary-strong: #dc2626;
  --accent: #ff7f51;
  --primary-soft-bg: rgb(220 38 38 / 5%);
  --primary-soft-border: rgb(220 38 38 / 20%);
  --primary-soft-text: #fecaca;

  /* Fundos/superfícies (zinco). */
  --bg: #000000;
  --surface: #000000;
  --surface-glass: rgb(24 24 27 / 40%);
  --surface-track: rgb(24 24 27 / 50%);
  --surface-active: #3f3f46;
  --surface-hover: #27272a;

  /* Texto. */
  --text: #ffffff;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-faint: #52525b;

  /* Bordas. */
  --border: rgb(255 255 255 / 10%);
  --border-strong: #27272a;
  --border-hover: rgb(255 255 255 / 20%);

  /* Sinais financeiros (margem positiva/negativa) — legíveis nos dois temas. */
  --margin-pos: #4ade80;
  --margin-neg: #f87171;

  /* Faixas do score (baixo/médio/alto) — legíveis nos dois temas. */
  --score-low: #f87171;
  --score-mid: #fbbf24;
  --score-high: #4ade80;

  /* Efeitos. */
  --glow: 0 0 10px rgb(239 35 60 / 35%);
  --dot-glow: 0 0 10px rgb(220 38 38 / 50%);
  --shadow: 0 2px 10px rgb(0 0 0 / 45%);
  --focus-ring: 0 0 0 3px rgb(239 35 60 / 35%);

  /* Tipografia. */
  --font-heading: 'Manrope', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  /* Formas e ritmo. */
  --radius-card: 8px;
  --radius-sm: 2px;
  --radius-pill: 9999px;
  --control-h: 44px;
  --sidebar-w: 232px;
  --dur: 300ms;
  --dur-slow: 400ms;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Tema claro — derivação do DS (marca preservada). */
:root[data-theme='light'] {
  color-scheme: light;
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-glass: rgb(255 255 255 / 70%);
  --surface-track: #f4f4f5;
  --surface-active: #e4e4e7;
  --surface-hover: #f4f4f5;
  --text: #18181b;
  --text-secondary: #3f3f46;
  --text-muted: #71717a;
  --text-faint: #a1a1aa;
  --border: rgb(24 24 27 / 10%);
  --border-strong: #e4e4e7;
  --border-hover: rgb(24 24 27 / 25%);
  --margin-pos: #15803d;
  --margin-neg: #b91c1c;
  --score-low: #b91c1c;
  --score-mid: #b45309;
  --score-high: #15803d;
  --primary-soft-text: #b91c1c;
  --shadow: 0 2px 10px rgb(0 0 0 / 8%);
  --glow: 0 0 10px rgb(239 35 60 / 25%);
}

/* Tema escuro explícito (default do :root) — o toggle grava
   data-theme='dark' e, com color-scheme pareado, os controles nativos
   (popup dos <select>, ex.: cascata FIPE) seguem o tema em vez de sair
   branco/ilegível no escuro. */
:root[data-theme='dark'] {
  color-scheme: dark;
}

/* ---------- Reset leve ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Regras de display próprias (ex.: .access-screen/.app-shell em grid) não
   podem vencer o atributo `hidden` — sem isso as telas empilham em vez de
   trocarem (mesmo reset do dashboard). */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

input,
select,
textarea {
  font: inherit;
  color: var(--text);
}

code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--surface-track);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

::selection {
  background: rgb(239 35 60 / 30%);
}

/* ---------- Animações do DS (adaptadas a dashboard) ---------- */

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(24px);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes pulseGlow {
  0%,
  100% {
    box-shadow: var(--dot-glow);
    opacity: 1;
  }
  50% {
    box-shadow: none;
    opacity: 0.55;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.screen-enter {
  animation: fadeSlideIn var(--dur-slow) var(--ease) both;
}

/* ---------- Shell: sidebar + view ---------- */

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 16px;
  border-right: 1px dashed var(--border-strong);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulseGlow 2.4s var(--ease) infinite;
}

.brand-name {
  font-family: var(--font-heading);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.main-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-card);
  text-decoration: none;
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.nav-link.is-active {
  color: var(--text);
  background: var(--surface-hover);
  box-shadow: inset 2px 0 0 var(--primary);
}

.nav-icon {
  display: inline-flex;
  color: inherit;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px dashed var(--border-strong);
  padding-top: 16px;
}

.profile-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px 4px;
  font-size: 13px;
}

.profile-name {
  font-family: var(--font-heading);
  font-weight: 700;
}

.profile-username {
  color: var(--text-muted);
}

.profile-quota {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 12px;
}

.view {
  min-width: 0;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 32px 48px;
}

/* O Pipeline é a tela mais densa do painel: usa a largura inteira da janela
   para as 5 colunas do Kanban caberem sem rolagem horizontal (:has() é da
   mesma geração de navegador já exigida por color-mix() neste arquivo). */
.view:has(.kanban) {
  max-width: none;
}

/* ---------- Botões ---------- */

.btn-primary,
.btn,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--control-h);
  padding: 0 18px;
  border-radius: var(--radius-card);
  font-family: var(--font-heading);
  font-weight: 700;
  text-decoration: none;
  transition: background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    opacity var(--dur) var(--ease);
}

.btn-primary {
  background: var(--text);
  color: var(--bg);
}

/* Desabilitado legível em qualquer botão (ex.: "Consultar preço" da FIPE
   antes da cascata completa) — sem isso o estado é invisível ao toque. */
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary:hover {
  background: var(--text-secondary);
}

.btn {
  border: 1px solid var(--border-strong);
  background: transparent;
}

.btn:hover {
  background: var(--surface-hover);
}

.btn-danger {
  background: var(--primary-strong);
  color: #fff;
}

.btn-danger:hover {
  box-shadow: var(--glow);
}

.btn-block {
  width: 100%;
}

/* Desabilitado mas clicável (quota esgotada → 403 em toast): aparência
   apagada, cursor permitido, clique segue para o servidor decidir. */
.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-card);
  color: var(--text-secondary);
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.btn-icon:hover {
  color: var(--text);
  background: var(--surface-hover);
}

/* ---------- Badges / chips ---------- */

.badge-solid {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: var(--glow);
}

.badge-discount {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--primary-soft-bg);
  border: 1px solid var(--primary-soft-border);
  color: var(--primary-soft-text);
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulseGlow 2s var(--ease) infinite;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.chip-muted {
  color: var(--text-muted);
}

/* Chip de score — cor pela faixa (verde ≥55, amarelo 35–54, vermelho <35). */
.chip-score {
  border-color: color-mix(in srgb, currentColor 35%, transparent);
  background: color-mix(in srgb, currentColor 12%, transparent);
  font-weight: 700;
}

.chip-score::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.chip-score-low { color: var(--score-low); }
.chip-score-mid { color: var(--score-mid); }
.chip-score-high { color: var(--score-high); }

/* Veredito do detector de vendidos (detalhe) e selo do card do Pipeline. */
.chip-sold {
  background: color-mix(in srgb, #b91c1c 15%, transparent);
  color: #b91c1c;
}

/* Chips clicáveis (toggle "Descartados" do Pipeline). */
button.chip {
  cursor: pointer;
  background: transparent;
  font-family: var(--font-body);
  transition: background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

button.chip[aria-pressed='true'] {
  border-color: var(--primary-soft-border);
  background: var(--primary-soft-bg);
  color: var(--primary-soft-text);
}

.chip-tier {
  border-color: var(--primary-soft-border);
  background: var(--primary-soft-bg);
  color: var(--primary-soft-text);
  font-family: var(--font-heading);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Cards ---------- */

.card {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-card);
  background: var(--surface);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.card:hover {
  border-color: var(--border-hover);
}

.card-glass {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover {
  transform: translateY(-1px);
}

/* ---------- Toolbar / formulários ---------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
}

.toolbar .grow {
  flex: 1 1 200px;
  min-width: 0;
}

.control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--control-h);
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  background: var(--surface);
  color: var(--text-secondary);
  transition: border-color var(--dur) var(--ease);
}

.control:focus-within {
  border-color: var(--primary);
}

.control input,
.control select {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  color: var(--text);
}

.control select {
  appearance: none;
  cursor: pointer;
}

.control input::placeholder {
  color: var(--text-faint);
}

/* Filtros avançados do feed (Rodada A): <details> discreto acima da lista. */
.feed-advanced {
  margin: -10px 0 20px;
}

.feed-advanced summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 4px 2px;
  user-select: none;
}

.feed-advanced summary:hover {
  color: var(--primary);
}

.feed-advanced-grid {
  margin-top: 10px;
  margin-bottom: 0;
  flex-wrap: wrap;
}

/* Campo floating-label do DS (linha inferior; foco vermelho). */
.field-floating {
  position: relative;
  display: flex;
  flex-direction: column;
}

.field-floating input,
.field-floating textarea,
.field-floating select {
  height: var(--control-h);
  padding: 18px 12px 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  background: var(--surface);
  outline: none;
  transition: border-color var(--dur) var(--ease);
}

.field-floating textarea {
  height: auto;
  min-height: 88px;
  resize: vertical;
}

.field-floating input:focus,
.field-floating textarea:focus,
.field-floating select:focus {
  border-color: var(--primary);
}

.field-floating label {
  position: absolute;
  left: 13px;
  top: 12px;
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
  transition: transform var(--dur) var(--ease), color var(--dur) var(--ease),
    font-size var(--dur) var(--ease);
  transform-origin: left top;
}

.field-floating input:focus + label,
.field-floating input:not(:placeholder-shown) + label,
.field-floating textarea:focus + label,
.field-floating textarea:not(:placeholder-shown) + label,
.field-floating select:focus + label,
.field-floating select.has-value + label {
  transform: translateY(-9px) scale(0.82);
  color: var(--primary);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-error {
  color: var(--primary-soft-text);
  font-size: 13px;
}

.form-hint {
  color: var(--text-muted);
  font-size: 12px;
}

/* ---------- Página: cabeçalho de seção ---------- */

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.page-title {
  font-size: 24px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-title .nav-icon {
  color: var(--primary);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Seletor de período do painel (Hoje/Semana/Mês/Ano/Tudo). */
.period-switch {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
}

.period-btn {
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  padding: 9px 14px;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.period-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.period-btn.is-active {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--glow);
}

/* ---------- Filtros ---------- */

.filters-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.filter-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-summary {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 13px;
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Toggle is_active (role="switch"): trilho + botão, vermelho quando ativo. */
.switch {
  position: relative;
  width: 40px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-track);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.switch[aria-checked='true'] {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: var(--glow);
}

.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: transform var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.switch[aria-checked='true'] .switch-knob {
  transform: translateX(18px);
  background: #ffffff;
}

.switch:focus-visible {
  box-shadow: var(--focus-ring);
}

/* ---------- Tabela do feed ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-card);
}

table.feed-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

/* Linha/card de anúncio vendido — atenuado, chip "Vendido" marca o motivo. */
.feed-row-sold {
  opacity: 0.6;
}

.feed-table th {
  text-align: left;
  padding: 10px 14px;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px dashed var(--border-strong);
  white-space: nowrap;
}

.feed-table td {
  padding: 12px 14px;
  border-bottom: 1px dashed var(--border-strong);
  vertical-align: middle;
}

.feed-table tbody tr:last-child td {
  border-bottom: none;
}

.feed-table tbody tr {
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}

.feed-table tbody tr:hover {
  background: var(--surface-hover);
}

.cell-title {
  min-width: 240px;
  max-width: 380px;
}

.listing-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Valor FIPE como referência (opção A): muted, sem riscado — o destaque
   fica no preço e na margem. */
.fipe-ref {
  color: var(--text-muted);
}

/* Barra Preço→FIPE (opção B): o trilho marca a FIPE; o preenchimento é a
   parte coberta pelo preço; o vão verde restante é o desconto. */
.fipe-bar {
  display: block;
  width: 100%;
  min-width: 96px;
  max-width: 160px;
  height: 5px;
  margin-top: 6px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--score-high) 30%, transparent);
  overflow: hidden;
}

.fipe-bar-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--text-secondary);
}

/* Margem bruta em verde (sinal positivo). */
.margin-pos {
  color: var(--margin-pos);
  font-weight: 600;
}

.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Rótulo só para leitores de tela (inputs com placeholder/ícone). */
.visually-hidden-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Cards do feed em telas estreitas (a tabela vira cards via JS). */
.feed-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feed-card {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feed-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.feed-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ---------- Pager ---------- */

/* ---------- Detalhe da oportunidade ---------- */

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}

.detail-main {
  padding: 24px;
}

.detail-title {
  font-size: 22px;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
  overflow-wrap: anywhere;
}

.kv-list {
  margin: 0;
}

.kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border-strong);
  font-size: 13px;
}

.kv:last-child {
  border-bottom: none;
}

.kv dt {
  color: var(--text-muted);
}

.kv dd {
  margin: 0;
  text-align: right;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.detail-aside {
  padding: 24px;
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-aside .badge-discount {
  align-self: flex-start;
}

.detail-price {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.detail-fipe {
  color: var(--text-muted);
}

.detail-margin {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px dashed var(--primary-soft-border);
  border-radius: var(--radius-card);
  background: var(--primary-soft-bg);
  color: var(--primary-soft-text);
  font-size: 13px;
}

.detail-margin strong {
  font-family: var(--font-heading);
  font-size: 20px;
  color: var(--text);
}

/* Histórico FIPE do detalhe (Rodada A5): sparkline + min/max/variação. */
.fipe-trend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  font-size: 13px;
}

.fipe-trend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 600;
  color: var(--text-secondary);
}

.sparkline {
  display: block;
  max-width: 100%;
  height: auto;
  color: var(--accent);
}

.fipe-trend-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  color: var(--text-secondary);
}

.fipe-trend-stats strong {
  color: var(--text);
}

.fipe-trend-up {
  color: var(--accent);
}

.fipe-trend-down {
  color: var(--primary);
}

.fipe-trend-flat {
  color: var(--text-secondary);
}

.state-actions {
  display: flex;
  justify-content: center;
  padding-bottom: 24px;
}

/* Ícone "voltar" (seta aponta para a esquerda sem outro SVG). */
.flip-x {
  transform: scaleX(-1);
}

@media (max-width: 900px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-aside {
    position: static;
  }
}


/* ---------- Pager ---------- */

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
  color: var(--text-secondary);
}

/* ---------- Estados (loading / vazio / erro) ---------- */

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 56px 24px;
  text-align: center;
  color: var(--text-secondary);
}

.state .nav-icon {
  color: var(--text-faint);
}

.state-title {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text);
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--surface-active);
  border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
}

/* ---------- Tela de acesso ---------- */

.access-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgb(239 35 60 / 7%), transparent),
    var(--bg);
}

.access-card {
  width: min(420px, 100%);
  padding: 36px 32px;
  animation: fadeSlideIn var(--dur-slow) var(--ease) both;
}

.access-brand {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-card);
  background: var(--primary-soft-bg);
  border: 1px solid var(--primary-soft-border);
  margin-bottom: 18px;
  position: relative;
}

.access-brand::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  background: var(--primary);
  clip-path: polygon(50% 0%, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0% 50%, 38% 38%);
}

.access-title {
  font-size: 26px;
  letter-spacing: -0.02em;
}

.access-subtitle {
  margin: 8px 0 24px;
  color: var(--text-secondary);
}

.access-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.access-hint {
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 12px;
}

.access-hint a {
  color: var(--primary);
  text-decoration: none;
}

.access-hint a:hover {
  text-decoration: underline;
}

.register-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 8px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.register-consent input {
  margin-top: 2px;
  accent-color: var(--primary);
}

.register-consent a {
  color: var(--primary);
  text-decoration: none;
}

.register-consent a:hover {
  text-decoration: underline;
}

/* ---------- Tela de cadastro (captura única pós-chave) ---------- */

.register-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.register-form {
  gap: 12px;
}

.register-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.register-select {
  height: var(--control-h);
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  background: var(--surface);
  color: inherit;
  outline: none;
}

.register-select:focus {
  border-color: var(--primary);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.segmented label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  background: var(--surface);
  font-size: 13px;
  cursor: pointer;
}

.segmented input {
  accent-color: var(--primary);
}

/* ---------- Toasts ---------- */

.toast-host {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 32px));
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radius-card);
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: fadeSlideIn var(--dur) var(--ease) both;
}

.toast-error {
  background: #2a0a0e;
  border: 1px solid var(--primary-soft-border);
  color: var(--primary-soft-text);
}

.toast-success {
  background: #0f1c12;
  border: 1px solid rgb(74 222 128 / 25%);
  color: #bbf7d0;
}

:root[data-theme='light'] .toast-error {
  background: #fef2f2;
}

:root[data-theme='light'] .toast-success {
  background: #f0fdf4;
}

.toast.hide {
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

/* ---------- Modais ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(0 0 0 / 60%);
  backdrop-filter: blur(4px);
  animation: fadeSlideIn calc(var(--dur) / 2) var(--ease) both;
}

.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px dashed var(--border-strong);
}

.modal-title {
  font-size: 17px;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px dashed var(--border-strong);
}

/* ---------- CRM Kanban ---------- */

/* Faixa de agregados do quadro (Rodada A3 — GET /crm/summary): grid fluido,
   4 telas lado a lado no desktop sem depender da largura do conteúdo. */
.crm-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.crm-summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface-track);
}

/* A margem projetada é o número que decide a compra — destaque suave. */
.crm-summary-featured {
  border-color: var(--primary-soft-border);
  background: var(--primary-soft-bg);
}

.crm-summary-item span {
  font-size: 12px;
  color: var(--text-secondary);
}

.crm-summary-item strong {
  font-family: var(--font-heading);
  font-size: 16px;
  color: var(--text);
}

/* ---------- Consultor FIPE (Rodada B) — cascata + cotação ---------- */

.fipe-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 520px;
}

.fipe-intro {
  font-size: 13px;
  color: var(--text-secondary);
}

.fipe-step {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fipe-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.fipe-step .control {
  display: flex;
  width: 100%;
}

.fipe-quote-model {
  font-size: 18px;
  letter-spacing: -0.02em;
}

.fipe-quote-price {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--text);
  margin-top: 2px;
}

.fipe-quote-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.fipe-quote-hint {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.fipe-quote-trend { margin-top: 10px; }

/* Hoje (Rodada B1) — snapshot diário: KPIs, top do dia e bloco "Vendidos". */
.today-date { font-size: 13px; color: var(--text-secondary); }

.today-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.today-tile {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.today-tile-icon {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-card);
  background: var(--primary-soft-bg);
  border: 1px solid var(--primary-soft-border);
  color: var(--primary-soft-text);
}

.today-tile-body { min-width: 0; }

.today-tile-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.today-tile-value {
  display: block;
  font-family: var(--font-heading);
  font-size: 24px;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-top: 2px;
}

.today-top-title {
  font-size: 16px;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

/* Funil de curadoria (aba Desempenho) — coletados → novos → aprovados. */
.today-funnel {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 16px 18px;
  margin-bottom: 20px;
}

.today-funnel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.today-funnel-title {
  font-size: 16px;
  letter-spacing: -0.01em;
  margin: 0;
}

.today-funnel-sub {
  margin: 4px 0 0;
  max-width: 58ch;
  font-size: 12.5px;
  color: var(--text-muted);
}

.today-funnel-rate {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
}

.today-funnel-rate strong {
  font-family: var(--font-heading);
  font-size: 26px;
  line-height: 1;
  color: var(--margin-pos);
}

.today-funnel-rate span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.today-funnel-stages {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.today-funnel-stage {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.today-funnel-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.today-funnel-row strong {
  font-size: 14px;
  color: var(--text);
}

.today-funnel-track {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-track);
  overflow: hidden;
}

.today-funnel-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width var(--dur, 200ms) ease;
}

.today-funnel-collected { background: var(--text-faint); }
.today-funnel-analyzed { background: var(--accent); }
.today-funnel-approved { background: var(--margin-pos); }

.today-funnel-hint {
  font-size: 11.5px;
  color: var(--text-muted);
}

.today-funnel-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 12.5px;
  color: var(--text-secondary);
}

.today-funnel-foot strong { color: var(--text); }

/* Contador discreto ao lado de títulos de seção ("Vendidos 12"). */
.today-top-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Empty state do Top compacto, com piso de altura (a seção não colapsa). */
.today-top .state {
  padding: 32px 24px;
  min-height: 148px;
}

/* Bloco "Vendidos" (aba Hoje) — métricas de venda + notas honestas. */
.today-sold-note {
  color: var(--text-muted);
  font-size: 12.5px;
}

/* Largos: últimas vendas ao lado do gráfico de meses. */
.today-sold-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 12px;
}

/* Mesma linguagem do .card (dashed/radius/surface), sem o :hover — painéis
   de seção não são clicáveis. */
.today-panel {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 14px 16px;
  min-width: 0;
}

.today-sub-title {
  font-size: 13.5px;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Últimas vendas: linhas tabulares (título elástico, números à direita). */
.today-sold-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.today-sold-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  grid-template-areas: 'title source date days';
  align-items: center;
  gap: 4px 10px;
  padding: 9px 0;
}

.today-sold-row + .today-sold-row { border-top: 1px dashed var(--border); }

.today-sold-title {
  grid-area: title;
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-sold-row .chip { grid-area: source; justify-self: start; }

.today-sold-date {
  grid-area: date;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.today-sold-days {
  grid-area: days;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-track);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  white-space: nowrap;
}

/* Série do período: barras agrupadas (novos × vendidos) ancoradas na base. */
.today-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.today-bar {
  flex: 1 1 0;
  min-width: 10px; /* histórico longo rola em vez de esmagar as barras */
  max-width: 56px; /* 1 único bucket não estica a barra */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.today-bar-value { font-size: 12px; color: var(--text-secondary); }

.today-bar-track {
  width: 100%;
  height: 96px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  background: var(--surface-track);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.today-bar-fill {
  flex: 1 1 0;
  min-height: 0;
  background: var(--primary);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.today-bar-new { background: var(--primary); }
.today-bar-sold { background: var(--accent); }

.today-bar-label {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.today-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.today-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.today-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  display: inline-block;
}

.today-legend-new { background: var(--primary); }
.today-legend-sold { background: var(--accent); }

@media (max-width: 900px) {
  .today-sold-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  /* Linha de venda re-flui: título+pill na 1ª linha, chip+data na 2ª. */
  .today-sold-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'title days'
      'source date';
  }

  .today-sold-date { justify-self: start; }
}

/* Grid de 5 colunas — todas as etapas visíveis ao mesmo tempo, sem rolagem
   horizontal (a tela usa a largura toda via .view:has(.kanban)). */
.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: stretch;
  gap: 12px;
}

.kanban-col {
  min-width: 0; /* grid minmax(0,1fr): conteúdo longo nunca estoura a coluna */
  display: flex;
  flex-direction: column;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-card);
  background: var(--surface-track);
}

/* Toggle "Descartados": coluna escondida sem buraco (grid vira 4 colunas). */
.kanban.hide-discarded {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kanban.hide-discarded .kanban-col[data-status='DISCARDED'] {
  display: none;
}

.kanban-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px dashed var(--border-strong);
}

.kanban-col-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.kanban-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 1px 8px;
}

/* Σ das margens líquidas da coluna (client-side; DESCARTADO não soma). */
.kanban-sum {
  flex-shrink: 0;
  font-size: 10.5px;
  color: var(--text-muted);
}

.kanban-col-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  min-height: 120px;
}

.kanban-col-empty {
  color: var(--text-faint);
  font-size: 12px;
  text-align: center;
  padding: 18px 0;
}

/* Dots de status (mesma linguagem do badge-discount do DS). */
.crm-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.crm-dot-inbox { background: #a1a1aa; }
.crm-dot-contacted { background: #f59e0b; }
.crm-dot-visit { background: #3b82f6; }
.crm-dot-bought { background: #22c55e; }
.crm-dot-discarded { background: var(--primary); }

.crm-card {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Cabeçalho: título (âncora do detalhe) + chip Vendido. */
.crm-card-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.crm-card-head .chip {
  flex-shrink: 0;
}

/* Título clicável → detalhe do anúncio; clamp de 2 linhas no flex. */
.crm-card-title {
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.35;
  transition: color var(--dur) var(--ease);
}

.crm-card-title:hover {
  color: var(--primary);
}

.crm-card-price {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* FIPE + desconto vs FIPE (só exibição — a margem é do servidor). */
.crm-card-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.crm-discount {
  color: var(--margin-pos);
  font-weight: 600;
}

.crm-card-notes {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.crm-card-margin {
  font-size: 12px;
  color: var(--text-secondary);
}

.crm-card-margin strong {
  color: var(--primary-soft-text);
}

/* Sinal da margem (verde/vermelho) — herda no strong para não conflitar. */
.crm-margin-pos {
  color: var(--margin-pos);
}

.crm-margin-neg {
  color: var(--margin-neg);
}

.crm-margin-pos strong,
.crm-margin-neg strong {
  color: inherit;
}

.crm-margin-hint {
  color: var(--text-faint);
}

/* Antiguidade do card ("no pipeline há N dias") — sutil, último sinal. */
.crm-card-age {
  font-size: 11px;
  color: var(--text-muted);
}

.crm-card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

/* Ação destrutiva: só revela o vermelho no hover/focus (não polui o card). */
.crm-card-delete:hover,
.crm-card-delete:focus-visible {
  color: var(--margin-neg);
  border-color: var(--margin-neg);
}

.crm-card-spacer {
  flex: 1;
}

/* Card destacado vindo do detalhe (`#/crm/{id}`). */
.crm-card.is-highlight {
  border-style: solid;
  border-color: var(--primary);
  box-shadow: var(--glow);
}

/* Banner de quadro vazio — convite à ação, não um beco sem saída. */
.crm-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.crm-empty h2 {
  font-size: 18px;
  color: var(--text);
}

.crm-empty p {
  max-width: 46ch;
  font-size: 14px;
}

/* Board estreito ( laptops pequenos/tablet): colunas de 260px com rolagem
   horizontal — abaixo de ~1100px, 5 colunas de grid ficariam ilegíveis.
   O toggle "Descartados" segue valendo nos dois layouts. */
@media (max-width: 1099px) {
  .kanban,
  .kanban.hide-discarded {
    display: flex;
    overflow-x: auto;
    padding-bottom: 8px;
    /* Espaço para o focus-ring não ser cortado pela borda do scroll. */
    scroll-padding: 4px;
  }

  .kanban-col {
    flex: 0 0 260px;
    min-width: 260px;
  }
}

/* Três colunas de despesas no modal de edição. */
.form-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

/* ---------- Responsivo ---------- */

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-right: none;
    border-bottom: 1px dashed var(--border-strong);
  }

  .main-nav {
    flex-direction: row;
    gap: 2px;
    margin-left: auto;
  }

  .nav-link {
    padding: 8px 10px;
  }

  .sidebar-footer {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
  }

  .profile-box {
    display: none;
  }

  .view {
    padding: 20px 16px 40px;
  }
}

@media (max-width: 640px) {
  .view {
    padding: 16px 12px 88px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  /* Filtros empilham: resumo acima, ações (toggle/editar/excluir) abaixo. */
  .filter-item {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-actions {
    justify-content: flex-end;
    padding-top: 10px;
    border-top: 1px dashed var(--border-strong);
  }

  .form-row-3 {
    grid-template-columns: 1fr;
  }

  /* Nav vira abas inferiores fixas (mesma DOM, só CSS). */
  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 50;
    border-bottom: none;
    border-top: 1px dashed var(--border-strong);
    background: var(--surface-glass);
    backdrop-filter: blur(12px);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  }

  .brand {
    display: none;
  }

  .main-nav {
    width: 100%;
    justify-content: space-around;
    margin-left: 0;
  }

  .nav-link {
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
  }

  .nav-link.is-active {
    box-shadow: none;
    background: transparent;
    color: var(--primary);
  }

  .sidebar-footer {
    display: none;
  }
}

/* ---------- Movimento reduzido ---------- */

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