@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #0d0f13;
  --panel: #15181e;
  --panel-2: #1b1f27;
  --panel-3: #242a35;
  --line: #262b35;
  --line-2: #333a48;
  --text: #eceef2;
  --muted: #9aa1b0;
  --faint: #667080;
  --accent: #e5484d;
  --accent-2: #c9393e;
  --accent-soft: #3a1a1c;
  --ok: #3dd68c;
  --ok-soft: #12291f;
  --warn: #f5a524;
  --warn-soft: #2e2412;
  --info: #6b9cf7;
  --info-soft: #172238;
  --bad: #f2555a;
  --bad-soft: #321718;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a.link { color: var(--info); }
a.link:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.hidden { display: none !important; }
.mt { margin-top: 10px; }
.mt2 { margin-top: 20px; }
.mb { margin-bottom: 14px; }
textarea.short { min-height: 70px; }
textarea.medium { min-height: 100px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
svg.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.top { position: sticky; top: 0; z-index: 10; background: var(--panel); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1040px; margin: 0 auto; padding: 0 20px; height: 60px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; white-space: nowrap; }
.mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; }
.brand .logo { width: 36px; height: 36px; flex: none; }
.login .login-logo { width: 104px; height: 104px; display: block; margin-bottom: 10px; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; line-height: 1; }
nav.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
nav.tabs a { padding: 8px 12px; border-radius: 7px; color: var(--muted); font-weight: 550; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
nav.tabs a:hover { color: var(--text); background: var(--panel-2); }
nav.tabs a.on { color: var(--text); background: var(--panel-3); }
.dot-count { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 0 6px; }

main { max-width: 1040px; margin: 0 auto; padding: 28px 20px 60px; }
.head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.head p { margin-top: 4px; color: var(--muted); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.card > .card-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.card > .card-head h2 { flex: 1; font-size: 16px; }
.card > .card-body { padding: 18px; }
.card > .card-body.flush { padding: 0; }
.grid { display: grid; gap: 14px; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat { padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 2px; }
.stat .sub { color: var(--muted); font-size: 13px; }
a.stat:hover { border-color: var(--line-2); }

.notice { padding: 14px 16px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); display: flex; gap: 12px; align-items: flex-start; }
.notice.ok { background: var(--ok-soft); border-color: #1f4a35; }
.notice.warn { background: var(--warn-soft); border-color: #4d3b16; }
.notice.bad { background: var(--bad-soft); border-color: #4a2427; }
.notice.ok svg { color: var(--ok); }
.notice.warn svg { color: var(--warn); }
.notice.bad svg { color: var(--bad); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--panel-3); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel-2); }
.btn.small { padding: 6px 11px; font-size: 13.5px; }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 550; }
input, select, textarea { background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text); border-radius: 8px; padding: 10px 12px; font: inherit; min-width: 0; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--info); }
textarea { resize: vertical; min-height: 140px; }
.hint { font-size: 12.5px; color: var(--faint); font-weight: 400; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form .span { grid-column: 1 / -1; }

.pill { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 650; background: var(--panel-3); color: var(--muted); white-space: nowrap; }
.pill.open { background: var(--warn-soft); color: var(--warn); }
.pill.answered { background: var(--info-soft); color: var(--info); }
.pill.closed { background: var(--panel-3); color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }

.list { display: flex; flex-direction: column; }
.list .item { display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.list .item:last-child { border-bottom: 0; }
a.item:hover { background: var(--panel-2); }
.list .title { font-weight: 600; }
.new-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; }

.char { padding: 18px; }
.char .name { font-size: 18px; font-weight: 700; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; margin-top: 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.subhead { margin-top: 16px; font-size: 13px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.mini { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.mini > div { display: flex; gap: 10px; justify-content: space-between; padding: 8px 10px; background: var(--panel-2); border-radius: 8px; font-size: 14px; }

.thread { display: flex; flex-direction: column; gap: 12px; }
.msg { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--panel); max-width: 86%; }
.msg.player { align-self: flex-end; background: var(--panel-3); border-color: var(--line-2); }
.msg.staff { align-self: flex-start; border-color: #2a3a5c; background: var(--info-soft); }
.msg.system { align-self: center; background: none; border-style: dashed; color: var(--muted); font-size: 13px; padding: 6px 12px; }
.msg .meta { font-size: 12.5px; color: var(--faint); margin-bottom: 4px; display: flex; gap: 8px; }
.msg .meta b { color: var(--text); font-weight: 650; }
.msg .text { white-space: pre-wrap; overflow-wrap: anywhere; }

.empty { padding: 34px 18px; text-align: center; color: var(--muted); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: min(420px, 100%); padding: 30px; }
.login .mark { width: 46px; height: 46px; font-size: 22px; border-radius: 12px; margin-bottom: 16px; }
.login h1 { margin-bottom: 6px; }
.login form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
.login .error { color: var(--bad); font-size: 14px; min-height: 20px; }
.steps { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.steps ol { margin: 8px 0 0; padding-left: 20px; }
.steps code { background: var(--panel-3); padding: 1px 6px; border-radius: 5px; color: var(--text); }

.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 32px)); }
.toast { background: var(--panel-3); border: 1px solid var(--line-2); border-radius: 10px; padding: 11px 14px; display: flex; gap: 10px; align-items: flex-start; }
.toast.ok svg { color: var(--ok); }
.toast.bad svg { color: var(--bad); }

@media (max-width: 760px) {
  .top-inner { height: auto; padding: 10px 14px; flex-wrap: wrap; gap: 10px; }
  nav.tabs { order: 3; flex-basis: 100%; }
  main { padding: 20px 14px 50px; }
  .grid.three, .grid.two, .form { grid-template-columns: minmax(0, 1fr); }
  .msg { max-width: 100%; }
  .kv { grid-template-columns: 110px 1fr; }
  h1 { font-size: 22px; }
}

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.cat { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; padding: 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; font: inherit; }
.cat:hover { border-color: var(--line-2); background: var(--panel-2); }
.cat.on { border-color: var(--accent); background: var(--accent-soft); }
.cat-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--panel-3); display: grid; place-items: center; }
.cat.on .cat-icon { background: var(--accent); color: #fff; }
.cat-label { font-weight: 650; }
.cat-hint { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.cat-chosen { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
