/* ============ Tokens ============ */
:root {
  --bg: #f5f6fa;
  --bg-accent: radial-gradient(1200px 600px at 10% -10%, #e6e9ff 0%, transparent 60%), radial-gradient(900px 500px at 110% 10%, #f1e9ff 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --border: #e4e7ef;
  --border-strong: #d3d8e4;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0ff;
  --accent-text: #ffffff;
  --success: #15803d;
  --success-soft: #e8f7ee;
  --warn: #92400e;
  --warn-soft: #fff6e0;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --logo-ink: #ffffff;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.06);
  --shadow: 0 1px 3px rgb(15 23 42 / 0.06), 0 8px 24px rgb(15 23 42 / 0.06);
  --shadow-lg: 0 20px 60px rgb(15 23 42 / 0.18);
  --radius: 14px;
  --radius-sm: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d12;
    --bg-accent: radial-gradient(1200px 600px at 10% -10%, #1b1f3a 0%, transparent 60%), radial-gradient(900px 500px at 110% 10%, #241a3a 0%, transparent 55%);
    --surface: #12151c;
    --surface-2: #171b24;
    --border: #232835;
    --border-strong: #303746;
    --text: #e8eaf0;
    --text-2: #c3c8d4;
    --muted: #8b93a7;
    --accent: #8b8cf8;
    --accent-hover: #a5a6fb;
    --accent-soft: rgb(139 140 248 / 0.14);
    --accent-text: #0b0d12;
    --success: #4ade80;
    --success-soft: rgb(74 222 128 / 0.12);
    --warn: #fbbf24;
    --warn-soft: rgb(251 191 36 / 0.12);
    --danger: #f87171;
    --danger-soft: rgb(248 113 113 / 0.12);
    --logo-ink: #0b0d12;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow: 0 1px 3px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 20px 60px rgb(0 0 0 / 0.6);
    color-scheme: dark;
  }
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
body.app { background: var(--bg-accent), var(--bg); background-attachment: fixed; min-height: 100vh; }
body.no-scroll { overflow: hidden; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { width: 1em; height: 1em; flex: none; }
.logo-ink { fill: var(--logo-ink); }
.logo-stroke { stroke: var(--logo-ink); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mono { font-family: var(--mono); font-size: 0.85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 16px; }
[hidden] { display: none !important; }

/* ============ Buttons & inputs ============ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 550; cursor: pointer; text-decoration: none; transition: background 0.15s, border-color 0.15s, transform 0.05s; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--muted); text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { font-size: 1.05rem; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); box-shadow: 0 1px 2px rgb(79 70 229 / 0.3); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn.danger { color: var(--danger); }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 1.15rem; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 12px; max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ============ Landing (signed out) ============ */
body.landing { min-height: 100vh; background: var(--bg-accent), var(--bg); }
.landing-main { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 20px; }
.landing-card { width: min(520px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); padding: 40px 32px 32px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.logo-lg { font-size: 52px; color: var(--accent); display: grid; place-items: center; margin-bottom: 6px; }
.landing-card h1 { font-size: 1.6rem; }
.lead { color: var(--text-2); max-width: 34ch; }
.landing-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 10px; }
.landing-note { font-size: 0.85rem; color: var(--muted); max-width: 36ch; }
.landing-status { display: none; align-items: center; gap: 10px; color: var(--muted); font-size: 0.9rem; margin-top: 10px; }
.landing-card[data-state="loading"] .landing-actions, .landing-card[data-state="loading"] .landing-note { display: none; }
.landing-card[data-state="loading"] .landing-status { display: inline-flex; }
.landing-foot { color: var(--muted); font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; }
.landing-foot a { color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; }
.landing-foot a:hover { color: var(--accent); }
.landing-card.doc-card { width: min(760px, 100%); text-align: left; align-items: stretch; gap: 8px; padding: 32px 36px; }
.doc-card .back { align-self: flex-start; }
.doc-prose { margin-top: 4px; font-size: 0.95rem; }
.doc-prose h3 { font-size: 1.05rem; }
.doc-prose ul { padding-left: 1.2em; }
.site-foot { max-width: 960px; margin: 0 auto; padding: 0 16px 32px; text-align: center; color: var(--muted); font-size: 0.85rem; }
.site-foot a { color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; }
.site-foot a:hover { color: var(--accent); }
@media (max-width: 640px) { .landing-card.doc-card { padding: 24px 18px; } }
.intro-prose ul.rules { padding-left: 0; margin: 4px 0 1em; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Intro (experiment notice) ============ */
.pill.pill-experiment { background: color-mix(in srgb, #f59e0b 16%, transparent); color: #b45309; letter-spacing: 0.02em; }
@media (prefers-color-scheme: dark) { .pill.pill-experiment { color: #fbbf24; } }
.intro-prose { text-align: left; margin-top: 0; font-size: 0.95rem; line-height: 1.6; width: 100%; }
.intro-prose p, .intro-prose ul { margin: 0 0 0.8em; }
.intro-prose ul { padding-left: 1.2em; }
.intro-prose li { margin: 0.3em 0; }
.intro-prose > :last-child { margin-bottom: 0; }
.intro-prose strong { color: var(--text); }
.intro-card { background: linear-gradient(180deg, var(--accent-soft), transparent 80%), var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border)); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 14px 20px; margin-bottom: 16px; }
.intro-card summary { display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
.intro-card summary::-webkit-details-marker { display: none; }
.intro-card summary > span:last-child { display: flex; flex: 1; justify-content: space-between; align-items: center; gap: 12px; }
.intro-badge { font-size: 16px; color: var(--accent); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft); flex: none; }
.intro-badge svg { width: 16px; height: 16px; }
.intro-hint { text-decoration: underline; text-underline-offset: 3px; }
.intro-card[open] .intro-prose { margin-top: 12px; }

/* ============ App shell ============ */
.topbar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 960px; margin: 0 auto; height: 60px; padding: 0 16px; display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand svg { font-size: 28px; color: var(--accent); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav-link { padding: 7px 12px; border-radius: 9px; color: var(--muted); font-weight: 550; text-decoration: none; }
.nav-link:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-link[aria-current="page"] { color: var(--text); background: var(--accent-soft); }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.user-menu { position: relative; }
.avatar-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.avatar-btn:hover { border-color: var(--border-strong); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: 0.85rem; }
.avatar-name { font-weight: 550; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 40; }
.menu-head { display: flex; flex-direction: column; padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-item { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); }
.container { max-width: 960px; margin: 0 auto; padding: 28px 16px 64px; }

/* ============ Cycle card ============ */
.cycle-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.cycle-card.is-downtime { border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); background: linear-gradient(0deg, var(--warn-soft), var(--warn-soft)), var(--surface); }
.cycle-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 650; font-size: 0.8rem; }
.phase { font-weight: 650; }
.cycle-days { margin-left: auto; color: var(--muted); }
.cycle-days strong { color: var(--text); font-size: 1.1rem; }
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #c084fc)); border-radius: inherit; transition: width 0.6s ease; }
.cycle-note { color: var(--muted); font-size: 0.9rem; }

/* ============ Board ============ */
.board { margin-top: 32px; }
.board-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.board-tools { display: flex; align-items: center; gap: 10px; }
.segmented { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; }
.segmented button { border: 0; background: transparent; padding: 6px 14px; border-radius: 8px; color: var(--muted); font-weight: 550; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.idea-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.idea { display: flex; gap: 16px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); transition: border-color 0.15s, box-shadow 0.15s; }
.idea:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.idea.is-selected { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.vote { flex: none; width: 56px; height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); cursor: pointer; transition: all 0.15s; }
.vote svg { font-size: 1.25rem; }
.vote-count { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.vote:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.vote.is-voted { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.vote.is-voted .vote-count { color: var(--accent); }
.vote:disabled { cursor: default; }
.idea-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.idea-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.idea-title { font-size: 1.02rem; overflow-wrap: anywhere; }
.idea-problem { color: var(--text-2); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.idea-meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.85rem; flex-wrap: wrap; }
.idea-toggle { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 6px; font-size: 0.85rem; }
.idea-toggle:hover { color: var(--text); background: var(--surface-2); }
.idea-toggle svg { transition: transform 0.15s; }
.idea-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.idea-details { border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 4px; }
.behavior { white-space: pre-wrap; color: var(--text-2); font-size: 0.92rem; }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--success-soft); color: var(--success); font-size: 0.75rem; font-weight: 650; }
.skeleton { pointer-events: none; }
.skeleton > span { width: 56px; height: 64px; border-radius: 12px; background: var(--surface-2); }
.skeleton > div { flex: 1; display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.skeleton i { display: block; height: 12px; border-radius: 6px; background: var(--surface-2); }
.skeleton i:first-child { width: 45%; height: 14px; }
.skeleton i:last-child { width: 80%; }
.skeleton > span, .skeleton i { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }
.empty { list-style: none; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 48px 16px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.empty > svg, .empty-icon { font-size: 34px; color: var(--accent); display: grid; place-items: center; width: 60px; height: 60px; border-radius: 16px; background: var(--accent-soft); margin-bottom: 8px; }
.empty .btn { margin-top: 12px; }

/* ============ Drawer ============ */
.scrim { position: fixed; inset: 0; background: rgb(15 23 42 / 0.35); backdrop-filter: blur(2px); z-index: 45; animation: fade 0.15s ease; }
.drawer { position: fixed; top: 0; right: 0; height: 100dvh; width: min(460px, 100vw); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); z-index: 50; display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); visibility: hidden; }
.drawer.open { transform: none; visibility: visible; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 20px 14px; border-bottom: 1px solid var(--border); }
.quota { padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.quota-row { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--muted); margin-bottom: 6px; }
.meter { height: 5px; background: var(--border); border-radius: 999px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.3s; }
.meter span.is-full { background: var(--danger); }
.chat { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.bubble { padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 88%; font-size: 0.94rem; animation: rise 0.18s ease; }
.bubble.user { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 6px; }
.bubble.assistant { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.bubble.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.bubble.blocked { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.bubble.typing { display: inline-flex; gap: 4px; padding: 14px; }
.bubble.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: bounce 1.2s infinite; }
.bubble.typing i:nth-child(2) { animation-delay: 0.15s; }
.bubble.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 60%, 100% { transform: none; opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes rise { from { transform: translateY(4px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.brief { margin: 0 20px 12px; padding: 16px; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border)); background: linear-gradient(180deg, var(--accent-soft), transparent 70%), var(--surface); border-radius: var(--radius); display: flex; flex-direction: column; gap: 8px; max-height: 45vh; overflow-y: auto; animation: rise 0.2s ease; }
.brief ul { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 0.92rem; }
.brief .btn { margin-top: 6px; }
.eyebrow { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.composer { margin: 0 20px; display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 14px; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--surface); }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer textarea { flex: 1; border: 0; padding: 6px 0; resize: none; background: transparent; box-shadow: none; min-height: 24px; max-height: 160px; }
.composer textarea:focus { box-shadow: none; }
.send-btn { flex: none; width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; cursor: pointer; font-size: 1.1rem; }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.composer-hint { padding: 8px 20px 16px; font-size: 0.75rem; color: var(--muted); }

/* ============ Modals ============ */
.modal { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); width: min(520px, calc(100vw - 32px)); padding: 0; box-shadow: var(--shadow-lg); }
.modal::backdrop { background: rgb(15 23 42 / 0.45); backdrop-filter: blur(3px); }
.modal[open] { animation: rise 0.2s ease; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 22px 24px 0; }
.modal-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 1.2rem; }
.modal-icon svg { font-size: 26px; }
.modal-body { padding: 14px 24px 4px; display: flex; flex-direction: column; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 22px; }
.rules { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.rules li { position: relative; padding: 10px 12px 10px 36px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; font-size: 0.92rem; }
.rules li::before { content: ""; position: absolute; left: 13px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; border: 2px solid var(--accent); }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 4px 2px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
.wn-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.wn-list li { display: flex; flex-direction: column; padding: 12px; border: 1px solid var(--border); border-radius: 10px; }

/* ============ Toasts ============ */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 0.92rem; animation: rise 0.2s ease; transition: opacity 0.3s, transform 0.3s; }
.toast.success { background: var(--success); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }
.toast.leaving { opacity: 0; transform: translateY(6px); }

/* ============ Knowledge base & articles ============ */
.page-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.search { position: relative; display: flex; gap: 8px; margin-top: 10px; max-width: 520px; }
.search input { flex: 1; padding-left: 38px; height: 42px; }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); display: grid; }
.kb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.kb-item { display: flex; gap: 14px; align-items: center; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm); }
.kb-item:hover { border-color: var(--accent); text-decoration: none; }
.kb-item > span:last-child { display: flex; flex-direction: column; }
.kb-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; background: var(--accent-soft); color: var(--accent); font-size: 1.2rem; }
.article { max-width: 720px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 32px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 10px; }
.back { font-size: 0.9rem; color: var(--muted); }
.prose { margin-top: 10px; color: var(--text-2); line-height: 1.7; }
.prose h2, .prose h3, .prose h4 { color: var(--text); margin: 1.4em 0 0.5em; }
.prose p, .prose ul, .prose ol, .prose pre { margin: 0 0 1em; }
.prose code { font-family: var(--mono); font-size: 0.88em; background: var(--surface-2); padding: 2px 5px; border-radius: 5px; }
.prose pre { background: var(--surface-2); border: 1px solid var(--border); padding: 14px; border-radius: 10px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }

/* ============ Admin ============ */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab { border: 0; background: transparent; padding: 10px 14px; cursor: pointer; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.panel { display: flex; flex-direction: column; gap: 14px; }
.panel h2 { margin-top: 10px; }
.notice { background: var(--success-soft); color: var(--success); padding: 10px 14px; border-radius: var(--radius-sm); margin: 0 0 16px; }
.disclaimer { margin: 12px 0; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid color-mix(in srgb, #f59e0b 45%, var(--border)); background: color-mix(in srgb, #f59e0b 10%, var(--surface)); color: var(--text); font-size: 0.9rem; text-align: left; }
.notice.error { background: var(--danger-soft); color: var(--danger); }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-sm); min-width: 0; }
.card.dim { opacity: 0.55; }
.card h3 { overflow-wrap: anywhere; }
.card-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-top: 4px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow-sm); }
.stat span { color: var(--muted); font-size: 0.8rem; }
.stat strong { font-size: 1.05rem; overflow-wrap: anywhere; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.form-stack { display: flex; flex-direction: column; gap: 14px; max-width: 720px; }
.form-stack label { display: flex; flex-direction: column; gap: 6px; font-weight: 550; font-size: 0.9rem; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface-2); }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td code { white-space: pre-wrap; word-break: break-all; font-family: var(--mono); font-size: 0.8rem; }
textarea#banned-keywords { width: 100%; max-width: 480px; }

/* ============ Responsive ============ */
@media (max-width: 640px) {
  h1 { font-size: 1.45rem; }
  .topbar-inner { gap: 10px; }
  .brand span, .avatar-name { display: none; }
  .nav-link { padding: 7px 9px; }
  .container { padding-top: 18px; }
  .cycle-days { margin-left: 0; width: 100%; }
  .board-tools { width: 100%; justify-content: space-between; }
  .idea { gap: 12px; padding: 14px; }
  .vote { width: 48px; height: 58px; }
  .article { padding: 20px; }
  .landing-card { padding: 32px 20px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
