/* Orça Mais — portal do vendedor */
:root {
  --bg: #0d0f14;
  --panel: #12151c;
  --panel-2: #171b24;
  --card: rgba(var(--fg-rgb), 0.03);
  --line: rgba(var(--fg-rgb), 0.08);
  --line-2: rgba(var(--fg-rgb), 0.14);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --faint: #64748b;
  --violet: #8b5cf6;
  --violet-2: #7c3aed;
  --violet-3: #a78bfa;
  --accent-rgb: 139, 92, 246;       /* cor de destaque em rgba() (roxo; o tema Moderno troca) */
  --primary-end: #6d28d9;
  --green: #4ade80;
  --red: #f87171;
  --amber: #fbbf24;
  --blue: #60a5fa;
  --chat-bg: #0b141a;
  --bubble-in: #1f2c34;
  --bubble-out: #3b2a6b;
  --fg-rgb: 255, 255, 255;
  --text-strong: #fff;
  --link-hover: #c4b5fd;
  --danger-text: #fecaca;
  --topbar-bg: rgba(13, 15, 20, 0.85);
  --chat-intro-bg: rgba(31, 44, 52, 0.85);
  --chat-soft: #d1d7db;
  --chat-faint: #aebac1;
  --quote-card-bg: rgba(0, 0, 0, 0.18);
  --composer-bg: #1f2c34;
  --composer-input: #2a3942;
  color-scheme: dark;
}

/* Tema soft: meio termo. Claro suave, fundo cinza areia, sem branco puro e com contraste menor. */
:root[data-theme="soft"] {
  --bg: #e7e4de;
  --panel: #f1efea;
  --panel-2: #e9e6e0;
  --text: #2d2a26;
  --muted: #625d55;
  --faint: #857f76;
  --violet-3: #6d4fc2;
  --green: #2f7d4f;
  --red: #b3413b;
  --amber: #9a6512;
  --blue: #3563a8;
  --chat-bg: #e3dfd6;
  --bubble-in: #f4f2ed;
  --bubble-out: #e3dcf3;
  --fg-rgb: 45, 42, 38;
  --text-strong: #1f1c19;
  --link-hover: #54399f;
  --danger-text: #a3342e;
  --topbar-bg: rgba(231, 228, 222, 0.92);
  --chat-intro-bg: rgba(244, 242, 237, 0.92);
  --chat-soft: #45413b;
  --chat-faint: #6d675e;
  --quote-card-bg: rgba(45, 42, 38, 0.05);
  --composer-bg: #ebe8e2;
  --composer-input: #f6f4f0;
  color-scheme: light;
}

/* Tema claro: data-theme="light" no <html> (definido por theme.js antes da pintura). */
:root[data-theme="light"] {
  --bg: #f5f6fa;
  --panel: #ffffff;
  --panel-2: #eef0f5;
  --text: #0f172a;
  --muted: #475569;
  --faint: #64748b;
  --violet-3: #6d28d9;
  --green: #15803d;
  --red: #dc2626;
  --amber: #b45309;
  --blue: #1d4ed8;
  --chat-bg: #efeae2;
  --bubble-in: #ffffff;
  --bubble-out: #e9e3fb;
  --fg-rgb: 15, 23, 42;
  --text-strong: #0f172a;
  --link-hover: #5b21b6;
  --danger-text: #b91c1c;
  --topbar-bg: rgba(245, 246, 250, 0.88);
  --chat-intro-bg: rgba(255, 255, 255, 0.92);
  --chat-soft: #334155;
  --chat-faint: #64748b;
  --quote-card-bg: rgba(15, 23, 42, 0.05);
  --composer-bg: #f0f2f5;
  --composer-input: #ffffff;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 15px; line-height: 1.5;
}
a { color: var(--violet-3); text-decoration: none; }
a:hover { color: var(--link-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.muted { color: var(--muted); }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(ellipse at top right, rgba(var(--accent-rgb), 0.14), transparent 55%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 32px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4); }
.login-card .brand { margin-bottom: 24px; }
.login-card h1 { font-size: 1.3rem; margin: 0 0 4px; }
.login-card p { margin: 0 0 22px; color: var(--muted); font-size: 0.92rem; }
.login-card form { display: grid; gap: 14px; }
.login-foot { margin-top: 18px; font-size: 0.85rem; color: var(--muted); text-align: center; }

/* ---------------------------------------------------------------- layout */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 14px;
  display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); }
.brand img { width: 30px; height: 30px; }
.brand small { display: block; font-weight: 400; font-size: 0.68rem; color: var(--faint); }
.menu { display: grid; gap: 4px; }
.menu a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--muted); }
.menu a:hover { background: var(--card); color: var(--text); }
.menu a.active { background: rgba(var(--accent-rgb), 0.14); color: var(--text-strong); }
.menu .ico { width: 20px; text-align: center; }
.plan-box { margin-top: auto; padding: 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: 0.82rem; }
.plan-box strong { display: block; font-size: 0.9rem; }
.meter { height: 6px; border-radius: 999px; background: rgba(var(--fg-rgb), 0.08); margin: 8px 0 4px; overflow: hidden; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--violet-2), var(--violet-3)); }
.meter.full span { background: var(--red); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 28px;
  border-bottom: 1px solid var(--line); background: var(--topbar-bg); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(8px); }
.topbar h1 { font-size: 1.1rem; margin: 0; }
.topbar .who { color: var(--muted); font-size: 0.88rem; display: flex; align-items: center; gap: 10px; }
.btn.theme { font-weight: 500; }
.content { padding: 24px 28px 48px; max-width: 1180px; width: 100%; }

/* ---------------------------------------------------------------- elementos */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px;
  border-radius: 9px; border: 1px solid transparent; cursor: pointer; font-weight: 600; font-size: 0.9rem;
  background: rgba(var(--fg-rgb), 0.06); color: var(--text); transition: all 0.15s; white-space: nowrap; }
.btn:hover { background: rgba(var(--fg-rgb), 0.1); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--violet-2), var(--primary-end)); color: #fff; }
.btn.primary:hover:not(:disabled) { background: linear-gradient(135deg, var(--violet), var(--violet-2)); box-shadow: 0 0 18px rgba(var(--accent-rgb), 0.3); }
.btn.ghost { background: rgba(var(--accent-rgb), 0.1); border-color: rgba(var(--accent-rgb), 0.28); }
.btn.danger { background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.3); color: var(--danger-text); }
.btn.small { padding: 5px 10px; font-size: 0.8rem; font-weight: 500; }
.btn.icon { width: 42px; height: 42px; padding: 0; border-radius: 50%; font-size: 1.1rem; }

label.field { display: grid; gap: 6px; font-size: 0.85rem; color: var(--muted); }
label.field > span { font-weight: 500; }
.input, input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=tel], input[type=date], select, textarea {
  width: 100%; background: rgba(var(--fg-rgb), 0.05); border: 1px solid var(--line-2); border-radius: 9px;
  padding: 10px 12px; color: var(--text); outline: none; transition: border-color 0.15s; }
input:focus, select:focus, textarea:focus { border-color: rgba(var(--accent-rgb), 0.6); }
textarea { resize: vertical; min-height: 80px; }
input[type=color] { width: 56px; height: 40px; padding: 2px; border-radius: 8px; border: 1px solid var(--line-2); background: transparent; }
.hint { font-size: 0.78rem; color: var(--faint); }
.error-text { color: var(--red); font-size: 0.85rem; min-height: 1.2em; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; margin-bottom: 20px; }
.panel h2 { font-size: 1rem; margin: 0 0 4px; }
.panel > p.muted { margin: 0 0 16px; font-size: 0.88rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: 1 / -1; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type=search] { max-width: 320px; }
.toolbar select { max-width: 200px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
table.list { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.list th { text-align: left; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--faint); padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: rgba(var(--fg-rgb), 0.025); }
.num, table.list .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.74rem; font-weight: 600;
  background: rgba(var(--fg-rgb), 0.07); color: var(--muted); white-space: nowrap; }
.badge.generated { background: rgba(96, 165, 250, 0.14); color: var(--blue); }
.badge.sent { background: rgba(var(--accent-rgb), 0.16); color: var(--violet-3); }
.badge.approved { background: rgba(74, 222, 128, 0.14); color: var(--green); }
.badge.rejected, .badge.failed { background: rgba(248, 113, 113, 0.13); color: var(--red); }
.badge.processing { background: rgba(251, 191, 36, 0.13); color: var(--amber); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.stat small { color: var(--muted); font-size: 0.8rem; }
.stat strong { display: block; font-size: 1.4rem; margin-top: 4px; font-variant-numeric: tabular-nums; }

.back { display: inline-flex; gap: 6px; margin-bottom: 14px; font-size: 0.88rem; }
details.raw summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; }
details.raw pre { white-space: pre-wrap; background: var(--panel-2); padding: 12px; border-radius: 8px; font-size: 0.82rem; color: var(--muted); }

.logo-preview { width: 160px; height: 80px; border: 1px dashed var(--line-2); border-radius: 10px;
  display: grid; place-items: center; background: #fff; overflow: hidden; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-preview.none { background: var(--card); color: var(--faint); font-size: 0.8rem; }

/* ---------------------------------------------------------------- chat */
.chat { display: flex; flex-direction: column; height: calc(100vh - 62px); background: var(--chat-bg); }
.chat-scroll { flex: 1; overflow-y: auto; padding: 20px max(16px, calc((100% - 820px) / 2)); display: flex; flex-direction: column; gap: 10px;
  background-image: radial-gradient(rgba(var(--fg-rgb), 0.025) 1px, transparent 1px); background-size: 18px 18px; }
.chat-intro { align-self: center; max-width: 520px; text-align: center; background: var(--chat-intro-bg);
  border-radius: 12px; padding: 14px 18px; color: var(--chat-soft); font-size: 0.88rem; margin-bottom: 8px; }
.msg { max-width: min(78%, 560px); padding: 8px 12px 6px; border-radius: 10px; font-size: 0.92rem; line-height: 1.45;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.25); white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--bubble-out); border-top-right-radius: 3px; }
.msg.assistant { align-self: flex-start; background: var(--bubble-in); border-top-left-radius: 3px; }
.msg.error { border-left: 3px solid var(--amber); }
.msg time { display: block; text-align: right; font-size: 0.68rem; color: rgba(var(--fg-rgb), 0.45); margin-top: 3px; }
.msg .attach { display: flex; align-items: center; gap: 8px; font-size: 0.86rem; color: var(--chat-soft); }
.msg .attach + .text { margin-top: 6px; }
.quote-card { display: flex; gap: 12px; align-items: center; background: var(--quote-card-bg); border-radius: 8px; padding: 10px; margin-bottom: 6px; }
.pdf-ico { flex-shrink: 0; width: 40px; height: 46px; border-radius: 6px; background: #e11d48; color: #fff;
  font: 700 0.72rem 'JetBrains Mono', monospace; display: grid; place-items: center; }
.quote-card strong { display: block; font-size: 0.9rem; }
.quote-card small { color: var(--chat-faint); font-size: 0.8rem; }
.msg .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.typing { color: var(--chat-faint); font-style: italic; }
.typing::after { content: '…'; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: 0.2; } }

.composer { border-top: 1px solid var(--line); background: var(--composer-bg); padding: 10px max(12px, calc((100% - 820px) / 2)); }
.composer .file-chip { display: inline-flex; align-items: center; gap: 8px; background: rgba(var(--fg-rgb), 0.08);
  border-radius: 8px; padding: 5px 10px; font-size: 0.82rem; margin-bottom: 8px; }
.composer .file-chip button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1rem; }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { min-height: 42px; max-height: 160px; resize: none; border-radius: 21px; padding: 10px 16px;
  background: var(--composer-input); border-color: transparent; }
.composer .btn.icon { flex-shrink: 0; }
.rec { background: var(--red) !important; color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(248, 113, 113, 0.25); } }

/* ---------------------------------------------------------------- ícones e tema */
.icon { flex-shrink: 0; vertical-align: middle; }
.menu .ico { display: inline-flex; width: 20px; justify-content: center; }
.btn.icon .icon { width: 20px; height: 20px; }
.theme-switch { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--card);
  border: 1px solid var(--line); }
.theme-switch button { border: 0; background: transparent; color: var(--muted); font-size: 0.78rem; font-weight: 500;
  padding: 5px 10px; border-radius: 7px; cursor: pointer; }
.theme-switch button:hover { color: var(--text); }
.theme-switch button[aria-pressed="true"] { background: var(--panel-2); color: var(--text-strong); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); }
.side .theme-switch { align-self: stretch; display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; }
.side .theme-switch button { padding: 5px 7px; font-size: 0.74rem; }
.login .theme-switch { position: fixed; left: 16px; bottom: 16px; }
.link-back { display: inline-block; margin-bottom: 14px; font-size: 0.88rem; }

/* ---------------------------------------------------------------- toast */
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 50;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); font-size: 0.9rem; max-width: calc(100% - 32px); }
#toast.err { border-color: rgba(248, 113, 113, 0.5); }

/* ---------------------------------------------------------------- responsivo */
/* Celular (até 860 px): topo fixo enxuto, barra de navegação fixa embaixo (Chat, Orçamentos, Clientes, Regras, Mais),
   tabelas em cartões, campos com 16 px (o iPhone não dá zoom sozinho) e botões do tamanho do dedo. */
.bnav, .top-logo, .top-guide { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding-top: 52px; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 30; padding: 10px 16px; height: 52px; justify-content: flex-start; gap: 10px; }
  .topbar .who { display: none; }
  .top-logo { display: block; width: 26px; height: 26px; flex-shrink: 0; }
  .topbar h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-guide { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; padding: 7px 12px; min-height: 36px; border-radius: 999px;
    border: 1px solid rgba(var(--accent-rgb), 0.45); background: rgba(var(--accent-rgb), 0.12); color: var(--text-strong);
    font-size: 0.82rem; font-weight: 600; cursor: pointer; flex-shrink: 0; }
  .top-guide .ico svg { width: 16px; height: 16px; }
  .content { padding: 14px 14px 32px; }
  .grid-2, .grid-3, .stats { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .chat { height: calc(100vh - 52px - 64px); height: calc(100dvh - 52px - 64px - env(safe-area-inset-bottom)); }
  .msg { max-width: 88%; }
  input, select, textarea, .composer textarea { font-size: 16px; }
  .btn { min-height: 42px; }
  .btn.small { min-height: 38px; padding: 8px 12px; }
  .btn.icon { width: 44px; height: 44px; min-height: 44px; }
  .seg button { padding: 8px 12px; }

  .bnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--panel); border-top: 1px solid var(--line-2); padding: 4px 4px env(safe-area-inset-bottom);
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.12); }
  .bnav a, .bnav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px;
    border: 0; background: transparent; color: var(--muted); font-size: 0.7rem; font-weight: 500; border-radius: 10px; cursor: pointer; padding: 4px 2px; }
  .bnav .ico { display: inline-flex; }
  .bnav .ico svg { width: 22px; height: 22px; }
  .bnav a.active, .bnav button.active { color: var(--violet-3); background: rgba(var(--accent-rgb), 0.12); font-weight: 600; }
  body.typing .bnav { display: none; }
  body.typing .main { padding-bottom: 0; }
  body.typing .chat { height: calc(100vh - 52px); height: calc(100dvh - 52px); }

  /* Tabelas viram cartões: cada linha um cartão, cada célula "Coluna: valor" (data-label posto pelo app.js) */
  .table-wrap { border: 0; background: transparent; overflow: visible; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list thead { display: none; }
  table.list tr { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; }
  table.list td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); text-align: right; }
  table.list tr td:last-child { border-bottom: 0; }
  table.list td::before { content: attr(data-label); flex-shrink: 0; max-width: 45%; text-align: left; font-size: 0.72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em; color: var(--faint); }
  table.list td[data-label=""]::before { display: none; }
  table.list td[data-label=""] { justify-content: flex-end; }
  table.list td.empty { justify-content: center; text-align: center; }
  table.list tr.click:hover td { background: transparent; }
  table.edit-items td { display: grid; text-align: left; justify-content: stretch; }
  table.edit-items td::before { max-width: none; }
  table.edit-items .w-qty, table.edit-items .w-unit, table.edit-items .w-price, table.edit-items .w-total, table.edit-items .w-del { width: 100%; }
}

/* Painel "Mais" do celular */
.more-sheet-wrap { position: fixed; inset: 0; z-index: 66; background: rgba(0, 0, 0, 0.45); display: flex; align-items: flex-end; }
.more-sheet { width: 100%; background: var(--panel); border-radius: 18px 18px 0 0; padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  display: grid; gap: 12px; box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3); max-height: 85vh; overflow-y: auto; }
.more-guide { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; border-radius: 14px; cursor: pointer; text-align: left;
  border: 1px solid rgba(var(--accent-rgb), 0.45); background: rgba(var(--accent-rgb), 0.12); color: var(--text); }
.more-guide .ico svg { width: 22px; height: 22px; }
.more-guide-text { flex: 1; display: grid; gap: 2px; }
.more-guide-text strong { font-size: 0.98rem; color: var(--text-strong); }
.more-guide-text small { font-size: 0.8rem; color: var(--muted); }
.more-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.more-grid a, .more-grid button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 78px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); font-size: 0.82rem; font-weight: 500; cursor: pointer; }
.more-grid .ico svg { width: 22px; height: 22px; }
.more-sheet .plan-box { display: block; margin: 0; }
.more-sheet .theme-switch { display: grid; grid-template-columns: repeat(4, 1fr); }
.more-sheet .theme-switch button { padding: 9px 4px; font-size: 0.85rem; }
.more-exit { width: 100%; }

/* ---------------------------------------------------------------- formulários em coluna */
.stack { display: grid; gap: 14px; }
.panel.narrow { max-width: 520px; }

/* ---------------------------------------------------------------- orçamentos: edição, histórico, janelas */
.row.nowrap { flex-wrap: nowrap; }
.totals { margin-top: 12px; gap: 22px; }
.total-big { font-size: 1.2rem; }
h2.section { font-size: 1rem; margin: 20px 0 10px; }
table.edit-items td { vertical-align: top; }
table.edit-items input { padding: 7px 9px; }
table.edit-items .sub-input { margin-top: 6px; font-size: 0.82rem; }
.w-qty { width: 90px; } .w-unit { width: 80px; } .w-price { width: 130px; } .w-total { width: 120px; padding-top: 18px !important; } .w-del { width: 48px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 0.9rem; }
.timeline li { padding-left: 14px; border-left: 2px solid var(--line-2); }
.pdf-ico.off { background: var(--faint); }
.btn.danger-solid { background: var(--red); color: #fff; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; padding: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35); }
.modal h2 { font-size: 1.05rem; margin: 0 0 8px; }
.modal p { margin: 0 0 18px; }
@media (max-width: 860px) {
  table.edit-items thead { display: none; }
  table.edit-items tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); }
  table.edit-items td { border: 0; padding: 0; width: auto; }
  table.edit-items td:first-child { grid-column: 1 / -1; }
}
label.field { align-content: start; }
td.nowrap, .nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- modelos de PDF */
.templates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.template-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel-2); display: flex; flex-direction: column; }
.template-card.selected { border-color: var(--violet); box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.25); }
.template-thumb { display: block; background: #fff; aspect-ratio: 794 / 700; overflow: hidden; border-bottom: 1px solid var(--line); }
.template-thumb img { width: 100%; display: block; }
.template-info { padding: 12px 14px 14px; display: grid; gap: 6px; }
.template-info strong { display: flex; align-items: center; gap: 8px; }
.template-info p { margin: 0; font-size: 0.85rem; }
@media (max-width: 860px) { .templates { grid-template-columns: 1fr; } }
.msg.draft { max-width: min(88%, 620px); }
.msg.draft .actions { margin-top: 10px; }
.msg .missing { color: var(--amber); font-weight: 600; }

/* ---------------------------------------------------------------- plano */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
.plan-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: var(--panel-2); display: grid; gap: 6px; align-content: start; }
.plan-card.current { border-color: var(--violet); box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.2); }
.plan-card strong { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.plan-card p { margin: 0; font-size: 0.85rem; }
.plan-price { font-size: 1.3rem; font-weight: 700; }
.plan-price small { font-size: 0.8rem; font-weight: 400; color: var(--muted); }
.plan-usage { display: grid; gap: 6px; max-width: 420px; font-size: 0.9rem; margin-top: 6px; }
.plan-alert { padding: 10px 12px; border-radius: 10px; background: rgba(251, 191, 36, 0.1); border: 1px solid rgba(251, 191, 36, 0.35);
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
@media (max-width: 860px) { .plans { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- situação do orçamento */
.steps { list-style: none; margin: 4px 0 14px; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.steps li { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; font-size: 0.86rem;
  background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.steps .step-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 0.75rem; font-weight: 700;
  background: rgba(var(--fg-rgb), 0.08); color: var(--muted); }
.steps li.done { color: var(--text); }
.steps li.done .step-dot { background: var(--violet); color: #fff; }
.steps li.current { color: var(--text-strong); border-color: var(--violet); font-weight: 600; }
.steps li.current .step-dot { background: var(--violet); color: #fff; }
.steps li.approved { border-color: var(--green); } .steps li.approved .step-dot { background: var(--green); }
.steps li.rejected { border-color: var(--red); } .steps li.rejected .step-dot { background: var(--red); }
.btn.success { background: rgba(74, 222, 128, 0.14); border-color: rgba(74, 222, 128, 0.4); color: var(--green); }
.btn.success:hover { background: rgba(74, 222, 128, 0.22); }
tr.current-version td { background: rgba(var(--accent-rgb), 0.06); }

/* ---------------------------------------------------------------- listas de opções (select)
   A lista aberta é desenhada pelo navegador: sem cor explícita, alguns pintam fundo branco com o
   texto claro do tema (quase invisível). Aqui o fundo e o texto seguem o tema. */
select { color: var(--text); background-color: var(--panel); }
select option, select optgroup { background-color: var(--panel); color: var(--text); }
select option:checked { background-color: var(--violet-2); color: #fff; }
select option:disabled { color: var(--faint); }
select:focus { background-color: var(--panel); }

/* Painel (métricas) */
.stats.four { grid-template-columns: repeat(4, 1fr); }
.stat .delta { display: block; font-size: 0.76rem; color: var(--muted); margin-top: 4px; }
.stat .delta.up { color: var(--green); }
.stat .delta.down { color: var(--red); }
.dash-filters input[type=date] { max-width: 170px; }
.dash-filters select { max-width: 200px; }
.chart-wrap { position: relative; }
svg.bars { width: 100%; height: auto; display: block; }
svg.bars .grid { stroke: var(--line); stroke-width: 1; }
svg.bars .axis { fill: var(--muted); font-size: 11px; }
svg.bars .bar { fill: var(--violet); }
svg.bars .bar.on { fill: var(--violet-3, var(--violet)); }
svg.bars .hit { fill: transparent; cursor: default; }
.chart-tip { position: absolute; top: 0; transform: translateX(-50%); pointer-events: none; background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 10px; padding: 8px 10px; font-size: 0.8rem; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25); white-space: nowrap; z-index: 2; }
.chart-tip strong { display: block; margin-bottom: 2px; }
.status-bars { display: grid; gap: 10px; }
.sb-row { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 10px; font-size: 0.86rem; }
.sb-track { height: 8px; border-radius: 4px; background: rgba(var(--fg-rgb), 0.06); overflow: hidden; }
.sb-track span { display: block; height: 100%; background: var(--violet); border-radius: 4px; }
.sb-val { color: var(--muted); white-space: nowrap; }
table.list.compact td, table.list.compact th { padding-top: 7px; padding-bottom: 7px; }
.export-row input[type=date] { max-width: 170px; }
.export-row select { max-width: 260px; }

/* Integrações */
label.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.stack-sm { display: grid; gap: 6px; }
code.secret { padding: 4px 8px; border-radius: 6px; background: rgba(var(--fg-rgb), 0.05); border: 1px solid var(--line-2); user-select: all; word-break: break-all; }
tr.row-muted td { opacity: 0.55; }
/* Texto longo numa linha só, cortado com "..." no limite (o botão Copiar ao lado copia o valor inteiro) */
code.clip { flex: 0 1 auto; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-break: normal; user-select: all; }
.row.nowrap > .btn { flex: 0 0 auto; }
.api-new input[type="text"] { flex: 1 1 220px; min-width: 0; }
.badge.expired { background: rgba(var(--fg-rgb), 0.08); color: var(--muted); }
.ok-text { color: var(--green); }
input[type=url] { width: 100%; background: rgba(var(--fg-rgb), 0.05); border: 1px solid var(--line-2); border-radius: 9px;
  padding: 10px 12px; color: var(--text); outline: none; }
@media (max-width: 860px) { .stats.four { grid-template-columns: 1fr 1fr; } .sb-row { grid-template-columns: 84px 1fr; } .sb-val { grid-column: 2; } }
/* Integrações: e-mails em cópia e headers */
.cc-box { display: grid; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 10px; border-radius: 999px; font-size: 0.84rem;
  background: rgba(var(--accent-rgb), 0.12); border: 1px solid rgba(var(--accent-rgb), 0.3); }
.chip-x { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 1rem; line-height: 1; width: 20px; height: 20px;
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.chip-x:hover { background: rgba(var(--fg-rgb), 0.1); }
.cc-box .row input { flex: 1; }
.header-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
@media (max-width: 560px) { .header-pair { grid-template-columns: 1fr; } }

/* Avaliação do orçamento (chat e página do orçamento) */
.rating-box { margin-top: 8px; }
.rating-form { display: grid; gap: 8px; }
.rating-form textarea { width: 100%; }
.stars { display: inline-flex; gap: 2px; }
.star { background: none; border: 0; cursor: pointer; font-size: 1.6rem; line-height: 1; padding: 2px; color: var(--faint); opacity: 0.55; }
.star.on { color: var(--amber); opacity: 1; }
.star:focus-visible { outline: 2px solid var(--violet-3); border-radius: 4px; }
.stars-static { color: var(--amber); letter-spacing: 1px; font-size: 1.05rem; }
.rating-done { gap: 8px; align-items: center; flex-wrap: wrap; }
/* Chamados de suporte */
.thread { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding: 14px; border-radius: 12px;
  background: rgba(var(--fg-rgb), 0.025); border: 1px solid var(--line); }
/* Estilo WhatsApp: as suas à direita (cor de destaque), as da outra parte à esquerda, eventos no meio */
.tmsg { max-width: min(78%, 620px); padding: 8px 12px 6px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--panel-2); }
.tmsg.theirs { align-self: flex-start; border-top-left-radius: 4px; }
.tmsg.mine { align-self: flex-end; border-top-right-radius: 4px; background: rgba(var(--accent-rgb), 0.16); border-color: rgba(var(--accent-rgb), 0.35); }
.tmsg-head { font-size: 0.8rem; margin-bottom: 3px; }
.tmsg.theirs .tmsg-head strong { color: var(--blue); }
.tmsg.mine .tmsg-head strong { color: var(--violet-3); }
.tmsg-body { white-space: pre-wrap; word-break: break-word; }
.tmsg-time { font-size: 0.72rem; color: var(--muted); text-align: right; margin-top: 4px; }
.tmsg .attach-list { margin-top: 6px; }
.tmsg-event { align-self: center; text-align: center; font-size: 0.78rem; color: var(--muted); }
.tmsg-event span { display: inline-block; padding: 3px 10px; border-radius: 999px; background: rgba(var(--fg-rgb), 0.06); }
@media (max-width: 640px) { .tmsg { max-width: 92%; } }
.attach-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.attach-list:empty { display: none; }
a.chip { color: inherit; text-decoration: none; padding-right: 10px; }
a.chip:hover { background: rgba(var(--accent-rgb), 0.2); }
.attach-picker { display: grid; gap: 6px; }
.badge.ticket-warn { background: rgba(251, 191, 36, 0.13); color: var(--amber); }
.badge.ticket-ok { background: rgba(96, 165, 250, 0.14); color: var(--blue); }
.badge.ticket-done { background: rgba(74, 222, 128, 0.14); color: var(--green); }
.badge.ticket-off { background: rgba(var(--fg-rgb), 0.08); color: var(--muted); }
.dist { display: grid; gap: 4px; }
.dist-row { display: grid; grid-template-columns: 96px 1fr 40px; gap: 8px; align-items: center; font-size: 0.85rem; }
.dist-bar { height: 8px; border-radius: 4px; background: rgba(var(--fg-rgb), 0.08); overflow: hidden; }
.dist-bar > span { display: block; height: 100%; background: var(--amber); }
/* Listas grandes: busca + páginas (assets/ui.js pager); campo de busca com sugestões */
.paged .toolbar input[type=search] { max-width: 340px; flex: 1 1 220px; }
.toolbar > .hint { align-self: center; white-space: nowrap; }
.table-wrap.loading { opacity: 0.6; transition: opacity 0.15s; }
.pager { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; font-size: 0.85rem; color: var(--muted); }
.pager-size { display: inline-flex; align-items: center; gap: 8px; }
.pager-size select { width: auto; padding: 5px 28px 5px 10px; font-size: 0.85rem; }
.pager-info { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pager-nav { display: inline-flex; align-items: center; gap: 4px; }
.pager-pages { display: inline-flex; align-items: center; gap: 4px; }
.pager-btn { min-width: 32px; height: 32px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text); cursor: pointer;
  font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.pager-btn:hover:not(:disabled) { background: rgba(var(--fg-rgb), 0.06); }
.pager-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pager-btn.current { background: var(--violet-2); border-color: var(--violet-2); color: #fff; font-weight: 600; cursor: default; }
.pager-gap { padding: 0 2px; color: var(--faint); }
.btn.icon-only { padding: 5px 7px; }
.modal-list { margin: -8px 0 16px; padding-left: 20px; display: grid; gap: 6px; font-size: 0.9rem; color: var(--muted); }
.modal .field { margin-bottom: 16px; }
@media (max-width: 560px) { .pager { justify-content: center; } .pager > .spacer { display: none; } }
.picker { position: relative; display: inline-flex; align-items: center; min-width: 240px; max-width: 360px; flex: 1 1 240px; }
.picker input { width: 100%; }
.picker-chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 8px 8px 12px; border-radius: 9px; width: 100%;
  background: rgba(var(--accent-rgb), 0.12); border: 1px solid rgba(var(--accent-rgb), 0.3); font-size: 0.9rem; justify-content: space-between; }
.picker-list { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30; margin: 0; padding: 4px; list-style: none;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); max-height: 320px; overflow: auto; }
.picker-list li { padding: 8px 10px; border-radius: 7px; cursor: pointer; display: grid; gap: 2px; }
.picker-list li small { color: var(--faint); font-size: 0.78rem; }
.picker-list li.active, .picker-list li:hover { background: rgba(var(--accent-rgb), 0.14); }
.picker-list li.none { color: var(--faint); cursor: default; }

/* ---------------------------------------------------------------- CPF ou CNPJ (assets/masks.js) */
.doc-row { display: flex; gap: 8px; }
.doc-row .doc-type { flex: 0 0 auto; width: auto; min-width: 84px; }
.doc-row .doc-number { flex: 1; min-width: 0; }

/* ---------------------------------------------------------------- Painel (abas e período) */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--muted); font-size: 0.84rem; font-weight: 500; padding: 6px 12px;
  border-radius: 7px; cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--panel-2); color: var(--text-strong); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); }
.seg-tabs button { font-size: 0.9rem; font-weight: 600; padding: 7px 14px; }
.dash-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.dash-when { display: grid; gap: 6px; justify-items: end; }
.dash-dates input[type=date] { max-width: 160px; padding: 6px 10px; }
.dash-period { font-variant-numeric: tabular-nums; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.dash-side .panel { margin-bottom: 20px; }
.dash-side .panel:last-child { margin-bottom: 0; }
.kpi .hint { display: block; margin-top: 6px; }
.follow { display: grid; gap: 2px; margin: 0 -8px 10px; }
.follow-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px; border-radius: 8px; color: var(--text); }
.follow-row:hover { background: rgba(var(--fg-rgb), 0.04); color: var(--text); }
.follow-main { display: grid; min-width: 0; }
.follow-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 0.9rem; }
@media (max-width: 960px) { .dash-grid { grid-template-columns: 1fr; } .dash-when { justify-items: start; } }

/* ================================================================ Tema Moderno
   Mesmo portal, outra cara: papel claro, grafite, verde-petróleo com laranja queimado nos destaques,
   IBM Plex Sans, cantos retos, linhas finas no lugar de sombras e sem gradientes. */
:root[data-theme="modern"] {   /* verdes como no Moderno original (29/09); pedido do Augusto em 12/10 */
  --bg: #c3cac2;            /* pedra: meio-tom, nem claro nem escuro */
  --panel: #eef1ec;
  --panel-2: #dce2da;
  --card: rgba(24, 32, 29, 0.04);
  --text: #18201d;
  --muted: #47524d;
  --faint: #66716b;
  --violet: #0f6e63;
  --violet-2: #0c5c53;
  --violet-3: #0f6e63;
  --accent-rgb: 15, 110, 99;
  --primary-end: #0c5c53;
  --orange: #d45d24;
  --ink: #18211e;           /* barra lateral e topo */
  --ink-2: #222d29;
  --ink-text: #cdd6d1;
  --green: #2f7a3f;
  --red: #b0342a;
  --amber: #945405;
  --blue: #2b5a86;
  --chat-bg: #d3d9d1;
  --bubble-in: #f4f6f2;
  --bubble-out: #d8ebe5;
  --fg-rgb: 24, 32, 29;
  --text-strong: #0f1513;
  --link-hover: #094a43;
  --danger-text: #9a2c23;
  --topbar-bg: #18211e;
  --chat-intro-bg: #eef1ec;
  --chat-soft: #33403a;
  --chat-faint: #5c6862;
  --quote-card-bg: rgba(24, 32, 29, 0.06);
  --composer-bg: #dce2da;
  --composer-input: #f7f8f5;
  color-scheme: light;
}
:root[data-theme="modern"] body { font-family: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; letter-spacing: 0; }
:root[data-theme="modern"] .mono,
:root[data-theme="modern"] code { font-family: 'IBM Plex Mono', ui-monospace, monospace; }
:root[data-theme="modern"] h1, :root[data-theme="modern"] h2 { font-weight: 600; letter-spacing: -0.01em; }
/* Superfícies: cantos quase retos, borda fina, nenhuma sombra */
:root[data-theme="modern"] .panel,
:root[data-theme="modern"] .stat,
:root[data-theme="modern"] .table-wrap,
:root[data-theme="modern"] .modal,
:root[data-theme="modern"] .login-card,
:root[data-theme="modern"] .plan-card,
:root[data-theme="modern"] .template-card,
:root[data-theme="modern"] .plan-box { border-radius: 4px; box-shadow: none; border-color: rgba(35, 34, 30, 0.14); }
:root[data-theme="modern"] .login { background: var(--bg); }
/* logo novo (11/10/2026) já é verde-petróleo: sem filtro de cor */
:root[data-theme="modern"] .topbar { backdrop-filter: none; border-bottom-color: rgba(35, 34, 30, 0.14); }
:root[data-theme="modern"] .side { background: var(--bg); border-right-color: rgba(35, 34, 30, 0.14); }
/* Menu: sem "pílula"; o item ativo ganha um traço laranja à esquerda */
:root[data-theme="modern"] .menu a { border-radius: 0; border-left: 3px solid transparent; padding-left: 11px; }
:root[data-theme="modern"] .menu a:hover { background: transparent; color: var(--text-strong); }
:root[data-theme="modern"] .menu a.active { background: transparent; border-left-color: var(--orange); color: var(--text-strong); font-weight: 600; }
/* Botões chapados */
:root[data-theme="modern"] .btn { border-radius: 4px; font-weight: 500; background: transparent; border-color: rgba(35, 34, 30, 0.22); }
:root[data-theme="modern"] .btn:hover { background: rgba(35, 34, 30, 0.05); }
:root[data-theme="modern"] .btn.primary { background: var(--violet); border-color: var(--violet); color: #fff; }
:root[data-theme="modern"] .btn.primary:hover:not(:disabled) { background: var(--violet-2); box-shadow: none; }
:root[data-theme="modern"] .btn.ghost { background: transparent; border-color: rgba(var(--accent-rgb), 0.45); color: var(--violet-2); }
:root[data-theme="modern"] .btn.danger { background: transparent; border-color: rgba(178, 58, 46, 0.45); }
:root[data-theme="modern"] .btn.icon { border-radius: 50%; }
:root[data-theme="modern"] input[type=text], :root[data-theme="modern"] input[type=email], :root[data-theme="modern"] input[type=password],
:root[data-theme="modern"] input[type=number], :root[data-theme="modern"] input[type=search], :root[data-theme="modern"] input[type=tel],
:root[data-theme="modern"] input[type=date], :root[data-theme="modern"] input[type=url], :root[data-theme="modern"] select,
:root[data-theme="modern"] textarea { border-radius: 4px; background: #fff; border-color: rgba(35, 34, 30, 0.2); }
:root[data-theme="modern"] input:focus, :root[data-theme="modern"] select:focus, :root[data-theme="modern"] textarea:focus {
  border-color: var(--violet); box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.15); }
:root[data-theme="modern"] .composer textarea { border-radius: 21px; }
/* Tabelas: cabeçalho em texto normal, linha de base mais forte */
:root[data-theme="modern"] table.list th { text-transform: none; letter-spacing: 0; font-size: 0.8rem; color: var(--muted);
  border-bottom: 1px solid rgba(35, 34, 30, 0.3); background: var(--panel-2); }
:root[data-theme="modern"] table.list td { font-variant-numeric: tabular-nums; }
:root[data-theme="modern"] table.list tr.click:hover td { background: rgba(var(--accent-rgb), 0.05); }
/* Números grandes: mais peso e alinhados */
:root[data-theme="modern"] .stat small { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.7rem; font-weight: 600; color: var(--muted); }
:root[data-theme="modern"] .stat strong { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; }
:root[data-theme="modern"] .badge { border-radius: 3px; font-weight: 600; letter-spacing: 0.01em; }
:root[data-theme="modern"] .meter { border-radius: 0; height: 5px; }
:root[data-theme="modern"] .meter span { background: var(--violet); }
:root[data-theme="modern"] .meter.full span { background: var(--red); }
/* Seletores (tema, período, abas): sublinhado em vez de caixinha */
:root[data-theme="modern"] .theme-switch,
:root[data-theme="modern"] .seg { border-radius: 4px; background: transparent; border-color: rgba(35, 34, 30, 0.18); }
:root[data-theme="modern"] .theme-switch button,
:root[data-theme="modern"] .seg button { border-radius: 2px; }
:root[data-theme="modern"] .theme-switch button[aria-pressed="true"],
:root[data-theme="modern"] .seg button[aria-pressed="true"] { background: var(--text-strong); color: var(--bg); box-shadow: none; }
:root[data-theme="modern"] .seg-tabs { border: 0; border-bottom: 1px solid rgba(35, 34, 30, 0.18); border-radius: 0; padding: 0; gap: 0; }
:root[data-theme="modern"] .seg-tabs button { border-radius: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 8px 14px; }
:root[data-theme="modern"] .seg-tabs button[aria-pressed="true"] { background: transparent; color: var(--text-strong); border-bottom-color: var(--orange); }
/* Paginação */
:root[data-theme="modern"] .pager-btn { border-radius: 3px; background: transparent; }
:root[data-theme="modern"] .pager-btn.current { background: var(--text-strong); border-color: var(--text-strong); color: var(--bg); }
/* Gráfico e etapas */
:root[data-theme="modern"] svg.bars .bar { fill: var(--violet); }
:root[data-theme="modern"] svg.bars .bar.on { fill: var(--orange); }
:root[data-theme="modern"] .sb-track, :root[data-theme="modern"] .dist-bar { border-radius: 0; }
:root[data-theme="modern"] .sb-track span { border-radius: 0; }
:root[data-theme="modern"] .steps li { border-radius: 3px; }
:root[data-theme="modern"] .chip, :root[data-theme="modern"] .picker-chip { border-radius: 3px; }
:root[data-theme="modern"] .msg { box-shadow: none; border: 1px solid rgba(35, 34, 30, 0.08); }
:root[data-theme="modern"] .chat-scroll { background-image: none; }
:root[data-theme="modern"] .tmsg { border-radius: 6px; }
:root[data-theme="modern"] #toast { border-radius: 4px; box-shadow: none; background: var(--text-strong); color: var(--bg); border-color: var(--text-strong); }
:root[data-theme="modern"] .modal-overlay { background: rgba(35, 34, 30, 0.35); }
:root[data-theme="modern"] .template-card.selected, :root[data-theme="modern"] .plan-card.current { box-shadow: none; border: 2px solid var(--violet); }
:root[data-theme="modern"] tr.current-version td { background: rgba(var(--accent-rgb), 0.06); }
/* Celular: números grandes não cabem em 2 colunas */
.stats > .stat { min-width: 0; }
@media (max-width: 560px) { .stats.four { grid-template-columns: 1fr; } }

/* Moderno, parte 2 (29/09): duas cores. Barra lateral e topo em grafite, conteúdo em pedra com cartões claros. */
:root[data-theme="modern"] .side { background: var(--ink); border-right-color: var(--ink); color: var(--ink-text); }
:root[data-theme="modern"] .side .brand { color: #fff; }
:root[data-theme="modern"] .side .brand small { color: #8f9c95; }
:root[data-theme="modern"] .menu a { color: var(--ink-text); }
:root[data-theme="modern"] .menu a:hover { color: #fff; background: rgba(255, 255, 255, 0.04); }
:root[data-theme="modern"] .menu a.active { color: #fff; background: rgba(255, 255, 255, 0.07); border-left-color: var(--orange); }
:root[data-theme="modern"] .side .plan-box { background: var(--ink-2); border-color: rgba(255, 255, 255, 0.08); color: var(--ink-text); }
:root[data-theme="modern"] .side .plan-box strong { color: #fff; }
:root[data-theme="modern"] .side .meter { background: rgba(255, 255, 255, 0.12); }
:root[data-theme="modern"] .side .meter span { background: var(--orange); }
:root[data-theme="modern"] .side .theme-switch { border-color: rgba(255, 255, 255, 0.14); }
:root[data-theme="modern"] .side .theme-switch button { color: #9fada6; }
:root[data-theme="modern"] .side .theme-switch button:hover { color: #fff; }
:root[data-theme="modern"] .side .theme-switch button[aria-pressed="true"] { background: var(--orange); color: #fff; }
:root[data-theme="modern"] .topbar { background: var(--ink); border-bottom-color: var(--ink); }
:root[data-theme="modern"] .topbar h1 { color: #fff; }
:root[data-theme="modern"] .topbar .who { color: var(--ink-text); }
:root[data-theme="modern"] .topbar .btn { color: #fff; border-color: rgba(255, 255, 255, 0.25); background: transparent; }
:root[data-theme="modern"] .topbar .btn:hover { background: rgba(255, 255, 255, 0.08); }
:root[data-theme="modern"] .login { background: var(--ink); }
:root[data-theme="modern"] .login .theme-switch { border-color: rgba(255, 255, 255, 0.14); }
:root[data-theme="modern"] .login .theme-switch button { color: #9fada6; }
:root[data-theme="modern"] .login .theme-switch button[aria-pressed="true"] { background: var(--orange); color: #fff; }
/* Cartões claros sobre a pedra, com uma linha de cor no topo dos números */
:root[data-theme="modern"] .panel, :root[data-theme="modern"] .stat, :root[data-theme="modern"] .table-wrap { border-color: rgba(24, 32, 29, 0.16); }
:root[data-theme="modern"] .stat.kpi { border-top: 3px solid var(--violet); }
:root[data-theme="modern"] .stats .stat.kpi:first-child { border-top-color: var(--orange); }
:root[data-theme="modern"] .btn { border-color: rgba(24, 32, 29, 0.28); }
:root[data-theme="modern"] .pager-btn { background: var(--panel); }
/* Botões com fundo próprio: a regra geral de botão transparente não pode apagar (o "Excluir" ficava branco no branco) */
:root[data-theme="modern"] .btn.danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
:root[data-theme="modern"] .btn.danger-solid:hover:not(:disabled) { background: #922a21; }
:root[data-theme="modern"] .btn.danger-solid:disabled { background: var(--red); opacity: 0.45; }
:root[data-theme="modern"] .btn.success { background: rgba(42, 114, 57, 0.12); border-color: rgba(42, 114, 57, 0.45); color: var(--green); }
:root[data-theme="modern"] .btn.primary.confirm { background: var(--red); border-color: var(--red); }
:root[data-theme="modern"] .rec { background: var(--red) !important; color: #fff; }
:root[data-theme="modern"] .side .plan-box :not(strong) { color: #a9b6af; }

/* ---------------------------------------------------------------- guia do portal (tour.js) */
.guide-btn { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; border: 1px dashed var(--line-2);
  background: transparent; color: var(--muted); cursor: pointer; text-align: left; margin-top: auto; }
.guide-btn:hover, .guide-btn[aria-expanded="true"] { background: var(--card); color: var(--text); border-style: solid; }
.guide-btn .ico { display: inline-flex; width: 20px; justify-content: center; }
.guide-btn + .plan-box { margin-top: 0; }
.tour-layer { position: fixed; inset: 0; z-index: 70; }
.tour-shade { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); }
.tour-dim { position: fixed; background: rgba(0, 0, 0, 0.55); }
.tour-spot { position: fixed; border-radius: 12px; box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.95), 0 0 0 7px rgba(255, 255, 255, 0.25);
  cursor: pointer; }
.tour-card { position: fixed; width: min(340px, calc(100vw - 24px)); background: var(--panel); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 14px; padding: 16px 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35); outline: none; }
.tour-card.center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.tour-card h2 { font-size: 1.05rem; margin: 2px 0 6px; color: var(--text-strong); }
.tour-card p { margin: 0 0 14px; color: var(--muted); font-size: 0.92rem; line-height: 1.5; }
.tour-head { display: flex; align-items: center; justify-content: space-between; }
.tour-count { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--violet-3); }
.tour-x { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 8px; display: inline-flex; }
.tour-x:hover { color: var(--text); background: var(--card); }
.tour-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tour-gap { flex: 1; }
.guide-menu { position: fixed; z-index: 67; background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; padding: 6px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3); display: grid; gap: 2px; max-height: 70vh; overflow-y: auto; }
.guide-menu button { border: 0; background: transparent; color: var(--text); text-align: left; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 0.9rem; }
.guide-menu button:hover, .guide-menu button:focus-visible { background: rgba(var(--accent-rgb), 0.12); outline: none; }
.guide-menu .guide-full { font-weight: 600; color: var(--violet-3); }
.guide-menu .guide-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--faint); padding: 8px 12px 2px; }
:root[data-theme="modern"] .side .guide-btn { color: var(--ink-text); border-color: rgba(205, 214, 209, 0.25); }
:root[data-theme="modern"] .side .guide-btn:hover { background: var(--ink-2); color: #fff; }
@media (max-width: 860px) {
  .guide-btn { margin-top: 0; padding: 7px 10px; }
  .guide-btn .label { display: none; }
  /* Celular: o balão vira um painel fixo embaixo, com a largura toda e botões grandes */
  .tour-card.sheet, .tour-card.sheet.center { top: auto; left: 0; right: 0; bottom: 0; transform: none; width: 100%;
    border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
  .tour-card.sheet .tour-actions .btn { padding: 10px 14px; font-size: 0.9rem; }
  .tour-card.sheet.at-top { top: calc(56px + env(safe-area-inset-top)); bottom: auto; border-radius: 16px; left: 8px; right: 8px; width: auto; padding-bottom: 16px; }
  .tour-card.sheet.above-nav { bottom: calc(80px + env(safe-area-inset-bottom)); border-radius: 16px; left: 8px; right: 8px; width: auto; }
  .guide-menu.sheet { left: 0; right: 0; bottom: 0; border-radius: 16px 16px 0 0; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); }
  .guide-menu.sheet button { padding: 12px 14px; font-size: 0.95rem; }
}

:root[data-theme="modern"] .bnav { background: var(--ink); border-top-color: var(--ink); }
:root[data-theme="modern"] .bnav a, :root[data-theme="modern"] .bnav button { color: var(--ink-text); }
:root[data-theme="modern"] .bnav a.active, :root[data-theme="modern"] .bnav button.active { color: #fff; background: var(--ink-2); box-shadow: inset 0 -2px 0 var(--orange); }
:root[data-theme="modern"] .topbar .top-logo { filter: none; }

:root[data-theme="modern"] .topbar .top-guide { color: #fff; border-color: rgba(212, 93, 36, 0.7); background: rgba(212, 93, 36, 0.18); }
.coupon-input { max-width: 190px; }
.plan-box a { display: block; margin-top: 4px; }

/* Complete seu perfil (23/10/2026) */
.setup-card .setup-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.setup-bar { flex: 1; min-width: 120px; max-width: 260px; height: 8px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.setup-bar span { display: block; height: 100%; background: var(--accent, #2a9d8f); }
.setup-card p { margin: 0 0 12px; }
.guide-btn.setup-link { margin-top: 8px; display: block; font-size: 0.8rem; line-height: 1.35; text-decoration: none; }
.setup-link .muted { opacity: 0.85; }

/* Menu lateral em tela baixa (25/10/2026, Augusto: "lá embaixo no plano e temas quebrou"): com Guia, Perfil, Plano e Temas o menu
   passava da altura da tela (notebook 720 px) e os temas ficavam cortados. Agora rola por dentro e compacta em tela baixa. */
.side { overflow-y: auto; scrollbar-width: none; }
.side::-webkit-scrollbar { display: none; }
.side > * { flex-shrink: 0; }
.guide-btn.setup-link { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-height: 820px) {
  .side { gap: 10px; padding-top: 12px; padding-bottom: 12px; }
  .side .plan-box { padding: 8px 10px; }
  .guide-btn.setup-link { margin-top: 0; }
}
@media (max-height: 700px) {
  .side .plan-box { display: none; }
}
