/* Pont, the web app. Light = the mock-up (light grey ground, white cards, blue accent, round
   corners, round avatars); dark = the same tokens, derived. */
:root {
  --bg: #eceef2;
  --frame: #ffffff;
  --side: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --hover: #edf0f5;
  --active: #e7edfb;
  --border: #e3e6ec;
  --border-2: #d3d8e0;
  --text: #101828;
  --sub: #475467;
  --dim: #8a93a3;
  --accent: #1f5eff;
  --accent-2: #174ee0;
  --accent-soft: #e6edff;
  --accent-ink: #1849cc;
  --on-accent: #ffffff;
  --mine: #dde7ff;
  --other: #f1f3f6;
  --green: #22b35e;
  --amber: #e5961a;
  --red: #d92d20;
  --red-soft: #fdeceb;
  --tag-own: #d2462b;
  --tag-own-bg: #fde9e4;
  --tag-other: #1f5eff;
  --tag-other-bg: #e6edff;
  /* an agent's avatar: its color over the surface, its initial darkened */
  --ag-bg: 40%;
  --ag-ink: 58%;
  --ag-ink-base: #1b1d22;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 30px rgba(16, 24, 40, .07);
  --shadow-pop: 0 18px 50px rgba(16, 24, 40, .18);
  --ring: var(--surface);
  --mono: ui-monospace, "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d11;
    --frame: #13161c;
    --side: #101318;
    --surface: #161a21;
    --surface-2: #1e232c;
    --hover: #1c212a;
    --active: #1b2742;
    --border: #262c37;
    --border-2: #343b48;
    --text: #eef1f6;
    --sub: #b2bac8;
    --dim: #7b8494;
    --accent: #4d86ff;
    --accent-2: #6a9bff;
    --accent-soft: #1b2846;
    --accent-ink: #a3c0ff;
    --on-accent: #ffffff;
    --mine: #203259;
    --other: #1e232c;
    --green: #35c26f;
    --amber: #f0a73a;
    --red: #f0675c;
    --red-soft: #3a1d1b;
    --tag-own: #ff9c84;
    --tag-own-bg: #3b2119;
    --tag-other: #a3c0ff;
    --tag-other-bg: #1b2846;
    --ag-bg: 20%;
    --ag-ink: 100%;
    --ag-ink-base: #ffffff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
    --shadow-pop: 0 18px 50px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--sans); overscroll-behavior: none; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.logo { width: 34px; height: 34px; color: var(--accent); flex: none; }
.logo.big { width: 64px; height: 64px; }
.dim { color: var(--dim); font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: .93em; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.error { color: var(--red); font-size: 13px; }
.info { color: var(--green); font-size: 13px; }

/* buttons, fields */
button { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 8px 14px; cursor: pointer; color: var(--text); transition: background-color .12s, border-color .12s, color .12s; }
button:hover { border-color: var(--border-2); }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent-2); }
button.ghost { background: var(--surface); }
button.ghost:hover:not(:disabled) { background: var(--hover); }
button.danger { color: var(--red); }
button.danger:hover:not(:disabled) { background: var(--red-soft); border-color: transparent; }
button.block { display: block; width: 100%; height: 46px; border-radius: 14px; font-size: 15px; }
.icon-btn { width: 40px; height: 40px; padding: 0; border: none; border-radius: 12px; background: none; color: var(--sub); display: inline-grid; place-items: center; flex: none; }
.icon-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }
input, select, textarea { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 9px 12px; }
input::placeholder, textarea::placeholder { color: var(--dim); }
input:read-only:not(textarea) { background: var(--surface-2); color: var(--sub); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select { cursor: pointer; }

/* avatars, presence, badges, tags */
.avatar { --size: 48px; width: var(--size); height: var(--size); padding: 0; border: none; border-radius: 50%; display: inline-grid; place-items: center; flex: none; position: relative; font-weight: 650; font-size: calc(var(--size) * .4); line-height: 1; color: #fff; background: var(--hc, #8a93a3); }
.avatar.agent { border-radius: 38%; background: color-mix(in srgb, var(--ac, #9ec5ff) var(--ag-bg), var(--surface)); color: color-mix(in srgb, var(--ac, #9ec5ff) var(--ag-ink), var(--ag-ink-base)); }
.avatar.lg { --size: 48px; }
.avatar.md { --size: 40px; }
.avatar.sm { --size: 36px; }
.avatar.xs { --size: 28px; }
button.avatar { cursor: pointer; }
button.avatar:hover { box-shadow: 0 0 0 3px var(--accent-soft); }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; width: calc(var(--size) * .26); height: calc(var(--size) * .26); min-width: 9px; min-height: 9px; border: 2px solid var(--ring); }
.avatar .dot:not(.online) { display: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--dim); display: inline-block; flex: none; }
.dot.online, .dot.public { background: var(--green); }
.dot.private { background: var(--amber); }
.dot.busy { animation: pulse 1.2s infinite; }
.stack { --s: 48px; position: relative; width: var(--s); height: var(--s); flex: none; }
.stack .avatar { --size: calc(var(--s) * .62); position: absolute; box-shadow: 0 0 0 2px var(--ring); }
.stack .avatar:first-child { left: 0; top: 0; }
.stack .avatar:nth-child(2) { right: 0; bottom: 0; }
.stack .avatar:only-child { --size: var(--s); }
.stack.md { --s: 40px; }
.badge { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; align-items: center; justify-content: center; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; line-height: 1; }
.tag { display: inline-block; font-size: 11.5px; font-weight: 500; line-height: 1.5; padding: 0 7px; border-radius: 6px; white-space: nowrap; background: var(--tag-other-bg); color: var(--tag-other); flex: none; }
.tag.own { background: var(--tag-own-bg); color: var(--tag-own); }
.who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.who b, .who span, .who .name-row > b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-row { display: flex; align-items: center; gap: 7px; min-width: 0; }
.name-row b { min-width: 0; }

/* sign in */
.login { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px 16px; }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 28px; padding: 32px 32px 28px; box-shadow: var(--shadow); }
.logo-row { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; letter-spacing: -.2px; color: var(--accent); }
.login-card h1 { font-size: 26px; letter-spacing: -.4px; margin: 26px 0 6px; }
/* signing up looks like signing up: an accent band, a stepper, not the sign-in card */
.login-card[data-view="signup"], .login-card[data-view="confirm"] { border-top: 5px solid var(--accent); }
.login-card .steps { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 -10px; }
.login-card .steps ol { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.login-card .steps li { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--dim); }
.login-card .steps li::before { content: attr(data-step); display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); color: var(--sub); font-weight: 700; font-size: 11px; }
.login-card .steps li.on { color: var(--text); font-weight: 600; }
.login-card .steps li.on::before { background: var(--accent); color: var(--on-accent); }
.login-card .steps li.done::before { content: '✓'; background: var(--accent-soft); color: var(--accent-ink); }
.eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--accent-ink); }
.login-card .sub { color: var(--sub); margin: 0 0 20px; }
.login-card label, .dlg label { display: block; margin: 14px 0 6px; font-size: 13px; font-weight: 500; color: var(--sub); }
.login-card input { display: block; width: 100%; height: 46px; }
.login-form { margin: 0; }
.login-card button.block { margin-top: 18px; }
.login-card .info, .login-card .error { margin: 14px 0 0; }
.login-card .check { display: flex; align-items: flex-start; gap: 9px; margin: 16px 0 0; font-size: 13px; font-weight: 400; color: var(--sub); cursor: pointer; }
.login-card .check input { display: inline-block; width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--accent); box-shadow: none; }
.login-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; margin: 18px 0 0; }
button.link { background: none; border: none; padding: 0; color: var(--accent); font-size: 13px; cursor: pointer; }
button.link:hover { text-decoration: underline; }
.login-foot { margin: 0; color: var(--accent-ink); font-size: 13px; }
/* the short legal pages */
.doc { max-width: 640px; margin: 0 auto; padding: 32px 20px 60px; }
.doc h1 { font-size: 26px; letter-spacing: -.4px; margin: 18px 0 8px; }
.doc h2 { font-size: 17px; margin: 26px 0 6px; }
.doc p, .doc li { color: var(--sub); line-height: 1.55; }

/* the frame: rail | list | conversation | panel */
.app { display: flex; position: relative; height: calc(100dvh - 24px); margin: 12px; background: var(--frame); border: 1px solid var(--border); border-radius: 26px; overflow: hidden; box-shadow: var(--shadow); }
.rail { width: 76px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 0 16px; background: var(--side); border-right: 1px solid var(--border); }
.rail-logo { display: flex; flex-direction: column; align-items: center; gap: 3px; margin-bottom: 16px; font-weight: 800; font-size: 13px; letter-spacing: -.1px; color: var(--accent); }
.rail-btn { position: relative; width: 46px; height: 46px; padding: 0; border: none; border-radius: 14px; background: none; color: var(--sub); display: grid; place-items: center; }
.rail-btn .ic { width: 23px; height: 23px; }
.rail-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.rail-btn.active { background: var(--accent-soft); color: var(--accent); }
.rail-btn.active .ic { fill: currentColor; fill-opacity: .14; }
.rail-btn.active::before { content: ''; position: absolute; left: -15px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.rail-btn:disabled { opacity: .45; }
.rail-btn .badge { position: absolute; top: 2px; right: 0; box-shadow: 0 0 0 2px var(--side); }
.rail-fill { flex: 1; }
.rail-me { position: relative; }
.conn { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: var(--dim); border: 2px solid var(--side); }
.conn.online { background: var(--green); }
.conn.connecting { background: var(--amber); animation: pulse 1.2s infinite; }
.conn.offline { background: var(--red); }
.conn.paused { background: var(--dim); }

.side { --ring: var(--side); width: 340px; flex: none; display: flex; flex-direction: column; min-height: 0; background: var(--side); border-right: 1px solid var(--border); }
.side-head { display: flex; align-items: center; gap: 10px; padding: 20px 16px 12px 22px; }
.side-title { flex: 1; min-width: 0; }
.side-title h1 { margin: 0; font-size: 25px; font-weight: 700; letter-spacing: -.5px; line-height: 1.2; }
.me-line { display: flex; gap: 5px; font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; }
.me-line .handle { font-family: var(--mono); letter-spacing: .4px; }
.compose { width: 40px; height: 40px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.mobile-only { display: none !important; }
.side-tools { display: flex; flex-direction: column; gap: 12px; padding: 4px 16px 10px; }
.filters { display: flex; gap: 4px; }
.filters button { border: none; background: none; padding: 6px 16px; border-radius: 999px; color: var(--sub); font-weight: 500; }
.filters button:hover { background: var(--hover); }
.filters button.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--dim); cursor: not-allowed; }
.search .ic { width: 18px; height: 18px; }
.search input { flex: 1; min-width: 0; border: none; background: none; padding: 0; box-shadow: none; cursor: not-allowed; }
.pane { flex: 1; overflow-y: auto; min-height: 0; }
.empty { padding: 24px 22px; text-align: center; color: var(--dim); font-size: 13px; margin: 0; }
.bottombar { display: none; }

/* the conversations */
.list { list-style: none; margin: 0; padding: 2px 10px 12px; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 18px; cursor: pointer; }
.list li:hover { --ring: var(--hover); background: var(--hover); }
.list li.active { --ring: var(--active); background: var(--active); }
.list .who { gap: 2px; }
.list .who b { font-size: 15px; font-weight: 600; }
.list .preview { color: var(--sub); font-size: 13px; }
.list .preview b { font-weight: 500; color: var(--text); }
.list .end { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; align-self: flex-start; padding-top: 3px; }
.list .when { color: var(--dim); font-size: 12px; }

/* contacts */
.section { padding: 4px 12px 8px; }
.section h3 { margin: 12px 10px 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .7px; color: var(--dim); }
.section > .dim { padding: 2px 10px 6px; margin: 0; }
.addfriend { display: flex; gap: 6px; margin: 2px 4px 8px; }
.addfriend input { flex: 1; min-width: 0; height: 40px; }
.addfriend input.code { font-family: var(--mono); text-transform: uppercase; flex: 0 1 152px; letter-spacing: .5px; }
.addfriend input.code::placeholder { text-transform: none; font-family: var(--sans); letter-spacing: 0; }
.addfriend button.primary { width: 40px; height: 40px; padding: 0; font-size: 20px; line-height: 1; border-radius: 12px; flex: none; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 16px; }
.plain li.sub { padding-left: 34px; }
.plain .btns { display: flex; gap: 4px; flex: none; }
.plain .btns button { padding: 4px 10px; font-size: 12.5px; border-radius: 10px; }
.plain .meta { color: var(--dim); font-size: 12px; }
.plain .meta.handle { font-family: var(--sans); }
.plain li.clickable { cursor: pointer; }
.plain li.clickable:hover { --ring: var(--hover); background: var(--hover); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.swatches button { width: 32px; height: 32px; padding: 0; border-radius: 38%; border: 2px solid transparent; background: var(--sw); }
.swatches button.on { border-color: var(--surface); box-shadow: 0 0 0 2px var(--accent); }
.swatches button:hover { box-shadow: 0 0 0 2px var(--border-2); }
.swatches button.on:hover { box-shadow: 0 0 0 2px var(--accent); }
.btns { display: flex; gap: 6px; }

/* the open conversation */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); }
.nocurrent { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--dim); }
.nocurrent h2 { margin: 10px 0 0; color: var(--text); font-size: 22px; letter-spacing: -.3px; }
.nocurrent p { margin: 4px 0 0; }
.conv { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.conv-head { display: flex; align-items: center; gap: 12px; min-height: 74px; padding: 12px 16px 12px 22px; border-bottom: 1px solid var(--border); }
.conv-head .back { display: none; }
.conv-avatar { display: flex; flex: none; }
#convTitle { font-size: 18px; font-weight: 700; letter-spacing: -.2px; }
#convSub { color: var(--dim); font-size: 13px; }
.banner { padding: 7px 22px; background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; }
.messages { flex: 1; overflow-y: auto; padding: 14px 24px 10px; }
.more { display: block; margin: 0 auto 10px; font-size: 12.5px; border-radius: 999px; padding: 5px 14px; }
.day { width: fit-content; margin: 18px auto 6px; padding: 3px 12px; border-radius: 999px; background: var(--surface-2); color: var(--dim); font-size: 12px; }
.msg { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; margin-top: 16px; }
.msg .avatar { --size: 40px; }
.msg .body { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.msg .head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 7px; margin: 1px 2px 5px; font-size: 13.5px; }
.msg .from { font-weight: 600; }
.msg .head .tag { align-self: center; }
.msg .time { color: var(--dim); font-size: 12px; }
.msg .to { color: var(--dim); font-size: 12px; }
.msg .to .woken { color: var(--accent-ink); font-weight: 600; }
.bubble { max-width: min(640px, 100%); padding: 10px 15px; border-radius: 20px; border-top-left-radius: 6px; background: var(--other); }
.msg.forme .bubble { box-shadow: inset 3px 0 0 var(--accent); }
.msg.mine { grid-template-columns: minmax(0, 1fr) 40px; }
.msg.mine > .avatar { grid-column: 2; grid-row: 1; }
.msg.mine > .body { grid-column: 1; grid-row: 1; align-items: flex-end; }
.msg.mine .bubble { background: var(--mine); border-top-left-radius: 20px; border-top-right-radius: 6px; }
.msg.cont { margin-top: 4px; }
.msg.cont .head { display: none; }
.msg.cont > .avatar { visibility: hidden; height: 0; }
.msg.cont .bubble { border-radius: 20px; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.5; }
.text .mention { color: var(--accent); font-weight: 600; }
.text pre { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; overflow-x: auto; margin: 6px 0; white-space: pre; }
.text pre code { background: none; padding: 0; }
.text code { background: color-mix(in srgb, var(--text) 7%, transparent); }
.files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.text + .files { margin-top: 8px; }
.file { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 7px 12px 7px 9px; font-size: 13px; text-decoration: none; color: var(--text); }
.file .ic { width: 18px; height: 18px; color: var(--accent); }
.file .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.file:hover { border-color: var(--accent); }
.file .size { color: var(--dim); font-size: 12px; flex: none; }
.readonly { margin: 0; padding: 14px 22px; border-top: 1px solid var(--border); color: var(--dim); font-size: 13px; text-align: center; }

/* the composer */
.composer { position: relative; padding: 8px 20px 16px; }
.targets, .pending-files { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px 54px; }
.targets:empty, .pending-files:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); color: var(--accent-ink); border-radius: 999px; padding: 3px 6px 3px 12px; font-size: 13px; }
.chip b { font-weight: 600; }
.chip .dim { color: inherit; opacity: .7; }
.chip button { border: none; background: none; padding: 0 4px; color: inherit; font-size: 15px; line-height: 1; border-radius: 50%; }
.chip button:hover { color: var(--red); }
.composer .row { display: flex; align-items: flex-end; gap: 10px; }
.round { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.field { flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: 0; min-height: 46px; padding: 3px 5px 3px 18px; border: 1px solid var(--border); border-radius: 23px; background: var(--surface); }
.field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field textarea { flex: 1; min-width: 0; border: none; background: none; padding: 9px 0; resize: none; max-height: 220px; line-height: 1.4; box-shadow: none; }
.field textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field textarea:focus { box-shadow: none; }
.field .icon-btn { width: 38px; height: 38px; border-radius: 50%; color: var(--text); }
.send { width: 46px; height: 46px; padding: 0; border: none; border-radius: 15px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; flex: none; }
.send:hover:not(:disabled) { background: var(--accent-2); }
.send .ic { width: 21px; height: 21px; }
.mention-box { position: absolute; left: 76px; bottom: calc(100% - 6px); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 6px; min-width: 280px; max-width: calc(100% - 96px); max-height: 260px; overflow-y: auto; box-shadow: var(--shadow-pop); z-index: 3; }
.mention-box div { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 10px; cursor: pointer; font-weight: 500; }
.mention-box div.active, .mention-box div:hover { background: var(--hover); }
.mention-box .k { margin-left: auto; color: var(--dim); font-size: 12px; font-weight: 400; }

/* dialogs */
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 26px; padding: 24px 26px; width: min(480px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: var(--shadow-pop); }
dialog::backdrop { background: rgba(15, 23, 42, .38); backdrop-filter: blur(2px); }
dialog h2 { margin: 0; font-size: 19px; letter-spacing: -.3px; }
dialog h3 { margin: 22px 0 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .7px; color: var(--dim); }
dialog p { margin: 4px 0; }
.dlg input, .dlg select { display: block; width: 100%; }
.dlg-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.dlg-head h2 { flex: 1; }
.dlg-head .who h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-head .icon-btn { margin: -6px -8px -6px 0; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.actions.between { justify-content: space-between; }
.handle-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.bigcode { font-size: 22px; letter-spacing: 2px; padding: 8px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); }
.addrow { display: flex; gap: 8px; }
.addrow input, .addrow select { flex: 1; min-width: 0; width: auto; }
.addrow button { flex: none; }
.candidates { display: flex; flex-direction: column; gap: 2px; max-height: 280px; overflow-y: auto; margin: 0 -8px; }
.candidates label { display: flex; align-items: center; gap: 10px; margin: 0; padding: 8px; border-radius: 12px; cursor: pointer; color: var(--text); font-size: 14px; font-weight: 400; }
.candidates label:hover { background: var(--hover); }
.candidates input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); box-shadow: none; }
.toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 14px; font-size: 13px; box-shadow: var(--shadow-pop); z-index: 10; max-width: calc(100vw - 32px); }

/* the conversation's panel: a column beside the conversation, a drawer, or a dialog on a phone */
.panel { padding: 0; }
.panel:not(:modal)[open] { position: static; display: block; flex: none; width: 340px; height: auto; max-height: none; margin: 0; border: none; border-left: 1px solid var(--border); border-radius: 0; box-shadow: none; overflow-y: auto; }
.panel-body { display: flex; flex-direction: column; min-height: 100%; }
.panel-head { display: flex; align-items: center; gap: 8px; min-height: 74px; padding: 12px 12px 4px 22px; }
.panel-head h2 { flex: 1; font-size: 17px; }
.panel-sub { margin: 0; padding: 0 22px 6px; color: var(--dim); font-size: 13px; }
.members { --ring: var(--surface); list-style: none; margin: 0; padding: 4px 10px 10px; }
.members li { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 16px; }
.members li:hover { --ring: var(--hover); background: var(--hover); }
.members .who b { font-weight: 600; }
.members .who .meta { color: var(--dim); font-size: 12.5px; }
.members .side-col { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.members .role { color: var(--dim); font-size: 12.5px; }
.members .acts { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.members li:hover .acts, .members li:focus-within .acts { opacity: 1; }
.members .acts .icon-btn { width: 28px; height: 28px; border-radius: 8px; }
.members .acts .icon-btn .ic { width: 16px; height: 16px; }
.members .acts .icon-btn.danger:hover { color: var(--red); background: var(--red-soft); }
@media (hover: none) { .members .acts { opacity: 1; } }
.panel-block { margin: 0 22px; padding: 16px 0; border-top: 1px solid var(--border); }
.panel-block.end { border-top: none; margin-top: auto; padding-top: 4px; }
.panel-block.end:has(#infoLeave[hidden]):has(#infoError[hidden]) { display: none; }
.panel-block h3 { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; font-size: 15px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--text); }
.panel-block h3 label { margin: 0; font: inherit; color: inherit; }
.panel-block .hint { display: inline-grid; color: var(--dim); cursor: help; }
.panel-block .hint .ic { width: 17px; height: 17px; }
.wake-agent + .wake-agent { margin-top: 10px; }
.wake-agent .wake-name { font-size: 12.5px; color: var(--dim); margin: 0 0 2px; }
.radio { display: grid; grid-template-columns: 22px 1fr; gap: 1px 10px; padding: 7px 0; cursor: pointer; }
.radio input { width: 19px; height: 19px; margin: 1px 0 0; accent-color: var(--accent); box-shadow: none; cursor: pointer; }
.radio b { font-weight: 500; }
.radio small { grid-column: 2; color: var(--dim); font-size: 12.5px; line-height: 1.4; }
#infoLeave { width: 100%; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* not wide enough for a third column: the panel slides over the conversation */
@media (max-width: 1279px) {
  .panel:not(:modal)[open] { position: absolute; top: 0; right: 0; bottom: 0; left: auto; z-index: 5; box-shadow: -18px 0 50px rgba(16, 24, 40, .14); }
}
@media (max-width: 1100px) {
  .side { width: 300px; }
}

/* a phone: one pane at a time, tabs at the bottom */
@media (max-width: 820px) {
  .app { height: 100dvh; margin: 0; border: none; border-radius: 0; box-shadow: none; }
  .rail { display: none; }
  .side { --ring: var(--surface); width: 100%; border-right: none; background: var(--surface); }
  .main { display: none; }
  .app.show-conv .side { display: none; }
  .app.show-conv .main { display: flex; }
  .mobile-only { display: inline-grid !important; }
  .wide-only { display: none; }
  .side-head { padding: calc(14px + env(safe-area-inset-top)) 14px 10px 18px; }
  .side-title h1 { font-size: 27px; }
  .compose { border: none; border-radius: 50%; background: var(--accent); color: var(--on-accent); }
  .compose:hover:not(:disabled) { background: var(--accent-2); color: var(--on-accent); }
  .side-tools { padding: 2px 14px 8px; }
  .search { display: none; }
  .filters button { flex: 1; }
  .list { padding: 0 8px 8px; }
  .list li { border-radius: 16px; }
  .bottombar { display: flex; flex: none; border-top: 1px solid var(--border); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); }
  .bottombar button { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px; border: none; border-radius: 14px; background: none; color: var(--sub); font-size: 11.5px; font-weight: 500; }
  .bottombar button .ic { width: 24px; height: 24px; }
  .bottombar button.on { color: var(--accent); }
  .bottombar button.on .ic { fill: currentColor; fill-opacity: .14; }
  .bottombar .badge { position: absolute; top: 0; left: calc(50% + 6px); box-shadow: 0 0 0 2px var(--surface); }
  #contacts.view-friends .section[data-k="agents"], #contacts.view-agents .section:not([data-k="agents"]) { display: none; }
  .conv-head { min-height: 0; padding: calc(8px + env(safe-area-inset-top)) 6px 8px 4px; gap: 8px; }
  .conv-head .back { display: inline-grid; }
  #convTitle { font-size: 16.5px; }
  #convSub { font-size: 12.5px; }
  .messages { padding: 8px 12px 6px; }
  .msg { grid-template-columns: 34px minmax(0, 1fr); column-gap: 9px; }
  .msg.mine { grid-template-columns: minmax(0, 1fr) 34px; }
  .msg .avatar { --size: 34px; }
  .bubble { padding: 9px 13px; }
  .composer { padding: 6px 10px calc(10px + env(safe-area-inset-bottom)); }
  .composer .row { gap: 8px; }
  .round, .send { width: 42px; height: 42px; }
  .field { min-height: 42px; padding-left: 14px; }
  .field .icon-btn { width: 34px; height: 34px; }
  .targets, .pending-files { margin-left: 50px; }
  .mention-box { left: 10px; right: 10px; min-width: 0; max-width: none; }
  .panel:modal { width: min(480px, calc(100vw - 16px)); }
  dialog { padding: 20px; border-radius: 24px; }
  .panel { padding: 0; }
}
