:root {
  --ground: #0e0f13;
  --side: #121419;
  --surface: #16181e;
  --surface-2: #1b1e25;
  --raise: #1d2028;
  --line: #22252d;
  --line-2: #2f3440;
  --text: #ecebe6;
  --text-2: #c9cbd3;
  --muted: #a3a6b1;
  --accent: #ff9300;
  --accent-hi: #ffb347;
  --accent-bg: #2a2114;
  --accent-line: #6b4a14;
  --ok: #3fb68b;
  --ok-bg: #13261e;
  --ok-line: #23503d;
  --warn-bg: #2e2414;
  --warn: #ffc979;
  --bad: #f2828a;
  --bad-bg: #2d1416;
  --info-bg: #1c2440;
  --info: #c3ccff;
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--text); font-family: var(--sans); font-size: 15px; }
a { color: var(--accent-hi); }
a:hover { color: #ffd08a; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.boot { padding: 64px; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

/* shell */
.app { min-height: 100vh; display: flex; flex-wrap: wrap; }
.side { flex: 1 1 220px; max-width: 100%; padding: 24px 16px; background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
@media (min-width: 900px) { .side { position: sticky; top: 0; height: 100vh; max-width: 260px; } }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -0.01em; }
.nav a { display: flex; gap: 12px; align-items: center; padding: 0 12px; border-radius: 8px; color: var(--text-2); text-decoration: none; min-height: 44px; font-size: 14px; font-weight: 500; }
.nav a:hover { background: var(--raise); color: #fff; }
.nav a[aria-current="page"] { background: var(--accent-bg); color: var(--accent-hi); }
.side-foot { margin-top: auto; padding-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.status-box { border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.dot.off { background: var(--bad); }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; }
.me img { width: 32px; height: 32px; border-radius: 50%; }
.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 20px 32px; border-bottom: 1px solid var(--line); }
.crumb { font-size: 13px; color: var(--muted); }
h1 { margin: 4px 0 0; font-family: var(--display); font-size: 28px; font-weight: 700; letter-spacing: -0.015em; }
h2 { margin: 0; font-family: var(--display); font-size: 18px; font-weight: 700; }
h3 { margin: 0; font-size: 15px; font-weight: 600; }
.page { padding: 24px 32px 48px; }
@media (max-width: 640px) { .head, .page { padding-left: 16px; padding-right: 16px; } }
.cols { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.col-list { flex: 1 1 200px; min-width: 0; }
.col-edit { flex: 3 1 440px; min-width: 0; }
.col-prev { flex: 3 1 420px; min-width: 0; }
@media (min-width: 1200px) { .col-prev { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; } }

/* banners */
.banner { margin: 16px 32px 0; padding: 12px 16px; border-radius: 10px; font-size: 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.banner.warn { background: var(--warn-bg); border: 1px solid #5a4219; color: var(--warn); }
.banner.ok { background: var(--ok-bg); border: 1px solid var(--ok-line); color: #bfeedd; }
.banner.bad { background: var(--bad-bg); border: 1px solid #5c2328; color: #ffc4c8; }
@media (max-width: 640px) { .banner { margin-left: 16px; margin-right: 16px; } }

/* controls */
.lbl { display: block; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.inp { background: var(--ground); border: 1px solid var(--line-2); border-radius: 8px; color: var(--text); padding: 10px 12px; font-size: 14px; width: 100%; min-height: 44px; }
.inp:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
textarea.inp { resize: vertical; line-height: 1.5; min-height: 88px; }
textarea.code { font-family: var(--mono); font-size: 13px; min-height: 420px; white-space: pre; tab-size: 2; }
select.inp { cursor: pointer; }
.inp.emoji { text-align: center; font-size: 18px; padding: 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--raise); color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #262a34; color: #fff; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a1206; }
.btn.primary:hover { background: #ffa733; color: #1a1206; }
.btn.danger { background: transparent; border-color: #5c2328; color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: #262a34; color: #fff; }
.icon-btn[disabled] { opacity: .3; cursor: default; background: transparent; }
.check { display: flex; gap: 10px; align-items: center; min-height: 40px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.seg { display: inline-flex; flex-wrap: wrap; }
.seg button { min-height: 40px; padding: 0 12px; border: 1px solid var(--line-2); background: var(--ground); color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; margin-left: -1px; }
.seg button:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.seg button:last-child { border-radius: 0 8px 8px 0; }
.seg button[aria-pressed="true"] { background: var(--accent-bg); color: var(--accent-hi); border-color: var(--accent-line); position: relative; }
.swatch { width: 40px; height: 40px; border-radius: 10px; cursor: pointer; border: 2px solid transparent; flex: none; }
.swatch[aria-pressed="true"] { border-color: var(--text); }
input[type="color"].inp { padding: 4px; width: 56px; cursor: pointer; }

/* cards & lists */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.card.tight { padding: 16px; gap: 12px; }
.sub { background: var(--surface-2); border: 1px solid #262a33; border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.divider { height: 1px; background: var(--line); }
.list { display: flex; flex-direction: column; gap: 2px; }
.list a { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 8px; border: 1px solid transparent; color: var(--text); text-decoration: none; min-height: 44px; justify-content: center; }
.list a:hover { background: var(--raise); color: var(--text); }
.list a[aria-current="true"] { background: var(--raise); border-color: #3a3020; }
.list .t { font-weight: 600; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.list .m { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: #262a33; color: var(--text-2); white-space: nowrap; font-family: var(--sans); }
.badge.accent { background: var(--accent-bg); color: var(--accent-hi); }
.badge.ok { background: var(--ok-bg); color: #9fe3c6; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.info { background: var(--info-bg); color: var(--info); }
.fcard { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; border: 1px solid #262a33; background: var(--surface-2); }
.fcard[aria-current="true"] { border-color: var(--accent); background: #211c14; }
.fcard .pick { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--text); min-height: 40px; }
.fcard .pick .t { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.fcard .pick .m { font-size: 12px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 32px; border-bottom: 1px solid var(--line); }
.tabs button, .tabs a { min-height: 44px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.tabs button:hover, .tabs a:hover { color: var(--text); }
.tabs [aria-selected="true"] { color: var(--accent-hi); border-bottom-color: var(--accent); }
@media (max-width: 640px) { .tabs { padding: 0 16px; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border-radius: 999px; background: var(--raise); border: 1px solid var(--line-2); font-size: 13px; }
.chip button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.chip button:hover { background: #333845; color: #fff; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.tile .v { font-family: var(--display); font-size: 34px; font-weight: 700; margin-top: 4px; }
.empty { padding: 32px; text-align: center; color: var(--muted); font-size: 14px; }

/* tables */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 16px; border-bottom: 1px solid var(--raise); vertical-align: middle; }
tbody tr:hover { background: #181a20; }
.who { display: flex; align-items: center; gap: 10px; }
.who img { width: 28px; height: 28px; border-radius: 50%; }

/* dialogs & toasts */
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line-2); border-radius: 14px; padding: 0; width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog.wide { width: min(1000px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(5, 6, 9, .7); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.dlg-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
pre.transcript { margin: 0; padding: 16px; background: var(--ground); border: 1px solid var(--line); border-radius: 10px; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; max-height: 60vh; overflow: auto; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.thumbs a { display: block; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--ground); aspect-ratio: 4 / 3; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; max-width: min(420px, calc(100vw - 32px)); }
.toast { padding: 12px 16px; border-radius: 10px; font-size: 14px; background: #23262f; border: 1px solid var(--line-2); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.toast.ok { background: var(--ok-bg); border-color: var(--ok-line); color: #bfeedd; }
.toast.bad { background: var(--bad-bg); border-color: #5c2328; color: #ffc4c8; }
.warnings { margin: 0; padding-left: 18px; font-size: 13px; color: var(--warn); }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 36px; display: flex; flex-direction: column; gap: 20px; }
.btn.discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.btn.discord:hover { background: #4752c4; }

/* ---------- Discord preview ---------- */
.dc { background: #313338; border-radius: 14px; padding: 20px 20px 24px; color: #dbdee1; font-family: var(--sans); font-size: 15px; line-height: 1.375; }
.dc-msg { display: flex; gap: 14px; }
.dc-msg + .dc-msg { margin-top: 18px; }
.dc-avatar { width: 40px; height: 40px; border-radius: 50%; background: #241a0b; display: flex; align-items: center; justify-content: center; flex: none; }
.dc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.dc-author { display: flex; align-items: center; gap: 8px; }
.dc-name { font-weight: 600; color: var(--accent-hi); }
.dc-app { font-size: 10px; font-weight: 700; background: #5865f2; color: #fff; border-radius: 4px; padding: 1px 5px; }
.dc-time { font-size: 12px; color: #949ba4; }
.dc-box { background: #2b2d31; border: 1px solid #1f2023; border-left-width: 4px; border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 10px; max-width: 640px; position: relative; overflow: hidden; }
.dc-box.spoiler::after { content: "SPOILER"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(30,31,34,.85); backdrop-filter: blur(12px); font-weight: 700; letter-spacing: .08em; color: #dbdee1; font-size: 13px; }
.dc-sep { height: 1px; background: #3f4147; margin: 2px 0; }
.dc-text { white-space: normal; word-wrap: break-word; }
.dc-text p { margin: 0; min-height: 1.375em; }
.dc-text h1, .dc-text h2, .dc-text h3 { margin: 4px 0 2px; font-family: var(--sans); color: #f2f3f5; letter-spacing: 0; }
.dc-text h1 { font-size: 24px; }
.dc-text h2 { font-size: 20px; }
.dc-text h3 { font-size: 16px; }
.dc-text .sub { all: unset; display: block; font-size: 12px; color: #949ba4; }
.dc-text ul { margin: 0; padding-left: 22px; }
.dc-text li { margin: 1px 0; }
.dc-text blockquote { margin: 0; padding-left: 12px; border-left: 4px solid #4e5058; }
.dc-text code { font-family: var(--mono); font-size: 13px; background: #1e1f22; border-radius: 4px; padding: 1px 4px; }
.dc-text a { color: #00a8fc; text-decoration: none; }
.dc-text a:hover { text-decoration: underline; }
.dc-mention { background: #3c4270; color: #c9cdfb; border-radius: 3px; padding: 0 2px; font-weight: 500; }
.dc-ph { background: var(--accent-bg); color: var(--accent-hi); border-radius: 4px; padding: 0 4px; font-family: var(--mono); font-size: 13px; }
.dc-emoji { width: 1.375em; height: 1.375em; vertical-align: -0.3em; object-fit: contain; }
.dc-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 4px; border-radius: 8px; overflow: hidden; }
.dc-gallery img { width: 100%; height: 100%; max-height: 300px; object-fit: cover; display: block; background: #1e1f22; }
.dc-gallery.one { grid-template-columns: 1fr; }
.dc-thumb { width: 84px; height: 84px; border-radius: 8px; object-fit: cover; flex: none; }
.dc-row { display: flex; flex-wrap: wrap; gap: 8px; }
.dc-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 2px 14px; border-radius: 8px; border: 0; font-size: 14px; font-weight: 500; color: #fff; cursor: default; }
.dc-btn.primary { background: #5865f2; }
.dc-btn.secondary { background: #4e5058; }
.dc-btn.success { background: #248046; }
.dc-btn.danger { background: #da373c; }
.dc-select { width: 100%; }
.dc-select > button { width: 100%; min-height: 40px; display: flex; justify-content: space-between; align-items: center; padding: 0 12px; border-radius: 8px; background: #1e1f22; border: 1px solid #1e1f22; color: #b5bac1; font-size: 15px; cursor: pointer; text-align: left; }
.dc-menu { margin-top: 4px; background: #2b2d31; border: 1px solid #1e1f22; border-radius: 8px; padding: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.dc-opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 4px; }
.dc-opt:hover { background: #393c43; }
.dc-opt .e { width: 22px; flex: none; text-align: center; font-size: 18px; line-height: 22px; }
.dc-opt .l { color: #f2f3f5; font-weight: 500; }
.dc-opt .d { font-size: 13px; color: #b5bac1; }

/* modal (form) preview */
.dc-modal { background: #232428; border-radius: 14px; padding: 22px; display: flex; flex-direction: column; gap: 18px; color: #dbdee1; }
.dc-modal-title { font-size: 18px; font-weight: 700; color: #f2f3f5; }
.dc-q { display: flex; flex-direction: column; gap: 8px; border: 0; margin: 0; padding: 0; min-width: 0; }
.dc-q > legend, .dc-q > label.q { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #b5bac1; padding: 0; margin-bottom: 8px; }
.dc-q .req { color: #f2828a; }
.dc-q .desc { font-size: 13px; color: #949ba4; margin-top: -4px; }
.dc-in { width: 100%; min-height: 40px; padding: 10px 12px; border-radius: 8px; border: 1px solid #1e1f22; background: #1e1f22; color: #dbdee1; font-size: 15px; }
textarea.dc-in { min-height: 90px; resize: vertical; }
.dc-radio { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; border: 1px solid #3f4147; background: #2b2d31; cursor: pointer; color: #dbdee1; font-size: 15px; }
.dc-radio:hover { background: #32353b; }
.dc-radio input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: #5865f2; flex: none; }
.dc-radio .d { display: block; font-size: 13px; color: #b5bac1; }
.dc-file { border: 2px dashed #4e5058; border-radius: 8px; padding: 18px; text-align: center; color: #949ba4; font-size: 14px; }
.dc-page { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--info); display: flex; align-items: center; gap: 10px; }
.dc-page::after { content: ""; flex: 1; height: 1px; background: #3f4147; }
.dc-modal-foot { display: flex; justify-content: flex-end; gap: 8px; }
.dc-chan { display: flex; align-items: center; gap: 8px; padding: 0 0 14px; margin-bottom: 14px; border-bottom: 1px solid #26282c; font-weight: 600; color: #f2f3f5; }
.dc-chan .hash { color: #80848e; font-size: 20px; }
