:root {
  --bg: #F5F4EF;
  --surface: #FFFFFF;
  --surface-2: #FAFAF7;
  --ink: #1C1F26;
  --ink-2: #454B59;
  --ink-3: #636A78;
  --line: #E4E2DA;
  --line-2: #D6D3C9;
  --accent: #3A4FD8;
  --accent-ink: #2C3DB3;
  --accent-soft: #EEF0FD;
  --ok: #0F7B61;
  --ok-soft: #E6F4EF;
  --warn: #A45A06;
  --warn-soft: #FDF3E4;
  --danger: #B42E24;
  --danger-soft: #FCECEA;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(28, 31, 38, .05), 0 6px 20px rgba(28, 31, 38, .06);
  --shadow-lg: 0 20px 60px rgba(28, 31, 38, .18);
  --font: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  --header: 60px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 17px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent-ink); text-underline-offset: 3px; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0; font-weight: 700; }
p { margin: 0; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; border-radius: 6px; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 600; font-size: 16px;
  text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: rgba(28, 31, 38, .05); color: var(--ink); }
.btn.soft { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.btn.soft:hover { background: #E2E6FC; }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 15px; border-radius: 8px; }
.btn.tiny { min-height: 30px; padding: 0 10px; font-size: 14px; border-radius: 8px; font-weight: 600; }
.btn.lg { min-height: 50px; padding: 0 22px; font-size: 17px; border-radius: 12px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  border: 0; background: transparent; cursor: pointer; color: var(--ink-2); position: relative; font-size: 19px;
}
.icon-btn:hover { background: rgba(28, 31, 38, .06); color: var(--ink); }
.badge {
  position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; line-height: 18px; text-align: center;
}
.field { display: grid; gap: 6px; }
.field > span { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--ink-3); font-size: 14px; }
.input, .textarea, .select {
  width: 100%; min-height: 44px; padding: 9px 13px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; font-size: 16px;
}
.textarea { resize: vertical; line-height: 1.6; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pw { position: relative; }
.pw .input { padding-right: 48px; }
.pw button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.err { color: var(--danger); font-size: 15px; min-height: 1em; }
.muted { color: var(--ink-3); }
.small { font-size: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.switch { position: relative; width: 40px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #CFCCC2; border-radius: 12px; cursor: pointer; transition: background .15s; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 3px solid var(--accent-soft); }

.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot { min-height: 100vh; display: grid; place-items: center; }

/* ---------- toast & modal ---------- */
#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #1F2330; color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 15px; z-index: 90;
  transition: opacity .2s, transform .2s; max-width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow-lg);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--danger); }
.modal-back {
  position: fixed; inset: 0; background: rgba(20, 22, 30, .42); z-index: 80; display: grid; place-items: center; padding: 20px;
  animation: fade .15s ease-out;
}
.modal {
  width: min(620px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border-radius: 18px;
  box-shadow: var(--shadow-lg); padding: 26px 26px 22px; animation: pop .18s ease-out;
}
.modal.wide { width: min(860px, 100%); }
.modal header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.modal header h2 { font-size: 22px; flex: 1; }
.modal header p { color: var(--ink-3); font-size: 15px; margin-top: 4px; }
.modal footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.modal .stack { display: grid; gap: 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--header); display: flex; align-items: center; gap: 12px;
  padding: 0 20px; background: rgba(245, 244, 239, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.logo { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; flex: none; }
.logo svg { width: 22px; height: 22px; }
.userchip {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; background: transparent; cursor: pointer;
  padding: 4px 8px 4px 4px; border-radius: 22px; max-width: 180px;
}
.userchip:hover { background: rgba(28, 31, 38, .05); }
.userchip b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 15px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font-weight: 700; font-size: 15px; color: #fff; background: #7A8194; position: relative; user-select: none;
}
.avatar.sm { width: 28px; height: 28px; font-size: 13px; }
.avatar.xs { width: 24px; height: 24px; font-size: 12px; }
.avatar.ai { border-radius: 10px; font-size: 18px; }
.avatar.ai.sm { border-radius: 8px; font-size: 15px; }
.avatar.ai.xs { border-radius: 7px; font-size: 13px; }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: #22A06B; border: 2px solid var(--bg); }
.menu {
  position: absolute; z-index: 60; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 6px; animation: pop .12s ease-out;
}
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 10px; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 15px; color: var(--ink); text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--surface-2); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.menu .head { padding: 8px 12px 6px; font-size: 14px; color: var(--ink-3); }

/* ---------- landing ---------- */
.landing { max-width: 1180px; margin: 0 auto; padding: 0 24px 64px; }
.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center; padding: 64px 0 56px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); padding: 5px 12px; border-radius: 20px; }
.hero h1 { font-size: 52px; letter-spacing: -.5px; margin: 20px 0 18px; line-height: 1.15; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lead { font-size: 19px; color: var(--ink-2); max-width: 34em; }
.hero .cta { display: flex; gap: 12px; margin-top: 30px; flex-wrap: wrap; }
.hero .note { margin-top: 14px; color: var(--ink-3); font-size: 15px; }
.preview { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 20px; border: 1px solid var(--line); transform: rotate(.4deg); }
.preview .q { display: flex; gap: 10px; padding-bottom: 14px; border-bottom: 1px dashed var(--line); }
.preview .q p { font-size: 16px; }
.preview .experts { display: flex; gap: 6px; margin: 14px 0 12px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; padding: 3px 10px 3px 4px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--line); }
.pill .avatar { width: 22px; height: 22px; font-size: 12px; border-radius: 6px; }
.pill.done::after { content: "✓"; color: var(--ok); font-weight: 700; }
.synth-mini { background: var(--accent-soft); border-radius: 14px; padding: 14px 16px; }
.synth-mini h4 { font-size: 15px; color: var(--accent-ink); margin-bottom: 6px; }
.synth-mini ul { margin: 6px 0 0; padding-left: 20px; font-size: 15px; color: var(--ink-2); }
.synth-mini .vs { margin-top: 10px; font-size: 15px; background: #fff; border-radius: 10px; padding: 8px 12px; border-left: 3px solid var(--warn); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.step .n { width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; margin-bottom: 12px; }
.step h3 { font-size: 19px; margin-bottom: 6px; }
.step p { color: var(--ink-2); font-size: 16px; }
.section-title { font-size: 26px; margin: 8px 0 18px; }
.why { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 40px; }
.why div { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.why b { display: block; margin-bottom: 4px; }
.why p { color: var(--ink-2); font-size: 16px; }
.foot { text-align: center; color: var(--ink-3); font-size: 14px; padding: 36px 0 0; }

/* ---------- auth ---------- */
.auth-wrap { min-height: calc(100vh - var(--header)); display: grid; place-items: center; padding: 32px 16px; }
.auth { width: min(440px, 100%); background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); padding: 30px; border: 1px solid var(--line); }
.auth h1 { font-size: 26px; margin-bottom: 6px; }
.auth .sub { color: var(--ink-3); margin-bottom: 22px; font-size: 16px; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); padding: 4px; border-radius: 12px; margin-bottom: 20px; }
.tabs button { flex: 1; border: 0; background: none; padding: 8px 10px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--ink-3); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.auth form { display: grid; gap: 14px; }
.invite-card { background: var(--accent-soft); border-radius: 14px; padding: 14px 16px; margin-bottom: 18px; }
.invite-card b { display: block; font-size: 18px; }
.invite-card p { color: var(--ink-2); font-size: 15px; }

/* ---------- home ---------- */
.page { max-width: 1120px; margin: 0 auto; padding: 32px 24px 64px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; }
.page-head p { color: var(--ink-3); margin-top: 4px; }
.block { margin-top: 30px; }
.block > h2 { font-size: 19px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.block > h2 .count { font-size: 14px; color: var(--ink-3); font-weight: 600; }
.todo { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.todo a { display: flex; align-items: center; gap: 12px; padding: 13px 18px; color: var(--ink); text-decoration: none; border-top: 1px solid var(--line); }
.todo a:first-child { border-top: 0; }
.todo a:hover { background: var(--surface-2); }
.todo .where { color: var(--ink-3); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 38%; }
.todo .what { flex: 1; min-width: 0; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 6px; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.tag.red { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.tag.amber { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.green { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag.blue { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; position: relative; min-height: 190px;
}
.card:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.card h3 { font-size: 19px; padding-right: 40px; }
.card .goal { color: var(--ink-2); font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .faces { display: flex; gap: 4px; margin-top: auto; flex-wrap: wrap; }
.card .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 14px; color: var(--ink-3); }
.card .unread { position: absolute; top: 18px; right: 18px; }
.card.new { border-style: dashed; border-width: 2px; align-items: center; justify-content: center; text-align: center; color: var(--ink-2); cursor: pointer; background: transparent; }
.card.new b { font-size: 18px; color: var(--ink); }
.card.demo { background: linear-gradient(135deg, #F4F5FE, #FFFFFF 60%); }
.empty-hero { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 36px; display: grid; gap: 12px; justify-items: start; }
.empty-hero h2 { font-size: 26px; }
.empty-hero p { color: var(--ink-2); max-width: 36em; }
details.more { margin-top: 26px; }
details.more summary { cursor: pointer; color: var(--ink-3); font-weight: 600; }

/* ---------- room ---------- */
.room { display: grid; grid-template-columns: minmax(0, 1fr) 420px; height: calc(100dvh - var(--header)); }
.room-head {
  position: sticky; top: 0; z-index: 30; height: var(--header); display: flex; align-items: center; gap: 10px;
  padding: 0 14px 0 10px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.room-title { min-width: 0; flex: 1; display: flex; align-items: center; gap: 10px; }
.room-title h1 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-title .goal-inline { color: var(--ink-3); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.faces-btn { display: inline-flex; align-items: center; border: 0; background: none; cursor: pointer; padding: 4px; border-radius: 20px; }
.faces-btn .avatar { margin-left: -8px; border: 2px solid var(--surface); }
.faces-btn .avatar:first-child { margin-left: 0; }
.faces-btn .more { font-size: 13px; color: var(--ink-3); margin-left: 6px; font-weight: 600; }
.main-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.stream { flex: 1; overflow-y: auto; padding: 22px 28px 12px; scroll-behavior: auto; }
.stream-inner { max-width: 880px; margin: 0 auto; display: grid; gap: 4px; }
.side { border-left: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.side-tabs { display: flex; gap: 2px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); }
.side-tabs button { border: 0; background: none; padding: 10px 14px 11px; cursor: pointer; font-weight: 700; color: var(--ink-3); border-bottom: 3px solid transparent; font-size: 16px; display: inline-flex; gap: 6px; align-items: center; }
.side-tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--accent); }
.side-tabs .n { font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 0 7px; color: var(--ink-3); }
.side-tabs .n.hot { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.side-body { flex: 1; overflow-y: auto; padding: 18px 18px 40px; }
.mobile-tabs { display: none; }

/* messages */
.msg { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 12px; padding: 10px 10px; border-radius: 12px; position: relative; }
.msg:hover { background: rgba(255, 255, 255, .6); }
.msg .who { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.msg .who b { font-size: 16px; }
.msg .who .t { font-size: 13px; color: var(--ink-3); }
.msg .who .model { font-size: 13px; color: var(--ink-3); }
.msg .body { min-width: 0; }
.msg .actions { position: absolute; top: 6px; right: 8px; display: none; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 2px; box-shadow: var(--shadow); }
.msg:hover .actions, .msg:focus-within .actions { display: flex; }
.msg .actions button { border: 0; background: none; cursor: pointer; font-size: 14px; padding: 4px 9px; border-radius: 7px; color: var(--ink-2); white-space: nowrap; }
.msg .actions button:hover { background: var(--surface-2); color: var(--ink); }
.msg.ai .md { border-left: 3px solid var(--c, var(--accent)); padding-left: 14px; }
.msg.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 30% { background: #FFF6D6; } }
.reply-ref { display: inline-flex; gap: 6px; font-size: 14px; color: var(--ink-3); margin-bottom: 2px; cursor: pointer; border: 0; background: none; padding: 0; text-align: left; }
.reply-ref:hover { color: var(--accent-ink); }
.notice { text-align: center; color: var(--ink-3); font-size: 14px; padding: 8px 0; }
.notice span { background: rgba(28, 31, 38, .04); padding: 4px 12px; border-radius: 14px; display: inline-block; max-width: 100%; }
.day { text-align: center; margin: 14px 0 6px; font-size: 13px; color: var(--ink-3); font-weight: 600; }
.errbox { margin-top: 6px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--danger); font-size: 15px; background: var(--danger-soft); padding: 8px 12px; border-radius: 10px; }
.thinking { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 15px; padding: 4px 0; }
.dots i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 3px; animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.thinking .note { color: var(--warn); font-size: 14px; }
.cursor::after { content: "▍"; color: var(--accent); animation: blink 1s infinite; margin-left: 1px; }

/* roundtable */
.rt { margin: 6px 0 10px 50px; border: 1px solid var(--line); background: var(--surface); border-radius: 16px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.rt-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: var(--surface-2); }
.rt-head h3 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.rt-status { display: flex; gap: 6px; flex-wrap: wrap; }
.rt-status .pill { cursor: pointer; background: #fff; }
.rt-status .pill.run { border-color: var(--line-2); }
.rt-status .pill.run::after { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.rt-status .pill.bad::after { content: "!"; color: var(--danger); font-weight: 800; }
.synth { padding: 16px 20px 18px; background: linear-gradient(180deg, #F3F5FF, #FFFFFF); border-bottom: 1px solid var(--line); }
.synth .label { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--accent-ink); font-size: 15px; margin-bottom: 8px; flex-wrap: wrap; }
.synth .label .model { color: var(--ink-3); font-weight: 400; font-size: 13px; }
.synth.waiting { color: var(--ink-3); font-size: 15px; }
.answers { display: grid; }
.answer { border-top: 1px solid var(--line); padding: 14px 18px 12px; position: relative; }
.answer:first-child { border-top: 0; }
.answer .top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.answer .top b { font-size: 16px; }
.answer .top .muted { font-size: 13px; }
.answer .md { border-left: 3px solid var(--c); padding-left: 14px; }
.answer.collapsed .md { max-height: 11.5em; overflow: hidden; -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent); mask-image: linear-gradient(180deg, #000 60%, transparent); }
.expand { border: 0; background: none; color: var(--accent-ink); cursor: pointer; font-weight: 600; font-size: 15px; padding: 6px 0 0 17px; }
.round-label { padding: 10px 18px; background: var(--warn-soft); color: var(--warn); font-weight: 700; font-size: 14px; border-top: 1px solid var(--line); }
.rt-foot { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; background: var(--surface-2); }
.older { text-align: center; margin: 6px 0 14px; }

/* markdown */
.md { overflow-wrap: anywhere; }
.md > * + * { margin-top: .6em; }
.md h1, .md h2, .md h3, .md h4 { font-size: 17px; margin-top: 1em; }
.md h3:first-child, .md h4:first-child, .md h2:first-child { margin-top: 0; }
.md ul, .md ol { padding-left: 1.4em; margin-bottom: 0; }
.md li + li { margin-top: .25em; }
.md li > ul, .md li > ol { margin-top: .25em; }
.md blockquote { margin: 0; padding: 4px 14px; border-left: 3px solid var(--line-2); color: var(--ink-2); }
.md code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; }
.md pre { background: #1E2230; color: #E8EAF2; padding: 12px 14px; border-radius: 10px; overflow-x: auto; font-size: 14px; }
.md pre code { background: none; border: 0; padding: 0; color: inherit; }
.md table { border-collapse: collapse; font-size: 15px; display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.md th { background: var(--surface-2); }
.md hr { border: 0; border-top: 1px solid var(--line); }
.md .ref { display: inline-block; font-size: .86em; background: var(--ok-soft); color: var(--ok); border-radius: 6px; padding: 0 6px; margin: 0 1px; cursor: pointer; border: 0; font-weight: 600; }
.md .seq { color: var(--accent-ink); cursor: pointer; font-weight: 600; text-decoration: none; }
.md .mention { color: var(--accent-ink); font-weight: 700; background: var(--accent-soft); border-radius: 5px; padding: 0 3px; }
.md .deleted { color: var(--ink-3); font-style: italic; }

/* composer */
.composer-wrap { padding: 8px 28px 18px; background: linear-gradient(180deg, rgba(245,244,239,0), var(--bg) 22%); }
.composer { max-width: 880px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow); padding: 10px 12px 10px; position: relative; }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.to-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 2px 2px 8px; }
.to-row::-webkit-scrollbar { display: none; }
.to-row > span { font-size: 14px; color: var(--ink-3); white-space: nowrap; font-weight: 600; margin-right: 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface); padding: 4px 11px 4px 5px;
  border-radius: 20px; cursor: pointer; white-space: nowrap; font-size: 14px; font-weight: 600; color: var(--ink-2); flex: none; min-height: 34px;
}
.chip .avatar { width: 24px; height: 24px; font-size: 13px; border-radius: 7px; }
.chip.plain { padding-left: 11px; }
.chip:hover { border-color: var(--ink-3); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.chip.rtc[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip.search[aria-pressed="true"] { background: #E3F4F6; border-color: #0E7490; color: #0E6275; }
.composer textarea { width: 100%; border: 0; outline: none; resize: none; min-height: 52px; max-height: 38vh; padding: 6px 6px; font-size: 17px; line-height: 1.6; background: transparent; }
.composer-bottom { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.composer-bottom .hint { font-size: 14px; color: var(--ink-3); flex: 1; min-width: 180px; }
.replying { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); background: var(--surface-2); border-radius: 10px; padding: 6px 6px 6px 12px; margin-bottom: 8px; }
.replying span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-pop { position: absolute; left: 12px; bottom: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 240px; max-height: 280px; overflow-y: auto; z-index: 20; }
.mention-pop button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 7px 10px; border-radius: 8px; cursor: pointer; text-align: left; font-size: 15px; }
.mention-pop button[aria-selected="true"], .mention-pop button:hover { background: var(--accent-soft); }
.mention-pop small { color: var(--ink-3); }
.newpill { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(100% + 10px); z-index: 5; }
.readonly-bar { max-width: 880px; margin: 0 auto; display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; padding: 14px 18px; box-shadow: var(--shadow); flex-wrap: wrap; }
.readonly-bar p { flex: 1; min-width: 220px; color: var(--ink-2); font-size: 16px; }

/* starters */
.starters { max-width: 700px; margin: 32px auto 8px; text-align: center; }
.starters h2 { font-size: 22px; margin-bottom: 6px; }
.starters p { color: var(--ink-3); margin-bottom: 18px; }
.starters .list { display: grid; gap: 10px; text-align: left; }
.starters button { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 14px 16px; cursor: pointer; display: flex; gap: 12px; align-items: flex-start; font-size: 16px; text-align: left; line-height: 1.55; }
.starters button:hover { border-color: var(--accent); }
.starters button small { display: block; color: var(--ink-3); font-size: 14px; margin-top: 2px; }

/* side panels */
.panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.panel-head h2 { font-size: 18px; flex: 1; }
.panel-note { font-size: 14px; color: var(--ink-3); margin: -6px 0 14px; }
.goal-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.goal-box .k { font-size: 13px; font-weight: 700; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.goal-box p { font-size: 16px; margin-top: 2px; }
.proposals { border: 1px solid #F0D9B5; background: #FFFBF3; border-radius: 14px; padding: 12px 12px 8px; margin-bottom: 18px; }
.proposals > .row { margin-bottom: 8px; }
.proposals h3 { font-size: 15px; color: var(--warn); flex: 1; }
.prop { background: #fff; border: 1px solid #F1E4CE; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.prop p { font-size: 15px; margin: 4px 0 8px; }
.prop .row { gap: 6px; }
.prop .task-fields { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.prop .task-fields .select, .prop .task-fields .input { min-height: 34px; padding: 4px 8px; font-size: 14px; width: auto; flex: 1; min-width: 120px; }
.bsec { margin-bottom: 20px; }
.bsec h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; color: var(--ink-2); }
.bsec h3 .count { color: var(--ink-3); font-weight: 600; font-size: 13px; }
.bsec h3 .spacer + button { font-weight: 600; }
.bitem { display: flex; gap: 10px; align-items: flex-start; padding: 8px 6px; border-radius: 9px; font-size: 15px; line-height: 1.55; }
.bitem:hover { background: var(--surface-2); }
.bitem .mark { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; background: var(--ink-3); }
.bitem.conclusion .mark { background: var(--ok); }
.bitem.disagreement .mark { background: var(--warn); }
.bitem.question .mark { background: var(--accent); }
.bitem .txt { flex: 1; min-width: 0; }
.bitem .sub { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; align-items: center; }
.bitem .tools { display: none; gap: 2px; }
.bitem:hover .tools, .bitem:focus-within .tools { display: flex; }
.bitem .tools button { border: 0; background: none; cursor: pointer; color: var(--ink-3); font-size: 13px; padding: 2px 6px; border-radius: 6px; }
.bitem .tools button:hover { background: #fff; color: var(--ink); }
.bitem input[type=checkbox] { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--ok); flex: none; cursor: pointer; }
.bitem.done .txt { color: var(--ink-3); text-decoration: line-through; }
.bempty { font-size: 14px; color: var(--ink-3); padding: 2px 6px 4px; }
.add-inline { display: flex; gap: 6px; margin-top: 6px; }
.add-inline .input { min-height: 36px; padding: 5px 10px; font-size: 15px; }
.srclink { border: 0; background: none; color: var(--accent-ink); font-size: 13px; cursor: pointer; padding: 0; font-weight: 600; }
.expert-row { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; align-items: flex-start; background: var(--surface); }
.expert-row.off { opacity: .6; }
.expert-row .info { flex: 1; min-width: 0; }
.expert-row .info b { font-size: 16px; }
.expert-row .info p { font-size: 14px; color: var(--ink-3); }
.expert-row .ctrl { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.weight { display: inline-flex; gap: 3px; align-items: center; }
.weight button { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); background: #fff; cursor: pointer; padding: 0; }
.weight button.on { background: var(--c, var(--accent)); border-color: var(--c, var(--accent)); }
.weight span { font-size: 13px; color: var(--ink-3); margin-left: 4px; }
.model-tag { font-size: 13px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); padding: 1px 8px; border-radius: 6px; }
.mat-add { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; }
.mat-add .btn { justify-content: flex-start; }
.mat { display: flex; gap: 10px; padding: 10px 8px; border-radius: 10px; align-items: flex-start; }
.mat:hover { background: var(--surface-2); }
.mat .ico { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; flex: none; font-size: 17px; }
.mat .info { flex: 1; min-width: 0; cursor: pointer; }
.mat .info b { font-size: 15px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mat .info small { color: var(--ink-3); font-size: 13px; }
.mat .ai-toggle { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); flex: none; }
.tpl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tpl { display: flex; gap: 10px; align-items: flex-start; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px; cursor: pointer; }
.tpl:hover { border-color: var(--accent); }
.tpl[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.tpl b { font-size: 15px; display: block; }
.tpl small { color: var(--ink-3); font-size: 13px; }
.tpl:disabled { opacity: .5; cursor: default; }
.copybox { display: flex; gap: 8px; }
.copybox .input { font-family: var(--mono); font-size: 14px; }
.doc { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; max-height: 55vh; overflow: auto; font-size: 15px; white-space: pre-wrap; }
.doc.md-doc { white-space: normal; }
.notes-pop { width: min(380px, calc(100vw - 24px)); max-height: 70vh; overflow-y: auto; }
.notes-pop a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 15px; }
.notes-pop a:hover { background: var(--surface-2); }
.notes-pop a small { display: block; color: var(--ink-3); font-size: 13px; }
.kbd { font-family: var(--mono); font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .room { grid-template-columns: minmax(0, 1fr) 360px; }
  .hero { gap: 36px; }
  .hero h1 { font-size: 44px; }
}
@media (max-width: 900px) {
  body { font-size: 16px; }
  .hero { grid-template-columns: 1fr; padding: 36px 0 32px; }
  .hero h1 { font-size: 36px; }
  .preview { transform: none; }
  .steps { grid-template-columns: 1fr; }
  .why { grid-template-columns: 1fr; }
  .room { grid-template-columns: 1fr; height: auto; min-height: calc(100dvh - var(--header)); }
  .room-title .goal-inline { display: none; }
  .mobile-tabs {
    display: flex; position: sticky; top: var(--header); z-index: 25; background: var(--surface); border-bottom: 1px solid var(--line); padding: 0 6px;
  }
  .mobile-tabs button { flex: 1; border: 0; background: none; padding: 11px 4px 10px; font-weight: 700; color: var(--ink-3); border-bottom: 3px solid transparent; font-size: 15px; display: inline-flex; justify-content: center; gap: 5px; align-items: center; }
  .mobile-tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--accent); }
  .mobile-tabs .n { font-size: 11px; background: var(--warn-soft); color: var(--warn); border-radius: 9px; padding: 0 6px; }
  .side-tabs { display: none; }
  .room[data-tab="chat"] .side { display: none; }
  .room:not([data-tab="chat"]) .main-col { display: none; }
  .side { border-left: 0; min-height: calc(100dvh - var(--header) - 46px); }
  .side-body { padding: 16px 16px 60px; }
  .main-col { min-height: calc(100dvh - var(--header) - 46px); }
  .stream { padding: 14px 10px 8px; overflow: visible; }
  .composer-wrap { position: sticky; bottom: 0; padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); }
  .composer { border-radius: 16px; }
  .rt { margin-left: 0; }
  .msg { grid-template-columns: 32px minmax(0, 1fr); gap: 10px; padding: 8px 6px; }
  .msg .avatar { width: 30px; height: 30px; font-size: 13px; }
  .msg .actions { display: flex; position: static; box-shadow: none; border: 0; background: none; padding: 0; margin-top: 2px; grid-column: 2; justify-self: start; }
  .msg .actions button { padding: 2px 8px 2px 0; font-size: 13px; color: var(--ink-3); }
  .page { padding: 22px 16px 48px; }
  .page-head h1 { font-size: 25px; }
  .cards { grid-template-columns: 1fr; }
  .landing { padding: 0 16px 48px; }
  .topbar { padding: 0 12px; }
  .room-head { padding: 0 8px 0 4px; gap: 4px; }
  .hide-m { display: none !important; }
  .modal { padding: 20px 18px 18px; border-radius: 16px; }
  .modal-back { padding: 10px; align-items: end; }
  .tpl-grid { grid-template-columns: 1fr; }
  .todo .where { display: none; }
  .answer { padding: 12px 12px 10px; }
  .synth { padding: 14px 14px 16px; }
  .composer-bottom .hint { order: 3; flex-basis: 100%; font-size: 13px; }
  #h-export, #h-settings, .faces-btn .more { display: none; }
  .room-head .userchip { padding: 2px; }
  .composer-bottom #send { flex: 1; }
  .to-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .to-row::-webkit-scrollbar { display: none; }
}
@media (max-width: 420px) {
  .hero h1 { font-size: 31px; }
  .hero .lead { font-size: 17px; }
  .brand span.full { display: none; }
  .mat-add { grid-template-columns: 1fr 1fr; }
}
@media print {
  .topbar, .room-head, .side, .composer-wrap, .mobile-tabs { display: none !important; }
}

/* ---------- round 2 (audit fixes) ---------- */
.chip .s { display: none; }
.menu .pick-row { align-items: center; }
.menu .pick-row .tick { width: 18px; color: var(--accent); font-weight: 800; text-align: center; }
.menu .pick-row small { font-size: 13px; }
.synth .md > :is(h3, h4):first-child + p { font-size: 18px; font-weight: 700; color: var(--ink); line-height: 1.55; }
.synth-rest { margin-top: .6em; }
.synth .expand { padding-left: 0; }
.room-title h1 { flex: 0 1 auto; max-width: 62%; }
.room-title .goal-inline { flex: 1 1 0; }
@media (max-width: 1100px) { .room-title .goal-inline { display: none; } .room-title h1 { max-width: none; } }
.composer textarea { min-height: 44px; }
.composer-bottom .hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-head .btn.small.ghost { padding: 0 10px; }
@media (max-width: 900px) {
  .chip .l { display: none; }
  .chip .s { display: inline; }
  .to-row { -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); padding-right: 24px; }
  .composer-bottom .hint { white-space: normal; }
  .readonly-bar { padding: 10px 12px; gap: 8px; border-radius: 14px; }
  .readonly-bar p { font-size: 14px; min-width: 0; flex-basis: 100%; }
  .readonly-bar .btn { width: 100%; min-height: 40px; }
  .room-title h1 { max-width: none; }
}
.synth { scroll-margin-top: 12px; }
@media (max-width: 900px) { .synth, .msg, .answer { scroll-margin-top: 118px; } }
@media (max-width: 420px) { .room-title .tag { display: none; } }
