/* =========================================================
   LavaCar — Design system inspirado em Dark Pay
   Cards uniformes · fundo único · acento verde neon
   ========================================================= */

:root {
  --bg: #0a0a0a;
  --bg-elevated: #141414;
  --bg-card: #151515;
  --bg-soft: #1c1c1c;
  --bg-hover: #222222;
  --border: #222222;
  --border-subtle: #1e1e1e;
  --text: #f5f5f5;
  /* Cinza mais legível e com peso visual */
  --text-muted: #a3a3a3;
  --text-dim: #7a7a7a;
  --scrollbar-track: #1a1a1a;
  --scrollbar-thumb: #f5c518;
  --scrollbar-thumb-hover: #d4a40f;

  /* Hierarquia de espaçamento entre seções */
  --space-section: 1.75rem;   /* entre blocos grandes (stats → lista) */
  --space-block: 1.25rem;     /* entre grids de cards */
  --space-card: 1rem;         /* entre cards na mesma grid */
  --space-title: 1.1rem;      /* título de seção → cards */

  /* Amarelo — botões, menu, ícones, tags */
  --primary: #f5c518;
  --primary-dark: #d4a40f;
  --primary-soft: rgba(245, 197, 24, 0.16);
  --primary-ink: #0a0a0a;

  /* Ícones — amarelo (mesmo tom do sistema) */
  --icon-bg: #f5c518;
  --icon-fg: #0a0a0a;

  --success: #f5c518;
  --success-soft: rgba(245, 197, 24, 0.16);
  --warning: #ffc107;
  --warning-soft: rgba(255, 193, 7, 0.14);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --info: #3b82f6;
  --info-soft: rgba(59, 130, 246, 0.14);

  --radius: 16px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --sidebar-w: 248px;
  --card-h: 112px;
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
}

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

html {
  font-size: 16px;
  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar amarela (Chrome, Edge, Safari) */
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid var(--scrollbar-track);
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

*::-webkit-scrollbar-corner {
  background: var(--scrollbar-track);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

.app {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* ---------- Boot / Login ---------- */
.boot-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  z-index: 200;
}

.boot-screen[hidden] {
  display: none;
}

.boot-card {
  text-align: center;
  color: var(--text-muted);
}

.boot-logo {
  width: 160px;
  height: auto;
  margin-bottom: 1rem;
  mix-blend-mode: screen;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 70% 50% at 50% -5%, rgba(245, 197, 24, 0.14), transparent 55%),
    var(--bg);
  padding: 1.5rem;
}

.login-wrap {
  width: min(420px, 100%);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem 1.75rem 1.75rem;
  box-shadow: var(--shadow);
}

.login-brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-logo {
  width: min(240px, 100%);
  height: auto;
  display: block;
  margin: 0 auto 0.75rem;
  mix-blend-mode: screen;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-error {
  background: var(--danger);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
}

.login-error[hidden] {
  display: none;
}

.btn-block {
  width: 100%;
  margin-top: 0.35rem;
}

/* ---------- Sidebar (Dark Pay style) ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg);
  border-right: 1px solid var(--border-subtle);
  padding: 1.35rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  transition: transform 0.25s ease;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.5rem 0.35rem;
}

.brand-logo {
  width: 100%;
  max-width: 200px;
  height: auto;
  display: block;
  object-fit: contain;
  background: transparent;
  border: none;
  mix-blend-mode: screen;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.92rem;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.nav-btn:hover {
  background: var(--bg-soft);
  color: var(--text);
}

/* Item ativo = pílula amarela */
.nav-btn.active {
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 700;
}

/* Lateral: SEM fundo — mesmo tipo de ícone da Dashboard, cor FIXA PRETA */
.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  flex-shrink: 0;
  background: transparent;
  border: none;
  line-height: 1;
  color: #0a0a0a;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  color: #0a0a0a;
  stroke: #0a0a0a;
  stroke-width: 2.25;
}

/* Ícone PNG no menu (ex.: Métricas) — cor fixa via filter */
.nav-icon .nav-img-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
  /* preto sólido */
  filter: brightness(0);
  opacity: 1;
}

/* Inativo no fundo escuro: ícone claro */
.nav-btn:not(.active) .nav-icon .nav-img-icon {
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

/* Ativo na pílula amarela: preto */
.nav-btn.active .nav-icon .nav-img-icon {
  filter: brightness(0);
  opacity: 1;
}

/* Ativo (pílula amarela): mantém ícone preto fixo */
.nav-btn.active .nav-icon,
.nav-btn.active .nav-icon svg {
  color: #0a0a0a;
  stroke: #0a0a0a;
}

.nav-btn:hover .nav-icon,
.nav-btn:hover .nav-icon svg {
  color: #0a0a0a;
  stroke: #0a0a0a;
}

/* Sobre fundo escuro do menu (item inativo), ícone preto some — usar branco suave no tema dark */
.nav-btn:not(.active) .nav-icon,
.nav-btn:not(.active) .nav-icon svg {
  color: #ececee;
  stroke: #ececee;
}

/* Item ativo = pílula amarela → ícone preto (igual Dashboard) */
.nav-btn.active .nav-icon,
.nav-btn.active .nav-icon svg,
.nav-btn.active:hover .nav-icon,
.nav-btn.active:hover .nav-icon svg {
  color: #0a0a0a;
  stroke: #0a0a0a;
}

.meta-with-icon {
  display: inline-flex !important;
  align-items: center;
  gap: 0.35rem;
}

.meta-with-icon svg {
  flex-shrink: 0;
  opacity: 0.85;
}

.tag svg {
  width: 12px;
  height: 12px;
  vertical-align: -1px;
  margin-right: 2px;
}

.menu-toggle svg {
  width: 20px;
  height: 20px;
}

.btn-funil svg {
  width: 18px;
  height: 18px;
}

/* Ícone de pagamento no modal — fundo amarelo arredondado, SEM borda */
.btn-pagamento .pag-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--icon-bg);
  border: none;
  color: var(--icon-fg);
}

.btn-pagamento .pag-icon svg {
  width: 22px;
  height: 22px;
}

.stat-pag-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

/* Ícones de imagem nos badges amarelos: pretos */
.stat-pag-icon .pay-img-icon,
.pag-icon .pay-img-icon,
.tag .pay-img-icon {
  width: 1.15em;
  height: 1.15em;
  object-fit: contain;
  display: block;
  filter: brightness(0);
  opacity: 0.9;
}

.stat-pag-icon .pay-img-icon {
  width: 20px;
  height: 20px;
}

.pag-icon .pay-img-icon {
  width: 22px;
  height: 22px;
}

.tag .pay-img-icon {
  width: 12px;
  height: 12px;
  display: inline-block;
  vertical-align: -1px;
  filter: brightness(0) invert(1);
}

/* Barras de métricas (Pix / Cartão / Dinheiro): ícones AMARELOS */
.metric-row .pay-img-icon,
.metric-row .meta-with-icon .pay-img-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  display: inline-block;
  vertical-align: -2px;
  flex-shrink: 0;
  /* força cor amarela #f5c518 */
  filter: brightness(0) saturate(100%) invert(78%) sepia(61%) saturate(700%) hue-rotate(5deg) brightness(103%) contrast(98%);
  opacity: 1;
}

.metric-row .meta-with-icon svg {
  color: var(--primary);
  stroke: var(--primary);
  opacity: 1;
}

.sidebar-footer {
  padding: 0.75rem 0.35rem 0;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.4rem 0.4rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--icon-bg);
  color: var(--icon-fg);
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: none;
}

.user-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.user-meta strong {
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-meta span {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.88rem;
  transition: background 0.15s, color 0.15s;
}

.btn-logout:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Sair: mesmo traço, sem fundo */
.btn-logout .nav-icon {
  background: transparent;
  color: #ececee;
}

.btn-logout .nav-icon svg {
  color: #ececee;
  stroke: #ececee;
  width: 18px;
  height: 18px;
  stroke-width: 2.25;
}

.btn-logout:hover .nav-icon,
.btn-logout:hover .nav-icon svg {
  color: var(--danger);
  stroke: var(--danger);
}

/* ---------- Main ---------- */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 1.5rem 1.75rem 2.5rem;
  min-width: 0;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: var(--space-section);
}

.topbar h2 {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex: 1;
}

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 1.2rem;
}

/* Views */
.view {
  display: none;
  animation: fadeIn 0.2s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* =========================================================
   STAT CARDS — MESMO fundo · MESMA altura · MESMA largura
   ========================================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-card);
  margin-bottom: var(--space-block);
  align-items: stretch;
}

.stats-grid.stats-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* Segunda faixa de cards (Pix/Cartão/Dinheiro): mais espaço antes da lista */
.stats-grid.stats-pagamento {
  margin-bottom: var(--space-section);
}

/* Hierarquia: bloco de stats → painel seguinte */
.view > .stats-grid + .panel,
.view > .stats-grid.stats-pagamento + .panel {
  margin-top: 0.25rem;
}

.view > .section-title {
  margin-top: var(--space-section);
}

.view > .section-title:first-of-type,
.view > .filters + .section-title {
  margin-top: 0.35rem;
}

.view > .section-title + .stats-grid {
  margin-top: 0;
}

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

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

@media (max-width: 520px) {
  .stats-grid,
  .stats-grid.stats-grid-4 {
    grid-template-columns: 1fr;
  }
}

/* Card base unificado (métricas e pagamento) */
.stat-card,
.stat-card-pag {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  position: relative;
  overflow: hidden;
  min-height: var(--card-h);
  height: 100%;
  width: 100%;
  box-sizing: border-box;
}

.stat-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-card .label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.stat-card .value {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat-card .sub {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 500;
  margin-top: 0.25rem;
}

/* Layout horizontal: ícone à ESQUERDA · nome + valor à direita */
.stat-card.stat-card-pag,
.stat-card-pag {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.9rem;
}

/* Ícone: quadrado arredondado AMARELO sólido, SEM borda (padrão único Dashboard/Métricas) */
.stat-pag-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--icon-bg) !important;
  border: none;
  line-height: 1;
  color: var(--icon-fg) !important;
}

.stat-pag-icon svg {
  width: 20px;
  height: 20px;
  color: #0a0a0a !important;
  stroke: #0a0a0a !important;
  stroke-width: 2.25;
}

/* Ícones pretos da Dashboard/Métricas: mesmo peso visual (PNG + lucide) */
.stat-pag-icon .pay-img-icon {
  width: 22px !important;
  height: 22px !important;
  filter: brightness(0) !important;
  opacity: 1 !important;
}

.stat-pag-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.stat-pag-caption {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  letter-spacing: 0.01em;
}

.stat-card-pag .value {
  margin-left: 0;
  font-size: 1.35rem;
  line-height: 1.15;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: left;
  color: var(--text);
  letter-spacing: -0.02em;
}

/* Garante que o ícone nunca sobe para cima do texto */
.stat-card-pag > .stat-pag-icon {
  order: 0;
  align-self: center;
}

.stat-card-pag > .stat-pag-text {
  order: 1;
}

/* ---------- Panels ---------- */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin-bottom: var(--space-section);
  box-shadow: none;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}

.panel-header h3 {
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panels-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-block);
  align-items: stretch;
  margin-bottom: var(--space-section);
}

.panels-row > .panel {
  margin-bottom: 0;
  height: 100%;
  min-height: 220px;
}

/* Espaço extra entre seções de painéis */
.panels-row + .panels-row {
  margin-top: 0.15rem;
}

.panels-row + .panel {
  margin-top: 0.15rem;
}

.badge {
  background: var(--primary);
  color: var(--primary-ink);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-pill);
  border: none;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.15rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.9rem;
  transition: transform 0.1s, opacity 0.15s, background 0.15s;
  border: 1px solid transparent;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-sm {
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
}

#btnNovoRapido[hidden] {
  display: none !important;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-ink);
  border: none;
}

.btn-primary:hover {
  background: var(--primary-dark);
  opacity: 1;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--bg-soft);
  color: var(--text);
}

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

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  background: var(--bg-soft);
  border: none;
  font-size: 0.95rem;
}

.btn-icon:hover {
  color: var(--primary);
}

.btn-icon.danger:hover {
  color: var(--danger);
}

.btn-icon-action {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  background: var(--bg-soft);
  border: none;
  color: var(--text-muted);
  display: inline-grid;
  place-items: center;
  transition: background 0.15s, color 0.15s;
}

.btn-icon-action:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.btn-icon-action.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-icon-action svg {
  width: 16px;
  height: 16px;
}

/* ---------- Form ---------- */
.form-panel {
  max-width: 640px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.15rem;
}

.form-grid-minimal {
  gap: 1.1rem 1.15rem;
}

/* Toggle Buscar / Cliente traz */
.modalidade-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.mod-btn {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.mod-btn:hover {
  border-color: rgba(245, 197, 24, 0.45);
  color: var(--text);
}

.mod-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}

.tag-mod-buscar {
  background: #3b82f6;
  color: #fff;
}

.tag-mod-trazer {
  background: #64748b;
  color: #fff;
}

#fieldEndereco[hidden] {
  display: none !important;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field-full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.field input,
.field select,
.field textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  color-scheme: dark;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.field textarea {
  resize: vertical;
  min-height: 80px;
}

.hint {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 500;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

/* ---------- Filters ---------- */
.filters {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr);
  gap: 0.85rem;
  margin-bottom: var(--space-section);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
}

.filters-compact {
  grid-template-columns: minmax(200px, 280px);
}

.filters-metricas {
  grid-template-columns: repeat(auto-fit, minmax(200px, 280px));
}

.view-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-bottom: var(--space-block);
  min-height: 40px;
}

/* Métricas: funil alinhado à direita, acima do resumo */
.metricas-tools {
  margin-bottom: 0.85rem;
  margin-top: 0.15rem;
}

.filter-popover-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.15rem;
}

.periodo-opcoes {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.btn-periodo {
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-periodo:hover {
  border-color: rgba(245, 197, 24, 0.45);
  color: var(--text);
}

.btn-periodo.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}

.view-tools-label {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 600;
}

.filter-menu {
  position: relative;
}

.btn-funil {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.btn-funil:hover,
.btn-funil.active,
.btn-funil.has-filter {
  color: var(--primary-ink);
  background: var(--primary);
  border-color: var(--primary);
}

.filter-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  width: min(260px, calc(100vw - 2rem));
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.filter-popover[hidden] {
  display: none;
}

.filter-popover > label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.filter-popover input[type="date"],
.filter-popover input[type="search"],
.filter-popover select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  outline: none;
  color-scheme: dark;
  width: 100%;
}

.filter-popover input:focus,
.filter-popover select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}

.filter-popover-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-top: 0.25rem;
}

.filter-popover-wide {
  width: min(340px, calc(100vw - 2rem));
}

.filter-popover-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

.filter-popover-grid .field label {
  font-size: 0.75rem;
}

.filter-popover-grid .field input,
.filter-popover-grid .field select {
  padding: 0.5rem 0.65rem;
  font-size: 0.88rem;
}

.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: var(--space-section) 0 var(--space-title);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-title + .stats-grid {
  margin-bottom: var(--space-block);
}

/* Seções de métricas bem separadas */
#view-metricas .section-title {
  padding-top: 0.35rem;
  border-top: 1px solid transparent;
}

#view-metricas .filters {
  margin-bottom: var(--space-section);
}

#view-metricas .panels-row {
  margin-bottom: var(--space-section);
}

/* ---------- List cards ---------- */
.list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.list-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}

.list-empty strong {
  display: block;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem 1rem;
  transition: border-color 0.15s;
  align-items: stretch;
}

.card:hover {
  border-color: rgba(245, 197, 24, 0.4);
}

.card-main {
  min-width: 0;
}

.card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.45rem;
}

.card-name {
  font-weight: 600;
  font-size: 1rem;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.05rem;
  font-size: 0.86rem;
  color: var(--text-muted);
  font-weight: 500;
}

.card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.card-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.card-actions--valor {
  justify-content: center;
  align-items: center;
  align-self: stretch;
  min-width: 6.5rem;
  gap: 0.55rem;
}

.card-actions--valor .card-price {
  text-align: center;
  width: 100%;
}

.card-actions--com-botoes .card-btns {
  justify-content: center;
}

.card-price {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--primary);
  white-space: nowrap;
}

.card-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
  align-items: center;
}

/* WhatsApp — mantém verde oficial (única exceção) */
.btn-wa {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  background: #25d366;
  color: #fff;
  display: inline-grid;
  place-items: center;
  border: none;
  transition: transform 0.1s, opacity 0.15s;
}

.btn-wa:hover {
  opacity: 0.9;
  transform: scale(1.04);
}

.btn-wa svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.btn-concluir {
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 700;
  font-size: 0.85rem;
  border: none;
  white-space: nowrap;
}

.btn-concluir:hover {
  background: var(--primary-dark);
}

.btn-pagamento {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  font-weight: 600;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
  min-height: 110px;
}

.btn-pagamento:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.pagamento-opcoes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 1.15rem 0 0.5rem;
}

.modal-pagamento {
  width: min(420px, 100%);
}

.modal-pagamento p {
  margin-top: 0.25rem;
}

/* Tags sólidas e vivas */
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.28rem 0.65rem;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: none;
  color: #fff;
}

.tag-completa {
  background: var(--primary);
  color: var(--primary-ink);
}

.tag-completa_cera {
  background: #f59e0b;
  color: #0a0a0a;
}

.tag-completa_cera_pasta {
  background: #ea580c;
  color: #fff;
}

.tag-ducha_cera {
  background: #ffc107;
  color: #0a0a0a;
}

.tag-ducha_sem_cera {
  background: #64748b;
  color: #fff;
}

/* Agendada — amarelo */
.tag-agendado {
  background: var(--primary);
  color: var(--primary-ink);
}

/* Lavagem paga / finalizada — verde */
.tag-concluido,
.tag-finalizada {
  background: #00e676;
  color: #0a0a0a;
}

.tag-cancelado {
  background: var(--danger);
  color: #fff;
}

.tag-pix {
  background: #eab308;
  color: #0a0a0a;
}

.tag-cartao {
  background: #2563eb;
  color: #fff;
}

.tag-dinheiro {
  background: #ca8a04;
  color: #fff;
}

/* Metric bars */
.metric-bars {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.metric-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.metric-row .name {
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-row .name.meta-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.metric-row .bar-track {
  height: 8px;
  background: var(--bg-soft);
  border-radius: var(--radius-pill);
  overflow: hidden;
  border: none;
}

.metric-row .bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-pill);
  min-width: 2px;
  transition: width 0.4s ease;
}

.metric-row .val {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 4.5rem;
  text-align: right;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  max-width: min(360px, calc(100vw - 2rem));
  font-weight: 500;
}

.toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.toast.success {
  border-color: transparent;
  background: #c9a012;
  color: #0a0a0a;
}

.toast.error {
  border-color: transparent;
  background: #b91c1c;
  color: #fff;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: grid;
  place-items: center;
  z-index: 90;
  padding: 1rem;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.35rem 1.1rem;
  box-shadow: var(--shadow);
  width: min(440px, 100%);
}

.modal h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal p {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
}

/* Sidebar mobile */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 35;
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
    padding: 1rem 1rem 2rem;
  }

  .menu-toggle {
    display: grid;
    place-items: center;
  }

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

  .panels-row > .panel {
    min-height: 0;
  }

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

  .card {
    grid-template-columns: 1fr;
  }

  .card-actions--valor {
    align-items: flex-start;
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
  }

  .metric-row {
    grid-template-columns: 90px 1fr auto;
  }
}

@media (max-width: 520px) {
  .pagamento-opcoes {
    grid-template-columns: 1fr;
  }

  .topbar h2 {
    font-size: 1.2rem;
  }

  :root {
    --card-h: 100px;
  }
}
