/* ChassisUI variables only (see chassis.css). No raw colour values here, except the frame's four
   blues (.shell), the avatar palette near the end and the chart palette below, which ChassisUI
   has no equivalent for. */
:root { color-scheme: light dark; }

/* Local aliases, per theme, where a semantic token fails WCAG AA or doesn't stand apart from
   the page. Each points at an existing ChassisUI token; the token-level problems are listed in
   the UX wave B report for the ChassisUI owner. chassis.css itself is generated: don't edit it.
   - link: text links (brand-blue is 3.3:1 on the light page, 3.6:1 on the dark one).
   - accent / on-accent: count chips and pressed toggles (white on brand-blue is 3.5:1). Buttons
     follow ChassisUI as designed (see .button).
   - inset: code, quotes, reaction chips and avatars (dark bg-inset is the page colour).
   - raised-border: the edge of dialogs and pop-ups (dark has no shadows).
   - meta-on-hover: secondary text (times, captions) on a hovered row; text-secondary is 4.4:1
     on light bg-hover.
   - presence-*: the presence dot (see .presence). active is the Available fill: status-success
     is 2.9:1 on light bg-panel, so light mixes it 70% with ink (5.4:1). busy is the red fill of
     Busy, In a meeting, In a call, Presenting and Do not disturb: status-error is 4.0:1 on
     light bg-panel, so it is used as it is. amber is the Be right back and Away fill:
     status-warning is 2.5:1 on light bg-panel, so light mixes it 70% with ink (4.7:1). gap is
     the ring that sets the dot apart from the avatar and background (and the Do not disturb
     bar); edge is the Available disc's rim, and rim the rim of the other discs (unset in light,
     where they take their own colour); away and hollow are the Offline ring and its centre.
     Dark (and the sidebar frame, in both themes) uses a white gap, as navy and the avatar
     colours are within 3:1 of each other.
   - heading-solid: the heading colour made opaque (dark's is white at 75%), for heavy, tightly
     tracked titles whose overlapping glyphs would otherwise paint twice.
   Semantic tokens are used where one has the value wanted; palette tokens only where none does. */
:root {
  --torque-link: var(--text-emphasis);
  --torque-accent: var(--action-primary-hover);
  --torque-accent-hover: var(--navy-900);
  --torque-on-accent: var(--on-deep);
  --torque-inset: var(--bg-inset);
  --torque-raised-border: var(--border-panel);
  --torque-meta-on-hover: var(--text-emphasis);
  --torque-presence-active: color-mix(in srgb, var(--status-success) 70%, var(--ink));
  --torque-presence-busy: var(--status-error);
  --torque-presence-amber: color-mix(in srgb, var(--status-warning) 70%, var(--ink));
  --torque-presence-gap: var(--bg-panel);
  --torque-presence-edge: var(--torque-presence-active);
  --torque-presence-away: var(--text-secondary);
  --torque-presence-hollow: var(--bg-panel);
  --torque-heading-solid: var(--heading);
  /* The error icon (a circled "!"), drawn as a mask in status-error. */
  --torque-error-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='10' cy='10' r='7.5'/%3E%3Cpath d='M10 6.2v4.6M10 13.8v.01'/%3E%3C/svg%3E");
  /* A tick in a circle: the Healthy tag's icon. */
  --torque-healthy-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10' cy='10' r='7.5'/%3E%3Cpath d='M6.8 10.3l2.2 2.2 4.2-4.8'/%3E%3C/svg%3E");
  /* A cross in a circle: the Not working tag's icon. */
  --torque-broken-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='10' cy='10' r='7.5'/%3E%3Cpath d='M7.5 7.5l5 5M12.5 7.5l-5 5'/%3E%3C/svg%3E");
  /* A circle with a bar across it: the Off tag's icon. */
  --torque-off-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='10' cy='10' r='7.5'/%3E%3Cpath d='M6.5 10h7'/%3E%3C/svg%3E");
  /* A neutral Tag's fill and edge (dark's bg-section is within 1.1:1 of the panel, so dark uses
     bg-inset with a control edge). */
  --torque-tag-fill: var(--bg-section);
  --torque-tag-edge: transparent;
  /* The chart palette (admin/charts.rs): six categorical colours, given to series in this order
     and kept per series. From the dataviz reference palette: blue, orange and green are its
     light steps; aqua, yellow and magenta take its darker (dark-mode) steps, which the light
     steps left well under 3:1 on the page. Checked with its validate_palette.js on bg-page
     (#f4f9fc): every check passes; only yellow is under 3:1 (2.9:1), a warning the table view
     every chart has (and its legend, tooltip and direct labels) answers. */
  --torque-chart-1: #2a78d6;
  --torque-chart-2: #eb6834;
  --torque-chart-3: #199e70;
  --torque-chart-4: #c98500;
  --torque-chart-5: #d55181;
  --torque-chart-6: #008300;
  /* The design file's dark palette ("Torque – Dark Theme", its variables by name). The frame
     uses it in both themes; the dark theme maps ChassisUI's semantic tokens onto it below. */
  --torque-dark-bg-app: #071a2a;
  --torque-dark-bg-card: #0a2236;
  --torque-dark-bg-panel: #0c2e47;
  --torque-dark-bg-hover: #163449;
  --torque-dark-bg-info: #0c3646;
  --torque-dark-border-subtle: #173a55;
  --torque-dark-border-default: #1e4260;
  --torque-dark-border-strong: #4d6a82;
  --torque-dark-border-info: #21c8e0;
  --torque-dark-border-focus: #3db4e0;
  --torque-dark-text-primary: #f2f6f9;
  --torque-dark-text-body: #e3eaf0;
  --torque-dark-text-nav: #c9d6e0;
  --torque-dark-text-muted: #a9bbc9;
  --torque-dark-text-info: #5fe0f0;
  --torque-dark-text-link: #3db4e0;
  --torque-dark-accent-brand: #5cc6e8;
  --torque-dark-accent-primary: #0e7fa6;
  --torque-dark-avatar-ring: #8fdbf3;
  --torque-dark-status-online: #34c77b;
  --torque-dark-status-offline: #9fb0be;
  /* Per theme, where the dark design differs from ChassisUI's own tokens:
     - text-body: a message's words (the design's are a shade softer than primary text).
     - info-*: the "Everyone here is in Torque…" offer: its fill, edge and words.
     - raised-fill: the message action bar and other small pop-ups over the list.
     - chip-*: the Slack and Teams chips after a DM's name in its header.
     - field-glow: the ring round the message box while you type. */
  --torque-text-body: var(--text-primary);
  --torque-info-fill: color-mix(in srgb, var(--action-primary) 8%, var(--bg-panel));
  --torque-info-edge: var(--action-primary);
  --torque-info-text: var(--torque-link);
  --torque-raised-fill: var(--bg-panel);
  --torque-chip-fill: transparent;
  --torque-chip-edge: var(--border-control);
  --torque-chip-text: var(--text-secondary);
  --torque-field-glow: color-mix(in srgb, var(--focus-ring) 18%, transparent);
  /* A tick, drawn as a mask in the checkbox's mark colour. */
  --torque-check-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* ChassisUI's dark semantic tokens, at the design file's values (contrast on bg-panel:
       text-primary 12.6:1, text-secondary 7.2:1, link 5.9:1; white on action-primary 4.6:1). */
    --bg-page: var(--torque-dark-bg-panel);
    --bg-panel: var(--torque-dark-bg-panel);
    --bg-inset: var(--torque-dark-bg-card);
    --bg-chrome: var(--torque-dark-bg-app);
    --bg-hover: var(--torque-dark-bg-hover);
    --bg-section: var(--torque-dark-bg-hover);
    --bg-input: var(--torque-dark-bg-card);
    --border-panel: var(--torque-dark-border-default);
    --border-subtle: var(--torque-dark-border-default);
    --border-control: var(--torque-dark-border-strong);
    --text-primary: var(--torque-dark-text-primary);
    --text-secondary: var(--torque-dark-text-muted);
    --text-emphasis: var(--torque-dark-text-primary);
    --heading: var(--torque-dark-text-nav);
    --link: var(--torque-dark-text-link);
    --focus-ring: var(--torque-dark-border-focus);
    --action-primary: var(--torque-dark-accent-primary);
    --action-primary-border: var(--torque-dark-accent-primary);
    --action-primary-hover: color-mix(in srgb, var(--torque-dark-accent-primary) 80%, var(--torque-dark-bg-app));
    --torque-text-body: var(--torque-dark-text-body);
    --torque-info-fill: var(--torque-dark-bg-info);
    --torque-info-edge: var(--torque-dark-border-info);
    --torque-info-text: var(--torque-dark-text-info);
    --torque-raised-fill: var(--torque-dark-bg-card);
    --torque-chip-fill: var(--torque-dark-bg-hover);
    --torque-chip-edge: var(--torque-dark-border-default);
    --torque-chip-text: var(--torque-dark-text-nav);
    --torque-link: var(--torque-dark-text-link);
    --torque-accent: var(--blue-300);
    --torque-accent-hover: var(--blue-100);
    /* Knocked out in the page colour. */
    --torque-on-accent: var(--bg-page);
    --torque-inset: var(--bg-inset);
    --torque-raised-border: var(--border-panel);
    --torque-meta-on-hover: var(--text-secondary);
    --torque-presence-active: var(--torque-dark-status-online);
    --torque-presence-busy: var(--status-error);
    --torque-presence-amber: var(--status-warning);
    --torque-presence-rim: var(--torque-dark-bg-app);
    --torque-presence-gap: var(--torque-dark-bg-app);
    --torque-presence-edge: var(--torque-dark-bg-app);
    --torque-presence-away: var(--torque-dark-status-offline);
    --torque-presence-hollow: var(--torque-dark-bg-app);
    --torque-presence-ring: transparent;
    /* The design's one shadow: under the message action bar (and so every raised pop-up). */
    --shadow-raised: 0 4px 12px rgba(0, 0, 0, 0.35);
    --torque-heading-solid: var(--text-primary);
    --torque-tag-fill: var(--bg-hover);
    --torque-tag-edge: var(--border-subtle);
    /* The same six hues stepped for the dark band, checked on dark bg-page and bg-panel: all
       pass, all 3:1 or more. */
    --torque-chart-1: #3987e5;
    --torque-chart-2: #d95926;
    --torque-chart-3: #199e70;
    --torque-chart-4: #c98500;
    --torque-chart-5: #d55181;
    --torque-chart-6: #0ca30c;
  }
}
:root[data-theme="dark"] {
  --bg-page: var(--torque-dark-bg-panel);
  --bg-panel: var(--torque-dark-bg-panel);
  --bg-inset: var(--torque-dark-bg-card);
  --bg-chrome: var(--torque-dark-bg-app);
  --bg-hover: var(--torque-dark-bg-hover);
  --bg-section: var(--torque-dark-bg-hover);
  --bg-input: var(--torque-dark-bg-card);
  --border-panel: var(--torque-dark-border-default);
  --border-subtle: var(--torque-dark-border-default);
  --border-control: var(--torque-dark-border-strong);
  --text-primary: var(--torque-dark-text-primary);
  --text-secondary: var(--torque-dark-text-muted);
  --text-emphasis: var(--torque-dark-text-primary);
  --heading: var(--torque-dark-text-nav);
  --link: var(--torque-dark-text-link);
  --focus-ring: var(--torque-dark-border-focus);
  --action-primary: var(--torque-dark-accent-primary);
  --action-primary-border: var(--torque-dark-accent-primary);
  --action-primary-hover: color-mix(in srgb, var(--torque-dark-accent-primary) 80%, var(--torque-dark-bg-app));
  --torque-text-body: var(--torque-dark-text-body);
  --torque-info-fill: var(--torque-dark-bg-info);
  --torque-info-edge: var(--torque-dark-border-info);
  --torque-info-text: var(--torque-dark-text-info);
  --torque-raised-fill: var(--torque-dark-bg-card);
  --torque-chip-fill: var(--torque-dark-bg-hover);
  --torque-chip-edge: var(--torque-dark-border-default);
  --torque-chip-text: var(--torque-dark-text-nav);
  --torque-link: var(--torque-dark-text-link);
  --torque-accent: var(--blue-300);
  --torque-accent-hover: var(--blue-100);
  --torque-on-accent: var(--bg-page);
  --torque-inset: var(--bg-inset);
  --torque-raised-border: var(--border-panel);
  --torque-meta-on-hover: var(--text-secondary);
  --torque-presence-active: var(--torque-dark-status-online);
  --torque-presence-busy: var(--status-error);
  --torque-presence-amber: var(--status-warning);
  --torque-presence-rim: var(--torque-dark-bg-app);
  --torque-presence-gap: var(--torque-dark-bg-app);
  --torque-presence-edge: var(--torque-dark-bg-app);
  --torque-presence-away: var(--torque-dark-status-offline);
  --torque-presence-hollow: var(--torque-dark-bg-app);
  --torque-presence-ring: transparent;
  --shadow-raised: 0 4px 12px rgba(0, 0, 0, 0.35);
  --torque-heading-solid: var(--text-primary);
  --torque-tag-fill: var(--bg-hover);
  --torque-tag-edge: var(--border-subtle);
  --torque-chart-1: #3987e5;
  --torque-chart-2: #d95926;
  --torque-chart-3: #199e70;
  --torque-chart-4: #c98500;
  --torque-chart-5: #d55181;
  --torque-chart-6: #0ca30c;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Figtree", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg-page);
  color: var(--text-primary);
}
.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-8) var(--space-12);
  border: 1px solid var(--border-panel);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  box-shadow: var(--shadow-panel);
}
.panel h1 { margin: 0; color: var(--heading); }
.centered { min-height: 100vh; display: grid; place-items: center; }
.panel p { margin: 0; color: var(--text-secondary); }
/* Status text on the panel keeps the ink colour (`.panel p` would make it grey on the tint). */
.panel .notice, .panel .field-error { color: var(--text-primary); }
/* Form controls take Figtree and the size around them, not the browser's Arial 13.33px. */
button, input, select, textarea { font: inherit; }
/* Checkboxes and radios: a 20px box (a circle for radios) on bg-input, edged in link blue (the
   field edge, blue-100, is too faint to show an empty box), filled action-primary with a white
   tick or dot when on. On a phone the label around one is the 44px
   target (see the 767px block). */
input[type="checkbox"], input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  display: inline-grid;
  place-content: center;
  flex: none;
  box-sizing: border-box;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 1px solid var(--link);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  cursor: pointer;
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:checked, input[type="radio"]:checked { border-color: var(--action-primary); background: var(--action-primary); }
input[type="checkbox"]::before, input[type="radio"]::before { content: ""; visibility: hidden; background: var(--white); }
input[type="checkbox"]::before {
  width: 14px;
  height: 14px;
  -webkit-mask: var(--torque-check-icon) center / contain no-repeat;
  mask: var(--torque-check-icon) center / contain no-repeat;
}
input[type="radio"]::before { width: 8px; height: 8px; border-radius: 50%; }
input[type="checkbox"]:checked::before, input[type="radio"]:checked::before { visibility: visible; }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: 0.5; cursor: not-allowed; }

/* ChassisUI Button (bundle.css .cui-btn): primary by default; .secondary, .ghost and .danger;
   md 48px, .small 32px, .large 56px; Figtree 700. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  box-sizing: border-box;
  min-height: 48px;
  padding: 0 var(--space-6);
  border: 1px solid var(--action-primary-border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  background: var(--action-primary);
  color: var(--white);
  box-shadow: var(--shadow-panel);
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.button:hover:not(:disabled) {
  background: var(--action-primary-hover);
  border-color: var(--action-primary-hover);
  color: var(--white);
}
.button.secondary {
  background: var(--bg-input);
  border-color: var(--brand-blue);
  color: var(--text-emphasis);
  box-shadow: none;
}
.button.secondary:hover:not(:disabled) { background: var(--bg-selected); border-color: var(--brand-blue); color: var(--text-emphasis); }
.button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-emphasis);
  box-shadow: none;
}
.button.ghost:hover:not(:disabled) { background: var(--bg-hover); border-color: transparent; color: var(--text-emphasis); }
/* Not a status fill: the error tint, a red edge and label, and always a bin icon beside the
   label (the red label alone is under 4.5:1). */
.button.danger {
  background: var(--status-error-subtle);
  border-color: var(--status-error);
  color: var(--status-error-fg);
  box-shadow: none;
}
/* The edge thickens on hover; the padding gives back the extra pixel so nothing moves. */
.button.danger:hover:not(:disabled) {
  background: var(--status-error-subtle);
  border-width: 2px;
  border-color: var(--status-error);
  color: var(--status-error-fg);
  padding: 0 calc(var(--space-6) - 1px);
}
.button:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.button .icon { flex: none; width: 16px; height: 16px; }

.button.small { min-height: 32px; padding: 0 var(--space-2); font-size: 13px; }
.button.danger.small:hover:not(:disabled) { padding: 0 calc(var(--space-2) - 1px); }
.button.large { min-height: 56px; padding: 0 var(--space-8); font-size: 19px; }
.button:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.muted { color: var(--text-secondary); }
.centre { text-align: center; }

/* ChassisUI field (bundle.css .cui-field): one 48px height for inputs and selects, 16px text, an
   italic placeholder. Text areas keep their own height. */
.field {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-control);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
  font-size: 16px;
}
input.field, select.field { flex-shrink: 0; height: 48px; padding-top: 0; padding-bottom: 0; }
.field::placeholder { font-style: italic; color: var(--text-primary); opacity: 0.8; }
.field:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.field:disabled { opacity: 0.6; cursor: not-allowed; }
.field[aria-invalid="true"] { border-color: var(--status-error); }
/* ChassisUI SearchField (search_field.rs): the 48px field with the magnifier from icons.rs at its
   end, which gives way to a round clear IconButton once something is typed. The browser's own
   clear button and search styling are hidden. */
.search-field { position: relative; display: flex; align-items: center; min-width: 0; }
.search-field > .field { padding-right: calc(var(--space-3) + 32px + var(--space-2)); }
input[type="search"] { -webkit-appearance: none; appearance: none; }
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
.search-field-icon {
  position: absolute;
  right: var(--space-3);
  display: flex;
  pointer-events: none;
  color: var(--heading);
}
.search-field .search-clear { position: absolute; right: var(--space-2); }
/* A select drawn like the other fields, with the chevron from icons.rs at its end. */
.select-wrap { position: relative; display: flex; align-items: center; }
select.field { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer; }
.select-wrap > .icon { position: absolute; right: var(--space-4); pointer-events: none; color: var(--heading); }
/* Under a field: primary text with an error icon (the error red is under 4.5:1 as text). */
.field-error { color: var(--text-primary); }
.field-error::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: var(--space-1);
  vertical-align: -3px;
  background: var(--status-error);
  -webkit-mask: var(--torque-error-icon) center / contain no-repeat;
  mask: var(--torque-error-icon) center / contain no-repeat;
}
.field-error:empty::before { display: none; }

.dev-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: 100%;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}
.dev-form p { margin: 0; }
.dev-form label.dev-admin { flex-direction: row; align-items: center; gap: var(--space-2); min-height: 44px; }
.dev-form .dev-admin input { width: 20px; height: 20px; }
.dev-form label { display: flex; flex-direction: column; gap: var(--space-1); color: var(--text-secondary); }

/* An error banner: text-primary on the error tint, edged in status-error, with the error icon.
   (Red text on its own tint is about 3:1; text-primary is over 10:1 in both themes.) */
.notice {
  position: relative;
  margin: var(--space-2) var(--space-4);
  padding: var(--space-2) var(--space-3) var(--space-2) calc(var(--space-3) + 16px + var(--space-2));
  border: 1px solid var(--status-error);
  border-radius: var(--radius-sm);
  background: var(--status-error-subtle);
  color: var(--text-primary);
}
.notice::before {
  content: "";
  position: absolute;
  left: var(--space-3);
  top: calc(var(--space-2) + 4px);
  width: 16px;
  height: 16px;
  background: var(--status-error);
  -webkit-mask: var(--torque-error-icon) center / contain no-repeat;
  mask: var(--torque-error-icon) center / contain no-repeat;
}

/* Shell: sidebar on the left, conversation in the main pane. */
.shell { display: grid; grid-template-columns: 273px minmax(0, 1fr); height: 100vh; }
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  background: var(--bg-chrome);
  border-right: 1px solid var(--border-subtle);
}
/* The sidebar scrolls as a whole, so nothing in it shrinks: with a long list a flex child (such as a
   section heading, whose height is fixed) would otherwise be squeezed and the rows below drawn over it. */
.sidebar > * { flex-shrink: 0; }
.workspace { padding: var(--space-4); color: var(--heading); border-bottom: 1px solid var(--border-subtle); }
/* On a wide screen the wordmark is the top bar's left end, over the sidebar's column and level
   with the search box. Placed on the shell (the sidebar itself isn't positioned), so it stays put
   while the list scrolls. */
@media (min-width: 768px) {
  .sidebar .workspace {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 5;
    box-sizing: border-box;
    width: 273px;
    height: 61px;
    padding: 0 20px;
    border-bottom: 0;
  }
}
/* The top bar on a wide screen, right of the wordmark: the search box from the sidebar's edge,
   then the notifications offer 16px after it and 12px in from the window's edge. Without the
   offer, the search box runs to those 12px. */
.top-bar {
  position: absolute;
  top: 10px;
  left: 273px;
  right: 12px;
  z-index: 5;
  display: flex;
  gap: var(--space-4);
  height: 39px;
}
/* The same offer on a wide screen: a rounded box in the top bar, drawn like the search box:
   bell, words, then the ✕. */
.notify-pill {
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex: none;
  align-items: center;
  height: 39px;
  border: 1px solid var(--torque-frame-rule);
  border-radius: 10px;
  background: var(--torque-frame-well);
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
}
.notify-pill-main, .notify-pill-dismiss {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.notify-pill-main { gap: var(--space-2); min-width: 0; height: 100%; padding: 0 var(--space-2) 0 var(--space-4); border-radius: 10px; }
.notify-pill-main .icon { width: 16px; height: 16px; flex: none; }
.notify-pill-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notify-pill-main:disabled { opacity: 0.6; cursor: default; }
.notify-pill-dismiss { justify-content: center; flex: none; width: 28px; height: 28px; margin-right: 6px; padding: 0; border-radius: var(--radius-sm); }
.notify-pill-dismiss .icon { width: 12px; height: 12px; }
.notify-pill-main:hover, .notify-pill-dismiss:hover { background: var(--torque-frame-hover); }
.notify-pill-main:focus-visible, .notify-pill-dismiss:focus-visible { outline: 2px solid var(--ai-cyan); outline-offset: 1px; }
/* Opens under the pill, in the panel colours (the pill's own white text is for the frame). */
.notify-pill-menu {
  position: absolute;
  top: calc(100% + var(--space-1));
  right: 0;
  z-index: 11;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 280px;
  max-width: calc(100vw - 32px);
  padding: var(--space-3);
  border: 1px solid var(--torque-raised-border);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  box-shadow: var(--shadow-raised);
  color: var(--text-primary);
  font-weight: 400;
}
.notify-pill-copy { margin: 0; color: var(--text-primary); }
.notify-pill-actions { display: flex; justify-content: flex-end; gap: var(--space-2); }
/* "Get notified…", a strip across the top until notifications are on, blocked or dismissed:
   the panel colour with a bell in the link colour, so it reads as an offer, not a warning. */
.notify-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-3);
  border: 1px solid var(--torque-raised-border);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  color: var(--text-primary);
}
/* Side by side when there is more than one mark (a DM just in Torque shows Slack's and Teams'). */
.notify-bar-icon { display: inline-grid; grid-auto-flow: column; gap: var(--space-1); place-items: center; flex: none; color: var(--link); }
.notify-bar-text { display: flex; flex: 1; flex-direction: column; gap: var(--space-1); min-width: 0; }
/* The same control in Preferences: its words over its button. */
.notify-body { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); min-width: 0; }
.notify-copy { margin: 0; color: var(--text-primary); }
/* Primary text on the error tint: the error colour itself is under 4.5:1 here. */
.notify-error {
  margin: 0;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--status-error-subtle);
  color: var(--text-primary);
}
.notify-dismiss { flex: none; }
/* "Everyone here is in Torque…": an offer, in the primary blue: its edge, a faint wash of it, and
   the info icon and words in the link colour (4.5:1 or better on the wash, in both themes). */
.notify-bar.offer-bar {
  border-color: var(--action-primary);
  background: color-mix(in srgb, var(--action-primary) 8%, var(--bg-panel));
}
.offer-bar .notify-bar-icon, .offer-bar .offer-copy { color: var(--torque-link); }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-4) var(--space-1);
}
.section-head h2 { margin: 0; color: var(--text-secondary); }
/* ChassisUI IconButton, round (bundle.css .cui-iconbtn--round): 32px, no frame. (The framed
   48px variant has no use here yet.) */
.icon-button {
  display: inline-grid;
  place-items: center;
  flex: none;
  box-sizing: border-box;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--heading);
  font: inherit;
  cursor: pointer;
}
.icon-button:hover { background: var(--bg-selected); }
.icon-button:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.item:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.items { list-style: none; margin: 0; padding: 0 var(--space-2); }
.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-decoration: none;
}
.item:hover { background: var(--bg-hover); }
.item.selected { background: var(--bg-selected); }
.item.bold { font-weight: 800; color: var(--text-emphasis); }
.item-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* An unread count: ChassisUI Count (bundle.css .cui-count), bg-section with heading text. */
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  box-sizing: border-box;
  min-width: 24px;
  height: 24px;
  padding: 0 var(--space-1);
  border-radius: var(--radius-full);
  background: var(--bg-section);
  color: var(--heading);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.me {
  margin-top: auto;
  padding: var(--space-2);
  border-top: 1px solid var(--border-subtle);
}
/* You: opens the account menu (above it, over the list). */
.me-button {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: var(--space-2);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.me-button:hover, .me-button[aria-expanded="true"] { background: var(--bg-hover); }
.me-button:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.me-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu.account-menu { left: var(--space-2); right: var(--space-2); }
.me .notice { margin: var(--space-2) 0 0; color: var(--text-primary); }

/* Presence: a dot on the avatar's corner, in a gap ring that keeps it apart from the avatar and
   the background (3.5:1 or better against each). Available is a filled green disc, Busy (and In
   a meeting, In a call, Presenting) a red one, Do not disturb a red one with a bar, Be right
   back and Away an amber one, and Offline a ring round a hollow centre, so the state never rests
   on hue alone. Every dot is named by its tooltip. Colours: the --torque-presence-* aliases; the frame's are set on .sidebar. */
.avatar-wrap { position: relative; display: inline-flex; flex: none; }
/* Off the avatar's corner by 4px: its ring stays clear of the initials, and of the next row and
   the rules round the list. */
.presence {
  position: absolute;
  right: -4px;
  bottom: -4px;
  box-sizing: border-box;
  width: 12px;
  height: 12px;
  border: 2px solid var(--torque-presence-edge);
  border-radius: 50%;
  background: var(--torque-presence-active);
  box-shadow: 0 0 0 2px var(--torque-presence-ring, var(--torque-presence-gap));
}
.presence.offline { border-color: var(--torque-presence-away); background: var(--torque-presence-hollow); }
.presence.busy, .presence.dnd {
  border-color: var(--torque-presence-rim, var(--torque-presence-busy));
  background: var(--torque-presence-busy);
}
.presence.away {
  border-color: var(--torque-presence-rim, var(--torque-presence-amber));
  background: var(--torque-presence-amber);
}
/* Do not disturb: a bar across the red disc, in the gap colour. */
.presence.dnd::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 2px;
  transform: translate(-50%, -50%);
  background: var(--torque-presence-gap);
}
/* In the conversation header the dot sits inline before the name, not on a corner. */
/* Its 2px ring sits outside its box: the left margin keeps the heading from cropping it. */
.header-presence { display: inline-flex; flex: none; margin-left: 2px; margin-right: var(--space-1); }
.header-presence .presence { position: relative; right: auto; bottom: auto; }
/* The presence menu: each state with its dot, the current one ticked (aria-checked). */
.presence-menu .menu-item { display: flex; align-items: center; gap: var(--space-2); }
.presence-menu .menu-item .presence { position: relative; right: auto; bottom: auto; flex: none; }
.presence-menu .menu-item .menu-tick { display: inline-flex; margin-left: auto; visibility: hidden; }
.presence-menu .menu-item[aria-checked="true"] .menu-tick { visibility: visible; }
.presence-menu .menu-rule { height: 1px; margin: var(--space-1) 0; background: var(--torque-raised-border); }
/* A status emoji after a name: the text is its tooltip. */
.status-emoji { flex: none; font-size: 14px; line-height: 1; cursor: default; }
.dialog-row-name { display: flex; align-items: center; gap: var(--space-1); min-width: 0; }

/* "Set a status". */
/* The label sits above one 48px row: the emoji button, then the field. */
.status-field { display: flex; flex-direction: column; gap: var(--space-1); }
.status-field > label { color: var(--text-secondary); }
.status-row { display: flex; align-items: center; gap: var(--space-2); }
.status-row .status-text { flex: 1; min-width: 0; width: auto; }
.status-emoji-button {
  display: inline-grid;
  place-items: center;
  flex: none;
  box-sizing: border-box;
  width: 48px;
  height: 48px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.status-emoji-button:hover { background: var(--bg-hover); }
.status-emoji-button:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.dialog .status-count { margin-top: calc(-1 * var(--space-2)); text-align: right; color: var(--text-secondary); }
.dialog .status-count.status-remove-emoji { align-self: flex-start; }
.status-clear { margin-right: auto; }
.pref-section { display: flex; flex-direction: column; gap: var(--space-2); }

.main-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg-page); }
/* A page with nothing to show (404, a conversation that's gone): its EmptyState, centred. */
.empty { margin: auto; padding: var(--space-8) var(--space-4); }

/* ChassisUI EmptyState (bundle.css .cui-empty): picture, "No <things>" in web-page-title, a
   sentence ending with the next step, and the action. The title is opaque, as dialog titles are. */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  box-sizing: border-box;
  max-width: 320px;
  margin: 0 auto;
  padding: var(--space-8) 0;
  text-align: center;
}
.empty-state-icon { display: flex; margin-bottom: var(--space-3); color: var(--torque-heading-solid); }
.dialog .empty-state-title, .empty-state-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.33;
  font-weight: 900;
  letter-spacing: -0.05em;
  color: var(--torque-heading-solid);
}
.dialog .empty-state-body, .empty-state-body {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-secondary);
}
.empty-state-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin-top: var(--space-4); }
/* In the emoji picker: a smaller picture and less padding (Torque's own; the picker is 420px). */
.empty-state.compact { padding: var(--space-4) var(--space-2); }
.empty-state.compact .empty-state-icon { margin-bottom: var(--space-1); }

/* A section inside a dialog (Preferences, Custom Emoji): t-web-section-title under the
   web-page-title dialog title, ruled off from the one before. */
.dialog .dialog-section-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 800;
  letter-spacing: -0.05em;
  color: var(--torque-heading-solid);
}
.dialog-section { display: flex; flex-direction: column; gap: var(--space-2); }
.emoji-dialog .dialog-section { padding-top: var(--space-3); border-top: 1px solid var(--border-subtle); }
.conversation { display: flex; flex-direction: column; flex: 1; min-height: 0; }
/* One height whatever the actions, so the list doesn't shift between conversations. */
.conv-header {
  box-sizing: border-box;
  height: 73px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-panel);
}
/* The conversation's name: 22px semibold, in the opaque heading colour. */
.conv-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0;
  font-size: 22px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--torque-heading-solid);
}
.conv-topic { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { display: none; align-self: center; }
/* A short list sits at the bottom, by the message box; a long one scrolls as usual. */
.messages { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-4); }
.messages-inner { margin-top: auto; }

/* The top of a conversation, once nothing older is left to load. */
.intro { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); padding: var(--space-8) 0 var(--space-4); }
/* web-page-title, as a PageHeader's title; opaque for the same reason as dialog titles. */
/* The same type as the conversation's name in the header above it. */
.intro-title { margin: 0; font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -0.01em; color: var(--torque-heading-solid); }
.intro-text { margin: 0; }
.intro-topic { margin: 0; color: var(--text-secondary); }
/* On a wide screen the header already shows the topic and Add People; a phone's header has
   neither (they are here and in its menu). */
@media (min-width: 768px) {
  .intro-topic, .intro-add-people { display: none; }
}

/* "Today", "Yesterday", "Thursday 12 November" between days; "New" above the first unread. */
.day-divider, .new-divider { display: flex; align-items: center; gap: var(--space-2); }
.day-divider { margin: var(--space-4) 0 var(--space-2); }
.day-divider::before, .day-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border-panel); }
.day-pill {
  padding: 2px var(--space-3);
  border: 1px solid var(--border-panel);
  border-radius: var(--radius-full);
  background: var(--bg-panel);
  color: var(--text-primary);
  font-weight: 700;
}
/* The day and "New" on one rule: the rule takes the "New" colour, the label sits at its end. */
.day-divider.with-new::before, .day-divider.with-new::after { border-top-color: var(--torque-link); }
.day-divider::after { order: 2; }
.new-label { order: 3; color: var(--torque-link); font-weight: 700; }
.new-divider { margin: var(--space-2) 0; color: var(--torque-link); }
.new-divider::before { content: ""; flex: 1; border-top: 1px solid currentColor; }
.new-divider span { font-weight: 700; }

.group { margin: 0; }
/* Author and time, on a group's first message. */
.msg-header { display: flex; align-items: baseline; gap: var(--space-2); min-width: 0; }
/* A long name ends in "…" rather than wrapping into the job title under it. */
.msg-author { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-header time { flex: none; }
/* On a message: the name in semibold, then their job title and the time, smaller, on one line;
   the title gives way first when the line is short. The avatar beside it is 36px, as in the
   sidebar. */
.msg-header .msg-author { font-weight: 600; }
.msg-header .person-title { flex: 0 1 auto; font-size: 14px; }
.message .avatar.avatar-lg, .message .app-icon.app-icon-lg { width: 36px; height: 36px; font-size: 14px; }
/* The Slack or Teams mark after a synced message's time. It follows the time's colour, so it keeps
   at least 3:1 (graphics) on the panel and on the hovered row in both themes. */
.origin-badge { display: inline-flex; flex: none; align-self: center; color: var(--text-secondary); }
.origin-mark { display: block; }
.message:hover .origin-badge, .message:focus-within .origin-badge { color: var(--torque-meta-on-hover); }
.body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.body.pending { opacity: 0.6; }

/* Formatted message bodies (built as elements, never HTML). */
.body p, .body ul, .body ol, .body pre, .body blockquote { margin: 0; }
.body > * + *, .body blockquote > * + * { margin-top: var(--space-1); }
.body ul, .body ol { padding-left: var(--space-6); }
.body code {
  padding: 0 var(--space-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--torque-inset);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875em;
}
.body pre {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--torque-inset);
  white-space: pre;
  overflow-x: auto;
}
.body pre code { padding: 0; border: 0; background: transparent; }
.body blockquote {
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--torque-inset);
  color: var(--text-secondary);
}
.body a { color: var(--torque-link); }
.body a:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.mention {
  padding: 0 2px;
  border-radius: var(--radius-sm);
  background: var(--bg-selected);
  color: var(--text-emphasis);
  font-weight: 600;
}
/* A mention of you: bg-selected like the others, with a link-coloured edge (not colour alone). */
.mention-me { background: var(--bg-selected); color: var(--text-emphasis); box-shadow: inset 0 0 0 1px var(--link); }
.body a.channel-link { color: var(--text-emphasis); font-weight: 600; text-decoration: none; }
.body a.channel-link:hover { text-decoration: underline; }
.tombstone { color: var(--text-secondary); font-style: italic; }
.edited { color: var(--text-secondary); }
/* "(edited)" follows the last paragraph on its line. */
.body > p:has(+ .edited:last-child) { display: inline; }
.body > p:has(+ .edited:last-child) + .edited { margin-left: var(--space-1); }
.body > :not(p) + .edited { display: block; }

/* One message: the action bar shows on hover, and on focus inside it for keyboards and taps.
   A 36px gutter on the left holds the group's avatar, or a later message's time on hover, 12px
   clear of the text. */
.message {
  position: relative;
  margin: 0 calc(-1 * var(--space-2));
  padding: 2px var(--space-2) 2px calc(var(--space-2) + 36px + var(--space-3));
  border-radius: var(--radius-sm);
}
.message.lead { margin-top: var(--space-1); padding-top: var(--space-2); }
.msg-gutter { position: absolute; top: 2px; left: var(--space-2); width: 36px; }
.message.lead .msg-gutter { top: var(--space-2); }
.avatar.avatar-lg {
  box-sizing: border-box;
  display: grid;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.hover-time { display: block; visibility: hidden; color: var(--torque-meta-on-hover); line-height: 24px; text-align: right; white-space: nowrap; }
.message:hover .hover-time, .message:focus-within .hover-time, .message:focus-visible .hover-time { visibility: visible; }
/* "Replied to a thread: …" over a reply that was also sent here. */
.reply-caption { display: block; width: fit-content; max-width: 100%; color: var(--text-secondary); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-caption:hover { color: var(--torque-link); text-decoration: underline; }
/* Secondary text on a hovered or focused row keeps AA on bg-hover. */
.message:hover :is(.reply-caption, .msg-header time, .edited, .tombstone, .person-title, .body.narration, .pinned-label),
.message:focus-within :is(.reply-caption, .msg-header time, .edited, .tombstone, .person-title, .body.narration, .pinned-label) { color: var(--torque-meta-on-hover); }
/* A /me line: one italic sentence in secondary text, with no avatar or header. Its time shows
   in the gutter on hover, as a grouped message's does. */
.body.narration { color: var(--text-secondary); font-style: italic; }
.message.narration { padding-block: var(--space-1); }
/* A synced /me line's Slack or Teams mark follows its last paragraph, after any "(edited)". */
.body.narration > p:last-of-type:has(~ .origin-badge) { display: inline; }
.body.narration > p + .edited, .body.narration > .origin-badge { margin-left: var(--space-1); }
.body.narration > .origin-badge { vertical-align: middle; }
.message.narration .msg-gutter { top: var(--space-1); }
.message .reply-caption:hover { color: var(--torque-link); }
.reply-caption:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.message:hover, .message:focus-within { background: var(--bg-hover); }
/* Keyboard focus on a message (↑ and ↓ move it) shows a ring; a click or tap doesn't. */
.message:focus { outline: none; }
.message:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
/* The root of the thread open beside the conversation. */
.message.thread-open { background: var(--bg-selected); }
.message.editing { background: transparent; }
.msg-actions {
  position: absolute;
  top: calc(-1 * var(--space-4));
  right: var(--space-2);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--torque-raised-border);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  box-shadow: var(--shadow-raised);
  opacity: 0;
  pointer-events: none;
}
.message:hover .msg-actions, .message:focus-within .msg-actions, .msg-actions.open { opacity: 1; pointer-events: auto; }
/* One bar at a time: a clicked (focused) message keeps its bar only until the pointer is over
   another message, whose bar then takes over. A bar with its menu open stays. */
:root:has(.message:hover) .message:not(:hover) .msg-actions:not(.open) { opacity: 0; pointer-events: none; }
.action {
  min-width: 28px;
  height: 28px;
  padding: 0 var(--space-2);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}
.action.reaction { width: 32px; height: 32px; padding: 0; font-size: 18px; }
.action.icon-action { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; color: var(--text-secondary); }
.action.icon-action:hover, .action.icon-action[aria-expanded="true"] { color: var(--text-primary); }
.icon { display: block; }
/* "More actions" opens under the bar, or above it near the bottom of the list. */
.msg-actions .menu { top: calc(100% + var(--space-1)); z-index: 3; }
.menu.above { top: auto; bottom: calc(100% + var(--space-1)); }
.action:hover { background: var(--bg-hover); }
.action:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.message .notice { margin: var(--space-1) 0 0; }
.edit-box { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-1) 0; }
/* Like the message box: no grip, one 48px line to start, growing with the text (fit_to_text in
   composer.rs) up to 240px, then scrolling. */
.edit-box textarea { display: block; resize: none; min-height: 48px; max-height: 240px; overflow-y: auto; }
/* Editing a /me line: its text, after a "/me" tag. */
.edit-box .edit-me { display: flex; align-items: flex-start; gap: var(--space-2); }
.edit-box .edit-me textarea { flex: 1; min-width: 0; }
.me-tag {
  flex: none;
  margin-top: var(--space-3);
  padding: 0 var(--space-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}
.edit-box .notice { margin: 0; }
.edit-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); }
.edit-hint { margin: 0 auto 0 0; }
/* Reactions under a message: "🎉 3". Yours are highlighted. */
.reactions { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: var(--space-1) 0 2px; }
.reaction-chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 var(--space-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: var(--torque-inset);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.reaction-chip:hover { border-color: var(--border-control); }
.reaction-chip.mine { background: var(--bg-selected); border-color: var(--border-control); color: var(--text-emphasis); }
.reaction-chip:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
/* In an archived channel: the count and who reacted, nothing to press. */
.reaction-chip.is-static { cursor: default; }
/* Who reacted: a small popover over the chip on hover or focus. */
.reaction-wrap { position: relative; display: inline-flex; }
.reaction-who {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 20;
  width: max-content;
  max-width: 260px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  border: 1px solid var(--border-control);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  color: var(--text-primary);
  white-space: normal;
  pointer-events: none;
}
.reaction-wrap:hover .reaction-who,
.reaction-wrap:focus-within .reaction-who { display: flex; flex-direction: column; gap: 2px; }
.reaction-who-emoji { color: var(--text-secondary); }
.reaction-chip.is-static:hover { border-color: var(--border-subtle); }
.reaction-chip.is-static.mine:hover { border-color: var(--border-control); }

/* The emoji and GIF picker: a search box, tabs, a grid and a footer, beside the caret or the
   button that opened it (placed by script); a sheet along the bottom on a phone. */
.picker {
  position: fixed;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  box-sizing: border-box;
  width: 352px;
  height: 420px;
  max-height: calc(100vh - 16px);
  padding: var(--space-2);
  border: 1px solid var(--torque-raised-border);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  box-shadow: var(--shadow-raised);
}
.picker:not(.placed) { left: 0; right: 0; bottom: 0; width: auto; height: min(420px, 70vh); padding-inline: var(--space-4); border-radius: var(--radius-md) var(--radius-md) 0 0; }
.picker-head { display: flex; gap: var(--space-2); }
.picker-head .search-field { flex: 1; }
.picker-search { flex: 1; min-width: 0; }
/* The sheet's way out on a phone; Esc does it on a keyboard. */
.picker.placed .picker-close { display: none; }
/* Above `.button.small`, which would otherwise set its size. */
.picker .picker-head .picker-close { flex: none; min-height: 44px; min-width: 44px; }
.picker-tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border-subtle); }
.picker-tab {
  padding: var(--space-1) var(--space-2);
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}
.picker-tab:hover { color: var(--text-primary); }
.picker-tab[aria-selected="true"] { border-bottom-color: var(--focus-ring); color: var(--text-emphasis); }
.picker-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }
/* Padded so the active cell's ring (offset 2px) isn't cut off at the edges. */
.picker-grid { position: relative; flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-1); }
.picker-heading { padding: var(--space-1) var(--space-1) 2px; color: var(--text-secondary); font-weight: 700; }
.picker-row { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.picker-row.gif-row { grid-template-columns: repeat(2, 1fr); gap: var(--space-1); margin-bottom: var(--space-1); }
.picker-cell {
  display: grid;
  place-items: center;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.picker-cell img { width: 24px; height: 24px; object-fit: contain; }
.picker-cell.gif { height: 112px; overflow: hidden; background: var(--torque-inset); }
.picker-cell.gif img { width: 100%; height: 100%; object-fit: cover; }
.picker-cell:hover { background: var(--bg-hover); }
.picker-cell.active { background: var(--bg-selected); outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.picker-note { margin: var(--space-2) var(--space-1); }
.picker-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); min-height: 28px; }
.picker-tones { display: flex; align-items: center; gap: var(--space-1); }
.picker-tones[hidden] { display: none; }
.picker-tones [role="radiogroup"] { display: flex; gap: 2px; }
.picker-tone {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.picker-tone:hover { background: var(--bg-hover); }
.picker-tone[aria-checked="true"] { border-color: var(--border-control); background: var(--bg-selected); }
.picker-tone:focus-visible, .picker-tab:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.picker-attribution { margin-left: auto; }
/* The "+" after a message's reactions. */
.add-reaction-chip { display: inline-grid; place-items: center; color: var(--text-secondary); }
/* A GIF in the message box, between the text before it and the text after it, at the size it
   will show in the message, with a button over its corner to take it out. */
.composer-gif-inline {
  position: relative;
  align-self: flex-start;
  box-sizing: border-box;
  max-width: calc(100% - 2 * var(--space-3));
  margin: var(--space-1) var(--space-3);
}
.composer-gif-image {
  display: block;
  max-width: 100%;
  height: auto;
  box-sizing: border-box;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--torque-inset);
}
.composer-gif-remove {
  position: absolute;
  top: var(--space-1);
  right: var(--space-1);
  background: var(--bg-input);
  box-shadow: 0 0 0 1px var(--border-subtle);
}
.composer-gif-remove:hover { background: var(--bg-hover); }
.composer-input-after { padding-top: var(--space-1); }
/* Editing a message with a GIF: the GIF, fixed in place, between the two fields. */
.edit-gif { align-self: flex-start; max-width: 100%; }

/* A workspace's own emoji, at the size of the text around it. */
.custom-emoji { display: inline-block; width: 1.375em; height: 1.375em; margin: 0 1px; vertical-align: -0.3em; object-fit: contain; }
.reaction-chip .custom-emoji { width: 1.25em; height: 1.25em; margin: 0; vertical-align: -0.25em; }
.ac-option .custom-emoji { width: 1.25em; height: 1.25em; margin: 0; vertical-align: middle; }

/* A message's GIF, under its text: the box keeps its shape before the image loads. */
.msg-gif-row { margin-top: var(--space-1); }
.msg-gif-row.pending { opacity: 0.6; }
.msg-gif { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-1); }
.msg-gif-frame {
  box-sizing: border-box;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--torque-inset);
}
.msg-gif-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* The "Custom emoji" dialog. */
/* ChassisUI Dropzone (bundle.css .cui-dropzone): white, dashed link edge, a 120px bg-selected
   circle with the upload icon (or the chosen image), title, body, button and hint. A file
   dragged over turns it bg-selected with a solid edge. */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-8);
  border: 1px dashed var(--link);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  text-align: center;
}
.dropzone.over { background: var(--bg-selected); border-style: solid; }
.dropzone.invalid { border-color: var(--status-error); }
.dropzone-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-full);
  background: var(--bg-selected);
  color: var(--link);
}
.dialog .dropzone-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.33;
  font-weight: 900;
  letter-spacing: -0.05em;
  color: var(--torque-heading-solid);
}
.dialog .dropzone-body, .dialog .dropzone-hint { margin: 0; font-size: 16px; font-weight: 500; line-height: 1.3; color: var(--text-secondary); overflow-wrap: anywhere; }
.dialog .dropzone-hint.field-error { color: var(--text-primary); }
.dropzone .button { margin: var(--space-6) 0 var(--space-4); }
.emoji-preview { display: block; object-fit: contain; border-radius: var(--radius-sm); }
@media (max-width: 767px) {
  .dropzone { padding: var(--space-4); }
}
.emoji-form-actions { display: flex; justify-content: flex-end; }
.emoji-list { border-top: 1px solid var(--border-subtle); }
.emoji-row { flex-wrap: wrap; justify-content: flex-start; }
.emoji-row .dialog-row-text { flex: 1; }
.emoji-row-image { display: block; flex: none; object-fit: contain; }
.emoji-row .notice { flex-basis: 100%; }
.emoji-confirm-row { display: flex; align-items: center; gap: var(--space-2); }

/* Autocomplete for @people, #channels and :emoji:, above the message box. */
.ac-anchor { position: relative; }
/* space-2 clear of the box it's above. */
.ac-popup {
  position: absolute;
  bottom: calc(100% + var(--space-2));
  left: 0;
  right: 0;
  z-index: 3;
  max-height: 240px;
  margin: 0;
  padding: var(--space-1);
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--torque-raised-border);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  box-shadow: var(--shadow-raised);
}
.ac-option {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
}
.ac-option:hover { background: var(--bg-hover); }
.ac-option.active { background: var(--bg-selected); color: var(--text-emphasis); }
.ac-main { font-weight: 600; }
.ac-detail { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A person: the people picker's row (avatar, then name over email), one 40px height. */
.ac-option.ac-person { align-items: center; gap: var(--space-3); }
.ac-option.ac-person .avatar { width: 32px; height: 32px; border-radius: var(--radius-md); font-size: 13px; }
.ac-lines { display: flex; flex-direction: column; min-width: 0; }
.ac-lines .ac-main { line-height: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-lines .ac-detail { line-height: 14px; }
.ac-option.active .ac-detail { color: var(--torque-meta-on-hover); }

/* Torque's mark before a channel name, where other apps put a hash. It follows the text colour. */
.channel-glyph {
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  margin-right: 0.15em;
  flex: none;
}

/* Read by screen readers, not shown. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.composer { padding: var(--space-3) var(--space-4) var(--space-4); border-top: 1px solid var(--border-subtle); background: var(--bg-panel); }
.composer .notice { margin: 0 0 var(--space-2); }
/* Why a command wasn't sent, under the message box. */
.composer .command-note { margin: var(--space-2) 0 0; }
/* A `/gif` preview, just above the message box: the search, the GIF at the size it will show
   in the message, and Post, Shuffle and Cancel under it. */
.gif-preview {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  margin: 0 0 var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-input);
}
.gif-preview-search { margin: 0; color: var(--text-secondary); overflow-wrap: anywhere; }
.gif-preview-image {
  display: block;
  max-width: 100%;
  height: auto;
  box-sizing: border-box;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--torque-inset);
}
.gif-preview-placeholder { width: 200px; max-width: 100%; height: 150px; border-radius: var(--radius-md); background: var(--torque-inset); }
.gif-preview-message { margin: 0; }
.gif-preview-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.gif-preview-actions .button[aria-disabled="true"] { opacity: 0.6; cursor: default; }
.gif-preview-credit { margin-left: var(--space-2); }
/* The message box: one ChassisUI field holding the text, full width, over one 48px row of its
   controls: the round IconButtons for files and emoji, "Also send to…" in a thread, and Send at
   the end. The text box grows with its text (composer.rs) up to the max-height. */
.composer-field {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
}
.composer-field:has(.composer-input:focus-visible) { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.composer-field.disabled { opacity: 0.6; }
/* The autocomplete sits above the whole field, not just the text. */
.composer-field .ac-anchor { position: static; }
/* Placed inside the field's border, so 1px more to be space-2 clear of its outer edge. */
.composer-field .ac-popup { bottom: calc(100% + var(--space-2) + 1px); }
.composer-input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 48px;
  max-height: 240px;
  margin: 0;
  padding: var(--space-3) var(--space-3) var(--space-1);
  border: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 16px;
  resize: none;
  overflow-y: auto;
}
.composer-input:focus { outline: none; }
/* Upright, like the search box's. */
.composer-input::placeholder { font-style: normal; color: var(--text-primary); opacity: 0.8; }
.composer-input:disabled { cursor: not-allowed; }
.composer-tools {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  box-sizing: border-box;
  min-height: 48px;
  padding: 0 var(--space-2);
}
.composer-tools .send { flex: none; margin-left: auto; }
/* Send is solid in the box in use even with nothing to send yet: it still does nothing until
   there is (it stays disabled); only the faded look goes. */
.composer-tools .send:disabled:not(.secondary) { opacity: 1; cursor: default; box-shadow: var(--shadow-panel); }
.icon-button:disabled { cursor: not-allowed; opacity: 0.5; }
.icon-button:disabled:hover { background: transparent; }

/* Files attached in a message box, above the text. */
.attachments { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-2); padding: 0; list-style: none; }
.attachment {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  box-sizing: border-box;
  width: 240px;
  max-width: 100%;
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-3);
  border: 1px solid var(--border-control);
  border-radius: var(--radius-md);
  background: var(--bg-page);
}
.attachment.failed { border-color: var(--status-error); }
.attachment-text { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 2px; }
.attachment-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.attachment-size { color: var(--text-secondary); }
.attachment-error { color: var(--status-error-fg); }
.attachment-text .link-button { align-self: flex-start; }
.attachment-progress { height: 4px; overflow: hidden; border-radius: var(--radius-full); background: var(--bg-hover); }
.attachment-progress > span { display: block; height: 100%; background: var(--torque-accent); transition: width 120ms linear; }
.attachment-remove { display: inline-grid; place-items: center; flex: none; }
/* How long the file is kept once sent: "Expires: 12 months ▾", under its name and size. */
.attachment-expiry { display: flex; align-items: center; gap: var(--space-1); color: var(--text-secondary); }
.attachment-expiry-select {
  min-width: 0;
  min-height: 28px;
  padding: 0 var(--space-1);
  border: 1px solid var(--border-control);
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  color: var(--text-primary);
  font: inherit;
  cursor: pointer;
}
.attachment-expiry-select:hover { background: var(--bg-hover); }
.attachment-expiry-select:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
/* An image chip's picture of its file: a fixed square, so the chip never changes height. */
.attachment-preview {
  display: block;
  flex: none;
  width: 40px;
  height: 40px;
  margin-left: calc(-1 * var(--space-2));
  border-radius: var(--radius-sm);
  background: var(--torque-inset);
  object-fit: cover;
}

/* Files on a message: image thumbnails, each box sized before its image loads so nothing below
   it moves, then a card for each other file. On a phone a thumbnail shrinks to the column. */
.msg-files.pending { opacity: 0.6; }
.files { display: flex; flex-direction: column; gap: var(--space-2); margin: var(--space-1) 0; }
.file-thumbs { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.file-thumb {
  box-sizing: border-box;
  display: block;
  max-width: 100%;
  height: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--torque-inset);
  cursor: zoom-in;
}
.file-thumb:hover { border-color: var(--border-control); }
.file-thumb:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.file-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
/* An image that wouldn't load: the same box, saying so, with Download. */
.file-thumb-broken {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-width: 160px;
  min-height: 140px;
  padding: var(--space-3);
  border-style: dashed;
  border-color: var(--border-control);
  color: var(--text-secondary);
  text-align: center;
  cursor: default;
}
.file-thumb-broken-title { color: var(--text-primary); }
/* A GIF kept still (reduced motion) that has no thumbnail: a quiet label in its box. */
.file-thumb-still { display: grid; place-items: center; width: 100%; height: 100%; color: var(--text-secondary); }
.file-cards { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.file-card {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  box-sizing: border-box;
  width: 280px;
  max-width: 100%;
  padding: var(--space-2) var(--space-1) var(--space-2) var(--space-2);
  border: 1px solid var(--border-control);
  border-radius: var(--radius-md);
  background: var(--bg-page);
}
.file-type-icon { flex: none; color: var(--text-secondary); }
.file-card-text { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 2px; }
.file-card-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.file-card-size { color: var(--text-secondary); }
.file-download { display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; }
/* An expired file (image or not): its name and when it went, as plain text, never a link. The
   card keeps a file card's size so the message doesn't jump when its file expires. */
.file-card-expired { min-height: 50px; padding-right: var(--space-2); border-style: dashed; background: transparent; }
.file-card-expired .file-card-name { color: var(--text-secondary); white-space: normal; overflow-wrap: anywhere; }

/* The image viewer: one image scaled to fit, with its name, size and controls. A phone's fills
   the screen. */
.dialog.file-viewer { width: min(960px, 100%); }
.dialog.file-viewer h2 { overflow-wrap: anywhere; }
.viewer-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  height: min(70vh, 720px);
  min-height: 0;
  border-radius: var(--radius-sm);
  background: var(--torque-inset);
}
.viewer-image { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-meta { color: var(--text-secondary); }
.viewer-actions { flex-wrap: wrap; }
.viewer-step { display: inline-flex; align-items: center; gap: var(--space-1); }
/* Previous and Next on the left, Download and Close on the right. */
.viewer-step + .viewer-step { margin-right: auto; }
@media (max-width: 767px) {
  .file-download { width: 44px; height: 44px; }
  .overlay:has(> .file-viewer) { padding: 0; }
  .dialog.file-viewer { width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; }
  .viewer-frame { flex: 1; height: auto; }
}

/* Files dragged over a message pane. Pointer events pass through, so the pane still gets the drop. */
.conversation, .thread-panel { position: relative; }
.drop-overlay {
  position: absolute;
  inset: var(--space-2);
  z-index: 20;
  display: grid;
  place-items: center;
  padding: var(--space-4);
  border: 2px dashed var(--torque-accent);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--bg-page) 90%, transparent);
  color: var(--text-emphasis);
  text-align: center;
  pointer-events: none;
}
.drop-overlay p { margin: 0; }
.join-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.join-row p { margin: 0; color: var(--text-secondary); }
.join-row strong { color: var(--text-primary); }

/* First Tab stop on the page; off-screen until focused. */
.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 40;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  color: var(--text-primary);
  box-shadow: var(--shadow-raised);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.loading { margin: 0; }

/* The delete confirmation quotes the message. */
.delete-preview {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  max-height: 9em;
  overflow: hidden;
  /* Links and mentions in the quote are for reading, not following. */
  pointer-events: none;
}

/* A message's actions on a narrow screen: a sheet along the bottom (see ActionSheet). */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: var(--overlay);
}
.sheet {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: var(--space-2) var(--space-2) calc(var(--space-2) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--torque-raised-border);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--bg-panel);
  box-shadow: var(--shadow-drawer);
  color: var(--text-primary);
}
.sheet-reactions { display: flex; gap: var(--space-2); padding: var(--space-2); }
.sheet-reaction {
  flex: 1;
  min-height: 48px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: var(--torque-inset);
  font-size: 24px;
  cursor: pointer;
}
.sheet-item {
  min-height: 48px;
  padding: 0 var(--space-4);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.sheet-item:hover, .sheet-reaction:hover { background: var(--bg-hover); }
/* Plain text: the error colour is under 4.5:1 on the panel in both themes, and the dialog that
   follows carries the warning. */
.sheet-item.danger { color: var(--text-primary); }
.sheet-cancel { margin-top: var(--space-1); border-top: 1px solid var(--border-subtle); border-radius: 0; text-align: center; }
.sheet-item:focus-visible, .sheet-reaction:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.conv-actions { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; align-self: center; }
/* The header's "Pinned" button: the pin, and the count when there are any. */
.icon-button.header-pins { display: inline-flex; gap: var(--space-1); width: auto; min-width: 32px; padding: 0 var(--space-2); }
.icon-button.header-pins[aria-pressed="true"], .icon-button.header-media[aria-pressed="true"] { background: var(--bg-selected); color: var(--text-primary); }
/* "Pinned by Sam", above a pinned message's body. */
.pinned-label { display: flex; align-items: center; gap: var(--space-1); margin: 0; color: var(--text-secondary); }
.pinned-label .icon { width: 12px; height: 12px; flex: none; }
/* An entry in the Pinned panel: who pinned it and when, and Unpin, above the card's stretched
   button so they keep their own clicks. */
.pin-footer { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-top: var(--space-2); }
.pin-by { margin: 0; min-width: 0; }
/* The Media panel: images as a grid of squares, then "Files" as a list of cards. */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.media-thumb {
  box-sizing: border-box;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--torque-inset);
  cursor: pointer;
}
.media-thumb:hover { border-color: var(--border-control); }
.media-thumb:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.media-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.media-thumb-none { display: grid; place-items: center; width: 100%; height: 100%; color: var(--text-secondary); }
.media-files h3 { margin: 0 0 var(--space-2); color: var(--text-primary); }
.media-file-list { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.file-card.media-file { width: 100%; }
.media-file-open { display: block; max-width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.media-file-open:hover { text-decoration: underline; }
.media-file-open:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.icon-button[aria-expanded="true"] { background: var(--bg-hover); color: var(--text-primary); }
.menu-item.narrow-only { display: none; }

/* Channel menu on the sidebar "+" */
.menu-anchor { position: relative; }
.menu-backdrop { position: fixed; inset: 0; z-index: 10; }
.menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 11;
  display: flex;
  flex-direction: column;
  min-width: 180px;
  padding: var(--space-1);
  border: 1px solid var(--torque-raised-border);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  box-shadow: var(--shadow-raised);
}
.menu-item {
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.menu-item:hover { background: var(--bg-hover); }
.menu-item:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* Dialogs: the ChassisUI Modal (bundle.css .cui-scrim, .cui-modal). An overlay scrim with a 12px
   blur; the dialog in the page colour with radius-lg and shadow-drawer; a 24px Black title with
   a round close button. The edge is --torque-raised-border, as dark has no shadows.
   As tall as the screen allows, space-8 clear of its top and bottom (space-4 on a phone): the
   head (title and close) stays put, and only the body under it scrolls, with the footer pinned
   to the bottom of it. */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 0 var(--space-4);
  background: var(--overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.dialog {
  --torque-dialog-pad: var(--space-8);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: min(480px, 100%);
  max-height: calc(100% - 2 * var(--space-8));
  overflow: hidden;
  border: 1px solid var(--torque-raised-border);
  border-radius: var(--radius-lg);
  background: var(--bg-page);
  box-shadow: var(--shadow-drawer);
  color: var(--text-primary);
}
.dialog:focus { outline: none; }
/* The close button sits on the title's first line, however many lines the title takes. */
.dialog-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--torque-dialog-pad) var(--torque-dialog-pad) 0;
}
.dialog-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: var(--space-3);
  min-height: 0;
  overflow-y: auto;
  /* space-2 + space-3 under the title, as before the head was split off. */
  padding: calc(var(--space-2) + var(--space-3)) var(--torque-dialog-pad) var(--torque-dialog-pad);
}
/* web-page-title. Opaque: the dark heading colour is translucent, and the tight tracking
   overlaps glyphs, which then paint twice. */
.dialog .dialog-title {
  margin: 0;
  min-width: 0;
  font-size: 24px;
  line-height: 1.33;
  font-weight: 900;
  letter-spacing: -0.05em;
  color: var(--torque-heading-solid);
}
/* The round close button sits in the 32px row beside the title, so lift it into the corner. */
.dialog-close { margin-right: calc(-1 * var(--space-1)); }
.dialog p { margin: 0; }
.dialog-form { display: flex; flex-direction: column; gap: var(--space-3); }
.dialog label { display: flex; flex-direction: column; gap: var(--space-1); color: var(--text-secondary); }
.dialog label.check { flex-direction: row; align-items: center; gap: var(--space-2); color: var(--text-primary); }
/* Pinned to the bottom of the scrolling body, so the actions are always in view. */
.dialog-actions {
  position: sticky;
  bottom: calc(-1 * var(--torque-dialog-pad));
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin: 0 calc(-1 * var(--torque-dialog-pad)) calc(-1 * var(--torque-dialog-pad));
  padding: var(--space-4) var(--torque-dialog-pad) var(--torque-dialog-pad);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-page);
}
@media (max-width: 767px) {
  .dialog { --torque-dialog-pad: var(--space-6); max-height: calc(100% - 2 * var(--space-4)); }
  /* The 44px close button, centred on the title's 32px first line. */
  .dialog-close { margin-top: calc((32px - 44px) / 2); margin-bottom: calc((32px - 44px) / 2); }
}
.dialog .notice { margin: 0; }
.dialog-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.dialog-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.dialog-row-text { display: flex; flex-direction: column; min-width: 0; }
/* A person's name and email: a tap opens a DM with them (or adds them to a group). */
.dialog-row-pick {
  flex: 1;
  align-items: flex-start;
  margin: calc(-1 * var(--space-1)) 0;
  padding: var(--space-1) var(--space-2);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.dialog-row-pick:hover { background: var(--bg-hover); }
.dialog-row-pick:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.dialog-row-pick:disabled { cursor: default; background: transparent; }
.dialog-row { flex-wrap: wrap; }
.dialog-row-reason { display: none; flex-basis: 100%; margin: 0; color: var(--text-secondary); }
.dialog-row.is-blocked:hover .dialog-row-reason,
.dialog-row.is-blocked:focus-within .dialog-row-reason { display: block; }
.dialog-row.is-blocked .dialog-row-pick,
.dialog-row.is-blocked .dialog-row-pick .muted,
.dialog-row.is-blocked .dialog-row-pick:hover .muted,
.dialog-row.is-blocked .button { color: var(--text-faint); cursor: default; }
.dialog-row.is-blocked .dialog-row-pick:hover { background: transparent; }
.dialog-row-pick .t-web-caption { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
/* The muted line keeps AA on the hovered row (text-secondary is 4.4:1 on light bg-hover). */
.dialog-row-pick:hover:not(:disabled) .muted { color: var(--torque-meta-on-hover); }
.picked { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.picked-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-chip);
  background: var(--bg-selected);
  color: var(--text-primary);
}

/* Below 768px the sidebar and the conversation are separate screens. */
@media (max-width: 767px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .shell[data-screen="list"] .main-pane { display: none; }
  /* No conversation on this screen, so nothing to skip to. */
  .shell[data-screen="list"] .skip-link { display: none; }
  .shell[data-screen="conversation"] .sidebar { display: none; }
  .back { display: inline-block; }
  /* A tap on a message opens the action sheet instead of the hover bar. */
  .msg-actions { display: none; }
  /* Tap targets at least 44px square. */
  .item { min-height: 44px; box-sizing: border-box; }
  .icon-button, .thread-close { min-width: 44px; height: 44px; }
  .icon-button.header-menu { width: 44px; height: 44px; }
  /* The header keeps Back, the name and the menu; the topic is in the intro, and "Add People"
     moves into the menu. */
  .conv-header { height: 68px; }
  .conv-topic, .header-add-people { display: none; }
  /* "Pinned" and "Media" move into the menu too, when there is one. */
  .conv-actions.with-menu .header-pins, .conv-actions.with-menu .header-media { display: none; }
  .media-file-open { min-height: 44px; }
  /* Its own rule outranks the 44px one for icon buttons above. */
  .icon-button.header-pins { min-width: 44px; }
  .menu-item.narrow-only { display: block; min-height: 44px; }
  .menu-item { min-height: 44px; }
  /* Every small button: 32px is too small to tap. The md and lg sizes are 48px and up. */
  .button.small { min-height: 44px; }
  .back.button.small { display: inline-flex; }
  .composer-tools .icon-button, .attachment-remove { width: 44px; height: 44px; }
  .attachment-expiry-select { min-height: 44px; }
  .expiry-choices label.check { min-height: 44px; }
  .composer-tools { min-height: 52px; }
  /* Reactions, a thread's summary and a reply's caption: 44px to tap. */
  .reactions { gap: var(--space-2); }
  .reaction-chip { height: 44px; padding: 0 var(--space-3); }
  .thread-summary { min-height: 44px; box-sizing: border-box; }
  /* A checkbox or radio: the 20px box, with its whole label the 44px target. */
  label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) { min-height: 44px; }
  .reply-caption { display: block; line-height: 44px; }
  .picker-cell { height: 44px; }
  .picker-tab, .picker-tone { min-height: 44px; min-width: 44px; }
  .dialog-row-pick { min-height: 44px; }
  .slash-option { min-height: 44px; box-sizing: border-box; align-items: center; }
  .me-button { min-height: 44px; }
  .status-remove-emoji { min-height: 44px; }
  /* 44px square at least ("Add" in the people picker was 43 wide). */
  .button.small { min-width: 44px; }
  /* A link in a message: 44px tall to tap (13px over and under its 19px text box), by padding
     that doesn't move the lines round it. */
  .body a { padding-block: 13px; }
  /* A search hit's name: 44px tall, the negative margin keeping the card's layout. */
  .hit .hit-open { padding-block: 10px; margin-block: -10px; }
}

/* Threads: the panel sits to the right of the conversation. */
.conv-layout { position: relative; display: flex; flex: 1; min-height: 0; container-type: inline-size; }
.conv-layout > .conversation { min-width: 0; }
/* Too narrow for the conversation (360px) beside a 400px panel (a thread beside it, or the
   search results or a profile beside the whole pane): the panel covers the conversation from
   its right edge, as a drawer, rather than squeezing it to a sliver. */
@media (min-width: 768px) {
  @container (max-width: 759px) {
    :is(.conv-layout, .pane-row) > .thread-panel {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      z-index: 5;
      max-width: 100%;
      box-shadow: var(--shadow-drawer);
    }
  }
}
/* The thread, the search results (and any right-hand panel): one 400px width, edge included. */
.thread-panel {
  display: flex;
  flex-direction: column;
  flex: none;
  box-sizing: border-box;
  width: 400px;
  min-height: 0;
  border-left: 1px solid var(--border-subtle);
  background: var(--bg-page);
}
/* The same height as the conversation header, so their rules line up. */
.thread-header {
  box-sizing: border-box;
  height: 73px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-panel);
}
.thread-title { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.thread-title h2 { margin: 0; color: var(--heading); }
.thread-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-messages { flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-4); }
/* "2 replies": starts where the messages' text does, past the 36px avatar gutter. */
.thread-divider {
  margin: 0 0 var(--space-4);
  padding-left: calc(36px + var(--space-3));
  padding-bottom: var(--space-1);
  border-bottom: 1px solid var(--border-subtle);
}
.load-newer { display: block; margin: 0 auto; }
/* "Also send to #channel", in the reply box's control row, cut short if it must be. */
.also-send { display: flex; align-items: center; gap: var(--space-2); min-width: 0; margin-left: var(--space-2); color: var(--text-secondary); cursor: pointer; }
.also-send-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* "N replies · Last reply 14:05" under a thread root. */
.thread-summary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin: 2px 0;
  padding: 2px var(--space-2) 2px 2px;
  border-radius: var(--radius-sm);
  color: var(--torque-link);
  text-decoration: none;
}
.thread-summary:hover { background: var(--bg-panel); text-decoration: underline; }
.thread-summary:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.avatars { display: inline-flex; gap: 2px; }
/* Avatars: radius-sm up to 28px, radius-md from 32px; initials 11px or more. */
.avatar {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  background: var(--torque-inset);
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1;
}

/* Below 768px an open thread is its own screen, with Back in place of the close button. */
@media (max-width: 767px) {
  .shell[data-screen="panel"] .sidebar { display: none; }
  .shell[data-screen="panel"] .conv-layout > .conversation { display: none; }
  .thread-panel { flex: 1; width: auto; min-width: 0; border-left: 0; }
  .thread-close { display: none; }
  .thread-header { height: 68px; }
}

/* A calm note that something didn't load, with a way to try again. */
.inline-retry { margin: var(--space-2) var(--space-4); color: var(--text-secondary); }
.messages .inline-retry { margin: 0 0 var(--space-3); }
.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--torque-link);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.link-button:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* Frame: the design file's gradient behind the top strip and the sidebar, the same in both
   themes: DeGould Blue at the bottom right, falling to the app's darkest navy (bg/app) past the
   top left, with the main pane on it as a rounded panel. Its text and controls take the dark
   design's colours in both themes too. Measured under the sidebar at 1440 × 960: primary text
   7.5:1 or better, the rows' text 5.5:1, the muted headings 4.7:1 down to 800px (lower down they
   fall towards 4.2:1, where only the account row, in primary text, normally sits). */
.shell {
  --torque-frame: linear-gradient(-56.35deg, var(--brand-blue) 7.07%, var(--torque-dark-bg-app) 119.05%);
  --torque-on-frame: var(--torque-dark-text-primary);
  --torque-on-frame-soft: var(--torque-dark-text-nav);
  --torque-on-frame-accent: var(--torque-dark-accent-brand);
  --torque-frame-current: var(--torque-dark-accent-primary);
  /* The sidebar's section headings, its icons and the dismiss crosses: the muted text. */
  --torque-on-frame-heading: var(--torque-dark-text-muted);
  --torque-on-frame-muted: var(--torque-on-frame-soft);
  --torque-frame-hover: color-mix(in srgb, var(--on-deep) 10%, transparent);
  --torque-frame-selected: color-mix(in srgb, var(--on-deep) 20%, transparent);
  --torque-frame-rule: var(--torque-dark-border-subtle);
  /* The search box: a card on the frame; the notifications offer: only an edge. */
  --torque-frame-well: var(--torque-dark-bg-card);
  --torque-frame-well-hover: var(--torque-dark-bg-hover);
  --torque-frame-well-edge: var(--torque-dark-border-default);
  --torque-frame-offer-edge: var(--torque-dark-border-strong);
  box-sizing: border-box;
  padding-top: 60px;
  background: var(--torque-frame);
}
.main-pane {
  margin: 0 12px 12px 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px color-mix(in srgb, var(--ink) 35%, transparent);
}
/* Dark panels have no shadow: a 1px edge in the panel's border colour instead, inside its box as
   in the design (not on phones, where they fill the screen). */
@media (min-width: 768px) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .main-pane { border: 1px solid var(--border-panel); }
}
@media (min-width: 768px) {
  :root[data-theme="dark"] .main-pane { border: 1px solid var(--border-panel); }
}

/* The sidebar, on the frame. Only its own text is recoloured: the "+" menu inside it keeps the
   panel colours. */
.sidebar { background: transparent; border-right: 0; }
.sidebar .workspace { color: var(--torque-on-frame); border-bottom-color: var(--torque-frame-rule); }
.sidebar .section-head h2, .sidebar .section-head .icon-button { color: var(--torque-on-frame-soft); }
.sidebar .section-head .icon-button:hover { background: var(--torque-frame-hover); color: var(--torque-on-frame); }
.sidebar .item { justify-content: flex-start; color: var(--torque-on-frame-soft); }
/* The count on the frame: an edge in the frame's rule colour sets it apart where the frame and
   bg-section are both navy (dark). */
.sidebar .item .chip { margin-left: auto; box-shadow: 0 0 0 1px var(--torque-frame-rule); }
/* A channel with unread messages (and no mention chip): a cyan dot at the row's end. */
.sidebar .item .unread-dot { margin-left: auto; flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--ai-cyan); }
.sidebar .item:hover { background: var(--torque-frame-hover); }
/* The selected row: a solid fill in the primary button's blue, deepened a touch so white text on
   it is 4.6:1 (brand-blue itself is 3.5:1). */
.sidebar .item.selected { background: var(--torque-frame-current); color: var(--torque-on-frame); }
.sidebar .item.bold { color: var(--torque-on-frame); }
.sidebar .item:focus-visible, .sidebar .section-head .icon-button:focus-visible,
.sidebar .me-button:focus-visible { outline-color: var(--ai-cyan); }
.sidebar .me { border-top-color: var(--torque-frame-rule); }
.sidebar .me-button { color: var(--torque-on-frame); }
.sidebar .me-button:hover, .sidebar .me-button[aria-expanded="true"] { background: var(--torque-frame-hover); }
/* On the frame, in both themes: a white gap (3.5:1 or better on the gradient), a green disc in a
   navy rim for Active, a navy centre for Away. */
.sidebar {
  --torque-presence-active: var(--torque-dark-status-online);
  --torque-presence-busy: var(--status-error);
  --torque-presence-amber: var(--status-warning);
  --torque-presence-rim: var(--torque-dark-bg-app);
  --torque-presence-gap: var(--torque-dark-bg-app);
  /* No ring outside the dot on the frame, as in the design: its own dark rim sets it apart. */
  --torque-presence-ring: transparent;
  --torque-presence-edge: var(--torque-dark-bg-app);
  --torque-presence-away: var(--torque-dark-status-offline);
  --torque-presence-hollow: var(--torque-dark-bg-app);
}

/* Avatars: a rounded square of initials in the person's colour (format::avatar_hue), or a
   group's head count in slate. ChassisUI has no identity palette, so these eight are Torque's own
   (listed in the ChassisUI token notes); white initials are 5.1:1 or better on each. */
:root {
  --torque-avatar-0: #8e3b8a;
  --torque-avatar-1: #1f6f8b;
  --torque-avatar-2: #2f7a55;
  --torque-avatar-3: #a65a1e;
  --torque-avatar-4: #5b4bb7;
  --torque-avatar-5: #a33a4a;
  --torque-avatar-6: #7a5c12;
  --torque-avatar-7: #17675a;
}
.avatar[class*="hue-"] {
  flex: none;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--white);
  font-weight: 700;
}
.avatar.hue-0 { background: var(--torque-avatar-0); }
.avatar.hue-1 { background: var(--torque-avatar-1); }
.avatar.hue-2 { background: var(--torque-avatar-2); }
.avatar.hue-3 { background: var(--torque-avatar-3); }
.avatar.hue-4 { background: var(--torque-avatar-4); }
.avatar.hue-5 { background: var(--torque-avatar-5); }
.avatar.hue-6 { background: var(--torque-avatar-6); }
.avatar.hue-7 { background: var(--torque-avatar-7); }
.avatar.hue-group { background: var(--slate-600); }
/* A photo fills its square, corners and all; the initials come back if it fails to load. */
.avatar.has-photo { position: relative; overflow: hidden; }
.avatar-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.avatar.avatar-lg[class*="hue-"] { border-radius: var(--radius-md); color: var(--white); }
/* Every DM row has the one 32px avatar column, so its name starts at the same x with or without
   a job title under it; the margin leaves 8px between the presence dot's ring and the name. */
.item .avatar, .me-button .avatar { width: 32px; height: 32px; border-radius: var(--radius-md); font-size: 13px; }
.item .avatar-wrap, .me-button .avatar-wrap { margin-right: var(--space-2); }
.dialog-row-pick.has-avatar { flex-direction: row; align-items: center; gap: var(--space-3); }
.dialog-row-pick.has-avatar .avatar { width: 32px; height: 32px; border-radius: var(--radius-md); font-size: 13px; }
.dialog-row-lines { display: flex; flex-direction: column; min-width: 0; }

/* Phones: the list screen is the frame itself; the conversation and thread screens fill the
   screen as before. */
@media (max-width: 767px) {
  .shell { padding-top: 0; }
  .main-pane { margin: 0; border-radius: 0; box-shadow: none; }
}

/* Search: on a wide screen the box takes the top bar's width, on the gradient. */
.shell { position: relative; }
.top-search { flex: 1; min-width: 0; }
.search-form { position: relative; }
.search-input {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  font-family: inherit;
}
/* ChassisUI SearchField: a trailing magnifier and an italic placeholder. */
.search-icon {
  position: absolute;
  top: 0;
  right: var(--space-3);
  bottom: 0;
  display: flex;
  align-items: center;
  pointer-events: none;
  color: var(--heading);
}
.search-input::placeholder { font-style: italic; }
/* In the top strip: the magnifier leads, the placeholder is upright, and the box is a darker,
   slightly see-through navy with a faint edge. Soft text on it is 6:1 or better. */
.top-search .search-icon { right: auto; left: var(--space-4); color: var(--torque-on-frame-soft); }
.top-search .search-icon .icon { width: 16px; height: 16px; }
.top-search .search-input {
  height: 39px;
  padding: 0 var(--space-4) 0 calc(var(--space-4) + 16px + 10px);
  border: 1px solid var(--torque-frame-rule);
  border-radius: 10px;
  background: var(--torque-frame-well);
  color: var(--torque-on-frame);
  font-size: 15px;
}
.top-search .search-input::placeholder { color: var(--torque-on-frame-soft); font-style: normal; opacity: 1; }
.top-search .search-input:hover { background: var(--torque-frame-well-hover); }
.top-search .search-input:focus { outline: none; }
.top-search .search-input:focus-visible { outline: 2px solid var(--ai-cyan); outline-offset: 2px; }
/* The filters, under the box while it is focused and empty. Panel colours, like the menus. */
.search-hint {
  position: absolute;
  top: calc(100% + var(--space-1));
  left: 0;
  right: 0;
  z-index: 11;
  padding: var(--space-3);
  border: 1px solid var(--torque-raised-border);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  color: var(--text-secondary);
  box-shadow: var(--shadow-raised);
}
.search-hint[hidden] { display: none; }
.search-hint-title { margin: 0 0 var(--space-2); color: var(--text-primary); }
.search-hint ul { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.search-hint ul { align-items: center; }
/* ChassisUI Tag (bundle.css .cui-tag): 24px, radius-sm, 13px SemiBold Figtree on bg-section. */
.search-hint code {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--bg-section);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

/* The results take the right-hand panel, beside whichever conversation is open. */
.pane-row { position: relative; display: flex; flex: 1; min-height: 0; container-type: inline-size; }
.pane-main { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.search-panel {
  display: flex;
  flex-direction: column;
  flex: none;
  box-sizing: border-box;
  width: 400px;
  min-height: 0;
  border-left: 1px solid var(--border-subtle);
  background: var(--bg-page);
}
.search-results {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-4);
}
.search-results > p { margin: 0; }
.search-note { color: var(--text-secondary); }
.load-more { align-self: center; }
.hits { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
/* A hit is one card: its name is the button, stretched over the card, and the links and files
   in the message sit above it so they keep their own clicks. */
.hit {
  position: relative;
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
}
.hit:hover { background: var(--bg-hover); }
.hit-forward { margin: var(--space-1) 0 0; overflow: hidden; color: var(--text-secondary); text-overflow: ellipsis; white-space: nowrap; }
.hit-place { margin: 0 0 var(--space-2); overflow: hidden; color: var(--text-secondary); text-overflow: ellipsis; white-space: nowrap; }
.hit-conv { color: var(--text-primary); font-weight: 700; }
.hit-row { display: flex; align-items: flex-start; gap: var(--space-2); }
.hit-avatar.avatar { width: 28px; height: 28px; border-radius: var(--radius-sm); font-size: 12px; }
.hit-main { flex: 1; min-width: 0; }
.hit-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-2); }
.hit-open { padding: 0; border: 0; background: none; color: var(--text-emphasis); text-align: left; cursor: pointer; }
.hit-open::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-md); }
.hit-open:hover { text-decoration: underline; }
.hit-open:focus { outline: none; }
.hit-open:focus-visible::after { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.hit .body a, .hit .body .person-mention, .hit .msg-files { position: relative; z-index: 1; }
.hit .msg-files { margin-top: var(--space-1); }
.hit-note { margin: var(--space-2) 0 0; color: var(--text-secondary); }

/* A message reached from a search hit: highlighted for two seconds, fading out unless motion is
   reduced. */
.message.jump-target { background: var(--bg-selected); }
@media (prefers-reduced-motion: no-preference) {
  .message.jump-target { animation: torque-jump 2s ease-in forwards; }
}
@keyframes torque-jump {
  0%, 60% { background: var(--bg-selected); }
  100% { background: transparent; }
}

/* On a phone: a search button in the list's header, and search as a screen of its own. */
.sidebar .workspace { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
/* The identity block: the product, Torque's mark and the workspace on one line, all one link
   home. */
.identity {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
}
.identity:focus-visible { outline: 2px solid var(--ai-cyan); outline-offset: 2px; }
/* "TORQUE @ DeGould": all three centred on one line. Each word is trimmed to its capital
   height (none of these letters descend), so it's the letters that are centred, not the space
   the font keeps above and below them. */
.identity-text { display: flex; align-items: center; gap: var(--space-2); min-width: 0; line-height: 1; }
.identity-product, .identity-name { text-box: trim-both cap alphabetic; }
.identity-mark { flex: none; width: 1.3em; height: 1.3em; color: var(--torque-on-frame); }
.identity-name { font-size: 19px; font-weight: 700; letter-spacing: -0.03em; }
/* The product in the frame's accent: a logotype, and 4:1 or better on the frame all the same. */
.identity-product {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--torque-on-frame-accent);
}
.search-open { display: none; }
.sidebar .search-open { color: var(--torque-on-frame); }
.sidebar .search-open:hover { background: var(--torque-frame-hover); }
.sidebar .search-open:focus-visible { outline-color: var(--ai-cyan); }
.search-screen { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg-page); }
.search-screen-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-panel);
}
.search-screen .search-form { flex: 1; min-width: 0; }
.search-screen .search-input {
  min-height: 48px;
  padding: 0 var(--space-12) 0 var(--space-3);
  border: 1px solid var(--border-control);
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  color: var(--text-primary);
}
.search-screen .search-input::placeholder { color: var(--text-primary); opacity: 0.8; }
.search-screen .search-input:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
@media (max-width: 767px) {
  .search-open { display: inline-grid; place-items: center; }
  .shell[data-screen="search"] .sidebar, .shell[data-screen="search"] .main-pane { display: none; }
  .shell[data-screen="search"] .skip-link { display: none; }
  .search-results .load-more { min-height: 44px; }
}

/* Notification preferences (prefs_view): Preferences, a channel's notifications, and the
   "Notify anyway" line under the message box. */
.preferences .pref-section + .pref-section { padding-top: var(--space-3); border-top: 1px solid var(--border-subtle); }
.pref-group { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; padding: 0; border: 0; min-width: 0; }
.pref-group legend { margin-bottom: var(--space-1); padding: 0; color: var(--text-secondary); }
.dialog .pref-hint { margin-top: calc(-1 * var(--space-1)); }
.pref-hint:empty { display: none; }
.pref-times { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.pref-days { display: flex; flex-direction: column; gap: var(--space-1); color: var(--text-secondary); }
.pref-day-buttons { display: flex; flex-wrap: wrap; gap: var(--space-1); }
/* A weekday toggle: filled when picked. Not colour alone: the fill and the text both change. */
.day-toggle {
  min-width: 44px;
  min-height: 36px;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border-control);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
  cursor: pointer;
}
.day-toggle:hover { background: var(--bg-hover); }
.day-toggle[aria-pressed="true"] { border-color: var(--torque-accent); background: var(--torque-accent); color: var(--torque-on-accent); font-weight: 700; }
.day-toggle:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.pref-pause-buttons { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.pref-mute { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); }
.notify-anyway { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-2); }
.notify-anyway p { margin: 0; color: var(--text-secondary); }
.notify-anyway .button[aria-pressed="true"] { background: var(--torque-accent); border-color: var(--torque-accent); color: var(--torque-on-accent); }
/* Muted in the sidebar: never bold, the read colour even when unread, and a struck-through bell.
   The read colour is already the dimmest that keeps 4.5:1 where the list starts on the frame, so
   the bell (and "(muted)" for screen readers) says muted, not a dimmer grey. */
.sidebar .item.is-muted { color: var(--torque-on-frame-muted); }
.sidebar .item.is-muted.selected { color: var(--torque-on-frame); }
.item-muted { display: inline-flex; flex: none; align-items: center; }
@media (max-width: 767px) {
  .day-toggle { min-height: 44px; }
  .pref-group label.check, .preferences label.check { min-height: 44px; }
}

/* Sidebar sections. Each header is a collapse toggle (the heading itself; aria-expanded says
   whether it is open) with the name in small letter-spaced capitals, then the section's own
   buttons. */
.section-head { gap: var(--space-1); }
.section-title { flex: 1; min-width: 0; }
.section-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  box-sizing: border-box;
  width: 100%;
  min-height: 28px;
  padding: 0 var(--space-1);
  margin-left: calc(-1 * var(--space-1));
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.section-toggle:hover { background: var(--bg-hover); }
.section-toggle:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
/* A custom section's emoji, before its name. */
.section-icon { flex-shrink: 0; font-size: 14px; line-height: 1; }
.section-icon-img { width: 16px; height: 16px; object-fit: contain; }
/* A section with an unread conversation in it: the channel rows' cyan dot, after its name. */
.section-toggle .section-unread { margin-left: 2px; width: 6px; height: 6px; border-radius: 50%; background: var(--ai-cyan); flex-shrink: 0; }
.section-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sidebar .section-toggle { color: var(--torque-on-frame-heading); }
.sidebar .section-toggle:hover { background: var(--torque-frame-hover); color: var(--torque-on-frame); }
.sidebar .section-toggle:focus-visible { outline-color: var(--ai-cyan); }

/* A row's "⋯" sits over its right end, shown on hover or focus (always on touch screens). The
   label makes room for it rather than running under it. */
.side-row { position: relative; }
.item-tools { position: absolute; top: 0; right: var(--space-1); bottom: 0; display: flex; align-items: center; }
.item-more { display: inline-grid; place-items: center; opacity: 0; }
.side-row:hover .item-more, .side-row:focus-within .item-more, .item-more[aria-expanded="true"] { opacity: 1; }
.side-row:hover .item, .side-row:focus-within .item { padding-right: 36px; }
/* Pin or unpin, beside the "⋯", only while the pointer is over the row. */
.item-pin { display: none; place-items: center; }
.side-row:hover .item-pin { display: inline-grid; }
.side-row:hover .item { padding-right: 68px; }
.sidebar .item-more, .sidebar .item-pin { color: var(--torque-on-frame-soft); }
.sidebar .item-more:hover, .sidebar .item-more[aria-expanded="true"], .sidebar .item-pin:hover { background: var(--torque-frame-hover); color: var(--torque-on-frame); }
.sidebar .item-more:focus-visible, .sidebar .section-more:focus-visible { outline: 2px solid var(--ai-cyan); outline-offset: 2px; }
.menu-heading { margin: 0; padding: var(--space-1) var(--space-3); color: var(--text-secondary); }
.menu-item:disabled { color: var(--text-secondary); cursor: default; opacity: 0.6; }
.menu-item:disabled:hover { background: transparent; }

/* Dragging a row: a line where it would land, or the header it would join. */
.side-row.is-dragged { opacity: 0.5; }
.side-row.drop-before::before,
.items.drop-end::after {
  content: "";
  display: block;
  height: 2px;
  border-radius: 1px;
  background: var(--ai-cyan);
  pointer-events: none;
}
.side-row.drop-before::before { position: absolute; top: -1px; left: var(--space-1); right: var(--space-1); }
.items.drop-end::after { margin: 0 var(--space-1); }
.sidebar.is-dragging .items { min-height: var(--space-2); }
.section-head.drop-target .section-toggle { outline: 2px dashed var(--ai-cyan); outline-offset: -2px; background: var(--torque-frame-hover); }

/* "Your sidebar changed on another device." and save failures, for a few seconds. */
.sidebar-notice {
  margin: var(--space-3) var(--space-3) 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--torque-raised-border);
  border-radius: var(--radius-sm);
  background: var(--torque-inset);
  color: var(--text-primary);
}

@media (hover: none) {
  .item-more { opacity: 1; }
  .side-row:hover .item-pin { display: none; }
  .side-row .item { padding-right: 48px; }
}
@media (max-width: 767px) {
  .section-toggle { min-height: 44px; }
}

/* "Jump to…" (Cmd/Ctrl+K): near the top, so the list grows downwards as results come. */
.overlay:has(> .dialog.switcher) { align-items: start; }
.dialog.switcher { width: min(560px, 100%); margin-top: 10vh; }
.dialog.switcher .dialog-body { gap: var(--space-2); }
/* Padded so the active row's ring (offset 2px) isn't cut off by the scrolling list. */
.switcher-list {
  list-style: none;
  margin: 0;
  padding: var(--space-1);
  max-height: min(360px, 50vh);
  overflow-y: auto;
}
.switcher-list:empty { display: none; }
.switcher-option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 36px;
  box-sizing: border-box;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
}
.switcher-option:hover { background: var(--bg-hover); }
.switcher-option.active { background: var(--bg-selected); color: var(--text-emphasis); outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.switcher-option.unread .switcher-name { font-weight: 700; }
.switcher-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-detail { flex: none; color: var(--text-secondary); }
.switcher-empty:empty { display: none; }
@media (max-width: 767px) {
  .dialog.switcher { margin-top: 0; }
  .switcher-option { min-height: 44px; align-items: center; }
}

/* "Keyboard shortcuts" (Cmd/Ctrl+/). */
/* The table scrolls above the pinned footer when the screen is too short for all of it. */
.dialog.shortcuts-dialog { width: min(800px, 100%); }
.shortcuts-table { width: 100%; border-collapse: collapse; }
.shortcuts-table th { padding: 0 var(--space-4) var(--space-2) 0; color: var(--text-secondary); text-align: left; }
.shortcuts-table td { padding: var(--space-2) var(--space-4) var(--space-2) 0; border-top: 1px solid var(--border-subtle); vertical-align: baseline; }
.shortcuts-table td:last-child, .shortcuts-table th:last-child { padding-right: 0; }
/* The keys wrap between alternatives (" / "), never inside one, and keep space-4 from the action. */
.shortcut-keys { width: 45%; line-height: 1.75; }
.shortcut-sep { color: var(--text-secondary); }
.shortcut-keys kbd {
  white-space: nowrap;
  display: inline-block;
  padding: 0 var(--space-1);
  border: 1px solid var(--torque-raised-border);
  border-radius: var(--radius-sm);
  background: var(--torque-inset);
  color: var(--text-primary);
  font: inherit;
}

/* A person's job title: a smaller, lighter line under their name, cut short with an ellipsis
   (the full title is its tooltip). Under a one-to-one DM's name in the sidebar and its header,
   and under the author's name on a group's first message. */
.person-title {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: normal;
}
/* The header keeps its height: the name and title stack in the space the name had. */
.conv-title { display: flex; flex-direction: column; }
.conv-name-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
/* The app's mark follows the text colour, so it reads in both themes. */
.app-mark { display: inline-flex; flex: none; align-items: center; }
.app-mark svg { fill: currentColor; }
/* In a DM's header, the apps it is also in, as small named chips after the name. The heading's
   tracking is set back to the caption's; the edge is only a frame, as the name says it all. */
.app-chip {
  flex: none;
  padding: 0 6px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  letter-spacing: normal;
  line-height: 18px;
}
.conv-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Name and title as one block the height of the avatar beside it: 18 + 14 = 32 px next to a
   32 px avatar in the people picker. */
.dialog-row-pick.has-avatar .dialog-row-lines > :first-child { line-height: 18px; }
.dialog-row-pick.has-avatar .dialog-row-lines > :last-child { line-height: 14px; }

/* Profiles (profile_view): someone's profile in the right-hand panel (the thread panel's width
   and header), or a screen of its own on a phone. */
.profile-body { flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-6); }
.profile-loading { margin: 0; }
/* Focused only so a screen reader starts here: a heading, not a control, so no ring. */
.profile-heading:focus, .profile-heading:focus-visible { outline: none; }
.profile-card { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-4); }
.avatar.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-lg);
  color: var(--white);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.02em;
}
/* The presence dot, grown with the avatar and tucked onto its corner. */
.profile-avatar-wrap .presence { right: -4px; bottom: -4px; width: 20px; height: 20px; border-width: 3px; box-shadow: 0 0 0 3px var(--torque-presence-gap); }
.profile-avatar-wrap .presence.dnd::after { width: 10px; height: 3px; }
.profile-who { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; max-width: 100%; }
.profile-name { margin: 0; color: var(--torque-heading-solid); overflow-wrap: anywhere; }
.profile-title, .profile-status { margin: 0; color: var(--text-secondary); }
.profile-status { color: var(--text-primary); }
/* Label and value side by side, under a rule; the labels share one column. */
.profile-rows {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: var(--space-4);
  row-gap: var(--space-3);
  align-self: stretch;
  margin: 0;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}
.profile-row { display: contents; }
.profile-row dt { color: var(--text-secondary); line-height: 24px; }
.profile-row dd { margin: 0; min-width: 0; color: var(--text-primary); line-height: 24px; overflow-wrap: anywhere; }
.profile-row a, .profile-link { color: var(--torque-link); text-align: left; }
.profile-row a:focus-visible, .profile-link:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.profile-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.profile-actions:empty { display: none; }
/* Says "Copied" for a moment; an empty line takes no room. */
.profile-copied { margin: calc(-1 * var(--space-2)) 0 0; color: var(--text-secondary); }
.profile-copied:empty { display: none; }
.profile-card .notice { margin: 0; align-self: stretch; }
.profile-reports { align-self: stretch; padding-top: var(--space-4); border-top: 1px solid var(--border-subtle); }
.profile-reports h3 { margin: 0 0 var(--space-2); color: var(--torque-heading-solid); }
.profile-reports ul { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.profile-reports li { display: flex; flex-direction: column; }

/* What opens a profile: the author's avatar and name on a message, a mention, a one-to-one DM's
   name in its header. Each is a button that looks as it did before. */
.avatar-button, .msg-author, .conv-name-button, .person-mention {
  margin: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.avatar-button { display: block; padding: 0; border-radius: var(--radius-md); }
.msg-author { padding: 0; }
.msg-author:hover, .conv-name-button:hover { text-decoration: underline; }
.conv-name-button { padding: 0; color: inherit; }
/* A button, so it can't break across lines: kept whole, and cut with "…" in a very narrow
   column rather than becoming a box as wide as the column. */
.person-mention { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; padding: 0 2px; background: var(--bg-selected); color: var(--text-emphasis); font-weight: 600; border-radius: var(--radius-sm); }
.person-mention.mention-me { box-shadow: inset 0 0 0 1px var(--link); }
.person-mention:hover { text-decoration: underline; }
:is(.avatar-button, .msg-author, .conv-name-button, .person-mention, .item-avatar-button):focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
/* A DM row's avatar: a button over it, outside the row's link. */
.item-avatar-button {
  position: absolute;
  top: 50%;
  left: var(--space-2);
  width: 32px;
  height: 32px;
  margin-top: -16px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
}
.sidebar .item-avatar-button:focus-visible { outline-color: var(--ai-cyan); }
/* The people picker's "View profile of…", between the row and Add. */
.dialog-row-info { display: inline-grid; place-items: center; flex: none; color: var(--text-secondary); }

@media (max-width: 767px) {
  .shell[data-screen="profile"] .sidebar, .shell[data-screen="profile"] .main-pane { display: none; }
  .shell[data-screen="profile"] .skip-link { display: none; }
  .profile-body { padding: var(--space-4); }
  /* Message and Copy Number share the width. */
  .profile-actions { align-self: stretch; }
  .profile-actions .button { flex: 1; }
  .profile-own-mobile { align-items: stretch; }
  /* Each row is at least 44px, its label level with the value's first line (a value may wrap or
     have a second line). A link in it is 44px tall to tap, by padding that doesn't move the lines
     (13px over and under its 19px text box, as a message's links; an email address may wrap); a
     name button by a negative margin that keeps its line. */
  .profile-rows { row-gap: 0; }
  .profile-row dt, .profile-row dd { box-sizing: border-box; min-height: 44px; padding-block: 10px; }
  .profile-row a { padding-block: 13px; }
  .profile-link { display: inline-flex; align-items: center; min-height: 44px; vertical-align: top; }
  .profile-row .profile-link { margin-block: -10px; }
  .profile-reports ul { gap: 0; }
  .profile-reports li { padding: var(--space-1) 0; }
  .item-avatar-button { left: 2px; width: 44px; height: 44px; margin-top: -22px; }
  /* What opens a profile from a message or header: 44px to tap, by padding whose negative
     margin keeps the layout where it was. */
  .avatar-button { padding: 4px; margin: -4px; }
  /* The name's 44px reaches 20px up but only 4px down, so the job title's line under it is
     its own (and the title lets taps through where they overlap). */
  .msg-author { padding-block: 20px 4px; margin-block: -20px -4px; }
  .message .person-title, .conv-title .person-title { pointer-events: none; }
  .conv-name-button { padding-block: 6px; margin-block: -6px; }
  /* The header's title box would clip the name button's 44px. */
  .conv-title { overflow: visible; }
  .conv-name-button { max-width: 100%; }
  /* A mention keeps its 24px chip, drawn behind the text, inside a 44px tall button. */
  .person-mention {
    position: relative;
    z-index: 1;
    isolation: isolate;
    padding: 10px 2px;
    margin-block: -10px;
    background: none;
    box-shadow: none;
  }
  .person-mention::before {
    content: "";
    position: absolute;
    inset: 10px 0;
    z-index: -1;
    border-radius: var(--radius-sm);
    background: var(--bg-selected);
  }
  .person-mention.mention-me, .person-mention.mention-me::before { box-shadow: none; }
  .person-mention.mention-me::before { box-shadow: inset 0 0 0 1px var(--link); }
}

/* Your own mobile (mobile_view): its status in the Mobile row, and Add or Remove just under the
   rows, pulled up to the rows. */
.profile-own-mobile { display: flex; flex-direction: column; align-items: flex-start; margin-top: calc(-1 * var(--space-2)); }
.profile-own-mobile p, .profile-pending { margin: 0; }
.own-pending { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
.own-pending-who { display: block; color: var(--text-secondary); }
.profile-own-number > a + .own-pending { margin-top: var(--space-1); }

/* ChassisUI's Tag (bundle.css .cui-tag), with a status icon so it never relies on colour:
   neutral (Off), or warning. */
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  box-sizing: border-box;
  width: max-content;
  height: 24px;
  padding: 0 var(--space-2) 0 6px;
  border-radius: var(--radius-sm);
  background: var(--torque-tag-fill);
  box-shadow: inset 0 0 0 1px var(--torque-tag-edge);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  vertical-align: middle;
}
.status-tag::before {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: var(--torque-off-icon) center / contain no-repeat;
  mask: var(--torque-off-icon) center / contain no-repeat;
}
/* The word in text-primary (dark's warning orange on its tint is 3.9:1); the icon in the warning
   colour. Light's status-warning-fg is ink, so it's the same there. */
.status-tag.warning { background: var(--status-warning-subtle); box-shadow: none; color: var(--text-primary); }
.status-tag.warning::before {
  background: var(--status-warning-fg);
  -webkit-mask-image: var(--torque-error-icon);
  mask-image: var(--torque-error-icon);
}
/* Health states (admin Overview and Teams): each a tint, an icon of its own and its word, the
   word and icon in text-primary, so neither depends on the tint's contrast. */
.status-tag.healthy { background: var(--status-success-subtle); box-shadow: none; color: var(--text-primary); }
.status-tag.healthy::before {
  -webkit-mask-image: var(--torque-healthy-icon);
  mask-image: var(--torque-healthy-icon);
}
.status-tag.broken { background: var(--status-error-subtle); box-shadow: none; color: var(--text-primary); }
.status-tag.broken::before {
  -webkit-mask-image: var(--torque-broken-icon);
  mask-image: var(--torque-broken-icon);
}

/* Under a code field: "Send Another Code" and "Use a Different Number" (or Email), as links on
   the field's left edge. */
.code-again { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-4); }
.link-button:disabled { color: var(--text-secondary); text-decoration: none; cursor: not-allowed; opacity: 0.6; }
.mobile-dialog [role="status"]:empty { display: none; }
/* The approval dialog's rows: the profile's label and value columns, without its rule. */
.dialog .approval-rows { padding-top: 0; border-top: 0; }
.approval-title { display: block; }

/* The admin area (admin/mod.rs): its own side menu in place of the conversation list, beside
   the section, inside the main pane. On a phone the side menu opens as a sheet from "Menu". */
.shell.admin-area { grid-template-columns: minmax(0, 1fr); }
.shell.admin-area > .sidebar { display: none; }
.shell.admin-area > .main-pane { margin-left: var(--space-2); }
.admin-layout { display: flex; flex: 1; min-height: 0; }
.admin-nav {
  box-sizing: border-box;
  flex: none;
  display: flex;
  flex-direction: column;
  width: 240px;
  padding: var(--space-4) var(--space-2);
  overflow-y: auto;
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-panel);
}
.admin-content { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.admin-nav-list { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.admin-nav-list .admin-nav-list { margin-top: 2px; padding-left: var(--space-4); }
.admin-nav-item {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-decoration: none;
}
.admin-nav-item:hover { background: var(--bg-hover); }
.admin-nav-item[aria-current="page"] { background: var(--bg-selected); font-weight: 700; }
/* The section a page sits within (Integrations over Slack): bold, without the fill. */
.admin-nav-item[aria-current="true"] { font-weight: 700; }
.admin-nav-item:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.admin-nav-back { margin-top: var(--space-4); padding-top: var(--space-2); border-top: 1px solid var(--border-subtle); border-radius: 0; }
.admin-menu-button { display: none; }
/* The sheet: the Modal along the bottom of the screen. */
.dialog.admin-menu-sheet {
  --torque-dialog-pad: var(--space-4);
  align-self: end;
  justify-self: stretch;
  width: auto;
  max-height: 85vh;
  margin: 0 calc(-1 * var(--space-4));
  padding-bottom: env(safe-area-inset-bottom);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.admin-menu-sheet .dialog-body nav { display: flex; flex-direction: column; padding-bottom: var(--space-4); }
@media (max-width: 767px) {
  .shell.admin-area > .main-pane { margin-left: 0; }
  .admin-nav { display: none; }
  .admin-menu-button.button.small { display: inline-flex; }
  .admin-nav-item { min-height: 44px; }
}

/* The admin "Emergency Sign-In" page (admin_view): a header as a conversation's, then sections. */
.admin-page { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.admin-body { flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-6); }
.admin-loading { margin: 0; }
.admin-section { display: flex; flex-direction: column; gap: var(--space-3); max-width: 720px; }
.admin-section + .admin-section { margin-top: var(--space-8); padding-top: var(--space-6); border-top: 1px solid var(--border-subtle); }
.admin-section h2 { margin: 0; color: var(--torque-heading-solid); }
.admin-section h2:focus { outline: none; }
.admin-section h2:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.admin-section p { margin: 0; }
.admin-section .notice { margin: 0; }
/* Nothing waiting is a calm state: the compact EmptyState on the section's left edge. */
.admin-section .empty-state { align-items: flex-start; max-width: none; margin: 0; padding: var(--space-2) 0; text-align: left; }
.admin-section .empty-state-icon { color: var(--text-secondary); }
/* The state: a Tag (On, in the warning tone, or Off), then until when and who switched it on. */
.admin-state { color: var(--text-primary); }
.admin-state .status-tag { margin-right: var(--space-1); }
.admin-actions, .admin-reauth { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.request-list, .audit-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.request-row, .audit-row { padding: var(--space-3) 0; border-bottom: 1px solid var(--border-subtle); }
.request-row:last-child, .audit-row:last-child { border-bottom: 0; }
.request-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-3); }
.request-text, .audit-row { display: flex; flex-direction: column; min-width: 0; }
.request-title { display: block; }
.request-actions { display: flex; gap: var(--space-2); }
.audit-meta { overflow-wrap: anywhere; }
/* The admin Slack page (slack_admin_view): public channels' imports and who hasn't linked. */
.slack-import-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.slack-import-row { display: flex; flex-direction: column; min-width: 0; padding: var(--space-3) 0; border-bottom: 1px solid var(--border-subtle); overflow-wrap: anywhere; }
.slack-import-row:last-child { border-bottom: 0; }
.slack-import-name .status-tag { margin-left: var(--space-1); }
/* The admin People table and person page (admin/people.rs). The table is wider than a phone:
   it scrolls sideways inside its own box, never the page. */
.admin-section.admin-wide { max-width: none; }
.admin-section .profile-rows { padding-top: 0; border-top: 0; }
.people-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); }
.people-controls .search-field { flex: 1 1 280px; }
.audit-toggle { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; color: var(--text-primary); }
.audit-toggle input { width: 20px; height: 20px; }
.audit-head { padding: var(--space-2) var(--space-3); color: var(--text-secondary); text-align: left; }
.audit-details { overflow-wrap: anywhere; }
.audit-actor { min-height: 44px; padding: 0; border: 0; background: none; color: var(--torque-link); font: inherit; text-decoration: underline; cursor: pointer; }
.audit-actor:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.people-filter { display: flex; flex: 0 1 260px; flex-direction: column; gap: var(--space-1); color: var(--text-secondary); }
.people-table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); }
.people-table-wrap:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
/* A newer list is on its way: what is shown dims until it comes. */
.people-table-wrap.is-busy { opacity: 0.6; }
.people-table { width: 100%; border-collapse: collapse; color: var(--text-primary); }
.people-table th, .people-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
.people-table tbody tr:last-child > * { border-bottom: 0; }
.people-table thead th { padding: 0; background: var(--bg-panel); }
.people-table tbody th { font-weight: 400; }
.people-sort {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  box-sizing: border-box;
  width: 100%;
  min-height: 36px;
  padding: 0 var(--space-3);
  border: 0;
  background: none;
  color: var(--text-secondary);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.people-sort:hover { background: var(--bg-hover); color: var(--text-primary); }
.people-sort:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.people-table th[aria-sort] .people-sort { color: var(--text-primary); }
.people-name { color: var(--torque-link); }
.people-name:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.people-number { font-variant-numeric: tabular-nums; }
@media (max-width: 767px) {
  .people-sort { min-height: 44px; }
  .people-name { display: inline-flex; align-items: center; min-height: 44px; }
  .people-filter { flex-basis: 100%; }
}

@media (max-width: 767px) {
  /* The admin page and an approval link are screens of their own. */
  .shell[data-screen="page"] .sidebar { display: none; }
  .admin-body { padding: var(--space-4); }
  .admin-actions .button, .admin-reauth .button { flex: 1; }
  .request-actions { flex: 1 1 100%; }
  .request-actions .button { flex: 1; }
  .code-again .link-button { min-height: 44px; }
}

/* The sign-in screen (sign_in_view): Microsoft first, then signing in by text in the same panel. */
.panel.sign-in { box-sizing: border-box; width: min(440px, calc(100vw - 2 * var(--space-4))); padding: var(--space-8); }
.sign-in > .button { align-self: stretch; }
.sign-in .notice { margin: 0; align-self: stretch; }
.sign-in-alt { text-align: center; }
.sign-in-text, .sign-in-form { display: flex; flex-direction: column; gap: var(--space-3); align-self: stretch; }
.sign-in-title { margin: 0; color: var(--torque-heading-solid); text-align: center; }
.sign-in-form label { display: flex; flex-direction: column; gap: var(--space-1); color: var(--text-secondary); }
.panel .sign-in-form p { margin: 0; }
.panel .sign-in-sent { color: var(--text-primary); }
.sign-in-address { overflow-wrap: anywhere; }
.sign-in-error:empty, .sign-in-wait:empty { display: none; }
.sign-in-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.sign-in-actions .button { flex: 1 1 auto; }

.button[aria-busy="true"] { cursor: progress; }
/* A calmer notice: the warning tint and edge, with the same icon in the warning colour. */
.notice.warning { border-color: var(--status-warning); background: var(--status-warning-subtle); }
.notice.warning::before { background: var(--status-warning-fg); }

/* Strips across the top, under the frame's top strip: while signed in by text, and reminding an
   admin that their sign-in by text is about to lapse. */
.shell.has-banner { grid-template-rows: auto minmax(0, 1fr); }
.shell.has-banner > .sidebar, .shell.has-banner > .main-pane { grid-row: 2; }
.shell-banners {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0 var(--space-2) var(--space-2);
}
.shell:not(.has-banner) > .shell-banners { display: none; }
.text-session-banner, .shell-banners .notice {
  margin: 0;
  border: 1px solid var(--status-warning);
  border-radius: var(--radius-sm);
  /* The tint is see-through: laid on the panel colour, not on the gradient frame. */
  background: linear-gradient(var(--status-warning-subtle), var(--status-warning-subtle)), var(--bg-panel);
  color: var(--text-primary);
}
.text-session-banner { padding: var(--space-1) var(--space-3); text-align: center; }
/* Status is word and icon: the warning notice's icon, in line before the words. */
.text-session-banner::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: var(--space-2);
  vertical-align: -3px;
  background: var(--status-warning-fg);
  -webkit-mask: var(--torque-error-icon) center / contain no-repeat;
  mask: var(--torque-error-icon) center / contain no-repeat;
}
/* The reminder: the words, then its two buttons. */
.admin-reminder { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.admin-reminder p { flex: 1 1 280px; margin: 0; }
.admin-reminder-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

@media (max-width: 767px) {
  .panel.sign-in { padding: var(--space-6) var(--space-4); }
  .sign-in .link-button { min-height: 44px; }
  .sign-in-actions .button { flex-basis: 100%; }
  .shell-banners { margin: 0; gap: 0; }
  .text-session-banner, .shell-banners .notice, .notify-bar { border-width: 0 0 1px; border-radius: 0; }
  .admin-reminder-actions { flex: 1 1 100%; }
  .admin-reminder-actions .button { flex: 1; }
}

/* The admin Channels pages (admin/channels.rs): a channel's name with its tags, its members with
   the owner tagged, and the owner picker's list. */
.channels-name { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.channel-members { display: flex; flex-direction: column; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.channel-member { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.channel-owner-list { display: flex; flex-direction: column; gap: var(--space-2); max-height: 50vh; margin: 0; padding: 0; overflow-y: auto; border: 0; }
.channel-owner-list legend { margin-bottom: var(--space-2); padding: 0; color: var(--text-secondary); }
/* Change Expiry (the sender's and an admin's): the choices, each with the date it gives. */
.expiry-choices { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; padding: 0; border: 0; }
.expiry-choices legend { margin-bottom: var(--space-2); padding: 0; color: var(--text-secondary); }
.expiry-file { overflow-wrap: anywhere; color: var(--text-primary); }
.expiry-date { padding-left: calc(20px + var(--space-2)); }
/* The admin Files table: a long name is cut short (its whole name is its tooltip). */
.files-table .files-name { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.files-table thead th.audit-head { padding: var(--space-2) var(--space-3); }
.files-row-expired > * { color: var(--text-secondary); }
.files-total { color: var(--text-primary); font-variant-numeric: tabular-nums; }
/* Shown but not usable (a channel synced with Slack): still focusable, so its reason is heard. */
.admin-actions .button[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
@media (max-width: 767px) {
  .channel-owner-list label.check { min-height: 44px; }
  .channel-member { min-height: 44px; }
}

/* The "App" tag after an app's name: ChassisUI's Tag (bundle.css .cui-tag), as .status-tag
   without the icon. */
.app-tag {
  flex: none;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  height: 24px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--torque-tag-fill);
  box-shadow: inset 0 0 0 1px var(--torque-tag-edge);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

/* Slack: the gate in place of the message box, and a message that never reached Slack. */
.slack-gate .join-row { flex-wrap: wrap; }
.teams-failed, .slack-failed { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); color: var(--text-secondary); }

/* Shared mailboxes. Every reply in a mailbox thread is an email: the banner over its box stays,
   in the warning tint with primary text (well over 4.5:1 in both themes). */
.email-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin: 0 0 var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--status-warning);
  border-radius: var(--radius-sm);
  background: var(--status-warning-subtle);
  color: var(--text-primary);
}
.email-banner .icon { flex: none; }
/* Under a mailbox thread's box: Enter adds a line there, so it says how to send. */
.email-hint {
  margin: var(--space-1) 0 0;
  color: var(--text-secondary);
}
/* An email's sender: the From name and address, "External", and a warning when the name is a
   colleague's. It wraps on a narrow column rather than cutting the address. */
.msg-header:has(.email-from) { flex-wrap: wrap; }
.email-from { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-2); min-width: 0; }
.email-from .msg-author:hover { text-decoration: none; }
.email-from .app-tag { align-self: center; }
.email-address { color: var(--text-secondary); overflow-wrap: anywhere; }
.email-warning { padding: 0 var(--space-1); border-radius: var(--radius-sm); background: var(--status-warning-subtle); color: var(--text-primary); }
.email-outlook { flex: none; color: var(--text-secondary); }
/* A mailbox reply's email: on its way, or not sent with Retry. */
.email-sending { margin: 0; color: var(--text-secondary); }
.email-failed { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); color: var(--text-primary); }

/* A short confirmation at the foot of the window. */
.toast-region { position: fixed; left: 0; right: 0; bottom: var(--space-4); z-index: 60; display: flex; justify-content: center; padding: 0 var(--space-4); pointer-events: none; }
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  color: var(--text-primary);
  box-shadow: var(--shadow-raised);
  pointer-events: auto;
}
@media (max-width: 767px) {
  .toast .link-button { min-height: 44px; min-width: 44px; }
}

/* The admin Default Channels page: a channel's name, a Slack note under it, and its button. */
.default-list { border-top: 1px solid var(--border-subtle); }
.default-row .dialog-row-text { flex: 1; }
@media (max-width: 767px) {
  .default-row .button { min-height: 44px; }
}

/* The admin Overview: the headline numbers, then a card per integration, edged in its state's
   colour (the tag inside says the state in words and an icon too). One card a row on phones. */
.overview-numbers { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-8); margin: 0; }
.overview-number { display: flex; flex-direction: column; gap: var(--space-1); }
.overview-number dt { color: var(--text-secondary); }
.overview-number dd { margin: 0; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}
.health-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--border-panel);
  border-left: 4px solid var(--border-panel);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
}
.health-card h3 { margin: 0; color: var(--text-primary); }
.health-card p { margin: 0; color: var(--text-secondary); }
.health-card.healthy { border-left-color: var(--status-success); }
.health-card.warning { border-left-color: var(--status-warning); }
.health-card.broken { border-left-color: var(--status-error); }
.teams-unlinked { display: flex; flex-direction: column; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.teams-unlinked a { display: inline-flex; align-items: center; min-height: 32px; color: var(--torque-link); }
.teams-unlinked a:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
@media (max-width: 767px) {
  .health-grid { grid-template-columns: 1fr; }
  .teams-unlinked a { min-height: 44px; }
}

/* Apps: an app's icon where a person's initials would be (20px in the sidebar, 36px on a
   message and the admin Apps page). An app's name and icon on a message open nothing. */
.app-icon {
  display: block;
  flex: none;
  box-sizing: border-box;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  background: var(--torque-inset);
  object-fit: cover;
}
.app-icon.app-icon-lg { width: 36px; height: 36px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }
span.avatar-button, span.msg-author { cursor: default; }
span.msg-author:hover { text-decoration: none; }
/* In place of the message box in a DM with an app. */
.app-read-only p { margin: 0; color: var(--text-secondary); }
.conv-header .app-tag { margin-left: var(--space-2); }

/* The admin Apps page: one app a row, its icon beside its name, details and buttons. */
.app-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border-subtle); }
.app-row { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-4) 0; border-bottom: 1px solid var(--border-subtle); }
.app-row-text { display: flex; flex: 1; flex-direction: column; gap: var(--space-1); min-width: 0; }
.app-row-name { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0; color: var(--text-primary); overflow-wrap: anywhere; }
.app-row-actions { margin-top: var(--space-2); }
.app-key { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2); }
.app-key-label { display: flex; flex: 1 1 240px; flex-direction: column; gap: var(--space-1); min-width: 0; }
.app-key-field { width: 100%; font-variant-numeric: tabular-nums; }
.app-channels-dialog .dialog-section-title { margin: var(--space-2) 0 0; }
@media (max-width: 767px) {
  .app-key .button { min-height: 44px; }
  .app-row-actions .button { flex: 1 1 auto; }
}

/* Charts (admin/charts.rs): SVG drawn one unit to the pixel, so it fills its container's width
   and text stays 12px on a phone. Series wear --torque-chart-N; words, numbers, grid and axes
   wear text and border tokens. Lines 2px, dots 8px with a 2px ring in the surface colour, bars
   16px with a rounded data end; the grid is a recessive solid hairline. */
.chart { --chart-surface: var(--bg-page); display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; margin: 0; }
.chart-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); }
.chart-head h2 { margin: 0; color: var(--torque-heading-solid); }
.chart-plot { position: relative; min-width: 0; border-radius: var(--radius-sm); touch-action: pan-y; }
.chart-plot:focus { outline: none; }
.chart-plot:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 4px; }
.chart-plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid { stroke: var(--border-subtle); stroke-width: 1; shape-rendering: crispEdges; }
.chart-axis { stroke: var(--border-panel); stroke-width: 1; shape-rendering: crispEdges; }
.chart-tick, .chart-label, .chart-value { font-family: inherit; font-size: 12px; font-variant-numeric: tabular-nums; }
.chart-tick { fill: var(--text-secondary); }
.chart-label { fill: var(--text-primary); font-size: 13px; }
.chart-value { fill: var(--text-primary); font-weight: 700; }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { stroke: var(--chart-surface); stroke-width: 2; }
.chart-crosshair { stroke: var(--text-secondary); stroke-width: 1; shape-rendering: crispEdges; }
/* A bar's row: the pointer's (or the keyboard's) row lifts on the selected wash. */
.chart-hit { fill: transparent; }
.chart-hit.is-active { fill: var(--bg-selected); }
.chart-tooltip {
  position: absolute;
  z-index: 1;
  box-sizing: border-box;
  max-width: min(240px, 45vw);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--torque-raised-border);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  box-shadow: var(--shadow-raised);
  color: var(--text-primary);
  overflow-wrap: anywhere;
  pointer-events: none;
}
.chart-tooltip-title { margin: 0 0 var(--space-1); color: var(--text-secondary); }
.chart-tooltip ul { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.chart-tooltip li { display: flex; align-items: baseline; gap: var(--space-2); }
.chart-tooltip strong { font-variant-numeric: tabular-nums; }
.chart-tooltip-name { color: var(--text-secondary); }
/* A series' key: a short stroke of its colour, as its line is drawn. */
.chart-key { display: inline-block; flex: none; width: 14px; height: 2px; border-radius: 1px; vertical-align: middle; align-self: center; }
.chart-legend { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); margin: 0; padding: 0; list-style: none; color: var(--text-primary); }
.chart-legend li { display: inline-flex; align-items: center; gap: var(--space-2); }
.chart-legend .chart-key { width: 16px; }
.chart-empty { margin: 0; }
/* The table view: a year of days scrolls inside its own box, never the page. */
.chart-table-wrap { max-width: 100%; max-height: 360px; overflow: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); }
.chart-table-wrap:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.chart-table { width: 100%; border-collapse: collapse; color: var(--text-primary); }
.chart-table th, .chart-table td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border-subtle); text-align: left; white-space: nowrap; }
.chart-table thead th { position: sticky; top: 0; background: var(--bg-panel); color: var(--text-secondary); }
.chart-table tbody th { font-weight: 400; }
.chart-table tbody tr:last-child > * { border-bottom: 0; }
.chart-table .chart-num { text-align: right; font-variant-numeric: tabular-nums; }

/* The Stats page (admin/stats.rs): the range row on top, then the charts, the two "active
   people" charts side by side where there is room. Charts sit in grid tracks of minmax(0, 1fr)
   so their width follows the track, never their drawing. */
.stats-body { display: flex; flex-direction: column; gap: var(--space-8); }
.stats-filters { display: inline-flex; align-self: flex-start; flex-wrap: wrap; border: 1px solid var(--border-control); border-radius: var(--radius-sm); overflow: hidden; }
.stats-range-button {
  min-width: 44px;
  min-height: 36px;
  padding: var(--space-1) var(--space-3);
  border: 0;
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
  cursor: pointer;
}
.stats-range-button + .stats-range-button { border-left: 1px solid var(--border-control); }
.stats-range-button:hover { background: var(--bg-hover); }
/* Pressed: filled, and bold, so it isn't colour alone. */
.stats-range-button[aria-pressed="true"] { background: var(--torque-accent); color: var(--torque-on-accent); font-weight: 700; }
.stats-range-button:focus-visible { position: relative; outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.stats-charts, .stats-activity { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-8); min-width: 0; }
/* Newer figures are on their way: what is shown dims until they come. */
.stats-charts.is-busy, .stats-comparison.is-busy { opacity: 0.6; }
.stats-comparison { min-width: 0; }
.stats-pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-8); min-width: 0; }
@media (min-width: 1100px) {
  .stats-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.stats-activity { gap: var(--space-4); padding-top: var(--space-6); border-top: 1px solid var(--border-subtle); }
.stats-picker { display: flex; flex-direction: column; gap: var(--space-3); }
.stats-people { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.stats-people:empty { display: none; }
.stats-person { display: inline-flex; align-items: center; gap: var(--space-2); padding-left: var(--space-3); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); color: var(--text-primary); }
.stats-person .chart-key { width: 16px; }
.stats-add { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.stats-add p { margin: 0; }
.stats-add .button[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.stats-candidate .status-tag { vertical-align: middle; }
@media (max-width: 767px) {
  .stats-range-button { min-height: 44px; }
  .stats-remove { width: 44px; height: 44px; }
}

/* The admin Retention & Export page: the request waiting for approval as a list of facts, then
   one export a row with its state tag beside its name. */
.retention-pending { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4); border: 1px solid var(--border-panel); border-radius: var(--radius-md); background: var(--bg-panel); }
.retention-pending h3 { margin: 0; color: var(--text-primary); }
.retention-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-1) var(--space-4); margin: 0; }
.retention-facts dt { color: var(--text-secondary); }
.retention-facts dd { margin: 0; color: var(--text-primary); }
.retention-reason, .export-reason { overflow-wrap: anywhere; white-space: pre-wrap; }
.retention-period { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-3); }
.retention-reason-field { min-height: 96px; resize: vertical; }
.export-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border-subtle); }
.export-row { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-4) 0; border-bottom: 1px solid var(--border-subtle); }
.export-row-name { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0; color: var(--text-primary); }
.export-row-actions:empty { display: none; }
.export-row-actions { margin-top: var(--space-2); }
.export-dates { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-3); }
.export-pick-list { display: flex; flex-direction: column; gap: var(--space-2); max-height: 40vh; margin: 0; padding: 0; overflow-y: auto; border: 0; }
.export-pick-list legend { margin-bottom: var(--space-2); padding: 0; color: var(--text-secondary); }
.export-people .dialog-row-text { flex: 1; }
@media (max-width: 767px) {
  .retention-facts { grid-template-columns: minmax(0, 1fr); }
  .retention-facts dd + dt { margin-top: var(--space-2); }
  .retention-period, .export-dates { grid-template-columns: minmax(0, 1fr); }
  .export-picked .icon-button { width: 44px; height: 44px; }
}

/* A forwarded message: the search card's border and surface, quieter, under the note. */
.forward-card {
  margin-top: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-subtle);
  border-left-width: 3px;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
}
.forward-header { margin: 0 0 var(--space-1); color: var(--text-secondary); }
.forward-arrow { margin-right: var(--space-1); }
.forward-from strong { color: var(--text-primary); font-weight: 700; }
.forward-card .msg-files, .forward-card .msg-gif-row { margin-top: var(--space-1); }
.forward-original { display: inline-block; margin-top: var(--space-1); color: var(--text-emphasis); }

/* Cards for a message's links, under its text: a page or video (site, title, two lines of
   description, picture), an image shown as itself, or a linked message in the forward card.
   The author's "Remove preview" sits beside each, shown on hover or focus (always on touch). */
.link-previews { display: flex; flex-direction: column; gap: var(--space-1); margin-top: var(--space-1); }
.link-preview { display: flex; align-items: flex-start; gap: var(--space-1); max-width: 560px; }
.link-preview > .forward-card { flex: 1; min-width: 0; margin-top: 0; }
.link-card {
  display: flex;
  flex: 1;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-subtle);
  border-left-width: 3px;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  color: var(--text-primary);
  text-decoration: none;
}
.link-card:hover { border-color: var(--border-control); }
.link-card:focus-visible, .link-image:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.link-card-text { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.link-card-site { color: var(--text-secondary); }
.link-card-title { color: var(--text-emphasis); font-weight: 700; overflow-wrap: anywhere; }
.link-card:hover .link-card-title { text-decoration: underline; }
.link-card-desc {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.link-card-thumb {
  position: relative;
  flex: none;
  width: 72px;
  height: 72px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--torque-inset);
}
.link-card.video .link-card-thumb { width: 128px; height: 72px; }
.link-card-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.link-card-thumb .play-mark { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.link-image { display: inline-flex; flex-direction: column; gap: 2px; min-width: 0; max-width: 100%; color: var(--text-secondary); text-decoration: none; }
.link-image-frame {
  display: block;
  box-sizing: border-box;
  max-width: 100%;
  height: auto;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--torque-inset);
}
.link-image-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
.link-image:hover .link-image-frame { border-color: var(--border-control); }
.link-image:hover .link-image-host { text-decoration: underline; }
.link-preview-remove { width: 24px; height: 24px; color: var(--text-secondary); opacity: 0; }
.message:hover .link-preview-remove, .message:focus-within .link-preview-remove { opacity: 1; }
@media (hover: none) { .link-preview-remove { width: 44px; height: 44px; opacity: 1; } }

/* The Forward dialog reuses the switcher's list; the pick stays marked while you add a note. */
.switcher-option.picked { font-weight: 700; }
.forward-to { margin: 0; color: var(--text-secondary); }
.forward-note { resize: vertical; min-height: 64px; }


/* The design file ("Torque – Dark Theme", frame 1440 × 960). Colours come from the tokens above;
   these are its shapes, type and spacing. Phones keep their own sizes, set earlier. */

/* Source chips after a DM's name in its header: 18px tall, 4px corners, 11px semibold. */
.app-chip {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 5px;
  border: 1px solid var(--torque-chip-edge);
  border-radius: var(--radius-sm);
  background: var(--torque-chip-fill);
  color: var(--torque-chip-text);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}
/* The offer: the info fill and edge, its icon, words and ✕ in the info colour (8.3:1 in dark). */
.notify-bar.offer-bar { border-color: var(--torque-info-edge); background: var(--torque-info-fill); }
.offer-bar .notify-bar-icon, .offer-bar .offer-copy, .offer-bar .notify-dismiss { color: var(--torque-info-text); }
.offer-bar .offer-copy { font-weight: 600; }
/* Message text in Lato, the design's body face; names, times and controls stay Figtree. */
.message .body { font-family: Lato, Figtree, system-ui, sans-serif; color: var(--torque-text-body); }
.message .msg-author { font-weight: 700; color: var(--text-primary); }
/* The action bar: a card with a 10px radius, 36px buttons 2px apart, 4px in. */
.msg-actions { gap: 2px; padding: 4px; border-color: var(--torque-raised-border); border-radius: 10px; background: var(--torque-raised-fill); }
.action.reaction, .action.icon-action { width: 36px; height: 36px; border-radius: var(--radius-md); }
.action .icon { width: 20px; height: 20px; }
/* The message box: a 12px-radius card, its edge and a soft ring in the focus colour while in use. */
.composer-field:focus-within { border-color: var(--focus-ring); box-shadow: 0 0 0 3px var(--torque-field-glow); }
.composer-field:has(.composer-input:focus-visible) { outline: none; }
/* Focus glint: while the message box has focus, a glint of light runs clockwise round its edge,
   quickest through the middle of the long edges and easing off towards the far ends: its speed
   falls with the square root of its distance from the box's centre (keyframes worked out for a
   1104 x 106 box, the desktop size). Three dashes on an SVG copy of the box's outline
   (pathLength 100, so lengths are percentages of the way round): a short bright head and two
   fainter, longer pieces of tail a fixed distance behind it. One lap every 3s. Off for people
   who ask for less motion. */
.composer-glint {
  position: absolute;
  inset: -1px;
  width: calc(100% + 2px);
  height: calc(100% + 2px);
  overflow: visible;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.composer-glint rect {
  x: 0.5px;
  y: 0.5px;
  width: calc(100% - 1px);
  height: calc(100% - 1px);
  rx: 11.5px;
  fill: none;
  stroke: #ffffff;
  stroke-width: 1.5px;
  stroke-linecap: round;
}
.composer-glint .glint-head { stroke-dasharray: 3 97; stroke-dashoffset: 0; }
.composer-glint .glint-tail { stroke-dasharray: 8 92; stroke-dashoffset: 8; stroke-opacity: 0.45; }
.composer-glint .glint-tail-far { stroke-dasharray: 18 82; stroke-dashoffset: 26; stroke-opacity: 0.15; }
@keyframes glint-head { 0.00% { stroke-dashoffset: 0.000; } 2.08% { stroke-dashoffset: -1.524; } 4.17% { stroke-dashoffset: -3.105; } 6.25% { stroke-dashoffset: -4.752; } 8.33% { stroke-dashoffset: -6.479; } 10.42% { stroke-dashoffset: -8.302; } 12.50% { stroke-dashoffset: -10.247; } 14.58% { stroke-dashoffset: -12.356; } 16.67% { stroke-dashoffset: -14.701; } 18.75% { stroke-dashoffset: -17.435; } 20.83% { stroke-dashoffset: -21.017; } 22.92% { stroke-dashoffset: -25.434; } 25.00% { stroke-dashoffset: -28.616; } 27.08% { stroke-dashoffset: -31.183; } 29.17% { stroke-dashoffset: -33.431; } 31.25% { stroke-dashoffset: -35.476; } 33.33% { stroke-dashoffset: -37.374; } 35.42% { stroke-dashoffset: -39.160; } 37.50% { stroke-dashoffset: -40.856; } 39.58% { stroke-dashoffset: -42.479; } 41.67% { stroke-dashoffset: -44.038; } 43.75% { stroke-dashoffset: -45.544; } 45.83% { stroke-dashoffset: -47.028; } 47.92% { stroke-dashoffset: -48.514; } 50.00% { stroke-dashoffset: -50.000; } 52.08% { stroke-dashoffset: -51.524; } 54.17% { stroke-dashoffset: -53.105; } 56.25% { stroke-dashoffset: -54.752; } 58.33% { stroke-dashoffset: -56.479; } 60.42% { stroke-dashoffset: -58.302; } 62.50% { stroke-dashoffset: -60.247; } 64.58% { stroke-dashoffset: -62.356; } 66.67% { stroke-dashoffset: -64.701; } 68.75% { stroke-dashoffset: -67.435; } 70.83% { stroke-dashoffset: -71.017; } 72.92% { stroke-dashoffset: -75.434; } 75.00% { stroke-dashoffset: -78.616; } 77.08% { stroke-dashoffset: -81.183; } 79.17% { stroke-dashoffset: -83.431; } 81.25% { stroke-dashoffset: -85.476; } 83.33% { stroke-dashoffset: -87.374; } 85.42% { stroke-dashoffset: -89.160; } 87.50% { stroke-dashoffset: -90.856; } 89.58% { stroke-dashoffset: -92.479; } 91.67% { stroke-dashoffset: -94.038; } 93.75% { stroke-dashoffset: -95.544; } 95.83% { stroke-dashoffset: -97.028; } 97.92% { stroke-dashoffset: -98.514; } 100.00% { stroke-dashoffset: -100.000; } }
@keyframes glint-tail { 0.00% { stroke-dashoffset: 8.000; } 2.08% { stroke-dashoffset: 6.476; } 4.17% { stroke-dashoffset: 4.895; } 6.25% { stroke-dashoffset: 3.248; } 8.33% { stroke-dashoffset: 1.521; } 10.42% { stroke-dashoffset: -0.302; } 12.50% { stroke-dashoffset: -2.247; } 14.58% { stroke-dashoffset: -4.356; } 16.67% { stroke-dashoffset: -6.701; } 18.75% { stroke-dashoffset: -9.435; } 20.83% { stroke-dashoffset: -13.017; } 22.92% { stroke-dashoffset: -17.434; } 25.00% { stroke-dashoffset: -20.616; } 27.08% { stroke-dashoffset: -23.183; } 29.17% { stroke-dashoffset: -25.431; } 31.25% { stroke-dashoffset: -27.476; } 33.33% { stroke-dashoffset: -29.374; } 35.42% { stroke-dashoffset: -31.160; } 37.50% { stroke-dashoffset: -32.856; } 39.58% { stroke-dashoffset: -34.479; } 41.67% { stroke-dashoffset: -36.038; } 43.75% { stroke-dashoffset: -37.544; } 45.83% { stroke-dashoffset: -39.028; } 47.92% { stroke-dashoffset: -40.514; } 50.00% { stroke-dashoffset: -42.000; } 52.08% { stroke-dashoffset: -43.524; } 54.17% { stroke-dashoffset: -45.105; } 56.25% { stroke-dashoffset: -46.752; } 58.33% { stroke-dashoffset: -48.479; } 60.42% { stroke-dashoffset: -50.302; } 62.50% { stroke-dashoffset: -52.247; } 64.58% { stroke-dashoffset: -54.356; } 66.67% { stroke-dashoffset: -56.701; } 68.75% { stroke-dashoffset: -59.435; } 70.83% { stroke-dashoffset: -63.017; } 72.92% { stroke-dashoffset: -67.434; } 75.00% { stroke-dashoffset: -70.616; } 77.08% { stroke-dashoffset: -73.183; } 79.17% { stroke-dashoffset: -75.431; } 81.25% { stroke-dashoffset: -77.476; } 83.33% { stroke-dashoffset: -79.374; } 85.42% { stroke-dashoffset: -81.160; } 87.50% { stroke-dashoffset: -82.856; } 89.58% { stroke-dashoffset: -84.479; } 91.67% { stroke-dashoffset: -86.038; } 93.75% { stroke-dashoffset: -87.544; } 95.83% { stroke-dashoffset: -89.028; } 97.92% { stroke-dashoffset: -90.514; } 100.00% { stroke-dashoffset: -92.000; } }
@keyframes glint-tail-far { 0.00% { stroke-dashoffset: 26.000; } 2.08% { stroke-dashoffset: 24.476; } 4.17% { stroke-dashoffset: 22.895; } 6.25% { stroke-dashoffset: 21.248; } 8.33% { stroke-dashoffset: 19.521; } 10.42% { stroke-dashoffset: 17.698; } 12.50% { stroke-dashoffset: 15.753; } 14.58% { stroke-dashoffset: 13.644; } 16.67% { stroke-dashoffset: 11.299; } 18.75% { stroke-dashoffset: 8.565; } 20.83% { stroke-dashoffset: 4.983; } 22.92% { stroke-dashoffset: 0.566; } 25.00% { stroke-dashoffset: -2.616; } 27.08% { stroke-dashoffset: -5.183; } 29.17% { stroke-dashoffset: -7.431; } 31.25% { stroke-dashoffset: -9.476; } 33.33% { stroke-dashoffset: -11.374; } 35.42% { stroke-dashoffset: -13.160; } 37.50% { stroke-dashoffset: -14.856; } 39.58% { stroke-dashoffset: -16.479; } 41.67% { stroke-dashoffset: -18.038; } 43.75% { stroke-dashoffset: -19.544; } 45.83% { stroke-dashoffset: -21.028; } 47.92% { stroke-dashoffset: -22.514; } 50.00% { stroke-dashoffset: -24.000; } 52.08% { stroke-dashoffset: -25.524; } 54.17% { stroke-dashoffset: -27.105; } 56.25% { stroke-dashoffset: -28.752; } 58.33% { stroke-dashoffset: -30.479; } 60.42% { stroke-dashoffset: -32.302; } 62.50% { stroke-dashoffset: -34.247; } 64.58% { stroke-dashoffset: -36.356; } 66.67% { stroke-dashoffset: -38.701; } 68.75% { stroke-dashoffset: -41.435; } 70.83% { stroke-dashoffset: -45.017; } 72.92% { stroke-dashoffset: -49.434; } 75.00% { stroke-dashoffset: -52.616; } 77.08% { stroke-dashoffset: -55.183; } 79.17% { stroke-dashoffset: -57.431; } 81.25% { stroke-dashoffset: -59.476; } 83.33% { stroke-dashoffset: -61.374; } 85.42% { stroke-dashoffset: -63.160; } 87.50% { stroke-dashoffset: -64.856; } 89.58% { stroke-dashoffset: -66.479; } 91.67% { stroke-dashoffset: -68.038; } 93.75% { stroke-dashoffset: -69.544; } 95.83% { stroke-dashoffset: -71.028; } 97.92% { stroke-dashoffset: -72.514; } 100.00% { stroke-dashoffset: -74.000; } }
.composer-field:focus-within .composer-glint { opacity: 1; }
.composer-field:focus-within .glint-head { animation: glint-head 3s linear infinite; }
.composer-field:focus-within .glint-tail { animation: glint-tail 3s linear infinite; }
.composer-field:focus-within .glint-tail-far { animation: glint-tail-far 3s linear infinite; }
@media (prefers-reduced-motion: reduce) {
  .composer-glint { display: none; }
}
.composer-input::placeholder { color: var(--text-secondary); opacity: 1; }
/* Icon buttons in the panel draw their icons in the muted text colour. */
.conv-header .icon-button, .composer-tools .icon-button, .msg-actions .action.icon-action { color: var(--text-secondary); }
.msg-actions .action.icon-action:hover, .msg-actions .action.icon-action[aria-expanded="true"] { color: var(--text-primary); }
/* In the sidebar: icons muted, words in the rows' colour; a selected DM's avatar goes dark with a
   light edge, its dot on top. */
.sidebar .item .channel-glyph { color: var(--torque-on-frame-heading); }
.sidebar .item.selected .channel-glyph { color: inherit; }
.sidebar .section-head .icon-button { color: var(--torque-on-frame-heading); }
.sidebar .item.selected .avatar[class*="hue-"] { box-sizing: border-box; border: 1px solid var(--torque-dark-avatar-ring); background: var(--torque-dark-bg-app); }
/* The Slack and Teams marks on a DM's row: white at 75%. */
.sidebar .item .app-mark { color: var(--white); opacity: 0.75; }
.sidebar .item.selected { color: var(--white); }

@media (min-width: 768px) {
  /* The top strip: 60px; the wordmark 20px in, the search box from 288px, the offer 20px from
     the right. */
  .shell { grid-template-columns: 272px minmax(0, 1fr); }
  .sidebar .workspace { width: 272px; height: 60px; padding: 0 20px; }
  .identity-text { gap: var(--space-2); }
  .identity-name { font-size: 20px; letter-spacing: normal; }
  .identity-product { font-size: 14px; letter-spacing: 0.2em; }
  .top-bar { top: 10px; left: 288px; right: 20px; height: 40px; gap: var(--space-4); }
  .top-search .search-input {
    height: 40px;
    padding: 0 14px 0 calc(14px + 20px + 10px);
    border: 1px solid var(--torque-frame-well-edge);
    border-radius: var(--radius-md);
    background: var(--torque-frame-well);
    color: var(--torque-on-frame);
    font-size: 15px;
  }
  .top-search .search-input::placeholder { color: var(--torque-on-frame-heading); }
  .top-search .search-icon { left: 15px; color: var(--torque-on-frame-heading); }
  .top-search .search-icon .icon { width: 20px; height: 20px; }
  .notify-pill { height: 40px; border-color: var(--torque-frame-offer-edge); border-radius: var(--radius-md); background: transparent; color: var(--torque-on-frame); }
  .notify-pill-main { gap: var(--space-1); padding: 0 0 0 12px; border-radius: var(--radius-md); }
  .notify-pill-main .icon { width: 20px; height: 20px; }
  .notify-pill-dismiss { width: 36px; height: 36px; margin: 0 2px 0 var(--space-1); border-radius: var(--radius-md); color: var(--torque-on-frame-heading); }
  .notify-pill-dismiss .icon { width: 20px; height: 20px; }

  /* The sidebar: 12px in; sections 18px apart, each a 32px heading then 40px rows 2px apart. */
  .sidebar .section-head { box-sizing: border-box; height: 32px; min-height: 0; margin: 18px 12px 2px; padding: 0 0 0 12px; }
  .sidebar-notice-region + .section-head { margin-top: 12px; }
  .sidebar .section-toggle { min-height: 24px; }
  .sidebar .section-name { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; }
  .sidebar .section-head .icon-button { width: 36px; height: 36px; border-radius: var(--radius-md); }
  .sidebar .items { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
  .sidebar .item { box-sizing: border-box; min-height: 40px; padding: 0 12px; gap: 10px; border-radius: var(--radius-md); font-size: 15px; font-weight: 100; }
  /* Unread rows stand out: 700 against everything else's 100, which Figtree draws at its lightest, 300 (the dot stays too). */
  .sidebar .item.bold { font-weight: 700; }
  .sidebar .item .channel-glyph { width: 20px; height: 20px; margin-right: 10px; vertical-align: -5px; }
  .sidebar .item .app-icon { width: 20px; height: 20px; }
  /* A DM row: a 36px avatar, the name 10px after it in semibold, its marks 4px apart and as tall
     as the name's capitals and tall lowercase letters (1cap of the row's font). */
  .sidebar .item:has(.avatar) { min-height: 48px; padding-block: 6px; font-weight: 600; }
  .sidebar .item .app-mark + .app-mark { margin-left: -6px; }
  .sidebar .item .app-mark .origin-mark { width: 0.72em; height: 0.72em; width: 1cap; height: 1cap; }
  /* Centring puts them a touch above the letters (the row centres on the whole line box); a
     little down lines them up with the letters' baseline. */
  .sidebar .item .app-mark { position: relative; top: 0.06em; }
  .item .avatar, .me-button .avatar { width: 36px; height: 36px; font-size: 13px; font-weight: 700; }
  .item .avatar-wrap, .me-button .avatar-wrap { margin-right: 0; }
  .sidebar .presence { right: -3px; bottom: -3px; }
  .item-avatar-button { left: 12px; width: 36px; height: 36px; margin-top: -18px; }
  /* You, at the foot: over a rule 12px in from each side, 12px round a 36px avatar. */
  .sidebar .me { margin: auto 12px 12px; padding: 0; }
  .sidebar .me-button { padding: 12px; gap: 10px; border-radius: var(--radius-md); }
  .sidebar .me-name { font-size: 15px; font-weight: 600; color: var(--torque-on-frame); }

  /* The panel: a 12px radius; its header 74px, everything 24px in. */
  .conv-header { height: 74px; padding: 14px 24px; }
  /* The same height as the conversation's header, so their bottom rules line up. */
  .thread-header { height: 74px; padding: 0 var(--space-6); }
  .conv-name-line { gap: 10px; }
  .conv-title, .intro-title { font-size: 22px; font-weight: 700; line-height: 26px; letter-spacing: normal; }
  .conv-name { line-height: 26px; }
  .conv-title .person-title { margin-top: 2px; font-size: 14px; font-weight: 400; line-height: 17px; }
  .header-presence { margin: 0; }
  .header-presence .presence { width: 13px; height: 13px; border-width: 1.5px; }
  .conv-header .icon-button { width: 40px; height: 40px; border-radius: var(--radius-md); }
  .conv-header .icon-button .icon { width: 20px; height: 20px; }
  /* "Everyone here is in Torque…": inset 12px under the header, 24px from the sides. */
  .notify-bar.offer-bar {
    box-sizing: border-box;
    gap: var(--space-3);
    margin: 12px 24px 0;
    padding: 10px 12px 10px 16px;
    border-radius: 10px;
  }
  .offer-bar .notify-bar-icon .icon { width: 20px; height: 20px; }
  .offer-bar .offer-copy { font-size: 15px; line-height: 18px; }
  .offer-bar .button.small { min-height: 40px; padding: 0 var(--space-4); border-radius: var(--radius-md); font-size: 14px; font-weight: 600; }
  .offer-bar .notify-dismiss { width: 36px; height: 36px; border-radius: var(--radius-md); }
  .offer-bar .notify-dismiss .icon { width: 20px; height: 20px; }

  /* Messages: full-width rows, the text 72px in; a group's first row 18px down, and 6px between
     the lines of a group. */
  .messages { padding: 12px 0 16px; }
  .message { margin: 0; padding: 3px 24px 3px 72px; border-radius: 0; }
  .message.lead { margin-top: 0; padding-top: 18px; }
  .msg-gutter { left: 24px; top: 3px; }
  .message.lead .msg-gutter { top: 18px; }
  .message .msg-header { margin-bottom: 6px; }
  .message .msg-author { font-size: 15px; }
  .msg-header .person-title { font-size: 13px; font-weight: 400; }
  .msg-header time { font-size: 12px; font-weight: 500; }
  .message .body { font-size: 15px; line-height: 1.5; }
  .message .body > p + p { margin-top: 6px; }
  .hover-time { font-size: 12px; font-weight: 500; line-height: 22px; }
  .message .avatar.avatar-lg { border: 0; border-radius: var(--radius-md); font-size: 13px; }
  .msg-actions { top: -22px; right: 24px; }
  .intro, .day-divider, .new-divider { margin-left: 24px; margin-right: 24px; }

  /* The message box: 24px in, 20px over the panel's foot, no rule above it. */
  .composer { padding: 0 24px 20px; border-top: 0; }
  .composer-field { border-color: var(--border-subtle); border-radius: 12px; background: var(--bg-input); }
  .composer-input { min-height: 50px; padding: 14px var(--space-4) 18px; border-radius: 12px 12px 0 0; font-size: 15px; line-height: 18px; }
  .composer-tools { min-height: 54px; gap: var(--space-1); padding: 6px 8px 8px 10px; }
  .composer-tools .icon-button { width: 40px; height: 40px; border-radius: var(--radius-md); }
  .composer-tools .icon-button svg, .composer-tools .icon-button .icon { width: 20px; height: 20px; }
  .composer-tools .send { min-width: 67px; min-height: 40px; padding: 0 var(--space-4); border-radius: var(--radius-md); font-size: 14px; font-weight: 600; }
}

/* The sidebar's "People" link: the phone book, under the workspace header. */
.sidebar-people {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 12px 0; padding: 0 12px; min-height: 40px; box-sizing: border-box;
  border-radius: var(--radius-md); color: var(--torque-on-frame-soft);
  font-size: 15px; font-weight: 500; text-decoration: none;
}
.sidebar-people .icon { width: 20px; height: 20px; }
.sidebar-people:hover { background: var(--torque-frame-hover); }
.sidebar-people[aria-current="page"] { background: var(--torque-frame-current); color: var(--torque-on-frame); }
.sidebar-people:focus-visible { outline: 2px solid var(--ai-cyan); outline-offset: 2px; }

/* The People page: a search box over the phone book. Marks are cyan when that app is linked,
   grey when not; the label says which, so colour isn't the only sign. */
.people-page { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.people-header {
  display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
  padding: var(--space-4); border-bottom: 1px solid var(--border-subtle);
}
.people-header h1 { margin: 0; flex: 1; }
.people-search {
  min-width: 0; width: min(320px, 100%); box-sizing: border-box; height: 36px; padding: 0 12px;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  background: var(--bg-panel); color: var(--text-primary); font: inherit;
}
.people-note { padding: var(--space-4); color: var(--text-secondary); }
.people-list { list-style: none; margin: 0; padding: var(--space-2) var(--space-4); overflow-y: auto; }
.people-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: var(--space-4);
  padding: 6px 0; border-bottom: 1px solid var(--border-subtle);
}
.people-person {
  display: flex; align-items: center; gap: 12px; min-width: 0; padding: 4px; margin: 0;
  border: 0; border-radius: var(--radius-md); background: transparent; color: inherit;
  font: inherit; text-align: left; cursor: pointer;
}
.people-person:hover { background: var(--bg-hover); }
.people-person:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.people-person .avatar { width: 36px; height: 36px; flex: none; border-radius: var(--radius-md); font-size: 13px; }
.people-names { display: flex; flex-direction: column; min-width: 0; }
.people-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-title { color: var(--text-secondary); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-mobile { color: var(--torque-link); font-variant-numeric: tabular-nums; white-space: nowrap; }
.people-mobile.none { color: var(--text-secondary); }
.people-marks { display: flex; gap: 8px; }
.people-mark { display: inline-grid; place-items: center; color: var(--text-secondary); }
.people-mark.linked { color: var(--ai-cyan); }
.people-mark .origin-mark { width: 16px; height: 16px; }
@media (max-width: 767px) {
  .sidebar-people { min-height: 44px; }
  .people-row { grid-template-columns: minmax(0, 1fr) auto; }
  .people-mobile { grid-column: 1; padding-left: 52px; }
  .people-marks { grid-column: 2; grid-row: 1; }
}

/* Admin → Sidebar Sections: a default's emoji, its text, and its buttons. */
.section-default-row { align-items: flex-start; gap: var(--space-2); }
.section-default-icon { flex-shrink: 0; width: 24px; font-size: 18px; line-height: 1.4; text-align: center; }
.section-default-actions { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-left: auto; }
.section-icon-field { max-width: 12ch; }

/* A bridged app's colour (Datadog: red for an alert, green for a recovery), as Slack draws it. */
.msg-accent { border-left: 3px solid var(--accent); padding-left: 10px; margin: 2px 0; }
/* A thin line between kinds of section (People, your sections, Mailboxes, Channels, DMs, Apps):
   70% of the sidebar's width, centred. */
.sidebar-divider {
  width: 70%; height: 0; margin: 14px auto 0; border: 0;
  border-top: 1px solid var(--torque-on-frame-soft); opacity: 0.25;
}
.sidebar .sidebar-divider + .section-head { margin-top: 10px; }
/* Unreads: the sidebar's link (under People, with the total) and the page. */
.sidebar-people + .sidebar-unreads { margin-top: 2px; }
.sidebar-unreads.bold { color: var(--torque-on-frame); font-weight: 700; }
.sidebar-unreads-count { margin-left: auto; font-weight: 600; }
.unreads-page { box-sizing: border-box; max-width: 860px; margin: 0 auto; padding: 24px 16px 48px; }
.unreads-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.unreads-header h1 { margin: 0; flex: 1; }
.unreads-header h1:focus { outline: none; }
.unreads-status { margin: 24px 0; }
.unreads-block { margin: 0 0 24px; padding: 12px 0 0; border-top: 1px solid var(--border-subtle); }
.unreads-block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.unreads-block-head h2 { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unreads-block-head h2 a { color: inherit; text-decoration: none; }
.unreads-block-head h2 a:hover { text-decoration: underline; }
.unreads-earlier { margin: 0 0 8px; }
.unreads-messages { list-style: none; margin: 0; padding: 0; }
/* Threads: the page's cards (laid out as Unreads' blocks), "New" on unread replies, "N more
   replies", the reply box, and the dot on a reply summary with replies you haven't read. */
.thread-more { margin: 4px 0; }
.thread-replies { margin-left: 24px; }
.thread-new-badge { display: inline-block; margin-top: 4px; color: var(--torque-link); font-weight: 700; }
.thread-reply { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 8px 0 0 24px; }
.thread-reply-input {
  flex: 1; min-width: 0; min-height: 36px; box-sizing: border-box; resize: vertical;
  padding: 8px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  background: var(--bg-panel); color: inherit; font: inherit;
}
.thread-reply .notice { flex-basis: 100%; margin: 0; }
.threads-more { margin: 8px 0 0; }
.thread-summary-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ai-cyan); flex-shrink: 0; }
/* "ALPHA" under "DeGould": right-aligned, about a third of its height, in white. Out of the flow,
   so the logo row stays where it is. */
.identity-workspace { position: relative; display: inline-flex; }
.identity-stage {
  position: absolute; top: 100%; right: 0; margin-top: 4px;
  font-size: 7px; font-weight: 700; letter-spacing: 0.12em; line-height: 1; color: #fff;
}

/* A channel's Details panel: About, then Members, each a section under a rule. */
.details-body { display: flex; flex-direction: column; gap: var(--space-4); flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-4); }
.details-body > p { margin: 0; }
.details-section { display: flex; flex-direction: column; gap: var(--space-3); }
.details-section + .details-section { padding-top: var(--space-4); border-top: 1px solid var(--border-subtle); }
.details-section > p { margin: 0; }
.details-section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.details-section-title { margin: 0; }
.details-field { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-2); }
.details-field-text { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.details-topic { overflow-wrap: anywhere; }
.details-edit { display: flex; flex-direction: column; gap: var(--space-2); }
.details-edit-actions { display: flex; gap: var(--space-2); }
.details-members { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.details-member { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.details-member-name { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.details-member-name:disabled { cursor: default; }
.details-member-name:hover:not(:disabled) .t-web-label { text-decoration: underline; }
.details-member-name:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.details-member-actions, .details-member-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); width: 100%; padding-left: calc(32px + var(--space-2)); }
.owner-badge { padding: 0 var(--space-1); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); color: var(--text-secondary); }
