/* ============================================================
   Zaka Forum — design system
   ============================================================ */
:root {
  --bg: #f5f6fb;
  --bg-soft: #eef0f8;
  --surface: #ffffff;
  --surface-2: #f2f4fa;
  --text: #14161c;
  --text-2: #5c6373;
  --text-3: #8b91a1;
  --border: #e5e8f1;
  --border-strong: #d6dae7;
  --primary: #5b5bd6;
  --primary-2: #8b5cf6;
  --primary-soft: #eeeefc;
  --success: #10b981;
  --danger: #ef4444;
  --warn: #f59e0b;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-1: 0 1px 2px rgba(20, 22, 28, .04), 0 2px 8px rgba(20, 22, 28, .04);
  --shadow-2: 0 10px 30px rgba(20, 22, 28, .10);
  --shadow-3: 0 18px 50px rgba(20, 22, 28, .16);
  --grad: linear-gradient(135deg, #5b5bd6, #8b5cf6 55%, #d946ef);
  --topbar-h: 60px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}
html[data-theme="dark"] {
  --bg: #0b0d13;
  --bg-soft: #10131b;
  --surface: #141822;
  --surface-2: #1a1f2b;
  --text: #e9ebf2;
  --text-2: #a2a9ba;
  --text-3: #7b8397;
  --border: #232936;
  --border-strong: #2e3545;
  --primary: #7c7cf0;
  --primary-2: #a78bfa;
  --primary-soft: #1d1f33;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 10px 30px rgba(0, 0, 0, .45);
  --shadow-3: 0 20px 60px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.7 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 0;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--primary); }
img { max-width: 100%; }
button { font: inherit; }
input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--primary); color: #fff; }
.skip { position: absolute; left: -9999px; }

.container { width: min(1180px, 100% - 32px); margin-inline: auto; }
.ico { flex: none; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--border);
}
@supports not (backdrop-filter: blur(1px)) { .topbar { background: var(--surface); } }
.topbar-inner {
  width: min(1180px, 100% - 32px); margin-inline: auto;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 750; letter-spacing: -.02em; font-size: 16.5px; flex: none; }
.brand:hover { color: inherit; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; background: var(--grad);
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 16px;
  box-shadow: 0 4px 14px rgba(91, 91, 214, .35);
}
.brand-mark.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 14px; }
.brand-name { white-space: nowrap; }

.topbar-search {
  flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid transparent; border-radius: 999px;
  padding: 0 14px; height: 38px; color: var(--text-3);
  transition: border-color .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
}
.topbar-search:focus-within { background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent); }
.topbar-search input { flex: 1; border: 0; background: none; outline: none; font-size: 14px; color: var(--text); min-width: 0; }
.topbar-search input::-webkit-search-cancel-button { display: none; }

.topbar-nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 11px; border: 0; background: none;
  color: var(--text-2); cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease), transform .16s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.lang-btn { width: auto; min-width: 46px; padding: 0 10px; font-size: 12.5px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.badge {
  position: absolute; top: 4px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--danger); color: #fff; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; line-height: 16px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}
.avatar-btn { border: 0; background: none; padding: 0; cursor: pointer; display: grid; place-items: center; }
.avatar { border-radius: 50%; object-fit: cover; background: var(--surface-2); display: block; }
.avatar-28 { width: 28px; height: 28px; }
.avatar-40 { width: 40px; height: 40px; }
.avatar-56 { width: 56px; height: 56px; }
.avatar-96 { width: 96px; height: 96px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 15px; border-radius: 11px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: transform .14s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease);
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(91, 91, 214, .28); }
.btn-primary:hover { color: #fff; box-shadow: 0 8px 24px rgba(91, 91, 214, .4); filter: brightness(1.04); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover { background: color-mix(in srgb, var(--primary) 18%, transparent); }
.btn-danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-link { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; font-weight: 600; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- menus ---------- */
.menu { position: relative; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-3); padding: 6px; z-index: 90;
  opacity: 0; transform: translateY(-6px) scale(.98); pointer-events: none;
  transition: opacity .16s var(--ease), transform .16s var(--ease);
}
.menu-panel-sm { min-width: 140px; }
.menu.open .menu-panel { opacity: 1; transform: none; pointer-events: auto; }
.menu-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 9px;
  font-size: 14px; color: var(--text-2); width: 100%; background: none; border: 0; text-align: left; cursor: pointer;
}
.menu-item:hover { background: var(--surface-2); color: var(--text); }
.menu-item.is-active { color: var(--primary); background: var(--primary-soft); }
.menu-head { display: flex; gap: 10px; align-items: center; padding: 10px 11px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-name { font-weight: 700; font-size: 14px; }
.menu-sub { font-size: 12px; color: var(--text-3); }
.menu-logout { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }
.theme-sun, .theme-moon { display: none; }
html[data-theme="light"] .theme-moon { display: block; }
html[data-theme="dark"] .theme-sun { display: block; }

/* ---------- announce / flash ---------- */
.announce { background: var(--primary-soft); border-bottom: 1px solid var(--border); font-size: 13.5px; color: var(--primary); }
.announce .container { display: flex; align-items: center; gap: 8px; padding: 9px 0; }
.flash {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm); font-size: 14px; margin: 16px 0;
  border: 1px solid var(--border); background: var(--surface); animation: slidein .3s var(--ease);
}
.flash-ok { background: color-mix(in srgb, var(--success) 10%, var(--surface)); border-color: color-mix(in srgb, var(--success) 28%, var(--border)); color: color-mix(in srgb, var(--success) 70%, var(--text)); }
.flash-err { background: color-mix(in srgb, var(--danger) 9%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 28%, var(--border)); color: color-mix(in srgb, var(--danger) 72%, var(--text)); }
.flash-x { background: none; border: 0; font-size: 18px; line-height: 1; color: inherit; opacity: .6; cursor: pointer; }
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- layout ---------- */
.main { padding: 22px 0 60px; min-height: 60vh; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 296px; gap: 22px; align-items: start; }
.layout-main { min-width: 0; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.card-pad { padding: 18px; }
.side-stack { display: grid; gap: 14px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.side-card { padding: 15px 16px; }
.side-title { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin: 0 0 10px; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.sep { margin: 0 6px; opacity: .5; }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 18px; padding: 26px 26px 24px; margin-bottom: 18px;
  background: var(--grad); color: #fff; box-shadow: 0 14px 40px rgba(91, 91, 214, .28);
}
.hero::after {
  content: ""; position: absolute; inset: -40% -10% auto auto; width: 420px; height: 420px;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .35), transparent); pointer-events: none;
}
.hero h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.02em; }
.hero p { margin: 0 0 16px; opacity: .88; font-size: 14px; max-width: 560px; }
.hero-stats { display: flex; gap: 22px; flex-wrap: wrap; }
.hero-stat b { display: block; font-size: 18px; line-height: 1.2; }
.hero-stat span { font-size: 12px; opacity: .82; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar h2 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  font-size: 13px; color: var(--text-2); white-space: nowrap; transition: all .16s var(--ease);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.is-active { background: var(--text); color: var(--surface); border-color: var(--text); }

/* ---------- topic list ---------- */
.topic-list { display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.topic-item {
  display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 14px 16px; background: var(--surface); transition: background .16s var(--ease);
}
.topic-item:hover { background: var(--surface-2); }
.topic-item .avatar { margin-top: 2px; }
.topic-title { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-weight: 650; font-size: 15px; letter-spacing: -.01em; line-height: 1.45; }
.topic-title a:hover { color: var(--primary); }
.topic-excerpt { color: var(--text-2); font-size: 13px; margin-top: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.topic-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 7px; font-size: 12.5px; color: var(--text-3); }
.topic-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }
.topic-right { text-align: right; font-size: 12px; color: var(--text-3); display: grid; gap: 4px; min-width: 76px; }
.topic-right b { color: var(--text-2); font-size: 13px; }
.topic-cat {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2);
}
.tag {
  display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary); font-weight: 600;
}
.badge-pin { background: var(--grad); color: #fff; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 6px; }
.badge-closed { background: var(--surface-2); color: var(--text-3); font-size: 10.5px; padding: 1px 7px; border-radius: 6px; }

.empty { text-align: center; padding: 56px 20px; color: var(--text-3); }
.empty svg { opacity: .5; margin-bottom: 10px; }

/* ---------- sidebar ---------- */
.cat-nav { display: grid; gap: 2px; }
.cat-link { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 9px; color: var(--text-2); font-size: 14px; transition: background .16s var(--ease), color .16s var(--ease); }
.cat-link:hover, .cat-link.is-active { background: var(--surface-2); color: var(--text); }
.cat-link .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.cat-count { margin-left: auto; font-size: 12px; color: var(--text-3); }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-box { background: var(--surface-2); border-radius: var(--radius-sm); padding: 11px 12px; }
.stat-box b { display: block; font-size: 17px; letter-spacing: -.02em; }
.stat-box span { font-size: 12px; color: var(--text-3); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.member-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- pager ---------- */
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 20px; }
.pager-item {
  min-width: 38px; height: 36px; display: grid; place-items: center; padding: 0 12px;
  border-radius: 10px; background: var(--surface); border: 1px solid var(--border);
  font-size: 13.5px; color: var(--text-2); transition: all .16s var(--ease);
}
.pager-item:hover { border-color: var(--primary); color: var(--primary); }
.pager-item.is-current { background: var(--text); color: var(--surface); border-color: var(--text); }

/* ---------- topic page ---------- */
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text-3); margin-bottom: 12px; flex-wrap: wrap; }
.crumbs a:hover { color: var(--primary); }
.topic-head { padding: 20px 22px; }
.topic-head h1 { margin: 0 0 10px; font-size: 23px; line-height: 1.4; letter-spacing: -.02em; }
.topic-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--text-3); }
.post {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 14px; scroll-margin-top: calc(var(--topbar-h) + 14px);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.post:target { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent); }
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.post-author { font-weight: 650; font-size: 14px; }
.post-sub { font-size: 12px; color: var(--text-3); }
.post-floor { margin-left: auto; font-size: 12px; color: var(--text-3); }
.post-body { font-size: 15px; line-height: 1.78; color: var(--text); overflow-wrap: anywhere; }
.post-foot { display: flex; align-items: center; gap: 4px; margin-top: 12px; }
.act {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 8px;
  background: none; border: 0; color: var(--text-3); font-size: 12.5px; cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.act:hover { background: var(--surface-2); color: var(--text); }
.act.is-on { color: var(--danger); }
.act.is-on svg { fill: currentColor; }
.act-bookmark.is-on { color: var(--primary); }
.act-bookmark.is-on svg { fill: currentColor; }
.quote-ref {
  border-left: 3px solid var(--border-strong); background: var(--surface-2);
  padding: 9px 12px; border-radius: 0 10px 10px 0; margin-bottom: 12px; font-size: 13px; color: var(--text-2);
}
.tr-badge {
  font-size: 11.5px; color: var(--primary); background: var(--primary-soft);
  padding: 3px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 7px; margin-bottom: 10px;
}
.tr-body { animation: fadein .25s var(--ease); }
@keyframes fadein { from { opacity: 0; } }

/* ---------- markdown ---------- */
.md-h { margin: 20px 0 8px; line-height: 1.4; letter-spacing: -.01em; }
.post-body > .md-h:first-child { margin-top: 0; }
.post-body p { margin: 0 0 11px; }
.post-body ul, .post-body ol { margin: 0 0 12px; padding-left: 22px; }
.post-body li { margin: 3px 0; }
.md-quote { margin: 0 0 12px; padding: 10px 14px; border-left: 3px solid var(--primary); background: var(--surface-2); border-radius: 0 10px 10px 0; color: var(--text-2); }
.md-quote p:last-child { margin: 0; }
.md-hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.inline-code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.code-block {
  background: #0f1219; color: #dbe2f0; border-radius: var(--radius-sm); padding: 14px 16px;
  overflow-x: auto; font-size: 13px; line-height: 1.6; margin: 0 0 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.md-img { border-radius: var(--radius-sm); margin: 6px 0; }
.mention { color: var(--primary); font-weight: 600; }

/* ---------- editor ---------- */
.editor-card { padding: 0; overflow: hidden; }
.editor-tabs { display: flex; gap: 2px; padding: 10px 12px 0; border-bottom: 1px solid var(--border); }
.editor-tab { padding: 8px 13px; border-radius: 9px 9px 0 0; border: 0; background: none; font-size: 13.5px; font-weight: 600; color: var(--text-3); cursor: pointer; }
.editor-tab.is-active { background: var(--surface-2); color: var(--text); }
.editor-body textarea {
  width: 100%; min-height: 320px; border: 0; padding: 16px; resize: vertical; outline: none;
  background: var(--surface); font-size: 14.5px; line-height: 1.75;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "PingFang SC", monospace;
}
.editor-preview { padding: 16px; min-height: 320px; }
.editor-toolbar { display: flex; gap: 4px; padding: 8px 12px; border-top: 1px solid var(--border); background: var(--surface-2); align-items: center; flex-wrap: wrap; }
.editor-toolbar .tool { width: 32px; height: 30px; border-radius: 8px; border: 0; background: none; color: var(--text-2); cursor: pointer; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.editor-toolbar .tool:hover { background: var(--surface); color: var(--text); }
.editor-toolbar .spacer { flex: 1; }
.editor-toolbar .btn-primary { margin-left: 8px; }

/* ---------- forms ---------- */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 650; margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.input, .textarea, select.input {
  width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
  padding: 10px 13px; font-size: 14px; outline: none; transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.input:focus, .textarea:focus, select.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent); }
.textarea { resize: vertical; min-height: 100px; line-height: 1.65; }
.input-lg { height: 44px; font-size: 15px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- auth ---------- */
.auth-wrap { min-height: calc(100vh - var(--topbar-h) - 80px); display: grid; place-items: center; padding: 30px 0; }
.auth-card { width: min(430px, 100%); padding: 30px 28px; }
.auth-card h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.02em; }
.auth-card .sub { color: var(--text-3); font-size: 13.5px; margin-bottom: 22px; }
.auth-foot { text-align: center; font-size: 13.5px; color: var(--text-3); margin-top: 18px; }

/* ---------- profile ---------- */
.profile-hero { padding: 24px; display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.profile-name { font-size: 21px; font-weight: 750; letter-spacing: -.02em; }
.profile-bio { color: var(--text-2); font-size: 13.5px; margin-top: 4px; max-width: 540px; }
.profile-stats { display: flex; gap: 22px; margin-left: auto; }
.profile-stats .stat-box { background: none; padding: 0; text-align: center; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 12px; margin-bottom: 14px; overflow-x: auto; }
.tab { padding: 12px 14px; font-size: 13.5px; font-weight: 600; color: var(--text-3); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.reply-row { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.reply-row:last-child { border-bottom: 0; }
.reply-row .rt { font-weight: 650; font-size: 14px; }
.reply-row .rb { color: var(--text-2); font-size: 13px; margin-top: 3px; }
.reply-row .rm { font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* ---------- inbox ---------- */
.inbox { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 0; min-height: 520px; overflow: hidden; }
.inbox-list { border-right: 1px solid var(--border); max-height: 70vh; overflow-y: auto; }
.inbox-item { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); align-items: center; }
.inbox-item:hover { background: var(--surface-2); }
.inbox-item.is-active { background: var(--primary-soft); }
.inbox-item .t { font-size: 13.5px; font-weight: 650; }
.inbox-item .s { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.inbox-body { display: flex; flex-direction: column; min-height: 0; }
.inbox-head { padding: 13px 16px; border-bottom: 1px solid var(--border); font-weight: 650; font-size: 14px; }
.inbox-thread { padding: 16px; overflow-y: auto; max-height: 56vh; display: grid; gap: 10px; align-content: start; }
.bubble { max-width: 78%; padding: 9px 13px; border-radius: 14px; font-size: 14px; background: var(--surface-2); line-height: 1.6; }
.bubble.mine { background: var(--primary); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.bubble.theirs { border-bottom-left-radius: 4px; }
.bubble time { display: block; font-size: 10.5px; opacity: .6; margin-top: 3px; }
.inbox-compose { border-top: 1px solid var(--border); padding: 12px; display: flex; gap: 8px; }
.notify-item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.notify-item:last-child { border-bottom: 0; }
.notify-item.unread { background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
.notify-text { font-size: 13.5px; }
.notify-time { font-size: 12px; color: var(--text-3); margin-top: 3px; }

/* ---------- admin ---------- */
.admin-wrap { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.admin-nav { padding: 10px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.admin-nav a { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 9px; font-size: 13.5px; color: var(--text-2); }
.admin-nav a:hover { background: var(--surface-2); color: var(--text); }
.admin-nav a.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 650; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.admin-head h1 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 15px 16px; }
.kpi b { display: block; font-size: 22px; letter-spacing: -.02em; line-height: 1.3; }
.kpi span { font-size: 12px; color: var(--text-3); }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th { text-align: left; font-size: 12px; font-weight: 700; color: var(--text-3); padding: 11px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; }
table.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tr:hover td { background: var(--surface-2); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; background: var(--surface-2); color: var(--text-2); }
.pill.ok { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.pill.err { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.pill.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.row-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.row-actions form { display: inline; }
.admin-section { margin-bottom: 18px; }
.admin-section h3 { margin: 0 0 12px; font-size: 14px; letter-spacing: -.01em; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.switch-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--border); background: var(--surface); padding: 26px 0 34px; margin-top: 20px; }
.footer-inner { display: grid; gap: 14px; }
.footer-brand { display: flex; gap: 11px; align-items: center; }
.footer-name { font-weight: 700; font-size: 14px; }
.footer-desc { font-size: 12.5px; color: var(--text-3); }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.footer-copy { font-size: 12px; color: var(--text-3); }

/* ---------- mobile ---------- */
.only-mobile { display: none !important; }
.tabbar { display: none; }
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side-stack { position: static; }
  .side-stack.is-secondary { display: none; }
  .admin-wrap { grid-template-columns: minmax(0, 1fr); }
  .admin-nav { position: static; display: flex; overflow-x: auto; gap: 4px; }
  .admin-nav a { white-space: nowrap; }
  .inbox { grid-template-columns: minmax(0, 1fr); }
  .inbox-list { border-right: 0; border-bottom: 1px solid var(--border); max-height: 240px; }
}
@media (max-width: 760px) {
  :root { --topbar-h: 56px; }
  .container { width: calc(100% - 24px); }
  .only-desktop { display: none !important; }
  .only-mobile { display: inline-grid !important; }
  .topbar-search { order: 3; flex-basis: 100%; max-width: none; height: 36px; }
  .topbar-inner { height: auto; padding: 9px 0 11px; flex-wrap: wrap; gap: 8px; }
  .topbar-nav { gap: 2px; }
  .topbar-nav .icon-btn { width: 34px; height: 34px; }
  .lang-btn { min-width: 40px; padding: 0 8px; font-size: 12px; }
  .badge { top: 1px; right: 1px; }
  .avatar-28 { width: 26px; height: 26px; }
  .brand-name { font-size: 15px; }
  .main { padding: 14px 0 84px; }
  .hero { padding: 20px 18px; border-radius: 16px; }
  .hero h1 { font-size: 20px; }
  .topic-item { grid-template-columns: 34px minmax(0, 1fr); padding: 13px; }
  .topic-right { display: none; }
  .topic-title { font-size: 14.5px; }
  .topic-excerpt { -webkit-line-clamp: 2; }
  .topic-head { padding: 16px; }
  .topic-head h1 { font-size: 19px; }
  .post { padding: 14px; border-radius: 12px; }
  .post-body { font-size: 14.5px; }
  .editor-body textarea { min-height: 200px; }
  .editor-toolbar { row-gap: 6px; }
  .editor-toolbar .small { display: none; }
  .profile-hero { padding: 18px; gap: 14px; }
  .profile-stats { margin-left: 0; width: 100%; justify-content: space-between; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 70;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar-item { flex: 1; display: grid; justify-items: center; gap: 2px; font-size: 10.5px; color: var(--text-3); padding: 5px 0; border-radius: 10px; }
  .tabbar-item.is-active, .tabbar-item:hover { color: var(--primary); }
  .tabbar-new { flex: none; width: 52px; }
  .tabbar-new svg { background: var(--grad); color: #fff; width: 38px; height: 38px; padding: 8px; border-radius: 50%; box-shadow: 0 6px 16px rgba(91, 91, 214, .35); }
  .footer { padding-bottom: 90px; }
  .auth-card { padding: 24px 20px; }
}

/* ---------- drawer / modal / toast ---------- */
.drawer { position: fixed; inset: 0; z-index: 120; background: rgba(8, 10, 16, .45); backdrop-filter: blur(2px); }
.drawer-panel {
  width: min(300px, 84vw); height: 100%; background: var(--surface); padding: 14px;
  animation: drawerin .22s var(--ease); overflow-y: auto;
}
@keyframes drawerin { from { transform: translateX(-100%); } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 14px; padding: 4px 6px 12px; }
.drawer-head .icon-btn { font-size: 20px; }
.drawer-item { display: flex; align-items: center; gap: 9px; padding: 10px 11px; border-radius: 9px; font-size: 14px; color: var(--text-2); }
.drawer-item:hover { background: var(--surface-2); color: var(--text); }
.drawer-item .dot { width: 8px; height: 8px; border-radius: 50%; }
.modal { position: fixed; inset: 0; z-index: 130; background: rgba(8, 10, 16, .5); display: grid; place-items: center; padding: 20px; }
.modal-card { width: min(440px, 100%); background: var(--surface); border-radius: 16px; padding: 22px; box-shadow: var(--shadow-3); animation: popin .2s var(--ease); }
.modal-card h3 { margin: 0 0 6px; font-size: 16px; }
.modal-card textarea { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface); outline: none; resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
@keyframes popin { from { opacity: 0; transform: scale(.96); } }
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(10px);
  background: #14161c; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 13.5px;
  z-index: 140; box-shadow: var(--shadow-2); opacity: 0; transition: all .22s var(--ease); pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
html[data-theme="dark"] .toast { background: #2a3040; }

/* skeleton */
.sk { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
