/* Đa Chat — design tokens */
:root {
  --bg: #fafafa;
  --bg-side: #f4f4f6;
  --surface: #ffffff;
  --surface-2: #f2f2f5;
  --surface-3: #e9e9ee;
  --line: rgba(15, 15, 30, .08);
  --line-2: rgba(15, 15, 30, .14);
  --ink: #111118;
  --ink-2: #565668;
  --ink-3: #8a8a9c;
  --accent: #6c5cff;
  --accent-ink: #ffffff;
  --grad: linear-gradient(135deg, #7c6cff 0%, #4f8cff 50%, #22c7b8 100%);
  --gold: #f5a524;
  --danger: #e5484d;
  --ok: #12a594;
  --shadow-sm: 0 1px 2px rgba(16, 16, 40, .06);
  --shadow: 0 1px 2px rgba(16, 16, 40, .04), 0 6px 24px -6px rgba(16, 16, 40, .10);
  --shadow-lg: 0 24px 64px -12px rgba(16, 16, 40, .22);
  --glow: radial-gradient(60% 50% at 50% 0%, rgba(108, 92, 255, .10), transparent 70%);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --r: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #09090c; --bg-side: #0d0d11; --surface: #131318; --surface-2: #1a1a21; --surface-3: #23232c;
    --line: rgba(255, 255, 255, .07); --line-2: rgba(255, 255, 255, .13);
    --ink: #ededf3; --ink-2: #a3a3b5; --ink-3: #6c6c7e;
    --accent: #8b7dff; --accent-ink: #0b0b10; --danger: #ff6369; --ok: #3dd6c3;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px -8px rgba(0,0,0,.5);
    --shadow-lg: 0 30px 80px -10px rgba(0,0,0,.7);
    --glow: radial-gradient(60% 55% at 50% 0%, rgba(124, 108, 255, .16), transparent 70%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #09090c; --bg-side: #0d0d11; --surface: #131318; --surface-2: #1a1a21; --surface-3: #23232c;
  --line: rgba(255, 255, 255, .07); --line-2: rgba(255, 255, 255, .13);
  --ink: #ededf3; --ink-2: #a3a3b5; --ink-3: #6c6c7e;
  --accent: #8b7dff; --accent-ink: #0b0b10; --danger: #ff6369; --ok: #3dd6c3;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px -8px rgba(0,0,0,.5);
  --shadow-lg: 0 30px 80px -10px rgba(0,0,0,.7);
  --glow: radial-gradient(60% 55% at 50% 0%, rgba(124, 108, 255, .16), transparent 70%);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14.5px/1.6 var(--font); font-feature-settings: "cv11", "ss01", "ss03"; -webkit-font-smoothing: antialiased; letter-spacing: -.006em; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.hidden { display: none !important; }
.muted { color: var(--ink-2); }
.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i.sm { width: 14px; height: 14px; }
.i.lg { width: 18px; height: 18px; }
kbd { font: 500 10.5px var(--mono); color: var(--ink-3); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; line-height: 16px; }
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }

.app { display: grid; grid-template-columns: 268px 1fr; height: 100dvh; }

/* ---------- avatars ---------- */
.av { --c: var(--accent); width: 24px; height: 24px; border-radius: 8px; flex: none; display: inline-grid; place-items: center; font: 700 11px/1 var(--font); color: #fff; background: linear-gradient(140deg, var(--c), color-mix(in srgb, var(--c) 68%, #000)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.15), 0 1px 2px rgba(0,0,0,.2); letter-spacing: 0; }
.av.lg { width: 30px; height: 30px; border-radius: 9px; font-size: 13px; }
.av.xs { width: 18px; height: 18px; border-radius: 6px; font-size: 9px; }
.av-stack { display: inline-flex; }
.av-stack .av { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface), inset 0 0 0 1px rgba(255,255,255,.15); }
.av-stack .av:first-child { margin-left: 0; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 550; font-size: 13.5px; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s, color .15s, transform .08s, box-shadow .15s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: transparent; }
.btn.primary:hover { background: color-mix(in srgb, var(--ink) 85%, var(--bg)); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.icon { width: 34px; padding: 0; }
.btn.tiny { height: 28px; padding: 0 9px; font-size: 12.5px; border-radius: 8px; gap: 5px; }
.btn.tiny.icon { width: 28px; padding: 0; }
.btn.block { width: 100%; }
.btn.grad { border: 1px solid transparent; background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad) border-box; color: var(--ink); box-shadow: 0 6px 20px -8px color-mix(in srgb, var(--accent) 50%, transparent); }
.btn.grad:hover { background: linear-gradient(var(--surface-2), var(--surface-2)) padding-box, var(--grad) border-box; }
.btn.grad .i { color: var(--accent); }
.danger-text { color: var(--danger) !important; }

/* ---------- sidebar ---------- */
.sidebar { background: var(--bg-side); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; padding: 14px 12px 12px; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 6px; }
.mark { width: 28px; height: 28px; position: relative; flex: none; }
.mark i { position: absolute; width: 16px; height: 16px; border-radius: 50%; }
.mark i:nth-child(1) { left: 0; top: 2px; background: #7c6cff; }
.mark i:nth-child(2) { left: 12px; top: 2px; background: #22c7b8; opacity: .85; }
.mark i:nth-child(3) { left: 6px; top: 11px; background: #4f8cff; opacity: .8; }
.brand-name { font-weight: 700; font-size: 15.5px; letter-spacing: -.02em; }
.brand-tag { font: 500 10px var(--mono); color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 6px; padding: 1px 6px; margin-left: auto; }
.new-chat { justify-content: flex-start; height: 36px; }
.new-chat kbd { margin-left: auto; }
.search-wrap { position: relative; }
.search-wrap .i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search { width: 100%; height: 34px; padding: 0 10px 0 32px; border-radius: 10px; border: 1px solid transparent; background: var(--surface-2); outline: none; font-size: 13.5px; }
.search:focus { border-color: var(--line-2); background: var(--surface); }
.search::placeholder { color: var(--ink-3); }
.conv-list { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.conv-group { font-size: 11px; font-weight: 600; color: var(--ink-3); margin: 14px 8px 4px; }
.conv { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 6px 0 10px; border-radius: 9px; cursor: pointer; color: var(--ink-2); position: relative; }
.conv:hover { background: var(--surface-2); color: var(--ink); }
.conv.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); }
.conv-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.conv-dots { display: flex; gap: 3px; }
.conv-dots i { width: 5px; height: 5px; border-radius: 50%; }
.conv-del { display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 6px; background: none; color: var(--ink-3); opacity: 0; }
.conv:hover .conv-del { opacity: 1; }
.conv-del:hover { background: var(--surface-3); color: var(--danger); }
.empty-list { color: var(--ink-3); font-size: 13px; padding: 16px 10px; line-height: 1.5; }
.side-foot { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--line); padding-top: 10px; }
.nav-item { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 9px; border: 0; background: none; color: var(--ink-2); font-size: 13.5px; font-weight: 500; text-align: left; width: 100%; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item .end { margin-left: auto; }
.byok { margin: 6px 2px 0; padding: 10px 12px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); font-size: 12px; color: var(--ink-2); display: flex; gap: 9px; align-items: flex-start; line-height: 1.45; }
.byok .i { color: var(--ok); margin-top: 1px; }

/* ---------- main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; background: var(--glow), var(--bg); }
.topbar { display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 14px 0 18px; border-bottom: 1px solid var(--line); flex: none; }
.main.is-empty .topbar { border-bottom-color: transparent; }
.top-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.top-meta { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.top-meta .av-stack .av { box-shadow: 0 0 0 2px var(--bg), inset 0 0 0 1px rgba(255,255,255,.15); }
.spacer { flex: 1; }
.only-mobile { display: none !important; }

.thread { flex: 1; overflow-y: auto; padding: 28px 24px 24px; }
.turn { max-width: 1440px; margin: 0 auto 36px; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.user-row { max-width: 1000px; margin: 0 auto 16px; display: flex; justify-content: flex-end; }
.user-msg { max-width: min(680px, 100%); background: var(--surface-2); border: 1px solid var(--line); border-radius: 18px 18px 6px 18px; padding: 10px 15px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; }

.replies { display: grid; align-items: start; gap: 14px; grid-auto-flow: column; grid-auto-columns: minmax(290px, 1fr); overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 2px 6px; }
.replies.single { grid-auto-columns: minmax(0, 820px); justify-content: center; }
.card { --seat: var(--accent); position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 0; scroll-snap-align: start; transition: border-color .2s, box-shadow .2s; }
.card::before { content: ""; position: absolute; inset: -1px 12px auto; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--seat), transparent); background-size: 200% 100%; opacity: 0; transition: opacity .3s; }
.card.streaming::before { opacity: 1; animation: sweep 1.4s linear infinite; }
@keyframes sweep { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.card:hover { border-color: var(--line-2); }
.card.best { border-color: color-mix(in srgb, var(--gold) 60%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 14%, transparent), var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 11px 12px 10px 14px; min-height: 52px; }
.card-head .who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.card-head .name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; }
.card-head .prov { color: var(--ink-3); font-size: 11.5px; }
.card-head .stats { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.stat { font: 500 10.5px var(--mono); color: var(--ink-3); background: var(--surface-2); border-radius: 6px; padding: 2px 6px; white-space: nowrap; display: inline-flex; gap: 3px; align-items: center; }
.stat .i { width: 11px; height: 11px; }
.stat.live { color: var(--seat); background: color-mix(in srgb, var(--seat) 12%, transparent); }
.crown { color: var(--gold); display: none; }
.card.best .crown { display: inline-flex; }
.card-body { padding: 0 16px 14px; overflow-wrap: anywhere; min-height: 64px; font-size: 14.5px; line-height: 1.7; }
.card-foot { display: flex; gap: 2px; padding: 6px 8px; border-top: 1px solid var(--line); opacity: .7; transition: opacity .15s; }
.card:hover .card-foot, .card-foot:focus-within { opacity: 1; }
.card-foot:empty { display: none; }
.card-foot .btn { background: transparent; border-color: transparent; color: var(--ink-2); }
.card-foot .btn:hover { background: var(--surface-2); color: var(--ink); }
.card-foot .btn.on { color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, transparent); }
.card-foot .sep { flex: 1; }
.err-box { display: flex; gap: 10px; background: color-mix(in srgb, var(--danger) 8%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 22%, transparent); border-radius: 11px; padding: 11px 12px; margin-top: 4px; font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.err-box .i { color: var(--danger); margin-top: 2px; }
.err-box b { display: block; color: var(--ink); font-weight: 600; }
.thinking-wrap summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); cursor: pointer; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); margin-bottom: 4px; }
.thinking-wrap summary::-webkit-details-marker { display: none; }
.thinking { font-size: 12.5px; color: var(--ink-3); border-left: 2px solid var(--line-2); padding-left: 10px; margin: 6px 0 10px; max-height: 180px; overflow: auto; white-space: pre-wrap; }
.status-note { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); margin-top: 8px; }

.typing { display: inline-flex; gap: 5px; padding: 10px 0 6px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--seat); animation: bob 1.1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bob { 0%, 80%, 100% { transform: scale(.6); opacity: .35; } 40% { transform: scale(1); opacity: 1; } }
.streaming .card-body > :last-child::after { content: ""; display: inline-block; width: 7px; height: 1.05em; vertical-align: -.15em; margin-left: 3px; border-radius: 2px; background: var(--seat); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.turn-actions { display: flex; justify-content: center; margin-top: 14px; }
.turn-actions:empty { display: none; }
.synth { max-width: 820px; margin: 16px auto 0; border: 1px solid transparent; background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad) border-box; box-shadow: 0 10px 40px -12px color-mix(in srgb, var(--accent) 40%, transparent); }
.synth .av { background: var(--grad); }

/* ---------- markdown ---------- */
.md > :first-child { margin-top: 0; }
.md p { margin: .65em 0; }
.md h1, .md h2, .md h3, .md h4 { line-height: 1.3; margin: 1.1em 0 .45em; letter-spacing: -.015em; font-weight: 650; }
.md h1 { font-size: 1.25em; } .md h2 { font-size: 1.12em; } .md h3 { font-size: 1.02em; }
.md ul, .md ol { padding-left: 1.3em; margin: .6em 0; }
.md li { margin: .25em 0; }
.md li::marker { color: var(--ink-3); }
.md strong { font-weight: 650; }
.md blockquote { margin: .8em 0; padding: .1em 0 .1em 14px; border-left: 2px solid var(--accent); color: var(--ink-2); }
.md code { font: .86em var(--mono); background: var(--surface-2); border: 1px solid var(--line); padding: .08em .35em; border-radius: 5px; }
.md pre { position: relative; background: #0c0c11; color: #e6e6ef; border: 1px solid rgba(255,255,255,.06); border-radius: 11px; padding: 14px 16px; overflow-x: auto; margin: .9em 0; }
.md pre code { background: none; border: 0; padding: 0; font-size: 12.5px; line-height: 1.6; color: inherit; }
.md pre code.hljs { background: none; padding: 0; }
.md pre .copy-code { position: absolute; top: 7px; right: 7px; font: 500 11px var(--font); background: rgba(255,255,255,.08); color: #cfcfdb; border: 1px solid rgba(255,255,255,.08); border-radius: 7px; padding: 3px 8px; opacity: 0; transition: opacity .15s; }
.md pre:hover .copy-code { opacity: 1; }
.md table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13.5px; display: block; overflow-x: auto; margin: .9em 0; border: 1px solid var(--line); border-radius: 10px; }
.md th, .md td { padding: 7px 11px; text-align: left; border-bottom: 1px solid var(--line); }
.md tr:last-child td { border-bottom: 0; }
.md th { background: var(--surface-2); font-weight: 600; font-size: 12.5px; color: var(--ink-2); }
.md a { color: var(--accent); text-underline-offset: 2px; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }

/* ---------- empty / hero ---------- */
.main.is-empty .thread { display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: 10px; }
.main.is-empty .composer-wrap { flex: 1; padding-top: 6px; }
.hero { max-width: 760px; width: 100%; margin: 0 auto; text-align: center; animation: rise .5s ease both; }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); padding: 4px 12px 4px 5px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); margin-bottom: 22px; }
.hero-badge b { font-weight: 600; color: var(--ink); background: var(--surface-2); border-radius: 999px; padding: 1px 8px; font-size: 11.5px; }
.hero h1 { font-size: clamp(32px, 5.4vw, 56px); line-height: 1.06; letter-spacing: -.045em; margin: 0 0 14px; font-weight: 700; }
.hero h1 .g { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 15.5px; color: var(--ink-2); max-width: 540px; margin: 0 auto 6px; line-height: 1.6; }
.extras { max-width: 860px; margin: 16px auto 0; }
.starters { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.starter { display: flex; align-items: center; gap: 11px; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; color: var(--ink-2); transition: border-color .15s, color .15s, transform .15s, box-shadow .15s; }
.starter:hover { border-color: var(--line-2); color: var(--ink); transform: translateY(-1px); box-shadow: var(--shadow); }
.starter .si { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); flex: none; }
.features { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 22px; margin-top: 22px; font-size: 12.5px; color: var(--ink-3); }
.features span { display: inline-flex; align-items: center; gap: 7px; }
.demo-banner { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 16px auto 0; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.demo-banner .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }

/* ---------- composer ---------- */
.composer-wrap { padding: 8px 20px calc(14px + env(safe-area-inset-bottom)); flex: none; }
.composer { max-width: 860px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--line-2)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent), var(--shadow); }
.composer textarea { display: block; width: 100%; border: 0; outline: none; background: transparent; resize: none; padding: 14px 16px 6px; max-height: 260px; line-height: 1.55; font-size: 15px; }
.composer textarea::placeholder { color: var(--ink-3); }
.composer-bar { display: flex; align-items: center; gap: 6px; padding: 6px 8px 8px; }
.seat-btn { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px 0 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-size: 12.5px; font-weight: 550; color: var(--ink-2); }
.seat-btn:hover { color: var(--ink); border-color: var(--line-2); }
.seat-btn .av-stack .av { box-shadow: 0 0 0 2px var(--surface-2), inset 0 0 0 1px rgba(255,255,255,.15); }
.seat-btn .warn { color: var(--gold); }
.select-wrap { position: relative; display: inline-flex; align-items: center; }
.select-wrap .i { position: absolute; pointer-events: none; color: var(--ink-3); }
.select-wrap .i.l { left: 9px; } .select-wrap .i.r { right: 8px; width: 13px; height: 13px; }
.persona { appearance: none; height: 32px; border: 1px solid transparent; border-radius: 10px; padding: 0 26px 0 30px; background: transparent; color: var(--ink-2); font-size: 12.5px; font-weight: 550; max-width: 210px; cursor: pointer; outline: none; }
.persona:hover, .persona:focus-visible { background: var(--surface-2); color: var(--ink); }
.persona option { background: var(--surface); color: var(--ink); }
.send { width: 34px; height: 34px; border-radius: 11px; border: 0; display: grid; place-items: center; background: var(--ink); color: var(--bg); transition: transform .1s, opacity .15s; }
.send:hover { transform: scale(1.05); }
.send:disabled { opacity: .25; transform: none; cursor: default; }
.stop { width: 34px; height: 34px; border-radius: 11px; border: 1px solid var(--line-2); display: grid; place-items: center; background: var(--surface-2); color: var(--ink); }
.stop .i { fill: currentColor; stroke: none; width: 12px; height: 12px; }
.composer-note { max-width: 860px; margin: 8px auto 0; font-size: 11.5px; color: var(--ink-3); text-align: center; }
.composer-note a { color: var(--ink-2); }

/* ---------- dialogs ---------- */
.dlg { border: 1px solid var(--line-2); border-radius: 18px; padding: 0; background: var(--surface); color: var(--ink); width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); }
.dlg[open] { animation: pop .18s ease; }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(4px); } }
.dlg.wide { width: min(720px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(5, 5, 10, .55); backdrop-filter: blur(4px); }
.dlg-body { padding: 0; display: flex; flex-direction: column; max-height: 86dvh; margin: 0; }
.dlg-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 20px 14px; }
.dlg-head h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.02em; }
.dlg-head p { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.dlg-head .btn { margin-left: auto; flex: none; margin-top: -4px; margin-right: -6px; }
.dlg-content { padding: 0 20px 6px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); margin-top: 10px; }
.field { width: 100%; height: 36px; border: 1px solid var(--line-2); background: var(--bg); border-radius: 10px; padding: 0 11px; outline: none; font-size: 13.5px; transition: border-color .15s, box-shadow .15s; }
.field:focus { border-color: color-mix(in srgb, var(--accent) 60%, var(--line-2)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
textarea.field { height: auto; padding: 10px 11px; resize: vertical; line-height: 1.5; }
select.field { appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8a9c' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
select.field option { background: var(--surface); }
.presets-label { font-size: 11.5px; font-weight: 600; color: var(--ink-3); margin-bottom: -4px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.preset { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 11px 0 6px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font-size: 12.5px; font-weight: 550; color: var(--ink); }
.preset:hover { background: var(--surface-2); }
.preset.dim { color: var(--ink-3); }
.preset .av-stack .av { box-shadow: 0 0 0 2px var(--surface), inset 0 0 0 1px rgba(255,255,255,.15); }
.seat-rows { display: flex; flex-direction: column; gap: 8px; }
.seat-row { display: grid; grid-template-columns: 24px 150px 1fr 34px; gap: 8px; align-items: center; }
.seat-row [data-rm] { grid-column: 4; grid-row: 1; }
.add-seat { border: 1px dashed var(--line-2); background: transparent; color: var(--ink-2); height: 38px; border-radius: 10px; font-size: 13px; font-weight: 550; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.add-seat:hover:not(:disabled) { color: var(--ink); border-color: var(--ink-3); }
.add-seat:disabled { opacity: .4; cursor: default; }
.check { display: flex; gap: 9px; align-items: center; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }
.notice { display: flex; gap: 10px; font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); border-radius: 11px; padding: 10px 12px; line-height: 1.5; }
.notice .i { color: var(--ok); margin-top: 1px; }
.provider-rows { display: flex; flex-direction: column; gap: 8px; }
.provider-rows .prov { border: 1px solid var(--line); border-radius: 13px; padding: 12px; display: grid; gap: 9px; background: var(--surface); }
.provider-rows .prov:focus-within { border-color: var(--line-2); }
.prov-head { display: flex; align-items: center; gap: 10px; }
.prov-head b { font-size: 14px; font-weight: 600; }
.prov-head a { margin-left: auto; font-size: 12px; color: var(--ink-2); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.prov-head a:hover { color: var(--accent); }
.prov-line { display: flex; gap: 8px; }
.prov-line .field { flex: 1; font-family: var(--mono); font-size: 12.5px; }
.provider-rows .prov small { color: var(--ink-3); font-size: 11.5px; line-height: 1.5; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-3); font-weight: 550; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.pill.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.pill.bad { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.sub { border: 1px solid var(--line); border-radius: 13px; padding: 4px 12px; }
.sub summary { cursor: pointer; font-weight: 600; font-size: 13.5px; padding: 8px 0; list-style: none; display: flex; align-items: center; gap: 8px; }
.sub summary::-webkit-details-marker { display: none; }
.sub summary .i.r { margin-left: auto; transition: transform .2s; color: var(--ink-3); }
.sub[open] summary .i.r { transform: rotate(180deg); }
.sub > :last-child { margin-bottom: 12px; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.board-row { display: grid; grid-template-columns: 24px 30px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.board-row:last-child { border-bottom: 0; }
.board-row .rank { font: 600 12px var(--mono); color: var(--ink-3); text-align: center; }
.board-row .rank.top { color: var(--gold); }
.board-row .nm { font-weight: 600; font-size: 13.5px; }
.board-row .nm small { color: var(--ink-3); font-weight: 500; margin-left: 4px; }
.bar-track { height: 5px; border-radius: 3px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.bar { height: 100%; border-radius: 3px; background: var(--grad); }
.board-row .num { text-align: right; font: 500 12px var(--mono); color: var(--ink-2); }
.board-row .num small { display: block; color: var(--ink-3); font-size: 10.5px; }
.board-empty { text-align: center; padding: 28px 0 18px; color: var(--ink-2); font-size: 13.5px; }
.board-empty .i { width: 28px; height: 28px; color: var(--gold); margin-bottom: 8px; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 12px); background: var(--ink); color: var(--bg); padding: 9px 15px; border-radius: 11px; font-size: 13px; font-weight: 500; opacity: 0; pointer-events: none; transition: .2s ease; z-index: 100; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.scrim { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 284px; z-index: 50; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
  .only-mobile { display: inline-flex !important; }
  .topbar { padding: 0 8px; }
  .top-meta { display: none; }
  .thread { padding: 18px 12px 16px; }
  .replies { grid-auto-columns: 88%; gap: 10px; }
  .replies.single { grid-auto-columns: 100%; }
  .starters { grid-template-columns: 1fr; }
  .starter:nth-child(n+3) { display: none; }
  .features { display: none; }
  .seat-row { grid-template-columns: 24px 1fr 34px; }
  .seat-row .field[data-f="m"] { grid-column: 2 / 4; grid-row: 2; }
  .seat-row [data-rm] { grid-column: 3; }
  .composer-wrap { padding: 6px 10px calc(10px + env(safe-area-inset-bottom)); }
  .persona { max-width: 130px; }
  .seat-btn .lbl { display: none; }
  .hero h1 { font-size: 34px; }
}
