/* Veche Forum — design system (light, warm editorial).
   Paper (bg / surface / surface-sunken / border / text / muted / faint)
   aligned to iOS Cream theme (Common/Theme.swift) so app + forum share one
   palette. Clay primary + sage secondary preserved (NOT Cream's rose/gold).
   Lora (serif) headings + Source Sans 3 (sans) body. */

:root {
  --bg:#FDF7F0; --surface:#FFFFFF; --surface-sunken:#F5EBDD; --border:rgba(40,20,10,.12);
  --text:#1F1510; --muted:rgba(31,21,16,.65); --faint:rgba(31,21,16,.4);
  --primary:#A8512F; --primary-hover:#8F4023; --primary-tint:#F2E1D6; --on-primary:#FFFFFF;
  --secondary:#5E6E4C; --secondary-tint:#E7EBDD;
  --success:#4F7A3F; --warning:#B07A1E; --danger:#BE3B2E; --danger-strong:#A1271C;
  --focus:#A8512F; --verified:#2E7D6B;
  --role-admin:#6E4B66;

  --serif:"Lora",Georgia,"Times New Roman",serif;
  --sans:"Source Sans 3",system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
  --sidebar-w:248px; --content-max:780px;
  --r-card:14px; --r-ctrl:9px; --r-pill:999px;
  --shadow:0 1px 2px rgba(31,21,16,.05), 0 6px 18px rgba(31,21,16,.05);
}

* { box-sizing:border-box; }
html,body { margin:0; padding:0; }
body {
  background:var(--bg); color:var(--text);
  font-family:var(--sans); font-size:16px; line-height:1.6;
  -webkit-font-smoothing:antialiased;
}
a { color:var(--primary); text-decoration:none; }
a:hover { text-decoration:underline; }
h1,h2,h3,h4 { font-family:var(--serif); font-weight:600; line-height:1.2; margin:0 0 .4em; color:var(--text); }
:focus-visible { outline:2px solid var(--focus); outline-offset:2px; border-radius:4px; }
img { max-width:100%; }
input,textarea,select,button { font-family:inherit; font-size:inherit; }

/* ---------- shell ---------- */
.app { display:grid; grid-template-columns:var(--sidebar-w) 1fr; min-height:100vh; }

.sidebar {
  position:sticky; top:0; height:100vh; align-self:start;
  background:var(--surface); border-right:1px solid var(--border);
  display:flex; flex-direction:column; padding:18px 14px; gap:2px;
}
.sidebar .brand { display:flex; align-items:center; gap:10px; padding:6px 8px 14px; }
.sidebar .brand img { width:30px; height:30px; border-radius:8px; }
.sidebar .brand span { font-family:var(--serif); font-weight:600; font-size:21px; letter-spacing:.2px; }
.nav-label { font-size:11px; font-weight:700; letter-spacing:.09em; text-transform:uppercase; color:var(--faint); padding:14px 10px 6px; }
.nav-link {
  display:flex; align-items:center; gap:11px; padding:9px 11px; border-radius:var(--r-ctrl);
  color:var(--text); font-weight:500; font-size:15px;
}
.nav-link:hover { background:var(--surface-sunken); text-decoration:none; }
.nav-link.active { background:var(--primary-tint); color:var(--primary-hover); }
.nav-link .ico { width:18px; text-align:center; opacity:.85; }
.nav-link .count { margin-left:auto; background:var(--danger); color:#fff; font-size:11px; font-weight:700; border-radius:var(--r-pill); padding:1px 7px; }
.sidebar .spacer { flex:1; }

/* account block (sidebar bottom) */
.acct { border-top:1px solid var(--border); padding-top:10px; margin-top:8px; }
.acct details { position:relative; }
.acct summary { list-style:none; cursor:pointer; display:flex; align-items:center; gap:10px; padding:8px; border-radius:var(--r-ctrl); }
.acct summary::-webkit-details-marker { display:none; }
.acct summary:hover { background:var(--surface-sunken); }
.av { width:32px; height:32px; border-radius:50%; object-fit:cover; background:var(--secondary-tint); color:var(--secondary); display:inline-flex; align-items:center; justify-content:center; font-weight:700; font-size:14px; flex:none; }
.acct .who { display:flex; flex-direction:column; line-height:1.2; min-width:0; }
.acct .who b { font-weight:600; font-size:14px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.acct .who small { color:var(--muted); }
.acct .panel { position:absolute; bottom:52px; left:0; right:0; background:var(--surface); border:1px solid var(--border); border-radius:var(--r-card); box-shadow:var(--shadow); padding:6px; }
.acct .panel a, .acct .panel button { display:block; width:100%; text-align:left; padding:9px 11px; border:0; background:none; border-radius:var(--r-ctrl); color:var(--text); cursor:pointer; font-size:15px; }
.acct .panel a:hover, .acct .panel button:hover { background:var(--surface-sunken); text-decoration:none; }
.acct .panel .danger { color:var(--danger); }

/* ---------- main ---------- */
.main { min-width:0; padding:30px 32px 80px; }
.wrap { max-width:1040px; margin:0 auto; padding:0; }
.page-head { display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-bottom:6px; }
.page-head h1 { font-size:30px; margin:0; }
.page-head .sub { color:var(--muted); margin:4px 0 0; }
.eyebrow { font-size:12px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--primary); }
.breadcrumb { font-size:13px; color:var(--muted); margin-bottom:14px; }
.breadcrumb a { color:var(--muted); }
.section-title { font-family:var(--serif); font-size:14px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:var(--faint); margin:30px 0 12px; }

/* ---------- buttons ---------- */
.btn { display:inline-flex; align-items:center; gap:8px; padding:9px 16px; border-radius:var(--r-ctrl); border:1px solid transparent; font-weight:600; font-size:14px; cursor:pointer; }
.btn:hover { text-decoration:none; }
.btn-primary { background:var(--primary); color:var(--on-primary); }
.btn-primary:hover { background:var(--primary-hover); }
.btn-ghost { background:var(--surface); color:var(--text); border-color:var(--border); }
.btn-ghost:hover { background:var(--surface-sunken); }
.btn-sm { padding:5px 11px; font-size:13px; }
.btn-danger { background:var(--danger-strong); color:#fff; }

/* ---------- tabs ---------- */
.tabs { display:flex; gap:6px; margin:18px 0 14px; border-bottom:1px solid var(--border); }
.tab { padding:8px 14px; color:var(--muted); font-weight:600; font-size:14px; border-bottom:2px solid transparent; margin-bottom:-1px; }
.tab:hover { color:var(--text); text-decoration:none; }
.tab.active { color:var(--primary-hover); border-bottom-color:var(--primary); }

/* ---------- badges ---------- */
.badge { display:inline-flex; align-items:center; gap:4px; font-size:11px; font-weight:700; letter-spacing:.03em; padding:2px 8px; border-radius:var(--r-pill); text-transform:uppercase; }
.badge-mod { background:var(--secondary-tint); color:var(--secondary); }
.badge-global { background:var(--primary-tint); color:var(--primary-hover); }
.badge-admin { background:#EDE3EC; color:var(--role-admin); }
.badge-verified { background:#DDF0EA; color:var(--verified); }
.badge-soft { background:var(--surface-sunken); color:var(--muted); }
.dot { width:7px; height:7px; border-radius:50%; display:inline-block; }
.dot-pin { background:var(--warning); } .dot-lock { background:var(--muted); }
.standing { color:var(--muted); font-size:13px; font-weight:600; }

/* ---------- attention strip (mods) ---------- */
.attention { display:flex; gap:12px; flex-wrap:wrap; margin:6px 0 22px; }
.attn-card { display:flex; align-items:center; gap:12px; background:var(--surface); border:1px solid var(--border); border-left:3px solid var(--primary); border-radius:var(--r-card); padding:12px 16px; min-width:190px; box-shadow:var(--shadow); }
.attn-card:hover { text-decoration:none; background:#FFFEFB; }
.attn-card .n { font-family:var(--serif); font-size:24px; font-weight:600; color:var(--primary-hover); }
.attn-card .l { font-size:13px; color:var(--muted); line-height:1.3; }

/* ---------- live banner (room) ---------- */
.live-banner { display:flex; align-items:center; gap:14px; background:linear-gradient(100deg,var(--primary-tint),var(--secondary-tint)); border:1px solid var(--border); border-radius:var(--r-card); padding:14px 18px; margin:18px 0; }
.live-dot { width:9px; height:9px; border-radius:50%; background:var(--danger); box-shadow:0 0 0 4px rgba(190,59,46,.18); flex:none; }
.live-banner .t { font-weight:600; }
.live-banner .s { color:var(--muted); font-size:14px; }
.live-banner .grow { flex:1; }

/* ---------- lists (rooms + threads) ---------- */
.list { background:var(--surface); border:1px solid var(--border); border-radius:var(--r-card); overflow:hidden; box-shadow:var(--shadow); }
.row { display:flex; gap:14px; align-items:center; padding:15px 18px; border-bottom:1px solid var(--border); }
.row:last-child { border-bottom:0; }
.row:hover { background:#FFFEFB; }
.row .ricon { width:40px; height:40px; flex:none; border-radius:11px; display:flex; align-items:center; justify-content:center; font-family:var(--serif); font-weight:600; font-size:18px; background:var(--secondary-tint); color:var(--secondary); }
.row .ricon.c2 { background:var(--primary-tint); color:var(--primary-hover); }
.row .rbody { min-width:0; flex:1; }
.row .ttl { font-family:var(--serif); font-size:17px; font-weight:600; color:var(--text); display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.row .ttl a { color:var(--text); }
.row .ttl a:hover { color:var(--primary-hover); }
.row .meta { color:var(--muted); font-size:13.5px; margin-top:2px; }
.row .meta a { color:var(--muted); }
.row .stats { text-align:right; flex:none; color:var(--muted); font-size:13px; line-height:1.35; }
.row .stats b { display:block; font-family:var(--serif); font-size:18px; color:var(--text); font-weight:600; }

/* mod actions inline */
.mod-actions { display:flex; gap:6px; margin-top:8px; }
.mod-actions form { margin:0; }
.mod-actions button { font-size:12px; padding:3px 10px; border-radius:var(--r-pill); border:1px solid var(--border); background:var(--surface); color:var(--muted); cursor:pointer; }
.mod-actions button:hover { background:var(--surface-sunken); color:var(--text); }
.mod-actions button.danger { color:var(--danger); }

/* ---------- room header / cards ---------- */
.card { background:var(--surface); border:1px solid var(--border); border-radius:var(--r-card); padding:20px 22px; box-shadow:var(--shadow); }
.room-head .mods { color:var(--muted); font-size:14px; margin-top:8px; }
.rules { background:var(--surface-sunken); border-radius:var(--r-ctrl); padding:12px 16px; margin:14px 0; color:var(--muted); font-size:14px; }
.rules b { color:var(--text); }

/* ---------- empty states ---------- */
.empty { text-align:center; padding:46px 24px; background:var(--surface); border:1px dashed var(--border); border-radius:var(--r-card); }
.empty h3 { font-size:20px; margin-bottom:6px; }
.empty p { color:var(--muted); margin:0 auto 18px; max-width:430px; }

/* ---------- thread / reading ---------- */
.thread { max-width:var(--content-max); }
.post { background:var(--surface); border:1px solid var(--border); border-radius:var(--r-card); padding:18px 22px; margin-bottom:14px; box-shadow:var(--shadow); }
.post .who { display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.post .who .n { font-weight:600; }
.post .body-text { font-size:17px; line-height:1.65; }
.composer textarea { width:100%; min-height:110px; padding:13px 15px; border:1px solid var(--border); border-radius:var(--r-card); background:#fff; resize:vertical; }
.locked-note { text-align:center; color:var(--muted); background:var(--surface-sunken); border-radius:var(--r-card); padding:16px; }

/* ---------- forms base ---------- */
label { display:block; font-weight:600; font-size:14px; margin:14px 0 6px; }
input[type=text],input[type=email],input[type=password],textarea,select { width:100%; padding:11px 14px; border:1px solid var(--border); border-radius:var(--r-ctrl); background:#fff; color:var(--text); }
.pagination { display:flex; gap:14px; align-items:center; justify-content:center; margin-top:22px; color:var(--muted); }

.flash { background:var(--secondary-tint); color:var(--secondary); border-radius:var(--r-ctrl); padding:10px 14px; max-width:1040px; margin:14px auto 0; }
.flash-error { background:#F6E0DC; color:var(--danger-strong); }
footer { color:var(--faint); font-size:13px; text-align:center; padding:24px; }

/* ---------- responsive ---------- */
@media (max-width:880px) {
  .app { grid-template-columns:1fr; }
  .sidebar { position:static; height:auto; flex-direction:row; flex-wrap:wrap; align-items:center; border-right:0; border-bottom:1px solid var(--border); padding:12px 16px; }
  .sidebar .brand { padding:0 8px 0 0; }
  .nav-label, .sidebar .spacer { display:none; }
  .nav-link { padding:7px 11px; }
  .acct { border-top:0; margin:0 0 0 auto; padding:0; }
  .main { padding:22px 18px 64px; }
}

/* ================= admin + board (templates not yet rebuilt) ================= */
.breadcrumbs { font-size:13px; color:var(--muted); margin-bottom:14px; }
.breadcrumbs .sep { margin:0 6px; color:var(--faint); }
.breadcrumbs a { color:var(--muted); }
.page-hero { margin-bottom:18px; }
.hero-eyebrow { font-size:12px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--primary); }
.page-hero h1 { font-size:30px; margin:4px 0 6px; }
.hero-sub { color:var(--muted); max-width:760px; }
code { background:var(--surface-sunken); padding:1px 6px; border-radius:6px; font-size:.92em; }
.muted { color:var(--muted); }

.search-form { display:flex; gap:8px; align-items:center; margin:0 0 20px; }
.search-form input[type=search] { flex:0 1 320px; padding:9px 13px; border:1px solid var(--border); border-radius:var(--r-ctrl); background:#fff; }
.search-form button { padding:9px 16px; border-radius:var(--r-ctrl); border:1px solid var(--border); background:var(--surface); font-weight:600; cursor:pointer; }
.search-form button:hover { background:var(--surface-sunken); }

.admin-table { width:100%; border-collapse:separate; border-spacing:0; background:var(--surface); border:1px solid var(--border); border-radius:var(--r-card); overflow:hidden; box-shadow:var(--shadow); }
.admin-table th { text-align:left; font-size:12px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:var(--faint); padding:12px 16px; border-bottom:1px solid var(--border); background:var(--surface-sunken); }
.admin-table td { padding:13px 16px; border-bottom:1px solid var(--border); vertical-align:top; font-size:14px; }
.admin-table tr:last-child td { border-bottom:0; }
.admin-table tr.inactive { opacity:.55; }
.admin-table code { font-size:12.5px; }

/* THE giant-photo fix: constrain avatars in admin tables */
.av-img { width:34px; height:34px; border-radius:50%; object-fit:cover; flex:none; }
.user-cell { display:flex; align-items:center; gap:11px; }
.user-text { display:flex; flex-direction:column; line-height:1.3; }
.user-name { font-weight:600; }
.user-email { color:var(--muted); font-size:13px; }

.role-badge { display:inline-block; font-size:11px; font-weight:700; letter-spacing:.03em; text-transform:uppercase; padding:3px 9px; border-radius:var(--r-pill); background:var(--surface-sunken); color:var(--muted); }
.role-badge.role-admin { background:#EDE3EC; color:var(--role-admin); }
.role-badge.role-globalmod { background:var(--primary-tint); color:var(--primary-hover); }
.role-badge.role-roommod { background:var(--secondary-tint); color:var(--secondary); }

.status { display:inline-block; font-size:12px; font-weight:700; padding:2px 9px; border-radius:var(--r-pill); }
.status-on { background:var(--secondary-tint); color:var(--secondary); }
.status-off { background:var(--surface-sunken); color:var(--muted); }

form.inline { display:inline; margin:0; }
.role-set-form { display:flex; gap:8px; align-items:center; }
select { padding:7px 10px; border:1px solid var(--border); border-radius:var(--r-ctrl); background:#fff; color:var(--text); }

/* user-row ban/mute panel (override the thread .mod-actions flex) */
details.mod-actions { display:block; margin-top:0; }
.mod-actions > summary { list-style:none; cursor:pointer; }
.mod-actions > summary::-webkit-details-marker { display:none; }
.mod-actions-panel { display:flex; gap:18px; flex-wrap:wrap; margin-top:10px; padding:14px; background:var(--surface-sunken); border-radius:var(--r-card); }
.mod-form { display:flex; flex-direction:column; gap:6px; min-width:200px; margin:0; }
.mod-form-title { font-size:13px; }
.mod-label { font-size:12px; font-weight:600; color:var(--muted); display:flex; flex-direction:column; gap:3px; margin:6px 0 0; }
.mod-label input, .mod-label select { font-weight:400; color:var(--text); }

/* board */
.board-summary { display:flex; gap:12px; flex-wrap:wrap; margin:6px 0 18px; }
.board-stat { display:flex; flex-direction:column; align-items:center; gap:2px; background:var(--surface); border:1px solid var(--border); border-radius:var(--r-card); padding:14px 22px; min-width:120px; box-shadow:var(--shadow); }
.board-stat:hover { text-decoration:none; background:#FFFEFB; }
.board-stat-count { font-family:var(--serif); font-size:26px; font-weight:600; color:var(--primary-hover); }
.board-stat-label { font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; }
.board-section { margin:26px 0; }
.board-section-title { font-family:var(--serif); font-size:20px; font-weight:600; display:flex; align-items:center; gap:10px; margin-bottom:12px; }
.count-badge { font-size:12px; font-weight:700; padding:1px 9px; border-radius:var(--r-pill); background:var(--surface-sunken); color:var(--muted); }
.count-badge.count-badge-on { background:var(--danger); color:#fff; }
.board-actions { display:flex; gap:8px; align-items:flex-start; }
.board-reject summary { list-style:none; cursor:pointer; }
.board-reject summary::-webkit-details-marker { display:none; }
.board-note-form { display:flex; flex-direction:column; gap:6px; margin-top:8px; padding:12px; background:var(--surface-sunken); border-radius:var(--r-card); min-width:240px; }
.board-label { font-size:12px; font-weight:600; color:var(--muted); display:flex; flex-direction:column; gap:3px; }
.board-check { font-size:13px; color:var(--muted); display:flex; align-items:center; gap:6px; }
.board-desc { max-width:280px; color:var(--muted); }
.board-filter-note { font-size:13px; }
.id-mono { font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:12px; background:var(--surface-sunken); padding:1px 5px; border-radius:5px; }
.board-pager { display:flex; gap:12px; align-items:center; justify-content:center; margin-top:14px; color:var(--muted); font-size:13px; }
.board-pager-disabled { opacity:.4; }

/* ================= room-centric forum (v2026-05-25c) ================= */

/* ---------- shared surface card + post form (room new-topic, thread reply) ---------- */
.surface-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--r-card); padding:20px 22px; box-shadow:var(--shadow); }
.post-form { display:flex; flex-direction:column; gap:2px; }
.post-form textarea { resize:vertical; }
.form-actions { display:flex; align-items:center; gap:14px; margin-top:14px; }
.form-actions button { padding:9px 18px; border-radius:var(--r-ctrl); border:1px solid transparent; background:var(--primary); color:var(--on-primary); font-weight:600; cursor:pointer; }
.form-actions button:hover { background:var(--primary-hover); }
.form-actions .cancel { color:var(--muted); }

/* ---------- hero search (home) ---------- */
.room-search { display:flex; gap:10px; align-items:center; background:var(--surface); border:1px solid var(--border); border-radius:var(--r-card); padding:12px 14px; margin:18px 0 14px; box-shadow:var(--shadow); }
.room-search:focus-within { border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-tint); }
.room-search-ico { font-size:20px; color:var(--faint); line-height:1; padding-left:4px; flex:none; }
.room-search input[type=search] { flex:1; border:0; background:transparent; padding:8px 4px; font-size:18px; color:var(--text); }
.room-search input[type=search]:focus { outline:none; }
.room-search .btn { flex:none; }

/* ---------- filter chips ---------- */
.chips { display:flex; flex-wrap:wrap; gap:8px; margin:0 0 6px; }
.chip { display:inline-flex; align-items:center; padding:6px 14px; border-radius:var(--r-pill); border:1px solid var(--border); background:var(--surface); color:var(--muted); font-weight:600; font-size:13.5px; }
.chip:hover { background:var(--surface-sunken); color:var(--text); text-decoration:none; }
.chip.chip-on { background:var(--primary); border-color:var(--primary); color:var(--on-primary); }
.chip-vibe { color:var(--secondary); border-color:var(--secondary-tint); }
.chip-vibe:hover { background:var(--secondary-tint); color:var(--secondary); }
.chip-vibe.chip-on { background:var(--secondary); border-color:var(--secondary); color:#fff; }

/* ---------- room rows (home) ---------- */
.room-row .ricon { background:var(--primary-tint); color:var(--primary-hover); }
.stats .stats-sub { display:block; font-size:12px; color:var(--faint); margin-top:2px; font-weight:400; }
.room-state { display:inline-block; font-size:10px; font-weight:700; letter-spacing:.05em; text-transform:uppercase; padding:2px 7px; border-radius:var(--r-pill); background:var(--surface-sunken); color:var(--muted); vertical-align:middle; }
.room-state-live { background:var(--danger); color:#fff; }
.room-state-scheduled, .room-state-upcoming { background:var(--secondary-tint); color:var(--secondary); }
.room-meta .room-state { font-size:11px; }

/* ---------- room page layout ---------- */
.room-grid { display:grid; grid-template-columns:1fr 360px; gap:22px; align-items:start; margin-top:14px; }
.room-grid-single { grid-template-columns:1fr; }
.room-threads { min-width:0; }
.new-topic { margin-top:18px; }
.new-topic h2 { margin:0 0 14px; font-size:20px; }

/* ---------- topic tabs ---------- */
.topic-tabs { display:flex; gap:4px; margin:18px 0 0; border-bottom:1px solid var(--border); flex-wrap:wrap; }
.topic-tab { display:inline-flex; align-items:center; gap:8px; padding:10px 16px; color:var(--muted); font-weight:600; font-size:14.5px; border-bottom:2px solid transparent; margin-bottom:-1px; }
.topic-tab:hover { color:var(--text); text-decoration:none; }
.topic-tab.active { color:var(--primary-hover); border-bottom-color:var(--primary); }
.topic-count { font-size:11px; font-weight:700; padding:1px 8px; border-radius:var(--r-pill); background:var(--surface-sunken); color:var(--muted); }
.topic-tab.active .topic-count { background:var(--primary-tint); color:var(--primary-hover); }

/* ---------- live channel chat (mIRC feel) ---------- */
.room-chat { position:sticky; top:18px; display:flex; flex-direction:column; background:var(--surface); border:1px solid var(--border); border-radius:var(--r-card); box-shadow:var(--shadow); overflow:hidden; }
.chat-head { display:flex; align-items:center; gap:9px; padding:12px 16px; border-bottom:1px solid var(--border); background:var(--surface-sunken); }
.chat-head .live-dot { width:8px; height:8px; }
.chat-title { font-family:var(--serif); font-weight:600; font-size:15px; }
.chat-hint { margin-left:auto; font-size:10px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--danger); }
.chat-feed { max-height:340px; overflow-y:auto; padding:10px 14px; display:flex; flex-direction:column; gap:3px; }
.chat-msg { font-size:14px; line-height:1.5; padding:3px 8px; border-radius:var(--r-ctrl); word-wrap:break-word; }
.chat-who { font-weight:700; color:var(--primary); cursor:default; margin-right:6px; }
.chat-who:hover { color:var(--primary-hover); }
.chat-body { color:var(--text); }
.chat-ts { display:inline-block; margin-left:6px; font-size:11px; color:var(--faint); }
.chat-msg-mine { background:var(--primary-tint); }
.chat-msg-mine .chat-who { color:var(--primary-hover); }
.chat-empty { color:var(--muted); font-size:14px; text-align:center; padding:28px 12px; }
.chat-send { display:flex; gap:8px; padding:12px 14px; border-top:1px solid var(--border); background:var(--surface); }
.chat-send input { flex:1; padding:9px 13px; border:1px solid var(--border); border-radius:var(--r-pill); background:#fff; color:var(--text); }
.chat-send input:focus { outline:none; border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-tint); }
.chat-send .btn { flex:none; padding:9px 16px; }
.chat-locked { padding:14px; text-align:center; color:var(--muted); font-size:14px; border-top:1px solid var(--border); background:var(--surface-sunken); }

/* ---------- room responsive ---------- */
@media (max-width:880px) {
  .room-grid { grid-template-columns:1fr; }
  .room-chat { position:static; }
  .chat-feed { max-height:300px; }
  .room-search input[type=search] { font-size:16px; }
}

/* ================= direct messages (1:1 — mIRC query) (v2026-05-25d) ================= */
.dm-wrap { max-width:980px; }

/* ---------- conversation list (Messages page) ---------- */
.dm-convo-list { margin-top:6px; }
.dm-convo-row { align-items:center; }
.dm-av { width:42px; height:42px; font-size:16px; }
.dm-convo-body { min-width:0; flex:1; }
.dm-convo-top { display:flex; align-items:baseline; gap:10px; }
.dm-convo-name { font-family:var(--serif); font-size:17px; font-weight:600; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dm-convo-row:hover .dm-convo-name { color:var(--primary-hover); }
.dm-convo-ts { margin-left:auto; flex:none; font-size:12.5px; color:var(--faint); white-space:nowrap; }
.dm-convo-preview { color:var(--muted); font-size:14px; margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dm-unread { flex:none; min-width:22px; height:22px; padding:0 7px; border-radius:var(--r-pill); background:var(--primary); color:var(--on-primary); font-size:12px; font-weight:700; display:inline-flex; align-items:center; justify-content:center; }
.dm-unread-sm { min-width:18px; height:18px; font-size:11px; padding:0 5px; }

/* ---------- conversation view (sidebar + main) ---------- */
.dm-grid { display:grid; grid-template-columns:260px 1fr; gap:22px; align-items:start; margin-top:14px; }
.dm-grid-single { grid-template-columns:1fr; }

.dm-side { background:var(--surface); border:1px solid var(--border); border-radius:var(--r-card); box-shadow:var(--shadow); overflow:hidden; position:sticky; top:18px; }
.dm-side-head { padding:12px 16px; border-bottom:1px solid var(--border); background:var(--surface-sunken); font-family:var(--serif); font-weight:600; font-size:15px; }
.dm-side-list { max-height:520px; overflow-y:auto; }
.dm-side-row { display:flex; align-items:center; gap:10px; padding:10px 14px; border-bottom:1px solid var(--border); color:var(--text); }
.dm-side-row:last-child { border-bottom:0; }
.dm-side-row:hover { background:#FFFEFB; text-decoration:none; }
.dm-side-row.active { background:var(--primary-tint); }
.dm-side-av { width:34px; height:34px; font-size:14px; }
.dm-side-text { display:flex; flex-direction:column; min-width:0; line-height:1.3; }
.dm-side-name { font-weight:600; font-size:14px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dm-side-preview { color:var(--muted); font-size:12.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dm-side-row .dm-unread-sm { margin-left:auto; flex:none; }

.dm-main { display:flex; flex-direction:column; background:var(--surface); border:1px solid var(--border); border-radius:var(--r-card); box-shadow:var(--shadow); overflow:hidden; min-width:0; }
.dm-head { display:flex; align-items:center; gap:11px; padding:13px 18px; border-bottom:1px solid var(--border); background:var(--surface-sunken); }
.dm-head-av { width:36px; height:36px; font-size:15px; }
.dm-head-name { font-family:var(--serif); font-weight:600; font-size:17px; }

.dm-feed { max-height:520px; min-height:240px; overflow-y:auto; padding:16px 18px; display:flex; flex-direction:column; gap:8px; }
.dm-empty { margin:auto; color:var(--muted); font-size:14px; text-align:center; padding:28px 12px; }

/* ---------- message bubbles (mine vs theirs) ---------- */
.dm-bubble-row { display:flex; justify-content:flex-start; }
.dm-bubble-row.dm-mine { justify-content:flex-end; }
.dm-bubble { max-width:74%; padding:8px 13px; border-radius:14px; background:var(--surface-sunken); color:var(--text); border:1px solid var(--border); }
.dm-mine .dm-bubble { background:var(--primary-tint); border-color:var(--primary-tint); border-bottom-right-radius:4px; }
.dm-bubble-row:not(.dm-mine) .dm-bubble { border-bottom-left-radius:4px; }
.dm-bubble-body { font-size:14.5px; line-height:1.5; word-wrap:break-word; overflow-wrap:anywhere; }
.dm-bubble-ts { display:block; margin-top:3px; font-size:11px; color:var(--faint); text-align:right; }

.dm-send { display:flex; gap:8px; padding:12px 16px; border-top:1px solid var(--border); background:var(--surface); }
.dm-send input { flex:1; padding:9px 14px; border:1px solid var(--border); border-radius:var(--r-pill); background:#fff; color:var(--text); }
.dm-send input:focus { outline:none; border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-tint); }
.dm-send .btn { flex:none; padding:9px 16px; }
.dm-locked { padding:14px 16px; text-align:center; color:var(--muted); font-size:14px; border-top:1px solid var(--border); background:var(--surface-sunken); }

/* ---------- dm responsive ---------- */
@media (max-width:880px) {
  .dm-grid { grid-template-columns:1fr; }
  .dm-side { position:static; }
  .dm-side-list { max-height:none; display:flex; overflow-x:auto; }
  .dm-side-row { border-bottom:0; border-right:1px solid var(--border); flex:none; }
  .dm-side-row .dm-side-preview { display:none; }
  .dm-feed { max-height:60vh; }
  .dm-bubble { max-width:84%; }
}
