:root {
  color-scheme: light dark;
  /* Brand: docs/brand/palette.json — Figma mNXj2rksJybTrDmOESZNDB saved styles, Codex-verified 2026-10-02 */
  --fg: #14213d; /* ink only — never a large fill */
  --bg: #eaeff9; /* RS-Prime-Gray */
  --surface: #f5f7fc;
  --card: #ffffff;
  --line: #d5dcea;
  --field-border: #7a8599;
  --ink-2: #5c677a;
  --accent: #7f54ff; /* RS-Prime-Purple */
  --accent-hover: #6a40f5;
  --accent-ink: #ffffff;
  --accent-text: #6a40f5;
  --brand-2: #af71ff; /* RS-Prime-LiPurple */
  --brand-3: #ffac47; /* RS-Prime-Orange */
  --selection: #f2eeff;
  --warn: #8a4b00;
  --bad: #a12626;
  --ok: #14663a;
  --focus: #6a40f5;
  --banner-bg: #fff1de;
  --banner-fg: #5c3b00;
  --banner-line: #ffac47;
  --promo-bg: #eaeff9;
  --promo-ink: #14213d;
  --promo-muted: #5c677a;
  --bubble-in: #f1f3f8;
  --bubble-out: #EFEAFF;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --type-title: 28px;
  --type-headline: 17px;
  --type-body: 15px;
  --type-secondary: 13px;
  --type-caption: 11px;
  --row-min: 64px;
  --row-max: 76px;
  --notice-max: 40px;
  --radius: 8px;
  --radius-lg: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e8ecf8;
    --bg: #151925;
    --surface: #151925;
    --card: #191e2b;
    --line: #343c52;
    --field-border: #8b9aab;
    --ink-2: #9aa3b5;
    --accent: #7f54ff;
    --accent-hover: #6a40f5;
    --accent-ink: #ffffff;
    --accent-text: #af71ff;
    --brand-2: #af71ff;
    --brand-3: #ffac47;
    --selection: #2f2a5a;
    --warn: #ffcf85;
    --bad: #ff9c9c;
    --ok: #87e0b0;
    --focus: #ffac47;
    --banner-bg: #2a2110;
    --banner-fg: #ffcf85;
    --banner-line: #ffac47;
    --promo-bg: #151925;
    --promo-ink: #e8ecf8;
    --promo-muted: #9aa3b5;
    --bubble-in: #232838;
    --bubble-out: #2f2a5a;
  }
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}
body {
  min-height: 100vh;
  min-height: 100dvh;
  font: var(--type-body)/1.4 var(--font);
  font-weight: 400;
  color: var(--fg);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.banner {
  flex-shrink: 0;
  max-height: var(--notice-max);
  overflow: hidden;
  padding: 4px 16px;
  font-size: var(--type-secondary);
  line-height: 1.35;
  background: var(--banner-bg);
  color: var(--banner-fg);
  border-bottom: 1px solid var(--banner-line);
}
.status-live {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
main {
  flex: 1;
  min-height: 0;
  max-width: 640px;
  margin: 24px auto;
  padding: 0 16px 48px;
  overflow: auto;
}
main:has([data-auth-shell]),
main:has([data-workspace-shell]) {
  max-width: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ——— Workspace app frame ——— */
.workspace-app {
  display: flex;
  flex: 1;
  min-height: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
}
.workspace-rail {
  width: 72px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px 14px;
  background: var(--surface);
  color: var(--fg);
  border-right: 1px solid var(--line);
}
.workspace-mark {
  padding: 4px 0 16px;
  font-size: 22px;
  line-height: 1;
  letter-spacing: -0.08em;
  font-weight: 700;
  color: var(--fg);
  text-align: center;
}
.workspace-mark span { color: var(--ink-2); }
.rail-button {
  text-decoration: none;
  width: 48px;
  min-height: 48px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0;
  border: 0;
  border-radius: var(--radius);
  padding: 8px;
  background: transparent;
  color: var(--ink-2);
  font-size: var(--type-secondary);
  line-height: 1.3;
  font-weight: 600;
}
/* Compact glyph is visual-only; full .rail-label remains the accessible name. */
.rail-button .rail-short {
  display: inline-block;
  font-size: var(--type-secondary);
  font-weight: 700;
  color: inherit;
}
.rail-button .rail-short::before {
  content: attr(data-rail-glyph);
}
.rail-button .rail-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.rail-button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border-color: transparent;
  color: var(--fg);
}
.rail-button.active {
  background: var(--selection);
  color: var(--fg);
  box-shadow: inset 3px 0 var(--accent);
}
.rail-button:focus-visible { outline-color: var(--focus); }
.rail-bottom {
  margin-top: auto;
  padding: 8px 0 0;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0;
  text-align: center;
  line-height: 1.5;
  width: 100%;
}
.rail-channel {
  margin: 0;
  font-size: 0;
  height: 0;
  overflow: hidden;
  color: var(--ink-2);
  line-height: 1.4;
}
/* Compact icon rail at all desktop widths; accessible names stay on the controls. */
.workspace-application {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--card);
}
.workspace-topbar {
  flex-shrink: 0;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.workspace-inbox-card[data-inbox="open"] .inbox-folders {
  padding: 8px 6px;
}
.workspace-inbox-card[data-inbox="open"] .folder-button {
  min-height: 36px;
  padding: 6px 8px;
  font-size: var(--type-secondary);
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}
.workspace-topbar-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 12px;
}
.workspace-brand-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: var(--type-headline);
  font-weight: 700;
  letter-spacing: -0.3px;
}
.workspace-brand-line > span:not(.divider) {
  color: var(--ink-2);
  font-size: var(--type-secondary);
  font-weight: 400;
  letter-spacing: 0;
}
.workspace-brand-line .divider {
  height: 18px;
  width: 1px;
  background: var(--line);
}
.workspace-version {
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--type-caption);
  white-space: nowrap;
}
.workspace-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  container-type: inline-size;
  container-name: workspace-main;
}
.workspace-panel {
  min-width: 0;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.workspace-panel[hidden] { display: none !important; }
#workspace-account-panel { overflow: auto; }
#workspace-account-panel > .notice,
#workspace-account-panel > [data-step-up] {
  flex-shrink: 0;
  margin: 12px 16px 0;
}
.workspace-inbox-card {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--card);
}
.workspace-page-header {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.workspace-page-header .eyebrow { display: none; }
.workspace-page-header h1,
.workspace-page-header h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: var(--type-title);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0;
}
.workspace-page-header .subtitle {
  color: var(--ink-2);
  font-size: var(--type-secondary);
  line-height: 1.4;
  margin: 4px 0 0;
}
.workspace-inbox-card > .workspace-identity,
.workspace-inbox-card > [data-channel-status],
.workspace-inbox-card > [data-assign-hint],
.workspace-inbox-card > [data-session-ends],
.workspace-inbox-card > .muted,
.workspace-inbox-card > [role="status"],
.workspace-inbox-card > button,
.workspace-inbox-card > [data-inbox-body] {
  margin-left: 16px;
  margin-right: 16px;
}
.workspace-identity,
[data-assign-hint],
[data-session-ends],
.workspace-inbox-card > .muted:not([data-inbox-phase]) {
  font-size: var(--type-caption);
  color: var(--ink-2);
  margin: 4px 16px;
}
.workspace-inbox-card > [data-channel-status] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: -1px;
}
.workspace-inbox-card > [data-inbox-body],
.workspace-inbox-card > [data-inbox-skeleton-body] {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.workspace-inbox-card > [data-inbox-skeleton-body] > [data-inbox-workspace] {
  flex: 1 1 auto;
  min-height: 0;
}
/* Owner saved-reply manage must not starve timeline/composer (U2 + composer squeeze repair). */
.workspace-inbox-card[data-inbox="open"] > [data-inbox-body] {
  flex: 1 1 0;
  min-height: min(52vh, 420px);
}
.workspace-inbox-card[data-inbox="open"] > .saved-reply-manage {
  flex: 0 0 auto;
  min-height: 0;
}
.workspace-inbox-card[data-inbox="open"] > .saved-reply-manage:not([open]) {
  max-height: 48px;
  overflow: hidden;
}
.workspace-inbox-card[data-inbox="open"] > .saved-reply-manage[open] {
  max-height: min(42vh, 360px);
  overflow-x: hidden;
  overflow-y: auto;
}
/* Open inbox: keep workspace+composer in the viewport; panes scroll internally. */
.workspace-inbox-card[data-inbox="open"] {
  position: relative;
  overflow: hidden;
}
.workspace-inbox-card[data-inbox="open"] > .workspace-page-header,
.workspace-inbox-card[data-inbox="open"] > .workspace-identity,
.workspace-inbox-card[data-inbox="open"] > [data-channel-status],
.workspace-inbox-card[data-inbox="open"] > [data-assign-hint],
.workspace-inbox-card[data-inbox="open"] > [data-session-ends],
.workspace-inbox-card[data-inbox="open"] > [data-inbox-closed],
.workspace-inbox-card[data-inbox="open"] > [data-closed-open],
.workspace-inbox-card[data-inbox="open"] > [data-inbox-active] {
  display: none !important;
}
/* Before Open: keep the signed-in identity line visible; compress only the handoff hint. */
.workspace-inbox-card[data-inbox="closed"] > [data-assign-hint] {
  display: none !important;
}
.workspace-inbox-card[data-inbox="open"] > [data-inbox-phase] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.workspace-inbox-card[data-inbox="open"] > [data-inbox-refresh] {
  position: absolute;
  top: 4px;
  right: 16px;
  z-index: 2;
  margin: 0;
  min-height: 32px;
  padding: 4px 12px;
  font-size: var(--type-secondary);
}
.workspace-inbox-card[data-inbox="open"] .counts {
  padding: 0;
}
.inbox-empty-state,
.inbox-closed-state,
.thread-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 32px 24px;
  min-height: 200px;
  color: var(--ink-2);
}
.inbox-empty-state[hidden],
.inbox-closed-state[hidden],
.thread-empty-state[hidden],
[data-details-drawer][hidden],
[hidden] {
  display: none !important;
}
.inbox-empty-state h2,
.inbox-closed-state h2,
.thread-empty-state h2 {
  margin: 0;
  font-size: var(--type-headline);
  font-weight: 700;
  color: var(--fg);
}
.inbox-empty-state p,
.inbox-closed-state p,
.thread-empty-state p {
  margin: 0;
  max-width: 36ch;
  font-size: var(--type-secondary);
  line-height: 1.45;
}
[data-workspace-actions] { display: flex; justify-content: flex-end; margin: 0; flex-shrink: 0; }
[data-account-tools] {
  margin: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  padding: 14px 16px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}
h1 { font-size: var(--type-title); margin: 0 0 8px; font-weight: 700; }
h2 { font-size: var(--type-headline); margin: 0 0 8px; font-weight: 700; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 0 0 16px;
}
.muted { color: var(--ink-2); font-size: var(--type-secondary); }
label { display: block; font-weight: 600; margin: 12px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  width: 100%;
  padding: 10px 12px;
  min-height: 44px;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
}
.search-panel {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  margin: 0;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.search-panel > label {
  flex: 1 1 100%;
  margin: 0;
  font-size: var(--type-caption);
  color: var(--ink-2);
}
.search-panel > [data-search-q] {
  flex: 1 1 12rem;
  min-width: 0;
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
}
.search-panel > [data-search-state],
.search-panel > [data-search-assignee] {
  flex: 0 1 9rem;
  min-width: 0;
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
}
.search-panel > [data-search-submit],
.search-panel > [data-search-clear],
.search-panel > [data-search-more] {
  flex: 0 0 auto;
  margin: 0;
}
.search-panel > [data-search-results] {
  flex: 1 1 100%;
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 0;
  max-width: 100%;
  max-height: min(36vh, 240px);
  overflow-x: hidden;
  overflow-y: auto;
  border-top: 1px solid var(--line);
}
.search-panel > [data-search-results] li {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.search-panel > [data-search-results] .conversation-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  height: auto;
  max-height: none;
  min-height: var(--row-min);
}
textarea { min-height: 72px; resize: vertical; }
input[aria-invalid="true"] { border-color: var(--bad); }
button {
  font: inherit;
  padding: 10px 14px;
  margin: 8px 8px 0 0;
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  font-weight: 600;
}
button:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
button.secondary {
  background: transparent;
  color: var(--accent-text);
}
button.secondary:hover:not(:disabled),
button.secondary:focus-visible:not(:disabled) {
  background: var(--card);
  color: var(--accent-text);
  border-color: var(--accent-hover);
}
button.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
button.danger:hover:not(:disabled) { background: transparent; border-color: var(--bad); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
h1[tabindex="-1"]:focus,
h2[tabindex="-1"]:focus { outline: none; }
h1[tabindex="-1"]:focus-visible,
h2[tabindex="-1"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  z-index: 20;
  background: var(--card);
  color: var(--accent-text);
  border-radius: var(--radius);
}
.skip-link:focus,
.skip-link:focus-visible {
  width: auto;
  height: auto;
  min-height: 44px;
  min-width: 44px;
  margin: 0;
  padding: 8px 12px;
  clip: auto;
  left: 8px;
  top: 8px;
}
.notice { padding: 8px 10px; border-radius: 6px; margin: 0 0 12px; border: 1px solid var(--line); font-size: var(--type-secondary); }
.notice.error { color: var(--bad); border-color: var(--bad); }
.notice.ok { color: var(--ok); border-color: var(--ok); }
.notice.warn { color: var(--warn); border-color: var(--warn); }
.error-summary { color: var(--bad); margin: 0 0 12px; }
.error-summary a { color: inherit; }
ol.steps { padding-left: 20px; }
ol.steps li { margin: 4px 0; }
ol.steps li.done { text-decoration: line-through; opacity: 0.7; }
ol.steps li.now { font-weight: 700; }
code.key {
  display: block;
  padding: 10px;
  margin: 8px 0;
  font-size: 18px;
  letter-spacing: 1px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  word-break: break-all;
  user-select: all;
}
ul.codes { list-style: none; padding: 0; columns: 2; font-family: ui-monospace, Menlo, monospace; }
ul.codes li { padding: 3px 0; user-select: all; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.row:first-of-type { border-top: 0; }
ul.inbox-list { list-style: none; padding: 0; margin: 8px 0 0; }
ul.inbox-list li { padding: 6px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; white-space: pre-wrap; }
.counts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 8px 16px;
  margin: 0;
  list-style: none;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-size: var(--type-caption);
  font-weight: 400;
}
.counts li {
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: 400;
}
[data-inbox-workspace] {
  display: flex;
  flex-direction: row;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.inbox-folders {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  width: 148px;
  flex-shrink: 0;
  padding: 8px 6px;
  margin: 0;
  border-right: 1px solid var(--line);
  border-bottom: 0;
  background: var(--surface);
  overflow-x: hidden;
  overflow-y: auto;
}
/* Folder buttons carry visible counts; keep the list for status assertions without widening the rail. */
.inbox-folders .counts {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.folder-button {
  margin: 0;
  width: 100%;
  min-height: 36px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-2);
  font-size: var(--type-secondary);
  font-weight: 600;
  justify-content: flex-start;
  text-align: left;
}
.folder-button:hover:not(:disabled) {
  background: var(--surface);
  border-color: var(--line);
  color: var(--fg);
}
.folder-button.active,
.folder-button[aria-current="page"] {
  background: var(--selection);
  color: var(--fg);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}
.list-scope {
  margin: 0;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

/* Split panes — independent scroll */
[data-inbox-workspace] > [data-workspace-split] {
  flex: 1 1 auto;
  min-width: 0;
}
[data-contacts-split] {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  padding: 12px 16px 16px;
  min-width: 0;
}
[data-contacts] {
  min-width: 0;
  overflow: hidden;
}
[data-contacts-list-pane],
[data-contacts-list],
[data-contact-detail] {
  min-width: 0;
  overflow: auto;
}
[data-workspace-split] {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: var(--card);
  flex: 1 1 auto;
  min-height: calc(2 * var(--row-min) + 40px);
}
[data-list-pane],
[data-timeline-pane],
[data-detail-host] {
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
[data-timeline-pane] > .thread-chrome { order: 1; }
[data-timeline-pane] > .thread-body { order: 2; }
[data-timeline-pane] > [data-composer-dock] { order: 3; }
[data-timeline-pane] > [data-reply-compose],
[data-timeline-pane] > [data-note-compose] { order: 3; }
[data-timeline-pane] > [data-details-drawer] { order: 4; }
[data-conversation-list] {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 0;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: var(--card);
}
[data-timeline-pane] {
  border-top: 1px solid var(--line);
  background: var(--card);
  padding: 0;
  min-height: min(48vh, 360px);
}
[data-detail-host] {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 0;
}
.detail-pane {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
}
.detail-pane h2 {
  margin: 0 0 8px;
  font-size: var(--type-headline);
}
.composer-dock {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  background: var(--card);
  padding: 0;
  min-height: 0;
  overflow: visible;
  z-index: 2;
}
[data-timeline-pane] > [data-reply-compose],
[data-timeline-pane] > [data-note-compose] {
  flex: 0 0 auto;
  flex-shrink: 0;
  overflow: visible;
  z-index: 2;
}
.composer-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 8px 12px 10px;
  border: 0;
  border-radius: 0;
  background: var(--card);
  min-height: 0;
  overflow: visible;
  box-sizing: border-box;
}
.composer-panel > label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.composer-panel textarea {
  min-height: 44px;
  max-height: 52px;
  height: 52px;
  flex: 0 0 auto;
  resize: none;
}
.composer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.composer-actions button {
  margin: 0;
}
/* Release B: the note's library-file list and its note-only upload sit in the action row without taking it over. */
.composer-actions select {
  width: auto;
  flex: 1 1 180px;
  min-width: 0;
  max-width: 100%;
  min-height: 36px;
  padding: 6px 10px;
}
.note-file-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex: 1 1 100%;
  min-width: 0;
}
.note-file-upload label {
  margin: 0;
  font-size: var(--type-caption);
}
.note-file-upload input[type=file] {
  flex: 1 1 160px;
  min-width: 0;
  font-size: var(--type-caption);
}
.note-attachment {
  margin-top: 6px;
  font-size: var(--type-caption);
  overflow-wrap: anywhere;
}
/* The file staged on a note: one wrapping line with a compact Remove, never clipped by the chip row's height. */
.saved-reply-chips[data-note-attachment-slot] {
  max-height: none;
  overflow: visible;
}
[data-note-attachment-slot] .saved-reply-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: var(--type-caption);
  overflow-wrap: anywhere;
}
[data-note-attachment-slot] button {
  margin: 0;
  min-height: 32px;
  padding: 4px 10px;
}
.composer-panel [data-reply-status],
.composer-panel [data-note-status] {
  margin: 0;
  font-size: var(--type-caption);
  line-height: 1.35;
  overflow: visible;
  overflow-wrap: anywhere;
  white-space: normal;
  flex: 0 0 auto;
}
.thread-meta {
  flex-basis: 100%;
  margin: 0;
  font-size: var(--type-secondary);
  color: var(--ink-2);
}
@container workspace-main (min-width: 900px) {
  [data-workspace-split] {
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  }
  [data-list-pane] {
    border-right: 1px solid var(--line);
  }
  [data-timeline-pane] {
    border-top: 0;
  }
  [data-detail-host] {
    display: none;
  }
}
@container workspace-main (min-width: 1200px) {
  [data-workspace-split] {
    grid-template-columns: minmax(260px, 300px) minmax(0, 1fr) minmax(220px, 280px);
  }
  [data-detail-host] {
    display: flex;
    border-top: 0;
    border-left: 1px solid var(--line);
  }
  [data-timeline-pane] > [data-details-drawer] {
    display: none;
  }
  [data-details-toggle] {
    display: none;
  }
}
@media (max-width: 1199px) {
  [data-detail-host] {
    display: none;
  }
}

/* Compact selectable rows 64–76px */
.conversation-row {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(9.5rem, 1fr) max-content;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
  width: 100%;
  min-height: var(--row-min);
  max-height: var(--row-max);
  margin: 0;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--card);
  color: var(--fg);
  text-align: left;
  font: inherit;
  font-weight: 400;
  cursor: pointer;
  overflow: hidden;
}
.conversation-row:hover:not(:disabled) {
  background: var(--surface);
  border-color: var(--line);
}
.conversation-row[data-selected="1"],
.conversation-row[aria-current="true"] {
  background: var(--selection);
  box-shadow: inset 3px 0 var(--accent);
}
.conversation-row[data-unread="1"] [data-conversation-label] {
  font-weight: 600;
}
.conversation-row .chips [data-unread-chip] {
  color: var(--accent-text);
}
.conversation-row:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
  z-index: 1;
}
.conversation-avatar {
  grid-row: 1 / span 2;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--type-secondary);
  font-weight: 700;
  flex-shrink: 0;
}
.conversation-row [data-conversation-label] {
  grid-column: 2;
  margin: 0;
  min-width: 0;
  font-size: var(--type-body);
  font-weight: 600;
  line-height: 1.25;
  overflow: visible;
  white-space: nowrap;
}
.conversation-row [data-activity] {
  grid-column: 3;
  grid-row: 1;
  margin: 0;
  font-size: var(--type-caption);
  color: var(--ink-2);
  white-space: nowrap;
  justify-self: end;
}
.conversation-row [data-preview] {
  grid-column: 2 / span 2;
  margin: 0;
  font-size: var(--type-secondary);
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-row .chips {
  grid-column: 2 / span 2;
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
.conversation-row .chips > span {
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  font-size: var(--type-caption);
  font-weight: 600;
  background: transparent;
  color: var(--ink-2);
  white-space: nowrap;
}
.conversation-row .chips [data-state="WAITING"]::before,
.conversation-row .chips [data-state="SNOOZED"]::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--brand-3);
  margin-right: 4px;
  vertical-align: middle;
}
.conversation-row .chips [data-state="OPEN"] { color: var(--accent-text); }
.conversation-row .chips [data-state="WAITING"],
.conversation-row .chips [data-state="SNOOZED"] { color: var(--warn); }
.conversation-row .chips [data-state="CLOSED"] { color: var(--bad); }
.conversation-card[data-empty="1"] {
  padding: 24px 16px;
  border: 0;
  background: transparent;
  list-style: none;
}
li.conversation-item {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Thread chrome + details */
.thread-chrome {
  flex: 0 0 auto;
  flex-shrink: 0;
  overflow: visible;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.thread-chrome [data-selected-heading] {
  margin: 0;
  flex: 1 1 0;
  font-size: var(--type-headline);
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thread-chrome [data-details-toggle] {
  margin-left: auto;
  flex: 0 0 auto;
}
.thread-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  flex: 1 1 100%;
  overflow: visible;
}
.thread-actions button,
.thread-actions .assign-control {
  margin: 0;
  max-width: 100%;
  flex: 0 0 auto;
}
.thread-actions .assign-control {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.thread-actions .assign-control [data-assign-status]:empty {
  display: none;
}
.thread-actions select {
  min-height: 44px;
  width: 10rem;
  min-width: 10rem;
  max-width: min(12rem, 100%);
  flex: 0 0 auto;
}
.thread-actions [data-assign-submit] {
  flex: 0 0 auto;
}
.thread-caption {
  flex-basis: 100%;
  margin: 0;
  font-size: var(--type-caption);
  color: var(--ink-2);
}
[data-timeline-pane]:has([data-composer-mode]) .thread-chrome .thread-caption,
[data-timeline-pane]:has([data-composer-mode]) .thread-chrome .thread-meta {
  display: none;
}
[data-timeline-pane]:has([data-composer-mode]) .thread-body {
  min-height: 9.5rem;
}
.thread-body {
  flex: 1 1 auto;
  min-height: 9.5rem;
  overflow-y: auto;
  padding: 10px 12px;
}
.thread-body > [data-search-old-hit] {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 0 8px;
  overflow: visible;
}
.thread-back {
  display: none;
  margin: 0;
}
[data-details-drawer] {
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  padding: 10px 14px;
  background: var(--surface);
  max-height: 40%;
  overflow: auto;
}
[data-details-drawer][hidden] { display: none !important; }
[data-technical] { margin: 0; }
[data-technical] summary {
  cursor: pointer;
  font-weight: 600;
  font-size: var(--type-secondary);
  color: var(--ink-2);
  min-height: 44px;
  display: flex;
  align-items: center;
}
.meta { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin: 8px 0 0; }
.meta dt { margin: 0; font-size: var(--type-caption); font-weight: 600; color: var(--ink-2); }
.meta dd { margin: 0; font-size: var(--type-secondary); overflow-wrap: anywhere; }
.message-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.message-list li {
  padding: 8px 10px;
  margin: 0;
  border: 0;
  border-radius: var(--radius-lg);
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
  max-width: min(100%, 36rem);
}
[data-message-meta], [data-message-text] { display: block; unicode-bidi: isolate; }
[data-message-meta] { font-size: var(--type-caption); font-weight: 600; color: var(--ink-2); }
[data-message-text] { overflow-wrap: anywhere; word-break: break-word; margin-top: 4px; }
.message-inbound { background: var(--bubble-in); align-self: flex-start; }
.message-outbound { background: var(--bubble-out); align-self: flex-end; }
.message-note {
  background: var(--card);
  border: 1px dashed var(--line);
  align-self: stretch;
  max-width: 100%;
}
[data-reply-compose],
[data-note-compose] {
  flex-shrink: 0;
  border-top: 0;
  padding: 0;
  background: var(--card);
  margin: 0;
  border-radius: 0;
  box-shadow: none;
}
[data-composer-dock] > [data-reply-compose],
[data-composer-dock] > [data-note-compose] {
  overflow: visible;
}
.saved-reply-tools {
  position: relative;
  margin: 0;
  flex: 0 0 auto;
  overflow: visible;
}
.saved-reply-tools > summary {
  cursor: pointer;
  list-style: none;
  min-height: 32px;
  display: flex;
  align-items: center;
  font-size: var(--type-caption);
  font-weight: 600;
}
.saved-reply-tools > summary::-webkit-details-marker { display: none; }
.saved-reply-heading {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.saved-reply-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  overflow-x: auto;
  max-height: 36px;
}
.saved-reply-chip {
  max-width: 100%;
}
.saved-reply-manage {
  margin: 0 16px 8px;
  padding: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--card);
  flex: 0 0 auto;
  max-height: 48px;
  overflow: hidden;
}
.saved-reply-manage > summary {
  cursor: pointer;
  list-style: none;
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 8px 0;
  font-weight: 700;
  font-size: var(--type-headline);
}
.saved-reply-manage > summary::-webkit-details-marker { display: none; }
.saved-reply-manage[open] {
  padding: 0 0 12px;
  max-height: min(42vh, 360px);
  overflow-x: hidden;
  overflow-y: auto;
}
.saved-reply-manage:not([open]) {
  max-height: 48px;
  overflow: hidden;
}
/* Dedicated Saved replies view (/saved-replies): the library is the page, never clipped like the collapsed section. */
#workspace-saved-replies-panel { overflow: auto; }
.saved-replies-view { padding: 16px 16px 24px; }
.saved-reply-manage.saved-reply-settings,
.saved-reply-manage.saved-reply-settings:not([open]) {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  max-height: none;
  overflow: visible;
}
.saved-replies-view-title { margin: 0 0 8px; font-size: var(--type-headline); }
.saved-replies-view-title:focus { outline: none; }
.saved-reply-dropzone {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding: 8px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.saved-reply-dropzone p { margin: 0; }
.saved-reply-manage-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.saved-reply-manage-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.saved-reply-manage input[type="text"],
.saved-reply-manage textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0 0 8px;
  box-sizing: border-box;
}
@media (max-width: 839px) {
  .saved-reply-manage {
    margin: 0 12px 12px;
  }
  .saved-reply-manage-list li {
    flex-direction: column;
    align-items: stretch;
  }
}
[data-inbox-phase="loading"] { font-weight: 600; }
[data-inbox-phase="denied"] { color: var(--bad); font-weight: 600; }
.workspace-skeleton {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.workspace-skeleton span {
  display: block;
  height: 56px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--line) 70%, var(--card));
}

/* Mobile / tablet: list ↔ thread; folders stay outside the list pane */
@container workspace-main (max-width: 899px) {
  [data-inbox-workspace] {
    flex-direction: column;
  }
  .inbox-folders {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 30%;
  }
  .folder-button,
  .workspace-inbox-card[data-inbox="open"] .folder-button {
    width: auto;
  }
  [data-workspace-split][data-mobile-view="list"] [data-timeline-pane],
  [data-workspace-split][data-mobile-view="closed"] [data-timeline-pane] {
    display: none;
  }
  [data-workspace-split][data-mobile-view="thread"] [data-list-pane] {
    display: none;
  }
  .workspace-inbox-card[data-inbox="open"] > [data-inbox-body]:has([data-mobile-view="thread"]),
  [data-workspace-split][data-mobile-view="thread"] {
    /* A short landscape viewport must also be allowed to shrink the ancestors. */
    min-height: 0;
  }
  [data-workspace-split][data-mobile-view="thread"] [data-timeline-pane] {
    min-height: 0;
    max-height: 100%;
    /* Note files can make the dock taller than a phone viewport. Scroll the
       whole thread rather than clipping upload, saved replies or status. */
    overflow-y: auto;
  }
  [data-inbox-workspace]:has([data-mobile-view="thread"]) .inbox-folders {
    display: none;
  }
  [data-timeline-pane]:has([data-composer-mode]) .thread-body {
    min-height: max(72px, 16vh);
  }
  .composer-dock,
  [data-timeline-pane] > [data-reply-compose],
  [data-timeline-pane] > [data-note-compose] {
    overflow: visible;
  }
  .workspace-inbox-card[data-inbox="open"] > .saved-reply-manage:not([open]) {
    max-height: 40px;
    overflow: hidden;
  }
  .workspace-inbox-card[data-inbox="open"] > .saved-reply-manage[open] {
    max-height: min(40vh, 280px);
    overflow-x: hidden;
    overflow-y: auto;
  }
  .thread-back { display: inline-flex; }
}

/* Auth shell — pale-grey / white split, purple actions */
.auth-shell {
  display: grid;
  min-height: 100%;
  flex: 1;
  grid-template-columns: minmax(0, 1fr);
  background: var(--bg);
  overflow: auto;
}
.auth-promo {
  display: none;
  background: var(--promo-bg);
  color: var(--promo-ink);
  padding: 48px 40px;
  position: relative;
  overflow: hidden;
}
.auth-brand {
  margin: 0 0 28px;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.auth-promo-heading {
  margin: 0 0 16px;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.3;
  max-width: 22ch;
}
.auth-promo-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: 36ch;
  color: var(--promo-muted);
  font-size: 0.95rem;
}
.auth-promo-list li { margin: 0 0 10px; padding-left: 0; }
.auth-promo-art {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: min(220px, 42%);
  height: min(220px, 42%);
  pointer-events: none;
  opacity: 0.55;
}
.auth-blob {
  position: absolute;
  display: block;
  border-radius: 50%;
}
.auth-blob-a {
  width: 55%; height: 55%; right: 8%; top: 6%;
  background: var(--brand-2);
}
.auth-blob-b {
  width: 62%; height: 62%; left: 4%; bottom: 4%;
  background: var(--brand-3);
}
.auth-blob-c {
  width: 38%; height: 38%; left: 28%; top: 28%;
  border-radius: 22%;
  background: var(--accent);
  opacity: 0.55;
}
.auth-mobile-brand {
  display: block;
  margin: 0 0 20px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 16px 48px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  box-sizing: border-box;
}
.auth-card {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  border-radius: 16px;
  padding: 24px 20px;
  max-width: 440px;
  width: 100%;
}
.auth-subtitle {
  margin: 0 0 20px;
  color: var(--promo-muted);
  font-size: 0.95rem;
}
.auth-primary,
.auth-card button[type="submit"],
.auth-card > button:not(.secondary):not(.danger) {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 8px 0 0;
  border-radius: 10px;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--promo-muted);
  font-size: 13px;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
[data-auth-shell] button.secondary {
  background: transparent;
  color: var(--accent-text);
  border-color: transparent;
  text-decoration: underline;
  font-weight: 600;
  padding: 6px 4px;
  min-height: 24px;
  min-width: 24px;
}
[data-auth-shell] button.secondary:hover:not(:disabled) {
  background: transparent;
  border-color: transparent;
  color: var(--accent-text);
}
.auth-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  background: var(--bg);
  color: var(--fg);
  overflow-wrap: anywhere;
}
.auth-chip button.secondary { margin: 0; }
.auth-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.auth-links {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 14px;
  margin: 16px 0 0;
}
.auth-links button,
.auth-links a {
  margin: 0;
  align-self: flex-start;
  text-align: left;
}
.auth-inline-link {
  color: var(--accent-text);
  font-weight: 600;
  text-decoration: underline;
  font-size: 0.95rem;
}
.auth-inline-link:hover { color: var(--accent-text); }
.totp-qr { display: grid; gap: 8px; margin: 0 0 12px; }
.totp-qr-frame {
  width: min(100%, 220px);
  justify-self: start;
}
.totp-qr-frame svg {
  display: block;
  width: 100%;
  height: auto;
  background: #ffffff;
}
@media (min-width: 840px) {
  .auth-shell { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); }
  .auth-promo { display: flex; flex-direction: column; justify-content: center; }
  .auth-mobile-brand { display: none; }
  .auth-panel {
    max-width: none;
    padding: 48px 40px;
    margin: 0;
    align-items: center;
  }
  .auth-card { padding: 40px; }
}
@media (max-width: 1199px) and (min-width: 840px) {
  :root {
    --type-title: 17px;
    --type-caption: 13px;
  }
}
@media (max-width: 839px) {
  .auth-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  html, body { overflow: auto; height: auto; }
  body { display: block; }
  main:has([data-workspace-shell]) {
    min-height: calc(100dvh - var(--notice-max));
    overflow: hidden;
    height: calc(100dvh - var(--notice-max));
  }
  .workspace-app {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding-bottom: 56px;
  }
  .workspace-rail {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 6;
    width: 100%;
    height: 56px;
    flex-direction: row;
    flex-wrap: nowrap;
    padding: 4px 8px;
    gap: 8px;
    align-items: stretch;
    border-right: 0;
    border-top: 1px solid var(--line);
    border-bottom: 0;
    background: var(--surface);
  }
  .workspace-mark,
  .rail-bottom { display: none; }
  .rail-button {
    flex: 1;
    width: auto;
    min-height: 44px;
    padding: 8px 12px;
    justify-content: center;
    gap: 0;
  }
  /* Mobile bottom bar shows full words; hide the compact glyph. */
  .rail-button .rail-short { display: none; }
  .rail-button .rail-label {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: nowrap;
    font-size: var(--type-secondary);
    font-weight: 600;
  }
  .thread-body {
    min-height: max(96px, 22vh);
  }
  .workspace-topbar { padding: 6px 12px; min-height: 44px; flex-wrap: nowrap; }
  .workspace-brand-line .divider,
  .workspace-brand-line > span:not(.divider),
  .workspace-version,
  .workspace-page-header .subtitle { display: none; }
  /* Keep a compact Inbox heading when closed; hide it once the list is open for density. */
  .workspace-inbox-card[data-inbox="open"] > .workspace-page-header { display: none; }
  /* Absolute Refresh sat on Closed conversations once the heading (and its 120px gutter) was gone. */
  .workspace-inbox-card[data-inbox="open"] > [data-inbox-refresh] {
    position: static;
    top: auto;
    right: auto;
    z-index: auto;
    margin: 0 16px 8px;
  }
  .workspace-page-header { padding: 4px 14px; }
  .workspace-inbox-card > .workspace-identity,
  .workspace-inbox-card[data-inbox="open"] > [data-assign-hint],
  .workspace-inbox-card[data-inbox="open"] > [data-session-ends],
  .workspace-inbox-card > [data-inbox-phase] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  button { margin-right: 0; }
}
@media (max-width: 620px) {
  [data-contacts-split] {
    grid-template-columns: minmax(0, 1fr);
  }
  .banner {
    max-height: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .workspace-page-header h1,
  .workspace-page-header h2 { font-size: var(--type-headline); }
  .workspace-inbox-card[data-inbox="open"] > [data-inbox-refresh],
  [data-inbox-refresh] {
    min-height: 44px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
.contact-chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.contact-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  color: var(--fg);
  background: var(--surface);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: var(--type-secondary);
}
.contact-chip[data-color="accent"],
.contact-chip[data-color="brand-2"],
.contact-chip[data-color="selection"] {
  background: var(--selection);
  border-color: var(--accent);
}
.contact-chip[data-color="brand-2"] { border-color: var(--brand-2); }
.contact-chip[data-color="brand-3"],
.contact-chip[data-color="warn"] {
  background: var(--banner-bg);
  border-color: var(--brand-3);
}
.contact-chip[data-color="warn"] { border-color: var(--warn); }
.contact-chip[data-color="ok"],
.contact-chip[data-color="bad"],
.contact-chip[data-color="ink-2"] {
  background: var(--bubble-in);
  border-color: var(--ok);
}
.contact-chip[data-color="bad"] { border-color: var(--bad); }
.contact-chip[data-color="ink-2"] { border-color: var(--ink-2); }
.contact-chip button {
  margin-left: 6px;
  padding: 0 6px;
  min-height: 24px;
  font-size: var(--type-secondary);
}
[data-org-manage], [data-org-catalogue] { display: grid; gap: 8px; margin-top: 12px; }
[data-org-picker], [data-org-catalogue-body], [data-org-members] { display: grid; gap: 6px; }
[data-org-catalogue-row] { border: 1px solid var(--line); border-radius: 8px; padding: 8px; }


/* Saved replies with media (HOSTED-SAVED-REPLIES-FULL §5): browse picker, master–detail library, private previews. */
/* The open picker floats above the composer (over the thread text), so the draft, Queue and Insert stay in view. */
.saved-reply-tools.saved-reply-browse { position: static; }
.saved-reply-picker-panel {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(100% - 4px);
  z-index: 5;
  /* Tall enough for header + list + preview + Insert in either layout, so Insert never hides the preview. */
  max-height: min(52vh, 420px);
  overflow-y: auto;
  box-shadow: 0 8px 24px rgb(20 33 61 / 18%);
}
.saved-reply-browse:not([open]) > .saved-reply-picker-panel { display: none; }
/* Familiar slash layout: header (title + Manage), then browse LEFT and the selected reply's preview + Insert RIGHT. */
.saved-reply-picker-panel { container-type: inline-size; container-name: saved-reply-picker; }
.saved-reply-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.saved-reply-picker-title { margin: 0; font-size: var(--type-secondary); font-weight: 600; }
.saved-reply-picker-body {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "browse" "detail" "actions";
}
.saved-reply-picker-browse { grid-area: browse; }
.saved-reply-picker-detail { grid-area: detail; }
.saved-reply-picker-body > .saved-reply-picker-actions { grid-area: actions; }
.saved-reply-picker-browse,
.saved-reply-picker-detail { display: grid; gap: 6px; align-content: start; min-width: 0; }
@container saved-reply-picker (min-width: 560px) {
  .saved-reply-picker-body {
    grid-template-columns: minmax(220px, 2fr) minmax(240px, 3fr);
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas: "browse detail" "browse actions";
  }
  .saved-reply-picker-detail,
  .saved-reply-picker-body > .saved-reply-picker-actions {
    border-left: 1px solid var(--line);
    padding-left: 10px;
  }
  .saved-reply-picker-browse .saved-reply-options { max-height: 220px; }
  .saved-reply-picker-detail .saved-reply-preview-text { max-height: 200px; }
}
/* Phones: a bottom sheet above the fixed rail, so the thread pane's scrolling never clips its header or Insert. */
@media (max-width: 839px) {
  .saved-reply-picker-panel {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 64px;
    max-height: min(72vh, 560px);
    z-index: 7;
  }
}
.saved-reply-picker-panel input[type="search"] { width: 100%; }
.saved-reply-picker-tabs,
.saved-reply-picker-actions,
.saved-reply-picker-lookup,
.saved-reply-views,
.saved-reply-filters,
.saved-reply-editor-actions,
.saved-reply-bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.saved-reply-picker-lookup p { margin: 0; }
.saved-reply-picker-actions {
  position: sticky;
  bottom: -8px;
  padding: 6px 0;
  background: var(--card);
}
[aria-pressed="true"].secondary {
  background: var(--selection);
  border-color: var(--accent);
}
.saved-reply-options {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 132px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.saved-reply-options:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.saved-reply-option {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 6px 8px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.saved-reply-option:last-child { border-bottom: 0; }
.saved-reply-option[aria-selected="true"] {
  background: var(--selection);
  box-shadow: inset 3px 0 var(--accent);
}
/* `{` variable menu: a listbox right under the reply text (the caret's line), same tokens as the picker list. */
.saved-reply-caret-menu {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.saved-reply-caret-menu li { padding: 6px 8px; overflow-wrap: anywhere; }
.saved-reply-caret-option { cursor: pointer; border-bottom: 1px solid var(--line); }
.saved-reply-caret-option:last-child { border-bottom: 0; }
.saved-reply-caret-option[aria-selected="true"] {
  background: var(--selection);
  box-shadow: inset 3px 0 var(--accent);
}
.saved-reply-select-all { display: inline-flex; align-items: center; gap: 6px; }
.saved-reply-picker-lookup [data-saved-reply-picker-more] { margin-top: 4px; }
.saved-reply-option-shortcut,
.saved-reply-row-shortcut {
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.saved-reply-preview {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.saved-reply-preview p { margin: 0; }
.saved-reply-preview-title { font-weight: 600; }
.saved-reply-preview-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 120px;
  overflow-y: auto;
}
.saved-reply-library[open] {
  max-height: min(72vh, 680px);
}
.workspace-inbox-card[data-inbox="open"] > .saved-reply-library[open] {
  max-height: min(72vh, 680px);
}
.workspace-inbox-card > .saved-reply-library { order: 10; }
.saved-reply-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}
.saved-reply-toolbar input[type="search"] { flex: 1 1 200px; min-width: 0; }
.saved-reply-sort-label { font-size: var(--type-secondary); color: var(--ink-2); }
.saved-reply-master-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
@media (min-width: 900px) {
  .saved-reply-master-detail { grid-template-columns: minmax(240px, 2fr) minmax(0, 3fr); }
}
.saved-reply-master-pane,
.saved-reply-detail-pane {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
}
.saved-reply-master .saved-reply-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.saved-reply-master .saved-reply-row.selected {
  border-color: var(--accent);
  background: var(--selection);
}
.saved-reply-row-open {
  display: grid;
  gap: 2px;
  text-align: start;
  min-width: 0;
  background: transparent;
  border: 0;
  color: var(--fg);
  padding: 0;
}
.saved-reply-row-open:hover:not(:disabled) { background: transparent; color: var(--accent-text); }
.saved-reply-row-text,
.saved-reply-row-title { overflow-wrap: anywhere; }
.saved-reply-detail h3 { margin: 0 0 4px; }
.saved-reply-detail label { display: block; font-size: var(--type-secondary); font-weight: 600; margin-top: 6px; }
.saved-reply-detail input[type="text"],
.saved-reply-detail textarea,
.saved-reply-detail select {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.saved-reply-detail textarea { min-height: 96px; resize: vertical; }
.saved-reply-variables,
.saved-reply-attachment {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.saved-reply-variables label,
.saved-reply-variables select { display: inline-block; width: auto; margin: 0; }
.saved-reply-variables p,
.saved-reply-attachment p { flex-basis: 100%; margin: 0; }
.saved-reply-attachment select { width: auto; flex: 1 1 200px; }
.saved-reply-attachment-heading { font-weight: 600; }
.saved-reply-bulk-results { flex-basis: 100%; margin: 0; padding-left: 18px; font-size: var(--type-secondary); }
.media-preview {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  max-width: 100%;
}
.media-preview p { margin: 0; overflow-wrap: anywhere; }
.media-preview img,
.media-preview video {
  display: block;
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  background: var(--card);
}
.media-preview audio { width: 100%; max-width: 360px; }
[data-reply-attachment] [data-reply-attachment-preview] { margin-left: 6px; }
@media (max-width: 839px) {
  .saved-reply-master .saved-reply-row { grid-template-columns: auto minmax(0, 1fr); }
  .saved-reply-master .saved-reply-row > button:last-child { grid-column: 2; justify-self: start; }
}
