:root { --bg: #0b0e13; --panel: #12161d; --panel-2: #171c25; --line: #222a36; --text: #e6eaf0; --muted: #8a94a6; --dim: #838ea0; --accent-text: #f7931a; --up: #16c784; --down: #ea3943; --warn: #f0b90b; --accent: #f7931a; color-scheme: dark; }

/* Themes: dark by default; html[data-theme="light"] (js/theme.js) switches every colour. The
   --x-rrggbb tokens are this sheet's one-off colours with a light counterpart each. */
:root { --strong: #fff; --ink-rgb: 255, 255, 255; --bg-rgb: 11, 14, 19; --x-06140e: #06140e; --x-08070f: #08070f; --x-0b0d02: #0b0d02; --x-0c0b16: #0c0b16; --x-0f2a1f: #0f2a1f; --x-13111f: #13111f; --x-2a0f12: #2a0f12; --x-3a1216: #3a1216; --x-c3bfd6: #c3bfd6; --x-c8ff3d: #c8ff3d; --x-ff6b73: #ff6b73; --x-ffd6d9: #ffd6d9; }
html[data-theme='light'] {
  --bg: #f2f4f7; --panel: #ffffff; --panel-2: #f5f7fa; --line: #dde2ea; --text: #121826; --muted: #566173; --dim: #636d80; --accent-text: #a65800;
  --up: #0c9f6b; --down: #d92f3a; --warn: #b58105; --accent: #e8850c;
  --strong: #0b0f17; --ink-rgb: 15, 23, 42; --bg-rgb: 242, 244, 247; color-scheme: light;
  --x-06140e: #f9fdfb; --x-08070f: #fbfbfd; --x-0b0d02: #fefefb; --x-0c0b16: #f9f8fc; --x-0f2a1f: #f0faf6; --x-13111f: #f6f6fa; --x-2a0f12: #faf0f1; --x-3a1216: #f9ebec; --x-c3bfd6: #3d3756; --x-c8ff3d: #9ed317; --x-ff6b73: #aa131b; --x-ffd6d9: #a5121d;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--text); }
.ad-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: rgba(var(--bg-rgb),.95); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ad-top .logo img { height: 28px; width: auto; display: block; }
.ad-badge { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); border: 1px solid rgba(247,147,26,.5); border-radius: 999px; padding: 2px 9px; }
.ad-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.ad-tabs a { text-decoration: none; color: var(--muted); font-weight: 600; padding: 7px 12px; border-radius: 8px; }
.ad-tabs a.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.ad-who { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.ad-back { color: var(--muted); font-size: 13px; }
.ad-main { padding: 20px; max-width: 1500px; margin: 0 auto; }
.ad-gate { max-width: 460px; margin: 60px auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.ad-gate h1 { margin: 0 0 8px; font-size: 22px; }
.ad-mfa { display: flex; gap: 8px; margin-top: 12px; }
.ad-mfa input { flex: 1; min-height: 44px; font-size: 20px; letter-spacing: .2em; text-align: center; }
.ad-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.ad-head h1 { margin: 0; font-size: 22px; }
.ad-head .btn { margin-left: auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.card h2 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.card h2 + * + h2 { margin-top: 18px; }
.ad-grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.kpi span { display: block; color: var(--muted); font-size: 12px; }
.kpi b { display: block; font-size: 24px; margin-top: 2px; letter-spacing: -.01em; }
.kpi small { color: var(--dim); font-size: 11.5px; }
.kpi.money b { color: var(--up); }
.kpi.warn b { color: var(--warn); }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: 10px; }
.bars div { flex: 1; background: linear-gradient(180deg, var(--up), rgba(22,199,132,.35)); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars div:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); white-space: nowrap; background: #000; padding: 2px 6px; border-radius: 4px; font-size: 11px; }
.hbar { display: grid; grid-template-columns: 120px 1fr 40px; align-items: center; gap: 8px; margin: 5px 0; font-size: 13px; }
.hbar i { display: block; height: 8px; border-radius: 4px; background: var(--accent); }
.hbar em { font-style: normal; text-align: right; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
input, select, textarea { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; min-height: 36px; font: inherit; font-size: 13.5px; }
textarea { padding: 10px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; width: 100%; min-height: 360px; }
.filters input[type="search"] { min-width: 240px; flex: 1; }
.btn { min-height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn.go { background: var(--up); border-color: var(--up); color: var(--x-06140e); }
.btn.bad { border-color: rgba(234,57,67,.6); color: var(--x-ff6b73); background: rgba(234,57,67,.08); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 12px; }
.btn.armed { border-color: var(--down); color: var(--x-ff6b73); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.tbl-wrap { padding: 0; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--dim); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--panel); cursor: pointer; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--panel-2); }
.tbl .mono, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.sub { color: var(--dim); font-size: 12px; }
.dim { color: var(--dim); font-size: 12.5px; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.pill.ok { background: rgba(22,199,132,.14); color: var(--up); }
.pill.trial { background: rgba(247,147,26,.14); color: var(--accent-text); }
.pill.warn { background: rgba(240,185,11,.14); color: var(--warn); }
.pill.bad { background: rgba(234,57,67,.14); color: var(--x-ff6b73); }
.err { color: var(--x-ff6b73); margin: 8px 0 0; min-height: 1em; }
.ok { color: var(--up); margin: 8px 0 0; min-height: 1em; }
.inline-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline-form input { width: 90px; }
.price-grid { display: grid; grid-template-columns: 120px 1fr 1fr; gap: 8px; align-items: center; margin-bottom: 10px; }
.price-grid b { font-size: 13px; color: var(--muted); }
.row { display: flex; align-items: center; gap: 8px; }
.row input { width: 90px; }
.drawer { position: fixed; inset: 0 0 0 auto; width: min(720px, 100%); background: var(--panel); border-left: 1px solid var(--line); z-index: 40; overflow-y: auto; box-shadow: -20px 0 60px rgba(0,0,0,.5); }
.drawer-in { padding: 20px; }
.dw-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.dw-head h2 { margin: 0; font-size: 19px; word-break: break-all; }
.dw-head .x { margin-left: auto; }
.sec { border-top: 1px solid var(--line); padding: 14px 0; }
.sec h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; margin: 0; }
.facts dt { color: var(--dim); font-size: 11.5px; }
.facts dd { margin: 0; font-size: 13px; word-break: break-word; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.acts input, .acts select { width: auto; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.7); display: flex; align-items: flex-start; justify-content: center; padding: 30px 16px; overflow-y: auto; }
.modal-in { width: min(900px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--x-0f2a1f); border: 1px solid var(--up); color: var(--text); padding: 10px 16px; border-radius: 10px; z-index: 60; }
.toast.bad { background: var(--x-2a0f12); border-color: var(--down); }
@media (max-width: 900px) { .ad-grid2 { grid-template-columns: 1fr; } .facts { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .ad-main { padding: 12px; } .form-grid { grid-template-columns: 1fr; } .filters input[type="search"] { min-width: 0; width: 100%; } .ad-who { display: none; } }

/* Emails: composer, audience, preview, history */
.em-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.em-kind, .em-aud { display: grid; gap: 8px; margin-bottom: 16px; }
.em-aud { grid-template-columns: repeat(3, auto); justify-content: start; gap: 18px; margin-bottom: 10px; }
.em-kind label { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.em-kind label span { grid-column: 2; color: var(--muted); font-size: 12.5px; }
.em-kind input, .em-aud input, .em-plans input, .em-ulist input { min-height: 0; accent-color: var(--up); }
.em-tpls { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.em-tpls button { border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.em-tpls button:hover { border-color: var(--up); }
.em-subject { width: 100%; min-height: 42px; font-size: 15px; margin-bottom: 8px; }
.em-bar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px; border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--panel-2); }
.em-bar button { min-width: 32px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 0 8px; }
.em-bar button:hover, .em-bar button.on { background: var(--bg); }
.em-bar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.em-bar select { min-height: 30px; font-size: 12.5px; }
.em-edit, .em-src { width: 100%; min-height: 320px; max-height: 60vh; overflow: auto; padding: 18px 20px; border: 1px solid var(--line); border-radius: 0 0 10px 10px; background: #13111f; color: #c3bfd6; font: 15px/1.65 -apple-system, 'Segoe UI', Roboto, sans-serif; outline: none; }
.em-src { font: 12.5px/1.5 ui-monospace, Menlo, monospace; color: var(--text); background: var(--bg); }
.em-edit:focus { box-shadow: 0 0 0 2px rgba(22,199,132,.35); }
.em-edit h1, .em-edit h2, .em-edit h3, .em-edit b, .em-edit strong { color: #fff; }
.em-edit h2 { font-size: 22px; margin: 0 0 12px; text-transform: none; letter-spacing: normal; color: #fff; } .em-edit h3 { font-size: 17px; margin: 16px 0 8px; }
.em-edit p { margin: 0 0 12px; } .em-edit a { color: #c8ff3d; }
.em-edit a.btn { display: inline-block; padding: 12px 24px; border-radius: 999px; background: #c8ff3d; color: #0b0d02; font-weight: 700; text-decoration: none; }
.em-edit blockquote { margin: 0 0 14px; padding: 12px 16px; border-left: 3px solid #c8ff3d; background: #0c0b16; border-radius: 0 10px 10px 0; color: #fff; }
.em-edit img { max-width: 100%; border-radius: 10px; }
.em-plans { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 10px; }
.em-ulist { max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; }
.em-ulist label { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.em-ulist label:last-child { border-bottom: 0; }
.em-ulist .sub { margin-left: auto; color: var(--dim); font-size: 12px; }
.em-count { min-height: 1.4em; margin: 6px 0 12px; color: var(--muted); }
.em-count b { color: var(--text); }
.em-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.em-prev-card { padding: 12px; }
#emFrame { width: 100%; height: 640px; border: 0; border-radius: 10px; background: var(--x-08070f); }
.prog { height: 6px; border-radius: 4px; background: var(--panel-2); overflow: hidden; margin-top: 6px; min-width: 120px; }
.prog i { display: block; height: 100%; background: var(--up); }
@media (max-width: 1100px) { .em-grid { grid-template-columns: 1fr; } .em-aud { grid-template-columns: 1fr; } }

/* Telegram: coins per member, and which coins are sent at all */
.chk { display: inline-flex; align-items: center; gap: 5px; margin-right: 8px; white-space: nowrap; cursor: pointer; }
.tg-sendcoins { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 16px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.ad-errbar { position: sticky; top: 0; z-index: 200; background: var(--x-3a1216); color: var(--x-ffd6d9); border-bottom: 1px solid var(--x-ff6b73); padding: 10px 16px; font-size: 14px; }
.ad-errbar a { color: #fff; }
.ad-fail { margin: 0 0 12px; }

/* Desktop: the full screen width */
@media (min-width: 1201px) { .ad-main { max-width: none; } }
.ad-theme { margin-left: 4px; }

/* Live stream (admin/live.js) */
.lv-intro { margin: -4px 0 14px; max-width: 80ch; }
.lv-wide { grid-column: 1 / -1; }
.lv-check { display: flex; align-items: center; gap: 8px; margin: 10px 0 12px; font-size: 13px; }
.lv-check input { width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; flex: none; accent-color: var(--up); }
#lvSetup { margin-top: 12px; }
.lv-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.lv-state { font-weight: 800; font-size: 15px; color: var(--muted); }
.lv-state.on { color: #fff; background: #c62832; padding: 3px 10px; border-radius: 6px; letter-spacing: .06em; }
.lv-time { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text); }
.lv-go { width: 100%; min-height: 48px; font-size: 15px; }
.btn.danger { background: #c62832; border-color: #c62832; color: #fff; }
.lv-scenes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lv-scenes .btn[aria-pressed="true"] { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.lv-now { margin: 10px 0 0; font-weight: 700; font-size: 13.5px; min-height: 1.2em; }
.lv-screens { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin: 12px 0 14px; }
.lv-screens .btn { min-height: 52px; white-space: normal; text-align: left; padding: 8px 14px; }
.lv-screens .btn[aria-pressed="true"] { background: var(--up); border-color: var(--up); color: #04150d; }
.lv-log { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow: auto; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.lv-log li { padding: 5px 0; border-bottom: 1px solid var(--line); color: var(--muted); }
.lv-log li.err { color: var(--x-ff6b73); margin: 0; }
.lv-log:empty::before { content: "Nothing yet. Connect to OBS to begin."; color: var(--dim); }
.lv-split { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin: 0 0 14px; padding: 12px 14px 14px; border: 1px solid var(--line); border-radius: 10px; }
.lv-split legend { padding: 0 6px; font-weight: 700; font-size: 13px; }
.lv-split label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); }
.lv-split select { min-height: 40px; min-width: 180px; }
@media (max-width: 640px) { .lv-split label, .lv-split select { width: 100%; } }
.lv-split .btn { min-height: 40px; display: inline-flex; align-items: center; text-decoration: none; }
.lv-split input[type=number] { min-height: 40px; width: 110px; }
.lv-coin-now { align-self: center; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.lv-split [hidden] { display: none; }
