/* Design system extraído de DivideAi.dc.html — cores, raios e componentes idênticos ao protótipo. */
:root {
  --emerald: #059669;
  --emerald-dark: #047857;
  --emerald-50: #ecfdf5;
  --emerald-500: #10b981;
  --emerald-900: #065f46;
  --violet: #7c3aed;
  --violet-dark: #6d28d9;
  --violet-50: #f5f3ff;
  --violet-200: #ddd6fe;
  --violet-900: #5b21b6;
  --slate-900: #0f172a;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --amber-600: #d97706;
  --amber-50: #fffbeb;
  --red-500: #ef4444;
  --red-600: #b91c1c;
  --red-200: #fecaca;
  --red-50: #fef2f2;

  /* Superfícies (cartões, inputs, sheets, phone-shell) — sempre opacas, diferente do bg da página */
  --surface: #ffffff;
  --overlay-scrim: rgba(15,23,42,0.55);

  /* Ícones em PNG (traço preto sobre fundo transparente) — invertidos no escuro quando ficam sobre --surface */
  --icon-invert: none;
}

/* Tema escuro: mesmos nomes de variável, valores recalibrados para contraste e legibilidade em fundo escuro. */
:root[data-theme="dark"] {
  --emerald: #10b981;
  --emerald-dark: #34d399;
  --emerald-50: rgba(16,185,129,0.16);
  --emerald-500: #10b981;
  --emerald-900: #a7f3d0;

  --violet: #8b5cf6;
  --violet-dark: #c4b5fd;
  --violet-50: rgba(139,92,246,0.18);
  --violet-200: rgba(139,92,246,0.4);
  --violet-900: #ddd6fe;

  /* Escala slate invertida: 900 continua sendo "texto de maior destaque", 50 continua sendo "fundo mais sutil" */
  --slate-900: #f1f5f9;
  --slate-700: #e2e8f0;
  --slate-600: #cbd5e1;
  --slate-500: #94a3b8;
  --slate-400: #64748b;
  --slate-300: #475569;
  --slate-200: #334155;
  --slate-100: #1e293b;
  --slate-50: #0b1220;

  --amber-600: #fbbf24;
  --amber-50: rgba(217,119,6,0.16);
  --red-500: #f87171;
  --red-600: #fca5a5;
  --red-200: rgba(239,68,68,0.35);
  --red-50: rgba(239,68,68,0.14);

  --surface: #16202f;
  --overlay-scrim: rgba(0,0,0,0.65);
  --icon-invert: invert(1);
}

/* Sem escolha explícita, o app abre no tema claro por padrão (não segue mais o SO/navegador). */

* { box-sizing: border-box; }
.hidden { display: none !important; }

html, body { background: var(--slate-50); }

body {
  margin: 0;
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: var(--slate-900);
  transition: background-color 0.15s ease, color 0.15s ease;
}

a { color: var(--emerald); text-decoration: none; }
a:hover { color: var(--emerald-dark); text-decoration: underline; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 8px; }

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

.phone {
  width: 100%;
  margin: 0;
  background: var(--surface);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: background-color 0.15s ease;
}

.brand { font-size: 22px; font-weight: 800; color: var(--slate-900); }
.brand .accent { color: var(--emerald); }

.label { font-size: 12px; font-weight: 600; color: var(--slate-700); display: block; margin-bottom: 5px; }

.input, textarea.input, select.input {
  width: 100%;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--slate-900);
  font-family: inherit;
  background: var(--surface);
}
.input::placeholder { color: var(--slate-400); opacity: 1; }
.input:focus { outline: none; border-color: var(--emerald); }
.input.erro { border-color: var(--red-500); background: var(--red-50); color: var(--red-600); }

.btn { border: none; border-radius: 14px; padding: 13px; font-size: 14px; font-weight: 700; cursor: pointer; width: 100%; font-family: inherit; }
.btn-primary { background: var(--emerald); color: #fff; }
.btn-primary:hover { background: var(--emerald-dark); }
.btn-primary:disabled { background: var(--slate-200); color: var(--slate-400); cursor: not-allowed; }
.btn-secondary { background: var(--surface); border: 1px solid var(--slate-200); color: var(--slate-700); font-weight: 600; font-size: 13.5px; }
.btn-destructive { background: var(--surface); border: 1px solid var(--red-200); color: var(--red-500); font-weight: 600; }
.btn-violet { background: var(--violet); color: #fff; }
.btn-violet:hover { background: var(--violet-dark); }
.btn-sm { padding: 9px 16px; font-size: 13px; border-radius: 12px; width: auto; }

.badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 9999px; white-space: nowrap; display: inline-block; }
.badge-lg { font-size: 11px; font-weight: 700; padding: 4px 10px; }
.badge-aberto { background: var(--emerald-50); color: var(--emerald-dark); }
.badge-fechado { background: var(--slate-100); color: var(--slate-600); }
.badge-inativo, .badge-pendente { background: var(--amber-50); color: var(--amber-600); }
.badge-pro { background: var(--violet); color: #fff; font-size: 9.5px; font-weight: 800; padding: 2px 6px; border-radius: 6px; letter-spacing: 0.04em; }

.avatar { border-radius: 9999px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }

.card { background: var(--surface); border: 1px solid var(--slate-200); border-radius: 16px; padding: 14px 16px; }
.card-2xl { border-radius: 20px; }

.empty-state { text-align: center; padding: 60px 20px; }
.empty-state .icon { font-size: 34px; }
.empty-state .title { font-size: 14px; font-weight: 600; color: var(--slate-700); margin-top: 10px; }
.empty-state .sub { font-size: 12px; color: var(--slate-400); margin-top: 4px; }

.seg { display: flex; background: var(--slate-100); border-radius: 9999px; padding: 3px; gap: 2px; }
.seg button { border: none; border-radius: 9999px; padding: 6px 14px; font-size: 12px; font-weight: 600; cursor: pointer; background: transparent; color: var(--slate-500); font-family: inherit; }
.seg button.active { background: var(--surface); color: var(--slate-900); font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

.tabs { display: flex; padding: 0 20px; border-bottom: 1px solid var(--slate-100); }
.tabs button { padding: 12px 14px 10px; font-size: 13px; font-weight: 600; color: var(--slate-400); border: none; background: transparent; cursor: pointer; font-family: inherit; border-bottom: 2px solid transparent; }
.tabs button.active { font-weight: 700; color: var(--emerald); border-bottom-color: var(--emerald); }

.menu-item { display: block; width: 100%; text-align: left; background: none; border: none; padding: 14px 4px; font-size: 14px; font-weight: 600; color: var(--slate-700); cursor: pointer; font-family: inherit; border-bottom: 1px solid var(--slate-100); }
.menu-item:last-child { border-bottom: none; }

.org-secao { border-bottom: 1px solid var(--slate-100); padding: 0 0 16px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
.org-secao-titulo { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--slate-500); }

.sheet-overlay { position: fixed; inset: 0; background: var(--overlay-scrim); display: none; align-items: flex-end; justify-content: center; z-index: 30; }
.sheet-overlay.open { display: flex; }
.sheet { background: var(--surface); width: 100%; max-width: 390px; border-radius: 24px 24px 0 0; padding: 20px 20px 26px; max-height: 90vh; overflow-y: auto; }
.sheet-handle { width: 36px; height: 4px; background: var(--slate-200); border-radius: 9999px; margin: 0 auto 14px; }

.toggle { width: 44px; height: 24px; border-radius: 9999px; position: relative; cursor: pointer; flex-shrink: 0; background: var(--slate-200); border: none; padding: 0; }
.toggle.on { background: var(--emerald-500); }
.toggle .knob { width: 18px; height: 18px; background: #fff; border-radius: 9999px; position: absolute; top: 3px; left: 3px; box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: left 0.15s; }
.toggle.on .knob { left: 23px; }

.fab { position: fixed; right: 18px; bottom: 18px; width: 52px; height: 52px; border-radius: 9999px; background: var(--emerald); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; box-shadow: 0 8px 20px -4px rgba(5,150,105,0.5); cursor: pointer; border: none; }
.fab:hover { background: var(--emerald-dark); }

.cat-chip { flex: 1; text-align: center; border: 1px solid var(--slate-200); border-radius: 12px; padding: 8px 4px; cursor: pointer; }
.cat-chip.active { border: 1.5px solid var(--emerald-500); background: var(--emerald-50); }
.cat-chip .icon { font-size: 16px; }
.cat-chip .lbl { font-size: 11px; color: var(--slate-400); margin-top: 2px; }
.cat-chip.active .lbl { color: var(--emerald); font-weight: 700; }

.header-row { display: flex; justify-content: space-between; align-items: center; }
.muted { color: var(--slate-500); }
.muted-2 { color: var(--slate-400); }

.checkbox-terms { width: 18px; height: 18px; border-radius: 6px; background: var(--surface); border: 1.5px solid var(--slate-300); color: transparent; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; cursor: pointer; margin-top: 1px; }
.checkbox-terms.checked { background: var(--emerald); border-color: var(--emerald); color: #fff; }

.divider { display: flex; align-items: center; gap: 10px; }
.divider .line { flex: 1; height: 1px; background: var(--slate-200); }
.divider span { font-size: 11px; color: var(--slate-400); }

.plan-chip { flex: 1; border-radius: 12px; padding: 10px 12px; }
.plan-chip.free { border: 1.5px solid var(--emerald-500); background: var(--emerald-50); }
.plan-chip.pro { border: 1.5px solid var(--violet-200); opacity: 0.7; }

/* Ícones em PNG (pasta /assets/icons) — traço preto sobre fundo transparente */
.icon-img { display: inline-block; vertical-align: middle; object-fit: contain; }
.icon-img-invert { filter: var(--icon-invert); } /* usar quando o ícone fica sobre --surface (adapta ao tema) */
.icon-img-white { filter: brightness(0) invert(1); } /* usar quando o ícone fica sobre um fundo colorido sólido (ex: violeta) */

/* ---------- Acessibilidade / heurísticas de Nielsen ---------- */
:focus-visible { outline: 2px solid var(--emerald); outline-offset: 2px; }
.input:focus-visible { outline: none; }
.btn:disabled, .btn-sm:disabled { opacity: 0.6; cursor: not-allowed; }

/* Alvo de toque mínimo de 44px para ícones de ação (✕, ⋮, ⋯) */
.icon-btn { background: none; border: none; cursor: pointer; font-family: inherit; color: var(--slate-500); font-size: 18px; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; padding: 0; }
.icon-btn:hover { background: var(--slate-100); }
.icon-btn.sm { font-size: 15px; }

/* Estado de carregamento */
.spinner { width: 20px; height: 20px; border: 3px solid var(--slate-200); border-top-color: var(--emerald); border-radius: 9999px; display: inline-block; animation: spin 0.8s linear infinite; flex-shrink: 0; }
.carregando { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 36px 0; font-size: 13px; color: var(--slate-500); }

/* Toast (feedback de sucesso e "Desfazer") */
.toast { position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 10001; background: var(--slate-900); color: var(--surface); border-radius: 12px; padding: 11px 16px; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 14px; width: max-content; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgba(0,0,0,0.25); transition: opacity 0.15s, transform 0.15s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { background: none; border: none; color: var(--emerald-500); font-weight: 800; font-size: 13px; cursor: pointer; font-family: inherit; padding: 4px; min-height: 32px; }

/* Erro inline de campo */
.campo-erro { color: var(--red-500); font-size: 12px; margin-top: 4px; line-height: 1.35; }

/* Botão de ajuda contextual (ⓘ) */
.info-btn { width: 18px; height: 18px; border-radius: 9999px; border: 1.5px solid var(--slate-400); background: transparent; color: var(--slate-500); font-size: 11px; font-weight: 800; font-style: italic; font-family: Georgia, serif; line-height: 1; cursor: pointer; margin-left: 6px; vertical-align: middle; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.info-btn:hover { color: var(--emerald); border-color: var(--emerald); }

/* Dica dispensável (onboarding) e banner */
.dica { background: var(--emerald-50); border: 1px solid var(--emerald-500); border-radius: 16px; padding: 12px 14px; margin-bottom: 12px; }
.dica .dica-titulo { font-size: 13px; font-weight: 700; color: var(--emerald-900); margin-bottom: 4px; }
.dica ul { margin: 0 0 8px; padding-left: 18px; font-size: 12.5px; color: var(--emerald-900); line-height: 1.5; }
.dica button { background: none; border: none; color: var(--emerald); font-weight: 700; font-size: 12.5px; cursor: pointer; font-family: inherit; padding: 4px 0; }

/* Chips de "usadas recentemente" e ações rápidas */
.chip { flex-shrink: 0; border-radius: 9999px; padding: 6px 12px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; border: 1px solid var(--slate-200); background: var(--surface); color: var(--slate-600); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip:hover { border-color: var(--emerald-500); color: var(--emerald); }

.resumo-soma { font-size: 12px; font-weight: 600; margin-top: 6px; }
.resumo-soma.ok { color: var(--emerald); }
.resumo-soma.pendente { color: var(--amber-600); }
.resumo-soma.excedeu { color: var(--red-500); }

.menu-item.destrutivo { color: var(--red-500); }
.menu-item .menu-desc { display: block; font-size: 12px; font-weight: 400; color: var(--slate-500); margin-top: 2px; }

/* Ajuda / FAQ */
.faq-item { border: 1px solid var(--slate-200); border-radius: 14px; background: var(--surface); }
.faq-item summary { cursor: pointer; padding: 13px 14px; font-size: 13.5px; font-weight: 600; color: var(--slate-900); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; color: var(--slate-400); font-size: 18px; font-weight: 400; }
.faq-item[open] summary::after { content: '–'; }
.faq-item .faq-resposta { padding: 0 14px 14px; font-size: 13px; color: var(--slate-600); line-height: 1.6; }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
  .toast, .toggle .knob { transition: none; }
}
