:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e5e9f2;
  --primary: #4f46e5;
  --primary-2: #6366f1;
  --primary-soft: #eef0ff;
  --ok: #059669;
  --ok-soft: #e7f8f1;
  --warn: #d97706;
  --warn-soft: #fff6e6;
  --bad: #dc2626;
  --bad-soft: #fdeeee;
  --side: #0f172a;
  --side-2: #1e293b;
  --side-text: #cbd5e1;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
  --wa: #25d366;
  /* cores de apoio (mudam no modo escuro) */
  --input: #ffffff;
  --soft: #f1f5f9;
  --th: #fafbfd;
  --hover: #f5f7ff;
  --label: #334155;
  --line-strong: #cbd5e1;
}
/* ---------- cor de cada seção ----------
   O app.js coloca data-sec="vendas" (etc.) no <html>. Cada seção troca a cor principal
   (--primary) de botões, abas, cartões em destaque e da faixa do topo. */
[data-sec=vendas]       { --primary: #16a34a; --primary-2: #22c55e; --primary-soft: #e8f8ee; --primary-dark: #15803d; --accent-2: #0d9488; }
[data-sec=relatorios]   { --primary: #7c3aed; --primary-2: #8b5cf6; --primary-soft: #f3efff; --primary-dark: #6d28d9; --accent-2: #a855f7; }
[data-sec=os]           { --primary: #0f766e; --primary-2: #14b8a6; --primary-soft: #e6f6f4; --primary-dark: #115e59; --accent-2: #0d9488; }
[data-sec=nf]           { --primary: #0284c7; --primary-2: #0ea5e9; --primary-soft: #e6f4fb; --primary-dark: #0369a1; --accent-2: #0891b2; }
[data-sec=estoque]      { --primary: #ea580c; --primary-2: #f97316; --primary-soft: #fff1e8; --primary-dark: #c2410c; --accent-2: #d97706; }
[data-sec=clientes]     { --primary: #2563eb; --primary-2: #3b82f6; --primary-soft: #eaf1fe; --primary-dark: #1d4ed8; --accent-2: #4f46e5; }
[data-sec=fornecedores] { --primary: #9333ea; --primary-2: #a855f7; --primary-soft: #f4ebfe; --primary-dark: #7e22ce; --accent-2: #c026d3; }
[data-sec=caixa]        { --primary: #b45309; --primary-2: #d97706; --primary-soft: #fdf3e2; --primary-dark: #92400e; --accent-2: #ca8a04; }
/* Ferramentas usa a mesma cor de Configurações (pedido do dono, v0.6.59) */
[data-sec=ferramentas],
[data-sec=config]       { --primary: #475569; --primary-2: #64748b; --primary-soft: #eef1f5; --primary-dark: #334155; --accent-2: #475569; }
/* cor fixa do ícone de cada seção no menu lateral (para reconhecer de longe) */
#nav a[data-sec=inicio] svg { color: #818cf8; }
#nav a[data-sec=vendas] svg { color: #4ade80; }
#nav a[data-sec=os] svg { color: #2dd4bf; }
#nav a[data-sec=nf] svg { color: #38bdf8; }
#nav a[data-sec=estoque] svg { color: #fb923c; }
#nav a[data-sec=clientes] svg { color: #60a5fa; }
#nav a[data-sec=fornecedores] svg { color: #c084fc; }
#nav a[data-sec=caixa] svg { color: #fbbf24; }
#nav a[data-sec=config] svg, #nav a[data-sec=ferramentas] svg { color: #94a3b8; }
#nav a.active svg { color: #fff !important; }
.sec-icon { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); margin-right: 10px; vertical-align: middle; }
.sec-icon svg { width: 17px; height: 17px; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--primary); }
.app { display: flex; min-height: 100vh; }

/* ---------- sidebar ---------- */
.sidebar { width: 236px; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; z-index: 30; }
.brand { display: flex; gap: 10px; align-items: center; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand strong { color: #fff; font-size: 16px; display: block; }
.brand small { color: #94a3b8; font-size: 12px; }
.logo { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), #8b5cf6); color: #fff; display: grid; place-items: center; font-weight: 700; }
#nav { padding: 12px 10px; flex: 1; overflow: auto; }
#nav .group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #64748b; padding: 14px 10px 6px; }
#nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 9px; color: var(--side-text); text-decoration: none; font-weight: 500; margin-bottom: 2px; transition: background .15s; }
#nav a svg { width: 18px; height: 18px; opacity: .8; }
#nav a:hover { background: var(--side-2); color: #fff; }
#nav a.active { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .3); }
#nav a.active svg { opacity: 1; }
.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.06); font-size: 12px; }
.sidebar-foot .app-version { margin-top: 8px; text-align: center; font-size: 11px; color: #94a3b8; }
.sidebar-foot .pill { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 9px; background: var(--side-2); color: #e2e8f0; text-decoration: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #64748b; }
.dot.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }

/* ---------- topbar ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--card); border-bottom: 1px solid var(--line); border-top: 4px solid var(--primary); padding: 0 28px; display: flex; align-items: center; gap: 24px; position: sticky; top: 0; z-index: 20; min-height: 64px; flex-wrap: wrap; }
.top-title h1 { font-size: 18px; margin: 0; font-weight: 700; display: flex; align-items: center; }
.tabs { display: flex; gap: 4px; align-self: stretch; overflow-x: auto; }
.tabs a { display: flex; align-items: center; padding: 0 14px; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.menu-btn { display: none; }
.content { padding: 24px 28px 60px; max-width: 1400px; width: 100%; }

/* ---------- componentes ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 20px; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.stat { padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 6px; letter-spacing: -.01em; }
.stat .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat.accent { background: linear-gradient(135deg, var(--primary), var(--accent-2, #7c3aed)); color: #fff; border: 0; }
.stat.accent .label, .stat.accent .sub { color: rgba(255,255,255,.8); }
.stat.accent .neg, .stat.accent .pos { color: #fff; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 8px 14px; border-radius: 9px; font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; transition: all .15s; text-decoration: none; }
.btn:hover { border-color: var(--line-strong); background: var(--soft); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark, #4338ca); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: #fecaca; }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.wa:hover { background: #1ebe5b; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { border: 0; background: transparent; font-size: 20px; cursor: pointer; padding: 6px; }

input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; background: var(--input); width: 100%; outline: none; transition: border .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(99, 102, 241, .15); }
textarea { resize: vertical; min-height: 70px; }
input[type=checkbox], input[type=radio] { width: auto; }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--label); margin-bottom: 5px; }
.field { margin-bottom: 12px; min-width: 0; }
.field small { color: var(--muted); font-size: 11.5px; font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 0 12px; }
.c2 { grid-column: span 2; } .c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c5 { grid-column: span 5; }
.c6 { grid-column: span 6; } .c7 { grid-column: span 7; } .c8 { grid-column: span 8; } .c9 { grid-column: span 9; } .c12 { grid-column: span 12; }
.input-group { display: flex; gap: 6px; }
.input-group input { flex: 1; }
.search { max-width: 280px; }
.seg { display: inline-flex; background: var(--soft); border-radius: 9px; padding: 3px; }
.seg label { margin: 0; padding: 6px 14px; border-radius: 7px; cursor: pointer; font-weight: 500; color: var(--muted); }
.seg input { display: none; }
.seg input:checked + span { color: var(--primary); }
.seg label:has(input:checked) { background: var(--card); color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin: 8px 0 10px; grid-column: span 12; border-top: 1px solid var(--line); padding-top: 14px; }

/* tabelas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--th); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--hover); }
td.num, th.num { text-align: right; white-space: nowrap; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn { margin-left: 4px; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.pos { color: var(--ok); } .neg { color: var(--bad); }
tfoot td { font-weight: 700; background: var(--th); }

.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; background: var(--soft); color: var(--label); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--primary-soft); color: var(--primary); }

.alert { padding: 12px 16px; border-radius: 10px; background: var(--primary-soft); color: #3730a3; margin-bottom: 16px; font-size: 13px; line-height: 1.5; }
.alert.warn { background: var(--warn-soft); color: #92400e; }

/* modal */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: flex-start; justify-content: center; z-index: 100; padding: 40px 16px; overflow-y: auto; animation: fade .15s; backdrop-filter: blur(2px); }
.modal { background: var(--card); border-radius: 16px; width: 100%; max-width: 560px; box-shadow: 0 24px 60px rgba(0,0,0,.25); animation: pop .18s; }
.modal.lg { max-width: 820px; } .modal.xl { max-width: 1100px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--th); border-radius: 0 0 16px 16px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }

/* editor de documentos */
.items-table input, .items-table select { padding: 6px 8px; }
.items-table td { padding: 6px 8px; }
.totals { display: grid; gap: 6px; justify-content: end; text-align: right; }
.totals .row { display: flex; gap: 16px; justify-content: space-between; min-width: 260px; }
.totals .grand { font-size: 20px; font-weight: 700; color: var(--primary); border-top: 1px solid var(--line); padding-top: 8px; }
.pay-row { display: grid; grid-template-columns: 1fr 140px 90px 160px 36px; gap: 8px; align-items: center; margin-bottom: 8px; }
.fee-hint { font-size: 12px; color: var(--muted); }

/* whatsapp */
.wa-preview { background: #e5ddd5; border-radius: 12px; padding: 16px; max-height: 420px; overflow: auto; }
.wa-bubble { background: #dcf8c6; border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; font-family: inherit; font-size: 14px; line-height: 1.45; box-shadow: 0 1px 1px rgba(0,0,0,.1); max-width: 520px; margin-left: auto; }
.wa-bubble b { font-weight: 700; }
/* a prévia do WhatsApp imita o app (balão claro): letra sempre escura, inclusive no modo escuro */
.wa-preview, .wa-bubble { color: #111b21; }
.money-in { gap: 0; align-items: center; justify-content: flex-end; }
.money-in .pre { padding: 0 4px 0 0; }

/* barras */
.bar { height: 8px; background: var(--soft); border-radius: 8px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent-2, #8b5cf6)); border-radius: 8px; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 110px; }
.spark i { flex: 1; background: linear-gradient(180deg, var(--primary-2), #a5b4fc); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.spark i:hover { background: var(--primary); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }

/* toasts */
#toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 200; }
.toast { background: #0f172a; color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: 380px; animation: pop .2s; font-weight: 500; border-left: 4px solid #22c55e; }
.toast.err { border-left-color: #ef4444; }

/* responsivo */
@media (max-width: 1000px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .g3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; left: -260px; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .menu-btn { display: block; }
  .topbar { padding: 10px 16px 0; gap: 8px; }
  .tabs { width: 100%; height: 44px; }
  .content { padding: 16px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .form-grid > * { grid-column: span 12 !important; }
  .pay-row { grid-template-columns: 1fr 1fr; }
  .search { max-width: none; }
}

/* ---------- fotos de produto (v0.2) ---------- */
.thumb { display: inline-grid; place-items: center; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--soft); vertical-align: middle; }
.thumb.empty { color: #cbd5e1; }
.thumb.empty svg { width: 45%; height: 45%; }
.photo-field { display: flex; gap: 16px; align-items: center; }
.photo-box { width: 110px; height: 110px; flex-shrink: 0; border: 2px dashed var(--line); border-radius: 12px; display: grid; place-items: center; overflow: hidden; background: var(--soft); }
.photo-box img { width: 100%; height: 100%; object-fit: cover; }
.wa-photos { display: flex; gap: 12px; flex-wrap: wrap; }
.wa-photo { width: 190px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: grid; gap: 6px; }
.wa-photo img { width: 100%; height: 140px; object-fit: cover; border-radius: 8px; }

/* ---------- contador de cédulas e moedas ---------- */
.coin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.coin-title { font-weight: 600; margin-bottom: 6px; }
.coin { display: grid; grid-template-columns: 90px 80px 1fr; gap: 8px; align-items: center; padding: 3px 0; }
.coin span { font-weight: 600; padding: 4px 8px; border-radius: 6px; text-align: center; }
.coin.nota span { background: #ecfdf5; color: #047857; }
.coin.moeda span { background: #fef3c7; color: #92400e; }
.coin input { padding: 5px 8px; text-align: center; }
.coin b { text-align: right; font-size: 12.5px; color: var(--muted); }
.coin-total { margin-top: 10px; padding: 10px 14px; border-radius: 10px; background: var(--primary-soft); text-align: right; font-size: 15px; }
.coin-total b { color: var(--primary); font-size: 18px; }

/* ---------- conciliador: lançamento conferido fica riscado ---------- */
tr.conc-ok td { text-decoration: line-through; text-decoration-color: var(--ok); text-decoration-thickness: 2px; color: var(--muted); background: var(--ok-soft); }
tr.conc-ok td .badge, tr.conc-ok td.actions { text-decoration: none; }
tr.conc-anim td { animation: concflash .6s; }
@keyframes concflash { from { background: #bbf7d0; } }
code { background: var(--soft); padding: 1px 5px; border-radius: 5px; font-size: 12px; word-break: break-all; }
@media (max-width: 760px) { .coin-grid { grid-template-columns: 1fr; } .photo-field { flex-direction: column; align-items: flex-start; } }


/* =====================================================================
   MODO ESCURO (botão 🌙 no topo). O app.js coloca data-theme="dark" no <html>.
   ===================================================================== */
html[data-theme=dark] {
  color-scheme: dark;
  --bg: #0b1120; --card: #131c2e; --text: #e5e7eb; --muted: #94a3b8; --line: #26324a; --line-strong: #3a4a6b;
  --input: #0f172a; --soft: #1c2740; --th: #162036; --hover: #1a2540; --label: #cbd5e1;
  --primary-soft: color-mix(in srgb, var(--primary) 20%, transparent);
  --ok-soft: #0e2e22; --warn-soft: #36270b; --bad-soft: #3a1515;
  --ok: #34d399; --bad: #f87171; --warn: #fbbf24;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  --side: #070b16; --side-2: #172036;
}
html[data-theme=dark] .alert { color: var(--text); }
html[data-theme=dark] .coin.nota span { background: #0e2e22; color: #6ee7b7; }
html[data-theme=dark] .coin.moeda span { background: #36270b; color: #fcd34d; }
html[data-theme=dark] .toast { background: #1e293b; }
html[data-theme=dark] img.thumb { background: #fff; }

/* =====================================================================
   v0.3 — destaque de valores, código sequencial, seleção e compartilhar
   ===================================================================== */
.seq { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.big-total { font-size: 34px; font-weight: 800; color: var(--primary); letter-spacing: -.02em; }
.hl { background: var(--warn-soft); color: var(--warn); padding: 2px 8px; border-radius: 6px; font-weight: 700; }
.gh-btn { margin-left: auto; border: 1px solid var(--line); background: var(--card); color: inherit; border-radius: 10px; height: 38px; padding: 0 12px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.gh-btn:disabled { opacity: .6; cursor: wait; }
/* bolinha laranja com o número de alterações ainda não enviadas */
.gh-count { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 10px; background: #f59e0b; color: #fff; font-size: 12px; margin-left: 4px; }
.gh-count:empty { display: none; }
.gh-btn + .theme-btn { margin-left: 8px; }
/* no celular mostra só a nuvem e o número */
@media (max-width: 700px) { .gh-btn { padding: 0 8px; } .gh-txt { display: none; } }
.theme-btn { margin-left: auto; font-size: 18px; border: 1px solid var(--line); background: var(--card); border-radius: 10px; width: 38px; height: 38px; cursor: pointer; }
.brand img.logo-img { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; background: #fff; padding: 2px; }
/* barra de seleção que aparece sobre a tabela quando marca linhas */
.sel-bar { display: none; align-items: center; gap: 10px; padding: 10px 14px; background: var(--primary-soft); border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; font-weight: 600; }
.sel-bar.on { display: flex; }
.sel-bar .grow { flex: 1; }
td.selc, th.selc { width: 34px; padding-right: 0; }
tr.is-sel td { background: var(--primary-soft) !important; }
/* venda cancelada: riscada em vermelho */
tr.canceled td { text-decoration: line-through; text-decoration-color: var(--bad); text-decoration-thickness: 2px; color: var(--bad); }
tr.canceled td.actions, tr.canceled td.selc { text-decoration: none; }
/* filtros em "pílulas" */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 20px; padding: 6px 14px; font: inherit; font-weight: 600; cursor: pointer; font-size: 13px; }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.danger.on { background: var(--bad); border-color: var(--bad); }

/* =====================================================================
   TELA DE VENDA (estilo caixa, tela cheia)
   ===================================================================== */
.pos-overlay { position: fixed; inset: 0; z-index: 90; background: var(--bg); animation: fade .12s; }
.pdv { display: flex; flex-direction: column; height: 100%; }
.pos-top { display: flex; align-items: center; gap: 16px; padding: 12px 20px; background: var(--card); border-bottom: 4px solid var(--primary); }
.pos-title { font-size: 20px; font-weight: 800; }
.pos-keys { flex: 1; color: var(--muted); font-size: 12.5px; text-align: right; }
kbd { background: var(--soft); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; font-size: 11.5px; font-family: inherit; font-weight: 700; color: var(--text); }
.pos-body { flex: 1; display: grid; grid-template-columns: 1fr 380px; gap: 16px; padding: 16px 20px; min-height: 0; }
.pos-left { display: flex; flex-direction: column; min-height: 0; gap: 12px; }
.pos-search { position: relative; }
.pos-search input { font-size: 19px; padding: 14px 18px; border: 2px solid var(--primary); border-radius: 12px; }
.pos-results { position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; right: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.18); max-height: 420px; overflow: auto; padding: 6px; }
.pos-res { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 9px; cursor: pointer; color: var(--text); font: inherit; }
.pos-res:hover, .pos-res.on { background: var(--primary-soft); }
.pos-res .grow { flex: 1; }
.pos-price { font-size: 16px; color: var(--primary); }
.pos-items { flex: 1; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.pos-table td { padding: 8px 10px; }
.pos-table input { padding: 6px 8px; }
.qty { display: inline-flex; align-items: center; gap: 4px; }
.qty input { width: 64px; text-align: center; }
.qty button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--soft); color: var(--text); font-size: 17px; font-weight: 700; cursor: pointer; }
.pos-empty { height: 100%; min-height: 220px; display: grid; place-items: center; text-align: center; color: var(--muted); }
.pos-empty svg { width: 54px; height: 54px; opacity: .35; }
.pos-right { display: flex; flex-direction: column; gap: 10px; overflow: auto; }
.pos-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; text-align: left; color: var(--text); font: inherit; }
button.pos-card { cursor: pointer; } button.pos-card:hover { border-color: var(--primary); }
.pos-client b { font-size: 16px; }
.pos-notes { justify-content: center; padding: 11px; }
.input-group .pre { display: grid; place-items: center; padding: 0 8px; font-weight: 700; color: var(--muted); }
.pos-sum { background: var(--card); border: 2px solid var(--primary); border-radius: 14px; padding: 14px 16px; }
.pos-sum .row { display: flex; justify-content: space-between; padding: 3px 0; }
.pos-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 8px; }
.pos-total span { font-weight: 800; color: var(--muted); }
.pos-total b { font-size: 38px; font-weight: 900; color: var(--primary); letter-spacing: -.02em; }
.pos-finish { justify-content: center; font-size: 19px; font-weight: 800; padding: 16px; border-radius: 14px; }
.pos-finish small { opacity: .75; font-size: 12px; margin-left: 6px; }

/* janela de pagamento */
.pay-grid { display: grid; grid-template-columns: 1fr 320px; gap: 18px; }
.pay-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pay-tile { border: 2px solid var(--line); background: var(--card); color: var(--text); border-radius: 12px; padding: 12px; text-align: left; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 3px; }
.pay-tile:hover { border-color: var(--primary); background: var(--primary-soft); }
.pay-tile span { font-size: 11.5px; color: var(--muted); }
.pay-row2 { display: grid; grid-template-columns: 1.1fr 130px 150px 1.4fr 36px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pay-side { background: var(--soft); border-radius: 14px; padding: 16px; }
.pay-sum .row { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.pay-sum .change { font-size: 20px; color: var(--ok); border: 0; margin-top: 6px; }
.pay-fiscal { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
label.check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin: 6px 0; cursor: pointer; color: var(--text); }
.sub-box { margin: 0 0 6px 26px; display: grid; gap: 6px; }
/* lista de escolha (clientes) */
.pick-list { max-height: 420px; overflow: auto; display: grid; gap: 4px; }
.pick-item { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; text-align: left; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px; padding: 10px 12px; cursor: pointer; font: inherit; }
.pick-item:hover { border-color: var(--primary); background: var(--primary-soft); }
/* depois da venda */
.after-sale { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.after-actions { display: grid; gap: 8px; }
.btn.big { justify-content: center; font-size: 16px; padding: 13px; }
.change-box { margin-top: 8px; font-size: 22px; background: var(--ok-soft); color: var(--ok); border-radius: 10px; padding: 8px 12px; display: inline-block; }
@media (max-width: 900px) {
  .pos-body, .pay-grid, .after-sale { grid-template-columns: 1fr; }
  .pos-keys { display: none; }
  .pay-row2 { grid-template-columns: 1fr 1fr; }
}

/* Ordem de serviço: estado clicável e escolha de estado */
.st-btn { border: 0; cursor: pointer; font: inherit; font-size: 11.5px; font-weight: 700; }
.st-btn:hover { filter: brightness(.95); outline: 2px solid var(--line-strong); }
.st-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.st-opt { border: 2px solid var(--line); background: var(--card); color: var(--text); border-radius: 12px; padding: 12px; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 3px; text-align: left; }
.st-opt:hover { border-color: var(--primary); }
.st-opt.on { border-color: var(--primary); background: var(--primary-soft); }

/* produtos: categorias na lateral e escolha de colunas */
.with-side { display: flex; gap: 14px; align-items: flex-start; }
.with-side .grow { flex: 1; min-width: 0; }
.cat-side { width: 210px; flex-shrink: 0; padding: 10px; position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow: auto; }
.cat-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 4px 8px 8px; }
.cat { display: flex; justify-content: space-between; width: 100%; border: 0; background: none; color: var(--text); font: inherit; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left; }
.cat span { color: var(--muted); font-size: 12px; }
.cat:hover { background: var(--soft); }
.cat.on { background: var(--primary); color: #fff; }
.cat.on span { color: rgba(255,255,255,.85); }
.col-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px 12px; }
/* etiquetas */
.sel-line { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.sel-line .grow { flex: 1; }
.label-prev { border: 1px dashed var(--line-strong); background: #fff; color: #000; border-radius: 4px; overflow: hidden; }
.label-prev .lbl { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 4px; font-family: Arial, sans-serif; }
.label-prev .lbl-name { font-size: 10px; text-align: center; font-weight: 600; line-height: 1.1; }
.label-prev .lbl-price { font-size: 17px; font-weight: 900; }
.label-prev .lbl-bar { width: 100%; height: 45%; object-fit: contain; }
@media (max-width: 760px) { .with-side { flex-direction: column; } .cat-side { width: 100%; position: static; } .col-grid { grid-template-columns: 1fr 1fr; } }
/* celular: a lista ocupa a largura da tela e a tabela rola de lado dentro dela
   (antes a tabela "esticava" a página inteira e as janelas ficavam maiores que a tela) */
@media (max-width: 760px) { .with-side { align-items: stretch; } .with-side .grow { width: 100%; } }

/* conciliação: barra com a soma dos selecionados */
.conc-bar { position: sticky; top: 70px; z-index: 5; display: flex; flex-wrap: wrap; gap: 18px; align-items: center; background: var(--primary-soft); border: 1px solid var(--primary); border-radius: 12px; padding: 10px 16px; margin-bottom: 12px; }
.conc-bar .big-sel { font-size: 20px; color: var(--primary); }

/* configurações */
.logo-box { width: 140px; height: 100px; }
.logo-box img { object-fit: contain !important; background: #fff; }
.cert-ok { background: var(--ok-soft); border-radius: 10px; padding: 10px 12px; line-height: 1.6; font-size: 13px; }
.inst-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.inst-grid div { display: flex; align-items: center; gap: 4px; }
.inst-grid span { font-weight: 700; min-width: 28px; }
.maq-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.maq { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ===== PEDIDO (ENCOMENDA) — v0.4 ===== */
/* campo "PRAZO PARA ENTREGA" na janela de entrada */
.order-days { background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.order-days label { display: block; font-weight: 700; margin-bottom: 6px; }
.order-days .input-group { max-width: 200px; }
.order-days input { font-size: 18px; text-align: right; }
/* linha "FALTA PAGAR" em destaque */
.pay-sum .row.falta, .order-box .falta { color: #b45309; }
.pay-sum .row.falta b { font-size: 20px; }
/* quadro do pedido lançado: Total · Recebido hoje · Falta pagar · Entrega */
.order-box { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.order-box > div { border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; background: var(--card); }
.order-box span { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; }
.order-box b { font-size: 20px; }
.order-box small { display: block; color: var(--muted); }
@media (max-width: 700px) { .order-box { grid-template-columns: 1fr 1fr; } }
/* lista de opções (rádio) uma embaixo da outra */
.radio-list { display: grid; gap: 8px; }

/* WhatsApp: mensagens separadas (chave PIX e copia e cola), cada uma num balão */
.wa-extras { display: grid; gap: 10px; }
.wa-extra .wa-preview { padding: 8px; }
.wa-extra .toolbar { margin-top: 6px; align-items: center; }
.wa-mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; }

/* ORIGEM CLICÁVEL: linhas que mostram "de onde veio" ao clicar */
tr.has-origin { cursor: pointer; }
tr.has-origin:hover td { background: color-mix(in srgb, var(--accent, #4f46e5) 8%, transparent); }
.origin-t { font-size: 18px; font-weight: 800; }
/* cartões de total que abrem a lista do que forma o número */
.stat.clickable { cursor: pointer; }
.stat.clickable:hover { outline: 2px solid color-mix(in srgb, var(--accent, #4f46e5) 40%, transparent); }

/* ---------- v0.5: LOGIN ---------- */
/* o que está marcado como escondido (hidden) fica escondido mesmo que tenha outro estilo */
[hidden] { display: none !important; }
/* botão com o nome do usuário (topo, ao lado do modo escuro) */
.user-btn { margin-left: 8px; border: 1px solid var(--line); background: var(--card); color: inherit; border-radius: 10px; height: 38px; padding: 0 12px; cursor: pointer; font-weight: 600; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 700px) { .user-btn { padding: 0 8px; max-width: 110px; } }
/* tela de entrar: cartão no meio da tela */
.login-screen { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); padding: 16px; overflow: auto; z-index: 50; }
.login-card { width: min(400px, 100%); }
.login-card h2 { margin: 6px 0 12px; font-size: 20px; }
.login-card .field { margin-bottom: 12px; }
.login-card .login-go { width: 100%; justify-content: center; padding: 11px; font-size: 15px; margin: 4px 0 12px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.login-brand .logo { width: 40px; height: 40px; border-radius: 10px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 800; }
.login-brand strong { display: block; font-size: 17px; }
.login-brand small { color: var(--muted); }

/* ---------- v0.5: RECONHECER PRODUTO PELA FOTO ---------- */
.rec-fotos { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 4px; }
.rec-foto { position: relative; width: 150px; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; background: var(--soft); }
.rec-foto.main { border-color: var(--primary); }
.rec-foto img { width: 100%; height: 110px; object-fit: cover; display: block; }
.rec-foto span { display: block; padding: 4px 6px; }
.rec-x { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; }
.rec-tab td { vertical-align: top; }
.rec-tab input:not([type=checkbox]), .rec-tab textarea { width: 100%; }
@media (max-width: 700px) { .rec-foto { width: calc(50% - 5px); } }

/* ---------- v0.6: EXPORTAR (topo), RELATÓRIOS, PAINEL e DANFE ---------- */
.exp-wrap { margin-left: auto; position: relative; }
.exp-wrap ~ .gh-btn, .exp-wrap ~ .theme-btn { margin-left: 8px; }
.exp-btn { border: 1px solid var(--line); background: var(--card); color: inherit; border-radius: 10px; height: 38px; padding: 0 12px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.exp-menu { position: absolute; right: 0; top: 44px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); display: grid; min-width: 180px; z-index: 30; overflow: hidden; }
.exp-menu button { border: 0; background: none; color: inherit; text-align: left; padding: 10px 14px; cursor: pointer; font: inherit; }
.exp-menu button:hover { background: var(--hover); }
@media (max-width: 700px) { .exp-btn { padding: 0 8px; } .exp-txt { display: none; } }
/* barra de período dos relatórios */
.rel-filtro { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.rel-filtro input[type=date] { width: 150px; }
/* números pequenos do gráfico do painel */
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.mini-stats .mini { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.mini-stats small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
.mini-stats b { display: block; font-size: 20px; margin: 2px 0; }
.mini-stats span { font-size: 12px; color: var(--muted); }
@media (max-width: 760px) { .mini-stats { grid-template-columns: 1fr 1fr; } }
.top-list { margin: 0; padding: 0; list-style: none; }
.top-list li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
/* prévia do DANFE na janela: a folha A4 encolhe para caber */
.dn-view { background: #e5e7eb; padding: 12px; border-radius: 10px; overflow: auto; max-height: 72vh; }
.dn-view .dn-page { box-shadow: 0 2px 10px rgba(0,0,0,.2); }
@media (max-width: 900px) { .dn-view .dn-page { zoom: .62; } }

/* Cadastro de produtos (v0.6.10): categorias em faixa no topo (sem coluna lateral) e coluna de ações sempre visível */
.cat-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cat-bar .cat { width: auto; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.cat-bar .cat.on { border-color: var(--primary); }
.prod-list th.actions, .prod-list td.actions { position: sticky; right: 0; background: var(--card); box-shadow: -6px 0 6px -6px rgba(0,0,0,.18); }
.prod-list td { padding-top: 6px; padding-bottom: 6px; }
.cat-bar .cat.on { background: var(--primary); color: #fff; }
.cat-bar .cat.on span { color: rgba(255,255,255,.85); }
.prod-list th, .prod-list td { padding-left: 8px; padding-right: 8px; }
.prod-list th.selc, .prod-list td.selc { padding-left: 10px; padding-right: 4px; width: 1%; }
.prod-list .thumb { width: 36px; height: 36px; overflow: hidden; flex: none; }
.prod-list .thumb.empty { display: inline-flex; align-items: center; justify-content: center; }
.prod-list .thumb.empty svg { width: 18px; height: 18px; }
/* a classe "empty" das listas vazias (padding grande) estava deixando a miniatura sem foto gigante */
.thumb.empty { padding: 0; box-sizing: border-box; }
/* v0.6.11: com o botão Editar de volta, botões e células da lista de produtos ficam mais compactos para não rolar */
.prod-list td.actions .btn { padding: 5px 9px; margin-left: 3px; }
.prod-list th, .prod-list td { padding-left: 6px; padding-right: 6px; }
.prod-list td.actions { white-space: nowrap; }

/* Notas Fiscais (v0.6.15): botões de ação fixos na ponta direita da linha; os botões quebram em mais de uma linha
   (em vez de alargar a tabela) e as células ficam mais compactas, para a lista não rolar para o lado */
.nf-list th, .nf-list td { padding-left: 6px; padding-right: 6px; }
.nf-list th.actions, .nf-list td.actions { position: sticky; right: 0; background: var(--card); box-shadow: -6px 0 6px -6px rgba(0,0,0,.18); white-space: normal; min-width: 120px; max-width: 230px; }
.nf-list td.actions .btn { margin: 2px 0 2px 4px; }
.nf-list th.actions, .nf-list td.actions { max-width: 175px; }
.nf-list td { vertical-align: middle; }
@media (max-width: 760px) { .nf-list th.actions, .nf-list td.actions { max-width: 112px; min-width: 96px; } .nf-list td.actions .btn { padding: 4px 6px; font-size: 12px; } }
.nf-list td.actions .btn { white-space: normal; text-align: center; line-height: 1.25; }
.nf-list td .badge { white-space: normal; }
.nf-list td:nth-child(5) { max-width: 150px; }

/* ===== CELULAR (v0.6.20) — SÓ até 760 px de largura; computador e tablet grande não mudam =====
   Botões, campos e seletores com pelo menos 44 px de altura (tamanho bom para o dedo), letra de 16 px
   nos campos (também evita o "zoom" automático do celular ao tocar) e mais espaço entre os botões.
   As listas continuam como tabelas que rolam de lado, como no computador. */
@media (max-width: 760px) {
  .btn, .btn.sm, .btn.big { min-height: 44px; padding-top: 10px; padding-bottom: 10px; font-size: 15px; }
  .btn.sm { padding-left: 12px; padding-right: 12px; }
  input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]), select { min-height: 44px; font-size: 16px; }
  textarea { min-height: 88px; font-size: 16px; }
  input[type=checkbox], input[type=radio] { width: 24px; height: 24px; flex: none; }
  .toolbar { gap: 10px; }
  td.actions .btn { margin-left: 8px; margin-top: 4px; margin-bottom: 4px; }
  .nf-list td.actions .btn { font-size: 14px; padding: 8px 10px; }
  .pos-res { min-height: 60px; }
  .pay-tile, .st-opt { min-height: 64px; }
  .pos-finish { min-height: 60px; }
  .modal-foot, .modal-footer { gap: 10px; }
}
@media (max-width: 760px) {
  .btn, .btn.sm, .btn.big, input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]), select, textarea { box-sizing: border-box; }
  .chip { min-height: 44px; padding: 10px 14px; font-size: 14px; }
  .chips { gap: 8px; }
  .icon-btn { min-width: 44px; min-height: 44px; }
  .qty button { min-width: 44px; min-height: 44px; }
}

/* ===== AJUDA (manual do usuário) — v0.6.21 ===== */
[data-sec=ajuda] { --primary: #0e7490; --primary-2: #06b6d4; --primary-soft: #e3f6fa; --primary-dark: #155e75; --accent-2: #0891b2; }
#nav a[data-sec=ajuda] svg { color: #22d3ee; }
.aj-busca { margin-bottom: 14px; }
.aj-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.aj-lista { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow: auto; }
.aj-item { display: flex; gap: 10px; align-items: flex-start; text-align: left; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 12px; padding: 10px 12px; cursor: pointer; font: inherit; }
.aj-item:hover { border-color: var(--primary); }
.aj-item.on { border-color: var(--primary); background: var(--primary-soft); }
.aj-item small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; font-weight: 400; }
.aj-ic { font-size: 20px; line-height: 1.2; }
.aj-conteudo { padding: 20px 24px; min-width: 0; }
.aj-tit { margin: 0 0 4px; font-size: 22px; }
.aj-bloco h4 { margin: 22px 0 8px; font-size: 16px; color: var(--primary-dark); }
.aj-bloco ol, .aj-bloco ul { margin: 0; padding-left: 22px; }
.aj-bloco li { margin: 7px 0; line-height: 1.55; }
.aj-img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; margin: 14px 0 4px; }
.aj-leg { margin: 0 0 6px; }
.aj-conteudo mark { background: #fde68a; color: inherit; border-radius: 3px; padding: 0 2px; }
html[data-theme=dark] .aj-conteudo mark { background: #854d0e; }
/* celular/tablet pequeno: a lista de assuntos vira uma grade no alto e o texto vem embaixo */
@media (max-width: 900px) {
  .aj-layout { grid-template-columns: 1fr; }
  .aj-lista { position: static; max-height: 260px; }
  .aj-conteudo { padding: 16px; }
}

/* Botão liga/desliga ("Vender sem estoque" no cadastro do produto) */
label.switch-row { display: flex; align-items: center; gap: 10px; cursor: pointer; margin: 6px 0; font-size: 14px; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .slider { position: absolute; inset: 0; background: var(--line); border-radius: 24px; transition: background .15s; }
.switch .slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch input:disabled + .slider { cursor: not-allowed; }
/* Saldo negativo: vermelho forte para chamar a atenção */
.badge.stock-neg { background: var(--bad); color: #fff; font-weight: 700; }

/* Título de coluna que ordena a lista ao clicar (▲ crescente, ▼ decrescente, ↕ ainda não escolhido) */
th.th-sort { cursor: pointer; user-select: none; }
th.th-sort:hover { color: var(--text); }
th.th-sort .sort-ind { margin-left: 4px; font-size: 10px; opacity: .45; }
th.th-sort.on { color: var(--primary); }
th.th-sort.on .sort-ind { opacity: 1; }

/* Modo exposição das fotos do produto (tela cheia, fundo escuro) */
.expor { position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,.93); display: flex; align-items: center; justify-content: center; }
.expor-img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 56px 64px; box-sizing: border-box; user-select: none; }
.expor-topo { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 12px; padding: 10px 14px; color: #fff; }
.expor-tit { flex: 1; font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.expor-cont { font-size: 14px; opacity: .8; }
.expor-x, .expor-seta { background: rgba(255,255,255,.15); color: #fff; border: 0; cursor: pointer; border-radius: 999px; }
.expor-x { width: 40px; height: 40px; font-size: 18px; }
.expor-seta { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 72px; font-size: 40px; line-height: 1; }
.expor-seta.esq { left: 6px; } .expor-seta.dir { right: 6px; }
.expor-x:hover, .expor-seta:hover { background: rgba(255,255,255,.3); }
@media (max-width: 600px) { .expor-img { padding: 56px 8px; } .expor-seta { width: 44px; height: 64px; } }
/* Galeria de fotos na ficha do produto */
.galeria { display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; width: 220px; }
.galeria .photo-box { width: 220px; height: 220px; cursor: zoom-in; border-style: solid; }
.galeria .photo-box img { object-fit: contain; background: #fff; }
/* setas ‹ › sobre a foto grande para alternar entre as fotos (grandes o bastante para tocar no celular) */
.galeria-grande { position: relative; }
.galeria-seta { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(0,0,0,.5); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0 0 4px; }
.galeria-seta[hidden] { display: none; }
.galeria-seta.esq { left: 4px; }
.galeria-seta.dir { right: 4px; }
/* miniaturas: as 5 fotos cabem numa linha só, embaixo da foto grande */
.galeria-mini { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.galeria-mini .mini { width: 100%; aspect-ratio: 1; height: auto;border: 2px solid var(--line); border-radius: 8px; overflow: hidden; padding: 0; background: #fff; cursor: pointer; position: relative; }
.galeria-mini .mini.sel { border-color: var(--primary, #2563eb); }
.galeria-mini .mini img { width: 100%; height: 100%; object-fit: cover; }
.galeria-mini .mini i { position: absolute; top: -2px; left: 0; font-style: normal; font-size: 11px; }
.galeria-acoes { display: flex; gap: 6px; flex-wrap: wrap; }
.thumb-expor { cursor: zoom-in; }
@media (max-width: 600px) { .photo-field { flex-direction: column; align-items: stretch; } .galeria { width: 100%; } .galeria .photo-box { width: 100%; } }

/* v0.6.49: olho do Início — esconde o valor da gaveta no rodapé do menu só na tela Início */
.cash-oculto { display: none; }
html.inicio-ocultar[data-sec="inicio"] .cash-valor { display: none; }
html.inicio-ocultar[data-sec="inicio"] .cash-oculto { display: inline; }

/* ===== FERRAMENTAS → POLAROIDE (v0.6.59) ===== */
/* Tela em 3 colunas: ajustes à esquerda, prévia da folha no centro, montagem para impressão à direita */
.pol-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.pol-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pol-col .card h3 { margin-top: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.pol-barra { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pol-linha { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.pol-linha select { flex: 1; min-width: 0; }
.pol-hex { width: 100px; text-transform: lowercase; }
/* quadradinho de escolher a cor (fica ao lado do código #rrggbb, na mesma linha) */
.pol-linha input[type=color] { width: 44px; height: 38px; padding: 3px; flex: none; cursor: pointer; }
.pol-hex.pol-invalido { border-color: var(--bad); }
.pol-num { width: 80px; }
.pol-chip-ico { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; padding: 6px 10px; }
.pol-info { margin: 12px 0 8px; font-size: 13px; }
.pol-dica { font-size: 12px; margin: 8px 0 0; }
.pol-fs { border: 0; padding: 0; margin: 0; min-width: 0; }
.pol-fs:disabled { opacity: .5; pointer-events: none; }

/* Controles deslizantes: rótulo à esquerda, valor à direita, barra embaixo */
.pol-slider { margin: 8px 0; }
.pol-slider label { display: flex; justify-content: space-between; font-size: 13px; color: var(--label); margin-bottom: 2px; }
.pol-slider label b { font-weight: 600; color: var(--text); }
.pol-slider input[type=range] { width: 100%; accent-color: var(--primary); }
.pol-fs .btn.pol-on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

/* Prévia: zona de soltar fotos e folha desenhada */
.pol-previa { min-height: 420px; border: 2px dashed transparent; transition: background .15s, border-color .15s; }
.pol-previa.pol-arrastando { background: var(--primary-soft); border-color: var(--primary); }
.pol-vazio { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 380px; border: 2px dashed var(--line-strong); border-radius: var(--radius); cursor: pointer; color: var(--muted); }
.pol-vazio:hover { border-color: var(--primary); }
.pol-vazio-ico { font-size: 40px; }
.pol-previa-barra { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.pol-zoomtxt { min-width: 44px; text-align: center; font-size: 13px; }
.pol-scroll { overflow: auto; max-height: calc(100vh - 220px); border-radius: var(--radius); background: var(--soft); padding: 12px; }
.pol-folha { position: relative; width: max-content; margin: 0 auto; box-shadow: var(--shadow); }
.pol-folha canvas { display: block; cursor: pointer; }
.pol-x { position: absolute; padding: 2px 8px; }

/* Janela de recorte */
.pol-corte-area { display: flex; justify-content: center; background: var(--soft); border-radius: var(--radius); padding: 10px; }
.pol-corte-area canvas { max-width: 100%; touch-action: none; }

/* Celular e telas estreitas: uma coluna só (prévia primeiro) */
@media (max-width: 1100px) {
  .pol-grid { grid-template-columns: 1fr; }
  .pol-centro { order: -1; }
}

/* ===== FERRAMENTAS → PROVA DE TAMANHO (v0.6.60) ===== */
/* Duas colunas: opções à esquerda, prévia da folha à direita; no celular empilha (prévia primeiro) */
.pt-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.pt-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pt-col .card h3 { margin-top: 0; }
.pt-barra { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.pt-ajuda { display: inline-block; margin-left: 6px; font-size: 16px; color: var(--muted); cursor: help; }
.pt-apoio { font-size: 12px; margin: 4px 0 0; }
.pt-linha { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pt-tres { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

/* Cartão da imagem: vazio (com botão) ou com miniatura, nome e medidas */
.pt-imagem { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 14px; text-align: center; transition: background .15s, border-color .15s; }
.pt-imagem.pt-arrastando, .pt-previa.pt-arrastando { background: var(--primary-soft); border-color: var(--primary); }
.pt-vazio p { margin: 0 0 10px; }
.pt-arquivo { display: flex; align-items: center; gap: 12px; text-align: left; }
.pt-arquivo img { width: 72px; height: 72px; object-fit: contain; border-radius: 8px; background: var(--soft); border: 1px solid var(--line); flex: none; }
.pt-arquivo-info { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; min-width: 0; }
.pt-nome { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* "Mais opções" (accordion) */
.pt-mais { border: 1px solid var(--line); border-radius: var(--radius); background: var(--soft); }
.pt-mais > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; color: var(--label); }
.pt-mais[open] > summary { border-bottom: 1px solid var(--line); }
.pt-mais-corpo { padding: 12px 14px; }
.pt-check { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; cursor: pointer; }
.pt-check input { width: auto; }

/* Avisos (lista dentro do banner .alert.warn) */
.pt-avisos { margin: 0; padding-left: 18px; }

/* Prévia: folha sobre fundo neutro do tema, com sombra */
.pt-previa { border: 2px dashed transparent; min-height: 320px; }
.pt-previa-barra { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.pt-scroll { overflow: auto; max-height: calc(100vh - 200px); border-radius: var(--radius); background: var(--soft); padding: 12px; }
.pt-folha { width: max-content; margin: 0 auto; box-shadow: var(--shadow); border: 1px solid var(--line-strong); }
.pt-folha svg { display: block; }
.pt-previa-barra .btn.pt-on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

@media (max-width: 980px) {
  .pt-grid { grid-template-columns: 1fr; }
  .pt-centro { order: -1; }
}

/* ===== FERRAMENTAS → CALCULADORA 3D (v0.6.61) ===== */
/* Coluna única e estreita: serve no computador e no celular */
.c3d-coluna { max-width: 560px; display: flex; flex-direction: column; gap: 16px; }
.c3d-ajuda { display: inline-block; margin-left: 6px; font-size: 16px; color: var(--muted); cursor: help; }
.c3d-apoio { font-size: 12px; margin-top: 4px; }
.c3d-sub { margin: 16px 0 8px; font-size: 15px; }
.c3d-sub:first-child { margin-top: 0; }

/* Topo de leitura: impressora e tarifa */
.c3d-topo { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 14px; padding: 10px 14px; border-radius: var(--radius); background: var(--soft); color: var(--muted); }
.c3d-topo-item { display: inline-flex; align-items: center; gap: 8px; }
.c3d-topo-item b { color: var(--text); }

/* Campos lado a lado (empilham no celular) */
.c3d-duas { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.c3d-watts { display: flex; align-items: center; padding-top: 22px; }
.c3d-botoes { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.c3d-erro { margin: 4px 0 8px; }
.c3d-erro-linha { margin-top: 6px; color: var(--bad); font-size: 12.5px; }

/* Janela pequena da margem */
.modal.c3d-pequeno { max-width: 420px; }

/* Resultado */
.c3d-final { text-align: center; }
.c3d-valor { font-size: 40px; }
.c3d-final .sub { font-size: 13px; }
.c3d-etiquetas { display: flex; flex-wrap: wrap; gap: 8px; }
.c3d-detalhes { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.c3d-detalhes > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; color: var(--label); }
.c3d-detalhes[open] > summary { border-bottom: 1px solid var(--line); }
.c3d-detalhes ul { margin: 0; padding: 12px 14px 12px 32px; line-height: 1.7; }
#c3dResultado:focus { outline: none; }
#c3dResultado:not([hidden]) { display: flex; flex-direction: column; gap: 12px; }

/* Assistente: indicador de etapas */
.c3d-assist { max-width: 640px; }
.c3d-etapas { list-style: none; display: flex; gap: 20px; margin: 0 0 18px; padding: 0; flex-wrap: wrap; }
.c3d-etapas li { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; }
.c3d-etapas li.on { color: var(--primary); }
.c3d-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong); font-size: 13px; }
.c3d-etapas li.on .c3d-num { border-color: var(--primary); background: var(--primary); color: var(--card); }

/* Formulário da impressora: lista de sugestões e consumos */
.c3d-auto { position: relative; }
.c3d-sug { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; margin: 2px 0 0; padding: 4px; list-style: none; max-height: 240px; overflow-y: auto; background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow); }
.c3d-sug li { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.c3d-sug li.on, .c3d-sug li:hover { background: var(--primary-soft); color: var(--primary); }
.c3d-fonte { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.c3d-fonte a { color: var(--primary); }
.c3d-consumos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; margin-top: 8px; }
.c3d-lista-aviso { margin: 0; padding-left: 18px; }
.c3d-check { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; cursor: pointer; }
.c3d-check input { width: auto; }
.c3d-manual { margin-bottom: 8px; }

/* Lista de impressoras nas configurações */
.c3d-imps { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.c3d-imps li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--soft); flex-wrap: wrap; }
.c3d-imp-nome { flex: 1; min-width: 140px; font-weight: 600; }
.c3d-padrao { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; }
.c3d-padrao input { width: auto; }

@media (max-width: 640px) {
  .c3d-duas { grid-template-columns: 1fr; }
  .c3d-watts { padding-top: 0; margin-bottom: 8px; }
  .c3d-consumos { grid-template-columns: 1fr 1fr; }
  .c3d-valor { font-size: 34px; }
  .c3d-botoes .btn { flex: 1; }
}

/* ===== FERRAMENTAS → ENCAIXE PARA IMPRESSÃO (v0.6.62) ===== */
/* Duas colunas: configurações à esquerda (rolam sozinhas no computador) e card da peça + prévia à direita (fica à vista) */
.enc-grid { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; align-items: start; }
.enc-esq { display: flex; flex-direction: column; gap: 14px; min-width: 0; max-height: calc(100vh - 130px); overflow-y: auto; padding-right: 4px; }
.enc-dir { display: flex; flex-direction: column; gap: 14px; min-width: 0; position: sticky; top: 12px; }
.enc-sec h3 { margin: 0 0 10px; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.enc-apoio { font-size: 12px; margin-top: 4px; }
.enc-duas { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.enc-linha { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.enc-linha input[type=range] { flex: 1; min-width: 120px; padding: 0; }
/* quadradinho de escolher a cor (mesma medida do Polaroide) */
.enc-linha input[type=color] { width: 44px; height: 38px; padding: 3px; flex: none; cursor: pointer; }
.enc-hex { width: 110px; text-transform: lowercase; }
.enc-sugestoes { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.enc-amostra-cor { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-strong); cursor: pointer; padding: 0; }
.enc-amostra-cor:hover { border-color: var(--primary); }
.enc-medidas .chips, .enc-sec .chips { margin-bottom: 8px; }
.enc-invalido { border-color: var(--bad) !important; }
.enc-erro-linha { color: var(--bad); }
.enc-check { display: flex; align-items: center; gap: 8px; margin: 6px 0; cursor: pointer; }
.enc-check input { width: auto; }

/* Banner "Configuração manual" / "Valores otimizados" */
.enc-banner { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: var(--radius); background: var(--soft); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.enc-banner b { color: var(--text); font-size: 14px; }
.enc-banner-otim { background: var(--ok-soft); border-color: var(--ok); }
.enc-banner-otim b { color: var(--ok); }
.enc-avisos { margin: 0; }
.enc-lista-aviso { margin: 0; padding-left: 18px; }

/* Área de soltar a arte e lista de artes */
.enc-solta { margin-top: 10px; padding: 14px; text-align: center; border: 2px dashed var(--line-strong); border-radius: var(--radius); transition: background .15s, border-color .15s; }
.enc-solta.enc-arrastando { background: var(--primary-soft); border-color: var(--primary); }
.enc-artes { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.enc-arte { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--soft); cursor: pointer; }
.enc-arte.enc-sel { border-color: var(--primary); background: var(--primary-soft); }
.enc-arte-mini { width: 40px; height: 40px; flex: none; border-radius: 6px; background: var(--card); border: 1px solid var(--line); }
.enc-arte-nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.enc-arte-qtd { width: 70px; flex: none; }
.enc-box-base { margin: 8px 0 12px; }
.enc-base-info { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 13px; }

/* Quantidade em destaque e botão Girar 90° */
.enc-qtd input { font-size: 20px; font-weight: 700; padding: 10px 12px; border-width: 2px; border-color: var(--primary); }
.enc-qtd input.enc-destaque-ro { background: var(--soft); }
.enc-ativo { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

/* Estatísticas */
.enc-stats > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; color: var(--label); }
.enc-stats[open] > summary { border-bottom: 1px solid var(--line); }
.enc-stats-corpo { padding: 14px 16px; }
.enc-numeros { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.enc-num { padding: 10px; border-radius: var(--radius); background: var(--soft); text-align: center; }
.enc-num-v { font-size: 22px; font-weight: 700; color: var(--text); }
.enc-num-l { font-size: 12px; color: var(--muted); }

/* Card "Encaixe na peça" */
.enc-card-corpo { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.enc-mini { flex: none; border-radius: var(--radius); background: var(--soft); border: 1px solid var(--line); padding: 8px; }
.enc-mini canvas { display: block; }
.enc-card-info { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; min-width: 0; flex: 1; }
.enc-chips-info { display: flex; gap: 6px; flex-wrap: wrap; }
.enc-info, .enc-chip-info { display: inline-block; padding: 4px 10px; border-radius: 20px; background: var(--soft); border: 1px solid var(--line); font-size: 12.5px; }
.enc-chip-info { font-weight: 600; color: var(--label); }

/* Prévia */
.enc-previa-barra { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.enc-previa-barra .chips { gap: 6px; }
.enc-zoom { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.enc-zoom-pct { min-width: 44px; text-align: center; font-weight: 600; }
.enc-nav { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; font-weight: 600; }
.enc-scroll { overflow: auto; max-height: calc(100vh - 360px); min-height: 260px; border-radius: var(--radius); background: var(--soft); padding: 12px; }
.enc-folha { width: max-content; margin: 0 auto; box-shadow: var(--shadow); border: 1px solid var(--line-strong); }
.enc-folha canvas { display: block; }
.enc-legenda { margin-top: 10px; }
.enc-leg-itens { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; }
.enc-leg { display: inline-flex; align-items: center; gap: 6px; }
.enc-amostra { display: inline-block; width: 26px; height: 0; border-top: 2px solid var(--line-strong); }
.enc-am-sangria { border-top: 2px dashed var(--warn); }
.enc-am-segura { border-top: 2px dashed var(--primary); }
.enc-imprimir { margin-top: 14px; display: flex; justify-content: flex-end; }
.enc-imprimir .btn { min-width: 220px; padding: 12px 22px; font-size: 15px; }

/* Janela "Ajustar arte" */
.enc-aj { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.enc-aj-tela { display: grid; place-items: center; min-height: 300px; padding: 10px; border-radius: var(--radius); background: var(--soft); border: 1px solid var(--line); }
.enc-aj-ctl .field { margin-bottom: 8px; }
.enc-aj-num { width: 80px; }

@media (max-width: 900px) {
  .enc-grid { grid-template-columns: 1fr; }
  .enc-esq { max-height: none; overflow: visible; padding-right: 0; }
  .enc-dir { position: static; }
  .enc-scroll { max-height: none; }
  .enc-aj { grid-template-columns: 1fr; }
  .enc-imprimir .btn { width: 100%; }
}
