:root {
  --plum: #2B1640; --plum-2: #3A2156; --porcelain: #F6F4FA; --paper: #fff; --ink: #1E1726; --ink-2: #5A5066;
  --line: #E3DEEC; --amethyst: #6B3FA0; --gold: #B8892B; --gold-soft: #F4EAD2;
  --green: #2F7D4F; --orange: #C26A12; --red: #B3261E; --grey: #8E8699;
  --body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif; --display: "Cinzel", Georgia, serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 15px/1.5 var(--body); color: var(--ink); background: var(--porcelain); }
a { color: var(--amethyst); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.shell:has(.side[hidden]) { grid-template-columns: 1fr; }
.side { background: var(--plum); color: #DCD3EA; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; color: #fff; }
.brand span { font-family: var(--display); font-size: 19px; letter-spacing: 0.04em; }
nav a { display: flex; justify-content: space-between; align-items: center; padding: 9px 10px; border-radius: 8px; color: #DCD3EA; text-decoration: none; }
nav a:hover { background: var(--plum-2); }
nav a[aria-current="page"] { background: var(--plum-2); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--gold); }
nav .count { background: var(--gold); color: var(--plum); border-radius: 999px; font-size: 12px; font-weight: 700; padding: 0 7px; }
.link { margin-top: auto; background: none; border: 0; color: #A592C0; font: 14px var(--body); cursor: pointer; text-align: left; padding: 10px; }
main { padding: 26px 30px 60px; max-width: 1120px; outline: none; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 26px 0 10px; }
.lede { color: var(--ink-2); margin: 0 0 18px; }
.small { font-size: 13px; color: var(--ink-2); }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.nums { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.num { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.num b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.num span { font-size: 13px; color: var(--ink-2); }
table { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--ink-2); font-weight: 600; background: #FAF9FC; }
tr:last-child td { border-bottom: 0; }
td.n { text-align: right; font-variant-numeric: tabular-nums; }
.light { display: inline-flex; align-items: center; gap: 8px; }
.light::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--grey); }
.light.green::before { background: var(--green); } .light.orange::before { background: var(--orange); } .light.red::before { background: var(--red); }
.lights { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 14px; border: 0; border-radius: 8px; background: var(--amethyst); color: #fff; font: 600 14px var(--body); cursor: pointer; text-decoration: none; }
.btn.quiet { background: var(--paper); color: var(--amethyst); border: 1px solid var(--line); }
.btn.ok { background: var(--green); } .btn.no { background: var(--paper); color: var(--red); border: 1px solid var(--line); }
.btn:disabled { opacity: 0.5; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.item { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.item h3 { font-size: 15px; margin: 0 0 4px; }
.item pre { white-space: pre-wrap; font: 14px/1.5 var(--body); margin: 8px 0; background: #FAF9FC; padding: 10px; border-radius: 8px; max-height: 260px; overflow: auto; }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #EEE8F6; color: #55307F; }
.tag.gold { background: var(--gold-soft); color: #7A5814; }
.alert { border-left: 4px solid var(--orange); }
.alert.critical { border-left-color: var(--red); }
.mode { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--paper); }
.mode button { border: 0; background: none; padding: 5px 12px; border-radius: 999px; font: 600 13px var(--body); color: var(--ink-2); cursor: pointer; }
.mode button[aria-pressed="true"][data-m="live"] { background: var(--green); color: #fff; }
.mode button[aria-pressed="true"][data-m="practice"] { background: var(--orange); color: #fff; }
.mode button[aria-pressed="true"][data-m="off"] { background: var(--grey); color: #fff; }
.bots { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.bot h3 { margin: 0 0 4px; font-size: 16px; }
.bot .meta { font-size: 13px; color: var(--ink-2); margin: 8px 0; }
.meter { height: 6px; border-radius: 3px; background: #EEE8F6; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--amethyst); }
input, textarea, select { font: 15px var(--body); padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
textarea { width: 100%; min-height: 110px; }
label { font-weight: 600; font-size: 13px; display: block; margin: 10px 0 4px; }
.login { max-width: 360px; margin: 12vh auto 0; }
.login .brand { color: var(--plum); justify-content: center; padding-bottom: 8px; }
.login input { width: 100%; }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding: 10px 0 0; }
.chart i { flex: 1; background: var(--amethyst); border-radius: 3px 3px 0 0; min-height: 2px; }
.chart-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); }
#toast { position: fixed; right: 20px; bottom: 20px; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.show { opacity: 1; }
.links { font-size: 13px; overflow-wrap: anywhere; background: #FAF9FC; padding: 10px; border-radius: 8px; }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px; }
  .brand { padding: 0 6px; width: 100%; }
  nav { display: flex; gap: 4px; overflow-x: auto; width: 100%; padding-bottom: 4px; }
  nav a { white-space: nowrap; }
  .link { margin: 0; }
  main { padding: 18px 14px 40px; }
  table { display: block; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .grid2 { grid-template-columns: 1fr; } }
/* Sandbox */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; margin-bottom: 14px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 46px; height: 26px; border-radius: 999px; background: var(--grey); position: relative; transition: background .15s; flex: none; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .track { background: var(--amethyst); }
.switch input:checked + .track .knob { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 3px solid var(--gold); outline-offset: 2px; }
.sbx-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.sbx-kinds button { border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 999px; padding: 7px 14px; font: 600 13px var(--body); cursor: pointer; }
.sbx-kinds button.on { background: var(--plum); border-color: var(--plum); color: #fff; }
.sbx-stage { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.phone { width: 390px; max-width: 100%; height: 780px; border: 10px solid #1E1726; border-radius: 36px; overflow: hidden; background: #000; box-shadow: 0 18px 40px rgba(30, 23, 38, .25); }
.phone iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.sbx-side { flex: 1 1 220px; max-width: 360px; }
