/* Canonical colors, type, space, radius, and shadow live in src/design-tokens.js.
   The marked blocks below are generated from it — do not hand-edit.
   Regenerate: node scripts/sync-design-tokens-css.mjs
   (dark is the product default; light is opt-in). */
:root {
  color-scheme: dark;
  /* tokens:begin DARK */
  --bg:#202127;--panel:#191a20;--panel-raised:#292b33;--panel-hover:#34363f;--line:#393b45;--line-soft:#30323a;--line-control:#8a8a96;--text:#eeedf1;--muted:#aaaab7;--blue:#a9b9ff;--blue-strong:#5555bd;--blue-strong-hover:#6a6ad4;--on-accent:#ffffff;--amber:#ffbf69;--green:#4fd09b;--red:#ff7b7b;--violet:#ad8cff;--card:#191a20;--border:#393b45;--shadow:0 20px 70px rgb(0 0 0 / 32%);--control-min-target-coarse:2.75rem;--radius-sm:.35rem;--radius-md:.45rem;--radius-lg:.85rem;--radius-xl:1rem;--space-1:.25rem;--space-2:.5rem;--space-3:.75rem;--space-4:1rem;--space-5:1.5rem;--space-6:2rem;--text-xs:.75rem;--text-sm:.875rem;--text-md:1rem;--text-lg:1.25rem;--font-sans:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  /* tokens:end DARK */
  /* Component aliases kept for existing rules. */
  --room-paper: var(--panel-raised);
  --text-wordmark: clamp(1.75rem, 7vw, 2.4rem);
  --room-ink: var(--text);
  --room-quiet: var(--muted);
  --room-rule: var(--line);
  --room-dark: var(--panel);
  --room-green: var(--green);
  --room-red: var(--red);
  font-family: var(--font-sans), "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", emoji;
}
[data-theme="light"] {
  color-scheme: light;
  /* tokens:begin LIGHT */
  --bg:#f4f3f8;--panel:#fffbff;--panel-raised:#e8e7ef;--panel-hover:#dddce6;--line:#c9c8d4;--line-soft:#dddce6;--line-control:#6e6e7a;--text:#1c1b22;--muted:#5c5b6a;--blue:#33339a;--blue-strong:#3f3fad;--blue-strong-hover:#33338f;--on-accent:#ffffff;--amber:#8a4b00;--green:#0f6b45;--red:#a32020;--violet:#5b3d99;--card:#fffbff;--border:#c9c8d4;--shadow:0 16px 40px rgb(28 27 34 / 12%);
  /* tokens:end LIGHT */
}

/* Ordinary light-surface content uses the matching light foreground. Keep
   fixed-dark nested cards and the established dark palette unchanged. */
:root[data-theme="light"] .message-content > .message-body:not(.message-muted):not(.message-tombstone),
:root[data-theme="light"] .pinned-item .pinned-body,
:root[data-theme="light"] .work-details > .work-facts dd { color: var(--text); }
/* These paragraph states are secondary, even under .message-content p. */
:root[data-theme="light"] .message-content > .message-muted,
:root[data-theme="light"] .message-content > .message-tombstone,
:root[data-theme="light"] .draft-feedback > .form-hint { color: var(--muted); }
/* Light theme: components below keep hardcoded dark backgrounds for the dark
   (default) theme, but their text follows the theme tokens — without these
   overrides the text is unreadable in light theme (measured 1.01–2.63:1).
   Dark theme rendering is untouched. */
:root[data-theme="light"] .thread-bar,
:root[data-theme="light"] .search-results,
:root[data-theme="light"] .invitation-details,
:root[data-theme="light"] .new-work-form,
:root[data-theme="light"] .handoff-envelopes { background: var(--panel-raised); }
:root[data-theme="light"] .new-work-form { border-color: var(--line); }
:root[data-theme="light"] .handoff-envelope { background: var(--panel); }
:root[data-theme="light"] .new-messages-button { background: var(--panel-raised); color: var(--text); }
:root[data-theme="light"] .mention-option:hover,
:root[data-theme="light"] .mention-option.active,
:root[data-theme="light"] .search-results a:hover,
:root[data-theme="light"] .rb-event-link:hover { background: var(--panel-hover); }

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
button, select { min-height: 2.6rem; }
button { cursor: pointer; }
a { color: var(--blue); }

.skip-link { position: fixed; left: 1rem; top: 1rem; z-index: 100; padding: .75rem 1rem; background: white; color: black; clip-path: inset(50%); }
.skip-link:focus { clip-path: none; }
.app-shell { min-height: 100dvh; }
/* Static hero (QA 2026-10-03 P1-1): the no-JS / crawler / slow-connection
   page. Removed by the app on boot; pure CSS, no JavaScript dependency. */
.static-hero {
  border-bottom: 1px solid var(--line);
  background: radial-gradient(60rem 22rem at 20% -4rem, rgb(47 99 199 / 22%), transparent 70%), var(--bg);
  padding: clamp(2.5rem, 7vw, 5rem) clamp(1.25rem, 5vw, 3rem);
}
/* A scripting-capable browser can still fail to download the entry module. */
html[data-entry-started] #static-hero { display: none; }
html:not([data-entry-started]) .app-shell > :not(#static-hero) { display: none; }
.static-hero-inner { max-width: 44rem; margin: 0 auto; }
.static-hero-kicker {
  margin: 0 0 .75rem;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.static-hero-title {
  margin: 0 0 1rem;
  font-size: clamp(1.9rem, 5vw, 3rem);
  line-height: 1.08;
  letter-spacing: -.02em;
  font-weight: 700;
}
.static-hero p { margin: 0 0 1.25rem; color: var(--muted); font-size: 1.02rem; line-height: 1.55; max-width: 38rem; }
.static-hero-connect { margin: 0 0 1.25rem; padding: 1rem 1.25rem; border: 2px solid var(--blue); border-radius: .85rem; background: var(--panel-raised, rgba(169,185,255,.08)); }
.static-hero-connect-title { margin: 0 0 .4rem; font-size: var(--text-lg); }
.static-hero-connect code { font-weight: 600; overflow-wrap: anywhere; }
.static-hero-connect-cta { font-weight: 700; font-size: var(--text-lg); }
.static-hero-links { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin: 0; }
.static-hero-links a { font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: .1rem; }
.static-hero-links a:hover { border-color: var(--blue); }
.static-hero-noscript { margin: 1.5rem 0 0; padding: .9rem 1.1rem; border: 1px solid var(--amber); border-radius: .5rem; color: var(--text); background: rgb(255 191 105 / 8%); font-size: .92rem; }
.app-shell:has(#main:not([hidden])) { height: 100dvh; display: flex; flex-direction: column; }
.app-shell > * { flex-shrink: 0; }
.app-shell > #main { flex: 1; min-height: 0; }
.topbar { position: relative; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.5rem; padding: .45rem 1.25rem; border-bottom: 1px solid var(--line-soft); background: var(--panel); }
.brand { display: flex; align-items: center; gap: .75rem; }
.brand-mark { display: grid; place-items: center; width: 2rem; aspect-ratio: 1; border-radius: var(--radius-md); background: var(--blue-strong); color: var(--on-accent); font-size: .7rem; font-weight: 700; letter-spacing: .02em; }
.brand div { display: grid; gap: .15rem; }
.brand strong { font-size: .98rem; letter-spacing: -.01em; }
.brand span:last-child { color: var(--muted); font-size: .76rem; }
.topbar-actions { display: flex; align-items: end; gap: .75rem; }
.session-menu { display: contents; }
#session-menu-button { display: none; }
.session-menu-panel { display: contents; }
label { color: var(--muted); font-size: .76rem; font-weight: 650; letter-spacing: .02em; }
select, input, textarea { width: 100%; border: 1px solid var(--line-control); border-radius: .45rem; background: var(--panel); color: var(--text); outline: none; }
select, input { min-height: 2.6rem; padding: 0 .75rem; }
textarea { padding: .7rem .8rem; line-height: 1.5; resize: vertical; }
select:focus, input:focus, textarea:focus, button:focus-visible, a:focus-visible, summary:focus-visible { border-color: var(--blue); outline: 2px solid var(--blue); outline-offset: 2px; }

main { max-width: 1540px; margin: 0 auto; padding: 2rem clamp(1rem, 3vw, 2.5rem) 4rem; }
.room-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 2rem; margin: .6rem 0 2rem; }
.eyebrow { margin: 0 0 .45rem; color: var(--blue); font-size: .69rem; font-weight: 800; letter-spacing: .14em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .45rem; font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1.04; letter-spacing: -.055em; }
h2 { margin-bottom: 0; font-size: var(--text-md); letter-spacing: -.015em; }
h3 { margin: .8rem 0 .45rem; font-size: 1.05rem; line-height: 1.3; letter-spacing: -.02em; }
.room-purpose { max-width: 46rem; margin-bottom: 0; color: var(--muted); font-size: var(--text-md); line-height: 1.6; }
.member-stack { display: flex; flex-direction: row-reverse; padding-top: .6rem; }
.member-avatar { position: relative; display: grid; place-items: center; width: 2.6rem; aspect-ratio: 1; margin-left: -.55rem; border: 2px solid var(--bg); border-radius: 50%; background: #263249; color: white; font-size: .72rem; font-weight: 800; }
.member-avatar.agent { background: #3c2c60; }

.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; }
.summary-card { min-height: 7.3rem; padding: .9rem 1rem; border: 1px solid var(--line-soft); background: rgb(255 255 255 / 2%); }
.summary-card > span { display: block; color: var(--muted); font-size: .76rem; }
.summary-card strong { display: block; margin: .25rem 0 .1rem; font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.summary-card p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }

.panel { min-width: 0; border: 1px solid var(--line-soft); border-radius: 1rem; background: var(--panel); }
.panel-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding: 1rem; border-bottom: 1px solid var(--line-soft); }
.panel-header .eyebrow { margin-bottom: .3rem; }
.count-chip { display: grid; min-width: 2rem; min-height: 1.7rem; place-items: center; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: .72rem; }

.message-list { flex: 1; min-height: 0; margin: 0; padding: .3rem 1rem; overflow-y: auto; list-style: none; }
.message { display: grid; grid-template-columns: 2rem 1fr; gap: .7rem; padding: .85rem 0; }
.message.grouped { position: relative; padding-top: .12rem; padding-bottom: .35rem; }
.message.grouped .message-avatar { visibility: hidden; }
.message.grouped .message-meta { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.grouped-time { display: none; }
.message.grouped:hover .grouped-time, .message.grouped:focus-within .grouped-time {
  display: block; position: absolute; left: 0; top: .15rem; width: 2rem; color: var(--muted); font-size: var(--text-xs); line-height: 1.2; text-align: right;
}
.message.mentioned { border-radius: .4rem; background: rgb(173 140 255 / 10%); }
.chat-divider { grid-column: 1 / -1; margin: .55rem 0 .2rem; color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-align: center; text-transform: uppercase; }
.chat-divider.unread { color: var(--amber); }
.message-avatar { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: #3d465f; color: white; font-size: .65rem; font-weight: 650; }
.message-avatar.agent { border-radius: .45rem; background: #3a2c57; color: #e7ddff; }
.message-content { min-width: 0; }
.message-content p { margin-bottom: .4rem; color: #dfe5ed; font-size: .9rem; line-height: 1.55; overflow-wrap: anywhere; }
.message-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem; margin-bottom: .25rem; }
.message-meta strong { font-size: .9rem; font-weight: 650; }
/* UI calming #6: the uppercase "AGENT" pill is gone (the square agent avatar
   already marks agent messages); this rule now styles only the Pinned chip. */
.pinned-chip { padding: .08rem .34rem; border: 1px solid var(--line); border-radius: 99px; color: var(--violet); font-size: .62rem; text-transform: uppercase; }
.message-meta time { color: var(--muted); font-size: .7rem; }
.mention { padding: 0; border: 0; background: transparent; color: var(--violet); font: inherit; font-weight: 650; cursor: pointer; }
.mention.agent { color: var(--text); font-weight: 850; }
.mention:hover { text-decoration: underline; }
/* Message markdown (rendered by markdownHtml in conversation.js; input is
   HTML-escaped before conversion, so these selectors only ever see safe markup). */
.message-body code { padding: .08rem .3rem; border-radius: .3rem; background: var(--panel-raised); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--text-sm); }
.message-body code.md-fence { display: block; margin: .5rem 0; padding: .6rem .8rem; white-space: pre-wrap; word-break: break-word; }
.message-body .md-quote { display: block; margin: .25rem 0; padding-left: .6rem; border-left: 2px solid var(--line); color: var(--muted); }
.message-body .md-list { display: block; white-space: normal; margin: .35rem 0 .35rem 1.25rem; padding: 0; }
.message-body ul.md-list { list-style: disc; }
.message-body ol.md-list { list-style: decimal; }
.message-body .md-list li { display: list-item; white-space: normal; }
.message-body details.md-spoiler { display: inline-block; margin: 0 .15rem; padding: .1rem .4rem; border: 1px solid var(--line); border-radius: .35rem; background: var(--panel-raised); cursor: pointer; }
.message-body details.md-spoiler summary { display: inline; color: var(--muted); font-size: var(--text-xs); cursor: pointer; }
.message-body details.md-spoiler[open] summary { display: none; }
/* Long-message disclosure uses the same body rhythm in both themes. */
.message-content > .message-body { margin-bottom: .4rem; color: var(--text); font-size: var(--text-md); line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
.message-expansion > summary { display: block; cursor: pointer; list-style: none; }
.message-expansion > summary::-webkit-details-marker { display: none; }
.message-preview { display: block; max-height: 9.3em; overflow: hidden; }
.message-show-more, .message-show-less { display: block; width: fit-content; min-height: 44px; padding: .6rem 0; color: var(--blue); font-size: var(--text-sm); font-weight: 650; }
.message-show-less { display: none; }
.message-expansion[open] > summary .message-preview, .message-expansion[open] > summary .message-show-more { display: none; }
.message-expansion[open] > summary .message-show-less { display: block; }
.message-expansion > summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: .3rem; }
.work-link { color: var(--muted); font-size: .72rem; text-decoration: none; }
.work-link:hover { color: var(--blue); }
.mention-list { position: absolute; right: 1rem; bottom: calc(100% - .35rem); left: 1rem; z-index: 5; margin: 0; padding: .25rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--panel-raised); box-shadow: var(--shadow); list-style: none; }
.mention-option { display: flex; align-items: center; justify-content: space-between; gap: .75rem; width: 100%; min-height: 44px; padding: .4rem .7rem; border: 0; border-radius: .35rem; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.mention-option span { color: var(--muted); font-size: .68rem; }
.mention-option.active, .mention-option:hover { background: #1d2734; }
.composer > label { display: block; margin-bottom: .45rem; }
.form-hint { margin: .45rem 0 0; color: var(--muted); font-size: .69rem; }
/* MI-033: the /join "Log in" link was a 40x19 px tap target. */
#join-enter-home { display: inline-block; min-width: 44px; min-height: 44px; padding: .75rem .25rem; box-sizing: border-box; text-align: center; }
#human-push-button { margin-top: .45rem; }
.check input { flex: 0 0 20px; width: 20px; height: 20px; min-height: 20px; margin: 0; padding: 0; accent-color: var(--blue); }
/* "Also send to channel" sits above the composer row, thread views only. */
.also-send-toggle { display: flex; align-items: center; gap: .5rem; margin: 0 0 .45rem; min-height: 32px; }
.also-send-toggle[hidden] { display: none; }
.also-send-toggle input { flex: 0 0 18px; width: 18px; height: 18px; margin: 0; accent-color: var(--blue); }

.button { padding: .58rem .85rem; border: 1px solid transparent; border-radius: .42rem; color: var(--text); font-size: .78rem; font-weight: 600; }
.button.primary { color: var(--on-accent); background: var(--blue-strong); }
.button.primary:hover { background: var(--blue-strong-hover); }
.button.primary.icon-button:hover { color: var(--on-accent); background: var(--blue-strong-hover); }
.button.secondary { border-color: var(--line); background: var(--panel-raised); }
.button.secondary:hover, .button.ghost:hover { background: var(--panel-hover); }
.button.ghost { border-color: var(--line); background: transparent; color: var(--muted); }
.new-work-form { margin: 1rem; padding: 1rem; border: 1px solid #375074; background: #111a27; }
.new-work-form label { display: grid; gap: .35rem; margin-bottom: .75rem; }
.work-checks { min-width: 0; margin: 0 0 .75rem; padding: .8rem; border: 1px solid var(--line); }
.work-checks legend { padding: 0 .3rem; font-size: .8rem; }
#new-work-form .check { display: flex; align-items: center; gap: .6rem; min-height: 44px; min-width: 0; overflow-wrap: anywhere; }
.form-actions { display: flex; justify-content: flex-end; gap: .5rem; }

.work-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: .8rem; max-height: 72vh; padding: 1rem; overflow-y: auto; }
.work-card { padding: 1rem; border: 1px solid var(--line); background: var(--panel-raised); scroll-margin-top: 6rem; }
.work-card-header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
/* UI calming #10: .state/.mode consolidated here (was split with a second
   .state rule later in the file); the later rule's values win. */
.state, .mode { font-weight: 800; }
.state { padding: .25rem .45rem; border: 0; border-radius: .35rem; background: #172335; color: #bcd5ff; font-size: var(--text-xs); }
.state-completed { border-color: #2e795e; background: #112b23; color: #7ce2b7; }
.state-blocked { border-color: #855a35; background: #2d2015; color: #ffbe7c; }
.mode { font-size: .65rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.definition { color: var(--muted); font-size: .8rem; line-height: 1.5; }
.work-facts { display: grid; gap: .35rem; margin: .8rem 0; }
.work-next-step { margin: .6rem 0; color: var(--muted); font-size: .875rem; line-height: 1.5; overflow-wrap: anywhere; }
.work-facts > div { display: grid; grid-template-columns: 6.2rem 1fr; gap: .5rem; }
.work-facts dt { color: var(--muted); font-size: .7rem; }
.work-facts dd { margin: 0; color: #d8dee8; font-size: .75rem; line-height: 1.4; overflow-wrap: anywhere; }
.receipt { margin-top: .9rem; padding: .85rem; border: 1px solid #2a4c43; background: #0d211b; }
.receipt-label { margin-bottom: .4rem !important; color: var(--green) !important; font-size: .63rem !important; font-weight: 850; letter-spacing: .1em; }
.receipt-attribution { display: grid; gap: .3rem; margin: 0 0 .7rem; }
.receipt-attribution > div { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: .5rem; }
.receipt-attribution dt { color: #87a59b; font-size: var(--text-xs); }
.receipt-attribution dd { margin: 0; color: #d6e8e1; font-size: var(--text-sm); overflow-wrap: anywhere; }
.receipt p { margin-bottom: .55rem; color: #cce2da; font-size: .77rem; line-height: 1.45; }
.receipt a { display: inline-block; font-size: .72rem; text-decoration: none; }
.receipt code { float: right; color: #9bbbae; font-size: .68rem; }
.loop-warning { margin: .5rem 0 0; padding: .5rem .75rem; border-left: 3px solid var(--amber); background: #241b12; color: #e8caa8; font-size: var(--text-xs); line-height: 1.5; }
.blocker { margin-top: .8rem; padding: .75rem; border-left: 3px solid var(--amber); background: #241b12; }
.blocker strong { color: var(--amber); font-size: .72rem; }
.blocker p { margin: .25rem 0 0; color: #e8caa8; font-size: var(--text-xs); }
:root[data-theme="light"] .blocker { background: var(--panel); color: var(--text); }
:root[data-theme="light"] .blocker p { color: var(--text); }
.decision { margin-top: .8rem; padding: .75rem; border-left: 3px solid var(--blue); background: #101f36; }
.decision strong { color: #a9c8ff; font-size: .72rem; }
.decision p { margin: .25rem 0 0; color: #c5d4ee; font-size: var(--text-xs); }
.claim { margin-top: .75rem; color: var(--muted); font-size: .7rem; }
.claim summary { cursor: pointer; color: var(--violet); }
.claim p { margin: .35rem 0 0; overflow-wrap: anywhere; }
.claim .claim-overlap { color: var(--amber); }
.claim .claim-overlap-list { margin: .25rem 0 0; padding-left: 1rem; overflow-wrap: anywhere; }
.work-actions { display: flex; flex-wrap: wrap; gap: .45rem; min-height: 2.6rem; align-items: center; margin-top: .9rem; }
.work-begin-limit { margin: 0 0 .35rem; color: var(--muted); font-size: .78rem; }
.work-more > summary { cursor: pointer; color: var(--muted); font-size: .78rem; font-weight: 600; }
.work-more-actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .45rem; }

.event-list { margin: 0; padding: .8rem 1rem 0; list-style: none; }
.event-list li { display: grid; gap: .25rem; padding: .8rem 0; overflow-wrap: anywhere; }
.event-list li + li { border-top: 1px solid var(--line-soft); }
.event-list strong { display: block; color: #dbe2ec; font-size: .73rem; }
.event-list p { margin: .15rem 0 0; color: var(--muted); font-size: .67rem; }
.prototype-note { margin: .6rem 1rem 1rem; padding: .8rem; border-top: 1px solid var(--line); color: #7f8b9b; font-size: .7rem; line-height: 1.55; }
.prototype-note strong { color: #aeb8c5; }
.status { position: fixed; right: 1rem; bottom: 1rem; z-index: 20; max-width: min(24rem, calc(100vw - 2rem)); padding: .75rem 1rem; border: 1px solid #315d4e; background: #10271f; color: #a7e7cd; font-size: .78rem; opacity: 0; transform: translateY(.5rem); transition: .18s ease; pointer-events: none; }
.status.visible { opacity: 1; transform: translateY(0); }
.status.error { border-color: #704242; background: #2a1616; color: #ffb0b0; }
/* Quiet Focus A4: composer-local failure text stays in flow beside the draft. */
.form-status { position: static; opacity: 1; transform: none; pointer-events: auto; max-width: none; margin: .35rem 0 0; padding: .5rem .75rem; }
.form-status:not(.visible) { display: none; }

/* Discord/Slack-style room shell: persistent sidebar + single channel column. */
.community-shell { display: grid; grid-template-columns: 16rem minmax(0, 1fr); max-width: none; min-height: 0; margin: 0; padding: 0; }
#room-sidebar { display: flex; flex-direction: column; gap: 1rem; min-width: 0; min-height: 0; padding: 1rem .75rem; border-right: 1px solid var(--line-soft); background: var(--panel); overflow-y: auto; }
.sidebar-head { display: flex; align-items: center; gap: .5rem; min-width: 0; }
#room-title { margin: 0; font-size: var(--text-md); font-weight: 800; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* UI calming #10: .room-kind-badge consolidated here (was defined twice; the
   later rule's values win). */
.room-kind-badge { display: inline-block; flex: none; margin: .15rem 0 .35rem; font-size: .7rem; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: .4rem; padding: .05rem .4rem; }
.room-archived-note { margin: 0; font-size: var(--text-xs); color: var(--muted); }
.sidebar-label { margin: 0 0 .3rem; color: var(--muted); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0; }
.channel-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .15rem; }
.channel { display: flex; align-items: center; gap: .45rem; width: 100%; min-height: 40px; padding: .45rem .6rem; border: 0; border-radius: .5rem; background: transparent; color: var(--text); font-size: .88rem; font-weight: 600; text-align: left; cursor: pointer; }
.channel:hover { background: rgb(255 255 255 / 4%); }
.channel.is-active { background: #37374e; color: #f2f0ff; }
.channels-label { display: flex; align-items: center; justify-content: space-between; }
.channel-row { display: flex; align-items: center; gap: .15rem; }
.channel-row .channel { flex: 1 1 auto; width: auto; min-width: 0; }
.channel .channel-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-manage { opacity: 0; flex: none; }
.channel-row:hover .channel-manage, .channel-row:focus-within .channel-manage { opacity: 1; }
/* Touch viewports have no hover: keep the owner-only channel settings
   affordance visible instead of undiscoverable. */
@media (hover: none), (pointer: coarse) { .channel-manage { opacity: 1; } }
#people-panel { border: 0; background: transparent; box-shadow: none; padding: 0; }
#people-panel > summary { list-style: none; }
#people-panel > summary::-webkit-details-marker { display: none; }
#people-panel > summary::before { display: none; }
.people-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; }
.people-actions .button { width: auto; min-height: 36px; padding: .35rem .7rem; font-size: .78rem; }
.create-room-details { margin: 0 0 .5rem; font-size: .78rem; color: var(--muted); }
.create-room-details summary { min-height: 36px; cursor: pointer; color: var(--text); font-weight: 600; }
.room-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; }
.room-main > :not(.timeline) { flex-shrink: 0; }
.room-topbar { display: flex; align-items: center; gap: .6rem; min-height: 3.5rem; padding: .45rem 1.25rem; border-bottom: 1px solid var(--line-soft); }
#conversation-title { margin: 0; font-size: var(--text-md); font-weight: 800; letter-spacing: -.01em; }
.room-topbar .count-chip { flex: none; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.topbar-button { display: inline-flex; align-items: center; gap: .35rem; min-height: 36px; padding: .35rem .65rem; border: 1px solid transparent; border-radius: .5rem; background: transparent; color: var(--text); font-size: .8rem; font-weight: 650; cursor: pointer; white-space: nowrap; }
.topbar-button:hover { background: rgb(255 255 255 / 5%); }
.topbar-button kbd { font-size: .68rem; color: var(--muted); }
.topbar-search { padding: .5rem 1rem; border-bottom: 1px solid var(--line-soft); }
.search-row { display: flex; gap: .4rem; align-items: center; }
.search-row input { flex: 1; min-width: 0; }
.search-row .button { min-height: 36px; padding: .3rem .6rem; font-size: .78rem; }
.search-results { padding: .5rem 1rem; border-bottom: 1px solid var(--line-soft); max-height: 16rem; overflow-y: auto; }
/* Keep several lines readable when enlarged controls consume the viewport.
   The room scrolls to its composer instead of squeezing the timeline away. */
.timeline { flex: 1 1 auto; min-height: 10rem; overflow-y: auto; margin: 0; padding: .75rem 1.5rem 1rem; list-style: none; scrollbar-gutter: stable; }
.timeline > .empty-note { color: var(--muted); }
.tl-work { margin: .6rem 0; }
.conversation-work { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: .35rem; max-width: 100%; }
.conversation-work-summary { flex-basis: 100%; color: var(--muted); overflow-wrap: anywhere; }
.tl-work .work-card { border: 1px solid var(--line); border-radius: .65rem; background: var(--panel-raised); padding: .85rem 1rem; }
.tl-work .work-card h3 { margin: .3rem 0 .2rem; font-size: .95rem; }
.tl-work .work-next-step { margin: .15rem 0; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .5rem; }
.dialog-head h2 { margin: 0; font-size: 1.1rem; }
#catchup-dialog, #settings-dialog { width: min(42rem, calc(100vw - 2rem)); max-height: calc(100dvh - 4rem); }
#settings-dialog .panel, #catchup-dialog .panel { box-shadow: none; }
.composer { position: relative; padding: .7rem 1.25rem .65rem; padding-bottom: max(.65rem, env(safe-area-inset-bottom)); background: var(--bg); }
/* Typing indicator: ephemeral ambient presence above the composer. */
.typing-indicator { padding: .15rem 1.25rem; color: var(--muted); font-size: var(--text-xs); font-style: italic; }
.typing-indicator[hidden] { display: none; }
.composer-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) 36px 44px; align-items: end; gap: .5rem; padding: .5rem; border: 1px solid var(--line-control); border-radius: .75rem; background: var(--panel-raised); }
.composer-row:focus-within { border-color: var(--blue); }
.composer-row textarea { grid-column: 2; min-height: 3rem; max-height: 25dvh; border: 0; border-radius: .35rem; background: transparent; padding: .45rem .25rem; }
.composer-row textarea:focus { outline: 0; }
.composer-row #request-reply { grid-column: 2; grid-row: 2; justify-self: end; align-self: center; min-height: 32px; padding: .2rem .55rem; font-size: .75rem; white-space: nowrap; }
.composer-attach { grid-column: 3; grid-row: 1 / span 2; align-self: end; }
.composer-row > button[type="submit"] { grid-column: 4; grid-row: 2; min-height: 44px; min-width: 44px; }
.composer-attachments, .message-files { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }
.file-chip { display: inline-flex; align-items: center; gap: .35rem; max-width: 100%; padding: .15rem .45rem; border: 1px solid var(--line); border-radius: 999px; font-size: .8rem; }
.file-chip button { border: 0; background: transparent; color: inherit; cursor: pointer; min-height: 1.5rem; }
/* 360px phones: a long attachment filename must truncate inside the message
   column instead of forcing horizontal overflow. The first child carries the
   filename (the download button in messages, the label span in the composer);
   the remove/status controls after it stay fully visible. The full name stays
   in the button's aria-label. */
.file-chip { min-width: 0; }
.file-chip > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#message-form.composer-drop { outline: 2px dashed var(--blue); outline-offset: 2px; }
.composer-add { display: inline-grid; place-items: center; width: 36px; min-height: 36px; height: 36px; border-radius: .4rem; border: 0; background: transparent; color: var(--muted); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.composer-add:hover { background: rgb(255 255 255 / 6%); }
#sidebar-toggle { display: none; }
.message { scroll-margin-top: 6rem; }
/* content-visibility removed: it breaks the "⋯" menu positioning by skipping
   off-screen messages. The menu needs the message rendered to position correctly. */
.audience-chip { display: inline-block; margin: 0 0 .2rem; color: #8195af; font-size: .66rem; }
.message-links { display: flex; align-items: center; gap: .8rem; min-height: 1.25rem; }
.message-to-work, .text-button { padding: 0; border: 0; background: transparent; color: var(--blue); font-size: .69rem; font-weight: 700; }
.message-to-work:hover, .text-button:hover { text-decoration: underline; }
/* antislop #7: "Advanced" on Add agent is a disclosure; show that it opens.
   The summary is display:flex (.agent-advanced > summary, below), which drops
   the native marker, so the marker is drawn. */
#agent-connect-advanced > summary::before { content: "\25B8"; margin-right: var(--space-2); }
#agent-connect-advanced[open] > summary::before { content: "\25BE"; }
/* antislop #6: on the sign-in surfaces, text links are real tap targets
   (14 px text, 44 px row) inside the form steps. The welcome view and chat
   rows keep the compact size above. */
/* #agent-signin-ui is the agent sign-in component's mount on its own
   page (/agent-signin) — the same 44px floor applies there. */
#auth-signin-ui .text-button, #agent-signin-ui .text-button { min-height: 44px; font-size: var(--text-sm); }
#join-account-rooms-link { display: inline-flex; align-items: center; min-height: 44px; font-size: var(--text-sm); }
/* UI calming #2: the "⋯" overflow menu holds Save as result / Pin / Make this
   work / Record decision / moderation; it fades in with the other actions.
   The fade targets the summary only, never the <details> itself: opacity < 1
   on the details would trap the absolutely-positioned menu inside its own
   stacking context, painting it UNDER the following message so the menu can
   never be hovered or clicked. An open menu also lifts above later messages. */
.message-more { position: relative; }
.message-more[open] { z-index: 40; }
/* The .message-menu-open class is no longer needed (content-visibility removed).
   Kept for test helpers that add it manually; it has no visual effect. */
.message-menu-open { position: relative; z-index: 40; }
.message-more > summary { list-style: none; cursor: pointer; color: var(--blue); font-size: .78rem; font-weight: 700; padding: .1rem .3rem; border-radius: .35rem; }
.message-more > summary::-webkit-details-marker { display: none; }
/* QA-200 challenger (ch-2034, follow-up to #2034): the per-message "⋯"
   overflow trigger is a ~20px summary with no coarse-pointer floor. On touch
   it's the only path to the message overflow actions (Save/Pin/Make work/
   Record decision/moderation) because the hover reveal is scoped to
   (hover:hover) and (pointer:fine). summary is not a <button>, so the global
   button floor doesn't cover it. */
@media (pointer: coarse) {
  .message-more > summary { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
}
.message-more > summary:hover { background: rgb(255 255 255 / 6%); }
.message-more > summary:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.message-more-menu { position: absolute; right: 0; top: calc(100% + .25rem); z-index: 30; display: grid; gap: .1rem; min-width: 12rem; padding: .35rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--panel-raised); box-shadow: var(--shadow); }
/* Flipped upward by JavaScript when there isn't room below (near the composer). */
.message-more-up .message-more-menu { top: auto; bottom: calc(100% + .25rem); }
.message-more-start .message-more-menu { right: auto; left: 0; }
.message-more-menu .message-to-work { padding: .5rem .6rem; text-align: left; font-size: .78rem; }
.message-more[open] .message-more-menu .message-to-work { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  .message-links .message-to-work:not([data-message-action="reply"]):not([data-message-action="request-follow-up"]), .message-links .message-more > summary { opacity: 0; }
  .message:is(:hover, :focus-within) .message-links .message-to-work, .message:is(:hover, :focus-within) .message-links .message-more > summary { opacity: 1; }
}
.composer-toolbar { display: flex; align-items: center; gap: .55rem; margin-bottom: .5rem; }
.composer-toolbar label { white-space: nowrap; }
.composer-toolbar .audience-label { color: var(--room-quiet); }
.composer-toolbar select { width: auto; min-width: 0; max-width: 100%; min-height: 44px; padding-block: 0; font-size: .72rem; }
.composer-toolbar .text-button { margin-left: auto; }

.presence-list { padding: .25rem 0; }
.presence-heading { margin: .55rem 0 .1rem; color: var(--room-quiet); font-size: .62rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.presence-heading:first-child { margin-top: 0; }
.presence-member { position: relative; display: grid; grid-template-columns: 1.8rem minmax(0, 1fr); align-items: center; gap: .6rem; min-width: 0; padding: .45rem .35rem; border-radius: .4rem; cursor: pointer; }

#presence-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
#presence-count { min-height: 0; min-width: 0; border: 0; font-size: .7rem; letter-spacing: 0; text-transform: none; }
.member-profile > summary { position: absolute; right: .15rem; top: .25rem; display: grid; place-items: center; width: 32px; height: 32px; min-height: 32px; list-style: none; cursor: pointer; border-radius: .4rem; color: var(--muted); font-weight: 700; }
.member-profile > summary::-webkit-details-marker { display: none; }
.member-profile > summary:hover, .member-profile[open] > summary { background: var(--panel-raised); color: var(--text); }
.member-profile-body { margin: .6rem 0 .25rem -2.4rem; padding: .75rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--panel-raised); font-size: .8rem; overflow-wrap: anywhere; }
.member-profile-badges { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .4rem; }
.member-profile-badges > span { margin-left: 0; }
.member-profile-body summary { min-height: 36px; padding-block: .5rem; cursor: pointer; }
.member-profile-body p { margin-bottom: .4rem; }
.member-profile-body .member-status { white-space: normal; font-size: .8rem; }
/* plan-dir-card: the member chip's directory card section. */
.member-directory-card { margin-top: .5rem; }
.member-directory-card > summary { min-height: 36px; padding-block: .5rem; cursor: pointer; }
.member-card-badges { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .4rem; }
.card-provenance, .card-visibility { font-size: var(--text-xs); padding: .1rem .45rem; border: 1px solid var(--line); border-radius: 999px; }
.card-provenance-seeded { border-style: dashed; }
.member-card-body p { margin-bottom: .4rem; }
.room-tools > summary { cursor: pointer; min-height: 44px; padding-block: .7rem; }
@media (pointer: coarse) { .presence-member { min-height: 52px; } .member-profile > summary { width: 44px; height: 44px; } .member-head { padding-right: 2.25rem; } }

.presence-member:hover { background: rgb(255 255 255 / 3%); }
.presence-member .member-avatar { width: 1.8rem; margin: 0; border: 0; border-radius: 50%; }
.presence-member .member-avatar.agent { border-radius: .45rem; }
.presence-member > div:nth-child(2) { display: grid; min-width: 0; gap: .15rem; }
.member-head { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; min-width: 0; padding-right: 1.7rem; }
.member-handle { overflow: hidden; color: var(--text); font-size: .82rem; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.member-handle-agent { color: var(--text); font-weight: 600; }
.presence-dot { position: absolute; right: -2px; bottom: -2px; width: .62rem; height: .62rem; border: 2px solid var(--panel); border-radius: 50%; }
.presence-online { background: var(--room-green); }
.presence-away { background: var(--room-quiet); }
.presence-offline { background: var(--room-rule); }
/* #660: server-derived working states. */
.presence-working { background: var(--room-green); box-shadow: 0 0 0 2px color-mix(in srgb, var(--green) 35%, transparent); }
.presence-listening { background: var(--room-green); }
.presence-idle { background: var(--room-quiet); }
.presence-unreachable { background: var(--room-red); }
.member-state-chip { display: inline-block; margin-left: .35rem; padding: .05rem .4rem; border-radius: 999px; font-size: .68rem; font-weight: 700; letter-spacing: .02em; background: rgb(255 255 255 / 6%); color: var(--muted); vertical-align: middle; }
.member-state-chip[data-state="working"] { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--room-green); }
.member-state-chip[data-state="unreachable"] { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--room-red); }
.member-working-on { display: block; font-size: .78rem; color: var(--muted); font-style: italic; }
.member-working-on .work-link { display: inline-block; min-height: 24px; line-height: 24px; padding: 0; margin: 0; font: inherit; text-decoration: underline; }
.member-owned-by { display: block; font-size: var(--text-xs); color: var(--room-quiet); }
.owner-chip { display: inline-block; margin-left: .35rem; padding: .05rem .4rem; border-radius: 999px; font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; background: color-mix(in srgb, var(--amber) 15%, transparent); color: var(--amber); vertical-align: middle; }
/* Round-2 #117: done chip — marks terminally finished work at a glance.
   UI calming #10: consolidated here (was defined twice; the later rule won). */
.done-chip { flex: 0 0 auto; display: inline-grid; place-items: center; gap: .25rem; min-height: 1.15rem; padding: .05rem .38rem; border: 1px solid var(--room-rule); border-radius: 99px; background: color-mix(in srgb, var(--room-green) 16%, var(--room-dark)); color: var(--room-green); font-size: .58rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.work-card-header .done-chip { margin-left: .5rem; }
.message-links .done-chip { margin-left: .4rem; }
/* Muse-lane motion (transitions.dev badge steal, tip #11): Done receipt chip
   spring. Transform/opacity only. Instant under prefers-reduced-motion.
   No People-rail unread indicator exists; this language is chip-only. */
@keyframes done-chip-pop {
  0% { opacity: 0; transform: translate(-0.22em, 0.16em) scale(0.84) rotate(-8deg); }
  58% { opacity: 1; transform: translate(0.03em, -0.05em) scale(1.06) rotate(1.5deg); }
  100% { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .done-chip { animation: done-chip-pop .42s cubic-bezier(.22, 1.35, .36, 1) both; }
}
.member-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: .1rem 0 .15rem; }
.member-actions .text-button { min-height: 24px; font-size: var(--text-xs); }
.member-actions .member-remove.armed { color: var(--red); }
.pause-chip { display: inline-flex; align-items: center; margin-left: .4rem; padding: .1rem .45rem; border-radius: 999px; border: 1px solid var(--room-quiet); color: var(--room-quiet); font-size: .65rem; font-weight: 700; }
.member-status { margin: 0; color: var(--room-quiet); font-size: .65rem; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-context { margin-bottom: .75rem; padding: .65rem; border-left: 2px solid var(--violet); background: #1a1625; color: #b9acce; font-size: .69rem; line-height: 1.45; }
.source-link { color: var(--violet); font-size: .68rem; text-decoration: none; }
button.source-link { background: none; border: 0; padding: .25rem 0; text-align: left; }
.record-panel { box-shadow: none; }
/* C7: consistent progressive disclosure - every in-room section summary shares
   one anatomy (chevron, label, trailing chip/note), hit target and focus ring. */
.section-summary { display: flex; align-items: center; gap: .5rem; min-height: 44px; cursor: pointer; list-style: none; }
.section-summary::-webkit-details-marker { display: none; }
.section-summary::before { content: ""; flex: none; width: .5rem; height: .5rem; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s ease; }
details[open] > .section-summary::before { transform: rotate(45deg); }
.section-summary .count-chip, .section-summary .summary-note { margin-left: auto; }
.summary-note { color: var(--muted); font-size: .72rem; text-align: right; }
.section-summary:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.record-panel > summary > span:first-child { display: grid; gap: .18rem; }
.record-panel > summary .eyebrow { margin: 0; }
.record-panel .event-list { max-height: 22rem; overflow-y: auto; }

@media (max-width: 1180px) {
  .community-shell { grid-template-columns: 12rem minmax(0, 1fr); }
}

@media (max-width: 940px) {
  .community-shell { grid-template-columns: 1fr; }
  #sidebar-toggle { display: inline-grid; }
  #room-sidebar { display: none; position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: min(18rem, 85vw); max-height: none; box-shadow: 0 0 40px rgb(0 0 0 / 50%); }
  .community-shell.sidebar-open #room-sidebar { display: flex; }

}

@media (max-width: 640px) {
  .room-topbar { flex-wrap: wrap; padding: .5rem .75rem; }
  .topbar-actions { gap: .15rem; }
  .topbar-button { padding: .35rem .45rem; font-size: var(--text-xs); }
  .topbar-button kbd { display: none; }
  .timeline { padding: .5rem .75rem 1rem; }
 .composer { padding: .6rem .75rem .8rem; }
 .chat-suggestions { padding: .25rem .75rem 0; }
}

/* C1: short mobile header - session actions fold into an accessible menu so
   conversation is reachable sooner; identity and connection state stay visible. */
@media (max-width: 640px) {
  .topbar { flex-direction: row; align-items: center; min-height: 3.25rem; padding: .5rem .75rem; }
  .brand-mark { width: 2rem; font-size: .66rem; }
  .topbar-actions { align-items: center; gap: .5rem; }
  #identity-label { font-size: .8rem; color: var(--muted); max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .session-menu { display: block; position: relative; }
  #session-menu.empty { display: none; }
  #session-menu-button { display: inline-grid; }
  .session-menu-panel { display: none; position: absolute; right: 0; top: calc(100% + .4rem); z-index: 30; min-width: 10rem; padding: .5rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--panel-raised, #131922); box-shadow: 0 10px 30px rgb(0 0 0 / 45%); }
  .session-menu.open .session-menu-panel { display: flex; flex-direction: column; gap: .25rem; }
  .session-menu-panel .button { width: 100%; justify-content: center; }
}

@media (max-width: 500px) {
  .topbar { padding-inline: .75rem; }
  .composer-toolbar { flex-wrap: wrap; }
  .composer-toolbar select { width: 100%; }
  .composer-toolbar .text-button { margin-left: 0; }
  .work-facts > div { grid-template-columns: 5.4rem 1fr; }
  .receipt code { float: none; display: block; margin-top: .45rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
  .done-chip { animation: none !important; opacity: 1; transform: none; }
}

/* Connected pilot: preserve the conversation-first layout without demo status. */
[hidden] { display: none !important; }
.connection-status { margin: 0; padding: .2rem 1.25rem; color: var(--muted); font-size: var(--text-xs); }
.connection-bar { position: relative; display: flex; align-items: center; gap: .5rem; border-bottom: 1px solid var(--line-soft); }
.connection-bar .connection-status { flex: 1; min-width: 0; border: 0; padding-right: 0; overflow-wrap: anywhere; }
.connection-status[data-state="connected"]::before { content: ""; display: inline-block; width: .4rem; height: .4rem; border-radius: 50%; margin-right: .5rem; background: var(--green); vertical-align: middle; }
#connection-details { margin-right: clamp(1rem, 3vw, 2.5rem); color: var(--muted); font-size: var(--text-sm); }
#connection-details > summary { cursor: pointer; min-height: 28px; padding-block: .3rem; font-size: var(--text-xs); }
#connection-explanation { position: absolute; z-index: 15; top: 100%; right: 1rem; margin: .25rem 0 0; width: min(26rem, calc(100vw - 2rem)); padding: 1rem; border: 1px solid var(--line); border-radius: .75rem; background: var(--panel-raised); box-shadow: var(--shadow); line-height: 1.5; overflow-wrap: anywhere; }
#people-hint:empty { display: none; }
/* #3340: account-home Needs Attention badge sits in the cockpit heading
   (the .count-chip rules carry its shape); per-room deep-link lines are
   compact rows above the Decisions queue. */
.cockpit-room-line { margin: .25rem 0; }
/* #662: owner "needs your attention" card. */
.needs-attention { margin: 0 1rem .5rem; padding: .6rem 1rem; border: 1px solid var(--line); border-radius: .65rem; background: rgb(255 255 255 / 4%); }
.needs-attention[hidden] { display: none; }
.attention-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .5rem; flex-wrap: wrap; }
.attention-header h3 { margin: 0; font-size: var(--text-md); display: flex; align-items: center; gap: .5rem; min-width: 0; }
.attention-icon { display: inline-flex; align-items: center; justify-content: center; width: 1.25rem; height: 1.25rem; border-radius: 50%; background: var(--accent, #d97706); color: #fff; font-size: .8rem; font-weight: 700; }
.attention-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
/* The preview is a glance, not a reading surface: one ellipsized line per item so a long
   room keeps its reading window. Open activity has the full text. */
/* min-width: 0 lets the nowrap line shrink to the card; without it the line's full
   length sets the page's minimum width and a phone's layout viewport grows with it. */
.needs-attention { min-width: 0; }
.attention-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.attention-item { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .75rem; padding: .6rem .75rem; border: 1px solid var(--line-soft); border-radius: .5rem; background: rgb(255 255 255 / 2%); }
.attention-body { flex: 1 1 18rem; min-width: 0; }
.attention-kind { display: inline-block; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-right: .5rem; }
.attention-severity-action .attention-kind { color: var(--amber); font-weight: 700; }
.attention-title { font-size: .95rem; overflow-wrap: anywhere; }
.attention-detail { margin: .25rem 0 0; color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.attention-actions { display: flex; align-items: center; gap: .5rem; }
.attention-actions .button { width: auto; }
.attention-hint { color: var(--muted); font-size: .85rem; }
#attention-status:empty { display: none; }
.auth-panel { max-width: 28rem; margin: clamp(1rem, 8vw, 6rem) auto; padding: clamp(1.25rem, 4vw, 2.5rem); }
#session-restore { display: grid; gap: .45rem; margin: 1.25rem 0 0; }
#session-restore[hidden] { display: none; }
#session-restore .button { width: 100%; }
.auth-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); gap: .5rem; margin-top: .5rem; }
.auth-methods .button { min-width: 0; }
.auth-oauth-row .button { width: 100%; }
[data-signin-panel]:not(:empty) { margin-top: 1rem; }
.auth-kind { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0 0 1rem; }
.auth-kind .button { flex: 1 1 8rem; width: auto; min-width: 0; }
.auth-kind .button[aria-pressed="true"] { border-color: var(--blue); color: var(--text); background: rgb(255 255 255 / 6%); }
.auth-kind .button.suggested { box-shadow: inset 0 0 0 1px var(--amber); }
.key-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .45rem; align-items: center; width: 100%; min-width: 0; }
.app-shell:has(#auth-panel:not([hidden])) #identity-label,
.app-shell:has(#auth-panel:not([hidden])) .connection-bar:has([data-state="signed-out"]) { display: none; }
.auth-panel h1 { margin-bottom: 1.5rem; overflow-wrap: anywhere; }
.auth-panel h1 { font-size: clamp(1.7rem, 4vw, 1.9rem); line-height: 1.2; text-wrap: balance; }
/* RC-2026-09-30-3650 (human-door P0-1): the logged-out hero. A raised card
   under the brand heading so a logged-out human sees what Project Room is
   and where to go, instead of a bare sign-in wall. */
.auth-hero { margin: 0 0 1.5rem; padding: 1rem 1.25rem; border: 1px solid var(--line-soft); border-radius: .75rem; background: var(--panel-raised); }
.auth-hero-tagline { font-size: 1.02rem; line-height: 1.55; margin: 0 0 .75rem; }
.auth-hero-links { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; margin: 0 0 .6rem; }
.auth-hero .form-hint { margin-top: 0; color: var(--muted); }
.auth-panel p, dialog p { line-height: 1.6; }
#invitation-summary:empty { display: none; }
.auth-panel form, #action-fields, #action-form, #invitation-account-form, .invitation-shell { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
#action-text-body, #result-body { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 22rem; overflow: auto; font: inherit; font-size: var(--text-md); padding: 1rem; border: 1px solid var(--line); border-radius: .65rem; }
#action-context { overflow-wrap: anywhere; }
#action-text, #action-form { min-width: 0; }
.auth-panel label, dialog label { display: grid; grid-template-columns: minmax(0, 1fr); gap: .45rem; }
#auth-error { color: var(--red); min-height: 1.5rem; margin: 0; }
#auth-reconnect:not([hidden]) { width: 100%; justify-content: center; min-height: 48px; margin: .5rem 0; }
#identity-label { align-self: center; overflow-wrap: anywhere; }
.topbar-actions { flex-wrap: wrap; }
.empty-note { padding: 1.25rem; color: var(--muted); font-size: var(--text-md); line-height: 1.6; }
.empty-note .text-button { min-height: 44px; margin-top: .35rem; }
#people-hint:empty { display: none; }
.people-actions { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0; padding: 0; }
.people-actions .button { width: auto; }
.create-room-details { margin: 0 .8rem .5rem; font-size: .9rem; }
.create-room-details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.create-room-details p { margin: .35rem 0; color: var(--muted); overflow-wrap: anywhere; }
.create-room-details code { font-size: .85em; }
.reply-bar, .cursor-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .65rem 1rem; border-top: 1px solid var(--line-soft); font-size: var(--text-sm); color: var(--muted); }
.reply-bar-actions { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
#reply-mention[aria-pressed="true"] { color: var(--text); }
#reply-mention[hidden] { display: none; }
#request-mode-bar { flex-wrap: wrap; }
#request-mode-label { flex: 1 1 auto; overflow-wrap: anywhere; }
.contribution-next { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .25rem 1rem .9rem; }
.contribution-next > div:first-child { min-width: 0; }
.contribution-next p { margin: .2rem 0 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.contribution-actions { display: flex; align-items: center; gap: .75rem; flex-shrink: 0; }
#review-brief p { white-space: pre-wrap; overflow-wrap: anywhere; }
#review-brief { padding: .75rem 0; border-bottom: 1px solid var(--line-soft); }
#review-brief summary { cursor: pointer; min-height: 44px; padding-block: .65rem; }
@media (max-width: 600px) {
  .contribution-next { align-items: stretch; flex-direction: column; gap: .6rem; }
  .contribution-actions { flex-wrap: wrap; }
}
.request-state { display: inline-block; margin-right: .5rem; color: var(--muted); font-size: var(--text-sm); }
.message-content p { font-size: var(--text-md); white-space: pre-wrap; overflow-wrap: anywhere; }
.form-hint, .prototype-note, .source-link, .audience-chip, .pinned-chip, .message-meta time, .member-status, .work-facts, .definition, .receipt p, .receipt a, .blocker p, .decision p, .source-context { font-size: .875rem; }
label, input, textarea, select { font-size: var(--text-md); }
.member-profile-body details { font-size: var(--text-sm); color: var(--muted); max-width: 16rem; overflow-wrap: anywhere; }
.member-profile-body details p { font-size: var(--text-sm); line-height: 1.5; }
.receipt code, .event-list code { display: block; overflow-wrap: anywhere; max-width: 100%; }
dialog { width: min(38rem, calc(100vw - 1.5rem)); max-height: calc(100dvh - 2rem); overflow: auto; border: 1px solid var(--line); border-radius: .85rem; padding: clamp(1rem, 4vw, 2rem); background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
/* A textarea's caret reveal can leave its lower padding and focus ring
   outside the scrollport. Keep a text-line inset using the shared space scale. */
#action-dialog { scroll-padding-bottom: var(--space-5); }
dialog::backdrop { background: rgb(0 0 0 / 72%); }
dialog h2 { margin: 0; }
dialog p { margin: 0; color: var(--muted); }
.portable-section { display: grid; gap: .8rem; margin-top: 1rem; }
.portable-section[hidden] { display: none; }
.portable-section textarea { width: 100%; min-height: 12rem; resize: vertical; font: inherit; font-size: var(--text-md); line-height: 1.5; }
.portable-section label:has(input[type="checkbox"]) { display: flex; align-items: center; gap: .6rem; min-height: 44px; }
.portable-section input[type="checkbox"] { width: 1.1rem; height: 1.1rem; min-height: 0; margin: 0; padding: 0; flex: none; }
.portable-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
#portable-work-title { overflow-wrap: anywhere; }
#portable-status { margin-top: .8rem; }
#portable-original-body { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.5; max-height: 14rem; overflow: auto; }
#result-copy-dialog summary { cursor: pointer; min-height: 44px; padding-block: .65rem; color: var(--muted); font-size: var(--text-sm); }
#result-copy-dialog .form-hint { overflow-wrap: anywhere; }
#result-copy-dialog > .panel-header { padding: 0 0 .75rem; align-items: flex-start; gap: .75rem; }
#reminder-work-title, #reminder-preview, .reminder-list { overflow-wrap: anywhere; }
#reminder-custom-label[hidden] { display: none; }
.reminder-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.reminder-list li a { grid-column: 1; }
.reminder-list li small { grid-column: 1; color: var(--muted); font-size: var(--text-sm); }
.reminder-list li button { grid-column: 2; grid-row: 1 / 3; }
#reminder-load-error:empty, #reminder-current:empty { display: none; }
.access-help { margin-top: 1rem; }
.access-help summary { cursor: pointer; min-height: 44px; }
.access-help p { color: var(--muted); }
button, .button, .message-to-work { min-height: 44px; }
.status { max-width: min(40rem, calc(100vw - 2rem)); overflow-wrap: anywhere; pointer-events: none; }
/* Error toasts persist: they take pointer events so the text can be selected, copied and dismissed. */
#status.error { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; pointer-events: auto; user-select: text; }
#status.error .status-text { flex: 1 1 14rem; }
.status-dismiss { flex: none; margin-left: auto; padding: 0 .7rem; border: 1px solid currentColor; border-radius: .35rem; background: transparent; color: inherit; font: inherit; font-size: .74rem; font-weight: 650; cursor: pointer; }
.status-dismiss:hover { background: rgb(255 255 255 / 8%); }
.invitation-dialog { width: min(42rem, calc(100vw - 1.5rem)); }
.invitation-dialog[aria-busy="true"] { cursor: wait; }
.invitation-boundary { padding: .8rem .9rem; border-left: 3px solid var(--blue); background: #101f36; color: #c8d9f6; }
.invitation-details { display: grid; gap: .65rem; margin: 0; padding: .9rem; border: 1px solid var(--line); background: #0d1117; }
.invitation-details[hidden] { display: none; }
.invitation-details > div { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: .75rem; }
.invitation-details dt { color: var(--muted); font-size: .76rem; font-weight: 650; }
.invitation-details dd { min-width: 0; margin: 0; color: var(--text); font-size: .9rem; line-height: 1.45; overflow-wrap: anywhere; }
.invitation-details code { display: block; margin-top: .2rem; color: var(--muted); font-size: .76rem; overflow-wrap: anywhere; }
.invitation-feedback { min-height: 1.35rem; color: var(--green) !important; overflow-wrap: anywhere; }
.invitation-feedback.error { color: var(--red) !important; }
.invitation-feedback:empty { display: none; }
.invitation-actions { margin-top: .25rem; }
@media (max-width: 500px) {
  .auth-panel { margin: 1rem .75rem; padding: min(1.25rem, 5vw); }
  .cursor-row, .reply-bar { align-items: stretch; flex-direction: column; }
  .invitation-details > div { grid-template-columns: 1fr; gap: .2rem; }
  .invitation-actions { flex-direction: column-reverse; align-items: stretch; }
}

/* Conversations stay navigable without replacing the composer during live updates. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.conversation-search { padding: .85rem 1rem; border-bottom: 1px solid var(--line-soft); }
.conversation-search label { display: block; margin-bottom: .45rem; font-size: var(--text-sm); }
.search-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.search-row input { min-width: 0; flex: 1 1 10rem; }
#search-mentions { width: auto; flex: 0 0 auto; }
#search-mentions[aria-pressed="true"] { color: var(--text); background: #212b38; }
.search-results { padding: .75rem 1rem; background: #101a29; border-bottom: 1px solid #344e72; }
.search-results p { margin-bottom: .5rem; color: var(--muted); font-size: var(--text-sm); }
.search-results ol { max-height: 18rem; overflow-y: auto; list-style: none; padding: 0; margin: 0; }
.search-results li + li { border-top: 1px solid var(--line); }
.search-results a { display: grid; gap: .4rem; padding: .8rem .5rem; font-size: var(--text-md); text-decoration: none; overflow-wrap: anywhere; }
.search-results a:hover { background: #1a2940; }
.search-results a span { color: var(--text); white-space: pre-wrap; }
.search-results a small { color: var(--muted); }
.thread-bar { display: flex; gap: 1rem; align-items: center; padding: .75rem 1rem; border-bottom: 1px solid #374463; background: #171c2a; }
.thread-bar > div { min-width: 0; }
.thread-bar h3 { margin: 0 0 .3rem; overflow-wrap: anywhere; }
.thread-bar p { margin: 0; color: var(--muted); font-size: var(--text-sm); }
.thread-bar button { flex-shrink: 0; }
.message-list { scroll-behavior: auto; overflow-anchor: none; }
.message:focus-visible, .message-list:focus-visible, .work-card:focus-visible, .presence-member:focus-visible, .event-list li:focus-visible, #room-title:focus-visible, #conversation-title:focus-visible, #thread-title:focus-visible, summary:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.message-time { margin-left: .2rem; text-decoration: none; }
.message-time time { color: var(--muted); }
/* Timestamp permalinks are standalone controls, not inline prose links. */
@media (pointer: coarse), (max-width: 500px) {
  .message-time { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding-inline: .2rem; }
}
.message-links { flex-wrap: wrap; gap: .3rem 1rem; }
.message-to-work, .thread-link { font-size: .875rem; }
.thread-link { padding: .4rem .65rem; border: 1px solid #374b68; border-radius: .45rem; background: #172335; color: #bcd5ff; }
.reply-preview { display: block; padding: .3rem 0; }
button:disabled { cursor: wait; opacity: .6; }
.new-messages-button { display: block; align-self: center; max-width: calc(100% - 2rem); margin: .35rem 1rem; padding: .45rem 1rem; border: 1px solid #66668b; border-radius: 99px; color: var(--text); background: #37374e; font-size: .8rem; }
.count-chip { padding-inline: .6rem; white-space: nowrap; }
@media (max-width: 500px) {
  /* One row: Back, the title and Mute, so a thread keeps room for its replies. */
  .thread-bar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .5rem; padding: .4rem .75rem; }
  .thread-bar h3 { margin: 0; font-size: var(--text-md); }
  .thread-bar p { font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .thread-bar button { min-height: 44px; padding-inline: .6rem; }
  .conversation-header { flex-wrap: wrap; }
}

/* One quiet return entry before conversation; deeper history is disclosed. */
.return-brief-panel { padding: 0; overflow: hidden; margin-bottom: 1rem; }
.return-brief-panel > summary { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; padding: .75rem 2.5rem .75rem 1rem; cursor: pointer; list-style: none; min-height: 44px; }
.return-brief-panel > summary::-webkit-details-marker { display: none; }
.return-brief-panel > summary::after { content: "▸"; position: absolute; right: .9rem; margin-top: .35rem; color: var(--muted); }
.return-brief-panel[open] > summary::after { content: "▾"; }
.return-brief-panel > summary { position: relative; font-size: var(--text-md); }
.catchup-signals { display: flex; flex-wrap: wrap; gap: .25rem 1rem; color: var(--muted); }
.catchup-signals, .catchup-signals small { font-size: var(--text-sm); font-weight: 400; }
.catchup-signals :empty { display: none; }
.return-brief-body { display: grid; gap: .9rem; padding: 0 .85rem .85rem; border-top: 1px solid var(--line-soft); }
.return-brief-body h3 { margin: .75rem 0 .5rem; font-size: var(--text-md); }
.return-brief-body details > summary { min-height: 44px; padding: .65rem 0; cursor: pointer; font-size: var(--text-sm); }
.rb-boundary { display: block; font-size: var(--text-xs); font-weight: 400; color: var(--muted); }
.rb-group-label { display: block; margin: .5rem 0 .15rem; font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.rb-group:first-child .rb-group-label { margin-top: 0; }
.rb-group-list { padding-left: .35rem; }
.rb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.rb-event { font-size: var(--text-sm); line-height: 1.5; overflow-wrap: anywhere; }
#rb-attention-list .rb-event { display: grid; gap: .15rem; padding-block: .35rem; }
.rb-event .work-link { color: var(--blue); font-size: .875rem; text-decoration: underline; text-underline-offset: .18em; }
#rb-attention-list .work-link { font-size: 1rem; padding-block: .3rem; min-height: 44px; display: flex; align-items: center; }
#rb-show-all { font-size: var(--text-sm); min-height: 44px; }
.rb-event-link { display: block; padding: .16rem; border-radius: .2rem; color: inherit; text-decoration: none; }
.rb-event-link:hover { background: #1a2940; }
.activity-item.unread .rb-event-link { border-left: 2px solid var(--accent, #7c6cf0); padding-left: .5rem; }
.rb-seq { color: var(--muted); font-variant-numeric: tabular-nums; }
.rb-type { color: var(--muted); }
.rb-actor { font-weight: 600; }
.rb-detail { color: var(--muted); }
.rb-empty { font-size: var(--text-sm); color: var(--muted); list-style: none; }
.rb-history { max-height: 16rem; overflow-y: auto; }
.rb-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.filter-row { display: flex; gap: .4rem; flex-wrap: wrap; margin: .4rem 0; }
.filter-row .button[aria-pressed="true"] { border-color: var(--accent, #7c6cf0); color: var(--text); }
.rb-note { margin: .45rem 0 0; font-size: var(--text-sm); color: var(--muted); }
.rb-note:empty { display: none; }

/* Narrow widths: the rail stacks and the brief reads as a full-width sheet/panel */
@media (max-width: 780px) {
  .return-brief-panel { border-radius: 14px; box-shadow: var(--shadow); }
  .return-brief-panel > summary { padding: .65rem 2rem .65rem .85rem; }
  .return-brief-body { padding: 0 1rem 1rem; }
  .rb-history { max-height: 45vh; }
}
.share-dialog { width: min(38rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow-y: auto; padding: 1.5rem; border-radius: 1rem; }
.share-dialog p, .share-dialog label, .share-dialog input, .share-dialog select { font-size: var(--text-md); line-height: 1.5; }
.share-dialog label { display: block; margin-block: .75rem .35rem; }
.share-dialog textarea { font-size: var(--text-md); overflow-wrap: anywhere; }
.share-dialog input, .share-dialog select { width: 100%; min-height: 2.75rem; }
.share-dialog .button { margin-block: .5rem; }
.share-dialog > .panel-header { padding: 0 0 .75rem; align-items: flex-start; flex-wrap: nowrap; }
.share-dialog > .panel-header h2 { min-width: 0; overflow-wrap: anywhere; line-height: 1.35; }
.share-dialog > .panel-header .button { flex-shrink: 0; margin: 0; }
.share-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.share-link-list { padding-left: 1.25rem; }
.share-link-list li { padding-block: .5rem; }
.share-dialog details { margin-block: .75rem; }
.share-dialog summary { cursor: pointer; min-height: 44px; padding-block: .65rem; font-size: var(--text-sm); color: var(--muted); }
.growth-kit { margin-block: .25rem 1rem; }
.growth-reward, .growth-inviter { margin: 0 0 .75rem; font-weight: 650; }
.growth-kit textarea, .growth-kit input { width: 100%; }
#share-settings-summary { display: block; padding-left: 1rem; font-size: .8rem; margin-top: .2rem; }
#share-link-form > .button { width: 100%; }
#share-management { border-top: 1px solid var(--line-soft); padding-top: .35rem; }
#share-link-status:empty, #share-management-status:empty { display: none; }
#share-link-url { font-family: inherit; }
@media (max-width: 480px) { .share-settings { grid-template-columns: 1fr; gap: 0; } }

/* Font-relative reflow: fixed viewport breakpoints alone miss enlarged text.
   em in a container query uses this container's computed font size. */
.app-shell { container: room-shell / inline-size; }
@container room-shell (max-width: 70em) {
  .topbar { position: static; flex-wrap: wrap; }
  .topbar-actions { min-width: 0; }
  .room-heading { flex-wrap: wrap; }
  .room-heading > *, .room-presence-summary { min-width: 0; max-width: 100%; }
  .room-presence-summary { white-space: normal; }
  .member-stack { flex-wrap: wrap; }
  .composer-toolbar, .composer-row, .message-links, .reply-bar, .cursor-row { flex-wrap: wrap; }
}
@container room-shell (max-width: 40em) {
  .topbar { flex-direction: column; align-items: stretch; }
  .new-work-form { margin: .5rem; padding: .5rem; }
  .work-checks { padding: .5rem; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .button { max-width: 100%; overflow-wrap: anywhere; }
  .composer-toolbar select { width: 100%; }
  .composer-toolbar .text-button { margin-left: 0; }
  .message { grid-template-columns: minmax(0, 1fr); }
  .message-avatar { display: none; }
  .work-facts > div { grid-template-columns: minmax(0, 1fr); }
}

/* Conversation first. These surfaces reveal detail without relocating controls. */


.topbar-actions { align-items: center; flex-direction: row; gap: .5rem; }
#identity-label { font-size: .8rem; color: var(--muted); }
.icon-button { display: inline-grid; place-items: center; min-width: 36px; min-height: 36px; width: 36px; height: 36px; align-self: center; padding: .4rem; border: 1px solid transparent; border-radius: .45rem; background: transparent; color: var(--muted); }
.icon-button svg { pointer-events: none; }
.icon-button:hover { color: var(--text); background: rgb(255 255 255 / 6%); }
@media (pointer: coarse) { .icon-button { min-width: 44px; min-height: 44px; width: 44px; height: 44px; } }
@media (pointer: coarse) { .button, .topbar-button, .people-actions .button, .search-row .button { min-height: 44px; } }
/* Front-door batch B-8 (#3744): the coarse-pointer floor is ONE token
   (--control-min-target-coarse, src/design-tokens.js), applied to the
   tappable elements the token rule did not already reach: plain links,
   text buttons, disclosure summaries, and footer legal links. */
@media (pointer: coarse) {
  .text-button, summary { min-height: var(--control-min-target-coarse); }
  .site-footer a, .signin-entry-routes a, #signin-methods a.button { display: inline-flex; align-items: center; min-height: var(--control-min-target-coarse); }
  .site-footer a { padding-inline: .3rem; }
}
/* QA2-A11Y (D-fo-3): form controls under 16px trigger iOS auto-zoom on focus.
   Coarse pointers get the 16px floor and the 44px touch target. Specific
   checkbox/radio sizes win by specificity where they are intentional. */
@media (pointer: coarse) {
  select, input, textarea { min-height: 44px; }
  .composer-toolbar select, .inbox-filters select, .inbox-quarantine-header select,
  .inbox-connection-form input, .inbox-connection-form select { font-size: var(--text-md); }
}
#conversation-title, #return-brief-panel { scroll-margin-top: 1rem; }
@media (max-width: 1020px) {
  #return-brief-panel, #conversation-title, #people-panel { scroll-margin-top: 3.5rem; }
}
.conversation-header { border: 0; padding-bottom: .25rem; }
.conversation-search { border: 0; }
.conversation-search input { border-color: transparent; background: var(--bg); }
.message-list { padding-inline: 1.25rem; }
.pinned-chip { border: 0; padding: 0; text-transform: none; font-size: var(--text-xs); }
.message-links { display: inline-flex; flex-wrap: wrap; gap: .75rem; vertical-align: top; }
.composer-toolbar { flex-wrap: wrap; }
.composer-toolbar select { width: auto; max-width: min(100%, 16rem); border-color: transparent; background: transparent; padding-left: 0; font-size: .875rem; }
.audience-note { color: var(--muted); font-size: .75rem; }
.composer-toolbar .text-button { margin-left: auto; font-size: .875rem; }
.cursor-row { border: 0; padding-top: 0; }
.presence-panel > summary, .work-details > summary { cursor: pointer; min-height: 44px; padding: .8rem 1rem; color: var(--muted); }
.work-card { border: 0; border-top: 1px solid var(--line-soft); padding: 1.25rem 0; background: transparent; }
.work-card:first-child { border-top: 0; }
.work-card h3 { margin-top: .65rem; }
/* UI calming #10: the duplicate .state rule lived here; consolidated above. */
.work-details { margin-top: .5rem; }
.work-drafts, .work-help { overflow-wrap: anywhere; }
.help-offers { list-style: none; margin: .5rem 0; padding: 0; }
.help-offer { padding: .75rem 0; border-top: 1px solid var(--line, #e5e5e5); }
.help-offer p { margin: .4rem 0; white-space: pre-wrap; }
.help-offer-heading { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.help-offer-heading strong { font-size: var(--text-sm); font-weight: 600; }
.help-offer-heading .form-hint { flex-shrink: 0; }
.offer-history > summary { cursor: pointer; padding: .5rem 0; font-size: .8125rem; }
.work-drafts > summary, .work-help > summary { min-height: 44px; padding: .5rem 0; font-size: .875rem; cursor: pointer; }
.work-drafts .source-link { display: block; min-height: 44px; padding: .4rem 0; }
.work-details > summary { padding: .5rem 0; font-size: .875rem; }
.work-details .mode, .work-details .source-link { display: block; margin: .5rem 0; }
.work-details .receipt { border-radius: .6rem; }
.work-actions:empty { display: none; }
.work-actions { margin-top: .25rem; }
.new-work-form { margin: 0; padding: 0; border: 0; background: transparent; }
.new-work-form h2 { margin-bottom: 1.25rem; }
.work-card h3, .work-card .definition { overflow-wrap: anywhere; white-space: pre-wrap; }
.work-link { overflow-wrap: anywhere; min-width: 0; }
@media (max-width: 40rem) {
  .work-facts > div, .receipt-attribution > div { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
}
#work-options { margin-block: .75rem; }
#work-options > summary { cursor: pointer; padding: .65rem 0; min-height: 44px; font-size: var(--text-sm); }
#work-options-summary { display: block; padding-block: .25rem; font-size: .8rem; color: var(--muted); }
#work-dialog .form-actions { margin-top: 1.25rem; }
.reviewer-unavailable { padding: .75rem; border: 1px solid var(--line); border-radius: .6rem; margin-bottom: .75rem; }
.reviewer-unavailable p { margin: 0 0 .5rem; font-size: var(--text-sm); line-height: 1.5; color: var(--muted); }
.work-checks { border-radius: .6rem; }
summary { overflow-wrap: anywhere; }
/* Large text and very narrow windows need document scrolling rather than a
   squeezed-to-zero timeline. Normal desktop/phone layouts stay viewport-fit. */
@container room-shell (max-width: 20em) {
  .app-shell > #main { flex: 1 0 auto; }
  .room-main { overflow: visible; min-height: 32rem; }
  .timeline { flex: 1 0 auto; min-height: 12rem; overflow: visible; }
}
/* Short windows retain bounded room scrolling so navigation cannot cover the composer. */
@container room-shell (max-width: 40em) {
  .topbar { flex-direction: row; align-items: center; gap: .5rem; }
  .brand div { display: none; }
  .brand-mark { width: 2rem; }
  .topbar-actions { justify-content: end; margin-left: auto; }
  #identity-label { flex-basis: auto; max-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .room-presence-summary { display: none; }
  .composer-toolbar .text-button { margin-left: 0; }
  .message { grid-template-columns: 1.75rem minmax(0, 1fr); gap: .5rem; }
  .message-avatar { display: grid; width: 1.75rem; height: 1.75rem; }
  .message-list { padding-inline: .75rem; }
  .work-checks { padding: .5rem; }
}
/* Private setup stays within narrow mobile dialogs; never show it by default. */
#agent-connect-dialog pre { white-space: pre-wrap; overflow-wrap: anywhere; }
#agent-connect-dialog textarea { max-width: 100%; overflow-wrap: anywhere; }
#agent-connect-dialog #agent-connect-done { position: sticky; bottom: 0; z-index: 1; width: 100%; margin-top: 0.75rem; background: var(--panel); box-shadow: var(--shadow); }
.agent-roster { display: flex; flex-wrap: wrap; gap: .45rem; margin: .45rem 0 .2rem; }
.agent-roster .button { width: auto; min-height: 44px; padding: 0 .7rem; }
.agent-type-catalog { margin: .45rem 0 .2rem; }
.agent-type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); gap: .45rem; }
.agent-type-card { display: flex; gap: .5rem; align-items: flex-start; width: 100%; margin: 0; padding: .55rem .6rem; min-height: 44px; text-align: left; border: 1px solid var(--room-rule); border-radius: .5rem; background: var(--room-paper); color: var(--room-ink); cursor: pointer; }
.agent-type-card:hover, .agent-type-card:focus-visible { border-color: var(--room-ink); }
.agent-type-icon { flex: 0 0 1.75rem; height: 1.75rem; font: 650 .7rem/1.75rem ui-monospace, SFMono-Regular, Menlo, monospace; text-align: center; border-radius: .35rem; background: color-mix(in srgb, var(--room-ink) 8%, var(--room-paper)); }
.agent-type-copy { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.agent-type-copy strong { font-size: .9rem; line-height: 1.25; }
.agent-type-copy span { font-size: var(--text-xs); line-height: 1.35; color: var(--room-quiet); }
.agent-type-chip { display: inline-block; margin-left: .35rem; padding: 0 .35rem; font-size: .7rem; line-height: 1.4; color: var(--room-quiet); border: 1px solid var(--room-rule); border-radius: .3rem; }
.agent-capabilities { margin: .2rem 0 .6rem; padding-left: 1.1rem; }
.agent-capabilities li { margin: .15rem 0; }
#agent-host-snippets pre { overflow-x: auto; font-size: .78rem; }
/* UI calming #5: the four advanced disclosures fold into one group; the
   nested ones stay collapsible so the dialog opens on name + type picker. */
.agent-advanced { margin: .75rem 0; border-top: 1px solid var(--line-soft); padding-top: .25rem; }
.agent-advanced > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--muted); font-weight: 600; }
.agent-advanced details { margin-top: .6rem; }
.pending-save { margin: 0 1rem 1rem; max-width: calc(100% - 2rem); }
#room-instructions-dialog { width: min(38rem, calc(100vw - 2rem)); box-sizing: border-box; }
#room-instructions-dialog p { overflow-wrap: anywhere; }
#room-instructions-view p, #room-instructions-comparison p { white-space: pre-wrap; font-size: var(--text-md); line-height: 1.5; }
#room-instructions-dialog h3 { margin: 1rem 0 .25rem; font-size: var(--text-md); }
#room-instructions-dialog label { display: grid; gap: .35rem; margin: .85rem 0; font-size: var(--text-md); }
#room-instructions-dialog textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: var(--text-md); resize: vertical; }
.instructions-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
#room-instructions-latest { border-left: 2px solid currentColor; padding-left: .75rem; margin: 1rem 0; }
.room-policy { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: .25rem; }
.room-policy-current { margin: .25rem 0; font-size: var(--text-md); line-height: 1.5; }

/* Inbox and Rooms share the shell; private source content stays in its own view. */
.workspace-nav { display: flex; gap: 1.25rem; padding: 0 1.25rem; border-bottom: 1px solid var(--line-soft); background: var(--panel); }
.workspace-nav button { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); padding: .65rem .2rem; font-size: .85rem; cursor: pointer; }
.workspace-nav button[aria-current="page"] { color: var(--text); border-bottom-color: currentColor; }
.inbox-panel { display: grid; grid-template-columns: minmax(14rem, 19rem) minmax(0, 1fr); min-height: 65vh; }
.inbox-sidebar { padding: 1.25rem 1rem; border-right: 1px solid var(--line); }
.inbox-sidebar header, .inbox-source-heading, .inbox-draft-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.inbox-sidebar h1 { font-size: 1.25rem; margin: 0; }
.inbox-connections { display: grid; gap: .5rem; margin: .75rem .75rem 0; }
.inbox-connection-card { display: grid; gap: .3rem; padding: .75rem; border: 1px solid var(--line); border-radius: .5rem; }
.inbox-connection-card h2 { margin: 0; font-size: var(--text-xs); font-weight: 550; letter-spacing: .02em; text-transform: uppercase; }
.inbox-connection-state { margin: 0; font-size: .8rem; text-transform: capitalize; }
.inbox-connection-facts { margin: 0; padding: 0; list-style: none; display: grid; gap: .15rem; font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.inbox-connection-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .25rem; }
.inbox-connection-note { font-size: .8rem; color: var(--muted); }
.inbox-filters { display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: center; margin: .25rem .75rem .5rem; font-size: .8rem; color: var(--muted); }
.inbox-filters label { display: inline-flex; align-items: center; gap: .35rem; min-height: 32px; }
.inbox-filters select { font: inherit; font-size: .8rem; max-width: 12rem; padding: .25rem .35rem; }
.inbox-filters input[type="checkbox"] { width: 1rem; height: 1rem; min-height: 1rem; margin: 0; }
.inbox-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.inbox-channel-badge, .inbox-needs-you { font-size: .7rem; letter-spacing: .02em; text-transform: uppercase; padding: .05rem .4rem; border-radius: .4rem; border: 1px solid var(--line); color: var(--muted); }
.inbox-needs-you { border-color: currentColor; color: var(--text); font-weight: 550; }
/* Held-message quarantine review. Same card language as the connections
   cards; the item keeps score, signals, and the three review actions
   (Confirm / Dismiss / Split) together so the verdict is one tap. */
.inbox-quarantine { margin: .75rem .75rem 0; font-size: .85rem; }
.inbox-quarantine-header { display: flex; align-items: center; gap: .5rem; }
.inbox-quarantine-header h2 { margin: 0; }
.inbox-quarantine-header select { font: inherit; font-size: .8rem; padding: .2rem .3rem; }
#inbox-quarantine-count:empty { display: none; }
#inbox-quarantine-list { display: grid; gap: .6rem; margin-top: .5rem; }
.inbox-quarantine-item { border: 1px solid var(--line); border-radius: .5rem; padding: .6rem .7rem; display: grid; gap: .4rem; }
.inbox-quarantine-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .6rem; }
.inbox-quarantine-subject { font-weight: 600; }
.inbox-quarantine-signals { margin: 0; padding: 0; list-style: none; display: grid; gap: .25rem; font-size: .8rem; color: var(--muted); }
.inbox-quarantine-signals li { display: flex; gap: .4rem; align-items: baseline; }
.inbox-quarantine-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.inbox-quarantine-note { width: 100%; box-sizing: border-box; font: inherit; font-size: var(--text-sm); padding: .4rem .5rem; border: 1px solid var(--line-control); border-radius: .4rem; }
.inbox-quarantine-warning { font-size: .8rem; color: var(--warn, #a35b00); }
.inbox-quarantine-coverage { margin-bottom: .75rem; border: 1px solid var(--line); border-radius: .5rem; padding: .6rem .7rem; display: grid; gap: .4rem; }
.inbox-quarantine-coverage p { margin: 0; }
#inbox-quarantine-coverage-summary:empty { display: none; }
.inbox-quarantine-coverage-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.inbox-quarantine-coverage-table th, .inbox-quarantine-coverage-table td { text-align: left; padding: .25rem .4rem; border-top: 1px solid var(--line); }
.inbox-quarantine-coverage-table thead th { color: var(--muted); font-weight: 600; border-top: 0; }
.inbox-quarantine-coverage-table[hidden] { display: none; }
#inbox-attention-count:empty { display: none; }
#inbox-attention-count { font-size: .8rem; color: var(--muted); }
.inbox-add-connection { margin: .75rem .75rem 0; font-size: .85rem; }
.inbox-add-connection summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.inbox-connection-form { display: grid; gap: .4rem; padding: .5rem 0; }
.inbox-connection-form label { font-weight: 550; font-size: .8rem; }
.inbox-connection-form input, .inbox-connection-form select { width: 100%; box-sizing: border-box; font: inherit; font-size: .9rem; padding: .45rem .55rem; }
.inbox-connection-form div[data-channel] { display: grid; gap: .4rem; }
.inbox-connection-form .form-hint { margin: 0; font-weight: 400; }
.inbox-group { display: grid; gap: .1rem; }
.inbox-group-label { margin: .75rem .75rem .25rem; font-size: var(--text-xs); font-weight: 550; letter-spacing: .02em; text-transform: uppercase; }
.inbox-row { display: grid; gap: .4rem; width: 100%; padding: 1rem .75rem; border: 0; border-radius: .5rem; background: none; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.inbox-row span { font-size: .8rem; color: var(--muted); }
.inbox-row strong { font-weight: 550; }
#account-rooms-list .inbox-row { grid-template-columns: minmax(0, 1fr) auto; align-items: center; min-height: 44px; }
#account-rooms-list .inbox-row span { font-size: .9rem; min-height: 44px; display: inline-flex; align-items: center; }
#agent-import-checklist { min-width: 0; overflow-wrap: anywhere; margin: 0 0 1rem; padding-left: 1.25rem; display: grid; gap: .45rem; }
#agent-import-checklist code { display: block; margin-top: .25rem; overflow-wrap: anywhere; }
.inbox-row[aria-current="true"] { background: rgba(128, 160, 160, .12); }
.inbox-row:hover { background: rgba(128, 160, 160, .08); }
.inbox-reader { padding: clamp(1.2rem, 4vw, 3rem); max-height: calc(100vh - 12rem); overflow-y: auto; }
.inbox-reader > * { max-width: 46rem; margin-left: auto; margin-right: auto; }
.inbox-source-heading { align-items: flex-start; }
.inbox-source-heading h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); line-height: 1.2; margin: .55rem 0 .75rem; }
.inbox-source-body { margin-top: 2rem; margin-bottom: 2.5rem; line-height: 1.65; }
.inbox-source-body p { white-space: pre-wrap; }
.inbox-reader, .inbox-row, .inbox-share-dialog { overflow-wrap: anywhere; }
.inbox-draft-form { display: grid; gap: .8rem; }
.inbox-draft-form label { font-weight: 550; }
.inbox-draft-form textarea { width: 100%; box-sizing: border-box; font: inherit; line-height: 1.5; padding: 1rem; resize: vertical; }
.inbox-draft-actions { flex-wrap: wrap; justify-content: flex-end; }
.inbox-draft-actions [role="status"] { margin-right: auto; color: var(--muted); font-size: .85rem; }
/* UI calming #4: the reply-review / send / conflict steps share one visible
   "Review & send" region. Each step keeps its own gating; the region shows
   only while at least one step is visible (see syncInboxReviewRegion). */
.inbox-review-region { margin-top: 1.25rem; border-top: 1px solid var(--line-soft); padding-top: .6rem; }
.inbox-review-heading { margin: 0 0 .35rem; font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.inbox-review-region .inbox-send-panel { margin-top: .25rem; }
.inbox-review-region .inbox-conflict { margin-top: .75rem; }
.inbox-conflict { border-left: 2px solid currentColor; padding-left: 1rem; margin-top: 2rem; }
.inbox-conflict h3 { font-size: var(--text-md); }
.inbox-conflict pre { white-space: pre-wrap; font: inherit; }
.inbox-conflict > div { display: flex; flex-wrap: wrap; gap: .5rem; }
.inbox-results { margin-bottom: 2rem; }
.inbox-results h3 { font-size: .9rem; color: var(--muted); }
.inbox-result-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .6rem 0; }
.inbox-result-row > span { color: var(--muted); font-size: .85rem; flex: 1; }
#inbox-result-dialog pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.6; }
#inbox-result-dialog details { margin: 1rem 0; }
#inbox-origin:empty { display: none; }
.inbox-send-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 1rem; }
.inbox-send-panel > p { flex: 1; margin: 0; }
.inbox-send-panel > div { margin-left: auto; }
.inbox-send-panel p:empty { display: none; }
#inbox-send-body, #inbox-reply-body { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.6; }
#inbox-reply-local-body, #inbox-reply-original-body { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.6; }
#inbox-reply-dialog.comparing { width: min(58rem, calc(100vw - 2rem)); }
.inbox-reply-versions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
.inbox-reply-versions h3 { margin: 0; font-size: .85rem; color: var(--muted); }
#inbox-reply-local-state { font-weight: 400; }
#inbox-reply-original { margin: 1rem 0; color: var(--muted); }
#inbox-reply-original pre { color: var(--text); }
@media (min-width: 700px) {
  .comparing .inbox-reply-versions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .comparing #inbox-reply-local { border-left: 1px solid var(--line-soft); padding-left: 1.5rem; }
}
.inbox-reply-addresses { display: grid; gap: .4rem; font-size: .85rem; }
.inbox-reply-addresses > div { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); gap: .6rem; }
.inbox-reply-addresses dt { color: var(--muted); }
.inbox-reply-addresses dd { margin: 0; }
#inbox-reply-subject { font-size: 1.05rem; margin-top: 1.4rem; }
#inbox-send-subject { font-size: var(--text-md); }
.inbox-share-dialog { width: min(38rem, calc(100vw - 2rem)); box-sizing: border-box; max-height: 90vh; overflow: auto; }
#inbox-share-paragraphs label { display: flex; align-items: flex-start; gap: .75rem; padding: 1rem 0; line-height: 1.5; }
#inbox-share-paragraphs input { flex: 0 0 auto; width: 1.1rem; height: 1.1rem; min-height: 1.1rem; margin-top: .3rem; }
#inbox-share-paragraphs span { white-space: pre-wrap; }
.inbox-back { display: none; }
.room-heading-actions { display: flex; align-items: center; gap: .75rem; flex-shrink: 0; }
.work-views { display: flex; align-items: center; gap: .75rem; }
.work-views h2 { margin: 0; font: inherit; }
.work-views button { background: none; border: 0; padding: .35rem 0; min-height: 44px; font: inherit; color: var(--muted); cursor: pointer; }
.work-views button[aria-pressed="true"] { color: var(--text); font-weight: 700; }
.result-row { padding: 1rem 0; border-top: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.result-row:first-child { border-top: 0; }
.result-row > button, .result-row > a { display: block; min-height: 44px; padding: .4rem 0; background: none; border: 0; color: var(--text); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.result-row p { margin: .25rem 0 .5rem; color: var(--muted); font-size: var(--text-sm); }
.result-row .result-meta { display: flex; align-items: center; gap: .75rem; font-size: var(--text-xs); color: var(--muted); }
#room-actions-open { white-space: nowrap; min-height: 44px; }
#room-actions-open kbd { margin-left: .4rem; color: var(--muted); font: inherit; font-size: var(--text-xs); }
#room-actions-dialog { width: min(30rem, calc(100vw - 1.5rem)); padding: 1rem; }
#room-actions-dialog .panel-header { margin-bottom: .75rem; }
#room-actions-dialog h2 { font-size: var(--text-md); }
#room-actions-query { width: 100%; box-sizing: border-box; }
#room-actions-list { display: grid; gap: .15rem; margin-top: .5rem; }
#room-actions-list button { border: 0; border-radius: .4rem; padding: .65rem .75rem; min-height: 44px; background: transparent; color: var(--text); text-align: left; font: inherit; cursor: pointer; }
#room-actions-list button:hover, #room-actions-list button:focus-visible { background: var(--panel-hover); }
@media (pointer: coarse) { #room-actions-open kbd { display: none; } }
@container room-shell (max-width: 40em) {
  .room-heading > div:first-child { display: contents; }
  .room-heading h1 { grid-column: 1 / -1; }
  .room-heading .room-about { grid-column: 1; align-self: center; }
  .room-heading-actions { grid-column: 2; grid-row: 2; }
}
.app-shell:has(#inbox-panel:not([hidden])) .connection-bar,
.app-shell:has(#inbox-panel:not([hidden])) #invite-people-button,
.app-shell:has(#inbox-panel:not([hidden])) #refresh-button { display: none; }
.app-shell:has(#inbox-panel:not([hidden])) .workspace-nav {
  position: sticky; top: 0; z-index: 3; background: var(--bg);
}
#inbox-share-paragraphs label { color: var(--text); font-weight: 400; letter-spacing: normal; }
#inbox-share-audience { max-height: 8rem; overflow-y: auto; }
#inbox-excerpt-text { box-sizing: border-box; }
#inbox-excerpt-preview { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 16rem; overflow: auto; font: inherit; }
@media (max-width: 720px) {
  .inbox-panel { grid-template-columns: minmax(0, 1fr); }
  .inbox-sidebar { border-right: 0; }
  .inbox-panel:not(.reading) .inbox-reader, .inbox-panel.reading .inbox-sidebar { display: none; }
  .inbox-reader { max-height: none; padding: 1.25rem; }
  .inbox-panel.reading .inbox-back { display: block; margin: 1rem 1.25rem 0; text-align: left; }
  .inbox-source-heading { flex-wrap: wrap; }
}
.message-tombstone, .message-muted { color: var(--muted); font-style: italic; }
.message.muted .message-avatar { opacity: .5; }
.mute-toggle { margin-top: .35rem; }
.work-changes-list { margin: 0.35rem 0 0.55rem; padding: 0.45rem 0.7rem; border-left: 3px solid var(--accent, #4a6fa5); background: var(--panel, rgba(127,127,127,0.06)); border-radius: 0 6px 6px 0; }
.work-changes-list ul { margin: 0; padding-left: 1.1rem; }
.work-changes-list li { margin: 0.15rem 0; }
.result-diff { margin: 0.4rem 0 0; padding: 0.5rem 0.7rem; border: 1px solid var(--border, rgba(127,127,127,0.35)); border-radius: 6px; overflow-x: auto; font-size: 0.9em; }
.result-diff span { display: block; white-space: pre-wrap; }
.result-diff .diff-added { color: var(--green); background: rgb(79 208 155 / 12%); }
.result-diff .diff-removed { color: var(--red); background: rgb(255 123 123 / 12%); text-decoration: line-through; }

/* Issue #6 A2: room lifecycle (create, archive, leave) */
#account-rooms-list .inbox-row small.inbox-row-kind { grid-column: 1; font-size: var(--text-xs); color: var(--muted); }
#account-rooms-list .inbox-row > span { grid-column: 2; grid-row: 1 / span 2; }
#account-rooms-list .inbox-row[data-room-archived="true"] strong { color: var(--muted); }
.account-room-create { margin: .75rem 0 0; font-size: .9rem; }
.account-room-create summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.account-room-form { display: grid; gap: .5rem; margin-top: .5rem; }
.account-room-form label { font-size: .8rem; color: var(--muted); }
.account-room-form input, .account-room-form textarea, .account-room-form select { width: 100%; box-sizing: border-box; font: inherit; padding: .5rem; }
.account-room-form .check { display: flex; align-items: center; gap: .5rem; min-height: 44px; }
.account-room-form input[type="checkbox"] { width: 20px; min-width: 20px; padding: 0; }
.account-room-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
/* UI calming #10: the duplicate .room-kind-badge rule lived here; consolidated above. */
.room-archived-note { margin: .5rem 0 0; padding: .4rem .75rem; border-left: 2px solid currentColor; color: var(--muted); font-size: var(--text-sm); max-width: 46rem; }
.room-archived #message-form { opacity: .6; }
.room-lifecycle-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }

/* C2: read-only access preview inside a work card's details. */
.access-preview { margin: .6rem 0 .2rem; padding: .6rem .8rem; border-left: 3px solid var(--blue, #75a7ff); background: var(--panel, rgba(127,127,127,0.06)); border-radius: 0 6px 6px 0; }
.access-preview h4 { margin: 0; font-size: .8rem; color: var(--text); }
.access-preview .work-facts { margin: .5rem 0 0; }
.access-preview .work-facts > div { grid-template-columns: 7rem 1fr; }
.access-preview .source-link { display: inline; }
/* Typed handoff envelopes (RC-2026-09-19-072): lifecycle badges, the
   status trail, and the seven-section card rendered in the work view. */
.handoff-envelopes { margin-top: .9rem; padding: .85rem; border: 1px solid #4a3f2e; background: #201a10; }
.handoff-envelopes > h4 { margin: 0 0 .6rem; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: #e8cf9a; }
.handoff-envelope-list { display: grid; gap: .7rem; }
.handoff-envelope { padding: .75rem; border: 1px solid var(--line); background: #151d2a; }
.handoff-envelope-header { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
/* UI calming #10: badge tones map to the four semantic accents. */
.handoff-badge { padding: .2rem .5rem; border: 1px solid #3c526f; border-radius: 999px; background: #172335; color: var(--blue); font-size: .65rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.handoff-badge-warn { border-color: #855a35; background: #2d2015; color: var(--amber); }
.handoff-badge-info { border-color: #2f5a85; background: #14202e; color: var(--blue); }
.handoff-badge-done { border-color: #2e795e; background: #112b23; color: var(--green); }
.handoff-badge-alert { border-color: #85352f; background: #2e1414; color: var(--red); }
.handoff-badge-muted { border-color: #3c526f; background: #172335; color: #8a94a3; }
.handoff-route { font-size: var(--text-xs); color: var(--muted); }
.handoff-objective { margin: .6rem 0; font-size: .85rem; line-height: 1.5; overflow-wrap: anywhere; }
.handoff-trail { list-style: none; margin: .6rem 0; padding: 0; display: grid; gap: .3rem; }
.handoff-trail li { display: flex; align-items: baseline; gap: .5rem; font-size: var(--text-xs); }
.handoff-trail-meta { color: var(--muted); overflow-wrap: anywhere; }
.handoff-details { margin-top: .6rem; }
.handoff-section { margin-top: .6rem; }
.handoff-section > h5 { margin: 0 0 .35rem; font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; color: #9fb3c8; }
.handoff-inputs, .handoff-checks { margin: .3rem 0; padding-left: 1.1rem; font-size: .78rem; line-height: 1.6; overflow-wrap: anywhere; }
.handoff-inputs li, .handoff-checks li { margin-bottom: .25rem; }
.handoff-chip { display: inline-block; padding: .1rem .4rem; border: 1px solid var(--line); border-radius: .35rem; background: #0f1622; font-size: .68rem; color: #c9d4e2; }
.handoff-note { margin: .25rem 0 0; color: var(--muted); font-size: .72rem; line-height: 1.5; overflow-wrap: anywhere; }
.handoff-pass { color: var(--green); font-size: .68rem; font-weight: 800; }

/* F5: read-only usage summary card */
.usage-panel { box-shadow: none; }
.usage-grid { display: grid; gap: .55rem; padding: .6rem 1rem 0; font-size: var(--text-sm); }
.usage-grid:empty { padding: 0; }
.usage-heading { margin: .3rem 0 0; color: var(--room-quiet); font-size: .62rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.usage-heading:first-child { margin-top: 0; }
.usage-grid dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .35rem .9rem; margin: 0; }
.usage-grid dt { color: var(--muted); overflow-wrap: anywhere; }
.usage-grid dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.usage-grid dd small { display: block; color: var(--muted); font-size: var(--text-xs); }
.usage-actions { padding: .5rem 1rem 0; }
.record-actions { display: grid; gap: .35rem; justify-items: start; padding: .5rem 1rem 0; }
.record-actions[hidden] { display: none; }
.usage-actions:has(> [hidden]) { padding: 0; }

/* B4 notification feed: compact rows inside catch-up; the badge reuses .catchup-signals. */
.notification-list .rb-event-link { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .1rem .6rem; align-items: baseline; }
.notification-list .rb-actor { font-weight: 600; }
.notification-list .rb-detail { grid-column: 1; }
.notification-list time { grid-column: 2; grid-row: 1 / 3; white-space: nowrap; font-size: .8rem; }

/* Issue #6 C3: room spend allowance card. */
.spend-panel .form-hint { margin: 0 1rem .6rem; }
.spend-allowance-form { display: grid; gap: .5rem; margin: 0 1rem .6rem; }
.spend-allowance-form label { display: grid; gap: .25rem; font-size: .8rem; color: var(--muted); }
.spend-allowance-form input { min-height: 40px; padding: .35rem .6rem; border: 1px solid var(--line-control); border-radius: .6rem; background: var(--panel); color: inherit; font: inherit; }
.spend-allowance-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.spend-panel[data-spend-allowance="over"] #spend-summary, .spend-panel[data-spend-allowance="full"] #spend-summary { color: var(--warning, #d9a441); }

/* Issue #6 B2: pinned messages (chip styling consolidated above with .pinned-chip). */
.pinned-panel { margin: 0 1rem .25rem; padding: 0 .75rem; border: 1px solid var(--line-soft); border-radius: .75rem; background: rgb(255 255 255 / 2%); }
.pinned-panel > .section-summary { min-height: 40px; }
.pinned-list { list-style: none; margin: 0; padding: 0 0 .6rem; display: grid; gap: .5rem; max-height: min(30dvh, 16rem); overflow-y: auto; overscroll-behavior: contain; }
.pinned-item { display: grid; grid-template-columns: 1fr auto; gap: .1rem .75rem; padding: .5rem .6rem; border: 1px solid var(--line-soft); border-radius: .6rem; }
.pinned-item .pinned-link { grid-column: 1; font-size: .78rem; }
.pinned-item .pinned-body { grid-column: 1; margin: 0; color: #dfe5ed; font-size: .9rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.pinned-item .pinned-meta { grid-column: 1; color: var(--muted); font-size: .7rem; }
.pinned-item .text-button { grid-column: 2; grid-row: 1 / span 3; align-self: start; min-height: 44px; font-size: var(--text-sm); }
@media (max-width: 40rem) { .pinned-panel { margin-inline: .75rem; } }
.auth-divider { display: flex; align-items: center; gap: .6rem; margin: .9rem 0; color: var(--muted); font-size: .72rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
#google-signin { display: block; text-align: center; text-decoration: none; margin-bottom: .2rem; font-size: 1.05rem; padding: .95rem 1.15rem; }
#email-auth-panel { margin-top: .75rem; }
#email-auth-panel form { display: grid; gap: .75rem; }
.invite-help, .access-help { margin-top: .8rem; }
.invite-help { opacity: .82; }
.invite-help summary, .access-help summary { cursor: pointer; color: var(--muted); font-size: .8rem; }
#auth-room-hint, #auth-kind-hint { margin: 0 0 1rem; }

/* Sign-in: connecting an agent is one of the two things you can do from this
   screen, so it is separated from the sign-in choices rather than trailing off
   the bottom of them. The prompt shows in full - a reader who cannot see what
   they are about to paste into their agent has no reason to trust it, and the
   clipboard fallback needs visible text to select. */

/* Room orientation reuses existing content rather than another work model. */
.room-overview-open { width: 100%; text-align: left; margin: 0; }
#room-overview-dialog { width: min(42rem, calc(100% - 2rem)); }
#room-overview-purpose { white-space: pre-wrap; overflow-wrap: anywhere; }
.room-overview-content section + section { border-top: 1px solid var(--line); margin-top: 1.4rem; padding-top: 1rem; }
.room-overview-content h3 { margin: 0 0 .7rem; }
.room-overview-content ul { list-style: none; margin: 0; padding: 0; }
.room-overview-content li { margin: 0 0 1rem; overflow-wrap: anywhere; }
.room-overview-content p { margin: .3rem 0; }

/* DM consent (consent-bound DMs, PR #731): per-member Direct messages
   disclosure and the incoming-request inbox in the People panel. */
.dm-consent summary { cursor: pointer; color: var(--muted); font-size: .8rem; }
.dm-consent-body p { margin: .3rem 0; font-size: .82rem; color: var(--muted); }
.dm-consent-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: .35rem 0 .15rem; }
.dm-consent-actions .text-button { min-height: 24px; font-size: .75rem; }
.dm-consent-note { font-size: .75rem; color: var(--room-quiet); }
.dm-requests { margin-bottom: .5rem; }
.dm-requests ul { list-style: none; margin: 0; padding: 0; }
.dm-request { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--line); }
.dm-request-reason { margin: .15rem 0 0; font-size: .78rem; color: var(--muted); overflow-wrap: anywhere; }
.friend-bond { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .2rem .45rem; }
.friend-bond:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.friend-chip { font-size: var(--text-xs); font-weight: 700; color: var(--muted); }
.friend-chip[data-friend-state="active"] { color: var(--room-green); }
.friend-dm-list { list-style: none; margin: .5rem 0 1rem; padding: 0; display: grid; gap: .75rem; max-height: min(16rem, 40dvh); overflow: auto; }
.friend-dm-meta { display: block; font-size: .75rem; color: var(--muted); }
/* Chat-bubble rows: the peer's messages sit left, mine sit right on an accent
   tint so a mobile reader can tell them apart at a glance. The .mine class
   existed in the markup with no styling — own and peer messages looked
   identical. Measured text contrast, both themes: 6.1:1 dark, 8.3:1 light. */
.friend-dm-message { justify-self: start; max-width: 88%; padding: .45rem .7rem; border: 1px solid var(--line-soft); border-radius: .75rem; background: var(--panel); }
.friend-dm-message.mine { justify-self: end; border-color: transparent; background: var(--blue-strong); color: var(--on-accent); }
.friend-dm-message.mine .friend-dm-meta { color: var(--on-accent); opacity: .8; }
.friend-dm-message p { margin: .15rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.friend-dm-empty { color: var(--muted); font-size: .85rem; }

.agent-invite-instructions { margin-top: 16px; }
#agent-invite-link { overflow-wrap: anywhere; }
.agent-invite-instructions pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 13px; }


.join-account-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
#join-account-choices { padding-bottom: .75rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line-soft); }

#join-account-google { display: inline-flex; margin: .75rem 0; }

/* Gmail-first inbox and resumable account setup. */
.inbox-gmail { display: grid; gap: .65rem; padding: 1rem 0; border-bottom: 1px solid var(--border, #ddd); }
.inbox-gmail > .button { justify-self: start; }
.inbox-gmail details { font-size: .85rem; }
.account-setup-dialog { width: min(32rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow: auto; padding: 1.5rem; border: 1px solid var(--border, #ddd); border-radius: 16px; }
.account-setup-dialog::backdrop { background: #0006; }
.account-setup-content { display: grid; gap: 1rem; margin: 1.5rem 0; }
.account-setup-content label { display: grid; gap: .4rem; }
.account-setup-content input:not([type=checkbox]), .account-setup-content select { width: 100%; min-height: 44px; }
.account-setup-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.setup-platforms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.setup-platforms label { display: flex; align-items: center; padding: .5rem; gap: .5rem; }
@media (max-width: 420px) { .setup-platforms { grid-template-columns: 1fr; } }

.setup-platforms input[type=checkbox] { width: 20px; height: 20px; min-height: 20px; margin: 0; flex: 0 0 20px; }

/* Gmail's provider-specific tools sit inside the private, unified inbox. */
#inbox-panel.gmail-active > :not(.gmail-workspace) { display: none; }
.gmail-workspace { grid-column: 1 / -1; width: 100%; min-width: 0; padding: 16px; }
.gmail-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.gmail-toolbar strong { flex: 1; overflow-wrap: anywhere; }
.gmail-toolbar label { display: flex; gap: 8px; align-items: center; }
.gmail-columns { display: grid; grid-template-columns: minmax(220px, 32%) minmax(0, 1fr); gap: 24px; }
.gmail-columns nav { max-height: 70vh; overflow: auto; }
.gmail-message { display: block; width: 100%; text-align: left; padding: 12px; border: 0; border-bottom: 1px solid var(--line, #ddd); background: transparent; }
.gmail-message strong, .gmail-message span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: normal; }
.gmail-message.unread strong { font-weight: 700; }
.gmail-columns article { min-width: 0; overflow-wrap: anywhere; }
.gmail-columns pre { font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.gmail-compose { width: min(680px, calc(100vw - 24px)); max-height: 90vh; overflow: auto; padding: 24px; border: 1px solid #ccc; border-radius: 12px; }
.gmail-compose::backdrop { background: #0006; }
.gmail-compose label { display: grid; gap: 5px; margin: 12px 0; }
.gmail-compose input, .gmail-compose textarea { width: 100%; box-sizing: border-box; }
.gmail-compose footer { display: flex; flex-wrap: wrap; gap: 10px; position: sticky; bottom: -24px; padding: 12px 0; background: var(--panel); }
@media (max-width: 700px) { .gmail-compose textarea { max-height: 28vh; } .gmail-columns { grid-template-columns: 1fr; } .gmail-columns nav { max-height: 35vh; } .gmail-toolbar input { max-width: 180px; } }
.gmail-compose [data-rich] { min-height: 200px; max-height: 40vh; overflow: auto; padding: 12px; border: 1px solid var(--line-control); border-radius: 8px; white-space: pre-wrap; }
.gmail-html { white-space: normal !important; }
.gmail-html table { border-collapse: collapse; max-width: 100%; }
.gmail-html td, .gmail-html th { border: 1px solid var(--line); padding: 6px; }
.gmail-html blockquote { border-left: 3px solid var(--line); margin: 12px 0; padding-left: 12px; }
.gmail-compose [data-files-list] { padding-left: 20px; overflow-wrap: anywhere; }
.gmail-toolbar [data-mailbox] { max-width: min(320px, 75vw); }

/* Conversation layout: a quiet navigation column and one content header. */
.app-shell:has(#main:not([hidden])) > .topbar { display: none; }
#sidebar-workspace:empty, #sidebar-invite:empty { display: none; }
#sidebar-workspace .workspace-nav { margin: 0; padding: 0 0 .75rem; border: 0; border-bottom: 1px solid var(--line-soft); flex-direction: column; align-items: stretch; gap: .2rem; }
#sidebar-workspace .workspace-nav button { text-align: left; justify-content: flex-start; border-radius: .45rem; min-height: 44px; }
#sidebar-workspace .workspace-nav button[aria-current="page"] { background: var(--panel-raised); }
#room-sidebar { gap: .75rem; padding: 1rem .8rem; }
.sidebar-head { padding-inline: .3rem; }
#room-title { white-space: normal; overflow-wrap: anywhere; font-weight: 650; }
#sidebar-invite .button { width: 100%; background: transparent; border-color: var(--line); color: var(--text); text-align: left; }
.sidebar-tools { margin-top: auto; padding-top: .75rem; border-top: 1px solid var(--line-soft); }
.sidebar-tools .topbar-button { width: 100%; justify-content: space-between; color: var(--muted); }
.conversation-heading { min-width: 0; flex: 1; }
.conversation-title-row { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.conversation-heading h2 { margin: 0; overflow-wrap: anywhere; min-width: 0; }
#room-trust-toggle { flex: none; }
#room-trust-toggle[aria-pressed="false"] { border-color: var(--line); background: var(--panel-raised); }
#mobile-room-name { display: none; }
.room-topbar { gap: .5rem; }
.room-topbar .topbar-actions { flex-wrap: nowrap; flex: none; }
.session-menu { display: block; position: relative; }
#session-menu.empty { display: none; }
#session-menu-button { display: inline-grid; }
.session-menu-panel { display: none; position: absolute; right: 0; top: calc(100% + .4rem); z-index: 50; width: min(16rem, calc(100vw - 2rem)); padding: .5rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--panel-raised); box-shadow: var(--shadow); }
.session-menu.open .session-menu-panel { display: flex; flex-direction: column; gap: .25rem; }
.session-menu-panel .button { width: 100%; text-align: left; justify-content: flex-start; border-color: transparent; }
.session-menu-panel #identity-label { max-width: none; padding: .5rem; white-space: normal; overflow-wrap: anywhere; border-bottom: 1px solid var(--line); }
.connection-bar:has(#connection-status[data-state="connected"]):not(:focus-within) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.count-chip:empty { display: none; }
.field { display: grid; gap: .4rem; margin-bottom: 1rem; }
.field > span, #verifier-label { color: var(--muted); font-size: .85rem; font-weight: 600; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
#work-title-input { min-height: 0; }
#work-options-summary { display: flex; }
.button:not(.primary):not(.secondary):not(.ghost) { background: var(--panel-raised); border-color: var(--line); }
.mention { min-height: 0; line-height: inherit; }
.mention.agent { font-weight: 650; }
.presence-member { align-items: start; }
.presence-member > .member-avatar { align-self: start; margin-top: .1rem; }
.return-brief-panel > summary::after { content: none; }
.return-brief-panel .summary-grid { grid-template-columns: minmax(0, 1fr); }
.composer-add { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; width: auto; padding: .4rem .65rem; }
.composer-add-label { font-size: .75rem; font-weight: 600; white-space: nowrap; }
.message-links .thread-link { order: -1; }
.thread-link { font-weight: 600; }
@media (hover: hover) and (pointer: fine) {
  .message { position: relative; }
  .message-links:not(:has(> :not([data-message-action="reply"], .message-more))) {
    position: absolute; top: .15rem; right: .25rem; z-index: 6; gap: .15rem; min-height: 0;
    padding: .15rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--panel-raised); box-shadow: 0 4px 14px rgb(0 0 0 / 25%); opacity: 0;
  }
  .message:is(:hover, :focus-within) .message-links, .message-links:has(details[open]) { opacity: 1; }
  .message:has(.message-more[open]) { z-index: 40; }
  .message-links .message-to-work, .message-links .message-more > summary { min-height: 32px; }
  .message-links .message-to-work { padding: .25rem .5rem; }
  .message-links .message-to-work[data-message-action="reply"] { opacity: 0; }
  .message:is(:hover, :focus-within) .message-links .message-to-work[data-message-action="reply"] { opacity: 1; }
}
@media (max-width: 940px) {
  #mobile-room-name { display: block; font-size: .7rem; line-height: 1.3; color: var(--muted); overflow-wrap: anywhere; }
  .room-topbar { align-items: center; padding: .5rem .75rem; }
  .conversation-heading h2 { font-size: var(--text-md); }
}
@media (max-width: 520px) {
  .composer-row { flex-wrap: nowrap; }
  .composer-add { flex: none; width: 36px; padding: .3rem; }
  .composer-add-label { display: none; }
  .composer-row textarea { min-width: 0; }
}
/* Popovers anchor to the action row, not to a trigger shifted by a thread link. */
.message-links { position: relative; }
.composer-row { grid-template-columns: auto minmax(0, 1fr) 36px 44px; }
.sidebar-head { margin: 0; padding: 0; font-weight: 400; letter-spacing: normal; }
.sidebar-head .room-overview-open { display: flex; align-items: center; justify-content: space-between; gap: .5rem; width: 100%; min-width: 0; padding: .35rem; border: 0; border-radius: .4rem; background: transparent; color: var(--text); text-align: left; }
.sidebar-head .room-overview-open:hover { background: var(--panel-raised); }
.invite-navigation { border-top: 1px solid var(--line-soft); padding-top: .25rem; }
.invite-navigation > summary { display: flex; justify-content: space-between; align-items: center; min-height: 44px; padding-inline: .5rem; cursor: pointer; font-size: .85rem; color: var(--muted); list-style: none; }
.invite-navigation > summary::-webkit-details-marker { display: none; }
.invite-navigation[open] > summary { color: var(--text); }
.invite-navigation .button { width: 100%; min-height: 40px; border: 0; background: transparent; color: var(--text); text-align: left; justify-content: flex-start; padding: .5rem; }
.invite-navigation .button:hover { background: var(--panel-raised); }
.invite-navigation .people-actions { display: grid; gap: .15rem; }
.composer-row textarea { grid-column: 1 / -1; grid-row: 1; }
.composer-row .composer-add { grid-column: 1; grid-row: 2; justify-self: start; }
.composer-row #request-reply { grid-column: 2; grid-row: 2; }
.composer-attach { grid-column: 3; grid-row: 2; }
.composer-row > button[type="submit"] { grid-column: 4; grid-row: 2; min-height: 44px; min-width: 44px; }
@media (max-width: 520px) {
  .composer-row #request-reply { padding-inline: .35rem; font-size: .68rem; }
}
.sidebar-head .room-overview-open > span:last-child { flex: none; font-size: var(--text-md); font-weight: 400; color: var(--muted); }
@media (max-width: 520px) {
  /* Keep each action intact. Catch-up uses the remaining room; enlarged text
     reflows whole controls rather than squeezing More into stacked letters. */
  .room-topbar { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: .25rem .5rem; }
  .room-topbar .topbar-actions { position: relative; display: flex; flex-wrap: wrap; grid-column: 1 / -1; justify-content: flex-end; width: 100%; gap: .25rem; }
  .room-topbar .topbar-actions > * { flex: none; }
  .room-topbar .icon-button { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  .room-topbar .topbar-actions > .topbar-button, .room-topbar .room-more > summary { min-width: 44px; min-height: 44px; padding-inline: .2rem; white-space: nowrap; overflow-wrap: normal; }
  .room-topbar #topbar-updates { flex-basis: min-content; flex-wrap: wrap; justify-content: center; }
  .room-topbar #topbar-catchup { display: flex; flex: 1 1 4rem; flex-wrap: wrap; gap: .1rem .4rem; min-width: min-content; justify-content: center; }
  .room-topbar .count-chip { min-width: 0; font-size: .7rem; }
  #catchup-count { max-width: 100%; padding-inline: 0; white-space: normal; overflow-wrap: normal; text-align: center; border: 0; }
  /* A wrapped trigger may be on the left. Anchor its popover to the full row. */
  .room-topbar .room-more, .room-topbar .session-menu { position: static; }
  .room-topbar .session-menu-panel { min-width: 0; }
  .room-topbar .room-more-actions .topbar-button { white-space: normal; }
  /* Recovery text gets a full line before its controls. Limit this to an
     interrupted active room; signed-out, inbox and healthy bars stay as-is. */
  .app-shell:has(#main:not([hidden])) > .connection-bar:has(#connection-status[data-state="other"]) { padding: .25rem .75rem; }
  .app-shell:has(#main:not([hidden])) > .connection-bar:has(#connection-status[data-state="other"]) > #connection-status { flex: 1 0 100%; padding: .2rem 0; overflow-wrap: normal; }
  .app-shell:has(#main:not([hidden])) > .connection-bar:has(#connection-status[data-state="other"]) > #connection-details { flex: none; max-width: 100%; margin: 0; }
  .app-shell:has(#main:not([hidden])) > .connection-bar:has(#connection-status[data-state="other"]) > #connection-details > summary { min-width: 44px; min-height: 44px; white-space: nowrap; overflow-wrap: normal; }
  .app-shell:has(#main:not([hidden])) > .connection-bar:has(#connection-status[data-state="other"]) > #refresh-button { flex: none; min-width: min-content; min-height: 44px; max-width: 100%; white-space: normal; overflow-wrap: normal; }
}
@media (max-width: 520px) {
  .composer-row { display: flex; flex-wrap: wrap; }
  .composer-row textarea { order: -1; flex: 1 0 100%; width: 100%; }
  .composer-row > button[type="submit"] { flex: 0 0 44px; }
  .composer-add { width: auto; min-width: 0; max-width: 100%; height: auto; padding-inline: .4rem; }
  .composer-add-label { display: inline; white-space: normal; }
  .composer-row #request-reply { margin-left: auto; min-width: 0; max-width: 100%; white-space: normal; }
}
/* #1607: the composer send hint is a visible caption under the row, not just
   a title tooltip. Coarse pointers also get the 44px touch target on the
   composer "New work" button and the suggestion chips. */
.composer-hint { margin: .25rem 0 0; padding: 0 .25rem; }
@media (pointer: coarse) {
  .composer-add { width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: .3rem; }
  .suggestion-chip, .suggestion-dismiss { min-height: 44px; }
}
@media (hover: none) and (pointer: coarse) {
  .composer-hint { display: none; }
}
/* 320px at large text cannot fit New work, Request a reply, and Send on one
   line. New work takes the row above; the request wraps beside Send. */
@media (max-width: 340px) {
  .composer-row .composer-add { flex: 1 0 100%; }
  .composer-row #request-reply { flex: 1 1 auto; margin-left: 0; min-width: 0; max-width: calc(100% - 3.25rem); white-space: normal; overflow-wrap: anywhere; text-align: end; }
}
@media (max-width: 940px) {
  .app-shell:has(#main:not([hidden])) > #workspace-nav {
    order: 2; display: flex; justify-content: center; gap: .5rem; margin: 0;
    padding: .25rem .75rem max(.25rem, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line-soft); border-bottom: 0; background: var(--panel);
  }
  .app-shell:has(#main:not([hidden])) > #workspace-nav button { flex: 1; min-height: 44px; }
}
/* Account destinations retain bottom navigation outside a conversation. */
@media (max-width: 940px) {
  .app-shell:has(> #workspace-nav:not([hidden])) { padding-bottom: var(--workspace-nav-height, 3.5rem); }
  .app-shell > #workspace-nav, .app-shell:has(#inbox-panel:not([hidden])) > #workspace-nav {
    position: fixed; inset: auto 0 0; z-index: 30; display: flex; justify-content: center; gap: .5rem;
    margin: 0; padding: .25rem .75rem max(.25rem, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line-soft); border-bottom: 0; background: var(--panel);
  }
  .app-shell > #workspace-nav button { flex: 1; min-height: 44px; }
}

/* Keep contextual controls within the conversation rather than above its header. */
#session-menu-panel #connection-details { margin: 0; padding: .4rem .6rem; }
#session-menu-panel #connection-details > summary { min-height: 32px; font-size: var(--text-sm); }

/* Large text must reflow on the signed-out screen with platform font metrics. */
.app-shell > .topbar { flex-wrap: wrap; }
.app-shell > .topbar .topbar-actions { min-width: 0; max-width: 100%; }
#refresh-button { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.connection-bar { flex-wrap: wrap; }
.auth-panel { min-width: 0; overflow-wrap: anywhere; }
.auth-panel > * { min-width: 0; max-width: 100%; }

/* A direct result visit omits unrelated administration without duplicating state. */


/* A recovery hint appears only when recorded worker progress needs attention. */
.work-recovery { border-left: 3px solid var(--muted); padding: .5rem .75rem; margin: .75rem 0; }
.work-recovery p { margin: .35rem 0; color: var(--muted); }

/* Guest upgrade hint: one-time inline nudge after first message. */
.guest-upgrade-hint {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: .5rem 0;
  padding: .6rem .8rem;
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: .5rem;
  font-size: .9rem;
}
.guest-upgrade-hint[hidden] { display: none; }
.guest-upgrade-hint p { margin: 0; flex: 1; }
.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--blue);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
}
/* QA-200 stranger-mobile (HD-04): back/"more" navigation links styled as
   .text-button/.link-button were ~11px tall with padding:0 and no coarse-pointer
   floor — untappable on phones. Intentional small inline contexts
   (.member-actions .text-button, .dm-consent-actions .text-button) keep their
   24px rules by higher specificity on fine pointers; the PRODUCT-200 BU-04
   follow-through floors them to 44px on coarse pointers (see block below).
   This block sits after the base .link-button
   rule on purpose: tests/audit2-guest-hint-contrast.test.js resolves
   ruleBody(".link-button") to the FIRST match, which must carry the color. */
@media (pointer: coarse) {
  .text-button { min-height: 44px; min-width: 44px; }
  .link-button { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
}

/* PRODUCT-200 BU-04 (2026-10-08): #2034 follow-through — the 44px coarse
   floor missed several board-UI tap targets:
   - .message-to-work buttons in .message-links carry only that class (not
     .text-button), so they rendered ~11px tall with padding:0 on touch; the
     .thread-link count button likewise. They are standalone row controls on
     touch (the hover-reveal sizing above is scoped to
     (hover:hover)/(pointer:fine)).
   - .member-actions .text-button and .dm-consent-actions .text-button kept
     24px by higher specificity — on a phone those are primary
     consent/member-management taps, so they get same-specificity coarse
     overrides AFTER the base rules (specificity ties win by source order).
   - details > summary disclosure toggles (people panel, session menu, room
     creation, inbox, DM consent, work-claim cards, message expander) sat at
     28-36px or bare text height.
   - label-row toggles (.also-send-toggle, .inbox-filters label) are the tap
     targets around intentionally-small checkboxes (QA2-A11Y keeps the boxes
     at 20px); the rows get the floor.
   Deliberately NOT floored: inline-in-sentence links (button.source-link,
   .form-hint a — WCAG-exempt inline links) and raw checkbox/radio inputs. */
@media (pointer: coarse) {
  .message-links .message-to-work, .message-links .thread-link {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px; min-width: 44px; padding: .25rem .6rem;
  }
  .member-actions .text-button, .dm-consent-actions .text-button {
    min-height: 44px; min-width: 44px;
  }
  #connection-details > summary,
  #session-menu-panel #connection-details > summary,
  .create-room-details summary, .member-profile-body summary,
  .member-directory-card > summary, .inbox-add-connection summary,
  .dm-consent summary, .claim summary, .work-more > summary,
  .message-expansion > summary { min-height: 44px; }
  .inbox-filters label, .also-send-toggle { min-height: 44px; }
}

/* Agent sign-in self-serve creation + first-run orientation (2026-09-24) */
.agent-secret-row { display: flex; gap: .5rem; align-items: center; }
.agent-secret-row input { flex: 1; font-family: ui-monospace, monospace; font-size: .8rem; }
.agent-room-list { display: flex; flex-direction: column; gap: .5rem; margin: .5rem 0; }
.agent-first-run {
  border: 1px solid var(--line);
  border-radius: .75rem;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  background: var(--panel, #fff);
}
.agent-first-run h2 { margin: 0 0 .5rem; font-size: 1.1rem; }
.agent-first-run-lede { margin: 0 0 .75rem; color: var(--muted); }
.agent-first-run-steps { margin: 0 0 .75rem; padding-left: 1.25rem; display: grid; gap: .5rem; }
.agent-first-run-steps button { font: inherit; cursor: pointer; background: none; border: none; padding: 0; color: var(--blue); text-decoration: underline; text-align: left; }
.agent-first-run-steps span { display: block; color: var(--muted); font-size: .85rem; }
.agent-first-run-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.agent-first-run-hint { font-size: .85rem; color: var(--muted); }
.agent-first-run-dismiss { font: inherit; cursor: pointer; }


/* Email/password entry and focused recovery screens. */
.app-shell:has(#auth-panel:not([hidden])) .topbar .brand { visibility: hidden; }
.app-shell:has(#auth-panel:not([hidden])):has(#connection-status[data-state="signed-out"]) > .topbar:has(#session-menu.empty) { display: none; }
.auth-panel #auth-title { font-family: inherit; font-size: clamp(1.5rem, 5vw, 1.9rem); font-weight: 600; letter-spacing: -.01em; }
.signin-methods { display: grid; gap: .75rem; }
.signin-methods .button { width: 100%; justify-content: center; min-height: 48px; font-size: var(--text-md); line-height: 1.4; padding: .75rem 1rem; margin: 0; }
.signin-methods #google-signin { font-size: var(--text-md); padding: .75rem 1rem; margin: 0; }
#email-auth-step #email-auth-panel { margin-top: 0; }
[data-signin-back] { display: inline-flex; align-items: center; gap: .35rem; min-width: 44px; min-height: 44px; margin: 0 0 .5rem; padding: .6rem 0; box-sizing: border-box; }
#auth-panel > .invite-help { margin-top: 1.25rem; }

.auth-panel .auth-email-title { display: flex; align-items: center; min-height: 44px; margin: 0 0 0 3.25rem; font-size: 1.15rem; }

/* Secondary chat actions are disclosed without hiding active audience or errors. */
.composer-row { grid-template-columns: minmax(0, 1fr) 44px; }
.composer-row > button[type="submit"] { grid-column: 2; }
.composer-options { position: relative; grid-column: 1; grid-row: 2; justify-self: start; }
.composer-options > summary { display: flex; align-items: center; min-height: 44px; padding: .35rem .6rem; cursor: pointer; color: var(--muted); font-size: .85rem; }
.composer-options-panel { position: absolute; bottom: calc(100% + .5rem); left: 0; z-index: 25; width: min(18rem, calc(100vw - 4rem)); padding: .4rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--panel); box-shadow: 0 .4rem 1.5rem #0005; }
.composer-options-panel > button { display: flex; align-items: center; justify-content: flex-start; gap: .5rem; width: 100%; min-height: 44px; height: auto; padding: .6rem; font-size: .85rem; text-align: left; }
.composer-options-panel > button[hidden] { display: none; }
.composer-options-panel .composer-add-label { display: inline; font-size: inherit; }
.composer-options-panel #request-reply { min-height: 44px; padding: .6rem; font-size: .85rem; max-width: 100%; text-align: left; white-space: normal; }
@media (max-width: 520px) {
  .composer-options { margin-right: auto; }
}
/* Chat suggestions: one-tap replies and a task nudge above the composer. */
.chat-suggestions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; padding: .25rem 1.25rem 0; background: var(--bg); }
.chat-suggestions[hidden] { display: none; }
.suggestion-chip { min-height: 2.25rem; padding: .35rem .8rem; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-raised); color: inherit; font: inherit; font-size: .8rem; cursor: pointer; }
.suggestion-chip:hover, .suggestion-chip:focus-visible { border-color: var(--violet); }
.suggestion-task { color: var(--violet); }
.suggestion-dismiss { min-width: 2.25rem; min-height: 2.25rem; border: 0; background: none; color: var(--muted); font-size: var(--text-md); cursor: pointer; }

/* Chat-first navigation: one native disclosure, ordinary keyboardable buttons. */
.room-more { position: relative; }
.room-more > summary { list-style: none; min-height: 44px; }
.room-more > summary::-webkit-details-marker { display: none; }
.room-more > summary::after { content: "⌄"; color: var(--muted); }
.room-more-actions { position: absolute; top: calc(100% + .25rem); right: 0; z-index: 50; width: min(16rem, calc(100vw - 2rem)); padding: .4rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--panel-raised); box-shadow: var(--shadow); }
.room-more:not([open]) > .room-more-actions { display: none; }
.room-more-actions .topbar-button { display: flex; width: 100%; min-height: 44px; justify-content: space-between; text-align: left; }
#room-permissions, #advanced-room-tools { margin-block: .75rem; }
#room-permissions > summary, #advanced-room-tools > summary { min-height: 44px; cursor: pointer; padding-block: .65rem; }

/* Visible entry routes, each opening a focused sign-in flow. */
.signin-entry-routes { display: grid; gap: .5rem; margin-top: 1.25rem; }
.signin-entry-routes #agent-signin-button { justify-self: start; min-height: 44px; font-size: var(--text-sm); color: var(--muted); text-decoration: none; }

#auth-signin-ui form { display: grid; gap: .75rem; }
#auth-signin-ui [data-signin-panel] { display: grid; gap: .75rem; }
#auth-signin-ui [data-signin-form="password"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
[data-signin-form="password"] > label, [data-signin-form="password"] > button[type="submit"] { grid-column: 1 / -1; }

/* Recovery uses one primary action with a quieter alternative below. */
#auth-panel #auth-error:empty, #auth-panel #auth-link-error:empty { display: none; }
#auth-signin-ui [data-signin-panel] { grid-template-columns: minmax(0, 1fr); margin-top: 0; }
#auth-signin-ui [data-recovery-option] { width: 100%; min-height: 44px; margin: 0; }
#auth-signin-ui [data-recovery-option="reset"].primary { font-size: var(--text-md); padding: .75rem 1rem; }
#auth-signin-ui [data-signin-form="reset-request"] button.primary { font-size: var(--text-md); padding: .75rem 1rem; }
#auth-signin-ui [data-recovery-option="magic"] { font-size: .9rem; justify-self: center; }

#owner-results-list { overflow-wrap: anywhere; }

/* Account and room settings share one section pattern. */
.settings-group { margin: 0 0 var(--space-4); padding-bottom: var(--space-2); border-bottom: 1px solid var(--line-soft); }
.settings-group-title, .settings-section > h3 { margin: 0 0 var(--space-2); font-size: var(--text-xs); font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.settings-section { display: grid; gap: var(--space-3); margin: 0 0 var(--space-4); padding: var(--space-4); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: var(--panel); }
.settings-section h3 { margin: 0; }
.settings-empty { margin: 0; color: var(--muted); line-height: 1.5; }
.settings-appearance { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin: 0; padding: 0; border: 0; }
.settings-appearance legend { width: 100%; padding: 0; color: var(--muted); font-size: var(--text-sm); font-weight: 650; }
.settings-appearance label { display: flex; align-items: center; gap: var(--space-2); min-height: 44px; }
.settings-appearance input { width: 1.15rem; height: 1.15rem; min-height: 0; margin: 0; padding: 0; flex: none; accent-color: var(--blue); }
.settings-methods { margin: 0; padding: 0; list-style: none; }
.settings-method { display: grid; gap: var(--space-1); padding: var(--space-3) 0; border-top: 1px solid var(--line-soft); }
.settings-method-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.settings-disabled { color: var(--amber); font-size: var(--text-sm); font-weight: 650; }
.settings-form { display: grid; gap: var(--space-3); }
.settings-identity { margin: 0; padding-left: 1.1rem; }
#settings-dialog details > summary { min-height: 44px; cursor: pointer; }
/* Not a scroll anchor: on a phone the inbox scrolls the document, and anchoring
   to this footer sends a restored reading position to the bottom. */
.site-footer { margin: 2rem 1rem 1rem; color: var(--muted); font-size: var(--text-sm); overflow-anchor: none; }
.site-footer a { color: inherit; }
body:has(#main:not([hidden])) .site-footer { display: none; }

/* Updates destination. Styles live here so the page content policy allows them. */
#updates-dialog { width: min(40rem, calc(100vw - 1.5rem)); max-height: min(36rem, calc(100vh - 2rem)); }
.updates-filters { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .75rem; }
.updates-filters button[aria-selected="true"] { background: var(--text); color: var(--bg); }
.updates-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.updates-row { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: center; justify-content: space-between; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: .55rem; }
.updates-copy { min-width: 0; flex: 1 1 12rem; }
.updates-copy p { margin: .2rem 0 0; overflow-wrap: anywhere; }
.updates-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
#updates-status { min-height: 1.2rem; }
@media (max-width: 420px) {
  .updates-row { align-items: stretch; }
  .updates-actions { width: 100%; }
  .updates-actions button { flex: 1 1 auto; }
}

/* Revoked memberships remain inspectable separately from active agents. */
.removed-agents { margin-top: .75rem; color: var(--muted); }
.removed-agents > summary { min-height: 44px; padding: .65rem 0; font-size: var(--text-sm); cursor: pointer; }

/* Availability is readable without relying on presence-dot colors. */
.presence-unknown { background: var(--muted); }
.member-availability { display: block; color: var(--muted); font-size: var(--text-xs); }
.member-observation, .member-pause-explanation, .presence-check-note { color: var(--muted); font-size: var(--text-sm); overflow-wrap: anywhere; }
.presence-refresh { margin-bottom: .75rem; }
.presence-check-note { display: block; }
.member-owned-by { overflow-wrap: anywhere; }

#room-actions-list section { display: grid; gap: .15rem; }
#room-actions-list h3 { color: var(--muted); font-size: var(--text-sm); margin: .75rem .75rem .25rem; }
#room-actions-status:empty { display: none; }

#room-actions-list [data-room-task] { overflow-wrap: anywhere; }
#room-actions-list [data-room-task] span, #room-actions-list [data-room-task] small { display: block; }
#room-actions-list [data-room-task] small { color: var(--muted); font-size: var(--text-xs); }

/* Signup guidance belongs to the complete credential row. */
[data-signin-form="password"] > .form-hint { grid-column: 1 / -1; margin: 0; }

/* The entrance offers two choices; explanation and agent entry live in More. */
@font-face { font-family: RoomWordmark; src: url("/og/fonts/Inter-Regular.woff2") format("woff2"), url("/og/fonts/Inter-Regular.ttf") format("truetype"); font-display: swap; }
#auth-panel.auth-panel { width: min(100% - 3rem, 25rem); max-width: 25rem; margin: clamp(5rem, 18vh, 12rem) auto 3rem; padding: 0; border: 0; background: transparent; box-shadow: none; }
.auth-panel #auth-title { font-family: RoomWordmark, var(--font-sans); font-size: var(--text-wordmark); font-weight: 400; letter-spacing: -.07em; line-height: 1.1; text-align: center; margin-bottom: 2.75rem; white-space: normal; }
.signin-welcome { display: grid; gap: .75rem; }
.signin-welcome .button { border-radius: .75rem; }
.signin-more { text-align: center; }
.signin-more > summary { cursor: pointer; color: var(--muted); font-size: var(--text-sm); min-height: 44px; padding: .8rem; list-style: none; }
.signin-more > summary::after { content: " +"; }
.signin-more[open] > summary::after { content: " −"; }
.signin-more > summary::-webkit-details-marker { display: none; }
.signin-more > a, .signin-more > button { display: block; margin: .25rem auto; min-height: 44px; padding: .6rem; font-size: var(--text-sm); }
#signin-entry-routes { margin-top: .6rem; }
#signin-entry-routes #agent-signin-button { justify-self: center; color: var(--muted); text-decoration: none; font-weight: 400; }
#signin-entry-routes #join-code-link { justify-self: center; display: inline-flex; align-items: center; min-height: 44px; font-size: var(--text-sm); text-decoration: none; }
[data-signin-form="password"] > .signin-more, #signup-password-hint { grid-column: 1 / -1; }
#terms-notice { margin: .5rem 0 0; font-size: var(--text-xs); text-align: center; }
@media (max-width: 520px) { #auth-panel.auth-panel { margin-top: 22vh; } }

.app-shell:has(#auth-panel:not([hidden])) ~ .site-footer { display: none; }
body:has(#auth-panel:not([hidden])) .site-footer { display: none; }

.join-agent { margin: 1.25rem 0 0; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: .85rem; background: var(--panel-raised); }
.join-agent h2 { margin: 0 0 .35rem; font-size: var(--text-md); }
.join-agent textarea { margin: .5rem 0 .6rem; overflow-wrap: anywhere; }
.join-agent .connect-steps { margin: .5rem 0 0; padding-left: 1.25rem; color: var(--muted); font-size: var(--text-sm); }
.join-agent .connect-steps li { margin: .35rem 0; }
.join-agent .connect-steps strong { color: var(--text); }

.inline-result { min-width: 0; margin-block: var(--space-3); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--panel); }
.inline-result h2 { margin-block: 0 var(--space-2); font-size: var(--text-lg); }
.inline-result .portable-actions { flex-wrap: wrap; }

#account-rooms-panel { max-width: 40rem; margin: 1.5rem auto; }
#account-rooms-search { width: 100%; }
#account-rooms-filter-status:empty, #account-rooms-status:empty { display: none; }
#account-rooms-panel #owner-cockpit { margin-top: 1.5rem; }
body:has(#account-rooms-panel:not([hidden])) .site-footer { display: none; }
@media (max-width: 700px) { #account-rooms-panel { margin: 1rem .75rem; } }

#account-rooms-panel > p > .button { display: inline-flex; align-items: center; min-height: 44px; font-size: var(--text-sm); text-decoration: none; }
#account-rooms-panel > p:has(> .button) { margin: .75rem 0 .5rem; }
/* New room and Account are disclosures: give them a visible row and a +/- state,
   matching the sidebar's Add people +. The glyph is hidden from assistive tech
   (details already announces expanded/collapsed). */
#account-rooms-panel > details > summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; border-top: 1px solid var(--line); color: var(--text); font-size: var(--text-sm); font-weight: 600; list-style: none; cursor: pointer; }
#account-rooms-panel > details > summary::-webkit-details-marker { display: none; }
#account-rooms-panel > details > summary::after { content: "+" / ""; color: var(--muted); font-size: var(--text-md); font-weight: 400; }
#account-rooms-panel > details[open] > summary::after { content: "\2212" / ""; }
body:has(#account-rooms-panel:not([hidden])) #invite-people-button { display: none; }

#signin-methods:has(#google-signin[hidden]):has(#github-signin[hidden]) .signin-divider { display: none; }

/* Preview is part of the workspace, never a modal over the conversation. */
.result-header { display: flex; align-items: center; gap: var(--space-2); position: sticky; top: 0; background: var(--panel); padding-block: var(--space-2); z-index: 2; }
.result-header h2 { flex: 1; min-width: 0; margin: 0; font-size: var(--text-md); overflow-wrap: anywhere; }
.result-header #close-result { flex: 0 0 auto; min-width: 36px; min-height: 36px; padding: var(--space-1); }
#result-resize { position: absolute; left: -4px; top: 0; bottom: 0; width: 9px; cursor: col-resize; touch-action: none; z-index: 3; }
#result-resize:hover, #result-resize:focus-visible { background: var(--blue); outline-offset: -2px; }
.preview-resizing { cursor: col-resize; user-select: none; }
.inline-result .portable-actions .button { min-height: 32px; padding: var(--space-1) var(--space-2); background: transparent; border-color: transparent; }
@media (min-width: 1100px) {
  .community-shell:has(> .result-docked:not([hidden])) { grid-template-columns: 12rem minmax(0, 1fr) var(--result-width, 340px); }
  #main > .result-docked { position: relative; grid-column: 3; grid-row: 1; min-width: 0; min-height: 0; overflow: visible; margin: 0; padding: var(--space-3); border: 0; border-left: 1px solid var(--line); border-radius: 0; background: var(--panel); display: flex; flex-direction: column; }
  #main > .result-docked[hidden] { display: none; }
  #main > .result-docked #result-body { max-height: none; border: 0; padding: 0; min-height: 0; overflow: auto; flex: 1; }
  #main > .result-docked .portable-actions { flex-shrink: 0; }
}
@media (max-width: 1099px) {
  #main:has(> .result-mobile:not([hidden])) { display: block; }
  #main:has(> .result-mobile:not([hidden])) > :not(.result-mobile) { display: none; }
  #main > .result-mobile { margin: 0; height: 100%; overflow: auto; border: 0; border-radius: 0; }
  .result-mobile .result-header { flex-wrap: wrap; }
  .result-mobile #close-result { min-height: 44px; }
}

.result-options { position: relative; }
.result-options > summary { cursor: pointer; list-style: none; min-width: 36px; min-height: 36px; display: grid; place-items: center; }
.result-options > div { position: absolute; right: 0; top: 100%; z-index: 4; min-width: 9rem; padding: var(--space-1); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--panel-raised); box-shadow: var(--shadow); }
.result-options > div > button { display: block; width: 100%; text-align: left; }
.result-options > div > button[hidden] { display: none; }
@media (pointer: coarse) { .result-options > summary { min-width: 44px; min-height: 44px; } }

/* Forced colors (Windows High Contrast): the platform overrides token
   backgrounds and drops shadows, so restate control boundaries and the
   focus indicator in system colors or they vanish (audit b5 F3). */
@media (forced-colors: active) {
  select, input, textarea, .composer-row { border-color: ButtonText; }
  .composer-row:focus-within { border-color: Highlight; }
  select:focus, input:focus, textarea:focus, button:focus-visible, a:focus-visible, summary:focus-visible { border-color: Highlight; outline-color: Highlight; }
}
/* Icons grow with the reader's text size. At the default size these match
   the previous pixel sizes exactly. */
svg[width="20"][height="20"] { width: 1.25rem; height: 1.25rem; }
.composer-row { grid-template-columns: minmax(0, 1fr) max(44px, 2.75rem); }
.icon-button { width: max(36px, 2.25rem); height: max(36px, 2.25rem); min-width: max(36px, 2.25rem); min-height: max(36px, 2.25rem); }
.composer-row > button[type="submit"] { min-width: max(44px, 2.75rem); min-height: max(44px, 2.75rem); }
@media (pointer: coarse) { .icon-button { width: max(44px, 2.75rem); height: max(44px, 2.75rem); min-width: max(44px, 2.75rem); min-height: max(44px, 2.75rem); } }
@media (max-width: 520px) {
  .room-topbar { grid-template-columns: max(44px, 2.75rem) minmax(0, 1fr); }
  .room-topbar .icon-button { width: max(44px, 2.75rem); height: max(44px, 2.75rem); min-width: max(44px, 2.75rem); min-height: max(44px, 2.75rem); }
  .composer-row > button[type="submit"] { flex-basis: max(44px, 2.75rem); }
}
/* The phone menu drawer dims the room behind it. A tap on the dimmed area
   lands outside the sidebar, which the existing outside-click handler
   treats as close. */
@media (max-width: 940px) {
  .community-shell.sidebar-open::after { content: ""; position: fixed; inset: 0; z-index: 39; background: rgb(0 0 0 / 55%); }
}

/* Direct conversations use the existing channel navigation and composer. */
.direct-conversation .message-context > .audience-chip { display: none; }
#new-direct-dialog { width: min(100% - 2rem, 32rem); }
#new-direct-people { margin-top: var(--space-4); max-height: 50vh; overflow-y: auto; }
#new-direct-people .channel { min-height: 44px; width: 100%; text-align: left; }

/* Touch targets, last in the cascade. Earlier coarse-pointer rules for the
   suggestion chips and the sidebar rows lose to later base rules of equal
   specificity, so phones got 36-40px targets. Keep this block at the end.
   Inline message links keep their layout: the hit area grows with padding
   and an equal negative margin. */
@media (pointer: coarse) {
  .suggestion-chip, .suggestion-dismiss { min-height: var(--control-min-target-coarse); }
  .suggestion-dismiss { min-width: var(--control-min-target-coarse); }
  .channel, #sidebar-invite .button, #invite-people-button, #connect-agent-button { min-height: var(--control-min-target-coarse); }
  .work-link { display: inline-block; padding-block: 1rem; margin-block: -1rem; }
}
