:root {
  --bg: #f7f7fa;
  --panel: #ffffff;
  --ink: #1c1c24;
  --ink-2: #4a4a57;
  --muted: #7d7d8a;
  --line: #e6e6ee;
  --line-2: #d6d6e0;
  --brand: #6e56cf;
  --brand-ink: #5841b8;
  --brand-soft: #f1edff;
  --ok: #2b9a66;
  --ok-soft: #e6f6ee;
  --warn: #f76b15;
  --warn-soft: #fff1e7;
  --danger: #e5484d;
  --danger-soft: #feecec;
  --stage: #ebebf1;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 20, 40, .06), 0 4px 16px rgba(20, 20, 40, .06);
  --shadow-lg: 0 12px 48px rgba(20, 20, 40, .18);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.space { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.boot { display: grid; place-items: center; height: 100vh; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; font-weight: 500; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: #f4f4f8; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); }
.btn.success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.success:hover { filter: brightness(.95); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(0, 0, 0, .05); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
.btn.block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; cursor: pointer; color: var(--ink-2); position: relative; }
.icon-btn:hover { background: rgba(0, 0, 0, .06); color: var(--ink); }
.icon-btn.sm { width: 26px; height: 26px; }

.input, .select, .textarea { width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; outline: none; transition: border-color .12s, box-shadow .12s; }
.textarea { height: auto; min-height: 72px; padding: 9px 11px; resize: vertical; line-height: 1.45; }
.select { padding-right: 28px; appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237d7d8a' fill='none' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center; }
.select.sm, .input.sm { height: 28px; font-size: 13px; padding: 0 8px; border-radius: 7px; }
.select.sm { padding-right: 24px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(110, 86, 207, .15); }
label.field { display: flex; flex-direction: column; gap: 5px; font-weight: 500; font-size: 13px; }
label.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; font-size: 13px; }
.error-text { color: var(--danger); font-size: 13px; }

/* ---------- topbar ---------- */
.topbar { display: flex; align-items: center; gap: 18px; height: 56px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; color: var(--ink); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.logo { width: 24px; height: 24px; }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a { padding: 6px 10px; border-radius: 7px; color: var(--ink-2); font-weight: 500; }
.topbar nav a:hover { background: rgba(0, 0, 0, .05); text-decoration: none; }
.topbar nav a.active { color: var(--ink); background: rgba(0, 0, 0, .06); }
.badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }

.avatar { display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.avatar.sm { width: 20px; height: 20px; font-size: 9px; }

/* ---------- popovers ---------- */
.popover { position: fixed; z-index: 60; min-width: 200px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; }
.menu-item:hover { background: #f4f4f8; }
.menu-item.danger { color: var(--danger); }
.menu-sep { height: 1px; background: var(--line); margin: 5px 0; }

.notif-panel { width: 360px; max-height: 480px; overflow: auto; padding: 0; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.notif { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif:hover { background: #f8f8fb; }
.notif.unread { background: var(--brand-soft); }
.notif .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-top: 6px; flex: none; }
.notif.read .dot { visibility: hidden; }
.empty-small { padding: 28px 14px; text-align: center; color: var(--muted); }

/* ---------- modal & toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 20, 35, .42); display: grid; place-items: center; z-index: 80; padding: 16px; animation: fade .12s; }
.modal { width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-lg); animation: rise .16s ease-out; }
.modal.wide { max-width: 620px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px; }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 10px 18px 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: #fbfbfd; border-radius: 0 0 14px 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; pointer-events: none; }
.toast { background: #24242e; color: #fff; padding: 10px 16px; border-radius: 9px; box-shadow: var(--shadow-lg); font-weight: 500; animation: rise .16s; max-width: 90vw; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }

.tabs { display: flex; gap: 2px; padding: 3px; background: #f0f0f5; border-radius: 9px; }
.tabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 12px; border: 0; background: none; border-radius: 7px; cursor: pointer; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.tabs .count { font-size: 11px; color: var(--muted); font-weight: 600; }

.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px; border: 2px dashed var(--line-2); border-radius: 12px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .12s, background .12s; }
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.dropzone strong { color: var(--ink); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 20% -10%, #ece6ff, transparent), radial-gradient(900px 500px at 110% 110%, #ffe9dc, transparent), var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); padding: 28px; border-radius: 16px; box-shadow: var(--shadow-lg); }
.auth-card .brand { margin-bottom: 18px; font-size: 18px; }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card p { margin: 0 0 18px; color: var(--muted); }

/* ---------- dashboard ---------- */
.dash { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - 56px); }
.dash-side { border-right: 1px solid var(--line); background: var(--panel); padding: 16px 12px; }
.dash-side h3 { display: flex; align-items: center; justify-content: space-between; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 8px 8px; }
.proj { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 8px; border: 0; background: none; cursor: pointer; text-align: left; color: var(--ink-2); font-weight: 500; }
.proj:hover { background: #f4f4f8; }
.proj.active { background: var(--brand-soft); color: var(--brand-ink); }
.proj .n { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 600; }
.proj-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.dash-main { padding: 26px 30px 60px; min-width: 0; }
.dash-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.dash-head h1 { font-size: 22px; letter-spacing: -.01em; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.canvas-card { display: flex; flex-direction: column; overflow: hidden; cursor: pointer; transition: transform .12s, box-shadow .12s; }
.canvas-card:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(20, 20, 40, .1); }
.thumb { height: 140px; background: linear-gradient(135deg, #f2efff, #fff4ec); display: grid; place-items: center; overflow: hidden; position: relative; border-bottom: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.thumb .host { font-weight: 700; font-size: 15px; color: var(--brand-ink); padding: 0 16px; text-align: center; word-break: break-all; }
.thumb .type { position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 4px; background: rgba(255, 255, 255, .92); border-radius: 6px; padding: 3px 7px; font-size: 11px; font-weight: 600; color: var(--ink-2); }
.canvas-card .meta { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.canvas-card .title { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.canvas-card .title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #f0f0f5; color: var(--ink-2); }
.pill.open { background: var(--brand-soft); color: var(--brand-ink); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill svg.i { width: 12px; height: 12px; }
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty h2 { color: var(--ink); font-size: 18px; margin: 12px 0 6px; }
.empty .art { width: 64px; height: 64px; margin: 0 auto; border-radius: 18px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.empty .art svg.i { width: 30px; height: 30px; }

/* ---------- settings ---------- */
.settings { max-width: 760px; margin: 0 auto; padding: 28px 20px 80px; display: flex; flex-direction: column; gap: 20px; }
.settings h1 { font-size: 22px; }
.section { padding: 20px; }
.section h2 { font-size: 15px; margin-bottom: 4px; }
.section > p { margin: 0 0 14px; color: var(--muted); }
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.list-row:first-of-type { border-top: 0; }
.list-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.label-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.label-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- viewer ---------- */
.viewer { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.toolbar { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar .name { font-weight: 600; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toolbar .crumb { color: var(--muted); font-size: 12px; }
.toolbar .titles { display: flex; flex-direction: column; min-width: 0; }
.addr { flex: 1; min-width: 180px; max-width: 520px; height: 32px; padding: 0 12px 0 32px; border: 1px solid var(--line); border-radius: 8px; background: #f6f6f9 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237d7d8a' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M2 12h20M12 2a15 15 0 0 1 0 20M12 2a15 15 0 0 0 0 20'/%3E%3C/svg%3E") no-repeat 10px center; outline: none; font-size: 13px; color: var(--ink-2); }
.addr:focus { background-color: #fff; border-color: var(--brand); }
.tb-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.seg { display: inline-flex; padding: 3px; background: #f0f0f5; border-radius: 9px; gap: 2px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: none; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.seg button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.seg.mode button.active[data-v="comment"] { background: var(--brand); color: #fff; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 99px; border: 0; font-size: 12px; font-weight: 600; cursor: pointer; background: #f0f0f5; color: var(--ink-2); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }

.viewer-body { flex: 1; display: flex; min-height: 0; }
.stage { flex: 1; position: relative; overflow: hidden; background: var(--stage); display: flex; justify-content: center; }
.device-frame { width: 100%; height: 100%; background: #fff; transition: width .25s ease, margin .25s ease, border-radius .25s; position: relative; }
.device-frame.tablet { width: 820px; max-width: calc(100% - 32px); margin: 16px; height: calc(100% - 32px); border-radius: 18px; overflow: hidden; box-shadow: 0 0 0 10px #1f1f27, var(--shadow-lg); }
.device-frame.mobile { width: 390px; max-width: calc(100% - 32px); margin: 16px; height: calc(100% - 32px); border-radius: 26px; overflow: hidden; box-shadow: 0 0 0 10px #1f1f27, var(--shadow-lg); }
.site-frame { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.stage-notice { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); background: #24242e; color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13px; max-width: min(560px, 90%); z-index: 5; display: flex; gap: 10px; align-items: center; }
.frame-loading { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }

.doc-stage { flex: 1; overflow: auto; padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.doc-page { position: relative; background: #fff; box-shadow: var(--shadow); line-height: 0; max-width: 100%; }
.doc-page img, .doc-page canvas { display: block; max-width: 100%; height: auto; user-select: none; }
.doc-page .page-no { position: absolute; top: -18px; left: 0; font-size: 11px; color: var(--muted); line-height: 1; }
.stage.commenting .doc-page { cursor: crosshair; }
.pin-layer { position: absolute; inset: 0; pointer-events: none; }
.pin { position: absolute; transform: translate(-50%, -50%); min-width: 28px; height: 28px; padding: 0 6px; border-radius: 14px; border: 2px solid #fff; background: var(--brand); color: #fff; font-size: 12px; font-weight: 600; line-height: 24px; cursor: pointer; pointer-events: auto; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); transition: transform .12s, box-shadow .12s; }
.pin:hover { transform: translate(-50%, -50%) scale(1.12); }
.pin.resolved { background: var(--ok); }
.pin.draft { background: var(--warn); }
.pin.active { transform: translate(-50%, -50%) scale(1.2); box-shadow: 0 0 0 5px rgba(110, 86, 207, .35), 0 2px 10px rgba(0, 0, 0, .4); }

.sidebar { width: 380px; flex: none; display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); min-height: 0; }
.side-head { padding: 12px 14px 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.side-filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.side-filters .select { width: auto; flex: 1; min-width: 110px; }
.side-scroll { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.banner { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 9px; font-size: 13px; }
.banner.warn { background: var(--warn-soft); color: #a3480b; }
.banner.info { background: var(--brand-soft); color: var(--brand-ink); }
.hint { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 30px 16px; color: var(--muted); }
.hint .art { width: 48px; height: 48px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.hint .art svg.i { width: 22px; height: 22px; }
kbd { display: inline-block; min-width: 20px; padding: 1px 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; background: #fff; font: 600 11px/1.4 var(--font); color: var(--ink-2); }

.composer { padding: 12px; border: 1.5px solid var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); display: flex; flex-direction: column; gap: 8px; }
.composer-head { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.composer-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.att-preview { display: inline-flex; align-items: center; gap: 8px; padding: 4px; padding-right: 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; max-width: 100%; }
.att-preview img { width: 40px; height: 40px; object-fit: cover; border-radius: 5px; }

.thread { padding: 12px; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.thread:hover { border-color: var(--line-2); }
.thread.open { cursor: default; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(110, 86, 207, .12); }
.thread.resolved .body { color: var(--muted); }
.thread-head { display: flex; align-items: center; gap: 8px; }
.thread-head .who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.thread-head .who strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-head .who span { font-size: 12px; }
.num { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; flex: none; }
.num.resolved { background: var(--ok); }
.body { margin: 8px 0 0; white-space: pre-wrap; word-wrap: break-word; color: var(--ink); }
.body.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mention { color: var(--brand-ink); font-weight: 600; background: var(--brand-soft); border-radius: 4px; padding: 0 2px; }
.attachment { display: block; margin-top: 8px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); max-width: 100%; }
.attachment img { display: block; max-width: 100%; max-height: 220px; object-fit: contain; background: #fafafa; }
.attachment.file { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; }
.meta-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.meta-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 6px; font-size: 11.5px; font-weight: 600; background: #f2f2f6; color: var(--ink-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta-chip svg.i { width: 12px; height: 12px; }
.meta-chip.overdue { background: var(--danger-soft); color: var(--danger); }
.meta-chip.link { cursor: pointer; }
.meta-chip.link:hover { background: #e8e8ef; }
.replies { margin-top: 10px; border-top: 1px solid var(--line); }
.reply { display: flex; gap: 8px; padding: 10px 0 0; }
.reply .content { flex: 1; min-width: 0; }
.reply .content .body { margin-top: 2px; }
.reply-box { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.reply-box .textarea { min-height: 40px; }
.thread-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.thread-actions .full { grid-column: 1 / -1; }
.resolve-btn { flex: none; }
.resolve-btn.done { color: var(--ok); }

.mention-wrap { position: relative; }
.mention-menu { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; z-index: 30; background: #fff; border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow-lg); padding: 4px; }
.mention-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; }
.mention-menu button.active, .mention-menu button:hover { background: var(--brand-soft); }

@media (max-width: 900px) {
  .dash { grid-template-columns: 1fr; }
  .dash-side { border-right: 0; border-bottom: 1px solid var(--line); }
  .dash-main { padding: 20px 16px 60px; }
  .viewer { height: auto; min-height: 100vh; }
  .viewer-body { flex-direction: column; }
  .stage { flex: none; height: 62vh; }
  .sidebar { width: 100%; border-left: 0; border-top: 1px solid var(--line); }
  .side-scroll { overflow: visible; }
  .toolbar .name { max-width: 160px; }
  .addr { order: 10; min-width: 100%; max-width: none; }
  .seg button .lbl { display: none; }
  .topbar { gap: 10px; padding: 0 12px; }
  .topbar .user-name { display: none; }
  .form-grid { grid-template-columns: 1fr; }
}
