:root {
  --bg: #f6f6f8;
  --surface: #ffffff;
  --surface-2: #f0f0f4;
  --border: #e4e4ea;
  --text: #17171c;
  --muted: #6b6b78;
  --faint: #9a9aa6;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --accent-text: #ffffff;
  --danger: #dc2626;
  --ok: #059669;
  --idea: #f59e0b;
  --project: #0ea5e9;
  --bubble-me: #eef0ff;
  --shadow: 0 1px 2px rgba(20, 20, 40, .06), 0 4px 16px rgba(20, 20, 40, .06);
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}
/* Theme: follows the phone by default; 設定 › 外觀 can force day (白底) or night (黑底) via <html data-theme>. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111114;
  --surface: #1b1b20;
  --surface-2: #24242b;
  --border: #2e2e36;
  --text: #ececf1;
  --muted: #a0a0ad;
  --faint: #72727e;
  --accent: #818cf8;
  --accent-soft: #25264a;
  --accent-text: #0f0f1a;
  --bubble-me: #23244a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111114;
    --surface: #1b1b20;
    --surface-2: #24242b;
    --border: #2e2e36;
    --text: #ececf1;
    --muted: #a0a0ad;
    --faint: #72727e;
    --accent: #818cf8;
    --accent-soft: #25264a;
    --accent-text: #0f0f1a;
    --bubble-me: #23244a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "PingFang HK", "PingFang TC", "Noto Sans HK", "Microsoft JhengHei", "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: contain;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.hidden { display: none !important; }
.boot { display: grid; place-items: center; min-height: 100dvh; font-weight: 700; font-size: 22px; color: var(--faint); }

/* ---------- layout ---------- */
.page { min-height: 100dvh; display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + var(--safe-t)) 12px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.topbar h1 { font-size: 22px; margin: 0; font-weight: 800; letter-spacing: -.02em; flex: 1; min-width: 0; }
.topbar h1 .dot { color: var(--accent); }
.topbar .title { flex: 1; min-width: 0; font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iconbtn {
  width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent;
  display: inline-grid; place-items: center; font-size: 20px; color: var(--text); flex: none; position: relative;
}
.iconbtn:active { background: var(--surface-2); }
.iconbtn svg { width: 22px; height: 22px; }
.content { flex: 1; padding: 4px 12px calc(96px + var(--safe-b)); }

/* ---------- tabs & chips ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; margin: 4px 12px 8px; }
.tabs button {
  flex: 1; border: 0; background: transparent; padding: 7px 4px; border-radius: 9px;
  font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 12px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

.search { margin: 0 12px 10px; position: relative; }
.search input {
  width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: 12px;
  padding: 9px 12px 9px 36px; font-size: 16px; outline: none;
}
.search input:focus { border-color: var(--accent); }
.search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 18px; height: 18px; }

/* ---------- topic cards ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.card {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow);
  border: 1px solid transparent; position: relative;
}
.card:active { transform: scale(.99); }
.card.unread { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.card .row1 { display: flex; align-items: flex-start; gap: 8px; }
.card .kind { font-size: 18px; line-height: 1.35; flex: none; }
.card .ttl { flex: 1; min-width: 0; font-weight: 700; font-size: 16px; line-height: 1.35; word-break: break-word; }
.card .pin { color: var(--faint); font-size: 12px; margin-right: 4px; }
.card .last { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--muted); font-size: 14px; }
.card .last .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 12px; color: var(--faint); }
.card .meta .sp { flex: 1; }
.badge {
  background: var(--accent); color: var(--accent-text); font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-grid; place-items: center;
}
.iconbtn .badge { position: absolute; top: 3px; right: 1px; }

.pill {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); white-space: nowrap; border: 0;
}
.pill[data-s="new"] { background: #fef3c7; color: #92400e; }
.pill[data-s="discussing"] { background: #e0e7ff; color: #3730a3; }
.pill[data-s="planned"] { background: #e0f2fe; color: #075985; }
.pill[data-s="doing"] { background: #ffedd5; color: #9a3412; }
.pill[data-s="review"] { background: #fae8ff; color: #86198f; }
.pill[data-s="done"] { background: #d1fae5; color: #065f46; }
.pill[data-s="parked"] { background: var(--surface-2); color: var(--muted); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pill[data-s="new"] { background: #3b2f0e; color: #fcd34d; }
  :root:not([data-theme="light"]) .pill[data-s="discussing"] { background: #25264a; color: #a5b4fc; }
  :root:not([data-theme="light"]) .pill[data-s="planned"] { background: #0c2a3b; color: #7dd3fc; }
  :root:not([data-theme="light"]) .pill[data-s="doing"] { background: #3b200e; color: #fdba74; }
  :root:not([data-theme="light"]) .pill[data-s="review"] { background: #3a1540; color: #f0abfc; }
  :root:not([data-theme="light"]) .pill[data-s="done"] { background: #0d3326; color: #6ee7b7; }
}
:root[data-theme="dark"] .pill[data-s="new"] { background: #3b2f0e; color: #fcd34d; }
:root[data-theme="dark"] .pill[data-s="discussing"] { background: #25264a; color: #a5b4fc; }
:root[data-theme="dark"] .pill[data-s="planned"] { background: #0c2a3b; color: #7dd3fc; }
:root[data-theme="dark"] .pill[data-s="doing"] { background: #3b200e; color: #fdba74; }
:root[data-theme="dark"] .pill[data-s="review"] { background: #3a1540; color: #f0abfc; }
:root[data-theme="dark"] .pill[data-s="done"] { background: #0d3326; color: #6ee7b7; }

.kindtag { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; border: 0; }
.listhead { font-size: 12px; color: var(--faint); margin: 0 4px 8px; }
.kindtag.idea { background: color-mix(in srgb, var(--idea) 18%, transparent); color: color-mix(in srgb, var(--idea) 80%, var(--text)); }
.kindtag.project { background: color-mix(in srgb, var(--project) 18%, transparent); color: color-mix(in srgb, var(--project) 80%, var(--text)); }

.av {
  width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  color: #fff; font-size: 11px; font-weight: 800; text-transform: uppercase;
}
.av.lg { width: 34px; height: 34px; font-size: 14px; }
.av.md { width: 28px; height: 28px; font-size: 12px; }
.avs { display: inline-flex; }
.avs .av { border: 2px solid var(--surface); margin-left: -6px; width: 22px; height: 22px; }
.avs .av:first-child { margin-left: 0; }

.empty { text-align: center; color: var(--muted); padding: 48px 20px; }
.empty .big { font-size: 42px; }

.fab {
  position: fixed; right: max(16px, calc(50vw - 360px + 16px)); bottom: calc(20px + var(--safe-b)); z-index: 30;
  height: 54px; padding: 0 20px 0 16px; border-radius: 27px; border: 0;
  background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: 16px;
  display: inline-flex; align-items: center; gap: 6px; box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 45%, transparent);
}
.fab svg { width: 22px; height: 22px; }
.fab:active { transform: scale(.97); }

.banner {
  margin: 0 12px 10px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft);
  display: flex; gap: 10px; align-items: center; font-size: 14px;
}
.banner .x { margin-left: auto; border: 0; background: none; color: var(--muted); font-size: 18px; }

/* ---------- activity ---------- */
.team { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 14px; }
.member { background: var(--surface); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; }
.member .nm { font-weight: 700; font-size: 14px; }
.member .sub { font-size: 12px; color: var(--muted); }
.day { font-size: 13px; font-weight: 700; color: var(--muted); margin: 14px 4px 6px; }
.act { display: flex; gap: 10px; padding: 10px 12px; background: var(--surface); border-radius: 12px; margin-bottom: 6px; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.act .body { flex: 1; min-width: 0; }
.act .line { font-size: 14px; }
.act .line b { font-weight: 700; }
.act .snip { font-size: 14px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.act .t { font-size: 12px; color: var(--faint); flex: none; }

/* ---------- topic thread ---------- */
.thead { padding: 4px 16px 10px; }
.thead h2 { font-size: 21px; line-height: 1.3; margin: 0 0 8px; word-break: break-word; }
.thead .tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.thead .by { font-size: 12px; color: var(--faint); margin-left: auto; }
.pill.sbtn { cursor: pointer; padding: 5px 10px; font-size: 13px; }
.pill.sbtn::after { content: "▾"; margin-left: 2px; opacity: .6; }

.thread { flex: 1; padding: 6px 12px 16px; display: flex; flex-direction: column; gap: 12px; }
.entry { display: flex; gap: 8px; align-items: flex-start; }
.entry .col { flex: 1; min-width: 0; }
.entry .hd { display: flex; align-items: baseline; gap: 6px; font-size: 13px; margin-bottom: 3px; }
.entry .hd .nm { font-weight: 700; }
.entry .hd .tm { color: var(--faint); font-size: 12px; }
.entry .hd .more { margin-left: auto; border: 0; background: none; color: var(--faint); font-size: 18px; line-height: 1; padding: 0 4px; }
.bubble { background: var(--surface); border-radius: 4px 14px 14px 14px; padding: 9px 12px; box-shadow: var(--shadow); word-break: break-word; }
.entry.me .bubble { background: var(--bubble-me); }
.entry.first .bubble { border-radius: 14px; }
.bubble .text { white-space: pre-wrap; }
.bubble .text + .atts { margin-top: 8px; }
.atts { display: flex; flex-direction: column; gap: 8px; }
.sysline { text-align: center; font-size: 12.5px; color: var(--muted); }
.sysline span { background: var(--surface-2); padding: 4px 10px; border-radius: 999px; display: inline-block; }
.divider { display: flex; align-items: center; gap: 8px; color: var(--accent); font-size: 12px; font-weight: 700; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: color-mix(in srgb, var(--accent) 40%, transparent); }
.edited { color: var(--faint); font-size: 11px; }

/* images */
.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 4px; }
.imgs.one { grid-template-columns: 1fr; }
.imgs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--surface-2); display: block; cursor: zoom-in; }
.imgs.one img { aspect-ratio: auto; max-height: 320px; max-width: min(100%, 300px); width: auto; object-fit: contain; }
video.vid { width: 100%; max-height: 360px; border-radius: 10px; background: #000; }

/* file chip */
.file {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  background: var(--surface-2); text-decoration: none; color: inherit; min-width: 0;
}
.file .fi { font-size: 22px; flex: none; }
.file .fn { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .fs { font-size: 12px; color: var(--muted); flex: none; }

/* audio player */
.player { display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border-radius: 999px; background: var(--surface-2); }
.player .pp {
  width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center; flex: none;
}
.player .pp svg { width: 16px; height: 16px; }
.player .bar { flex: 1; height: 28px; position: relative; cursor: pointer; touch-action: none; }
.player .bar .track { position: absolute; left: 0; right: 0; top: 12px; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--muted) 30%, transparent); }
.player .bar .fill { position: absolute; left: 0; top: 12px; height: 4px; border-radius: 2px; background: var(--accent); width: 0; }
.player .bar .knob { position: absolute; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); left: 0; transform: translateX(-6px); }
.player .tm { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; min-width: 34px; text-align: right; }
.player .spd { border: 0; background: var(--surface); border-radius: 8px; font-size: 11px; font-weight: 700; padding: 3px 6px; color: var(--muted); flex: none; }
.transcript { font-size: 14px; color: var(--text); background: color-mix(in srgb, var(--surface-2) 60%, transparent); border-left: 3px solid var(--accent); padding: 6px 10px; border-radius: 4px 8px 8px 4px; white-space: pre-wrap; }
.transcript.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.transcript .lbl { display: block; font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 2px; white-space: normal; }
.tx-actions { display: flex; gap: 12px; font-size: 12px; margin-top: 2px; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--accent); font-size: 12px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- composer ---------- */
.composer {
  position: sticky; bottom: 0; z-index: 15;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding: 8px 10px calc(8px + var(--safe-b));
}
.composer .pending { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; }
.composer .pending:empty { display: none; }
.pend {
  flex: none; display: flex; align-items: center; gap: 6px; max-width: 220px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 5px 6px 5px 8px; font-size: 13px;
}
.pend img { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; }
.pend .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pend .rm { border: 0; background: var(--surface-2); border-radius: 50%; width: 22px; height: 22px; font-size: 13px; line-height: 1; flex: none; color: var(--muted); }
.pend.voice { max-width: 280px; }
.pend.voice .player { padding: 3px 8px 3px 3px; background: transparent; min-width: 180px; }
.pend.voice .player .pp { width: 28px; height: 28px; }
.crow { display: flex; align-items: flex-end; gap: 6px; }
.crow textarea {
  flex: 1; min-width: 0; resize: none; border: 1px solid var(--border); background: var(--surface); border-radius: 20px;
  padding: 9px 14px; font-size: 16px; line-height: 1.4; max-height: 40vh; outline: none; min-height: 42px;
}
.crow textarea:focus { border-color: var(--accent); }
.cbtn {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--text);
  display: grid; place-items: center; flex: none;
}
.cbtn svg { width: 21px; height: 21px; }
.cbtn.send { background: var(--accent); color: var(--accent-text); }
.cbtn.send:disabled { opacity: .35; }
.cbtn.mic.big { width: 42px; }
.recbar { display: flex; align-items: center; gap: 10px; height: 42px; }
.recbar .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); animation: pulse 1.2s infinite; flex: none; }
.recbar .tm { font-variant-numeric: tabular-nums; font-weight: 700; }
.recbar .lvl { flex: 1; height: 24px; display: flex; align-items: center; gap: 2px; overflow: hidden; }
.recbar .lvl i { display: block; width: 3px; border-radius: 2px; background: var(--danger); opacity: .7; flex: none; }
.recbar .cancel { border: 0; background: none; color: var(--muted); font-weight: 600; padding: 8px; }
.recbar .stop { background: var(--danger); color: #fff; }
@keyframes pulse { 50% { opacity: .3; } }
.progress { height: 3px; background: var(--surface-2); border-radius: 2px; overflow: hidden; margin-bottom: 6px; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

/* ---------- forms ---------- */
.form { padding: 8px 16px 24px; display: flex; flex-direction: column; gap: 14px; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.input, .textarea, .select {
  width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 11px 13px;
  font-size: 16px; outline: none;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); }
.textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg button {
  border: 2px solid var(--border); background: var(--surface); border-radius: 14px; padding: 12px 10px; text-align: left;
}
.seg button .e { font-size: 22px; }
.seg button .l { display: block; font-weight: 700; }
.seg button .d { display: block; font-size: 12px; color: var(--muted); }
.seg button.on { border-color: var(--accent); background: var(--accent-soft); }
.btn {
  border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 700; font-size: 16px;
  background: var(--accent); color: var(--accent-text); width: 100%;
}
.btn:disabled { opacity: .5; }
.btn.ghost { background: var(--surface-2); color: var(--text); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.sm { width: auto; padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.attach-row { display: flex; gap: 8px; flex-wrap: wrap; }
.attach-row .btn { flex: 1; display: inline-flex; gap: 6px; align-items: center; justify-content: center; }
.attach-row .btn svg { width: 19px; height: 19px; }

/* login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login .box { width: 100%; max-width: 360px; }
.login .logo { width: 72px; height: 72px; border-radius: 20px; margin: 0 auto 14px; display: block; box-shadow: var(--shadow); }
.login h1 { text-align: center; margin: 0 0 4px; font-size: 28px; letter-spacing: -.02em; }
.login p.sub { text-align: center; color: var(--muted); margin: 0 0 24px; }
.login form { display: flex; flex-direction: column; gap: 10px; }
.err { color: var(--danger); font-size: 14px; min-height: 20px; text-align: center; }

/* settings */
.section { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 14px; }
.section h3 { margin: 0 0 10px; font-size: 15px; }
.section .help { font-size: 13px; color: var(--muted); margin: 6px 0 10px; }
.colors { display: flex; gap: 8px; flex-wrap: wrap; }
.colors button { width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent; }
.colors button.on { border-color: var(--text); }
.urow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.urow:first-of-type { border-top: 0; }
.urow .nm { flex: 1; min-width: 0; }
.urow .nm small { color: var(--muted); display: block; }
.stack { display: flex; flex-direction: column; gap: 8px; }

/* ---------- sheet / modal ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .4); display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s ease;
}
.sheet {
  width: 100%; max-width: 560px; background: var(--surface); border-radius: 18px 18px 0 0;
  padding: 8px 8px calc(12px + var(--safe-b)); max-height: 85dvh; overflow-y: auto; animation: up .2s ease;
}
.sheet .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--border); margin: 4px auto 8px; }
.sheet h4 { margin: 4px 10px 8px; font-size: 14px; color: var(--muted); }
.sheet .opt {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; text-align: left;
  padding: 13px 12px; border-radius: 12px; font-size: 16px;
}
.sheet .opt:active { background: var(--surface-2); }
.sheet .opt.on { font-weight: 700; }
.sheet .opt.on::after { content: "✓"; margin-left: auto; color: var(--accent); }
.sheet .opt.danger { color: var(--danger); }
.sheet .pad { padding: 4px 8px 8px; display: flex; flex-direction: column; gap: 10px; }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }
@keyframes fade { from { opacity: 0; } }
.lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(0, 0, 0, .92); display: flex; flex-direction: column; }
.lightbox .lb-top { display: flex; justify-content: space-between; padding: calc(8px + var(--safe-t)) 8px 8px; }
.lightbox .lb-top a, .lightbox .lb-top button { color: #fff; background: rgba(255, 255, 255, .12); border: 0; border-radius: 10px; padding: 8px 12px; text-decoration: none; font-size: 14px; }
.lightbox img { flex: 1; min-height: 0; width: 100%; object-fit: contain; }

#toast {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%) translateY(20px); z-index: 200;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: all .2s; max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--danger); color: #fff; }

@media (min-width: 760px) {
  .content, .thread { padding-left: 0; padding-right: 0; }
  .tabs, .chips, .search, .banner { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
  .tabs { padding: 4px; }
}

/* theme picker */
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.themes button {
  border: 2px solid var(--border); background: var(--surface); border-radius: 12px; padding: 10px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; font-weight: 700;
}
.themes button.on { border-color: var(--accent); background: var(--accent-soft); }
.themes .sw { width: 100%; max-width: 76px; height: 40px; border-radius: 8px; border: 1px solid rgba(128, 128, 128, .35); position: relative; overflow: hidden; }
.themes .sw::before { content: ""; position: absolute; left: 8px; right: 8px; top: 8px; height: 8px; border-radius: 4px; background: currentColor; opacity: .25; }
.themes .sw::after { content: ""; position: absolute; left: 8px; width: 55%; top: 22px; height: 8px; border-radius: 4px; background: #4f46e5; opacity: .8; }
.themes .sw.light { background: #f6f6f8; color: #17171c; }
.themes .sw.dark { background: #111114; color: #ececf1; }
.themes .sw.auto { background: linear-gradient(135deg, #f6f6f8 50%, #111114 50%); color: #888; }

/* chat members */
.mp-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; background: var(--surface-2); border-radius: 12px; }
.mp-seg button { border: 0; background: transparent; border-radius: 9px; padding: 8px 6px; font-weight: 700; font-size: 14px; color: var(--muted); }
.mp-seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.mp-list { margin-top: 8px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.mp-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--border); cursor: pointer; }
.mp-row:first-child { border-top: 0; }
.mp-row input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin: 0; }
.mp-row .nm { flex: 1; min-width: 0; font-weight: 600; }
.members-row {
  display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 10px; padding: 8px 12px;
  border: 1px dashed var(--border); border-radius: 12px; background: transparent; font-size: 13px; font-weight: 700; color: var(--muted); text-align: left;
}
.members-row .nm { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .lock { font-size: 13px; margin-right: 4px; }
.field .mp-row { display: flex; margin: 0; font-size: 16px; font-weight: 400; color: var(--text); }
.mp .help { font-size: 13px; color: var(--muted); }
