:root, [data-theme="light"] {
  --bg: #ffffff;
  --fg: #000000;
  --muted: #555555;
  --line: #d9d9d9;
  --soft: #f5f5f5;
  --danger: #b00000;
  --danger-solid: #b00000;
  --ok: #0a6b1f;
}
[data-theme="dark"] {
  --bg: #000000;
  --fg: #ffffff;
  --muted: #aaaaaa;
  --line: #333333;
  --soft: #111111;
  --danger: #ff6b6b;
  --danger-solid: #c62828;
  --ok: #4ade80;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* ---------- header ---------- */
header {
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 56px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 10;
}
.brand { font-weight: 700; font-size: 15px; letter-spacing: 0.02em; white-space: nowrap; }
nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
nav a {
  color: var(--muted); text-decoration: none;
  padding: 6px 12px; font-size: 14px; white-space: nowrap;
  border-bottom: 2px solid transparent;
}
nav a:hover { color: var(--fg); }
nav a.active { color: var(--fg); border-bottom-color: var(--fg); font-weight: 600; }
#tab-signout, #tab-signout:hover { color: var(--danger); }
#theme-toggle {
  background: none; border: 1px solid var(--line); color: var(--fg);
  padding: 5px 12px; cursor: pointer; font-size: 13px; white-space: nowrap;
}
#theme-toggle:hover { background: var(--soft); }

/* ---------- layout ---------- */
main { max-width: 1100px; margin: 0 auto; padding: 28px 24px 80px; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.page-sub { color: var(--muted); margin: 0 0 24px; }

/* ---------- cards & stats ---------- */
.card { border: 1px solid var(--line); padding: 20px; margin-bottom: 20px; background: var(--bg); }
/* Collapsible cards (premium emoji mapping): the summary is the header. */
details.card > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 10px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2 { margin: 0; }
details.card > summary .muted { font-size: 12px; }
details.card[open] > summary .muted { display: none; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { border: 1px solid var(--line); padding: 16px; }
.stat .n { font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 12px; margin-top: 4px; text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--soft); }
.pill { display: inline-block; padding: 1px 8px; font-size: 12px; border: 1px solid var(--line); }
.pill.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.pill.warn { border-color: var(--danger); color: var(--danger); }

/* ---------- forms ---------- */
label.f { display: block; margin: 0 0 14px; }
label.f .lbl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; padding: 8px 10px; font: inherit;
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--line); outline: none; border-radius: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--fg); }
input[type="file"] { font: inherit; font-size: 13px; color: var(--muted); }
input[type="file"]::file-selector-button {
  font: inherit; font-size: 13px; cursor: pointer; margin-right: 10px;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 0;
  background: none; color: var(--fg);
}
input[type="file"]::file-selector-button:hover { border-color: var(--fg); }
textarea { min-height: 90px; resize: vertical; font-family: inherit; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 6px 0; }
.checks label { display: flex; align-items: center; gap: 6px; font-weight: 400; }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--fg); }
.frow { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 18px; }

/* ---------- buttons ---------- */
button, .btn {
  display: inline-block; font: inherit; font-size: 14px; cursor: pointer;
  padding: 8px 16px; border: 1px solid var(--fg); border-radius: 0;
  background: var(--fg); color: var(--bg); text-decoration: none;
}
button.ghost, .btn.ghost { background: none; color: var(--fg); border-color: var(--line); }
button.ghost:hover, .btn.ghost:hover { border-color: var(--fg); }
button.danger { background: none; color: var(--danger); border-color: var(--danger); }
button.sm { padding: 4px 10px; font-size: 13px; }
.btnrow { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }

/* ---------- misc ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chips a {
  border: 1px solid var(--line); color: var(--muted); text-decoration: none;
  padding: 5px 12px; font-size: 13px;
}
.chips a.active { color: var(--bg); background: var(--fg); border-color: var(--fg); }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }
.banner { border: 1px solid var(--danger); color: var(--danger); padding: 10px 14px; margin-bottom: 16px; }
.note { border: 1px solid var(--line); background: var(--soft); padding: 10px 14px; margin-bottom: 16px; color: var(--muted); }
.hr { border: none; border-top: 1px solid var(--line); margin: 28px 0; }
.center-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { border: 1px solid var(--line); padding: 32px; width: 100%; max-width: 360px; }
.login-card h1 { margin-bottom: 20px; }
.status-line { margin-top: 10px; min-height: 18px; font-size: 13px; }
.status-line.ok { color: var(--ok); }
.status-line.err { color: var(--danger); }
.placeholder-box { border: 1px solid var(--line); padding: 48px 24px; text-align: center; color: var(--muted); }
.placeholder-box .t { font-size: 16px; color: var(--fg); font-weight: 600; margin-bottom: 6px; }
.pw-wrap { position: relative; }
.pw-wrap button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
fieldset { border: 1px solid var(--line); margin: 0 0 16px; padding: 16px; }
legend { padding: 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------- side-by-side message editor ---------- */
.msg-row { display: grid; grid-template-columns: 170px 1fr 1fr; gap: 12px; align-items: start; margin-bottom: 10px; }
.msg-row .lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding-top: 8px; }
.msg-row textarea { min-height: 64px; }
.msg-head { border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 14px;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
@media (max-width: 760px) { .msg-row { grid-template-columns: 1fr; } .msg-head { display: none; } }

/* ---------- modal popup ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px 16px;
}
.modal {
  background: var(--bg); border: 1px solid var(--line);
  width: 100%; max-width: 640px; max-height: 88vh; overflow-y: auto;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg);
}
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-body { padding: 20px; }

/* ---------- confirm popup (destructive actions) ---------- */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.confirm-box {
  background: var(--bg); border: 1px solid var(--line);
  width: 100%; max-width: 440px; padding: 22px;
}
.confirm-box h2 { margin: 0 0 8px; font-size: 16px; line-height: 1.35; }
.confirm-box p { margin: 0 0 20px; color: var(--muted); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
button.danger.solid { background: var(--danger-solid); color: #ffffff; border-color: var(--danger-solid); }
button.danger.solid:hover { opacity: 0.88; }

/* ---------- dashboard: pending dot, analysis, orders, customers ---------- */
.tab-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #ef4444; margin-left: 6px; vertical-align: 2px;
  animation: dot-pulse 1.6s ease-in-out infinite;
}
@keyframes dot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.pill.bad { background: var(--danger); color: #ffffff; border-color: var(--danger); }
.pill.temp { border-style: dashed; }
.actions-cell { white-space: nowrap; }
.actions-cell button { margin: 0 6px 6px 0; }
.stats-sm { margin-bottom: 6px; }
.stats-sm .stat { padding: 12px 14px; }
.stats-sm .stat .n { font-size: 20px; }
.sub-h { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; margin: 18px 0 10px; }
.chips button {
  border: 1px solid var(--line); color: var(--muted); background: none;
  padding: 5px 12px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.chips button.active { color: var(--bg); background: var(--fg); border-color: var(--fg); }
tbody tr.row-static, tbody tr.row-static:hover { cursor: default; background: var(--bg); }
.cust-orders { padding: 6px 4px 12px; }
.cust-orders table { border: 1px solid var(--line); }
.tag { display: inline-block; font-size: 11px; border: 1px solid var(--line); color: var(--muted); padding: 0 6px; margin-left: 6px; }
.tag.tg, .tag.wa { margin-left: 0; }
.tag.tg { color: #2f7fd1; border-color: #2f7fd1; }
.tag.wa { color: #1f9d55; border-color: #1f9d55; }
.tag.blocked { color: var(--danger); border-color: var(--danger); }
[data-theme="dark"] .tag.tg { color: #6aa9ea; border-color: #3d6f9e; }
[data-theme="dark"] .tag.wa { color: #4ade80; border-color: #2f7a4e; }

/* ---------- analysis chart ---------- */
.chart { width: 100%; height: auto; display: block; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-yl { fill: var(--muted); font-size: 11px; }
.ch-yl-r { fill: #3b82f6; }
.ch-xl { fill: var(--muted); font-size: 11px; }
.ch-bar { fill: var(--fg); opacity: 0.85; }
.ch-bar:hover { opacity: 1; }
.ch-line { fill: none; stroke: #3b82f6; stroke-width: 2; }
.ch-dot { fill: #3b82f6; }
.legend { display: flex; gap: 20px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.lg { display: inline-block; width: 14px; height: 8px; margin-right: 6px; vertical-align: middle; }
.lg-bar { background: var(--fg); }
.lg-line { background: #3b82f6; height: 3px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.grid-2 .card { min-width: 0; }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- usage bot ---------- */
.ub-error-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.joblog {
  background: var(--soft); border: 1px solid var(--line);
  padding: 12px; margin: 0 0 10px; max-height: 320px; overflow: auto;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.45; white-space: pre-wrap; word-break: break-all;
}
.joblog .lg-ok { color: var(--ok); }
.joblog .lg-err { color: var(--danger); }
.joblog .lg-warn { color: var(--fg); font-weight: 600; }
.joblog .lg-info { color: var(--muted); }

/* ---------- progress bar (live broadcast) ---------- */
.bc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 8px; }
.progress { height: 8px; background: var(--soft); border: 1px solid var(--line); overflow: hidden; margin-bottom: 8px; }
.progress > span { display: block; height: 100%; width: 0; background: var(--fg); transition: width 0.35s ease; }
.progress.done > span { background: var(--ok); }
.progress.err > span { background: var(--danger-solid); }
.bc-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.bc-stats b { color: var(--fg); }
.bc-stats .ok b { color: var(--ok); }
.bc-stats .err b { color: var(--danger); }

#ub-panels td { padding: 4px 6px 4px 0; border-bottom: none; }
#ub-panels input { min-width: 130px; font-size: 13px; padding: 6px 8px; }
#ub-panels thead th { padding-bottom: 4px; }

/* ---------- chip picker (dropdown multi-select) ---------- */
.sel-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); padding: 2px 4px 2px 10px; font-size: 13px; }
.chip button { border: none; background: none; color: var(--muted); padding: 0 4px; font-size: 15px; line-height: 1; cursor: pointer; }
.chip button:hover { color: var(--danger); }
.chip-select { max-width: 300px; }
fieldset .frow { margin-top: 4px; }

/* ---------- whatsapp tab ---------- */
.wa-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 760px) { .wa-tiles { grid-template-columns: 1fr; } }
.wa-tile {
  border: 1px solid var(--line); background: var(--bg); cursor: pointer; user-select: none;
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 32px 24px 26px; text-align: center; aspect-ratio: 1 / 1;
}
.wa-tile:hover { border-color: var(--fg); }
.wa-tile:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.wa-tile.selected { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); }
.wa-tile.selected::before {
  content: "Selected"; position: absolute; top: 12px; right: 12px;
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--fg); color: var(--bg); padding: 2px 8px;
}
.wa-stage { display: flex; align-items: center; justify-content: center; flex: 1; min-height: 200px; }
.wa-qr-wrap {
  position: relative; border: 1px solid var(--line); background: var(--bg);
  padding: 14px; width: 208px; height: 208px; border-radius: 22px;
}
.wa-qr { width: 180px; height: 180px; filter: blur(5px); opacity: 0.9; border-radius: 14px; overflow: hidden; }
.wa-qr-svg { width: 180px; height: 180px; display: block; }
.wa-qr-refresh {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 48px; height: 48px; border-radius: 50%;
  padding: 0; display: flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1; z-index: 2;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55), 0 0 0 4px var(--bg);
}
.wa-qr-refresh:hover { transform: translate(-50%, -50%) scale(1.08); }
.wa-qr-refresh.spin { animation: wa-spin 0.6s linear; }
@keyframes wa-spin { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(360deg); } }
.wa-logo-wrap { position: relative; width: 120px; height: 120px; }
.wa-logo {
  width: 120px; height: 120px; border-radius: 26px; background: #25D366;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(37, 211, 102, 0.35);
}
.wa-logo svg { width: 74px; height: 74px; fill: #ffffff; }
.wa-seal { position: absolute; width: 44px; height: 44px; z-index: 2; filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.4)); }
.wa-seal-qr { right: -10px; bottom: -10px; }
.wa-seal-official { right: -12px; bottom: -12px; }
.wa-seal-check { fill: none; stroke: #ffffff; stroke-width: 6.8; stroke-linecap: round; stroke-linejoin: round; }
.wa-tile-name { font-size: 17px; font-weight: 700; }
.wa-tile-sub { color: var(--muted); font-size: 13px; max-width: 300px; margin: 0 auto; }

/* ---------- baileys setup guide ---------- */
.back-link { margin: 0 0 10px; font-size: 13px; }
.back-link a { color: var(--muted); text-decoration: none; }
.back-link a:hover { color: var(--fg); text-decoration: underline; }

.steps { list-style: none; margin: 0 0 20px; padding: 0; }
.step { display: flex; gap: 16px; border: 1px solid var(--line); border-bottom: none; padding: 18px 20px; }
.step:last-child { border-bottom: 1px solid var(--line); }
.step-n {
  flex: 0 0 28px; width: 28px; height: 28px; margin-top: 1px;
  border: 1px solid var(--fg); background: var(--fg); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.step-body { min-width: 0; flex: 1; }
.step-t { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.step-body p { margin: 0 0 8px; }
.step-body p:last-child { margin-bottom: 0; }
.step-body .joblog { margin: 10px 0 0; }

.callout { border: 1px solid var(--line); border-left: 3px solid var(--fg); background: var(--soft); padding: 16px 20px; margin-bottom: 20px; }
.callout.warn { border-left-color: var(--danger); }
.callout-t { font-weight: 700; margin-bottom: 8px; }
.callout.warn .callout-t { color: var(--danger); }
.callout ul { margin: 0; padding-left: 20px; color: var(--muted); }
.callout li { margin-bottom: 5px; }
.callout li:last-child { margin-bottom: 0; }

.wa-guide-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }

/* ---------- official api: copy rows and webhook activity ---------- */
.grid-2 > label.f { min-width: 0; }
.wa-copyrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 9px 0; border-bottom: 1px solid var(--line); }
.wa-copyrow:last-of-type { border-bottom: none; }
.wa-copyrow .lbl { min-width: 110px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.wa-copyrow .mono { flex: 1 1 260px; font-size: 13px; word-break: break-all; }
.wa-hook { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); padding: 4px 0; }
.wa-hook .mono { font-size: 12px; }
.wa-tile-cta { margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--fg); }

/* ---------- baileys pairing ---------- */
.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 14px; }
.kv .lbl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
@media (max-width: 720px) { .kv { grid-template-columns: 1fr; } }

.wa-qr-live-wrap { display: flex; justify-content: center; padding: 8px 0 14px; }
.wa-qr-live { width: 232px; height: 232px; border: 1px solid var(--line); padding: 10px; background: var(--bg); }
.wa-qr-live.placeholder { filter: blur(5px); opacity: 0.55; }
.wa-qr-live .wa-qr-svg { width: 100%; height: 100%; }
.wa-qr-img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }

.wa-code {
  margin: 14px 0 0; padding: 14px; border: 1px solid var(--fg); text-align: center;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 30px; font-weight: 700; letter-spacing: 0.16em;
}

/* ---------- on/off switch ---------- */
.switch-row { display: flex; flex-wrap: wrap; gap: 6px 24px; align-items: center; padding: 4px 0 10px; }
.switch-row .switch { margin: 0; }
.switch { display: inline-flex; align-items: center; gap: 10px; margin: 2px 0 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch .track {
  position: relative; flex: 0 0 auto; width: 36px; height: 20px; border-radius: 999px;
  background: #9ca3af; border: none;
  transition: background .15s ease;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #ffffff; box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  transition: transform .15s ease;
}
.switch input:checked + .track { background: #4ade80; }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--fg); outline-offset: 2px; }
.switch .switch-text { font-weight: 400; }
.switch input:disabled + .track { opacity: .5; }

/* ---------- floating formatting toolbar ---------- */
.fmtbar {
  position: fixed; z-index: 150; box-sizing: border-box;
  background: var(--bg); border: 1px solid var(--line); padding: 5px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  /* The bar floats over whatever sits under the textarea, so only the controls
     themselves swallow clicks - the gaps stay clickable. */
  pointer-events: none;
}
.fmtbar button, .fmt-preview { pointer-events: auto; }
.fmtbar[hidden] { display: none; }
.fmt-btns { display: flex; flex-wrap: wrap; gap: 4px; }
.fmtbar button {
  padding: 2px 8px; font-size: 12px; min-width: 30px;
  background: none; color: var(--fg); border: 1px solid var(--line);
}
.fmtbar button:hover { border-color: var(--fg); }
.fmtbar button.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.fmtbar button.f-b { font-weight: 700; }
.fmtbar button.f-i { font-style: italic; }
.fmtbar button.f-u { text-decoration: underline; }
.fmtbar button.f-s { text-decoration: line-through; }
.fmt-preview {
  margin-top: 5px; padding: 10px 12px; max-height: 240px; overflow: auto;
  border: 1px dashed var(--line); background: var(--soft);
  white-space: pre-wrap; word-break: break-word;
}
.fmt-preview[hidden] { display: none; }
.fmt-preview code, .fmt-preview pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px;
}
.fmt-preview pre {
  display: block; padding: 8px; margin: 4px 0; overflow-x: auto;
  border: 1px solid var(--line); background: var(--bg);
}
.fmt-preview blockquote {
  margin: 4px 0; padding-left: 10px; border-left: 3px solid var(--line); color: var(--muted);
}
.fmt-preview a { color: inherit; }
/* Where <nxt> starts a new WhatsApp message. Telegram sends one message and
   ignores the break. */
.nxt-split {
  display: block; margin: 8px 0; padding: 2px 0;
  border-top: 1px dashed var(--line);
  font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
.fmt-preview tg-spoiler, .fmt-preview span.tg-spoiler { background: var(--fg); color: transparent; }
.fmt-preview tg-spoiler:hover, .fmt-preview span.tg-spoiler:hover { color: var(--bg); }
