/* KyaChat by Red Zircon. Chatwoot-style dashboard layout and components (MIT patterns; our own logo and colours):
   icon rail | secondary sidebar | conversation list | thread | details panel. One accent (ruby), neutral surfaces,
   Inter, 1px hairlines. Radius rule: buttons, inputs and cards 8-10px, bubbles 12px (4px on the joined corner),
   avatars and pills round. */
@font-face { font-family: 'Inter'; src: url('/assets/fonts/Inter-Variable.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
/* Flags where the system has none (Windows shows two letters): Twemoji country, England, Scotland and Wales flags
   (CC-BY 4.0, talkjs/country-flag-emoji-polyfill). unicode-range keeps it to regional indicators and the flag tag
   sequences, so no other emoji changes. boot-theme.js adds html.flag-font only when the system cannot draw flags. */
@font-face { font-family: 'Twemoji Country Flags'; src: url('/assets/fonts/TwemojiCountryFlags.woff2') format('woff2'); unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067, U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F; font-display: swap; }

:root {
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji';
  --emoji: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'Twemoji Mozilla', sans-serif;
  /* soft tints derive from --accent, so a ZirconOS accent (embed.js sets --accent/--accent-strong) recolours them too */
  --accent: #a52d3b; --accent-strong: #8a2130; --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 8%, #fff); --accent-soft-2: color-mix(in srgb, var(--accent) 15%, #fff);
  --bg: #ffffff; --rail: #f8f8fa; --side2: #fcfcfd; --list: #ffffff; --thread: #f7f7f9; --panel: #ffffff;
  --surface: #ffffff; --surface-2: #f4f4f6; --surface-3: #e9e9ed; --hover: #f3f3f5; --active: #efeff2;
  --ink: #1c2024; --ink-2: #3b3f46; --muted: #60646c; --faint: #8b8d98; --line: #e8e8ec; --line-2: #dcdce2;
  --in: #ececf0; --in-ink: #1c2024; --out: color-mix(in srgb, var(--accent) 13%, #fff); --out-ink: #1c2024; --out-meta: color-mix(in srgb, var(--accent) 60%, #777);
  --day-pill: #ffffff;
  --sys: #e4e4e9; --ok: #208368; --danger: #ce2c31; --danger-soft: #feebec; --warn: #ab6400;
  --shadow-1: 0 1px 2px rgba(22, 26, 34, .05);
  --shadow-2: 0 12px 32px rgba(22, 26, 34, .14), 0 2px 6px rgba(22, 26, 34, .06);
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px color-mix(in srgb, var(--accent) 55%, transparent);
  --h-a: #c2566a; --h-b: #3e7cc0; --h-c: #2f8a68; --h-d: #b6782a; --h-e: #7a5bb5; --h-f: #2f8c9c;
  --rail-w: 64px; --s2-w: 232px; --list-w: 344px; --info-w: 328px;
  color-scheme: light;
}
:root.flag-font {
  --font: 'Twemoji Country Flags', 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji';
  --emoji: 'Twemoji Country Flags', 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'Twemoji Mozilla', sans-serif;
}
[data-theme="dark"] {
  --accent: #e5707e; --accent-strong: #f08e99; --accent-ink: #1a0d10;
  --accent-soft: color-mix(in srgb, var(--accent) 16%, #17171a); --accent-soft-2: color-mix(in srgb, var(--accent) 24%, #17171a);
  --bg: #17171a; --rail: #131315; --side2: #1b1c20; --list: #17171a; --thread: #1e1f23; --panel: #151517;
  --surface: #1d1e22; --surface-2: #232429; --surface-3: #2c2d33; --hover: #222328; --active: #2a2b31;
  --ink: #ededef; --ink-2: #c8c9ce; --muted: #a0a1aa; --faint: #6f7079; --line: #2a2b30; --line-2: #34353b;
  --in: #2a2b30; --in-ink: #ededef; --out: color-mix(in srgb, var(--accent) 26%, #17171a); --out-ink: #f4f4f6; --out-meta: color-mix(in srgb, var(--accent) 55%, #aaa);
  --day-pill: #121215;
  --sys: #2a2b30; --ok: #4cc38a; --danger: #ff6369; --danger-soft: #3b1219; --warn: #ffca16;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 16px 40px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .4);
  --h-a: #e07e90; --h-b: #6aa7dc; --h-c: #5cbf97; --h-d: #dba45a; --h-e: #a58ae0; --h-f: #5fb6c6;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 var(--font); font-feature-settings: 'cv11', 'ss01'; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; }
a { color: var(--accent); }
img { display: block; }
kbd { font: 500 11px/1 var(--font); padding: 2px 5px; border-radius: 4px; border: 1px solid var(--line-2); background: var(--surface); color: var(--muted); }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 20px; height: 20px; flex: none; fill: currentColor; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.pad { padding: 8px 16px; }
.accent { color: var(--accent) !important; }
.flip { transform: rotate(180deg); }
.flip-x { transform: scaleX(-1); }
.boot { height: 100dvh; }
.noscript, .fatal { padding: 40px; text-align: center; }
.fatal { display: grid; gap: 16px; justify-items: center; margin-top: 20vh; }

/* ---------- buttons, fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; font-weight: 500; font-size: 14px; white-space: nowrap; border: 1px solid transparent; transition: background .15s, border-color .15s, opacity .15s; }
.btn .icon { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: var(--accent-strong); }
.btn.danger { background: var(--danger); color: #fff; }
[data-theme="dark"] .btn.danger { color: #1a0d0c; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover:not(:disabled) { background: var(--hover); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.small .icon { width: 15px; height: 15px; }
.btn:disabled { opacity: .55; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--accent-ink); border-right-color: transparent; animation: spin .7s linear infinite; }
.btn.ghost.busy::after { border-color: var(--ink); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--muted); flex: none; transition: background .15s, color .15s; }
.icon-btn .icon { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn[aria-pressed="true"] { background: var(--active); color: var(--ink); }
.icon-btn.mini { width: 24px; height: 24px; }
.icon-btn.mini .icon { width: 14px; height: 14px; }
.link-btn { color: var(--accent); font-weight: 500; font-size: 13.5px; }
.link-btn:hover { text-decoration: underline; }

.field { display: grid; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field input, .field textarea, .dlg input[type="text"], .invite-url {
  width: 100%; min-width: 0; height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
.field textarea { height: auto; padding: 9px 12px; resize: vertical; line-height: 1.45; }
.field input:focus, .field textarea:focus, .dlg input[type="text"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.hint { margin: 0; font-size: 12.5px; color: var(--muted); }
.hint code { font: 12px ui-monospace, "SF Mono", Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.form-error { margin: 0 0 12px; padding: 9px 12px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: 13px; }
.form-error:empty { display: none; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.check { display: flex; gap: 10px; align-items: center; margin-top: 12px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.counter { font-variant-numeric: tabular-nums; }

/* ---------- auth (Chatwoot's sign-in card) ---------- */
.auth { min-height: 100dvh; display: flex; flex-direction: column; background: var(--thread); overflow-y: auto; height: 100dvh; }
.auth-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 650; font-size: 18px; letter-spacing: -.01em; }
.brand b { color: var(--accent); font-weight: 650; }
.logo { display: block; width: 34px; height: 34px; border-radius: 8px; }
.auth-main { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 12px 16px; }
.auth-card { margin: auto 0; width: 100%; max-width: 420px; padding: 32px 32px 28px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.auth-card h1 { margin: 0 0 6px; font-size: 24px; line-height: 1.2; letter-spacing: -.02em; font-weight: 600; }
.auth-card .sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.auth-card form { margin: 0; }
.auth-card .actions .btn { min-width: 110px; }
.auth-card .actions .btn.primary { flex: 1; height: 40px; }
.auth-foot { padding: 18px 24px; text-align: center; font-size: 12.5px; color: var(--muted); }
.or { display: flex; align-items: center; gap: 12px; margin: 22px 0 14px; color: var(--faint); font-size: 12.5px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.providers { display: flex; justify-content: center; gap: 10px; }
.provider { width: 52px; height: 40px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); display: grid; place-items: center; transition: background .15s, border-color .15s; }
.provider:hover { background: var(--hover); }
.provider img { width: 20px; height: 20px; }
.provider-note { margin: 10px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); }
.alt { margin: 22px 0 0; text-align: center; font-size: 13.5px; color: var(--muted); }
.alt a { font-weight: 500; text-decoration: none; }
.alt a:hover { text-decoration: underline; }
.who { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 3px 12px 3px 3px; margin-bottom: 18px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 13.5px; }
.who-avatar { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); color: var(--muted); }
.who-avatar .icon { width: 15px; height: 15px; }
.who-mail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pass { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.pass:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.pass input { border: 0 !important; box-shadow: none !important; background: transparent; flex: 1; }
.pass-toggle { display: grid; place-items: center; width: 38px; height: 36px; color: var(--muted); border-radius: 8px; }
.pass-toggle:hover { color: var(--ink); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 22px; }
.steps span { height: 3px; border-radius: 3px; background: var(--surface-3); transition: background .2s; }
.steps span.on { background: var(--accent); }

/* ---------- email verification banner ---------- */
.verify-banner { display: flex; align-items: center; gap: 10px; flex: none; margin: 0 12px 8px; padding: 10px 12px; border-radius: 8px; background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); color: var(--ink); font-size: 13px; line-height: 1.35; }
.verify-banner[hidden] { display: none; }
.verify-banner .icon { color: var(--warn); flex: none; }
.verify-dlg p { margin: 0 0 12px; }
.verify-dlg input { text-align: center; font-size: 22px; letter-spacing: 6px; font-variant-numeric: tabular-nums; }
.alt.fp { margin: -4px 0 14px; text-align: right; }
.alt.fp a { font-size: 13px; font-weight: 500; }

/* ================================================================ dashboard shell */
.shell { display: grid; grid-template-columns: var(--rail-w) var(--s2-w) var(--list-w) minmax(0, 1fr); height: 100dvh; overflow: hidden; background: var(--bg); }
.shell[data-info="open"] { grid-template-columns: var(--rail-w) var(--s2-w) var(--list-w) minmax(0, 1fr) var(--info-w); }
.nav-scrim { display: none; }

/* ---- icon rail ---- */
.rail { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 0; background: var(--rail); border-right: 1px solid var(--line); min-height: 0; z-index: 6; }
.rail-logo { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 12px; border-radius: 10px; }
.rail-logo img { width: 34px; height: 34px; border-radius: 8px; }
.rail-main, .rail-foot { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rail-main { flex: 1; }
.rail-btn { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; color: var(--muted); transition: background .15s, color .15s; }
.rail-btn .icon { width: 22px; height: 22px; }
.rail-btn:hover { background: var(--hover); color: var(--ink); }
.rail-btn[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.rail-label { display: none; }
.rail-dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--rail); }
.rail-me { display: grid; place-items: center; width: 40px; height: 40px; margin-top: 6px; border-radius: 50%; }
.rail-me .online-dot { border-color: var(--rail); }

/* ---- secondary sidebar ---- */
.side2 { display: flex; flex-direction: column; min-height: 0; background: var(--side2); border-right: 1px solid var(--line); }
.s2-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; flex: none; }
.s2-cv { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.s2-cv-text { display: grid; min-width: 0; }
.s2-cv-cap { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; font-weight: 500; }
.s2-cv strong { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s2-close { display: none; }
.s2-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 16px; }
.s2-group { display: grid; gap: 1px; padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.s2-item { width: 100%; display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 8px; color: var(--ink-2); text-align: left; font-size: 13.5px; transition: background .12s; }
.s2-item > .icon { width: 18px; height: 18px; color: var(--muted); }
.s2-item:hover { background: var(--hover); }
.s2-item[aria-current="page"] { background: var(--active); color: var(--accent); font-weight: 500; }
.s2-item[aria-current="page"] > .icon { color: var(--accent); }
.s2-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s2-count { min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.s2-item[aria-current="page"] .s2-count { background: var(--accent-soft-2); color: var(--accent); }
.s2-muted { width: 14px !important; height: 14px !important; color: var(--faint) !important; }
.s2-sec { margin-top: 6px; }
.s2-sec-head { display: flex; align-items: center; gap: 4px; padding-right: 4px; }
.s2-sec-toggle { flex: 1; display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; text-align: left; }
.s2-sec-toggle:hover { color: var(--ink); }
.s2-caret { width: 12px !important; height: 12px !important; }
.s2-sec-add { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; color: var(--muted); }
.s2-sec-add:hover { background: var(--hover); color: var(--ink); }
.s2-sec-add .icon { width: 14px; height: 14px; }
.s2-sec-body { display: grid; gap: 1px; padding-left: 10px; margin-left: 10px; border-left: 1px solid var(--line); }
.s2-row { display: flex; align-items: center; }
.s2-row .s2-item { flex: 1; min-width: 0; }
.s2-more { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; color: var(--faint); opacity: 0; transition: opacity .12s; }
.s2-row:hover .s2-more, .s2-more:focus-visible { opacity: 1; }
.s2-more .icon { width: 16px; height: 16px; }
.s2-swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; margin: 0 4px; background: var(--h-a); }
.s2-swatch.h-a, .ci-chip-dot.h-a { background: var(--h-a); } .s2-swatch.h-b, .ci-chip-dot.h-b { background: var(--h-b); } .s2-swatch.h-c, .ci-chip-dot.h-c { background: var(--h-c); }
.s2-swatch.h-d, .ci-chip-dot.h-d { background: var(--h-d); } .s2-swatch.h-e, .ci-chip-dot.h-e { background: var(--h-e); } .s2-swatch.h-f, .ci-chip-dot.h-f { background: var(--h-f); }
.s2-add { color: var(--muted); }
.s2-add .icon { width: 14px !important; height: 14px !important; }
.s2-chat .avatar { margin-left: -1px; }
.s2-empty { margin: 4px 10px 6px; font-size: 12.5px; color: var(--faint); }

/* ---- conversation list column ---- */
.sidebar { position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--list); border-right: 1px solid var(--line); container-type: inline-size; }
@container (max-width: 320px) { .list-tabs { gap: 10px; padding: 0 12px; } .list-tab { font-size: 12.5px; gap: 4px; } .tab-count { min-width: 16px; padding: 0 4px; } .chat-item { padding: 12px; } }
.side-base, .panel { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.list-head { display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 12px 0 16px; flex: none; }
.list-title { flex: 1; min-width: 0; margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-head-actions { display: flex; gap: 4px; }
.head-btn { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: var(--muted); background: var(--surface-2); transition: background .15s, color .15s; }
.head-btn .icon { width: 16px; height: 16px; }
.head-btn:hover { background: var(--surface-3); color: var(--ink); }
.folders-btn { display: none; }
.list-search { padding: 0 12px 8px; flex: none; }
.panel-head { display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 12px; flex: none; border-bottom: 1px solid var(--line); }
.panel-head h2 { flex: 1; margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.search { position: relative; flex: 1; display: flex; align-items: center; min-width: 0; }
.search .search-icon { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.search-input { width: 100%; height: 34px; padding: 0 32px 0 32px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); transition: border-color .15s, box-shadow .15s; font-size: 13.5px; }
.search-input::-webkit-search-cancel-button { display: none; }
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.search-input::placeholder { color: var(--faint); }
.search-clear { position: absolute; right: 4px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; color: var(--muted); }
.search-clear .icon { width: 14px; height: 14px; }
.search.in-panel { margin: 10px 12px; flex: none; }
.list-tabs { display: flex; gap: 16px; padding: 0 16px; border-bottom: 1px solid var(--line); flex: none; overflow-x: auto; scrollbar-width: none; }
.list-tab { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 38px; font-size: 13.5px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.list-tab:hover { color: var(--ink); }
.list-tab[aria-selected="true"] { color: var(--accent); }
.list-tab[aria-selected="true"]::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.tab-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 5px; background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.list-tab[aria-selected="true"] .tab-count { background: var(--accent-soft); color: var(--accent); }
.conn { display: flex; align-items: center; gap: 10px; padding: 8px 16px; font-size: 12.5px; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--faint); border-right-color: transparent; animation: spin .8s linear infinite; }
.side-body, .panel-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.chat-list { list-style: none; margin: 0; padding: 0 0 16px; }
.chat-list > li { border-bottom: 1px solid var(--line); }
.chat-item { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; color: inherit; text-decoration: none; transition: background .12s; }
.chat-item:hover { background: var(--hover); }
.chat-item[aria-current="page"] { background: var(--active); }
.chat-item[aria-current="page"]::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.chat-item:focus-visible { border-radius: 0; box-shadow: inset var(--focus); }
.chat-item > .avatar { margin-top: 2px; }
.ci-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.ci-head { display: flex; align-items: center; gap: 6px; min-width: 0; height: 18px; }
.ci-tag { display: inline-flex; align-items: center; gap: 4px; min-width: 0; font-size: 12px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ci-tag .icon { width: 13px; height: 13px; color: var(--faint); }
.ci-flags { display: inline-flex; align-items: center; gap: 2px; flex: 1; }
.ci-flags .icon { width: 13px; height: 13px; color: var(--faint); }
.pin .icon { transform: rotate(45deg); }
.ci-top, .ci-bottom { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ci-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 5px; font-weight: 500; font-size: 14.5px; color: var(--ink); }
.ci-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-meta { display: flex; align-items: center; gap: 3px; flex: none; font-size: 12px; color: var(--faint); margin-left: auto; }
.ci-preview { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; color: var(--muted); }
.ci-preview .ci-out { width: 13px; height: 13px; color: var(--faint); vertical-align: -2px; margin-right: 3px; }
.ci-who { color: var(--ink-2); }
.ci-draft { color: var(--danger); }
.ci-typing { color: var(--accent); }
.ci-sys, .ci-empty { font-style: italic; }
.ci-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.ci-chip { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 5px; border: 1px solid var(--line-2); font-size: 11.5px; color: var(--ink-2); background: var(--surface); }
.ci-chip-dot { width: 8px; height: 8px; border-radius: 2px; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11.5px; font-weight: 600; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; flex: none; }
.badge.muted { background: var(--faint); color: var(--bg); }
.tick { display: inline-flex; color: var(--faint); }
.tick .icon { width: 15px; height: 15px; }
.tick.read { color: var(--accent); }
.tick.failed { color: var(--danger); }
.has-unread .ci-preview { color: var(--ink-2); }
.has-unread .ci-title { font-weight: 600; }
.list-empty { list-style: none; border: 0 !important; }
.load-more { display: grid; place-items: center; padding: 12px; border: 0 !important; }
.fab.static { display: inline-grid; place-items: center; position: sticky; bottom: 16px; margin: 16px 16px 16px auto; width: 48px; height: 48px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); }
.fab.static:hover { background: var(--accent-strong); }

.results { padding: 0 8px 16px; }
.res-sec { margin-bottom: 6px; }
.sec-title { margin: 14px 10px 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.rows { list-style: none; margin: 0; padding: 0 8px; }
.results .rows { padding: 0; }
.row-btn, .member { width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; text-align: left; color: inherit; }
.row-btn:hover:not(:disabled) { background: var(--hover); }
.row-btn:disabled { opacity: .55; }
.row-btn.selected { background: var(--accent-soft); }
.row-main { flex: 1; min-width: 0; display: grid; }
.row-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { font-size: 12px; color: var(--faint); flex: none; }
.check-dot { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; color: transparent; flex: none; }
.check-dot .icon { width: 12px; height: 12px; }
.selected .check-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* avatars */
.avatar { position: relative; display: inline-grid; place-items: center; flex: none; border-radius: 50%; color: #fff; font-weight: 600; background: var(--h-a); overflow: visible; letter-spacing: .01em; }
.avatar > img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar .icon { width: 55%; height: 55%; }
.avatar.h-a { background: var(--h-a); } .avatar.h-b { background: var(--h-b); } .avatar.h-c { background: var(--h-c); }
.avatar.h-d { background: var(--h-d); } .avatar.h-e { background: var(--h-e); } .avatar.h-f { background: var(--h-f); }
.avatar.saved { background: var(--accent) !important; color: var(--accent-ink); }
[data-theme="dark"] .avatar { color: #121418; }
.s-xxs { width: 20px; height: 20px; font-size: 8.5px; }
.s-xs { width: 28px; height: 28px; font-size: 11px; }
.s-sm { width: 40px; height: 40px; font-size: 14px; }
.s-md { width: 48px; height: 48px; font-size: 16px; }
.s-lg { width: 64px; height: 64px; font-size: 22px; }
.s-xl { width: 96px; height: 96px; font-size: 32px; }
.online-dot { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%; background: #30a46c; border: 2px solid var(--list); }
.s-xs .online-dot { width: 9px; height: 9px; border-width: 1.5px; right: -1px; bottom: -1px; }
.s-lg .online-dot { width: 15px; height: 15px; right: 1px; bottom: 1px; border-color: var(--panel); }

/* menus */
.menu { position: fixed; z-index: 50; min-width: 220px; max-width: min(320px, calc(100vw - 16px)); padding: 4px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); animation: pop .12s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-2px) scale(.98); } to { opacity: 1; transform: none; } }
.menu-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; font-size: 13.5px; font-weight: 400; text-align: left; }
.menu-item .icon { width: 16px; height: 16px; color: var(--muted); }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); box-shadow: none; }
.menu-item.danger, .menu-item.danger .icon { color: var(--danger); }
.menu-sep { height: 1px; margin: 4px 6px; background: var(--line); }
.menu-profile { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.menu-title { display: grid; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.menu-title strong { font-weight: 600; }
.menu-title span { font-size: 12.5px; color: var(--muted); }
.mp-text { display: grid; min-width: 0; }
.mp-text strong { font-weight: 600; }
.mp-text span { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.react-row { display: flex; gap: 2px; padding: 2px 2px 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.react-btn { width: 32px; height: 32px; border-radius: 8px; font-size: 18px; display: grid; place-items: center; transition: transform .12s, background .12s; }
.react-btn:hover, .react-btn:focus-visible { background: var(--hover); transform: scale(1.12); }
.react-btn.on { background: var(--accent-soft); }
.react-btn { font-family: var(--emoji); }
.react-more { color: var(--muted); margin-left: 4px; border-radius: 50%; background: var(--surface-2); }
.react-more .icon { width: 16px; height: 16px; }
.react-more:hover, .react-more:focus-visible { color: var(--accent); background: var(--accent-soft); border-radius: 50%; }

/* emoji picker: popover on desktop, bottom sheet on phones */
.emoji-picker { position: fixed; z-index: 55; width: 364px; height: 428px; display: flex; flex-direction: column; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); overflow: hidden; animation: pop .14s ease-out; --ep-cols: 9; --ep-cell: 40px; }
.ep-head { position: relative; display: flex; align-items: center; gap: 6px; padding: 10px 10px 6px; flex: none; }
.ep-search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 6px 0 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid transparent; transition: border-color .15s, background .15s; cursor: text; }
.ep-search:focus-within { background: var(--surface); border-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.ep-search > .icon { width: 16px; height: 16px; color: var(--faint); }
.ep-input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font-size: 14px; color: var(--ink); }
.ep-input::placeholder { color: var(--faint); }
.ep-input:focus-visible { box-shadow: none; }
.ep-input::-webkit-search-cancel-button { display: none; }
.ep-clear { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; color: var(--faint); }
.ep-clear:hover { background: var(--hover); color: var(--ink); }
.ep-clear .icon { width: 14px; height: 14px; }
.ep-tone { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; flex: none; transition: background .15s; }
.ep-tone:hover, .ep-tone[aria-expanded="true"] { background: var(--hover); }
.ep-glyph { font: 20px/1 var(--emoji); }
.ep-tones { position: absolute; right: 8px; top: 50px; z-index: 2; display: flex; gap: 2px; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); animation: pop .12s ease-out; }
.ep-tone-opt { width: 36px; height: 36px; border-radius: 9px; font: 22px/1 var(--emoji); display: grid; place-items: center; }
.ep-tone-opt:hover { background: var(--hover); }
.ep-tone-opt[aria-checked="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent); }
.ep-body { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 6px 8px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.ep-sec.lazy .ep-grid { visibility: hidden; }
.ep-title { position: sticky; top: 0; z-index: 1; height: 30px; margin: 0; padding: 0 6px; display: flex; align-items: center; font-size: 12px; font-weight: 600; color: var(--muted); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(6px); }
.ep-grid { display: grid; grid-template-columns: repeat(var(--ep-cols), minmax(0, 1fr)); grid-auto-rows: var(--ep-cell); }
.ep-e { display: grid; place-items: center; border-radius: 9px; font: 25px/1 var(--emoji); transition: background .1s, transform .1s; -webkit-tap-highlight-color: transparent; }
.ep-e:hover { background: var(--hover); }
.ep-e:hover:not(:active) { transform: scale(1.08); }
.ep-e:focus-visible { background: var(--accent-soft); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 60%, transparent); border-radius: 9px; }
.ep-e:active { transform: scale(.92); }
.ep-none { margin: 48px 16px; text-align: center; color: var(--muted); font-size: 13.5px; }
.ep-skel { display: grid; grid-template-columns: repeat(var(--ep-cols), minmax(0, 1fr)); grid-auto-rows: var(--ep-cell); padding-top: 30px; }
.ep-skel span { margin: 7px; border-radius: 50%; background: var(--surface-2); animation: ep-pulse 1.1s ease-in-out infinite alternate; }
@keyframes ep-pulse { to { opacity: .45; } }
.ep-tabs { display: flex; justify-content: space-between; gap: 2px; padding: 6px 8px; border-top: 1px solid var(--line); background: var(--surface); flex: none; transition: opacity .15s; }
.ep-tabs.dim { opacity: .55; }
.ep-tab { flex: 1; display: grid; place-items: center; height: 32px; max-width: 40px; border-radius: 8px; color: var(--faint); transition: background .15s, color .15s; }
.ep-tab .icon { width: 19px; height: 19px; }
.ep-tab:hover { background: var(--hover); color: var(--ink-2); }
.ep-tab[aria-selected="true"] { color: var(--accent); background: var(--accent-soft); }
.ep-scrim { position: fixed; inset: 0; z-index: 54; background: rgba(10, 12, 16, .32); animation: ep-fade .18s ease-out; }
@keyframes ep-fade { from { opacity: 0; } }
.emoji-picker.sheet { left: 0; right: 0; bottom: 0; top: auto; width: 100%; height: min(58dvh, 460px); border-radius: 18px 18px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); animation: none; transform: translateY(100%); transition: transform .24s cubic-bezier(.2, .8, .2, 1); }
.emoji-picker.sheet.in { transform: none; }
.emoji-picker.sheet.docked { box-shadow: 0 -8px 24px rgba(10, 12, 16, .12); }
[data-theme="dark"] .emoji-picker.sheet.docked { box-shadow: 0 -8px 24px rgba(0, 0, 0, .45); }
.ep-grab { width: 36px; height: 4px; margin: 8px auto 0; border-radius: 2px; background: var(--line-2); flex: none; }
.sheet .ep-head { padding-top: 8px; }
.sheet .ep-e { font-size: 28px; }
.sheet .ep-tabs { padding: 6px 6px 8px; }
.sheet .ep-tab { height: 36px; }

/* ================================================================ thread */
.convo-pane { position: relative; min-width: 0; min-height: 0; display: flex; background: var(--thread); container-type: inline-size; }
.convo-empty { flex: 1; display: grid; place-items: center; padding: 24px; }
.empty-card { display: grid; justify-items: center; gap: 6px; text-align: center; max-width: 360px; }
.empty-card img { width: 56px; height: 56px; border-radius: 14px; margin-bottom: 8px; opacity: .95; }
.empty-keys { margin: 8px 0 0; font-size: 12.5px; color: var(--faint); }
.convo { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.convo-head { display: flex; align-items: center; gap: 8px; height: 64px; padding: 0 12px 0 16px; background: var(--bg); border-bottom: 1px solid var(--line); flex: none; z-index: 3; }
.back-btn { display: none; }
.convo-peer { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 4px 6px; margin-left: -6px; border-radius: 8px; text-align: left; }
.convo-peer:hover { background: var(--hover); }
.cp-text { min-width: 0; display: grid; gap: 1px; }
.cp-title { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-sub { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.cp-kind { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.cp-kind .icon { width: 13px; height: 13px; }
.cp-dot { color: var(--faint); }
.cp-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head-actions { display: flex; align-items: center; gap: 2px; }
.split { display: inline-flex; margin-left: 8px; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: var(--surface); }
.split-main { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; font-size: 13.5px; font-weight: 500; }
.split-main .icon { width: 16px; height: 16px; color: var(--muted); }
.split-caret { display: grid; place-items: center; width: 30px; height: 32px; border-left: 1px solid var(--line-2); color: var(--muted); }
.split-caret .icon { width: 14px; height: 14px; }
.split-main:hover, .split-caret:hover { background: var(--hover); }
.convo-search { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: var(--bg); border-bottom: 1px solid var(--line); }
.convo-search input { flex: 1; min-width: 0; height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); }
.convo-search input:focus { outline: none; border-color: var(--accent); }
.cs-icon { color: var(--faint); width: 16px; height: 16px; }
.cs-count { font-size: 12.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.messages { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px 0 8px; outline: none; }
.messages:focus-visible { box-shadow: inset var(--focus); border-radius: 0; }
.sentinel { height: 1px; }
/* the thread uses the whole column: when the details panel or the folder sidebar is closed, messages and the composer
   widen with it (gutters scale with the column), instead of staying in a centred strip with empty bands beside it */
.msg-list { padding: 0 clamp(16px, 2.5cqi, 40px); display: flex; flex-direction: column; }
/* date pill (Telegram): one section per day, the pill is sticky inside its own day, so it floats above that day's
   messages and the next day's pill pushes it away instead of piling on top of it. Opaque: a translucent pill let the
   bubble text under it show through (ghost text), most visibly in dark mode */
.day-group { display: flex; flex-direction: column; }
.day { position: sticky; top: 8px; z-index: 3; align-self: center; margin: 12px 0; }
.day span { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 500; line-height: 18px; color: var(--ink-2); background: var(--day-pill); border: 1px solid color-mix(in srgb, var(--ink) 8%, transparent); box-shadow: 0 1px 3px rgb(0 0 0 / .1); }
.unread-sep { display: flex; align-items: center; gap: 12px; margin: 10px 0; font-size: 12px; color: var(--accent); font-weight: 500; }
.unread-sep::before, .unread-sep::after { content: ''; flex: 1; height: 1px; background: color-mix(in srgb, var(--accent) 40%, transparent); }
.msg { position: relative; display: flex; align-items: flex-end; gap: 8px; margin-top: 2px; outline: none; }
.msg.first { margin-top: 10px; }
.msg.mine { flex-direction: row-reverse; }
.msg-av { width: 28px; flex: none; }
.msg-col { display: flex; flex-direction: column; max-width: min(600px, 76%); min-width: 0; }
.mine .msg-col { align-items: flex-end; }
.bubble { position: relative; padding: 8px 12px 6px; border-radius: 12px; background: var(--in); color: var(--in-ink); overflow-wrap: anywhere; min-width: 72px; }
.mine .bubble { background: var(--out); color: var(--out-ink); }
.theirs.last .bubble { border-bottom-left-radius: 4px; }
.mine.last .bubble { border-bottom-right-radius: 4px; }
.post .bubble { background: var(--bg); border: 1px solid var(--line); color: var(--ink); }
.post.mine .bubble { background: var(--bg); color: var(--ink); }
.msg.flash .bubble { animation: flash 1.6s ease; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); } 100% { box-shadow: none; } }
.msg:focus-visible .bubble { box-shadow: var(--focus); }
.pending .bubble { opacity: .8; }
.sender { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.sender.h-a { color: var(--h-a); } .sender.h-b { color: var(--h-b); } .sender.h-c { color: var(--h-c); }
.sender.h-d { color: var(--h-d); } .sender.h-e { color: var(--h-e); } .sender.h-f { color: var(--h-f); }
.fwd { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); margin-bottom: 3px; }
.fwd .icon { width: 13px; height: 13px; }
.fwd strong { font-weight: 600; color: var(--ink-2); }
.quote { display: grid; width: 100%; margin: 2px 0 6px; padding: 5px 10px; border-left: 3px solid var(--accent); border-radius: 4px 8px 8px 4px; background: color-mix(in srgb, var(--ink) 5%, transparent); text-align: left; min-width: 0; }
.quote:hover { background: color-mix(in srgb, var(--ink) 9%, transparent); }
.q-name { font-size: 12.5px; font-weight: 600; color: var(--accent); }
.q-text { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; opacity: .8; }
.text { white-space: pre-wrap; font-size: 14px; line-height: 1.5; }
/* messages of only 1-3 emojis show large (Telegram); without a quote or sender line they drop the bubble */
.bubble.jumbo .text { font-family: var(--emoji); line-height: 1.15; letter-spacing: 2px; }
.bubble.jumbo-1 .text { font-size: 56px; }
.bubble.jumbo-2 .text { font-size: 44px; }
.bubble.jumbo-3 .text { font-size: 36px; }
.bubble.jumbo.bare { background: transparent; border: 0; padding: 2px 0 0; min-width: 0; }
.bubble.jumbo.bare .text { padding: 0 2px; }
.bubble.jumbo.bare .meta { float: none; display: flex; width: max-content; margin: 4px 0 0 auto; padding: 3px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.theirs .bubble.jumbo.bare .meta { margin-left: 0; }
.mine .bubble.jumbo.bare .meta, .mine .bubble.jumbo.bare .meta .tick { color: var(--muted); }
.mine .bubble.jumbo.bare .meta .tick.read { color: var(--accent); }
.text a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.mine .text a { color: var(--accent-strong); }
[data-theme="dark"] .mine .text a { color: #ffc7cc; }
.text code { font: 13px ui-monospace, 'SF Mono', Menlo, Consolas, monospace; padding: 1px 5px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 8%, transparent); }
.text pre { margin: 4px 0; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--ink) 7%, transparent); overflow-x: auto; white-space: pre; }
.text pre code { padding: 0; background: none; }
.meta { float: right; display: inline-flex; align-items: center; gap: 4px; margin: 7px 0 -2px 12px; font-size: 11px; color: var(--faint); line-height: 1; white-space: nowrap; user-select: none; font-variant-numeric: tabular-nums; }
.mine .meta, .mine .meta .tick { color: var(--out-meta); }
.mine .meta .tick.read { color: var(--accent); }
.post .meta, .post.mine .meta, .post.mine .meta .tick { color: var(--faint); }
[data-theme="dark"] .mine:not(.post) .meta .tick.read { color: #ffb3ba; }
.meta .tick .icon { width: 15px; height: 15px; }
.edited { font-style: italic; }
.pin-flag .icon, .views .icon { width: 13px; height: 13px; vertical-align: -2px; }
.views { display: inline-flex; align-items: center; gap: 3px; }
.bot-badge { display: inline-block; padding: 1px 5px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: .04em; background: var(--accent-soft); color: var(--accent); vertical-align: 1px; }
.sender .bot-badge { margin-left: 6px; }
.kb { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.bubble.has-kb { min-width: min(340px, 80vw); }
.kb-row { display: flex; gap: 6px; }
.kb-btn { flex: 1; min-width: 0; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink); font-size: 13px; font-weight: 500; text-align: center; cursor: pointer; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: background .15s, border-color .15s; }
.kb-btn:hover { background: var(--hover); border-color: color-mix(in srgb, var(--accent) 40%, var(--line-2)); }
.kb-btn:disabled { opacity: .6; cursor: default; }
.bubble.has-photo { padding: 4px; }
.bubble.has-photo .text, .bubble.has-photo .sender, .bubble.has-photo .fwd, .bubble.has-photo .quote { margin-left: 8px; margin-right: 8px; }
.bubble.has-photo .text { padding-bottom: 4px; padding-top: 4px; }
.bubble.has-photo .meta { margin-right: 8px; margin-bottom: 4px; }
.bubble.media-only .meta { position: absolute; right: 10px; bottom: 10px; margin: 0; padding: 3px 7px; border-radius: 999px; background: rgba(15, 17, 21, .55); color: #fff !important; }
.bubble.media-only .meta .tick, .bubble.media-only .meta .tick.read { color: #fff !important; }
.photo { display: block; border-radius: 9px; overflow: hidden; max-width: 100%; }
.photo img { max-width: 100%; height: auto; background: var(--surface-3); }
.voice { display: flex; align-items: center; gap: 10px; min-width: 230px; padding: 2px 0; }
.vp-play { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); flex: none; }
.vp-play .icon { width: 18px; height: 18px; }
.vp-main { flex: 1; display: grid; gap: 6px; }
.vp-bar { position: relative; height: 4px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 15%, transparent); cursor: pointer; }
.vp-bar::before { content: ''; position: absolute; inset: -8px 0; }
.vp-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 4px; background: var(--accent); }
.vp-time { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mine .vp-time { color: var(--out-meta); }
.file-card { display: flex; align-items: center; gap: 12px; min-width: 230px; padding: 6px 8px; margin: 2px -4px; border-radius: 8px; background: color-mix(in srgb, var(--bg) 70%, transparent); color: inherit; text-decoration: none; }
.file-ico { width: 38px; height: 38px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.file-ico .icon { width: 20px; height: 20px; }
.file-meta { flex: 1; min-width: 0; display: grid; }
.file-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: 12px; color: var(--muted); }
.mine .file-size { color: var(--out-meta); }
.file-dl { color: var(--muted); width: 18px; height: 18px; }
.file-card:hover .file-name { text-decoration: underline; }
.file-card.static { padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line-2); font-size: 12.5px; transition: border-color .1s; }
.reaction:hover { border-color: var(--faint); }
.reaction.mine { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
.r-emoji { font: 14px/1 var(--emoji); }
.r-count { font-weight: 600; font-variant-numeric: tabular-nums; }
.msg-more { align-self: center; width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; color: var(--muted); opacity: 0; transition: opacity .12s, background .12s; }
.msg-more .icon { width: 16px; height: 16px; }
.msg:hover .msg-more, .msg:focus-within .msg-more, .msg-more:focus-visible { opacity: 1; }
.msg-more:hover { background: var(--hover); }
.retry { align-self: center; display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--danger); font-weight: 500; }
.retry .icon { width: 15px; height: 15px; }
.msg.sys { justify-content: center; margin: 8px 0; }
.msg.sys span { padding: 4px 12px; border-radius: 999px; font-size: 12.5px; color: var(--ink-2); background: var(--sys); text-align: center; }
.convo-hello { flex: 1; display: grid; place-items: center; min-height: 50vh; }
.convo-hello .empty { padding: 24px 28px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.load-error { display: grid; gap: 10px; justify-items: center; margin: 40px auto; padding: 18px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.load-error p { margin: 0; }
.to-bottom { position: absolute; right: 24px; bottom: 170px; width: 40px; height: 40px; border-radius: 50%; background: var(--bg); color: var(--muted); display: grid; place-items: center; box-shadow: var(--shadow-2); border: 1px solid var(--line); z-index: 4; }
.to-bottom:hover { color: var(--ink); }
.to-bottom .badge { position: absolute; top: -6px; right: -4px; }

/* composer: Chatwoot's reply box */
.composer { flex: none; width: 100%; padding: 4px clamp(16px, 2.5cqi, 40px) 16px; }
.compose-box { border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg); transition: border-color .15s, box-shadow .15s; }
.compose-box:focus-within { border-color: color-mix(in srgb, var(--accent) 50%, var(--line-2)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent); }
.compose-fmt { display: flex; gap: 2px; padding: 6px 8px 0; }
.fmt-btn { display: grid; place-items: center; width: 28px; height: 26px; border-radius: 6px; color: var(--muted); }
.fmt-btn .icon { width: 15px; height: 15px; }
.fmt-btn:hover { background: var(--hover); color: var(--ink); }
.compose-field { display: flex; }
.compose-input { flex: 1; min-width: 0; min-height: 44px; border: 0; resize: none; background: transparent; padding: 8px 14px; max-height: 200px; line-height: 1.5; outline: none; }
.compose-input:focus-visible { box-shadow: none; }
.compose-input::placeholder { color: var(--faint); }
.compose-foot { display: flex; align-items: center; gap: 8px; padding: 6px 8px 8px; }
.compose-tools { display: flex; gap: 4px; }
.tool-btn { width: 32px; height: 32px; border-radius: 8px; background: var(--surface-2); color: var(--muted); }
.tool-btn:hover { background: var(--surface-3); }
.compose-hint { flex: 1; text-align: right; font-size: 11.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.online-text { color: var(--ok) !important; }
.send-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 45%, var(--bg)); color: var(--accent-ink); font-weight: 500; font-size: 13.5px; transition: background .15s; }
.send-btn kbd { border-color: color-mix(in srgb, var(--accent-ink) 35%, transparent); background: transparent; color: inherit; opacity: .85; }
.send-btn .icon { width: 16px; height: 16px; }
.send-btn.ready { background: var(--accent); }
.send-btn.ready:hover { background: var(--accent-strong); }
.compose-ctx { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; padding: 6px 6px 6px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.ctx-icon { color: var(--accent); width: 18px; height: 18px; }
.ctx-main { flex: 1; min-width: 0; display: grid; text-align: left; padding-left: 10px; border-left: 3px solid var(--accent); }
.ctx-title { font-size: 12.5px; font-weight: 600; color: var(--accent); }
.ctx-text { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 6px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg); }
.rec-cancel { color: var(--danger); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.rec-label { flex: 1; color: var(--muted); font-size: 13.5px; }
.compose-blocked { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.compose-blocked .icon { width: 18px; height: 18px; }
.drop { position: absolute; inset: 8px; z-index: 10; display: grid; place-items: center; border-radius: 12px; border: 2px dashed var(--accent); background: color-mix(in srgb, var(--bg) 88%, transparent); }
.drop-box { display: grid; justify-items: center; gap: 8px; color: var(--accent); font-weight: 600; pointer-events: none; }
.drop-box .icon { width: 36px; height: 36px; }

/* ================================================================ details panel */
.info-pane { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-left: 1px solid var(--line); }
.info-head { display: flex; align-items: center; gap: 8px; height: 64px; padding: 0 12px 0 16px; flex: none; border-bottom: 1px solid var(--line); }
.info-head h2 { flex: 1; margin: 0; font-size: 15px; font-weight: 600; }
.info-body { flex: 1; overflow-y: auto; padding: 16px 12px 24px; }
.info-hero { display: grid; justify-items: start; gap: 2px; padding: 0 4px 12px; }
.info-hero h3 { margin: 10px 0 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; overflow-wrap: anywhere; }
.info-handle { display: flex; align-items: center; gap: 4px; margin: 0; font-size: 13.5px; color: var(--muted); }
.info-sub { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-2); }
.info-rows { display: grid; gap: 2px; padding: 0 4px 10px; }
.info-row { display: flex; align-items: center; gap: 10px; min-height: 28px; font-size: 13.5px; color: var(--ink-2); }
.info-row > .icon { width: 16px; height: 16px; color: var(--muted); }
.info-row-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info-acts { display: flex; gap: 8px; padding: 2px 4px 16px; }
.act-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; background: var(--surface-2); color: var(--ink-2); transition: background .15s; }
.act-btn .icon { width: 17px; height: 17px; }
.act-btn:hover { background: var(--surface-3); }
.act-btn.danger { background: var(--danger-soft); color: var(--danger); }
.acc { margin-bottom: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.acc-head { display: flex; align-items: center; gap: 8px; padding: 11px 14px; font-weight: 500; cursor: pointer; list-style: none; border-radius: 10px; }
.acc-head::-webkit-details-marker { display: none; }
.acc-head > span:first-child { flex: 1; }
.acc-head:hover { background: var(--hover); }
.acc-count { min-width: 20px; height: 18px; padding: 0 6px; border-radius: 5px; background: var(--surface-2); font-size: 11px; font-weight: 600; color: var(--muted); display: inline-grid; place-items: center; }
.acc-plus, .acc-minus { width: 16px; height: 16px; color: var(--accent); }
.acc-minus, .acc[open] .acc-plus { display: none; }
.acc[open] .acc-minus { display: block; }
.acc[open] > .acc-head { border-bottom: 1px solid var(--line); border-radius: 10px 10px 0 0; }
.acc-body { padding: 8px 10px 10px; }
.acc-empty { margin: 4px 4px; font-size: 13px; color: var(--faint); }
.acc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.acc-list li { display: flex; align-items: center; gap: 4px; }
.acc-link, .acc-file { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 13px; }
.acc-link .icon { width: 15px; height: 15px; color: var(--muted); }
.acc-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-link:hover, .acc-file:hover { background: var(--hover); }
.acc-jump { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; color: var(--muted); }
.acc-jump .icon { width: 14px; height: 14px; }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.media-cell { aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.media-cell img { width: 100%; height: 100%; object-fit: cover; }
.info-actions { display: grid; padding: 2px 0; }
.row-action { display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-radius: 8px; font-weight: 400; text-align: left; font-size: 13.5px; }
.row-action .icon { width: 17px; height: 17px; color: var(--muted); }
.row-action:hover { background: var(--hover); }
.row-action.danger, .row-action.danger .icon { color: var(--danger); }
.avatar-edit { position: relative; border-radius: 50%; }
.ae-badge { position: absolute; right: -2px; bottom: -2px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); border: 2px solid var(--panel); }
.ae-badge .icon { width: 12px; height: 12px; }
.invite { margin: 4px 0 0; padding: 6px; border-top: 1px solid var(--line); display: grid; gap: 8px; justify-items: start; }
.invite .sec-title { margin: 8px 0 0; }
.invite-row { display: flex; gap: 6px; width: 100%; align-items: center; }
.invite-url { height: 32px; font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); }
.invite p { margin: 0; font-size: 13px; }
.members-sec .sec-title { margin: 4px 6px 4px; }
.members { list-style: none; margin: 0; padding: 0; }
.member { padding: 6px; }
.member .row-title { font-size: 13.5px; }
.role { font-size: 11.5px; color: var(--muted); padding: 1px 7px; border-radius: 5px; border: 1px solid var(--line-2); }
.role.owner { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-soft); }
.add-members { margin: 6px 6px 2px; }

/* ---------- settings panels ---------- */
.settings { padding: 8px 0 24px; }
.set-group { margin: 8px 12px; padding: 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: grid; }
.set-row { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; text-align: left; width: 100%; }
.set-row .icon { color: var(--muted); width: 18px; height: 18px; }
.set-row .chev { width: 16px; height: 16px; color: var(--faint); }
button.set-row:hover { background: var(--hover); }
.set-row.danger, .set-row.danger .icon { color: var(--danger); }
.set-row.static { cursor: default; }
.set-hero { display: grid; justify-items: center; gap: 2px; padding: 12px 20px 14px; text-align: center; }
.set-hero h3 { margin: 10px 0 0; font-size: 17px; font-weight: 600; }
.set-hero p { margin: 0; font-size: 13.5px; }
.seg { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button { height: 28px; padding: 0 12px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.pf { padding: 8px 16px 24px; }
.pf-photo { display: grid; justify-items: center; gap: 10px; margin: 6px 0 18px; }
.pf-av .avatar { pointer-events: none; }
.privacy { padding: 0 8px 24px; }
.privacy fieldset { border: 0; margin: 0 0 8px; padding: 0; }
.privacy legend { padding: 0; }
.radio { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.radio:hover { background: var(--hover); }
.radio input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; margin: 0; }
.switch { position: relative; width: 36px; height: 20px; border-radius: 999px; background: var(--surface-3); flex: none; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform .18s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(16px); }
.switch:disabled { opacity: .5; }
.notif { padding: 8px 12px; }
.sessions { list-style: none; margin: 0; padding: 0 8px; }
.session { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; }
.session > .icon { color: var(--muted); }
.people-results .rows, .people .rows { padding: 0 8px; }
.newgroup { position: relative; display: flex; flex-direction: column; min-height: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px 0 2px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 500; font-size: 13px; }
.chip .icon { width: 13px; height: 13px; }
.newgroup .fab.static { margin-top: auto; }
.bots-list { padding: 0 8px; }

.empty { display: grid; justify-items: center; gap: 4px; padding: 36px 24px; text-align: center; }
.empty-icon { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 8px; }
.empty-icon .icon { width: 26px; height: 26px; }
.empty-title { margin: 0; font-weight: 600; font-size: 15px; }
.empty-text { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; max-width: 32ch; }

/* skeletons */
.sk { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.sk-list { padding: 4px 8px; }
.sk-row { display: flex; gap: 12px; align-items: center; padding: 12px 8px; }
.sk-av { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.sk-lines { flex: 1; display: grid; gap: 8px; }
.sk-l1 { height: 12px; width: 55%; }
.sk-l2 { height: 10px; width: 80%; }
.sk-msgs { display: flex; flex-direction: column; gap: 10px; padding: 24px 0; }
.sk-bubble { height: 40px; border-radius: 12px; background-color: var(--in); }
.sk-bubble.mine { align-self: flex-end; }

/* dialogs */
.dlg { width: min(460px, calc(100vw - 24px)); max-height: min(720px, calc(100dvh - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2); display: flex; flex-direction: column; }
.dlg:not([open]) { display: none; }
.dlg.tall { height: min(640px, calc(100dvh - 32px)); }
.dlg::backdrop { background: rgba(10, 12, 16, .4); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 8px 20px; }
.dlg-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.dlg-body { padding: 6px 20px 8px; overflow-y: auto; flex: 1; min-height: 0; }
.dlg-body > div > p:first-child { margin-top: 0; }
.dlg.tall .dlg-body { padding: 0; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.pick-list { padding: 0 8px 8px; }
.folder-dlg .sec-title { margin: 14px 0 6px; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.check-grid .check { margin-top: 6px; }
.pick-scroll { max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.pick-row:hover { background: var(--hover); }
.pick-row input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.upload { display: grid; gap: 12px; }
.up-list.photo { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.up-img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.up-list.photo:has(.up-img:only-child) { grid-template-columns: 1fr; }
.up-list.photo .up-img:only-child { aspect-ratio: auto; max-height: 340px; object-fit: contain; background: var(--surface-2); }
.up-list.file { display: grid; gap: 6px; }
.up-progress { width: 100%; height: 6px; accent-color: var(--accent); }
.join { display: grid; justify-items: center; gap: 2px; padding: 6px 0 4px; text-align: center; }
.join h3 { margin: 12px 0 0; font-size: 18px; }
.join p { margin: 0; }
.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(8, 9, 12, .94); color: #f3f4f6; display: flex; flex-direction: column; }
.viewer:not([open]) { display: none; }
.viewer::backdrop { background: rgba(8, 9, 12, .9); }
.viewer-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; }
.viewer-who { flex: 1; font-weight: 600; }
.viewer .icon-btn { color: #e7e9ee; }
.viewer .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.viewer-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 8px 16px 16px; }
.viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.viewer-cap { margin: 0 auto 20px; max-width: 70ch; text-align: center; padding: 0 16px; }

/* toasts */
.toasts { position: fixed; top: 14px; right: 14px; z-index: 60; display: grid; gap: 8px; width: min(360px, calc(100vw - 28px)); }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-2); font-size: 13.5px; animation: slide .2s ease-out; text-align: left; }
.toast .icon { width: 18px; height: 18px; }
.toast.error { background: var(--danger); color: #fff; }
[data-theme="dark"] .toast.error { color: #1a0d0c; }
.toast.msg { background: var(--surface); color: var(--ink); border: 1px solid var(--line); width: 100%; }
.toast.msg:hover { background: var(--hover); }
.toast-text { display: grid; min-width: 0; }
.toast-text strong { font-weight: 600; }
.toast-text span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast.out { opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s; }
@keyframes slide { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ================================================================ responsive */
/* >=1280: the folder sidebar can be hidden (its close button; the Folders button brings it back, remembered per
   browser); the list and thread move left and the thread takes the freed width */
@media (min-width: 1280px) {
  .s2-close { display: inline-grid; }
  .shell[data-s2="closed"] { grid-template-columns: var(--rail-w) var(--list-w) minmax(0, 1fr); }
  .shell[data-s2="closed"][data-info="open"] { grid-template-columns: var(--rail-w) var(--list-w) minmax(0, 1fr) var(--info-w); }
  .shell[data-s2="closed"] .side2 { display: none; }
  .shell[data-s2="closed"] .folders-btn { display: grid; }
  .shell[data-s2="closed"] .list-head { padding-left: 12px; }
}
/* <1280: the secondary sidebar folds away (Folders button opens it as a drawer); details overlay the thread */
@media (max-width: 1279px) {
  .shell, .shell[data-info="open"] { grid-template-columns: var(--rail-w) var(--list-w) minmax(0, 1fr); }
  .side2 { position: fixed; top: 0; bottom: 0; left: var(--rail-w); width: 264px; z-index: 30; box-shadow: var(--shadow-2); transform: translateX(calc(-100% - var(--rail-w))); transition: transform .2s ease; visibility: hidden; }
  .shell[data-nav="open"] .side2 { transform: none; visibility: visible; }
  .shell[data-nav="open"] .nav-scrim { display: block; position: fixed; inset: 0; z-index: 29; background: rgba(10, 12, 16, .3); }
  .s2-close { display: inline-grid; }
  .folders-btn { display: grid; }
  .list-head { padding-left: 12px; }
  .info-pane { position: fixed; top: 0; right: 0; bottom: 0; width: min(var(--info-w), 100vw); z-index: 20; box-shadow: var(--shadow-2); }
}
@media (max-width: 1023px) { :root { --list-w: 300px; } .split-main { padding: 0 10px; } }
/* phones: rail becomes a bottom tab bar; list -> thread -> details are stacked screens (Chatwoot mobile) */
@media (max-width: 767px) {
  :root { --rail-w: 0px; }
  .shell, .shell[data-info="open"] { grid-template-columns: 100%; grid-template-rows: minmax(0, 1fr); }
  .shell > .rail { position: fixed; left: 0; right: 0; bottom: 0; height: calc(58px + env(safe-area-inset-bottom)); padding: 4px 4px env(safe-area-inset-bottom); flex-direction: row; align-items: stretch; gap: 0; border-right: 0; border-top: 1px solid var(--line); background: var(--bg); z-index: 15; }
  .rail-logo { display: none; }
  .rail-main, .rail-foot { flex-direction: row; gap: 0; align-items: stretch; }
  .rail-main { flex: 5; }
  .rail-foot { flex: 1; }
  .rail-btn, .rail-me { flex: 1; width: auto; height: auto; margin: 0; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
  .rail-btn[aria-current="page"] { background: transparent; }
  .rail-label { display: block; font-size: 10.5px; font-weight: 500; }
  .rail-bell { display: none; }
  .rail-dot { top: 6px; right: calc(50% - 16px); }
  .shell[data-view="chat"] > .rail, .shell[data-info="open"] > .rail { display: none; }
  .shell[data-view="list"] .sidebar { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  .shell[data-view="list"] .convo-pane { display: none; }
  .shell[data-view="chat"] .sidebar { display: none; }
  .side2 { left: 0; width: min(300px, 86vw); transform: translateX(-105%); }
  .back-btn { display: inline-grid; }
  .convo-head { padding: 0 8px 0 4px; gap: 4px; height: 58px; }
  .convo-peer { margin-left: 0; gap: 10px; }
  .convo-peer .avatar { width: 36px; height: 36px; }
  .cp-kind, .cp-dot { display: none; }
  .head-actions > .icon-btn:first-child { display: none; }
  .split { margin-left: 2px; }
  .split-main { padding: 0 8px; font-size: 13px; }
  .split-main .icon { display: none; }
  .msg-list { padding: 0 10px; }
  .msg-col { max-width: 84%; }
  .composer { padding: 4px 8px calc(8px + env(safe-area-inset-bottom)); }
  .compose-hint { display: none; }
  .compose-foot { justify-content: space-between; }
  .compose-fmt { display: none; }
  .info-pane { width: 100vw; border-left: 0; }
  .auth-card { padding: 26px 20px 22px; }
  .auth-top { padding: 14px 16px; }
  .to-bottom { right: 14px; bottom: 140px; }
  .toasts { top: 8px; right: 8px; left: 8px; width: auto; }
  .msg-more { display: none; }
  .list-tabs { gap: 14px; }
}
@media (hover: none) { .msg-more { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .emoji-picker, .emoji-picker.sheet, .ep-scrim, .ep-tones { animation: none; transition: none; }
  .ep-skel span { animation: none; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* settings and member rows: wrap helper text, keep pills aligned */
.radio .row-sub, .set-row .row-sub { white-space: normal; }
.privacy > .small { padding: 0 12px; min-height: 20px; }
.set-row.danger .chev { display: none; }
.member .slot { width: 32px; flex: none; }

/* thread-width rules last, so they win over the base rules above */
@container (max-width: 520px) { .compose-hint { display: none; } }
@container (min-width: 1100px) { .msg-col { max-width: min(720px, 64%); } }
@container (max-width: 420px) { .cp-kind, .cp-dot { display: none; } .split-main .icon { display: none; } .split-main { padding: 0 8px; } }

/* ---------- store rules: terms line, report, delete account, the owner's report list (native apps Phase 0) ---------- */
.terms-line { margin: 4px 0 14px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.terms-line a, .legal-links a { color: var(--accent); }
.legal-links { text-align: center; }
.report-reasons { border: 0; margin: 0 0 8px; padding: 0; }
.report-reasons .radio { padding: 6px 0; }
.danger-note { display: flex; gap: 10px; padding: 12px 14px; margin-bottom: 16px; border-radius: 10px; background: var(--danger-soft); color: var(--ink); font-size: 13.5px; line-height: 1.45; }
.danger-note > .ic, .danger-note > svg { color: var(--danger); flex: none; margin-top: 2px; }
.danger-note p { margin: 0 0 6px; }
.danger-note ul { margin: 0; padding-left: 18px; }
.danger-note li { margin: 2px 0; }
.report-list { list-style: none; margin: 0; padding: 0 12px 16px; display: grid; gap: 10px; }
.report-item { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); display: grid; gap: 6px; min-width: 0; }
.report-item p { margin: 0; }
.report-head { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.report-head > svg { color: var(--danger); }
.report-status { margin-left: auto; font-size: 11.5px; font-weight: 600; text-transform: capitalize; padding: 2px 8px; border-radius: 999px; background: var(--sys); color: var(--ink-2); }
.report-status.st-open { background: var(--danger-soft); color: var(--danger); }
.report-quote { margin: 0; padding: 8px 10px; border-left: 3px solid var(--line-2); background: var(--bg, transparent); display: grid; gap: 2px; overflow-wrap: anywhere; font-size: 13.5px; }
.badge-muted { justify-self: start; font-size: 11.5px; padding: 1px 6px; border-radius: 6px; background: var(--sys); color: var(--muted); }
.report-actions { justify-content: flex-start; flex-wrap: wrap; gap: 6px; }
.reports-admin .seg { margin: 8px 12px 12px; flex-wrap: wrap; }
.session .row-sub { white-space: normal; }
