:root {
  --brand: #02325B; --brand-2: #1D5FA8; --red: #E10706; --ink: #1f2937; --muted: #6b7280; --line: #e5e7eb;
  --bg: #f6f7f5; --card: #fff; --warn: #b45309; --bad: #b91c1c; --good: #15803d;
  --r: 14px; font-family: Poppins, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --brand-2: #7DB0EA; --ink: #e5e7eb; --muted: #9ca3af; --line: #2d3436; --bg: #111413; --card: #1a1f1d; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); padding-bottom: 76px; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  background: var(--brand); color: #fff; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); }
.top h1 { flex: 1; font-size: 17px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon { background: none; border: 0; color: #fff; font-size: 22px; padding: 4px 8px; cursor: pointer; }
.live { font-size: 11px; color: #86efac; letter-spacing: .05em; }
main { max-width: 760px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 12px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.stat small { color: var(--muted); display: block; font-size: 12px; }
.stat b { font-size: 18px; font-variant-numeric: tabular-nums; }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--brand-2); }
.bar > i.warn { background: var(--warn); } .bar > i.bad { background: var(--bad); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border: 0; }
.list .sub { color: var(--muted); font-size: 12px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.owe { color: var(--bad); } .ok { color: var(--good); } .void { text-decoration: line-through; opacity: .55; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { width: 100%; padding: 12px; font-size: 16px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); color: var(--ink); }
button.btn, a.btn { display: block; text-align: center; text-decoration: none; box-sizing: border-box; width: 100%; padding: 13px; font-size: 16px; font-weight: 600; border: 0; border-radius: 10px;
  background: var(--brand); color: #fff; margin-top: 14px; cursor: pointer; }
button.btn.ghost, a.btn.ghost { background: transparent; color: var(--brand-2); border: 1px solid var(--line); }
button.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); cursor: pointer; }
.row { display: flex; gap: 8px; } .row > * { flex: 1; } .row b { white-space: nowrap; }
.fab { position: fixed; right: 18px; bottom: 88px; width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--brand-2); color: #fff; font-size: 28px; box-shadow: 0 6px 18px rgba(0,0,0,.25); cursor: pointer; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; background: none; border: 0; padding: 8px 0; font-size: 18px; color: var(--muted); cursor: pointer; }
.tabs button span { display: block; font-size: 10px; }
.tabs button.on { color: var(--brand-2); }
dialog { border: 0; border-radius: var(--r); width: min(94vw, 480px); padding: 18px; background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.45); }
#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #111; color: #fff;
  padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.show { opacity: .95; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--line); }
.alert { border-left: 4px solid var(--warn); }
h2 { font-size: 15px; margin: 0 0 8px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(4, 1fr); } }

/* ---- Icons & form font ---- */
button, input, select, textarea { font-family: inherit; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.btn svg.i, .sm svg.i { width: 18px; height: 18px; margin-right: 6px; vertical-align: -3px; }
.sm svg.i { margin: 0; }
.tabs button svg.i { display: block; margin: 0 auto 2px; }
.fab svg.i { width: 26px; height: 26px; stroke-width: 2.2; }
a.sm { display: inline-flex; align-items: center; justify-content: center; color: var(--ink); text-decoration: none; }
.alert svg.i { color: var(--warn); margin-right: 6px; } .alert.bad { border-left-color: var(--bad); } .alert.bad svg.i { color: var(--bad); }

/* ---- E-card studio ---- */
.seg { display: grid; grid-auto-flow: column; gap: 4px; background: var(--line); padding: 4px; border-radius: 12px; margin-bottom: 12px; }
.seg button { border: 0; background: transparent; padding: 10px; border-radius: 9px; font-weight: 500; font-size: 14px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.gallery { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x mandatory; }
.thumb { flex: 0 0 112px; border: 2px solid transparent; border-radius: 10px; padding: 0; background: none; cursor: pointer; scroll-snap-align: start; text-align: center; }
.thumb .art { display: block; width: 108px; height: 150px; border-radius: 8px; overflow: hidden; background: var(--line); }
.thumb .art svg, .thumb .art img { width: 100%; height: 100%; display: block; object-fit: cover; }
.thumb span { display: block; font-size: 11px; color: var(--muted); padding: 4px 0 2px; }
.thumb.on { border-color: var(--brand-2); } .thumb.on span { color: var(--ink); font-weight: 600; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 4px; }
.sw { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0;
  display: grid; place-items: center; }
.sw.on { box-shadow: 0 0 0 3px var(--ink); }
.sw i { width: 14px; height: 14px; border-radius: 50%; display: block; }
.preview { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.preview svg { display: block; width: 100%; height: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip { font-size: 12px; padding: 6px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.chip.on { background: var(--ink); color: var(--card); border-color: var(--ink); }
.placer { position: relative; cursor: crosshair; }
.placer .dot { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 3px solid #fff; background: var(--bad);
  box-shadow: 0 0 0 1px rgba(0,0,0,.4); pointer-events: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.drop { display: grid; place-items: center; gap: 6px; border: 2px dashed var(--line); border-radius: 12px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; }
.drop svg.i { width: 32px; height: 32px; color: var(--brand-2); }
.drop input { display: none; }
.hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.ok-box { border-left: 4px solid var(--good); } .warn-box { border-left: 4px solid var(--warn); }
.big { font-size: 28px; font-weight: 600; margin: 4px 0; }
.scanner video { width: 100%; border-radius: 12px; background: #000; }
input[type=color] { height: 46px; padding: 4px; cursor: pointer; }
input[type=range] { padding: 0; border: 0; accent-color: var(--brand-2); }
#ciForm .btn { white-space: nowrap; flex: 0 0 140px; }
a.sm { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); }

/* ---- WhatsApp Quick Send ---- */
button.btn.wa, a.btn.wa { background: #1f7a4d; }
.sender { display: flex; flex-direction: column; gap: 2px; margin: 4px 0; }
.sender b { font-size: 16px; }
.wa-stats { margin: 10px 0 6px; } .wa-stats .stat { padding: 8px 10px; } .wa-stats .stat b { font-size: 16px; }
.wa-guest .big { margin: 10px 0 2px; }
.wa-msg { white-space: pre-wrap; font: 13px/1.5 Poppins, system-ui, sans-serif; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; margin: 12px 0 0; max-height: 220px; overflow: auto; }
.wa-chip { font-size: 11px; padding: 3px 9px; border-radius: 99px; background: var(--line); color: var(--ink); white-space: nowrap; }
.wa-chip.s-SENT { background: #d1fae5; color: #065f46; } .wa-chip.s-OPENED { background: #fef3c7; color: #92400e; }
.wa-chip.s-SKIPPED { background: #e5e7eb; color: #4b5563; }
.list li.cur { background: color-mix(in srgb, var(--brand-2) 8%, transparent); border-radius: 8px; padding-left: 8px; padding-right: 8px; }
button.btn[disabled] { opacity: .45; cursor: not-allowed; }
details.card summary { cursor: pointer; list-style: none; } details.card summary::-webkit-details-marker { display: none; }
textarea { width: 100%; font: 14px/1.5 Poppins, system-ui, sans-serif; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); margin-top: 8px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; margin-top: 12px; }
label.check input { width: auto; }
.wa-msg { overflow-wrap: anywhere; word-break: break-word; }
.wa-guest .row .pill { flex: 0 0 auto; }
.wa-guest .row .num { flex: 1; }

/* ---- SmartNet brand ---- */
.top { border-bottom: 3px solid var(--red); }
.top .logo { height: 26px; width: auto; display: block; }
.top h1 { display: flex; align-items: center; gap: 10px; }
.top h1 .sep { width: 1px; height: 20px; background: rgba(255,255,255,.35); }
.authlogo { display: block; width: 210px; max-width: 70%; height: auto; margin: 4px auto 6px; }
.authsub { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.fab { background: var(--red); }
.poweredby { text-align: center; font-size: 11px; color: var(--muted); margin: 18px 0 4px; }
.poweredby img { height: 22px; width: auto; vertical-align: middle; margin-left: 4px; }
[hidden] { display: none !important; }
