/* ============================================================
   DESIGN SYSTEM
   Tokens → Base → Layout → Componentes → Páginas → Responsivo

   Identidade: escuro grafite + um único acento laranja-cobre, usado com
   parcimônia (ação principal, item ativo, destaques). Tipografia Plus
   Jakarta Sans; números sempre tabulares para valores alinharem.
   Contraste: todo texto sobre --bg-card passa de 4.5:1 (WCAG AA).
   ============================================================ */

/* ── Tokens ──────────────────────────────────────────────── */
:root {
  --bg-page:    #0B0D11;
  --bg-card:    #13161C;
  --bg-element: #1A1E25;
  --bg-hover:   #20252D;
  --border:     #262B34;
  --border-lt:  #353C47;

  --text-primary:   #EDEFF2;
  --text-secondary: #B1B7C1;
  --text-muted:     #8A919C;

  /* Cor da marca. Na página pública é trocada pela cor da empresa emissora. */
  --accent:       #FF8A3D;
  --accent-hover: #FF9F5F;
  --accent-ink:   #1C0E04;
  --accent-soft:  rgba(255, 138, 61, 0.12);
  --accent-line:  rgba(255, 138, 61, 0.35);

  --danger:  #F26D6D;
  --success: #3DD68C;
  --warning: #F5B83D;
  --info:    #7CA5FF;
  --whatsapp: #25D366;

  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --radius:    8px;
  --radius-lg: 14px;
  --shadow:    0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --sidebar-w: 240px;
  --transition: 150ms ease;
  --demo-banner-h: 44px; /* ajustado via JS à altura real (app.js) */
}

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

body {
  font-family: var(--font);
  background:
    radial-gradient(900px 500px at -10% -20%, rgba(255, 138, 61, 0.07), transparent 60%),
    var(--bg-page);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1; /* números alinhados em tabelas e totais */
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; color: inherit; }
input, select, textarea { font: inherit; }
ul { list-style: none; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

::selection { background: var(--accent-soft); color: var(--text-primary); }

/* ── Marca ───────────────────────────────────────────────── */
.marca { display: flex; align-items: center; gap: 10px; }
.marca-simbolo { width: 32px; height: 32px; flex-shrink: 0; }
.marca-nome { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; color: var(--text-primary); line-height: 1.1; }
.marca-sub  { font-size: 11px; color: var(--text-muted); font-weight: 500; }

/* ── Layout: Sidebar + Main ──────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: rgba(19, 22, 28, 0.92);
  backdrop-filter: blur(8px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-brand { padding: 22px 20px 18px; }

.sidebar-nav { padding: 8px 12px; flex: 1; overflow-y: auto; }

.nav-section {
  padding: 12px 12px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 2px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
.nav-item:hover { color: var(--text-primary); background: var(--bg-element); }
.nav-item.active { color: var(--text-primary); background: var(--accent-soft); font-weight: 600; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.nav-item svg { flex-shrink: 0; opacity: 0.85; }
.nav-item.active svg { color: var(--accent); opacity: 1; }

/* Rodapé da sidebar: a conta logada (marca da empresa do cliente) + Sair */
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }

.conta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius);
}
.conta-avatar {
  width: 36px; height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.conta-avatar img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.conta-info { min-width: 0; flex: 1; }
.conta-nome {
  font-size: 13px; font-weight: 700; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conta-plano {
  font-size: 11.5px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.btn-sair {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--radius);
  color: var(--text-muted);
  transition: all var(--transition);
}
.btn-sair:hover { color: var(--text-primary); background: var(--bg-element); }

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  /* body é flex (sidebar + main em linha) — sem isso, .main recusa
     encolher abaixo do conteúdo mínimo de algum descendente (ex: tabela
     larga) e o overflow escapa pra fora da viewport em vez de ficar
     contido na rolagem horizontal interna do .table-wrap. */
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 36px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 13, 17, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.topbar-sub   { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ── Page content ────────────────────────────────────────── */
.page {
  padding: 28px 36px 48px;
  flex: 1;
  /* .main é flex-column; sem isso, item flex recusa encolher abaixo do
     conteúdo mínimo (ex: tabela larga) e o overflow escapa do .table-wrap
     pra página inteira, em vez de ficar contido na rolagem horizontal. */
  min-width: 0;
  max-width: 1280px;
  width: 100%;
  display: none;
}
.page.active { display: block; animation: surgir 220ms ease; }

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

.page-hint { font-size: 14px; color: var(--text-secondary); margin: -8px 0 18px; }

/* ── Stat Cards (Dashboard) ──────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  overflow: hidden;
}
.stat-card.destaque {
  border-color: var(--accent-line);
  background: linear-gradient(160deg, rgba(255, 138, 61, 0.10), var(--bg-card) 55%);
}
.stat-icone {
  position: absolute;
  top: 18px; right: 18px;
  width: 34px; height: 34px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-element);
  color: var(--text-secondary);
}
.stat-card.destaque .stat-icone { background: var(--accent-soft); color: var(--accent); }

.stat-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 10px; }
.stat-value { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.stat-sub   { font-size: 12.5px; color: var(--text-muted); margin-top: 10px; min-height: 1em; }
.stat-sub strong { color: var(--text-secondary); font-weight: 600; }

/* ── Section header ──────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.section-title { font-size: 16px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.01em; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform 80ms ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: progress; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  box-shadow: 0 6px 18px -8px var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost {
  background: var(--bg-element);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--border-lt); background: var(--bg-hover); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--border);
}
.btn-danger:hover { background: rgba(242, 109, 109, 0.10); border-color: rgba(242, 109, 109, 0.5); }

.btn-whatsapp {
  background: var(--whatsapp);
  color: #052E16;
  border-color: var(--whatsapp);
  font-weight: 700;
}
.btn-whatsapp:hover { background: #1EBE5A; border-color: #1EBE5A; }

.btn-sm    { padding: 6px 11px; font-size: 12.5px; }
.btn-icon  { padding: 7px; }
.btn-block { width: 100%; }

/* ── Tabela ──────────────────────────────────────────────── */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }

thead th {
  padding: 12px 18px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: rgba(26, 30, 37, 0.6);
  white-space: nowrap;
}

tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(32, 37, 45, 0.6); }

tbody td {
  padding: 14px 18px;
  font-size: 14px;
  color: var(--text-primary);
  vertical-align: middle;
}

.td-muted { color: var(--text-secondary); font-size: 13px; }
.nowrap   { white-space: nowrap; }

/* ── Badge de status (pílula com ponto) ──────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-pendente  { background: rgba(124, 165, 255, 0.12); color: #9DBBFF; border-color: rgba(124, 165, 255, 0.25); }
.badge-aprovado  { background: rgba(61, 214, 140, 0.12);  color: #5FE3A4; border-color: rgba(61, 214, 140, 0.25); }
.badge-rejeitado { background: rgba(242, 109, 109, 0.12); color: #FF8A8A; border-color: rgba(242, 109, 109, 0.25); }
.badge-cancelado { background: rgba(138, 145, 156, 0.14); color: #B1B7C1; border-color: rgba(138, 145, 156, 0.25); }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 44px 16px;
  color: var(--text-secondary);
}
.empty-state p { margin-top: 4px; font-size: 14px; }

/* ── Card genérico ───────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

/* ── Detail layout ───────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.detail-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.detail-field p { font-size: 15px; font-weight: 600; color: var(--text-primary); }

/* ── Total ───────────────────────────────────────────────── */
.total-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(120deg, var(--accent-soft), var(--bg-element) 70%);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-top: 12px;
}
.total-bar-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.total-bar-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; color: var(--text-primary); }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 8, 0.72);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-lt);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow);
  max-height: 90vh;
  overflow-y: auto;
  animation: surgir 180ms ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; }

.modal-body   { padding: 22px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--bg-element);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:hover { border-color: var(--border-lt); }
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-control::placeholder { color: #6B727D; }
.form-control:disabled { opacity: 0.7; }

select.form-control option { background: var(--bg-element); }
textarea.form-control { resize: vertical; min-height: 84px; }
input[type="color"].form-control { padding: 4px; height: 42px; cursor: pointer; }

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

/* ── Toast ───────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-element);
  border: 1px solid var(--border-lt);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 460px;
  animation: toast-in 200ms ease;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast .btn    { flex-shrink: 0; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ── Loader ──────────────────────────────────────────────── */
.loader {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid var(--border-lt);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.page-loader { display: flex; justify-content: center; padding: 60px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Misc ────────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 18px;
  transition: color var(--transition);
}
.back-link:hover { color: var(--accent); }

.divider { border: none; border-top: 1px solid var(--border); margin: 22px 0; }

.action-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── Itens no modal de novo orçamento ────────────────────── */
.itens-orc-acoes { display: flex; gap: 8px; margin-bottom: 10px; }
.itens-orc-acoes select { flex: 1; min-width: 0; }

.item-linha {
  display: grid;
  grid-template-columns: 1fr 84px 120px auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.itens-orc-total { font-size: 13.5px; font-weight: 600; color: var(--text-secondary); text-align: right; margin-top: 6px; }

/* ── Menu mobile (hamburger + sidebar deslizante) ───────────── */
.btn-menu-mobile {
  display: none;
  background: var(--bg-element);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px;
  color: var(--text-primary);
  margin-right: 12px;
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99;
}
.sidebar-backdrop.open { display: block; }

/* ── Modo demonstração ───────────────────────────────────── */
.demo-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 150;
  min-height: var(--demo-banner-h);
  padding: 6px 16px;
  padding-top: calc(6px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  background: linear-gradient(90deg, #2A1708, #1F1308 50%, #2A1708);
  border-bottom: 1px solid var(--accent-line);
  color: var(--text-primary);
  font-size: 13.5px;
}
.demo-banner strong { color: var(--accent); }
.demo-banner-ponto {
  display: inline-block;
  width: 8px; height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent);
  animation: pulsar 2s infinite;
  vertical-align: middle;
}
@keyframes pulsar {
  0%   { box-shadow: 0 0 0 0 rgba(255, 138, 61, 0.6); }
  70%  { box-shadow: 0 0 0 8px rgba(255, 138, 61, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 138, 61, 0); }
}

/* Empurra o layout para baixo do banner fixo. */
body.modo-demo { padding-top: var(--demo-banner-h); }
/* min-height 0: com top+bottom definidos, os 100vh empurrariam o "Sair" para fora da tela. */
body.modo-demo .sidebar { top: var(--demo-banner-h); min-height: 0; }
body.modo-demo .topbar  { top: var(--demo-banner-h); }

/* ── Conta travada (teste encerrado / vencida / suspensa) ── */
body.bloqueado .sidebar,
body.bloqueado .main,
body.bloqueado .sidebar-backdrop { display: none; }
.tela-bloqueio {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(700px 400px at 50% 0%, rgba(255, 138, 61, 0.10), transparent 70%),
    var(--bg-page);
}
.tela-bloqueio-card { max-width: 440px; width: 100%; text-align: center; padding: 32px 28px; box-shadow: var(--shadow); }
.tela-bloqueio-card h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 10px; }
.tela-bloqueio-card p  { font-size: 14.5px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 24px; }
.tela-bloqueio-card .btn + .btn { margin-top: 10px; }
.tela-bloqueio-icone {
  width: 56px; height: 56px;
  margin: 0 auto 18px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent);
}

/* ── Painel admin ────────────────────────────────────────── */
.admin-filtros { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-filtros input  { width: 260px; }
.admin-filtros select { width: 190px; }
.admin-acoes .btn { padding: 5px 10px; }
.badge-sit-teste          { background: rgba(124, 165, 255, 0.12); color: #9DBBFF; border-color: rgba(124, 165, 255, 0.25); }
.badge-sit-ativa          { background: rgba(61, 214, 140, 0.12);  color: #5FE3A4; border-color: rgba(61, 214, 140, 0.25); }
.badge-sit-teste_expirado,
.badge-sit-vencida        { background: rgba(245, 184, 61, 0.12);  color: #F5C76A; border-color: rgba(245, 184, 61, 0.28); }
.badge-sit-suspensa       { background: rgba(242, 109, 109, 0.12); color: #FF8A8A; border-color: rgba(242, 109, 109, 0.25); }
.badge[class*="badge-sit-"] { text-transform: none; }

/* ── Login: link "esqueci minha senha" e aviso do teste ──── */
.link-discreto {
  display: inline-block;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  background: none;
  border: none;
  padding: 0;
}
.link-discreto:hover { color: var(--accent); }
.form-nota { font-size: 12.5px; color: var(--text-muted); margin-top: 10px; text-align: center; }

/* ── Login (página de entrada) ───────────────────────────── */
.standalone-page {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}
.standalone-box { width: 100%; max-width: 440px; }

.login-layout {
  width: 100%;
  max-width: 1040px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 64px;
  align-items: center;
}

.login-hero .marca { margin-bottom: 40px; }
.login-hero .marca-simbolo { width: 40px; height: 40px; }
.login-hero .marca-nome { font-size: 18px; }

.login-titulo {
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.035em;
  margin-bottom: 16px;
}
.login-titulo em { font-style: normal; color: var(--accent); }
.login-subtitulo { font-size: 16px; color: var(--text-secondary); max-width: 440px; margin-bottom: 32px; }

.beneficios { display: grid; gap: 16px; }
.beneficio { display: flex; gap: 14px; align-items: flex-start; }
.beneficio-icone {
  width: 36px; height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-line);
}
.beneficio strong { display: block; font-size: 14.5px; font-weight: 700; }
.beneficio span   { font-size: 13.5px; color: var(--text-secondary); }

.login-card { padding: 28px; box-shadow: var(--shadow); }
.login-card-titulo { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 4px; }
.login-card-sub    { font-size: 13.5px; color: var(--text-secondary); margin-bottom: 20px; }

.login-rodape { margin-top: 20px; font-size: 12px; color: var(--text-muted); text-align: center; }

.tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--bg-element); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.tab-btn {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 7px;
  transition: all var(--transition);
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { background: var(--bg-hover); color: var(--text-primary); box-shadow: var(--shadow-sm); }

.demo-cta { margin-top: 18px; text-align: center; }
.demo-cta-divisor {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 12.5px;
  margin-bottom: 18px;
}
.demo-cta-divisor::before,
.demo-cta-divisor::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.btn-demo {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-line);
  padding: 11px 16px;
  font-size: 14px;
}
.btn-demo:hover { background: rgba(255, 138, 61, 0.2); border-color: var(--accent); }
.demo-cta-nota { font-size: 12.5px; color: var(--text-muted); margin-top: 8px; }
.demo-aviso { margin-top: 16px; text-align: left; border-color: var(--accent-line); }
.demo-aviso p { font-size: 14px; line-height: 1.6; margin-bottom: 12px; }

/* ── Página pública (documento claro, com a marca do emissor) ── */
.tema-claro {
  --bg-page:    #EEF0F3;
  --bg-card:    #FFFFFF;
  --bg-element: #F5F6F8;
  --bg-hover:   #EEF0F3;
  --border:     #E1E4E9;
  --border-lt:  #CDD2D9;
  --text-primary:   #14171C;
  --text-secondary: #4E5560;
  --text-muted:     #6B727D;
  --shadow: 0 20px 50px -20px rgba(20, 23, 28, 0.25);
}
body.tema-claro { background: var(--bg-page); }
.tema-claro thead th { background: var(--bg-element); }
.tema-claro tbody tr:hover { background: var(--bg-element); }
.tema-claro .badge-pendente  { color: #2952CC; }
.tema-claro .badge-aprovado  { color: #12804F; }
.tema-claro .badge-rejeitado { color: #C93636; }
.tema-claro .badge-cancelado { color: #4E5560; }
.tema-claro .toast { background: #fff; }

/* .card.doc: vence o padding do .card no celular — a faixa da marca encosta nas bordas. */
.card.doc { padding: 0; overflow: hidden; box-shadow: var(--shadow); }
.doc-faixa { height: 6px; background: var(--accent); }
.doc-topo {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  padding: 28px 32px 20px;
}
.doc-emissor-nome { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.doc-numero { text-align: right; }
.doc-numero-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.doc-numero-valor { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.doc-corpo { padding: 0 32px 32px; }
.doc-titulo { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 8px; }
.doc-descricao { font-size: 14.5px; color: var(--text-secondary); line-height: 1.65; margin-bottom: 20px; white-space: pre-line; }
.doc-rodape { margin-top: 18px; text-align: center; font-size: 12px; color: var(--text-muted); }

/* ── Responsividade ──────────────────────────────────────── */
@media (max-width: 900px) {
  .login-layout { grid-template-columns: 1fr; gap: 28px; max-width: 460px; }
  .login-hero .marca { margin-bottom: 20px; }
  .login-subtitulo { margin-bottom: 0; }
  .beneficios { display: none; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform var(--transition); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
  .topbar, .page { padding-left: 20px; padding-right: 20px; }
  .btn-menu-mobile { display: inline-flex; }

  /* Tabelas não cabem na largura da tela — rola horizontalmente em vez
     de cortar colunas (overflow:hidden do .table-wrap escondia o resto). */
  .table-wrap { overflow-x: auto; }
  table { min-width: 640px; }
}

/* ── Toque: alvos de no mínimo ~44px (recomendação Apple/Google) ── */
@media (pointer: coarse) {
  .btn          { min-height: 44px; }
  .btn-sm       { min-height: 40px; padding: 8px 12px; }
  .btn-icon     { min-width: 44px; }
  .form-control { min-height: 44px; }
  .nav-item     { padding-top: 13px; padding-bottom: 13px; }
  .btn-sair     { width: 44px; height: 44px; }
  .back-link    { padding: 8px 0; }
}

/* ── Celular ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* 16px evita o zoom automático do iOS ao focar um campo. */
  .form-control { font-size: 16px; }

  .topbar { padding-top: 14px; padding-bottom: 14px; }
  .topbar-title { font-size: 17px; }
  .topbar-sub { font-size: 12px; }
  .page { padding: 18px 16px 40px; }
  .card { padding: 18px; }
  .section-header { flex-wrap: wrap; }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 24px; }
  .stat-card  { padding: 14px; }
  .stat-icone { display: none; }
  .stat-label { font-size: 12px; margin-bottom: 6px; }
  .stat-value { font-size: 24px; }
  .stat-sub   { font-size: 11.5px; margin-top: 6px; }

  /* Ações do orçamento: botões grandes, dois por linha, WhatsApp em destaque. */
  .detail-actions { width: 100%; }
  .detail-actions .btn { flex: 1 1 calc(50% - 10px); }
  .detail-actions .btn-whatsapp { flex-basis: 100%; }

  .total-bar { padding: 14px 16px; }
  .total-bar-value { font-size: 20px; }

  /* Tabelas → cards: cada linha vira um bloco com "rótulo: valor"
     (rótulo vem do data-label de cada <td>), sem rolagem horizontal. */
  .table-wrap:has(.table-cards) { overflow: visible; background: transparent; border: none; }
  table.table-cards { min-width: 0; }
  .table-cards thead { display: none; }
  .table-cards tbody tr {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 10px 14px;
    margin-bottom: 10px;
  }
  .table-cards tbody tr:last-child { border-bottom: 1px solid var(--border); }
  .table-cards tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    text-align: right !important;
    overflow-wrap: anywhere;
  }
  .table-cards tbody td[data-label]::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: left;
  }
  .table-cards tbody td:not([data-label]) { justify-content: flex-end; }
  .table-cards tbody td[colspan] { display: block; text-align: center !important; }

  /* Modais viram "bottom sheet": ocupam a largura toda, com cabeçalho e
     rodapé fixos para os botões ficarem sempre ao alcance do polegar. */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    max-width: none;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: none;
  }
  .modal-header { position: sticky; top: 0; z-index: 1; background: var(--bg-card); padding: 14px 16px; }
  .modal-body   { padding: 16px; }
  .modal-footer {
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }
  .modal-footer .btn { flex: 1; }

  .itens-orc-acoes { flex-direction: column; }
  .item-linha { grid-template-columns: 1fr 1fr auto; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
  .item-linha [name="item_descricao"] { grid-column: 1 / -1; }

  .toast-container { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .toast { min-width: 0; max-width: none; }

  .standalone-page { padding: 24px 16px; align-items: flex-start; }
  .login-card { padding: 20px; }

  .doc-topo { padding: 22px 20px 16px; }
  .doc-corpo { padding: 0 20px 24px; }
  .doc-numero { text-align: left; }
  .doc-titulo { font-size: 20px; }

  .demo-banner { font-size: 12.5px; gap: 8px; }

  .admin-filtros, .admin-filtros input, .admin-filtros select { width: 100%; }
  .admin-acoes { justify-content: stretch !important; }
  .admin-acoes .btn { flex: 1 1 calc(50% - 10px); }
  /* Nome + e-mail empilhados: lado a lado ficariam espremidos. */
  #admin-contas-body td[data-label="Empresa"] { display: block; text-align: left !important; padding-bottom: 10px; }
  #admin-contas-body td[data-label="Empresa"]::before { display: none; }
}

/* ── Minha marca ─────────────────────────────────────────── */
#page-configuracoes { max-width: 1400px; --cor-marca: var(--accent); }
.marca-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  gap: 24px;
  align-items: start;
}
.marca-secao { margin-bottom: 16px; }
.marca-secao-titulo { font-size: 15px; font-weight: 700; margin-bottom: 16px; letter-spacing: -0.01em; }
.marca-identidade { display: grid; grid-template-columns: 140px 1fr; gap: 16px; }
.marca-identidade .form-group { margin-bottom: 0; }
.marca-logo { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
#logo-preview img {
  max-height: 48px; max-width: 160px;
  padding: 6px 10px;
  border-radius: var(--radius);
  background: #fff;
  display: block;
}

/* Cartões de layout com miniatura do documento (desenhada em CSS, na cor escolhida) */
.layouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.layout-opcao {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-element);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.layout-opcao:hover { border-color: var(--border-lt); }
.layout-opcao input { position: absolute; opacity: 0; pointer-events: none; }
.layout-opcao:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.layout-opcao:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.layout-opcao strong { font-size: 13.5px; margin-top: 6px; }
.layout-opcao small  { font-size: 12px; color: var(--text-secondary); line-height: 1.35; }

.layout-mini {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 104px;
  padding: 8px;
  border-radius: 6px;
  background: #fff;
}
.layout-mini i { display: block; border-radius: 2px; }
.layout-mini i:nth-child(1) { height: 22px; }                                   /* cabeçalho */
.layout-mini i:nth-child(2) { height: 6px; width: 70%; background: #D9DCE1; }   /* dados */
.layout-mini i:nth-child(3) { flex: 1; background: repeating-linear-gradient(#fff 0 7px, #E8EAED 7px 8px); } /* itens */
.layout-mini i:nth-child(4) { height: 14px; }                                   /* total */
.layout-mini-classico i:nth-child(1),
.layout-mini-classico i:nth-child(4) { background: var(--cor-marca); }
.layout-mini-moderno i:nth-child(1) { background: transparent; border-bottom: 3px solid var(--cor-marca); border-radius: 0; }
.layout-mini-moderno i:nth-child(4) { background: transparent; border: 1.5px solid var(--cor-marca); }
.layout-mini-minimalista i:nth-child(1) { background: transparent; border-bottom: 1px solid #14171C; border-radius: 0; }
.layout-mini-minimalista i:nth-child(4) { background: transparent; border-top: 1px solid #14171C; border-radius: 0; }

.checkbox { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text-secondary); cursor: pointer; }
.checkbox input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--accent); flex-shrink: 0; }

/* Barra de salvar: fica visível enquanto a pessoa rola o formulário */
.marca-salvar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 0 16px;
  margin-bottom: 16px;
  background: linear-gradient(transparent, var(--bg-page) 30%);
}
.marca-salvar #marca-status { margin-right: auto; color: var(--warning); }
.marca-conta { margin-top: 8px; }

/* Pré-visualização ao vivo */
.marca-preview {
  position: sticky;
  top: calc(var(--demo-banner-h-ativo, 0px) + 100px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
body.modo-demo .marca-preview { --demo-banner-h-ativo: var(--demo-banner-h); }
.marca-preview-topo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}
.marca-preview-quadro { position: relative; background: #525659; height: calc(100vh - 220px); min-height: 460px; }
#preview-pdf { width: 100%; height: 100%; border: 0; display: block; }
.marca-preview-carregando {
  position: absolute;
  top: 12px; right: 12px;
  padding: 8px;
  border-radius: var(--radius);
  background: rgba(19, 22, 28, 0.85);
}

/* ── Detalhe: aviso de orçamento travado ─────────────────── */
.aviso-travado {
  margin: -6px 0 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(245, 184, 61, 0.3);
  background: rgba(245, 184, 61, 0.08);
  font-size: 13.5px;
  color: var(--text-secondary);
}

/* ── Admin: conta administradora ─────────────────────────── */
.badge-sit-admin { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); text-transform: none; }

/* ── Página pública: contato e condições da empresa ──────── */
.doc-emissor-sub { font-size: 12.5px; color: var(--text-secondary); margin-top: 4px; }
.doc-condicoes {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--bg-element);
  border: 1px solid var(--border);
}
.doc-condicoes p { font-size: 13.5px; color: var(--text-secondary); line-height: 1.6; white-space: pre-line; margin-top: 4px; }

@media (max-width: 1100px) {
  /* Sem espaço para o quadro ao lado: a prévia fica no botão "Ver PDF de exemplo". */
  .marca-layout { grid-template-columns: 1fr; }
  .marca-preview { display: none; }
}

@media (max-width: 640px) {
  .marca-identidade { grid-template-columns: 1fr; }
  .layouts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .layout-opcao { padding: 8px; }
  .layout-mini { height: 72px; padding: 6px; gap: 4px; }
  .layout-mini i:nth-child(1) { height: 14px; }
  .layout-mini i:nth-child(4) { height: 10px; }
  .layout-opcao small { display: none; }
  .marca-salvar { justify-content: stretch; }
  .marca-salvar .btn { flex: 1; }
  .marca-salvar #marca-status { flex-basis: 100%; }
}

/* ── Fase 6: Google, anti-bot e termos ───────────────────── */
.google-entrar { margin-bottom: 4px; }
#google-botao { display: flex; justify-content: center; min-height: 44px; }
.google-entrar .form-nota { margin: 10px 0 16px; }
.google-entrar .demo-cta-divisor { margin-bottom: 16px; }
.form-nota a, .login-rodape a, .aceite-termos a { color: var(--text-secondary); text-decoration: underline; }
.form-nota a:hover, .login-rodape a:hover, .aceite-termos a:hover { color: var(--accent); }
.aceite-termos { margin: 2px 0 16px; font-size: 13px; }

/* Campo-isca: fora da tela (não display:none — alguns robôs pulam campos ocultos assim). */
.campo-isca { position: absolute; left: -10000px; width: 1px; height: 1px; opacity: 0; }

/* Turnstile: só ocupa espaço quando precisa pedir interação. */
.turnstile-slot:not(:empty) { display: flex; justify-content: center; margin-bottom: 12px; }

/* ── Páginas legais (termos.html / privacidade.html) ─────── */
.legal { max-width: 820px; }
.legal .doc-corpo { padding-top: 28px; }
.legal h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px; }
.legal h2 { font-size: 17px; font-weight: 700; margin: 28px 0 8px; }
.legal p, .legal li { font-size: 14.5px; line-height: 1.7; color: var(--text-secondary); }
.legal ul { list-style: disc; padding-left: 22px; margin: 6px 0; }
.legal li { margin-bottom: 4px; }
.legal strong { color: var(--text-primary); }
.legal .legal-versao { font-size: 13px; color: var(--text-muted); }
.legal .legal-aviso {
  margin: 18px 0 4px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(245, 184, 61, 0.12);
  border: 1px solid rgba(245, 184, 61, 0.4);
  font-size: 13.5px;
  color: var(--text-primary);
}
.legal-topo { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.legal-topo a { font-size: 13.5px; color: var(--text-secondary); text-decoration: underline; }
.link-sublinhado { color: var(--text-secondary); text-decoration: underline; }
.link-sublinhado:hover { color: var(--accent); }
