[hidden] { display: none !important; }
:root {
  --bg: #16181D;
  --bg-card: #1E2025;
  --bg-sunken: #1B1D22;
  --bg-input: #16181D;
  --bg-hover: #23262D;
  --border: #2B2E36;
  --border-2: #23262D;
  --text: #DBDEE1;
  --text-bright: #F2F3F5;
  --text-muted: #949BA4;
  --text-faint: #6A7080;
  --accent: #4453F5;
  --accent-hover: #3A48DC;
  --accent-soft: #7A93F5;
  --accent-mention: #9DB0FF;
  --green: #3BA55D;
  --red: #ED4245;
  --yellow: #FAA61A;
  --teal: #1ABC9C;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); }
body {
  color: var(--text);
  font-family: 'Open Sans', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-soft); text-decoration: none; }
a:hover { color: var(--accent-mention); text-decoration: underline; }
input, textarea, select, button { font-family: inherit; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent) !important; }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
h1, h2, h3, p, ul, ol { margin: 0; }

.thin { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.thin::-webkit-scrollbar { width: 12px; height: 12px; }
.thin::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }

/* markdown */
.md p { margin: 0 0 10px; }
.md h1, .md h2, .md h3 { margin: 18px 0 8px; line-height: 1.25; color: var(--text-bright); font-weight: 700; }
.md h1 { font-size: 21px; } .md h2 { font-size: 17px; } .md h3 { font-size: 15px; }
.md h1:first-child, .md h2:first-child, .md h3:first-child, .md p:first-child { margin-top: 0; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 20px; }
.md li { margin: 3px 0; }
.md .subtext { font-size: 12px; line-height: 1.4; color: var(--text-muted); margin-bottom: 6px; }
.md blockquote { margin: 0 0 10px; padding: 1px 0 1px 12px; border-left: 4px solid #4E5058; color: #C4C9D4; }
.md blockquote > :first-child { margin-top: 0; }
.md blockquote > :last-child { margin-bottom: 0; }
.md pre { margin: 0 0 10px; padding: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; overflow: auto; font-family: 'JetBrains Mono', monospace; font-size: 12.5px; }
.md code { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; background: var(--bg); border: 1px solid var(--border); border-radius: 3px; padding: 1px 4px; }
.md pre code { background: none; border: none; padding: 0; }
.md .sp { background: var(--bg-sunken); color: transparent; border-radius: 3px; cursor: pointer; }
.md .sp:hover { color: var(--text); background: var(--bg-hover); }
.md .mention { background: rgba(68,83,245,.16); color: var(--accent-mention); border-radius: 3px; padding: 0 2px; font-weight: 500; }
.md .mention:hover { background: rgba(68,83,245,.32); }

/* layout */
.shell { display: grid; grid-template-columns: 238px minmax(0,1fr); min-height: 100vh; }
.side { background: var(--bg-sunken); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-head { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--border); flex: none; }
.side-head img { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; }
.side-title { font-weight: 700; font-size: 13px; color: var(--text-bright); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-sub { font-size: 11px; color: var(--text-muted); }
.nav { flex: 1; overflow: auto; padding: 12px 8px; }
.nav-sec { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); padding: 4px 8px 6px; }
.nav-sec.spaced { padding-top: 14px; }
.nav-btn { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; color: var(--text); border: none; border-radius: 4px; padding: 8px 9px; font-size: 14px; font-weight: 500; cursor: pointer; margin-bottom: 2px; text-decoration: none; }
.nav-btn:hover { background: var(--bg-hover); text-decoration: none; }
.nav-btn.active { background: rgba(68,83,245,.16); color: var(--accent-mention); font-weight: 600; }
.nav-btn svg { width: 18px; height: 18px; flex: none; }
.nav-btn span { flex: 1; }

.side-foot { flex: none; border-top: 1px solid var(--border); }
.side-user { display: flex; align-items: center; gap: 9px; padding: 10px 12px; background: var(--bg); }
.avatar { width: 32px; height: 32px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.side-powered { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px; background: var(--bg); border-top: 1px solid var(--border); color: var(--text-faint); font-size: 11px; }
.side-powered img { width: 13px; height: 13px; border-radius: 3px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 0 20px; height: 52px; background: #1E2025; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; flex: none; }
.topbar-title { font-weight: 700; color: var(--text-bright); font-size: 15px; flex: none; }
.topbar-sep { width: 1px; height: 20px; background: var(--border); flex: none; }
.topbar-sub { font-size: 12px; color: var(--text-muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { flex: 1; overflow: auto; padding: 22px 20px 48px; }

/* components */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; }
.card-head { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }
.input, textarea.input, select.input {
  width: 100%; background: var(--bg-input); color: var(--text); border: 1px solid var(--border);
  border-radius: 4px; padding: 8px 10px; font-size: 13.5px;
}
textarea.input { resize: vertical; line-height: 1.6; }
label.field-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 5px; }

.btn { background: #3A3D45; color: #fff; border: none; border-radius: 4px; padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn:hover { background: #43464F; }
.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: none; color: var(--red); border: 1px solid #3A3D45; }
.btn-danger:hover { background: #2A1D22; }
.btn-ghost { background: none; color: var(--text-muted); border: none; cursor: pointer; }
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
button.link { background: none; border: none; color: var(--accent-soft); cursor: pointer; padding: 0; font: inherit; }

.pill { display: inline-flex; align-items: center; gap: 5px; background: var(--bg-hover); border-radius: 3px; padding: 2px 7px; font-size: 11px; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 20px; padding: 4px 11px; font-size: 12px; font-weight: 600; cursor: pointer; border: 1px solid var(--border); background: var(--bg-hover); color: var(--text); }
.chip.on { background: rgba(68,83,245,.16); border-color: var(--accent); color: var(--accent-mention); }

.toggle { width: 40px; height: 22px; border-radius: 11px; border: none; position: relative; padding: 0; cursor: pointer; background: var(--border); }
.toggle .knob { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .12s ease; }
.toggle.on { background: var(--accent); }
.toggle.on .knob { left: 21px; }
.toggle.inherited { background: #2F5040; }
.toggle.inherited .knob { left: 21px; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(278px,1fr)); gap: 12px; }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 12px; }
.stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; padding: 14px 16px; }
.stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text-bright); line-height: 1.1; }
.stat-note { font-size: 12px; color: var(--text-faint); margin-top: 4px; }

table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; padding: 10px 16px; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); }
table.data td { padding: 10px 16px; border-bottom: 1px solid var(--border-2); }

.tag { font-size: 10px; font-weight: 700; text-transform: uppercase; padding: 2px 6px; border-radius: 3px; }
.tag-feature { background: rgba(68,83,245,.18); color: #9DB0FF; }
.tag-policy { background: rgba(250,166,26,.18); color: var(--yellow); }
.tag-fix { background: rgba(59,165,93,.18); color: var(--green); }
.tag-notice { background: rgba(237,66,69,.18); color: var(--red); }

.empty { background: var(--bg-card); border: 1px dashed var(--border); border-radius: 6px; padding: 28px; text-align: center; color: var(--text-muted); }

.settings-layout { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.settings-tabs { flex: 0 1 206px; min-width: 180px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; padding: 8px; position: sticky; top: 8px; }
.settings-body { flex: 1 1 320px; min-width: 0; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--green); border-radius: 6px; padding: 11px 16px; font-size: 13px; color: var(--text); z-index: 80; }

.editor-wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px,1fr)); gap: 16px; align-items: start; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border: 1px solid var(--border); border-bottom: none; border-radius: 6px 6px 0 0; background: var(--bg-sunken); }
.editor-toolbar button { background: none; border: 1px solid transparent; border-radius: 4px; color: var(--text); min-width: 28px; padding: 0 6px; height: 28px; cursor: pointer; font-size: 13px; }
.editor-toolbar button:hover { background: var(--bg-hover); border-color: var(--border); }
.editor-toolbar button.active { background: rgba(68,83,245,.2); color: var(--accent-mention); }
.editor-toolbar .sep { width: 1px; background: var(--border); margin: 3px 4px; }
.wysiwyg { min-height: 260px; background: var(--bg-input); color: var(--text); border: 1px solid var(--border); border-top: none; border-radius: 0 0 4px 4px; padding: 14px; font-size: 13.5px; line-height: 1.7; }
.wysiwyg:focus { outline: none; }
.wysiwyg .mention-chip { display: inline-flex; align-items: center; background: rgba(68,83,245,.16); color: var(--accent-mention); border-radius: 3px; padding: 0 4px; font-weight: 500; }
.wysiwyg span[data-spoiler] { background: var(--bg-sunken); border-radius: 3px; padding: 0 2px; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 860px) { .login-shell { grid-template-columns: 1fr; } .login-art { display: none; } }
.login-art { background-size: cover; background-position: center; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-box { width: 100%; max-width: 360px; }
.discord-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; background: #5865F2; color: #fff; border: none; border-radius: 6px; padding: 12px; font-size: 14px; font-weight: 700; cursor: pointer; }
.discord-btn:hover { background: #4752C4; text-decoration: none; color: #fff; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .nav { display: flex; overflow-x: auto; padding: 8px; gap: 4px; }
  .nav .nav-btn { width: auto; white-space: nowrap; margin-bottom: 0; }
  .nav-sec { display: none; }
  .topbar { height: auto; min-height: 52px; padding: 9px 14px; flex-wrap: wrap; }
  .content { padding: 16px 14px 40px; }
}

/* guide editor */
.wysiwyg { padding: 0; }
.wysiwyg .ProseMirror { min-height: 260px; padding: 14px; outline: none; white-space: pre-wrap; }
.wysiwyg .ProseMirror p.is-editor-empty:first-child::before { content: attr(data-placeholder); color: var(--text-faint); float: left; height: 0; pointer-events: none; }
.wysiwyg .ProseMirror p.subtext { font-size: 12px; color: var(--text-muted); }
.wysiwyg .ProseMirror ul, .wysiwyg .ProseMirror ol { padding-left: 22px; }
.wysiwyg .ProseMirror blockquote { border-left: 4px solid var(--border); margin: 0; padding-left: 10px; }
.wysiwyg .ProseMirror pre { background: var(--bg-sunken); border-radius: 4px; padding: 8px 10px; }
.picker { position: relative; }
.picker-menu { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30; max-height: 240px; overflow-y: auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.35); padding: 4px; }
.picker-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 4px; font-size: 13px; color: var(--text); cursor: pointer; }
.picker-item.active, .picker-item:hover { background: var(--bg-hover); color: var(--text-bright); }
.picker-empty { padding: 6px 8px; font-size: 12.5px; color: var(--text-faint); }
.chip-x { background: none; border: none; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 0 0 2px; opacity: .7; }
.chip-x:hover { opacity: 1; }
.chip .dot, .picker-item .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* login */
.auth-page { min-height: 100vh; background: #16181D; color: #DBDEE1; font-family: 'Open Sans', system-ui, sans-serif; font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; display: grid; place-items: center; padding: 32px 16px; }
.auth-wrap { width: 100%; max-width: 460px; }
.auth-card { background: #1E2025; border: 1px solid #2B2E36; border-radius: 8px; overflow: hidden; }
.auth-banner { display: block; width: 100%; height: 148px; object-fit: cover; }
.auth-body { padding: 26px; }
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.auth-brand img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.auth-name { font-weight: 700; font-size: 15px; color: #F2F3F5; }
.auth-sub { color: #949BA4; font-size: 12px; }
.auth-discord { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; background: #4453F5; color: #fff; border-radius: 4px; padding: 12px 16px; font-size: 14px; font-weight: 600; text-decoration: none; }
.auth-discord:hover { background: #3A48DC; color: #fff; text-decoration: none; }
.auth-powered { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 16px; color: #6A7080; font-size: 12px; }
.auth-powered img { width: 15px; height: 15px; border-radius: 4px; }
.auth-powered span { font-weight: 600; color: #949BA4; }

/* roster */
.roster-manage { border-top: 1px solid var(--border-2); padding: 10px 16px 12px; background: var(--bg-sunken); }
.roster-notes-count { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }
.roster-note-preview { margin-top: 8px; font-size: 12.5px; color: var(--text); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.roster-add-note { margin-top: 8px; }
.roster-add-note summary { font-size: 12px; font-weight: 600; color: var(--accent-mention); cursor: pointer; list-style: none; }
.roster-add-note summary::-webkit-details-marker { display: none; }
.roster-add-note summary::before { content: "+ "; }
.roster-add-note[open] summary { margin-bottom: 6px; }
.roster-add-note textarea { width: 100%; resize: vertical; font-family: inherit; }

.picker-item.disabled { opacity: .45; cursor: not-allowed; }
.picker-label { flex: none; }
.picker-sub { margin-left: auto; font-size: 11px; color: var(--text-faint); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.picker-avatar { width: 22px; height: 22px; border-radius: 50%; flex: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.notice { background: rgba(240,178,50,.1); border: 1px solid rgba(240,178,50,.35); color: var(--text); border-radius: 6px; padding: 10px 14px; font-size: 13px; margin-bottom: 12px; }

/* onboarding */
.ob { min-height: 100vh; display: flex; flex-direction: column; margin: 0; }
.ob-top { display: flex; align-items: center; gap: 12px; padding: 11px 18px; background: #1B1D22; border-bottom: 1px solid var(--border); flex: none; }
.ob-top img { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; }
.ob-flow { font-weight: 600; color: var(--text-bright); font-size: 13px; }
.ob-flow span { color: var(--text-faint); font-weight: 400; }
.ob-count { font-size: 12px; color: var(--text-muted); }
.ob-dots { display: flex; align-items: center; gap: 5px; padding: 9px 18px; background: #1E2025; border-bottom: 1px solid var(--border); flex: none; }
.ob-dots span { height: 4px; flex: 1; border-radius: 2px; background: #2B2E36; }
.ob-dots span.done { background: #4EC97C; }
.ob-dots span.current { background: #4453F5; }
.ob-body { flex: 1; overflow: auto; padding: 34px 18px; }
.ob-inner { max-width: 720px; margin: 0 auto; }
.ob-kind { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.ob-title { font-size: 24px; font-weight: 700; color: var(--text-bright); margin: 0 0 18px; }
.ob-lead { color: var(--text-muted); margin-bottom: 14px; }
.ob-muted { font-size: 12px; color: #6A7080; }
.ob-ellipsis { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ob-profile { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; align-items: start; }
.ob-profile textarea { width: 100%; min-height: 132px; background: #1B1D22; color: var(--text); border: 1px solid var(--border); border-radius: 4px; padding: 10px; font: inherit; font-size: 13px; line-height: 1.6; resize: vertical; }
.ob-profile textarea:focus { outline: none; border-color: #4453F5; }
.ob-preview { background: #1B1D22; border: 1px solid var(--border); border-radius: 4px; padding: 14px; }
.ob-guide { display: flex; align-items: center; gap: 12px; background: #1B1D22; border: 1px solid var(--border); border-radius: 4px; padding: 12px 14px; }
.ob-guide.read { border-color: #2F5040; }
.ob-check { width: 26px; height: 26px; border-radius: 50%; background: #23262D; color: #4E5058; display: grid; place-items: center; flex: none; }
.ob-check svg { width: 14px; height: 14px; }
.ob-guide.read .ob-check { background: #2F5040; color: #4EC97C; }
.ob-choices { display: grid; gap: 8px; max-width: 580px; }
.ob-choice { display: flex; align-items: center; gap: 10px; background: #1B1D22; border: 1px solid var(--border); border-radius: 4px; padding: 11px 13px; cursor: pointer; color: var(--text); font-size: 13px; }
.ob-choice:hover { border-color: #4E5058; }
.ob-ring { width: 17px; height: 17px; border-radius: 50%; border: 2px solid #4E5058; flex: none; }
.ob-choice.right { background: #1E3A2A; border-color: #3BA55D; }
.ob-choice.right .ob-ring { border-color: #3BA55D; background: #3BA55D; }
.ob-choice.wrong { background: #2A1D22; border-color: #ED4245; }
.ob-choice.wrong .ob-ring { border-color: #ED4245; background: #ED4245; }
.ob-feedback { margin-top: 12px; font-size: 13px; color: #ED9CB2; min-height: 1em; }
.ob-feedback.right { color: #4EC97C; }
.ob-ack { display: flex; align-items: flex-start; gap: 10px; background: #1B1D22; border: 1px solid var(--border); border-radius: 4px; padding: 13px; cursor: pointer; color: var(--text); font-size: 13px; max-width: 620px; }
.ob-box { width: 18px; height: 18px; border-radius: 3px; border: 2px solid #4E5058; display: grid; place-items: center; flex: none; margin-top: 1px; }
.ob-box svg { width: 12px; height: 12px; visibility: hidden; }
.ob-ack.on { border-color: #3BA55D; }
.ob-ack.on .ob-box { border-color: #3BA55D; background: #3BA55D; }
.ob-ack.on .ob-box svg { visibility: visible; }
.ob-foot { display: flex; align-items: center; gap: 10px; padding: 11px 18px; background: #1B1D22; border-top: 1px solid var(--border); flex: none; position: sticky; bottom: 0; }
.ob-link { background: none; color: #B5BAC1; border: none; padding: 9px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; }
.ob-link:hover { color: var(--text-bright); text-decoration: none; }
.ob-link:disabled, .ob-link.disabled { color: #4E5058; cursor: default; }
.ob-link.exit { color: var(--text-muted); }
.ob-hint { flex: 1; font-size: 12px; color: #6A7080; }
.ob-next { padding: 10px 22px; }
.ob-next.blocked { background: #2F3546; cursor: not-allowed; }
.ob-reader { position: fixed; inset: 0; background: rgba(0,0,0,.72); display: grid; place-items: center; padding: 24px; z-index: 60; }
.ob-reader-card { width: 100%; max-width: 760px; max-height: 82vh; background: #1E2025; border: 1px solid var(--border); border-radius: 8px; display: flex; flex-direction: column; overflow: hidden; }
.ob-reader-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex: none; }
.ob-reader-head button { background: none; border: none; color: var(--text-muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 2px 6px; }
.ob-reader-body { flex: 1; overflow: auto; padding: 20px 22px; }
.ob-reader-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; flex: none; }
.waiting-spinner { width: 34px; height: 34px; margin: 4px auto 16px; border-radius: 50%; border: 3px solid var(--border); border-top-color: #4453F5; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
