/* /css/tokens.css */
/* Atrium design tokens. Source of truth: atrium/design/ (chat-shell.html palette, copied exactly).
   Dark theme only for now; a light theme would redefine these custom properties under [data-theme="light"].
   Features use these variables, never raw colours. */
:root {
  color-scheme: dark;

  /* surfaces */
  --bg: #080b10;
  --panel: rgba(10, 14, 19, .88);
  --panel-solid: #0b1016;
  --raise: #121922;
  --hover: #151d27;
  --overlay: rgba(4, 6, 9, .62);
  --field: rgba(14, 20, 27, .82);
  --card: rgba(14, 20, 27, .5);        /* option cards, drop zones */
  --row-hover: rgba(21, 29, 39, .55);  /* hover on list/table rows */
  --bubble: rgba(18, 25, 34, .72);     /* a quoted message */
  --scrim: rgba(8, 11, 16, .86);       /* over content while dragging files onto it */

  /* lines */
  --line: #1c2530;
  --line-2: #26313d;
  --line-3: #36434f;

  /* text */
  --ink: #d7dee6;
  --ink-2: #aeb8c3;
  --muted: #76828f;
  --faint: #4a5561;

  /* accent (teal) */
  --accent: #46c7dc;
  --accent-ink: #06171b;
  --accent-soft: rgba(70, 199, 220, .12);
  --accent-line: rgba(70, 199, 220, .55);
  --accent-soft-2: rgba(70, 199, 220, .2);

  /* status */
  --ok: #4cc38a;
  --ok-soft: rgba(76, 195, 138, .12);
  --warn: #e0b04a;
  --warn-soft: rgba(224, 176, 74, .12);
  --danger: #ef6b6b;
  --danger-soft: rgba(239, 107, 107, .12);
  /* status borders (a danger zone, a failed file, a warning banner) */
  --ok-line: rgba(76, 195, 138, .45);
  --warn-line: rgba(224, 176, 74, .45);
  --danger-line: rgba(239, 107, 107, .4);

  /* shape */
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow-pop: 0 20px 50px rgba(0, 0, 0, .5);
  --shadow-raise: 0 8px 24px rgba(0, 0, 0, .45);

  /* layout */
  --side-w: 276px;
  --rail-w: 56px;
  --drawer-w: 288px;
  --topbar-h: 48px;
  --status-h: 26px;
  --content-w: 780px;
  --composer-w: 760px;

  /* spacing scale (4px base) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* type: JetBrains Mono everywhere */
  --font: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-xs: 10.5px;
  --fs-sm: 12px;
  --fs-md: 13px;
  --fs-base: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-hero: clamp(28px, 4.2vw, 44px);
  --lh: 1.55;

  /* motion */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur: .15s;

  /* stacking */
  --z-drawer: 30;
  --z-popover: 40;
  --z-modal: 50;
  --z-toast: 60;
}

/* /css/base.css */
/* Base styles: reset, typography, focus, scrollbars, helpers. */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--fs-base)/var(--lh) var(--font);
  font-variant-ligatures: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  text-rendering: optimizeLegibility;
}
#root { height: 100%; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -.01em; }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-base); }
p { margin: 0 0 var(--sp-3); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:disabled { cursor: not-allowed; }
input, textarea, select { font: inherit; color: inherit; }
code, kbd, pre, samp { font-family: var(--font); }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--sp-4) 0; }
::selection { background: rgba(70, 199, 220, .28); color: #fff; }

:focus { outline: none; }
:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

/* visually hidden but read by screen readers */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 8px; top: -40px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 6px 10px; border-radius: 6px; }
.skip-link:focus { top: 8px; }

.muted { color: var(--muted); }
.faint { color: var(--faint); } /* decorative only: below text contrast; use .muted for text */
.mono-meta { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: var(--sp-2); }
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }

/* the procedural water backdrop from the mockup (no image) */
.backdrop { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.backdrop::before {
  content: ""; position: absolute; inset: -10%;
  background:
    radial-gradient(60% 40% at 55% 22%, rgba(70, 199, 220, .10), transparent 70%),
    radial-gradient(50% 35% at 70% 70%, rgba(40, 90, 120, .18), transparent 70%),
    linear-gradient(180deg, #0a1118 0%, #070a0e 100%);
}
.backdrop svg {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: .5; mix-blend-mode: screen;
  -webkit-mask-image: radial-gradient(90% 70% at 60% 30%, #000 30%, transparent 85%);
  mask-image: radial-gradient(90% 70% at 60% 30%, #000 30%, transparent 85%);
  transition: opacity .3s var(--ease);
}
.backdrop[data-dim="true"] svg { opacity: .14; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* /css/kit.css */
/* The shared component kit (atrium.core.ui). Classes are prefixed "ui-". Features style their own screens in
   resources/features/<name>.css and compose these components; they don't restyle the kit. */

/* icons */
.ui-icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* buttons */
.ui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 34px; padding: 0 14px; border-radius: var(--radius-sm);
  font-size: var(--fs-md); font-weight: 500; white-space: nowrap;
  border: 1px solid var(--line-2); background: var(--raise); color: var(--ink);
  transition: background var(--dur), border-color var(--dur), color var(--dur);
}
.ui-btn:hover:not(:disabled) { background: var(--hover); border-color: var(--line-3); }
.ui-btn:disabled { opacity: .5; }
.ui-btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ui-btn--primary:hover:not(:disabled) { background: #5fd2e4; border-color: #5fd2e4; }
.ui-btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.ui-btn--ghost:hover:not(:disabled) { background: var(--hover); border-color: transparent; color: var(--ink); }
.ui-btn--danger { background: var(--danger-soft); border-color: rgba(239, 107, 107, .4); color: var(--danger); }
.ui-btn--danger:hover:not(:disabled) { background: rgba(239, 107, 107, .2); border-color: var(--danger); }
.ui-btn--sm { height: 28px; padding: 0 10px; font-size: var(--fs-sm); }
.ui-btn--lg { height: 40px; padding: 0 18px; font-size: var(--fs-base); }
.ui-btn--block { width: 100%; }
.ui-btn .ui-spinner { width: 14px; height: 14px; }

.ui-icon-btn {
  width: 30px; height: 30px; display: inline-grid; place-items: center; flex: none;
  border-radius: var(--radius-sm); color: var(--muted); transition: background var(--dur), color var(--dur);
}
.ui-icon-btn:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.ui-icon-btn[aria-pressed="true"] { color: var(--accent); }
.ui-icon-btn:disabled { opacity: .45; }
.ui-icon-btn--sm { width: 24px; height: 24px; }
.ui-icon-btn--sm .ui-icon { width: 14px; height: 14px; }
.ui-icon-btn--lg { width: 34px; height: 34px; border-radius: 9px; }

/* form fields */
.ui-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ui-field-label { font-size: var(--fs-sm); color: var(--ink-2); font-weight: 500; }
.ui-field-hint { font-size: var(--fs-sm); color: var(--muted); }
.ui-field-error { font-size: var(--fs-sm); color: var(--danger); }
.ui-input, .ui-textarea, .ui-select {
  width: 100%; min-width: 0; border: 1px solid var(--line-2); background: var(--field); color: var(--ink);
  border-radius: var(--radius-sm); padding: 8px 11px; font-size: var(--fs-md); line-height: 1.45;
  transition: border-color var(--dur), background var(--dur);
}
.ui-input { height: 36px; }
.ui-input::placeholder, .ui-textarea::placeholder { color: var(--muted); opacity: .8; }
.ui-input:hover, .ui-textarea:hover, .ui-select:hover { border-color: var(--line-3); }
.ui-input:focus-visible, .ui-textarea:focus-visible, .ui-select:focus-visible { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-line); background: var(--raise); }
.ui-input[aria-invalid="true"], .ui-textarea[aria-invalid="true"] { border-color: rgba(239, 107, 107, .6); }
.ui-textarea { resize: vertical; min-height: 72px; }
.ui-select {
  height: 36px; appearance: none; padding-right: 30px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.ui-select option { background: var(--panel-solid); color: var(--ink); }

/* toggle (switch) */
.ui-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--fs-md); color: var(--ink-2); }
.ui-toggle-track {
  position: relative; width: 34px; height: 20px; border-radius: var(--radius-pill); flex: none;
  background: var(--line-2); border: 1px solid var(--line-3); transition: background var(--dur), border-color var(--dur);
}
.ui-toggle-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--muted); transition: transform var(--dur) var(--ease), background var(--dur);
}
.ui-toggle[aria-checked="true"] .ui-toggle-track { background: var(--accent-soft); border-color: var(--accent-line); }
.ui-toggle[aria-checked="true"] .ui-toggle-track::after { transform: translateX(14px); background: var(--accent); }
.ui-toggle[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

/* chips (the mockup's tool chips) */
.ui-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: var(--radius-pill);
  border: 1px solid var(--line-2); background: rgba(14, 20, 27, .7); color: var(--ink-2); font-size: var(--fs-md); white-space: nowrap;
  transition: border-color var(--dur), color var(--dur), background var(--dur);
}
.ui-chip:hover { border-color: var(--line-3); color: var(--ink); }
.ui-chip[aria-pressed="true"] { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.ui-chip--sm { height: 26px; padding: 0 9px; font-size: var(--fs-sm); gap: 5px; }
.ui-chip--sm .ui-icon { width: 13px; height: 13px; }
.ui-chip-remove { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: -5px; border-radius: 50%; color: var(--muted); }
.ui-chip-remove:hover { background: var(--hover); color: var(--ink); }

/* tag: small accent label (active composer toggles, statuses) */
.ui-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 3px 7px; white-space: nowrap; }
.ui-tag .ui-icon { width: 12px; height: 12px; }
.ui-tag--muted { color: var(--muted); background: var(--raise); }
.ui-tag--ok { color: var(--ok); background: var(--ok-soft); }
.ui-tag--warn { color: var(--warn); background: var(--warn-soft); }
.ui-tag--danger { color: var(--danger); background: var(--danger-soft); }

/* keyboard hints */
.ui-kbd { display: inline-flex; gap: 3px; font-size: 10px; line-height: 1; color: var(--ink-2); }
.ui-kbd span { border: 1px solid var(--line-2); border-radius: 4px; padding: 3px 4px; }

/* tabs */
.ui-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.ui-tabs::-webkit-scrollbar { display: none; }
.ui-tab {
  font-size: var(--fs-xs); font-weight: 500; letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
  padding: 10px 8px 9px; border-bottom: 1.5px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.ui-tab:hover { color: var(--ink-2); }
.ui-tab[aria-selected="true"] { color: var(--ink); border-color: var(--accent); }
.ui-tab-badge { display: inline-flex; margin-left: 6px; vertical-align: middle; letter-spacing: normal; }

/* section label (teal, uppercase) and bucket label (faint) */
.ui-section-label { display: flex; align-items: center; gap: 6px; margin: 14px 8px 6px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.ui-section-label .count { color: var(--muted); font-weight: 500; letter-spacing: .04em; }
.ui-bucket-label { margin: 10px 8px 4px; font-size: 9.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* list rows */
.ui-list-row {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 32px; padding: 6px 8px;
  border-radius: var(--radius-sm); color: var(--ink-2); text-align: left; text-decoration: none; cursor: pointer;
}
.ui-list-row:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.ui-list-row > .ui-icon { color: var(--muted); }
.ui-list-row:hover > .ui-icon { color: var(--ink-2); }
.ui-list-row[aria-current="page"], .ui-list-row[aria-current="true"], .ui-list-row[data-active="true"] { background: var(--accent-soft); color: var(--ink); }
.ui-list-row-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-list-row-sub { display: block; font-size: var(--fs-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-list-row-meta { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.ui-list-row-actions { display: flex; gap: 2px; margin-left: auto; }

/* avatar */
.ui-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(135deg, #2a3a48, #18222c); color: var(--ink-2); font-size: 11px; font-weight: 600;
}
.ui-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ui-avatar--sm { width: 20px; height: 20px; font-size: 9px; }
.ui-avatar--lg { width: 44px; height: 44px; font-size: 15px; }

/* badge (count) */
.ui-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent); font-size: 10px; font-weight: 600; }

/* card / panel */
.ui-card { background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-4); }

/* inline notice */
.ui-notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--raise); color: var(--ink-2); font-size: var(--fs-md); }
.ui-notice .ui-icon { margin-top: 2px; }
.ui-notice--info { border-color: rgba(70, 199, 220, .3); background: var(--accent-soft); }
.ui-notice--info .ui-icon { color: var(--accent); }
.ui-notice--warn { border-color: rgba(224, 176, 74, .35); background: var(--warn-soft); }
.ui-notice--warn .ui-icon { color: var(--warn); }
.ui-notice--error { border-color: rgba(239, 107, 107, .35); background: var(--danger-soft); }
.ui-notice--error .ui-icon { color: var(--danger); }

/* popover + menu */
.ui-popover {
  position: fixed; z-index: var(--z-popover); min-width: 180px; max-width: min(340px, calc(100vw - 16px));
  max-height: min(70vh, 480px); overflow-y: auto;
  background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: 12px; padding: 6px;
  box-shadow: var(--shadow-pop);
}
.ui-menu { display: flex; flex-direction: column; }
.ui-menu-group { font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 10px 10px 6px; }
.ui-menu-item {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  text-align: left; font-size: var(--fs-md); color: var(--ink-2);
}
.ui-menu-item:hover, .ui-menu-item:focus-visible { background: var(--hover); color: var(--ink); outline: none; }
.ui-menu-item:focus-visible { box-shadow: inset 0 0 0 1px var(--accent-line); }
.ui-menu-item .ui-icon { color: var(--muted); }
.ui-menu-item-meta { margin-left: auto; font-size: var(--fs-xs); color: var(--muted); }
.ui-menu-item[aria-checked="true"]::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: 8px; flex: none; }
.ui-menu-item--danger { color: var(--danger); }
.ui-menu-item--danger .ui-icon { color: var(--danger); }
.ui-menu-item:disabled { opacity: .45; }
.ui-menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }

/* tooltip */
.ui-tooltip {
  position: fixed; z-index: var(--z-toast); pointer-events: none; padding: 5px 8px; border-radius: 6px;
  background: #1a232e; border: 1px solid var(--line-2); color: var(--ink); font-size: var(--fs-sm); white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .4);
}

/* modal + sheet */
.ui-modal-backdrop {
  position: fixed; inset: 0; z-index: var(--z-modal); background: var(--overlay); backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: var(--sp-4);
  animation: ui-fade .15s var(--ease);
}
.ui-modal {
  width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow-pop);
  animation: ui-rise .18s var(--ease);
}
.ui-modal--wide { width: min(820px, 100%); }
.ui-modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px 18px; }
.ui-modal-title { flex: 1; font-size: var(--fs-base); font-weight: 600; }
.ui-modal-body { padding: 4px 18px 16px; overflow-y: auto; color: var(--ink-2); font-size: var(--fs-md); }
.ui-modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.ui-sheet-backdrop { position: fixed; inset: 0; z-index: var(--z-modal); background: var(--overlay); animation: ui-fade .15s var(--ease); }
.ui-sheet {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); display: flex; flex-direction: column;
  background: var(--panel-solid); border-left: 1px solid var(--line-2); box-shadow: var(--shadow-pop);
  animation: ui-slide-left .2s var(--ease);
}
@media (max-width: 760px) {
  .ui-sheet { top: auto; left: 0; width: 100%; max-height: 85vh; border-left: 0; border-top: 1px solid var(--line-2); border-radius: 14px 14px 0 0; animation: ui-slide-up .2s var(--ease); }
}

/* toasts */
.ui-toasts { position: fixed; z-index: var(--z-toast); right: 16px; bottom: calc(var(--status-h) + 12px); display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.ui-toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 10px 10px 12px; border-radius: var(--radius);
  background: var(--panel-solid); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop); font-size: var(--fs-md);
  animation: ui-rise .18s var(--ease);
}
.ui-toast-text { flex: 1; min-width: 0; padding-top: 2px; overflow-wrap: anywhere; }
.ui-toast .ui-icon { margin-top: 3px; }
.ui-toast--ok .ui-icon { color: var(--ok); }
.ui-toast--error { border-color: rgba(239, 107, 107, .45); }
.ui-toast--error .ui-icon { color: var(--danger); }
.ui-toast--info .ui-icon { color: var(--accent); }

/* spinner + skeleton */
.ui-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: ui-spin .8s linear infinite; flex: none; }
.ui-spinner--lg { width: 28px; height: 28px; }
.ui-skeleton { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--raise) 0%, var(--hover) 50%, var(--raise) 100%); background-size: 200% 100%; animation: ui-shimmer 1.4s ease-in-out infinite; }

/* empty state */
.ui-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 48px 24px; color: var(--muted); }
.ui-empty > .ui-icon { width: 32px; height: 32px; color: var(--faint); stroke-width: 1.3; }
.ui-empty-title { margin: 0; color: var(--ink); font-size: var(--fs-base); font-weight: 500; }
.ui-empty-body { max-width: 420px; font-size: var(--fs-md); }

/* page scaffolding for feature screens */
.ui-page { width: 100%; max-width: 960px; min-width: 0; margin: 0 auto; padding: 8px 24px 40px; }
.ui-page-head { display: flex; align-items: center; gap: 12px; margin: 8px 0 18px; flex-wrap: wrap; }
.ui-page-title { font-size: var(--fs-xl); font-weight: 500; }
.ui-page-sub { color: var(--muted); font-size: var(--fs-md); }

/* syntax highlighting (highlight.js classes), our palette */
.hljs { color: var(--ink); }
.hljs-comment, .hljs-quote { color: #5b6773; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-section, .hljs-link { color: #46c7dc; }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-attribute, .hljs-meta .hljs-string { color: #9fd58c; }
.hljs-number, .hljs-symbol, .hljs-bullet { color: #e0b04a; }
.hljs-title, .hljs-title.function_, .hljs-name { color: #8fb4ff; }
.hljs-type, .hljs-built_in, .hljs-class .hljs-title, .hljs-title.class_ { color: #d8a0f0; }
.hljs-variable, .hljs-template-variable, .hljs-params { color: #d7dee6; }
.hljs-meta, .hljs-tag { color: #76828f; }
.hljs-deletion { color: #ef6b6b; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 600; }

@keyframes ui-spin { to { transform: rotate(360deg); } }
@keyframes ui-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes ui-fade { from { opacity: 0; } }
@keyframes ui-rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes ui-slide-left { from { transform: translateX(24px); opacity: 0; } }
@keyframes ui-slide-up { from { transform: translateY(24px); opacity: 0; } }
.ui-load-failed { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-3); }
/* Touch screens: a tap would leave the bubble up over the next thing (the label stays the accessible name). */
@media (hover: none) { .ui-tooltip { display: none; } }

/* /css/shell.css */
/* App shell (atrium.app.Shell): sidebar, top bar, main, status bar. Layout follows atrium/design/chat-shell.html. */
.shell {
  position: relative; z-index: 1; height: calc(100% - var(--status-h));
  display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr);
  transition: grid-template-columns .2s var(--ease);
}
.shell[data-collapsed="true"] { --side-w: var(--rail-w); }

/* sidebar frame */
.shell-side {
  background: var(--panel); backdrop-filter: blur(14px); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden;
}
.shell-side-head { display: flex; align-items: center; gap: 10px; height: var(--topbar-h); padding: 0 12px 0 14px; flex: none; }
.shell-brand { display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 500; letter-spacing: -.01em; white-space: nowrap; color: var(--ink); text-decoration: none; }
.shell-brand:hover { text-decoration: none; }
.shell-brand .ui-icon { width: 22px; height: 22px; stroke-width: 1.5; }
.shell-side-tabs { padding: 0 10px; flex: none; }
.shell-panel { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 8px 16px; }
.shell-nav { list-style: none; margin: 0; padding: 0; }
.shell-nav .ui-kbd { margin-left: auto; }
.shell-nav .ui-list-row-meta { margin-left: auto; }
.shell-nav-badge { margin-left: auto; display: inline-flex; flex: none; }
.shell-nav .ui-kbd + .shell-nav-badge { margin-left: 6px; }
.shell-side-foot { flex: none; border-top: 1px solid var(--line); padding: 8px; display: flex; align-items: center; gap: 8px; }
.shell-who { flex: 1; min-width: 0; line-height: 1.25; display: flex; align-items: center; gap: 8px; padding: 4px; border-radius: var(--radius-sm); text-align: left; }
.shell-who:hover { background: var(--hover); }
.shell-who-text { min-width: 0; }
.shell-who b { display: block; font-weight: 500; font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-who small { color: var(--muted); font-size: 11px; }

/* collapsed rail */
.shell[data-collapsed="true"] .shell-brand-word,
.shell[data-collapsed="true"] .shell-side-tabs,
.shell[data-collapsed="true"] .shell-hide-rail,
.shell[data-collapsed="true"] .shell-nav .ui-list-row-text,
.shell[data-collapsed="true"] .shell-nav .ui-kbd,
.shell[data-collapsed="true"] .shell-nav .ui-list-row-meta,
.shell[data-collapsed="true"] .shell-nav-badge,
.shell[data-collapsed="true"] .shell-who-text,
.shell[data-collapsed="true"] .shell-foot-extra { display: none; }
.shell[data-collapsed="true"] .shell-side-head { flex-direction: column; height: auto; padding: 10px 0; gap: 8px; }
.shell[data-collapsed="true"] .shell-side-head .spacer { display: none; }
.shell[data-collapsed="true"] .shell-nav .ui-list-row { justify-content: center; padding: 8px 0; }
.shell[data-collapsed="true"] .shell-side-foot { justify-content: center; }
.shell[data-collapsed="true"] .shell-who { flex: none; }

/* main column */
.shell-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.shell-topbar { height: var(--topbar-h); display: flex; align-items: center; gap: 6px; padding: 0 14px; flex: none; min-width: 0; }
.shell-topbar-title { font-size: 14px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-menu-btn { display: none; }
.shell-content { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.shell-content > * { flex-shrink: 0; }
.shell-content--fill > * { flex: 1; min-height: 0; }

/* pill buttons in the top bar (Temporary, Share) */
.shell-pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.shell-pill:hover { background: var(--hover); color: var(--ink); }
.shell-pill[aria-pressed="true"] { color: var(--accent); }

/* status bar */
.shell-status {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--status-h); z-index: 2;
  display: flex; align-items: center; gap: 16px; padding: 0 12px; overflow: hidden; white-space: nowrap;
  background: #06090d; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted);
}
.shell-status-dot { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.shell-status-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.shell-status-dot[data-state="ok"]::before { background: var(--ok); }
.shell-status-dot[data-state="busy"]::before { background: var(--warn); }
.shell-status-dot[data-state="off"]::before { background: var(--danger); }

/* chat layout: centred hero + composer when empty, thread + docked composer otherwise */
.chat-layout { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-layout-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 24px 12vh; min-height: 0; }
.chat-layout-mark { width: 44px; height: 44px; color: var(--ink); opacity: .9; margin-bottom: 14px; stroke-width: 1.3; }
.chat-layout-hero { font-size: var(--fs-hero); font-weight: 400; line-height: 1.1; margin: 0 0 30px; letter-spacing: -.03em; text-align: center; text-wrap: balance; }
.chat-layout-slot { width: min(var(--composer-w), 100%); }
.chat-layout-below { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.chat-layout-thread { flex: 1; min-height: 0; overflow-y: auto; }
.chat-layout-thread-inner { max-width: var(--content-w); margin: 0 auto; padding: 18px 24px 30px; }
.chat-layout-dock { padding: 0 24px 16px; flex: none; }
.chat-layout-dock .chat-layout-slot { max-width: 732px; margin: 0 auto; width: 100%; }

/* full-screen states (boot, error, sign-in page frame) */
.shell-center { position: relative; z-index: 1; min-height: 100%; display: grid; place-items: center; padding: 24px; }
.shell-boot { display: flex; flex-direction: column; align-items: center; gap: 16px; color: var(--muted); }
.shell-boot .ui-icon { width: 40px; height: 40px; color: var(--ink); stroke-width: 1.3; }

/* settings / admin frames */
.shell-frame { min-width: 0; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; max-width: 1080px; width: 100%; margin: 0 auto; padding: 8px 24px 40px; }
.shell-frame-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; align-self: start; }
.shell-frame-body { min-width: 0; }
/* tablets and small laptops: beside the sidebar, a tab column would squeeze the page; the tabs go on top */
@media (max-width: 1080px) {
  .shell-frame { grid-template-columns: minmax(0, 1fr); }
  .shell-frame-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .shell-frame-nav .ui-list-row { width: auto; }
}

/* command palette */
.shell-palette { width: min(560px, 100%); align-self: start; margin-top: 12vh; }
.shell-palette-input { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.shell-palette-input input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-size: var(--fs-base); }
.shell-palette-input:has(input:focus-visible) { box-shadow: inset 0 -2px 0 var(--accent-line); }
.shell-palette-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.shell-palette-item[aria-selected="true"] { background: var(--hover); color: var(--ink); }

/* phones: the sidebar becomes an off-canvas drawer */
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .shell-side {
    position: fixed; inset: 0 auto var(--status-h) 0; width: var(--drawer-w); max-width: 86vw; z-index: var(--z-drawer);
    transform: translateX(-100%); transition: transform .2s var(--ease); background: var(--panel-solid); visibility: hidden;
  }
  .shell[data-drawer="open"] .shell-side { transform: none; visibility: visible; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .5); }
  .shell-menu-btn { display: inline-grid; }
  .shell-collapse-btn { display: none; }
  .shell-nav .ui-kbd { display: none; }
  .shell-status-extra { display: none; }
  .ui-chip { height: 40px; }
  .shell-frame { grid-template-columns: minmax(0, 1fr); padding: 8px 16px 32px; }
  .shell-frame-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .shell-frame-nav .ui-list-row { width: auto; }
  .ui-page { padding: 8px 16px 32px; }
  .chat-layout-thread-inner { padding: 12px 16px 24px; }
  .chat-layout-dock { padding: 0 12px 12px; }
}

/* announcement banners (GET /banners) above the page, under the top bar */
.shell-banners { display: flex; flex-direction: column; gap: 6px; padding: 0 14px 8px; flex: none; min-width: 0; }
.shell-banner {
  display: flex; align-items: flex-start; gap: 10px; min-width: 0; padding: 9px 10px 9px 12px;
  font-size: var(--fs-md); color: var(--ink); border-radius: var(--radius);
  background: var(--accent-soft); border: 1px solid var(--accent-line);
}
.shell-banner > .ui-icon { flex: none; margin-top: 2px; color: var(--accent); }
.shell-banner--warning { background: var(--warn-soft); border-color: var(--warn-line); }
.shell-banner--warning > .ui-icon { color: var(--warn); }
.shell-banner--error { background: var(--danger-soft); border-color: var(--danger-line); }
.shell-banner--error > .ui-icon { color: var(--danger); }
.shell-banner--success { background: var(--ok-soft); border-color: var(--ok-line); }
.shell-banner--success > .ui-icon { color: var(--ok); }
.shell-banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.shell-banner-text strong { font-weight: 600; }
.shell-banner-text p { margin: 0; }
.shell-banner-text p + p { margin-top: 6px; }
.shell-banner-text a { color: var(--accent); }
.shell-banner .ui-icon-btn { flex: none; margin: -2px -2px 0 0; }
@media (max-width: 760px) { .shell-banners { padding: 0 10px 8px; } }

/* /css/seams.css */
/* Default seam implementations (atrium.core.conversation, atrium.app) and the default model picker (atrium.app.chat). Prefix "seam-".
   Feature tasks that replace a seam style their own version in features/<name>.css. */

/* default composer (layout of the mockup's composer) */
.seam-composer-wrap { width: 100%; }
.seam-composer-above { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.seam-composer {
  display: flex; align-items: flex-end; gap: 6px; padding: 8px 8px 8px 10px; border-radius: var(--radius-lg);
  border: 1px solid var(--line-2); background: var(--field); backdrop-filter: blur(10px); transition: border-color var(--dur);
}
.seam-composer:focus-within { border-color: #3a4855; }
.seam-composer textarea {
  flex: 1; min-width: 0; resize: none; border: 0; outline: 0; background: none; padding: 8px 4px; max-height: 200px;
  line-height: 1.45; font-size: var(--fs-base); overflow-y: auto;
}
.seam-composer textarea::placeholder { color: var(--muted); }
.seam-composer .ui-icon-btn { width: 34px; height: 34px; border-radius: 9px; }
.seam-send { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--line-2); color: var(--muted); transition: background var(--dur), color var(--dur); }
.seam-send--ready { background: var(--ink); color: #0b0f14; }
.seam-send--stop { background: var(--ink); color: #0b0f14; }
.seam-send:disabled { cursor: default; }

/* default thread */
.seam-msg-ai { color: var(--ink); padding: 0 2px; }
.seam-msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.seam-msg-status { color: var(--muted); font-size: var(--fs-sm); margin-bottom: 6px; }
.seam-msg-error { margin-top: 8px; color: var(--danger); background: var(--danger-soft); border: 1px solid rgba(239, 107, 107, .35); border-radius: var(--radius-sm); padding: 8px 10px; font-size: var(--fs-md); }
.seam-caret { display: inline-block; width: 7px; height: 15px; background: var(--accent); vertical-align: -2px; margin-left: 1px; animation: seam-blink 1s steps(2) infinite; }
@keyframes seam-blink { 50% { opacity: 0; } }

/* default top-bar model picker */
.seam-model-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 8px; font-weight: 500; color: var(--ink); min-width: 0; }
.seam-model-btn:hover { background: var(--hover); }
.seam-model-btn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seam-model-btn small { font-size: 11px; color: var(--muted); font-weight: 400; }
.seam-model-btn .ui-icon { color: var(--muted); }

/* default conversation view (atrium.core.conversation: DefaultMessageView, DefaultComposerView; the dev kit) */
.seam-msg-ai { margin-bottom: 22px; }

/* /css/pages.css */
/* Shell pages: workspace index, dev kit, licences, bare pages. */
.shell-bare { position: relative; z-index: 1; height: 100%; overflow-y: auto; }

.workspace-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 0 0 8px; }
.workspace-grid .ui-list-row { padding: 14px; }

.devkit-section { margin: 0 0 22px; }
.devkit-section .ui-section-label { margin-left: 0; }
.devkit-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.devkit-col { display: flex; flex-direction: column; gap: 12px; width: min(420px, 100%); }
.devkit-swatch { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--muted); width: 150px; }
.devkit-swatch-chip { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line-2); flex: none; }
.devkit-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm); border: 1px solid var(--line); color: var(--ink-2); }
.devkit-lib { display: flex; align-items: center; gap: 10px; font-size: var(--fs-md); }
.devkit-md { color: var(--ink-2); }
.devkit-editor { max-width: 100%; border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; }
.devkit-editor .cm-editor { background: var(--panel-solid); color: var(--ink); font-family: var(--font); font-size: var(--fs-md); }
.devkit-editor .cm-gutters { background: var(--panel-solid); border-right: 1px solid var(--line); color: var(--faint); }
.devkit-editor .cm-activeLine, .devkit-editor .cm-activeLineGutter { background: rgba(70, 199, 220, .05); }
.devkit-editor .cm-cursor { border-left-color: var(--accent); }

.licences-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.licences-list li { display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.licences-name { color: var(--ink); }
.licences-meta { color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.licences-name { overflow-wrap: anywhere; }
.licences-name a { color: var(--ink); text-decoration: none; }
.licences-name a:hover, .licences-name a:focus-visible { color: var(--accent); text-decoration: underline; }
.licences-version { color: var(--muted); }
.licences-full { margin-top: var(--sp-5); }

/* /features/chat-thread.css */
/* Feature "chat-thread": styles for atrium.features.chatthread. Owned by the chat-thread task.
   Prefix every class with "chat-thread-" and use the tokens from css/tokens.css. */

/* page states */
.chat-thread-error { flex: 1; min-height: 0; display: grid; place-items: center; padding: var(--sp-6); }
.chat-thread-error-title { margin: 0; }
.chat-thread-gap { height: 28px; }
.chat-thread-hero { margin-bottom: 10px; }
.chat-thread-hero-sub { color: var(--muted); margin: 0 0 26px; text-align: center; max-width: 46ch; text-wrap: balance; }
.chat-thread-hero-notice { width: min(var(--composer-w), 100%); margin-bottom: var(--sp-4); }

/* thread */
.chat-thread .chat-layout-dock { position: relative; }
.chat-thread-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 2px 2px 10px; margin-bottom: 2px;
  border-bottom: 1px solid var(--line);
}
.chat-thread-title {
  flex: 1 1 auto; min-width: 0; margin: 0; font-size: var(--fs-md); font-weight: 500; color: var(--ink-2);
  overflow-wrap: anywhere;
}
.chat-thread-earlier { display: flex; justify-content: center; margin: var(--sp-3) 0 0; }
.chat-thread-list { min-width: 0; }

.chat-thread-msg { position: relative; min-width: 0; }
/* Off-screen messages far from the end skip layout and paint (long chats stay fast). */
.chat-thread-msg--far { content-visibility: auto; contain-intrinsic-size: auto 140px; }
.chat-thread-msg--user { margin: 22px 0 14px; }
.chat-thread-msg--ai { padding: 0 2px; margin-bottom: 10px; }

.chat-thread-bubble {
  border: 1px solid var(--line-2); background: color-mix(in srgb, var(--raise) 72%, transparent);
  border-radius: var(--radius); padding: 10px 14px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.chat-thread-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--sp-2); white-space: normal; }
.chat-thread-files .ui-chip { max-width: 100%; }

.chat-thread-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 2px 10px; min-height: 30px; margin-top: 4px;
  font-size: 11px; color: var(--muted);
}
.chat-thread-model { overflow-wrap: anywhere; min-width: 0; }
.chat-thread-live { color: var(--accent); }

/* actions: visible on hover/focus, always on the last message and on touch screens */
.chat-thread-actions { display: flex; align-items: center; gap: 2px; opacity: 0; transition: opacity var(--dur); }
.chat-thread-msg:hover .chat-thread-actions,
.chat-thread-actions:focus-within,
.chat-thread-actions--shown { opacity: 1; }
@media (hover: none) { .chat-thread-actions { opacity: 1; } }
.chat-thread-actions--user { justify-content: flex-end; margin-top: 4px; }
.chat-thread-actions .ui-icon-btn { color: var(--muted); }
.chat-thread-actions .ui-icon-btn:hover:not(:disabled) { color: var(--ink); }

.chat-thread-siblings { display: inline-flex; align-items: center; gap: 0; font-size: 11px; color: var(--muted); }
.chat-thread-sibling-pos { min-width: 4ch; text-align: center; font-variant-numeric: tabular-nums; }

/* waiting for the first token */
.chat-thread-pending { display: flex; gap: 5px; padding: 8px 0 4px; }
.chat-thread-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: chat-thread-pulse 1.2s infinite var(--ease); }
.chat-thread-dot:nth-child(2) { animation-delay: .15s; }
.chat-thread-dot:nth-child(3) { animation-delay: .3s; }
@keyframes chat-thread-pulse { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .chat-thread-dot { animation: none; opacity: .6; } }

/* editing a question */
.chat-thread-edit { border: 1px solid var(--accent-line); background: var(--field); border-radius: var(--radius); padding: 8px 10px; }
.chat-thread-edit-input {
  display: block; width: 100%; resize: none; border: 0; outline: 0; background: none; color: var(--ink);
  font: inherit; line-height: 1.5; max-height: 40vh; overflow-y: auto; padding: 2px;
}
.chat-thread-edit-bar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); margin-top: 6px; }
.chat-thread-edit-hint { flex: 1 1 200px; min-width: 0; font-size: var(--fs-sm); color: var(--muted); }

/* follow-up suggestions */
.chat-thread-followups { margin: var(--sp-3) 0 var(--sp-2); }
.chat-thread-followups .ui-section-label { padding: 0; margin: 0; }
.chat-thread-followup-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.chat-thread-followup {
  display: flex; align-items: flex-start; gap: var(--sp-2); width: 100%; text-align: left; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink-2); background: transparent;
  transition: background var(--dur), border-color var(--dur), color var(--dur);
}
.chat-thread-followup:hover { background: var(--hover); border-color: var(--line-2); color: var(--ink); }
.chat-thread-followup .ui-icon { flex: none; margin-top: 3px; color: var(--accent); }
.chat-thread-followup span { min-width: 0; overflow-wrap: anywhere; }

/* jump to the latest message, floating above the composer */
.chat-thread-jump { position: absolute; top: -46px; left: 50%; transform: translateX(-50%); z-index: 2; }
.chat-thread-jump .ui-icon-btn {
  width: 34px; height: 34px; border-radius: 50%; background: var(--raise); border: 1px solid var(--accent-line);
  box-shadow: var(--shadow-pop); color: var(--accent);
}
.chat-thread-jump .ui-icon-btn:hover { background: var(--hover); }

/* top bar: model picker and the temporary toggle */
.chat-thread-model-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 8px;
  font-weight: 500; color: var(--ink); min-width: 0; max-width: 100%;
}
.chat-thread-model-btn:hover:not(:disabled) { background: var(--hover); }
.chat-thread-model-btn:disabled { color: var(--muted); cursor: default; }
.chat-thread-model-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chat-thread-model-btn small { font-size: 11px; color: var(--muted); font-weight: 400; white-space: nowrap; }
.chat-thread-model-btn .ui-icon { color: var(--muted); flex: none; }
.chat-thread-temp-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 8px;
  color: var(--muted); font-size: var(--fs-md); flex: none;
}
.chat-thread-temp-btn:hover { background: var(--hover); color: var(--ink); }
.chat-thread-temp-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }

@media (max-width: 760px) {
  .chat-thread-temp-label { display: none; }
  .chat-thread-model-btn small { display: none; }
  .chat-thread-msg--user { margin-top: 16px; }
}

/* ---------- prompt suggestions under the centred composer ---------- */
.chat-thread-suggestions {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--sp-2);
  width: 100%; max-width: var(--composer-w); margin-top: var(--sp-4);
}
.chat-thread-suggestion {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); text-align: left;
}
.chat-thread-suggestion:hover { background: var(--hover); border-color: var(--line-2); }
.chat-thread-suggestion-title { font-size: var(--fs-md); max-width: 100%; overflow-wrap: anywhere; }
.chat-thread-suggestion-detail { font-size: var(--fs-sm); color: var(--ink-2); max-width: 100%; overflow-wrap: anywhere; }
@media (max-width: 760px) { .chat-thread-suggestions { grid-template-columns: 1fr 1fr; } }

/* the reply's state next to the model name */
.chat-thread-live--cancelled, .chat-thread-live--failed { color: var(--warn); }
.chat-thread-msg[data-status="interrupted"] .chat-thread-live { color: var(--warn); }
.chat-thread-edited { color: var(--muted); font-style: italic; }
.chat-thread-file--gone { opacity: .55; text-decoration: line-through; }
.chat-thread-edit--answer { margin-bottom: var(--sp-2); }

/* waiting for the run to start */
.chat-thread-waiting { display: flex; gap: 5px; padding: 8px 2px 4px; }

/* things the run skipped */
.chat-thread-warnings { display: flex; flex-direction: column; gap: 4px; margin-top: var(--sp-2); }
.chat-thread-warning { display: flex; align-items: flex-start; gap: 6px; font-size: var(--fs-sm); color: var(--muted); min-width: 0; }
.chat-thread-warning .ui-icon { flex: none; margin-top: 2px; color: var(--warn); }
.chat-thread-warning span { min-width: 0; overflow-wrap: anywhere; }

/* a tool waiting for the user's go-ahead */
.chat-thread-confirm {
  margin-top: var(--sp-3); padding: 10px 12px; border: 1px solid var(--warn-line); border-radius: var(--radius);
  background: var(--warn-soft); min-width: 0;
}
.chat-thread-confirm-head { display: flex; align-items: flex-start; gap: 8px; color: var(--ink); }
.chat-thread-confirm-head .ui-icon { flex: none; margin-top: 2px; color: var(--warn); }
.chat-thread-confirm-prompt { min-width: 0; overflow-wrap: anywhere; }
.chat-thread-confirm-args {
  margin-top: 8px; padding: 6px 8px; border-radius: var(--radius-sm); background: var(--field); border: 1px solid var(--line);
  font-size: var(--fs-sm); color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 160px; overflow-y: auto;
}
.chat-thread-confirm-code { white-space: pre; overflow-wrap: normal; overflow-x: auto; max-height: 240px; }
.chat-thread-confirm-bar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); margin-top: 10px; }

/* several models side by side */
.chat-thread-compare { margin-bottom: var(--sp-3); }
.chat-thread-compare-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--sp-3); }
.chat-thread-compare-col {
  min-width: 0; padding: 10px 12px 4px; border: 1px solid var(--line); border-radius: var(--radius);
  background: color-mix(in srgb, var(--raise) 45%, transparent);
}
.chat-thread-compare-col--selected { border-color: var(--accent-line); }
.chat-thread-compare-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 11px; color: var(--muted); min-width: 0; }
.chat-thread-compare-tag { margin-left: auto; }
.chat-thread-compare-col .chat-thread-actions { margin-top: 4px; flex-wrap: wrap; }

/* tokens and timing */
.chat-thread-usage { padding: 10px 12px; min-width: 220px; }
.chat-thread-usage-list { margin: 0; display: grid; gap: 4px; font-size: var(--fs-sm); }
.chat-thread-usage-list div { display: flex; justify-content: space-between; gap: var(--sp-4); }
.chat-thread-usage-list dt { color: var(--muted); }
.chat-thread-usage-list dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; }
.chat-thread-usage-note { margin-top: 8px; font-size: var(--fs-xs); color: var(--muted); max-width: 30ch; }

/* reconnecting, refused actions */
.chat-thread-reconnecting { margin: var(--sp-2) 0; font-size: var(--fs-sm); color: var(--warn); }
.chat-thread-problem { margin: var(--sp-3) 0; }
.chat-thread-problem-row { display: flex; align-items: flex-start; gap: var(--sp-2); min-width: 0; }
.chat-thread-problem-row .ui-notice { flex: 1; min-width: 0; }

/* /features/message-render.css */
/* Feature "message-render": styles for atrium.features.messagerender. Owned by the message-render task.
   Prefix every class with "message-render-" and use the tokens from css/tokens.css. */

.message-render { min-width: 0; color: var(--ink); overflow-wrap: anywhere; }
.message-render > * + * { margin-top: var(--sp-2); }
.message-render-plain { white-space: pre-wrap; }
.message-render-muted { color: var(--muted); font-size: var(--fs-md); margin: 0; }
.message-render-empty { color: var(--muted); font-size: var(--fs-md); font-style: italic; }

/* ---- markdown ---- */
.message-render-md { min-width: 0; line-height: 1.65; }
.message-render-md > :first-child { margin-top: 0; }
.message-render-md > :last-child { margin-bottom: 0; }
.message-render-md p { margin: 0 0 10px; }
.message-render-md h1, .message-render-md h2, .message-render-md h3,
.message-render-md h4, .message-render-md h5, .message-render-md h6 { margin: 18px 0 8px; font-weight: 600; line-height: 1.35; color: var(--ink); }
.message-render-md h1 { font-size: 18px; }
.message-render-md h2 { font-size: var(--fs-lg); }
.message-render-md h3 { font-size: 14.5px; }
.message-render-md h4, .message-render-md h5, .message-render-md h6 { font-size: var(--fs-base); color: var(--ink-2); }
.message-render-md ul, .message-render-md ol { margin: 0 0 10px; padding-left: 22px; }
.message-render-md li { margin: 3px 0; }
.message-render-md li > p { margin: 0 0 4px; }
.message-render-md li::marker { color: var(--muted); }
.message-render-md blockquote { margin: 0 0 10px; padding: 2px 0 2px 12px; border-left: 2px solid var(--accent-line); color: var(--ink-2); }
.message-render-md hr { margin: 16px 0; }
.message-render-md a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 2px; }
.message-render-md a:hover { text-decoration-color: var(--accent); }
.message-render-md strong { font-weight: 600; color: var(--ink); }
.message-render-md s { color: var(--muted); }
.message-render-md :not(pre) > code {
  font-size: 12.5px; background: var(--raise); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px;
  overflow-wrap: anywhere;
}
.message-render-md img { max-width: 100%; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); }
/* An image from another site, until the user asks for it (RemoteImages.kt). */
.message-render-remote-image {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-width: 0; margin: 2px 0; padding: 6px 10px;
  font: inherit; font-size: var(--fs-sm); color: var(--ink-2); background: var(--raise); border: 1px dashed var(--line-2);
  border-radius: var(--radius-sm); cursor: pointer; text-align: left;
}
.message-render-remote-image:hover { background: var(--hover); color: var(--ink); }
.message-render-remote-image .ui-icon { flex: none; width: 15px; height: 15px; }
.message-render-remote-image-text { min-width: 0; overflow-wrap: anywhere; }
/* Math can be sized and shifted far (\raisebox, \rlap): keep it from painting over other messages or controls. */
.message-render-md { overflow: clip; overflow-clip-margin: 4px; }

/* streaming caret (also used alone while the first token is on its way) */
.message-render .message-render-caret {
  display: inline-block; width: 7px; height: 15px; margin-left: 2px; vertical-align: -2px;
  background: var(--accent); animation: message-render-blink 1s steps(2) infinite;
}
@keyframes message-render-blink { 50% { opacity: 0; } }
.message-render-pending { min-height: 22px; }

/* ---- code blocks ---- */
.message-render-code {
  margin: 0 0 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid);
  overflow: hidden; min-width: 0;
}
.message-render-code-head {
  display: flex; align-items: center; gap: 4px; padding: 4px 6px 4px 12px; border-bottom: 1px solid var(--line);
  background: var(--raise); font-size: 11px;
}
.message-render-code-lang { flex: 1; min-width: 0; color: var(--muted); text-transform: lowercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-render-code-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 6px;
  color: var(--ink-2); font-size: 11px; transition: background var(--dur), color var(--dur);
}
.message-render-code-btn:hover { background: var(--hover); color: var(--ink); }
.message-render-code-btn .ui-icon { width: 13px; height: 13px; }
.message-render-code-btn--done { color: var(--ok); }
.message-render-code pre {
  margin: 0; padding: 12px 14px; overflow-x: auto; font-size: 12.5px; line-height: 1.6; tab-size: 4;
  white-space: pre; overflow-wrap: normal;
}
.message-render-code pre:focus-visible { outline-offset: -2px; border-radius: 0 0 var(--radius) var(--radius); }
.message-render-code code { font-size: inherit; background: none; border: 0; padding: 0; }
@media (max-width: 760px) {
  .message-render-code-btn-text { display: none; }
  .message-render-code-btn { width: 28px; padding: 0; justify-content: center; }
}

/* ---- tables ---- */
.message-render-table {
  margin: 0 0 12px; max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius);
}
.message-render-table:focus-visible { outline-offset: 0; }
.message-render-table table { border-collapse: collapse; width: max-content; min-width: 100%; font-size: var(--fs-md); }
.message-render-table th, .message-render-table td {
  padding: 7px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); overflow-wrap: normal;
}
.message-render-table th { background: var(--raise); font-weight: 600; color: var(--ink); white-space: nowrap; }
.message-render-table tr:last-child td { border-bottom: 0; }
.message-render-table td { color: var(--ink-2); max-width: 40ch; }

/* ---- math ---- */
.message-render-math--display, .message-render-math-block { display: block; max-width: 100%; overflow-x: auto; overflow-y: hidden; }
.message-render-math-block { margin: 4px 0 12px; }
.message-render-math-block .katex-display { margin: 0.4em 0; }
.message-render-math .katex { font-size: 1.08em; }
.message-render-math-src { font-size: 12.5px; color: var(--ink-2); background: var(--raise); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; }

/* ---- citation markers ---- */
.message-render-cites { white-space: nowrap; }
.message-render-cite {
  display: inline-grid; place-items: center; min-width: 18px; height: 17px; padding: 0 4px; margin: 0 1px;
  border-radius: 5px; background: var(--accent-soft); color: var(--accent); font-size: var(--fs-xs); font-weight: 600;
  line-height: 1; vertical-align: 2px; transition: background var(--dur), color var(--dur);
}
.message-render-cite:hover { background: var(--accent); color: var(--accent-ink); }

/* ---- collapsible blocks: reasoning, tool calls, code runs ---- */
.message-render-block { min-width: 0; }
.message-render-block-head {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 28px; padding: 3px 8px 3px 6px;
  margin-left: -6px; border-radius: 8px; color: var(--ink-2); font-size: var(--fs-md); text-align: left;
  transition: background var(--dur), color var(--dur);
}
.message-render-block-head:hover { background: var(--hover); color: var(--ink); }
.message-render-block-head > .ui-icon { color: var(--muted); }
.message-render-block-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-render-block-meta { color: var(--muted); font-size: var(--fs-sm); }
.message-render-chevron { width: 14px; height: 14px; color: var(--muted); transition: transform var(--dur) var(--ease); }
.message-render-block-head[aria-expanded="true"] .message-render-chevron,
.message-render-status-line[aria-expanded="true"] .message-render-chevron { transform: rotate(180deg); }
.message-render-block-body {
  margin: 6px 0 4px 2px; padding: 4px 0 4px 14px; border-left: 2px solid var(--line-2); color: var(--ink-2); min-width: 0;
}
.message-render-reasoning .message-render-block-body { font-size: var(--fs-md); }
.message-render-reasoning .message-render-md { color: var(--ink-2); }
.message-render-block--error .message-render-block-head { color: var(--danger); }
.message-render-block--error .message-render-block-head > .ui-icon { color: var(--danger); }
.message-render-block--waiting .message-render-block-head > .ui-icon { color: var(--warn); }
.message-render-tool .message-render-block-head > .ui-icon, .message-render-run .message-render-block-head > .ui-icon { color: var(--accent); }
.message-render-section-label {
  margin: 6px 0 6px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.message-render-block-body .message-render-code { margin-bottom: 8px; }
.message-render-output {
  margin: 0 0 8px; padding: 10px 12px; max-height: 320px; overflow: auto; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--panel-solid); font-size: var(--fs-sm); line-height: 1.55;
  white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink);
}
.message-render-output--error { color: var(--danger); border-color: var(--danger-line); background: var(--danger-soft); }
.message-render-spin { width: 14px; height: 14px; border-width: 2px; }

/* text that is being worked on */
.message-render-shimmer {
  background: linear-gradient(90deg, var(--ink-2) 0%, var(--ink) 45%, var(--ink-2) 90%);
  background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: message-render-shimmer 1.8s linear infinite;
}
@keyframes message-render-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---- status lines ---- */
.message-render-status { font-size: var(--fs-md); color: var(--ink-2); min-width: 0; }
.message-render-status-line {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 26px; padding: 2px 8px 2px 6px;
  margin-left: -6px; border-radius: 8px; color: var(--ink-2); text-align: left;
}
button.message-render-status-line:hover { background: var(--hover); color: var(--ink); }
.message-render-status-line > .ui-icon { color: var(--muted); }
.message-render-status-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-render-status--error .message-render-status-line, .message-render-status--error .message-render-status-line > .ui-icon { color: var(--danger); }
.message-render-status-list { list-style: none; margin: 4px 0 6px 2px; padding: 2px 0 2px 14px; border-left: 2px solid var(--line-2); }
.message-render-status-list > li { margin: 4px 0; }
.message-render-status-step { color: var(--ink-2); }
.message-render-status-step--error { color: var(--danger); }
.message-render-status-links { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }

.message-render-link {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; color: var(--accent); font-size: var(--fs-sm);
}
.message-render-link-hint { color: var(--muted); white-space: nowrap; }
.message-render-link .ui-icon { color: var(--muted); }

/* ---- sources ---- */
.message-render-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: var(--sp-3); }
.message-render-sources-all, .message-render-source-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; max-width: 220px; min-width: 0; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: var(--radius-pill); color: var(--ink-2); font-size: var(--fs-sm);
  transition: border-color var(--dur), color var(--dur), background var(--dur);
}
.message-render-sources-all { color: var(--ink); }
.message-render-sources-all .ui-icon, .message-render-source-chip .ui-icon { width: 13px; height: 13px; color: var(--muted); }
.message-render-sources-all:hover, .message-render-source-chip:hover { border-color: var(--accent-line); color: var(--ink); background: var(--accent-soft); }
.message-render-source-more { color: var(--muted); }
.message-render-source-n {
  display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 4px;
  background: var(--accent-soft); color: var(--accent); font-size: var(--fs-xs); font-weight: 600; flex: none;
}

.message-render-source-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.message-render-source {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--raise); min-width: 0;
  scroll-margin-top: 8px;
}
.message-render-source--focus { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-line) inset; }
.message-render-source-head { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--ink); }
.message-render-source-head .ui-icon { color: var(--muted); }
.message-render-source-title { min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.message-render-source-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 4px 0 2px 24px; font-size: var(--fs-sm); color: var(--ink-2); min-width: 0; }
.message-render-passage { margin: 8px 0 0 24px; padding: 8px 10px; border-left: 2px solid var(--line-2); background: var(--panel-solid); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.message-render-passage-text { margin: 0; font-size: var(--fs-sm); color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.message-render-passage-foot { display: flex; align-items: center; gap: 12px; margin-top: 4px; font-size: var(--fs-xs); }
.message-render-passage-foot .message-render-muted { font-size: var(--fs-xs); color: var(--ink-2); }
.message-render-more { color: var(--accent); font-size: var(--fs-xs); }
.message-render-more:hover { text-decoration: underline; }
@media (max-width: 760px) {
  .message-render-source-meta, .message-render-passage { margin-left: 0; }
}

/* ---- attachments, embeds ---- */
.message-render-images { display: flex; flex-wrap: wrap; gap: 8px; }
.message-render-image { display: block; max-width: min(100%, 420px); max-height: 420px; height: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--raise); }
.message-render-files { display: flex; flex-wrap: wrap; gap: 6px; }
.message-render-file { max-width: 260px; }
.message-render-embed { display: block; width: 100%; height: 360px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid); }

/* ---- error ---- */
.message-render-error {
  display: flex; align-items: flex-start; gap: 8px; margin-top: var(--sp-2); padding: 9px 12px; color: var(--danger);
  background: var(--danger-soft); border: 1px solid var(--danger-line); border-radius: var(--radius-sm); font-size: var(--fs-md);
}
.message-render-error .ui-icon { margin-top: 2px; }
.message-render-error-text { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Run on a code block, and what it printed */
.message-render-code-run { color: var(--accent); }
.message-render-code-out { border-top: 1px solid var(--line); padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 6px; }
.message-render-code-out-head { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--muted); }
.message-render-code-out[data-state="running"] .message-render-code-out-head { color: var(--accent); }
.message-render-code-out[data-state="error"] .message-render-code-out-head,
.message-render-code-out[data-state="timeout"] .message-render-code-out-head { color: var(--danger); }
.message-render-code-out-time { margin-left: auto; font-variant-numeric: tabular-nums; }
.message-render-code-out .message-render-output { margin: 0; }
.message-render-output--result { color: var(--ink); }
.message-render-image-link { display: inline-block; max-width: 100%; border-radius: var(--radius); }
.message-render-file-size { color: var(--muted); font-size: var(--fs-xs); flex: none; }

/* The Python sandbox (Pyodide.kt): an invisible iframe that only hosts the worker. */
.message-render-sandbox { display: none; }

/* /features/composer.css */
/* Feature "composer": styles for atrium.features.composer. Owned by the composer task.
   Prefix every class with "composer-" and use the tokens from css/tokens.css. */

/* ---------- the composer (mockup: .composer) ---------- */
.composer { width: 100%; min-width: 0; }
.composer-above { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.composer-above:empty { display: none; }
.composer-box {
  position: relative; display: flex; align-items: flex-end; gap: 6px; padding: 8px 8px 8px 10px; min-width: 0;
  border-radius: var(--radius-lg); border: 1px solid var(--line-2); background: var(--field); backdrop-filter: blur(10px);
  transition: border-color var(--dur), box-shadow var(--dur);
}
.composer-box:focus-within { border-color: var(--line-3); }
.composer-box:has(textarea:focus-visible) { box-shadow: 0 0 0 3px var(--accent-soft); }
.composer-box textarea {
  flex: 1; min-width: 0; resize: none; border: 0; outline: 0; background: none; color: var(--ink);
  padding: 8px 4px; max-height: 200px; line-height: 1.45; font-size: var(--fs-base); overflow-y: auto; overflow-wrap: anywhere;
}
.composer-box textarea:focus-visible { outline: none; }
.composer-box textarea::placeholder { color: var(--muted); }
.composer-box textarea:disabled { cursor: not-allowed; }
.composer-box .ui-icon-btn { width: 34px; height: 34px; border-radius: 9px; }
.composer-lead { display: flex; align-items: center; gap: 2px; flex: none; }
.composer--disabled .composer-box { opacity: .6; }

.composer-send {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--line-2); color: var(--muted); transition: background var(--dur), color var(--dur);
}
.composer-send--ready, .composer-send--stop { background: var(--ink); color: var(--bg); }
.composer-send:disabled { cursor: default; }

/* active toggles inside the docked box (mockup: .toggles .tag) */
.composer-tags { display: flex; gap: 4px; align-items: center; align-self: center; flex: none; min-width: 0; }
.composer-tag { cursor: pointer; border: 0; }
.composer-tag:hover { background: var(--accent-soft-2); }

/* chips under the centred composer (mockup: .chips) */
.composer-below { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.composer-chip-wrap { display: inline-flex; }

/* ---------- attachments ---------- */
.composer-files { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.composer-file {
  position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; max-width: min(260px, 100%);
  padding: 5px 4px 5px 5px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--panel); overflow: hidden;
}
.composer-file--failed { border-color: var(--danger-line); }
.composer-file--kb { border-color: var(--accent-line); }
.composer-file-thumb {
  width: 32px; height: 32px; flex: none; border-radius: var(--radius-sm); background: var(--raise);
  display: grid; place-items: center; color: var(--muted); overflow: hidden;
}
.composer-file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.composer-file--failed .composer-file-thumb { color: var(--danger); background: var(--danger-soft); }
.composer-file--kb .composer-file-thumb { color: var(--accent); background: var(--accent-soft); }
.composer-file-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.composer-file-name { font-size: var(--fs-sm); color: var(--ink); }
.composer-file-status { font-size: 11px; color: var(--muted); }
.composer-file--failed .composer-file-status { color: var(--danger); white-space: normal; }
.composer-file .ui-icon-btn { width: 26px; height: 26px; flex: none; }
.composer-file-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--line); }
.composer-file-bar-fill { height: 100%; background: var(--accent); transition: width .2s var(--ease); }
.composer-file-bar--busy .composer-file-bar-fill { animation: composer-pulse 1.1s ease-in-out infinite; }
@keyframes composer-pulse { 50% { opacity: .35; } }
.composer-warning { display: flex; align-items: center; gap: 6px; margin: -2px 0 8px; font-size: var(--fs-sm); color: var(--warn); }

/* ---------- `/` and `#` suggestions (above the box) ---------- */
.composer-suggest-slot { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 5; }
.composer-suggest {
  background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-pop);
  padding: 6px; max-height: min(320px, 50vh); overflow-y: auto;
}
.composer-suggest-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px 6px;
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent);
}
.composer-suggest-head .ui-spinner { width: 12px; height: 12px; }
.composer-suggest-group { font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 4px; }
.composer-suggest-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer;
  color: var(--ink-2); min-width: 0;
}
.composer-suggest-row .ui-icon { color: var(--muted); flex: none; }
.composer-suggest-row--active { background: var(--hover); color: var(--ink); }
.composer-suggest-row--active .ui-icon { color: var(--accent); }
.composer-suggest-row--active .composer-suggest-detail { color: var(--ink-2); }
.composer-suggest-label { flex: none; max-width: 55%; color: var(--ink); }
.composer-suggest-detail { flex: 1; font-size: var(--fs-sm); color: var(--muted); text-align: right; }
.composer-suggest-empty { padding: 8px 10px; font-size: var(--fs-md); color: var(--muted); }

/* ---------- options panel (docked) ---------- */
.composer-options { width: 300px; }
.composer-options-body { display: flex; flex-direction: column; padding: 0 4px 4px; }
.composer-options-body .ui-section-label:first-child { margin-top: 8px; }
.composer-options-row { display: flex; flex-direction: column; gap: 2px; padding: 6px 4px; }
.composer-options-hint { font-size: 11px; color: var(--muted); padding-left: 44px; overflow-wrap: anywhere; }
.composer-options-action {
  display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 8px; border-radius: var(--radius-sm);
  border-top: 1px solid var(--line); color: var(--ink-2); text-align: left; font-size: var(--fs-md);
}
.composer-options-action:hover { background: var(--hover); color: var(--ink); }
.composer-options-action .ui-icon { color: var(--muted); }
.composer-options-key { margin-left: auto; font-size: 11px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 5px; }

/* ---------- model picker (top bar; mockup: .model-btn and .menu) ---------- */
.composer-model-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 8px;
  font-weight: 500; color: var(--ink); min-width: 0; max-width: 100%;
}
.composer-model-btn:hover { background: var(--hover); }
.composer-model-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.composer-model-more { font-size: 11px; color: var(--accent); background: var(--accent-soft); border-radius: 5px; padding: 1px 5px; flex: none; }
.composer-model-src { font-size: 11px; color: var(--muted); font-weight: 400; flex: none; }
.composer-model-btn .ui-icon { color: var(--muted); flex: none; }
.composer-model-btn:hover .composer-model-src, .composer-model-btn[aria-expanded="true"] .composer-model-src { color: var(--ink-2); }

.composer-models.ui-popover { width: 360px; max-width: calc(100vw - 16px); padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.composer-models-body { display: flex; flex-direction: column; min-height: 0; max-height: min(70vh, 480px); }
.composer-models-search { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--muted); flex: none; }
.composer-models-search input { flex: 1; min-width: 0; border: 0; background: none; color: var(--ink); font-size: var(--fs-base); }
.composer-models-search input:focus-visible { outline: none; }
.composer-models-search:focus-within { color: var(--accent); }
.composer-models-search input::placeholder { color: var(--muted); }
.composer-models-selected { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; flex: none; }
.composer-models-selected .ui-chip { max-width: 100%; }
.composer-models-list { overflow-y: auto; padding: 4px 6px 6px; min-height: 0; flex: 1; }
.composer-models-group { font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 10px 10px 6px; }
.composer-models-row {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 6px; border-radius: var(--radius-sm); cursor: pointer;
  color: var(--ink-2); min-width: 0;
}
.composer-models-row--active { background: var(--hover); color: var(--ink); }
.composer-models-row--selected .composer-models-name { color: var(--ink); }
.composer-models-row--active .composer-models-meta, .composer-models-row--active .composer-models-desc { color: var(--ink-2); }
.composer-models-check { width: 16px; flex: none; display: grid; place-items: center; color: var(--accent); }
.composer-models-check .ui-icon { width: 14px; height: 14px; }
.composer-models-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.composer-models-name { font-weight: 500; }
.composer-models-desc { font-size: 11px; color: var(--muted); }
.composer-models-meta { font-size: 11px; color: var(--muted); flex: none; }
.composer-models-row .ui-tag { flex: none; }
.composer-models-empty { padding: 14px 16px; font-size: var(--fs-md); color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.composer-models-foot { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 12px; border-top: 1px solid var(--line); flex: none; }

/* ---------- drop overlay ---------- */
.composer-drop {
  position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; pointer-events: none;
  background: var(--overlay); backdrop-filter: blur(2px);
}
.composer-drop-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px 40px; border-radius: var(--radius-lg);
  border: 1.5px dashed var(--accent-line); background: var(--panel-solid); color: var(--ink); font-size: var(--fs-lg);
}
.composer-drop-card .ui-icon { width: 28px; height: 28px; color: var(--accent); }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  .composer-tags { display: none; }
  .composer-below .ui-chip { height: 40px; }
  .composer-model-src { display: none; }
  .composer-file { max-width: 100%; }
  .composer-suggest-label { max-width: 70%; }
  .composer-suggest-detail { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .composer-file-bar--busy .composer-file-bar-fill { animation: none; }
}

/* a tool the user can't turn on right now */
.composer-options-row--off .ui-toggle-label { color: var(--muted); }

/* /features/sidebar.css */
/* Feature "sidebar": the Chats panel (search, pinned, projects, chats), the search palette and the archived page.
   Layout and sizes follow atrium/design/chat-shell.html (.search, .label, .bucket, .proj, .chat). */

.sidebar { display: flex; flex-direction: column; min-width: 0; }

/* search box */
.sidebar-search {
  display: flex; align-items: center; gap: 8px; margin: 10px 0 6px; padding: 0 4px 0 8px; height: 32px;
  border-radius: var(--radius-sm); color: var(--muted); border: 1px solid transparent;
}
.sidebar-search:focus-within { background: var(--raise); border-color: var(--line-2); }
.sidebar-search:has(input:focus-visible) { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-line); }
.sidebar-search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-size: var(--fs-md); color: var(--ink); }
.sidebar-search input::placeholder { color: var(--muted); }
.sidebar-search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.sidebar-search-palette { display: inline-flex; align-items: center; padding: 3px; border-radius: 5px; flex: none; }
.sidebar-search-palette:hover { background: var(--hover); }

/* section headings and hints */
.sidebar-label { min-height: 22px; }
.sidebar-label .ui-icon { width: 13px; height: 13px; flex: none; }
.sidebar-label .spacer { flex: 1; }
.sidebar-label .ui-icon-btn--sm { width: 22px; height: 22px; color: var(--muted); }
.sidebar-label .ui-icon-btn--sm .ui-icon { width: 14px; height: 14px; }
.sidebar-hint { margin: 0 8px 4px; font-size: var(--fs-sm); color: var(--muted); }
.sidebar-bucket {
  margin: 10px 8px 4px calc(22px + var(--depth, 0) * 14px); font-size: 9.5px; font-weight: 500; line-height: 1;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.sidebar-section { min-width: 0; }
.sidebar-loading, .sidebar-error { padding: 6px 8px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.sidebar-loading { align-items: stretch; }
.sidebar-loading-more { display: flex; justify-content: center; min-height: 8px; padding: 4px 0; }
.sidebar-sentinel { height: 1px; }

/* lists and rows */
.sidebar-list { list-style: none; margin: 0; padding: 0; min-width: 0; }
.sidebar-row { position: relative; display: flex; align-items: center; min-width: 0; border-radius: var(--radius-sm); }
.sidebar-row:hover { background: var(--hover); }
.sidebar-row--current, .sidebar-row--current:hover { background: var(--accent-soft); }
.sidebar-row > .ui-list-row { flex: 1; }
.sidebar-chat {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; min-height: 28px;
  padding: 5px 8px 5px calc(22px + var(--depth, 0) * 14px); border-radius: var(--radius-sm);
  color: var(--ink-2); font-size: var(--fs-md); text-decoration: none;
}
.sidebar-section[data-testid="sidebar-pinned"] .sidebar-chat { padding-left: 8px; }
.sidebar-chat:hover { color: var(--ink); text-decoration: none; }
.sidebar-row--current .sidebar-chat { color: var(--ink); }
.sidebar-chat-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-meta { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; flex: none; }
.sidebar-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--faint); flex: none; }
.sidebar-dot[data-state="unread"] { background: var(--accent); }
.sidebar-dot[data-state="active"] { background: var(--accent); animation: sidebar-pulse 1.2s var(--ease) infinite; }
@keyframes sidebar-pulse { 50% { opacity: .3; transform: scale(1.6); } }

/* row actions: shown on hover and keyboard focus (always on touch screens) */
.sidebar-row-actions { display: inline-flex; flex: none; opacity: 0; margin-right: 2px; }
.sidebar-row:hover .sidebar-row-actions,
.sidebar-row:focus-within .sidebar-row-actions,
.sidebar-folder-head:hover .sidebar-row-actions,
.sidebar-folder-head:focus-within .sidebar-row-actions,
.sidebar-row-actions:has([aria-expanded="true"]) { opacity: 1; }
.sidebar-row:hover .sidebar-meta, .sidebar-row:focus-within .sidebar-meta { visibility: hidden; }
.sidebar-row .sidebar-row-actions,
.sidebar-folder-head .sidebar-row-actions { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); }
@media (pointer: coarse) {
  .sidebar-row-actions { opacity: 1; }
  .sidebar-row .sidebar-row-actions,
  .sidebar-folder-head .sidebar-row-actions { position: static; transform: none; }
  .sidebar-row .sidebar-meta, .sidebar-folder-toggle .sidebar-meta { display: none; }
}

/* projects */
.sidebar-folder { min-width: 0; }
.sidebar-folder-head {
  position: relative; display: flex; align-items: center; min-width: 0; border-radius: var(--radius-sm);
  padding-left: calc(var(--depth, 0) * 14px);
}
.sidebar-folder-head:hover { background: var(--hover); }
.sidebar-folder-toggle {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 6px 8px;
  border-radius: var(--radius-sm); color: var(--ink-2); text-align: left; font-size: var(--fs-base);
}
.sidebar-folder-head:hover .sidebar-folder-toggle { color: var(--ink); }
.sidebar-folder-toggle .ui-icon { flex: none; color: var(--muted); }
.sidebar-chev { width: 12px; height: 12px; transition: transform var(--dur) var(--ease); }
.sidebar-folder[data-open="false"] > .sidebar-folder-head .sidebar-chev { transform: rotate(-90deg); }
.sidebar-folder-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-folder-head:hover .sidebar-folder-toggle .sidebar-meta,
.sidebar-folder-head:focus-within .sidebar-folder-toggle .sidebar-meta { visibility: hidden; }
.sidebar-indent { padding: 2px 8px 4px calc(22px + var(--depth, 0) * 14px); }
.sidebar-hint.sidebar-indent { margin: 0; }
.sidebar-more { display: block; font-size: var(--fs-sm); color: var(--muted); padding-top: 4px; padding-bottom: 4px; border-radius: var(--radius-sm); }
.sidebar-more:hover { color: var(--ink); }

/* drag and drop */
.sidebar-drop { border-radius: var(--radius-sm); }
.sidebar-drop--over { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }

/* inline name editor */
.sidebar-name-field { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 2px 4px; }
.sidebar-name-input { height: 30px; font-size: var(--fs-md); padding: 0 8px; }
.sidebar-section > .sidebar-name-field { padding: 2px 4px 6px; }

/* archived link at the bottom of the panel */
.sidebar-archived { margin-top: 14px; color: var(--muted); font-size: var(--fs-md); }

/* move-to-project dialog */
.sidebar-pick { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.sidebar-pick-item { width: 100%; }
.sidebar-pick-item:disabled { opacity: 1; color: var(--accent); }

/* search palette (Ctrl+K) */
.sidebar-palette-list .ui-menu-group { padding-top: 8px; }
.sidebar-palette-item { width: 100%; }
.sidebar-palette-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.sidebar-palette-sub { font-size: var(--fs-sm); color: var(--muted); }
.sidebar-palette-item[aria-selected="true"] .sidebar-palette-sub { color: var(--ink-2); }
.sidebar-palette-empty { padding: 10px; }

/* archived chats page */
.sidebar-archived-head { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sidebar-archived-head .ui-page-title { margin: 0; }
.sidebar-archived-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.sidebar-archived-search { flex: 1 1 240px; min-width: 0; }
.sidebar-archived-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid); }
.sidebar-archived-row { display: flex; align-items: center; gap: 8px; padding: 10px 12px; min-width: 0; }
.sidebar-archived-row + .sidebar-archived-row { border-top: 1px solid var(--line); }
.sidebar-archived-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sidebar-archived-title { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-archived-date { font-size: var(--fs-sm); color: var(--muted); }
.sidebar-archived-more { display: flex; justify-content: center; padding: 12px; }
/* search results: title, snippet with marked matches, tags */
.sidebar-result { align-items: stretch; }
.sidebar-result-link {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: 6px 8px;
  border-radius: var(--radius-sm); color: var(--ink-2); font-size: var(--fs-md); text-decoration: none;
}
.sidebar-result-link:hover { color: var(--ink); text-decoration: none; }
.sidebar-result-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sidebar-result-head .ui-icon { width: 13px; height: 13px; flex: none; color: var(--muted); }
.sidebar-snippet {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: var(--fs-sm); color: var(--muted); line-height: 1.4; overflow-wrap: anywhere;
}
.sidebar-snippet mark { background: var(--accent-soft); color: var(--accent); border-radius: 3px; padding: 0 1px; }
.sidebar-result-tags { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.sidebar-tag {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 6px;
  border: 1px solid var(--line-2); border-radius: var(--radius-pill); font-size: var(--fs-xs); color: var(--muted);
}

/* dialogs: tags, tag manager, import, project settings */
.sidebar-dialog-sub { margin: 0 0 10px; color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.sidebar-tags { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sidebar-tags .sidebar-hint, .sidebar-flush { margin: 0; }
.sidebar-tag-chips, .sidebar-tag-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.sidebar-tag-list { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.sidebar-tag-row { display: flex; align-items: center; gap: 2px; min-width: 0; border-radius: var(--radius-sm); }
.sidebar-tag-row:hover { background: var(--hover); }
.sidebar-tag-open {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-size: var(--fs-md); text-align: left;
}
.sidebar-tag-open:hover { color: var(--ink); }
.sidebar-tag-open .ui-icon { width: 13px; height: 13px; flex: none; color: var(--muted); }
.sidebar-tag-open .truncate { flex: 1; min-width: 0; }
.sidebar-import-notes { margin: 8px 0 0; padding-left: 18px; font-size: var(--fs-sm); color: var(--muted); max-height: 30vh; overflow-y: auto; }
.sidebar-project-form { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sidebar-project-form .ui-field { margin: 0; }
.sidebar-knowledge { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.sidebar-knowledge-row { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 10px; min-width: 0; }
.sidebar-knowledge-row + .sidebar-knowledge-row { border-top: 1px solid var(--line); }
.sidebar-knowledge-row > .ui-icon { width: 14px; height: 14px; flex: none; color: var(--muted); }
.sidebar-knowledge-name { flex: 1; min-width: 0; color: var(--ink); font-size: var(--fs-md); }
.sidebar-knowledge-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.sidebar-knowledge-pick { flex: 1 1 200px; min-width: 0; }
.sidebar-knowledge-pick .ui-field { margin: 0; }
.sidebar-folder-flag { display: inline-flex; flex: none; }
.sidebar-folder-flag .ui-icon { width: 11px; height: 11px; color: var(--accent); }

/* archived page actions */
.sidebar-archived-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.sidebar-danger { color: var(--danger); }
.sidebar-danger:hover:not(:disabled) { color: var(--danger); background: var(--danger-soft); }
.sidebar-archived-text .sidebar-snippet { margin-top: 2px; }

@media (max-width: 760px) {
  .sidebar-search-palette { display: none; }
  .sidebar-archived-row { flex-wrap: wrap; }
  .sidebar-archived-text { flex-basis: 100%; }
}

/* /features/auth-screens.css */
/* Feature "auth-screens": styles for atrium.features.authscreens. Owned by the auth-screens task.
   Prefix every class with "auth-screens-" and use the tokens from css/tokens.css. */

/* The sign-in and waiting screens: a card in the middle of the water backdrop, the licences link under it. */
.auth-screens { align-content: center; gap: var(--sp-4); }
.auth-screens-card {
  width: min(400px, 100%); min-width: 0; display: flex; flex-direction: column; gap: 14px; padding: 28px 26px 22px;
  background: var(--panel); backdrop-filter: blur(14px); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: var(--shadow-pop);
}
.auth-screens-brand { display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 500; color: var(--ink); }
.auth-screens-brand .ui-icon { width: 24px; height: 24px; stroke-width: 1.5; }
.auth-screens-title { font-size: var(--fs-xl); font-weight: 500; margin-top: 6px; overflow-wrap: anywhere; }
.auth-screens-sub { color: var(--muted); font-size: var(--fs-md); margin: -6px 0 0; overflow-wrap: anywhere; }
.auth-screens-form { display: flex; flex-direction: column; gap: 12px; margin-top: 2px; }
.auth-screens-form .ui-btn { margin-top: 4px; }
.auth-screens-methods { margin-top: -2px; }
.auth-screens-methods + div { padding-top: 2px; }

/* password field with its show/hide button inside the input's right edge */
.auth-screens-pw { position: relative; display: flex; min-width: 0; }
.auth-screens-pw .ui-input { flex: 1; min-width: 0; padding-right: 40px; }
.auth-screens-pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }

/* providers, under an "or" rule when there is a form above them */
.auth-screens-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: var(--fs-sm); }
.auth-screens-or::before, .auth-screens-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-screens-oauth { display: flex; flex-direction: column; gap: 8px; }
.auth-screens-oauth .ui-btn { white-space: normal; height: auto; min-height: 40px; padding-top: 8px; padding-bottom: 8px; text-align: center; overflow-wrap: anywhere; }
.auth-screens-oauth .ui-btn .ui-icon { flex: none; }

.auth-screens-switch { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 6px; font-size: var(--fs-md); padding-top: 2px; }
.auth-screens-working { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: var(--fs-md); min-height: 40px; }
.auth-screens-foot { display: flex; justify-content: center; font-size: var(--fs-sm); }
.auth-screens-foot a { color: var(--muted); text-decoration: none; padding: 4px 6px; border-radius: var(--radius-sm); }
.auth-screens-foot a:hover { color: var(--ink-2); }

/* waiting for approval */
.auth-screens-pending-icon {
  width: 44px; height: 44px; display: grid; place-items: center; margin-top: 4px;
  border-radius: 12px; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line);
}
.auth-screens-facts { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; font-size: var(--fs-md); background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
.auth-screens-facts p { margin: 0; min-width: 0; }
.auth-screens-facts a { color: var(--accent); }
.auth-screens-wrap { overflow-wrap: anywhere; font-weight: 500; }
.auth-screens-status { margin: 0; font-size: var(--fs-sm); color: var(--muted); }
.auth-screens-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.auth-screens-actions .ui-btn { flex: 1 1 140px; }

/* the admin's waiting message is plain text: keep its line breaks */
.auth-screens-pre { white-space: pre-line; }

/* behind an authenticating proxy: "Continue" */
.auth-screens-trusted { display: flex; flex-direction: column; gap: 10px; }

@media (max-width: 760px) {
  .auth-screens { padding: 16px; }
  .auth-screens-card { padding: 22px 18px 18px; }
}

/* /features/settings-account.css */
/* Feature "settings-account": styles for atrium.features.settingsaccount. Owned by the settings-account task.
   Prefix every class with "settings-account-" and use the tokens from css/tokens.css. */

/* the dialog: tabs on the left, the panel on the right; a fixed height so switching tabs doesn't jump */
.ui-modal:has(.settings-account-layout) { width: min(880px, 100%); }
.ui-modal:has(.settings-account-layout) .ui-modal-body { padding: 0; overflow: hidden; display: flex; min-height: 0; }
.settings-account-layout {
  display: grid; grid-template-columns: 196px minmax(0, 1fr); width: 100%; min-width: 0;
  height: min(640px, calc(100vh - 96px)); border-top: 1px solid var(--line);
}
.settings-account-nav {
  display: flex; flex-direction: column; gap: 2px; padding: var(--sp-3) var(--sp-2);
  border-right: 1px solid var(--line); overflow-y: auto; min-width: 0;
}
.settings-account-tab {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 6px 10px;
  border-radius: var(--radius-sm); color: var(--ink-2); font-size: var(--fs-md); text-align: left; cursor: pointer;
}
.settings-account-tab:hover { background: var(--hover); color: var(--ink); }
.settings-account-tab .ui-icon { color: var(--muted); flex: none; }
.settings-account-tab[aria-selected="true"] { background: var(--accent-soft); color: var(--ink); }
.settings-account-tab[aria-selected="true"] .ui-icon { color: var(--accent); }
.settings-account-tab span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-account-panel { min-width: 0; overflow-y: auto; padding: var(--sp-4) var(--sp-5) var(--sp-6); }

/* sections (cards) */
.settings-account-stack { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.settings-account-section {
  display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-4);
}
.settings-account-panel .settings-account-section { background: var(--raise); }
.settings-account-section--danger { border-color: var(--danger-line); }
.settings-account-section-head { display: flex; flex-direction: column; gap: 2px; }
.settings-account-section-title { font-size: var(--fs-base); font-weight: 600; color: var(--ink); }
.settings-account-section-desc, .settings-account-text { font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; }

/* a setting: text left, control right */
.settings-account-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); min-width: 0;
  padding: var(--sp-2) 0; border-top: 1px solid var(--line);
}
.settings-account-section-head + .settings-account-row { border-top: 0; }
.settings-account-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.settings-account-row-label { font-size: var(--fs-md); color: var(--ink); }
.settings-account-row-desc { font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; }
.settings-account-row-control { flex: none; display: flex; align-items: center; gap: var(--sp-2); }

.settings-account-form { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.settings-account-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); }

/* profile */
.settings-account-picture { display: flex; align-items: center; gap: var(--sp-4); min-width: 0; flex-wrap: wrap; }
.settings-account-picture .ui-avatar { width: 64px; height: 64px; font-size: 20px; }
.settings-account-picture-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.settings-account-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-3); margin: 0; min-width: 0; }
.settings-account-facts > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.settings-account-facts dt { font-size: var(--fs-sm); color: var(--ink-2); font-weight: 500; }
.settings-account-facts dd { margin: 0; color: var(--ink); font-size: var(--fs-md); overflow-wrap: anywhere; }

/* API key */
.settings-account-key { min-width: 0; }
.settings-account-key-value {
  display: block; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--field); color: var(--ink); font-size: var(--fs-md); overflow-wrap: anywhere; user-select: all;
}

/* lists: sessions and API keys */
.settings-account-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; min-width: 0; }
.settings-account-item {
  display: flex; align-items: center; gap: var(--sp-3); min-width: 0; padding: var(--sp-2) 0; border-top: 1px solid var(--line);
}
.settings-account-item:first-child { border-top: 0; padding-top: 0; }
.settings-account-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.settings-account-item-title {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0;
  color: var(--ink); font-size: var(--fs-md); overflow-wrap: anywhere;
}
.settings-account-item-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: var(--fs-sm); color: var(--muted); min-width: 0; }
.settings-account-item-actions { flex: none; display: flex; gap: 2px; }
.settings-account-hint { font-size: var(--fs-sm); color: var(--ink-2); }
.settings-account-wrap { overflow-wrap: anywhere; min-width: 0; }
.settings-account-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.settings-account-key { display: flex; align-items: center; gap: var(--sp-2); }
.settings-account-key .settings-account-key-value { flex: 1; min-width: 0; }

/* about */
.settings-account-about { display: flex; align-items: center; gap: var(--sp-4); min-width: 0; }
.settings-account-about > .ui-icon { color: var(--accent); flex: none; }
.settings-account-about .settings-account-facts { flex: 1; }
.settings-account-links { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); font-size: var(--fs-sm); }

/* the full page (/settings/<tab>): the shell's frame holds the tab list */
.shell-frame-body > .settings-account-stack, .shell-frame-body > .settings-account-section { max-width: 720px; }

@media (max-width: 760px) {
  .settings-account-row { flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); }
  .settings-account-row-text { flex: 1 1 200px; }
  .settings-account-section { padding: var(--sp-3); }
  .settings-account-item { flex-wrap: wrap; }
  .settings-account-key { flex-direction: column; align-items: stretch; }
}

/* /features/share.css */
/* Feature "share": the share dialog, Settings → Shared links, and the public page /s/<id>.
   Every class is prefixed "share-"; colours and spacing come from css/tokens.css. */

/* ---- shared bits ---- */
.share-meta { margin: 0; color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.share-delete-btn { color: var(--danger); }
.share-delete-btn:hover:not(:disabled) { color: var(--danger); background: var(--danger-soft); }

/* ---- share dialog ---- */
.share-dialog { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.share-chat-title { margin: 0; color: var(--ink); font-size: var(--fs-base); }
.share-lede { margin: 0; line-height: var(--lh); }
.share-link { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.share-link-row { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.share-link-hidden { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); min-width: 0; }
.share-link-input { flex: 1; min-width: 0; font-size: var(--fs-sm); color: var(--ink); }

.share-audience { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.share-audience legend { display: flex; align-items: center; gap: var(--sp-2); padding: 0; margin-bottom: 6px; }
.share-saving { display: inline-flex; }
.share-option {
  display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.share-option:hover { background: var(--hover); }
.share-option:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
.share-option:has(input:checked) .share-option-hint { color: var(--ink-2); }
.share-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.share-option[data-disabled="true"] { cursor: not-allowed; }
.share-option[data-disabled="true"]:hover { background: var(--card); }
.share-option[data-disabled="true"] .share-option-label { color: var(--muted); }
.share-option input { margin: 3px 0 0; accent-color: var(--accent); flex: none; }
.share-option-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.share-option-label { color: var(--ink); font-size: var(--fs-md); }
.share-option-hint { color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }

.share-people { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.share-people .ui-field { margin: 0; }
.share-people-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.share-results { list-style: none; margin: 0; padding: 4px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--raise); }
.share-result {
  display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto; align-items: center; gap: 10px;
  width: 100%; padding: 7px 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink);
  font: inherit; font-size: var(--fs-md); text-align: left; cursor: pointer;
}
.share-result:hover:not(:disabled) { background: var(--hover); }
.share-result:disabled { cursor: progress; }
.share-result-email { color: var(--muted); font-size: var(--fs-sm); }
.share-result-add { color: var(--accent); font-size: var(--fs-sm); }
.share-confirm-text { margin-right: auto; align-self: center; color: var(--ink); font-size: var(--fs-md); }
.ui-modal-foot .share-delete-btn { margin-right: auto; }
[data-testid="share-dialog"] .ui-modal-foot { flex-wrap: wrap; }

/* ---- Settings → Shared links ---- */
.share-links { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.share-links-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.share-links-heading { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.share-links-heading .ui-page-title, .share-links-heading .ui-page-sub { margin: 0; }
.share-links-tools { display: flex; gap: var(--sp-2); flex-wrap: wrap; min-width: 0; }
.share-links-tools .ui-field { margin: 0; }
.share-links-search { flex: 1 1 220px; min-width: 0; }
.share-links-sort { flex: 0 1 180px; min-width: 0; }
.share-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.share-row { display: flex; align-items: center; gap: var(--sp-3); padding: 10px 10px 10px 14px; min-width: 0; }
.share-row + .share-row { border-top: 1px solid var(--line); }
.share-row-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.share-row-title { color: var(--ink); font-size: var(--fs-md); text-decoration: none; }
.share-row-title:hover { color: var(--accent); }
.share-row-meta { color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.share-row-actions { display: flex; gap: 2px; flex: none; }

/* ---- public page /s/<id> ---- */
.share-page { min-height: 100%; display: flex; flex-direction: column; }
.share-page-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: var(--sp-3);
  min-height: 52px; padding: 8px 20px; border-bottom: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(8px);
}
.share-brand { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--ink); font-size: var(--fs-lg); text-decoration: none; }
.share-brand:hover { color: var(--accent); }
.share-page-body { width: 100%; max-width: var(--content-w); min-width: 0; margin: 0 auto; padding: 28px 20px 64px; }
.share-page-intro { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: var(--sp-4); }
.share-page-title { margin: 0; font-size: var(--fs-xl); font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.share-readonly {
  display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 0; padding: 2px 10px;
  border: 1px solid var(--line-2); border-radius: var(--radius-pill); color: var(--ink-2); font-size: var(--fs-sm);
}
.share-thread { display: flex; flex-direction: column; min-width: 0; }
.share-msg-user {
  margin: 22px 0 14px; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--bubble); color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere;
}
.share-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; white-space: normal; }
.share-attachment {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 2px 8px; overflow-wrap: anywhere;
  border: 1px solid var(--line-2); border-radius: var(--radius-pill); color: var(--ink-2); font-size: var(--fs-sm);
}
.share-attachment-image { display: block; max-width: 100%; }
.share-attachment-image img { display: block; max-width: min(320px, 100%); max-height: 240px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.share-row-meta .ui-tag { margin-right: 6px; }
.share-msg-ai { min-width: 0; padding: 0 2px; color: var(--ink); }
.share-msg-meta { margin-top: 6px; color: var(--muted); font-size: 11px; }
.share-page-end {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  margin-top: var(--sp-8); padding-top: var(--sp-5); border-top: 1px solid var(--line);
}
.share-page-loading { padding-top: var(--sp-4); }
.share-problem {
  display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 460px; margin: 48px auto 0;
  text-align: center; color: var(--ink-2);
}
.share-problem-code { font-size: 44px; font-weight: 300; letter-spacing: .08em; color: var(--accent); line-height: 1; }
.share-problem-title { margin: 0; font-size: var(--fs-lg); font-weight: 500; color: var(--ink); }
.share-problem-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-2); margin-top: 6px; }

@media (max-width: 760px) {
  .share-page-head { padding: 8px 12px; }
  .share-page-body { padding: 20px 14px 48px; }
  .share-row { padding: 8px 6px 8px 12px; }
  [data-testid="share-dialog"] .ui-modal-foot .ui-btn { flex: 1 1 40%; justify-content: center; }
  [data-testid="share-dialog"] .ui-modal-foot .share-copy-btn { order: -1; flex-basis: 100%; }
  .ui-modal-foot .share-delete-btn { margin-right: 0; }
}
@media (max-width: 420px) {
  .share-row { flex-wrap: wrap; }
  .share-row-actions { margin-left: auto; }
}

/* /features/knowledge.css */
/* Feature "knowledge": the knowledge list, a knowledge base's page (files, folders, uploads), and its dialogs.
   Every class is prefixed "knowledge-"; colours and spacing come from css/tokens.css. */

/* ---- shared bits ---- */
.knowledge-page { display: flex; flex-direction: column; gap: var(--sp-3); }
.knowledge-page .ui-page-head { margin-bottom: 0; }
.knowledge-hint { margin: 0; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh); overflow-wrap: anywhere; }
.knowledge-search { flex: 1 1 220px; min-width: 0; }
.knowledge-search .ui-field { margin: 0; }
.knowledge-loading { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-4) 0; color: var(--muted); font-size: var(--fs-md); }
.knowledge-more { display: flex; justify-content: center; padding: var(--sp-2) 0; }
.knowledge-gap { margin-top: var(--sp-6); }

/* ---- list page ---- */
.knowledge-head-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.knowledge-head-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.knowledge-lede { margin: 0; color: var(--ink-2); font-size: var(--fs-md); line-height: var(--lh); max-width: 640px; }
.knowledge-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2); min-width: 0; }
.knowledge-tools .ui-field { margin: 0; }
.knowledge-tools .ui-select { min-width: 0; }

.knowledge-grid {
  list-style: none; margin: 0; padding: 0; min-width: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px;
}
.knowledge-grid > li { display: flex; min-width: 0; }
.knowledge-card {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-2);
  padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid);
  color: var(--ink); text-decoration: none;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
a.knowledge-card:hover { background: var(--hover); border-color: var(--line-2); text-decoration: none; }
a.knowledge-card:hover .knowledge-card-title { color: var(--accent); }
.knowledge-card--skeleton { min-height: 120px; }
.knowledge-card-head { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.knowledge-card-head .ui-icon { color: var(--accent); flex: none; }
.knowledge-card-title { margin: 0; font-size: var(--fs-base); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color var(--dur) var(--ease); }
.knowledge-card-desc {
  margin: 0; color: var(--ink-2); font-size: var(--fs-sm); line-height: var(--lh); min-height: calc(2 * var(--lh) * var(--fs-sm));
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.knowledge-card-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.knowledge-card-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: auto; color: var(--muted); font-size: var(--fs-xs); min-width: 0; }

/* ---- detail page ---- */
.knowledge-back {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin-top: 4px;
  color: var(--muted); font-size: var(--fs-sm); text-decoration: none; border-radius: var(--radius-sm); padding: 2px 4px; margin-left: -4px;
}
.knowledge-back:hover { color: var(--ink); text-decoration: none; }
.knowledge-back .ui-icon { width: 14px; height: 14px; }
.knowledge-detail-head { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.knowledge-detail-title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); min-width: 0; }
.knowledge-detail-title .ui-page-title { margin: 0; flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; }
.knowledge-detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.knowledge-detail-desc { margin: 0; color: var(--ink-2); font-size: var(--fs-md); line-height: var(--lh); max-width: 720px; overflow-wrap: anywhere; white-space: pre-line; }
.knowledge-detail-meta { color: var(--muted); font-size: var(--fs-xs); }

/* ---- files ---- */
.knowledge-files {
  position: relative; display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0;
  margin-top: var(--sp-2); padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
}
.knowledge-files--drop { border-color: var(--accent-line); }
.knowledge-files-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2); min-width: 0; }
.knowledge-files-bar .ui-field { margin: 0; }
.knowledge-files-actions { display: flex; align-items: center; gap: var(--sp-1); }
.knowledge-files-count { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }

.knowledge-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; min-width: 0; padding: 4px 2px; font-size: var(--fs-sm); }
.knowledge-crumb {
  color: var(--ink-2); background: none; border: 0; font: inherit; padding: 2px 6px; border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none; overflow-wrap: anywhere;
}
.knowledge-crumb:hover { color: var(--ink); background: var(--hover); text-decoration: none; }
.knowledge-crumb-here { color: var(--ink); padding: 2px 6px; overflow-wrap: anywhere; }
.knowledge-crumb-sep { color: var(--muted); }

.knowledge-list, .knowledge-uploads { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; min-width: 0; }
.knowledge-uploads { gap: 2px; padding-bottom: var(--sp-2); border-bottom: 1px solid var(--line); }
.knowledge-row {
  display: flex; align-items: center; gap: var(--sp-2); min-width: 0; min-height: 40px;
  padding: 2px 4px 2px 0; border-radius: var(--radius-sm);
}
.knowledge-list .knowledge-row:hover { background: var(--hover); }
.knowledge-row-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 8px; text-align: left;
  background: none; border: 0; color: var(--ink); font: inherit; font-size: var(--fs-md); cursor: pointer; border-radius: var(--radius-sm);
}
.knowledge-row-main .ui-icon { color: var(--accent); flex: none; }
.knowledge-row-name { min-width: 0; }
.knowledge-row-meta { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }
.knowledge-kind {
  flex: none; display: inline-grid; place-items: center; min-width: 38px; height: 22px; padding: 0 4px;
  border: 1px solid var(--line-2); border-radius: 5px; color: var(--ink-2); font-size: 9.5px; font-weight: 600; letter-spacing: .04em;
}

.knowledge-upload { padding: 6px 8px; background: var(--raise); }
.knowledge-upload .ui-spinner { flex: none; }
.knowledge-upload .ui-icon { color: var(--danger); flex: none; }
.knowledge-upload-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: var(--fs-md); }
.knowledge-upload-state { color: var(--muted); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.knowledge-upload--failed .knowledge-upload-state { color: var(--danger); }
.knowledge-upload-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.knowledge-progress { flex: 0 0 90px; height: 4px; border-radius: var(--radius-pill); background: var(--line); overflow: hidden; }
.knowledge-progress-bar { display: block; height: 100%; background: var(--accent); transition: width var(--dur) linear; }

.knowledge-drop {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-2);
  border: 2px dashed var(--accent-line); border-radius: var(--radius); background: var(--scrim); color: var(--ink); pointer-events: none;
}
.knowledge-drop .ui-icon { width: 28px; height: 28px; color: var(--accent); }

/* ---- external ---- */
.knowledge-external { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; margin-top: var(--sp-2); padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.knowledge-external .ui-section-label { margin: 6px 0 2px; }
.knowledge-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: var(--fs-md); }
.knowledge-facts dt { color: var(--muted); }
.knowledge-facts dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.knowledge-try { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); min-width: 0; }
.knowledge-hits { margin: 0; padding: 0 0 0 20px; display: flex; flex-direction: column; gap: var(--sp-2); }
.knowledge-hit { color: var(--ink-2); padding-left: 4px; }
.knowledge-hit::marker { color: var(--muted); font-size: var(--fs-sm); }
.knowledge-hit-head { display: flex; justify-content: space-between; gap: var(--sp-2); color: var(--ink); font-size: var(--fs-sm); min-width: 0; }
.knowledge-hit-score { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }
.knowledge-hit-text { margin: 2px 0 0; font-size: var(--fs-sm); line-height: var(--lh); overflow-wrap: anywhere; }

/* ---- dialogs ---- */
.knowledge-form { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.knowledge-form .ui-field { margin: 0; }
.knowledge-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-3); min-width: 0; }
.knowledge-options { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.knowledge-options legend { padding: 0; margin-bottom: 6px; }
.knowledge-option {
  display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; min-width: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.knowledge-option:hover { background: var(--hover); }
.knowledge-option:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
.knowledge-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.knowledge-option[data-disabled="true"] { cursor: not-allowed; }
.knowledge-option[data-disabled="true"]:hover { background: var(--card); }
.knowledge-option[data-disabled="true"] .knowledge-option-label { color: var(--muted); }
.knowledge-option input { margin: 3px 0 0; accent-color: var(--accent); flex: none; }
.knowledge-option > .ui-icon { color: var(--muted); flex: none; margin-top: 1px; }
.knowledge-option:has(input:checked) > .ui-icon { color: var(--accent); }
.knowledge-option-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.knowledge-option-label { color: var(--ink); font-size: var(--fs-md); }
.knowledge-option-hint { color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.knowledge-option:has(input:checked) .knowledge-option-hint { color: var(--ink-2); }

.knowledge-access { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.knowledge-people { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.knowledge-people .ui-field { margin: 0; }
.knowledge-results { list-style: none; margin: 0; padding: 4px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--raise); display: flex; flex-direction: column; gap: 2px; }
.knowledge-result {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 8px; min-width: 0; text-align: left;
  background: none; border: 0; border-radius: var(--radius-sm); color: var(--ink); font: inherit; font-size: var(--fs-md); cursor: pointer;
}
.knowledge-result:hover, .knowledge-result:focus-visible { background: var(--hover); }
.knowledge-result .ui-icon, .knowledge-grantee > .ui-icon { color: var(--muted); flex: none; }
.knowledge-result-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.knowledge-result-sub { color: var(--muted); font-size: var(--fs-xs); }
.knowledge-result-add { color: var(--accent); font-size: var(--fs-sm); flex: none; }
.knowledge-grantees { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.knowledge-grantee { display: flex; align-items: center; gap: 10px; padding: 6px 4px 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; font-size: var(--fs-md); }
.knowledge-grantee .ui-field { margin: 0; flex: none; }
.knowledge-grantee .ui-select { width: auto; padding-top: 5px; padding-bottom: 5px; font-size: var(--fs-sm); }

.knowledge-viewer { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; height: 100%; }
.knowledge-viewer-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: var(--fs-sm); }
.knowledge-viewer-label { margin: 8px 0 0; }
.knowledge-text {
  margin: 0; flex: 1; min-height: 160px; overflow: auto; padding: var(--sp-3);
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-solid);
  color: var(--ink-2); font-family: var(--font); font-size: var(--fs-sm); line-height: var(--lh); white-space: pre-wrap; overflow-wrap: anywhere;
}

.knowledge-move { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.knowledge-move .knowledge-crumbs { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px; }
.knowledge-move-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 280px; overflow-y: auto; }
.knowledge-move-dir {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; min-width: 0; text-align: left;
  background: none; border: 0; border-radius: var(--radius-sm); color: var(--ink); font: inherit; font-size: var(--fs-md); cursor: pointer;
}
.knowledge-move-dir:hover { background: var(--hover); }
.knowledge-move-dir .ui-icon:first-child { color: var(--accent); flex: none; }
.knowledge-move-dir .truncate { flex: 1; }
.knowledge-move-dir .ui-icon:last-child { color: var(--muted); flex: none; }

.knowledge-sync { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.knowledge-sync-summary { margin: 0; color: var(--ink); }
.knowledge-sync-group .ui-section-label { margin: 0 0 4px; }
.knowledge-sync-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: var(--fs-sm); color: var(--ink-2); }
.knowledge-sync-list li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.knowledge-sync-list .ui-icon { width: 13px; height: 13px; color: var(--muted); flex: none; }

/* ---- detail sections, rows (API v1) ---- */
.knowledge-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--sp-2); }
.knowledge-tabs { margin-top: var(--sp-2); }
.knowledge-panel { min-width: 0; }
.knowledge-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.knowledge-row-sub { color: var(--muted); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.knowledge-row--failed .knowledge-row-sub { color: var(--danger); }
.knowledge-upload-actions + .knowledge-row-sub { color: var(--danger); }
.knowledge-upload--failed .knowledge-row-sub { color: var(--danger); }
.knowledge-status { flex: none; display: inline-flex; }
.knowledge-check { flex: none; margin: 0 0 0 8px; width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.knowledge-active, .knowledge-selection {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: 6px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--raise); color: var(--ink-2); font-size: var(--fs-sm);
}
.knowledge-selection { border-color: var(--accent-line); }
.knowledge-field-error { margin: 0; color: var(--danger); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.knowledge-move-dir--on { background: var(--accent-soft); outline: 1px solid var(--accent-line); }
.knowledge-move-dir:disabled { color: var(--muted); cursor: not-allowed; }
.knowledge-move-dir:disabled:hover { background: none; }
.knowledge-move-dir .knowledge-hint { flex: none; font-size: var(--fs-xs); }
.knowledge-query { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; margin-top: var(--sp-2); padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.knowledge-try .ui-field { margin: 0; }
.knowledge-hit-file { color: var(--ink); min-width: 0; }
.knowledge-hit-loc { flex: 1; color: var(--muted); font-size: var(--fs-xs); min-width: 0; }
.knowledge-hit-head { align-items: baseline; }
.knowledge-link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: var(--fs-xs); cursor: pointer; }
.knowledge-link:hover { text-decoration: underline; }

/* ---- phones ---- */
@media (max-width: 760px) {
  .knowledge-grid { grid-template-columns: minmax(0, 1fr); }
  .knowledge-tools > .ui-field { flex: 1 1 140px; }
  .knowledge-files { padding: var(--sp-2); }
  .knowledge-files-bar > .ui-field { flex: 1 1 120px; }
  .knowledge-row-meta { display: none; }
  .knowledge-status .ui-tag { padding-left: 6px; padding-right: 6px; }
  .knowledge-progress { flex-basis: 48px; }
  .knowledge-detail-actions { width: 100%; }
}

/* /features/notes.css */
/* Feature "notes": the notes list (/notes), the editor (/notes/<id>), the sharing dialog and the composer's
   "Attach a note" picker. Every class is prefixed "notes-"; colours and spacing come from css/tokens.css. */

/* ---- list ---- */
.notes-page { display: flex; flex-direction: column; gap: var(--sp-3); }
.notes-head { justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.notes-head-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 260px; }
.notes-head-text .ui-page-title, .notes-head-text .ui-page-sub { margin: 0; }
.notes-tools { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; min-width: 0; }
.notes-tools .ui-field { margin: 0; }
.notes-search { flex: 1 1 240px; min-width: 0; }
.notes-scopes { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.notes-sort { flex: 0 1 170px; min-width: 0; }
.notes-loading { padding: var(--sp-4) 0; }
.notes-section { min-width: 0; }
.notes-section .ui-section-label { margin-left: 4px; }
.notes-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.notes-row { position: relative; display: flex; align-items: flex-start; gap: var(--sp-2); min-width: 0; }
.notes-row + .notes-row { border-top: 1px solid var(--line); }
.notes-row-link {
  display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; padding: 11px 6px 11px 14px;
  color: var(--ink); text-decoration: none; border-radius: var(--radius);
}
.notes-row-link:hover { text-decoration: none; }
.notes-row-link:hover .notes-row-title { color: var(--accent); }
.notes-row-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.notes-row-title { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--fs-base); }
.notes-row-pin { color: var(--accent); flex: none; }
.notes-row-shared { color: var(--muted); flex: none; }
.notes-row-preview {
  color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.5; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere;
}
.notes-row-meta { color: var(--muted); font-size: var(--fs-xs); letter-spacing: .02em; overflow-wrap: anywhere; }
.notes-row-actions { flex: none; padding: 8px 8px 0 0; }
.notes-more { display: flex; justify-content: center; padding: var(--sp-2) 0; }

/* ---- editor ---- */
.notes-editor-page { display: flex; flex-direction: column; min-height: 0; min-width: 0; height: 100%; }
.notes-editor-loading { width: 100%; max-width: var(--content-w); margin: 0 auto; padding: var(--sp-6) var(--sp-5); }
.notes-editor-head {
  display: flex; flex-direction: column; gap: 6px; padding: 10px var(--sp-5) 10px; min-width: 0;
  border-bottom: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(8px);
}
.notes-editor-titlebar { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.notes-title-input {
  flex: 1; min-width: 0; height: 38px; padding: 0 8px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--ink); font: inherit; font-size: var(--fs-xl); font-weight: 500;
}
.notes-title-input:hover { border-color: var(--line); }
.notes-title-input:focus { border-color: var(--accent-line); background: var(--field); outline: none; }
.notes-title-input::placeholder { color: var(--muted); }
.notes-title-text { flex: 1; margin: 0; padding: 0 8px; font-size: var(--fs-xl); font-weight: 500; }
.notes-editor-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-3); flex-wrap: wrap; min-width: 0; }
.notes-editor-status { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; min-width: 0; padding-left: 4px; }
.notes-editor-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }

.notes-save { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; }
.notes-save-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.notes-save--saved .notes-save-dot { background: var(--ok); }
.notes-save--saving .notes-save-dot { background: var(--accent); animation: notes-pulse 1s var(--ease) infinite alternate; }
.notes-save--offline { color: var(--warn); white-space: normal; }
.notes-save--offline .notes-save-dot { background: var(--warn); }
.notes-save--failed { color: var(--danger); }
.notes-save--failed .notes-save-dot { background: var(--danger); }
@keyframes notes-pulse { from { opacity: .35; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .notes-save--saving .notes-save-dot { animation: none; } }

.notes-access-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border: 1px solid var(--line-2);
  border-radius: var(--radius-pill); background: transparent; color: var(--ink-2); font: inherit; font-size: var(--fs-sm); cursor: pointer;
}
.notes-access-chip:hover { border-color: var(--accent-line); color: var(--ink); }
.notes-access-chip--static { cursor: default; }
.notes-access-chip--static:hover { border-color: var(--line-2); color: var(--ink-2); }

.notes-presence { display: flex; align-items: center; list-style: none; margin: 0; padding: 0 0 0 6px; }
.notes-peer {
  display: grid; place-items: center; width: 26px; height: 26px; margin-left: -6px; border-radius: 50%;
  border: 2px solid var(--peer, var(--accent)); background: var(--raise); color: var(--ink); font-size: var(--fs-xs); font-weight: 600;
}
.notes-peer--more { border-color: var(--line-3); color: var(--muted); }
.notes-left { color: var(--muted); font-size: var(--fs-sm); }
.notes-left:empty { display: none; }
.notes-save--gone { color: var(--danger); }
.notes-save--gone .notes-save-dot { background: var(--danger); }
.notes-save--readonly .notes-save-dot { background: var(--accent); }

.notes-editor-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.notes-editor-column {
  width: 100%; max-width: var(--content-w); min-width: 0; margin: 0 auto; padding: var(--sp-4) var(--sp-5) 0;
  display: flex; flex-direction: column; gap: var(--sp-3);
}
.notes-editor-meta { margin: 0; color: var(--muted); font-size: var(--fs-xs); letter-spacing: .02em; }
.notes-readonly-note .ui-notice { margin: 0; }

.notes-cm { min-width: 0; min-height: 50vh; font-size: var(--fs-base); }
.notes-cm .cm-editor { min-height: 50vh; }
.notes-cm .cm-content { font-family: var(--font); }
.notes-tok-heading { color: var(--ink); font-weight: 700; }
.notes-tok-h1 { font-size: 1.3em; }
.notes-tok-h2 { font-size: 1.15em; }
.notes-tok-strong { font-weight: 700; color: var(--ink); }
.notes-tok-em { font-style: italic; }
.notes-tok-strike { text-decoration: line-through; color: var(--muted); }
.notes-tok-link { color: var(--accent); }
.notes-tok-url { color: var(--accent); opacity: .8; }
.notes-tok-code { color: var(--ink-2); background: var(--raise); border-radius: 4px; }
.notes-tok-quote { color: var(--ink-2); font-style: italic; }
.notes-tok-list { color: var(--accent); }
.notes-tok-mark { color: var(--muted); }

.notes-preview { min-width: 0; padding-bottom: 30vh; line-height: var(--lh); overflow-wrap: anywhere; }
.notes-preview h1, .notes-preview h2, .notes-preview h3 { margin: 1.1em 0 .5em; font-weight: 600; line-height: 1.3; }
.notes-preview h1 { font-size: 1.45em; }
.notes-preview h2 { font-size: 1.25em; }
.notes-preview h3 { font-size: 1.1em; }
.notes-preview p, .notes-preview ul, .notes-preview ol, .notes-preview blockquote { margin: 0 0 .8em; }
.notes-preview a { color: var(--accent); }
.notes-preview code { padding: 1px 5px; border-radius: 4px; background: var(--raise); font-size: .92em; }
.notes-preview pre { max-width: 100%; overflow-x: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid); }
.notes-preview pre code { padding: 0; background: none; }
.notes-preview blockquote { padding-left: 12px; border-left: 3px solid var(--line-3); color: var(--ink-2); }
.notes-preview table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.notes-preview th, .notes-preview td { padding: 6px 10px; border: 1px solid var(--line); }
.notes-preview img { max-width: 100%; }
.notes-preview-empty { color: var(--muted); }

/* ---- AI help ---- */
.notes-assist {
  display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--accent-line); border-radius: var(--radius); background: var(--panel-solid);
}
.notes-assist-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.notes-assist-title { margin: 0; font-size: var(--fs-md); font-weight: 600; color: var(--ink); }
.notes-assist-form { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.notes-assist-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-2) var(--sp-3); min-width: 0; }
.notes-assist-fields .ui-field { margin: 0; min-width: 0; }
.notes-assist-actions { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); flex-wrap: wrap; }
.notes-assist-scope { margin: 0; flex: 1 1 220px; color: var(--muted); font-size: var(--fs-sm); }
.notes-assist-result { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.notes-assist-text {
  max-height: 40vh; overflow-y: auto; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--raise);
  color: var(--ink); font-size: var(--fs-md); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
}
.notes-assist-model { margin: 0; color: var(--muted); font-size: var(--fs-xs); }
.notes-assist-buttons { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- sharing dialog ---- */
.notes-access { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.notes-access .ui-field { margin: 0; }
.notes-access-label { margin: var(--sp-2) 0 0; }
.notes-access-add { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.notes-access-results { list-style: none; margin: 0; padding: 4px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--raise); }
.notes-access-result {
  display: grid; grid-template-columns: auto minmax(0, auto) minmax(0, 1fr); align-items: center; gap: 10px; width: 100%;
  padding: 7px 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink); font: inherit;
  font-size: var(--fs-md); text-align: left; cursor: pointer;
}
.notes-access-result:hover { background: var(--hover); }
.notes-access-none { color: var(--muted); font-size: var(--fs-sm); padding: 4px 2px; }
.notes-access-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.notes-access-row { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; min-width: 0; color: var(--ink-2); }
.notes-access-row + .notes-access-row { border-top: 1px solid var(--line); }
.notes-access-who { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.notes-access-name { color: var(--ink); font-size: var(--fs-md); }
.notes-access-sub { color: var(--muted); font-size: var(--fs-sm); }
.notes-access-error { color: var(--danger); font-size: var(--fs-sm); }
.notes-access-level { flex: 0 1 140px; min-width: 0; }

/* ---- composer: attach a note ---- */
.notes-attach { position: relative; display: inline-flex; }
.notes-attach-count {
  position: absolute; top: -2px; right: -2px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: var(--radius-pill);
  background: var(--accent); color: var(--accent-ink); font-size: var(--fs-xs); font-weight: 700; line-height: 15px; text-align: center;
  pointer-events: none;
}
.notes-attach-attached { padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.notes-attach-chosen { display: flex; align-items: center; gap: 8px; padding: 2px 2px 2px 8px; color: var(--ink); font-size: var(--fs-md); }
.notes-attach-chosen > .ui-icon { color: var(--accent); flex: none; }
.notes-attach-pop { width: min(340px, calc(100vw - 16px)); }
.notes-attach-body { display: flex; flex-direction: column; gap: 6px; padding: 6px; min-width: 0; }
.notes-attach-body .ui-field { margin: 0; }
.notes-attach-list { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow-y: auto; }
.notes-attach-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--ink); font: inherit; font-size: var(--fs-md); text-align: left; cursor: pointer;
}
.notes-attach-item:hover, .notes-attach-item:focus-visible { background: var(--hover); }
.notes-attach-name { flex: 1; min-width: 0; }
.notes-attach-age { color: var(--ink-2); font-size: var(--fs-xs); flex: none; }
.notes-attach-empty { display: flex; justify-content: center; padding: 12px 6px; color: var(--muted); font-size: var(--fs-sm); }

/* ---- phones ---- */
@media (max-width: 760px) {
  .notes-editor-head { padding: 8px var(--sp-3); }
  .notes-editor-column { padding: var(--sp-3) var(--sp-3) 0; }
  .notes-title-input, .notes-title-text { font-size: var(--fs-lg); }
  .notes-chat-btn .notes-btn-label, .notes-share-btn { display: none; }
  .notes-access-row { flex-wrap: wrap; }
  .notes-access-who { flex: 1 1 160px; } /* a basis, so the level select wraps under a name instead of squeezing it */
  .notes-access-level { flex: 1 1 120px; }
}

/* /features/workspace-models.css */
/* Feature "workspace-models": styles for atrium.features.workspacemodels. Owned by the workspace-models task.
   Prefix every class with "workspace-models-" and use the tokens from css/tokens.css. */

.workspace-models-head-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 320px; }
.workspace-models-head-text .ui-page-sub { margin: 0; overflow-wrap: anywhere; }
.workspace-models-head-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.workspace-models-muted { color: var(--muted); font-size: var(--fs-sm); margin: 0; overflow-wrap: anywhere; }
.workspace-models-page > .ui-notice { margin-bottom: var(--sp-3); }

/* toolbar */
.workspace-models-tools { display: flex; gap: var(--sp-2); align-items: flex-start; margin: 0 0 var(--sp-3); flex-wrap: wrap; }
.workspace-models-tools .ui-field { min-width: 0; }
.workspace-models-search { flex: 1 1 260px; min-width: 0; }
.workspace-models-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 var(--sp-3); }
.workspace-models-tags .ui-chip { max-width: 100%; }
.workspace-models-count { color: var(--muted); font-size: var(--fs-sm); margin: 0 0 var(--sp-2); }

/* list */
.workspace-models-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid); overflow: hidden; }
.workspace-models-row { display: flex; gap: var(--sp-3); align-items: flex-start; padding: 14px var(--sp-3); border-bottom: 1px solid var(--line); min-width: 0; }
.workspace-models-row:last-child { border-bottom: 0; }
.workspace-models-row:hover { background: var(--hover); }
.workspace-models-row--off .workspace-models-row-name { color: var(--ink-2); }
.workspace-models-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.workspace-models-row-title { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; min-width: 0; }
.workspace-models-row-name { color: var(--ink); font-weight: 500; max-width: 100%; }
.workspace-models-row-name:hover { color: var(--accent); text-decoration: none; }
.workspace-models-row-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--muted); font-size: var(--fs-sm); min-width: 0; }
.workspace-models-row-meta > span { max-width: 100%; }
.workspace-models-row-id { color: var(--ink-2); }
.workspace-models-row-desc { margin: 2px 0 0; color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.5; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.workspace-models-row-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.workspace-models-row-actions { flex: none; display: flex; align-items: center; }
.workspace-models-more { display: flex; justify-content: center; margin: var(--sp-3) 0 0; }

/* avatar */
.workspace-models-avatar { flex: none; width: 36px; height: 36px; border-radius: var(--radius-sm); display: inline-grid; place-items: center;
  background: var(--raise); border: 1px solid var(--line-2); color: var(--accent); overflow: hidden; }
.workspace-models-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.workspace-models-avatar--lg { width: 72px; height: 72px; border-radius: var(--radius); }

/* editor */
.workspace-models-back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-sm); width: fit-content; }
.workspace-models-back:hover { color: var(--ink); text-decoration: none; }
.workspace-models-editor-title { overflow-wrap: anywhere; }
.workspace-models-form { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.workspace-models-card { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.workspace-models-card-title { margin: 0; font-size: var(--fs-md); font-weight: 600; color: var(--ink); }
.workspace-models-card-sub { margin: -6px 0 0; color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.workspace-models-form-foot { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; padding: var(--sp-2) 0 0; }
.workspace-models-danger-text { color: var(--danger); }

.workspace-models-identity { display: flex; gap: var(--sp-4); align-items: flex-start; min-width: 0; }
.workspace-models-picture { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); flex: none; width: 120px; }
.workspace-models-picture-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.workspace-models-identity-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.workspace-models-id-value { color: var(--ink-2); font-size: var(--fs-md); overflow-wrap: anywhere; padding: 8px 0; }

.workspace-models-tag-edit { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.workspace-models-tag-input { flex: 1 1 180px; min-width: 0; width: auto; }

.workspace-models-suggestions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.workspace-models-suggestions:empty { display: none; }
.workspace-models-suggestion { display: flex; gap: var(--sp-2); align-items: center; min-width: 0; }
.workspace-models-suggestion .ui-field { flex: 1; min-width: 0; }
.workspace-models-card > .ui-btn { align-self: flex-start; }

.workspace-models-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.workspace-models-chips .ui-chip { max-width: 100%; }

.workspace-models-switches { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-2) var(--sp-4); }
.workspace-models-switch { display: flex; gap: var(--sp-3); align-items: center; justify-content: space-between; padding: 6px 0; min-width: 0; }
.workspace-models-switch-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.workspace-models-switch-label { color: var(--ink); font-size: var(--fs-md); overflow-wrap: anywhere; }
.workspace-models-switch-hint { color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.workspace-models-switch .ui-toggle { flex: none; }

.workspace-models-params { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-3); }
.workspace-models-params .ui-field { min-width: 0; }

/* access */
.workspace-models-access { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.workspace-models-access-label { margin-bottom: -6px; }
.workspace-models-access-list, .workspace-models-access-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.workspace-models-access-results { margin-top: var(--sp-2); }
.workspace-models-access-row { display: flex; align-items: center; gap: var(--sp-3); padding: 8px var(--sp-3); border-bottom: 1px solid var(--line); min-width: 0; }
.workspace-models-access-row:last-child { border-bottom: 0; }
.workspace-models-access-row > .ui-icon { color: var(--muted); flex: none; }
.workspace-models-access-row .ui-field { flex: none; width: 128px; }
.workspace-models-access-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.workspace-models-access-sub { color: var(--muted); font-size: var(--fs-sm); }
.workspace-models-access-add { min-width: 0; }

@media (max-width: 760px) {
  .workspace-models-identity { flex-direction: column; align-items: stretch; }
  .workspace-models-picture { width: auto; flex-direction: row; justify-content: flex-start; }
  .workspace-models-picture-actions { justify-content: flex-start; }
  .workspace-models-tools > .ui-field { flex: 1 1 140px; }
  .workspace-models-row { padding: 12px 10px; gap: 10px; }
  .workspace-models-access-row { flex-wrap: wrap; row-gap: var(--sp-2); }
  .workspace-models-access-who { flex: 1 1 calc(100% - 40px); }
  .workspace-models-access-row .ui-field { width: auto; flex: 1 1 120px; margin-left: 28px; }
  .workspace-models-access-results .workspace-models-access-who { flex-basis: 0; }
  .workspace-models-switches { grid-template-columns: 1fr; }
  .workspace-models-params { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 380px) {
  .workspace-models-params { grid-template-columns: 1fr; }
}

/* attachments (knowledge, tool servers, skills) */
.workspace-models-attach { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.workspace-models-attach-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.workspace-models-attach-row { display: flex; align-items: center; gap: var(--sp-3); padding: 8px var(--sp-3); border-bottom: 1px solid var(--line); min-width: 0; }
.workspace-models-attach-row:last-child { border-bottom: 0; }
.workspace-models-attach-row > .ui-icon { color: var(--accent); flex: none; }
.workspace-models-attach-row--missing > .ui-icon, .workspace-models-attach-row--missing .workspace-models-attach-name { color: var(--warn); }
.workspace-models-attach-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.workspace-models-attach > .ui-field { max-width: 420px; }

/* suggestions */
.workspace-models-suggestion { align-items: flex-start; }
.workspace-models-suggestion-fields { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--sp-2); }
.workspace-models-suggestion > button { margin-top: 26px; flex: none; }

/* voice */
.workspace-models-voice { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.workspace-models-voice > .ui-field { max-width: 420px; }
.workspace-models-blend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.workspace-models-blend-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px auto; gap: var(--sp-2); align-items: end; min-width: 0; }
.workspace-models-voice > .ui-btn { align-self: flex-start; }

/* outcome dialog (clone / import warnings) */
.workspace-models-outcome-intro { margin: 0 0 var(--sp-2); color: var(--ink-2); overflow-wrap: anywhere; }
.workspace-models-outcome-list { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; color: var(--ink); overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .workspace-models-suggestion-fields { grid-template-columns: 1fr; }
  .workspace-models-blend-row { grid-template-columns: minmax(0, 1fr) 90px auto; }
}

/* /features/prompts-tools.css */
/* Feature "prompts-tools": Workspace › Prompts and Tools. Owned by the prompts-tools task.
   Every class is prefixed "prompts-tools-"; colours and spacing come from css/tokens.css. */

/* ---- shared bits ---- */
.prompts-tools-muted { color: var(--muted); }
.prompts-tools-hint { margin: 0; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh); overflow-wrap: anywhere; }
.prompts-tools-label { font-size: var(--fs-sm); color: var(--ink-2); font-weight: 500; }
.prompts-tools-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); min-width: 0; }
.prompts-tools-spacer { flex: 1; }
.prompts-tools-section { margin: 0 0 var(--sp-6); min-width: 0; }
.prompts-tools-section-title {
  margin: var(--sp-6) 0 var(--sp-3); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent);
}
.prompts-tools-section > .prompts-tools-section-title:first-child { margin-top: 0; }
.prompts-tools-section > .ui-notice { margin-bottom: var(--sp-2); }
.prompts-tools-chiplist { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.prompts-tools-chiplist li { display: inline-flex; align-items: center; gap: 4px; min-width: 0; font-size: var(--fs-sm); }
.prompts-tools-back {
  display: inline-flex; align-items: center; gap: 6px; margin: 8px 0 0; color: var(--muted); font-size: var(--fs-sm);
  text-decoration: none;
}
.prompts-tools-back:hover { color: var(--ink); text-decoration: none; }

/* the kit's empty-state icon size must not reach the action button inside it */
.prompts-tools-page .ui-empty .ui-btn .ui-icon { width: 16px; height: 16px; color: currentColor; stroke-width: 1.6; }

/* ---- list pages ---- */
.prompts-tools-head { justify-content: space-between; align-items: flex-start; }
.prompts-tools-heading { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 280px; }
.prompts-tools-heading .ui-page-title, .prompts-tools-heading .ui-page-sub { margin: 0; overflow-wrap: anywhere; }
.prompts-tools-toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0 0 var(--sp-4); min-width: 0; }
.prompts-tools-search { flex: 1 1 260px; min-width: 0; }
.prompts-tools-filter { flex: 0 1 180px; min-width: 0; }
.prompts-tools-count { margin: 0 0 var(--sp-2); color: var(--muted); font-size: var(--fs-sm); }

.prompts-tools-list {
  list-style: none; margin: 0 0 var(--sp-3); padding: 0; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid); overflow: hidden;
}
.prompts-tools-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); padding: 12px 14px; min-width: 0;
  border-bottom: 1px solid var(--line);
}
.prompts-tools-row:last-child { border-bottom: 0; }
.prompts-tools-row:hover { background: var(--row-hover); }
.prompts-tools-row-icon { display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; border: 1px solid var(--line-2); border-radius: var(--radius-sm); color: var(--ink-2); }
.prompts-tools-row-main { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.prompts-tools-row-title {
  display: flex; align-items: baseline; gap: 10px; min-width: 0; color: var(--ink); text-decoration: none;
}
a.prompts-tools-row-title:hover { text-decoration: none; }
a.prompts-tools-row-title:hover .prompts-tools-row-name { text-decoration: underline; text-underline-offset: 3px; }
.prompts-tools-row-title .ui-tag { align-self: center; flex: none; }
.prompts-tools-command { color: var(--accent); font-weight: 500; flex: none; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prompts-tools-row-name { min-width: 0; }
.prompts-tools-id { color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.prompts-tools-row-preview {
  margin: 0; color: var(--ink-2); font-size: var(--fs-sm); overflow: hidden; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.prompts-tools-url { color: var(--muted); }
.prompts-tools-row-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-xs); min-width: 0;
}
.prompts-tools-row-meta > span { overflow-wrap: anywhere; }
.prompts-tools-row-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: none; }
.prompts-tools-row-actions .ui-toggle { margin-right: 6px; }
.prompts-tools-row--off .prompts-tools-row-name, .prompts-tools-row--off .prompts-tools-command { color: var(--muted); }
.prompts-tools-row-check { flex: 1 1 100%; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-2); padding-top: 4px; }

/* tools offered by a server */
.prompts-tools-specs {
  list-style: none; margin: 0; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--raise); max-height: 240px; overflow-y: auto;
}
.prompts-tools-specs li { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: var(--fs-sm); min-width: 0; }
.prompts-tools-spec-name { color: var(--accent); overflow-wrap: anywhere; }
.prompts-tools-specs .prompts-tools-muted { overflow-wrap: anywhere; min-width: 0; }

/* ---- editors ---- */
.prompts-tools-editor .ui-page-head { margin-top: 12px; }
.prompts-tools-editor > .ui-notice { margin-bottom: var(--sp-4); }
.prompts-tools-form { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.prompts-tools-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); min-width: 0; }
.prompts-tools-form .ui-textarea { font-family: var(--font); line-height: var(--lh); resize: vertical; }
.prompts-tools-form .ui-field-hint { overflow-wrap: anywhere; }
.prompts-tools-readonly { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.prompts-tools-readonly .prompts-tools-id { min-height: 36px; display: flex; align-items: center; color: var(--ink-2); font-size: var(--fs-md); }
.prompts-tools-vars { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.prompts-tools-tags { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }

/* access */
.prompts-tools-access {
  display: flex; flex-direction: column; gap: var(--sp-3); margin: 0; padding: 14px; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
}
.prompts-tools-access legend { padding: 0 6px; margin-left: -6px; }
.prompts-tools-access-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.prompts-tools-access-row {
  display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-solid);
}
.prompts-tools-access-row--error { border-color: var(--danger-line); }
.prompts-tools-access-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.prompts-tools-access-level { font-size: var(--fs-sm); flex: none; }
.prompts-tools-access-everyone { max-width: 420px; min-width: 0; }
.prompts-tools-access-icon { display: inline-grid; place-items: center; width: 20px; height: 20px; color: var(--ink-2); flex: none; }
.prompts-tools-access-name { flex: 1; font-size: var(--fs-md); color: var(--ink); }
.prompts-tools-access-perm { flex: 0 0 132px; min-width: 0; }
.prompts-tools-access-perm .ui-select { height: 30px; font-size: var(--fs-sm); }
.prompts-tools-access-add { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); align-items: start; min-width: 0; }
.prompts-tools-access-group, .prompts-tools-access-person { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.prompts-tools-access-results {
  list-style: none; margin: 0; padding: 4px; min-width: 0;
  border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--raise);
}
.prompts-tools-access-result {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 6px 8px; min-width: 0;
  border-radius: var(--radius-sm); color: var(--ink-2); text-align: left; font-size: var(--fs-md);
}
.prompts-tools-access-result:hover, .prompts-tools-access-result:focus-visible { background: var(--hover); color: var(--ink); }
.prompts-tools-access-result .prompts-tools-muted { font-size: var(--fs-sm); margin-left: auto; }

/* prompt versions */
.prompts-tools-history { margin-top: var(--sp-8); min-width: 0; }
.prompts-tools-versions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.prompts-tools-version {
  display: flex; flex-direction: column; gap: var(--sp-2); padding: 10px 12px; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-solid);
}
.prompts-tools-version-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; font-size: var(--fs-md); }
.prompts-tools-version-head .prompts-tools-muted { font-size: var(--fs-sm); margin-left: auto; }
.prompts-tools-version-title { color: var(--ink); overflow-wrap: anywhere; min-width: 0; }
.prompts-tools-version-body summary { cursor: pointer; color: var(--ink-2); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.prompts-tools-version-body pre {
  margin: 8px 0 0; padding: 10px; max-height: 220px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: var(--font); font-size: var(--fs-sm); color: var(--ink-2); background: var(--raise); border-radius: var(--radius-sm);
}

.prompts-tools-version--live { border-color: var(--ok-line); }

/* messages */
.prompts-tools-error { margin: 0; color: var(--danger); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.prompts-tools-banner { display: flex; align-items: flex-start; gap: var(--sp-2); margin: 0 0 var(--sp-4); min-width: 0; }
.prompts-tools-banner > .ui-notice { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.prompts-tools-import-lines { margin: 6px 0 0; padding-left: 18px; font-size: var(--fs-sm); overflow-wrap: anywhere; }
.prompts-tools-conflict { display: flex; flex-direction: column; gap: var(--sp-2); margin: 0 0 var(--sp-4); min-width: 0; }
.prompts-tools-footnote { margin-top: var(--sp-3); }
.prompts-tools-row-error { margin: 0; color: var(--danger); font-size: var(--fs-sm); overflow-wrap: anywhere; }

/* tool server editor */
.prompts-tools-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.prompts-tools-fieldset {
  display: flex; flex-direction: column; gap: var(--sp-3); margin: 0; padding: 14px; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
}
.prompts-tools-fieldset legend { padding: 0 6px; margin-left: -6px; }
.prompts-tools-header-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: var(--sp-2); align-items: start; min-width: 0; }
.prompts-tools-choices {
  list-style: none; margin: 0; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--raise); max-height: 280px; overflow-y: auto;
}
.prompts-tools-choices li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: var(--fs-sm); min-width: 0; }
.prompts-tools-choices .prompts-tools-spec-name { flex: 1 1 160px; min-width: 0; }
.prompts-tools-checkbox { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); cursor: pointer; }
.prompts-tools-checkbox input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.prompts-tools-check-area:empty { display: none; }
.prompts-tools-check { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.prompts-tools-check .ui-notice { overflow-wrap: anywhere; }
.prompts-tools-skipped { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.prompts-tools-skipped .prompts-tools-label { margin: 0; }
.prompts-tools-check-tools summary { cursor: pointer; color: var(--ink-2); font-size: var(--fs-sm); margin-bottom: 6px; }
.prompts-tools-spec-desc { flex-basis: 100%; }

@media (max-width: 760px) {
  .prompts-tools-grid, .prompts-tools-access-add { grid-template-columns: minmax(0, 1fr); }
  .prompts-tools-filter { flex: 1 1 140px; }
  .prompts-tools-row { padding: 12px; }
  .prompts-tools-row-actions { margin-left: 0; }
  .prompts-tools-access-perm { flex-basis: 112px; }
  .prompts-tools-version-head .prompts-tools-muted { margin-left: 0; flex-basis: 100%; }
  .prompts-tools-header-row { grid-template-columns: minmax(0, 1fr) auto; }
  .prompts-tools-header-row > :nth-child(2) { grid-column: 1; grid-row: 2; }
  .prompts-tools-header-row > :nth-child(3) { grid-column: 2; grid-row: 1; }
}

/* /features/skills.css */
/* Feature `skills`: Workspace › Skills. Classes are prefixed `skills-`; colours and spacing come from css/tokens.css. */

/* ---- shared bits ---- */
.skills-hint { margin: 0; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh); overflow-wrap: anywhere; }
.skills-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); min-width: 0; }
.skills-back {
  display: inline-flex; align-items: center; gap: 6px; margin: 8px 0 0; color: var(--muted); font-size: var(--fs-sm);
  text-decoration: none;
}
.skills-back:hover { color: var(--ink); text-decoration: none; }
.skills-back .ui-icon { width: 14px; height: 14px; }
.skills-slug { color: var(--accent); font-family: var(--font); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.skills-link-btn { text-decoration: none; }
.skills-link-btn:hover { text-decoration: none; }
.skills-dialog-foot { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); }
.skills-page .ui-empty .ui-btn .ui-icon { width: 16px; height: 16px; color: currentColor; stroke-width: 1.6; }

/* ---- list ---- */
.skills-head { justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: var(--sp-3); }
.skills-heading { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 280px; }
.skills-heading .ui-page-title, .skills-heading .ui-page-sub { margin: 0; overflow-wrap: anywhere; }
.skills-toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0 0 var(--sp-4); min-width: 0; }
.skills-search { flex: 1 1 260px; min-width: 0; }
.skills-filter { flex: 0 1 180px; min-width: 0; }
.skills-count { margin: 0 0 var(--sp-2); color: var(--muted); font-size: var(--fs-sm); }
.skills-list {
  list-style: none; margin: 0 0 var(--sp-3); padding: 0; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid); overflow: hidden;
}
.skills-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); padding: 12px 14px; min-width: 0;
  border-bottom: 1px solid var(--line);
}
.skills-row:last-child { border-bottom: 0; }
.skills-row:hover { background: var(--row-hover); }
.skills-row-main { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.skills-row-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; min-width: 0; color: var(--ink); text-decoration: none; }
a.skills-row-title:hover { text-decoration: none; }
a.skills-row-title:hover .skills-row-name { text-decoration: underline; text-underline-offset: 3px; }
.skills-row-name { min-width: 0; overflow-wrap: anywhere; }
.skills-row-description {
  margin: 0; color: var(--ink-2); font-size: var(--fs-sm); overflow: hidden; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.skills-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-xs); min-width: 0; }
.skills-row-meta > span { overflow-wrap: anywhere; }
.skills-row-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: none; }
.skills-row-actions .ui-toggle { margin-right: 6px; }
.skills-row--off .skills-row-name { color: var(--muted); }

/* ---- import ---- */
.skills-import { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.skills-import-pick { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.skills-import-picked {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 10px 12px; min-width: 0;
  border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--card);
}
.skills-import-name { color: var(--ink); overflow-wrap: anywhere; min-width: 0; }

/* ---- one skill ---- */
.skills-view .ui-page-head, .skills-editor .ui-page-head { margin-top: 12px; }
.skills-view > .ui-notice { margin-bottom: var(--sp-4); }
.skills-title { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); }
.skills-description { margin: 0 0 var(--sp-3); color: var(--ink-2); line-height: var(--lh); overflow-wrap: anywhere; }
.skills-section { margin: var(--sp-6) 0 0; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.skills-section > .ui-section-label { margin: 0; }
.skills-instructions { min-width: 0; overflow-x: auto; }
.skills-markdown { color: var(--ink); line-height: var(--lh); overflow-wrap: anywhere; min-width: 0; }
.skills-markdown > :first-child { margin-top: 0; }
.skills-markdown > :last-child { margin-bottom: 0; }
.skills-markdown h1, .skills-markdown h2, .skills-markdown h3 { font-size: var(--fs-md); margin: var(--sp-4) 0 var(--sp-2); color: var(--ink); }
.skills-markdown pre { overflow-x: auto; padding: 10px; border-radius: var(--radius-sm); background: var(--raise); }
.skills-markdown code { font-family: var(--font); font-size: var(--fs-sm); }
.skills-markdown a { color: var(--accent); }
.skills-files {
  list-style: none; margin: 0; padding: 0; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid); overflow: hidden;
}
.skills-file { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--sp-3); padding: 8px 12px; min-width: 0; border-bottom: 1px solid var(--line); }
.skills-file:last-child { border-bottom: 0; }
.skills-file-path { color: var(--accent); overflow-wrap: anywhere; min-width: 0; flex: 1 1 200px; }
.skills-file .ui-icon-btn { margin-left: auto; }
.skills-add-file { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2); min-width: 0; }
.skills-add-file-path { flex: 1 1 240px; min-width: 0; }
.skills-add-file .ui-field { margin: 0; }

/* sharing */
.skills-access { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.skills-access .ui-field { margin: 0; min-width: 0; }
.skills-access-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.skills-access-row {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-solid);
}
.skills-access-name { flex: 1; min-width: 0; font-size: var(--fs-md); color: var(--ink); overflow-wrap: anywhere; }
.skills-access-level { flex: 0 0 132px; min-width: 0; }
.skills-access-level .ui-select { height: 30px; font-size: var(--fs-sm); }
.skills-access-add { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); align-items: start; min-width: 0; }
.skills-access-person { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.skills-access-results {
  list-style: none; margin: 0; padding: 4px; min-width: 0;
  border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--raise);
}
.skills-access-result {
  width: 100%; display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; padding: 6px 8px; min-width: 0;
  border-radius: var(--radius-sm); color: var(--ink-2); text-align: left; font-size: var(--fs-md); overflow-wrap: anywhere;
}
.skills-access-result:hover, .skills-access-result:focus-visible { background: var(--hover); color: var(--ink); }

/* ---- editor ---- */
.skills-form { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.skills-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); min-width: 0; }
.skills-form .ui-textarea { font-family: var(--font); line-height: var(--lh); resize: vertical; }
.skills-form .ui-field-hint { overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .skills-grid, .skills-access-add { grid-template-columns: minmax(0, 1fr); }
  .skills-filter { flex: 1 1 140px; }
  .skills-row { padding: 12px; }
  .skills-row-actions { margin-left: 0; }
  .skills-access-level { flex-basis: 112px; }
}

/* /features/memories-voice.css */
/* Feature "memories-voice": styles for atrium.features.memoriesvoice. Owned by the memories-voice task.
   Prefix every class with "memories-voice-" and use the tokens from css/tokens.css. */

/* ---------- settings: cards and rows ---------- */
.memories-voice-stack { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.shell-frame-body > .memories-voice-stack { max-width: 720px; }
.memories-voice-card {
  display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-4);
}
[role="dialog"] .memories-voice-card { background: var(--raise); }
.memories-voice-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); min-width: 0; }
.memories-voice-card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.memories-voice-card-title { margin: 0; font-size: var(--fs-base); font-weight: 600; color: var(--ink); }
.memories-voice-card-desc { margin: 0; font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; }
.memories-voice-card-actions { flex: none; display: flex; gap: var(--sp-2); }

.memories-voice-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); min-width: 0;
  padding: var(--sp-2) 0; border-top: 1px solid var(--line);
}
.memories-voice-card-head + .memories-voice-row { border-top: 0; padding-top: 0; }
.memories-voice-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.memories-voice-row-label { font-size: var(--fs-md); color: var(--ink); }
.memories-voice-row-desc { font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; }
.memories-voice-row-control { flex: none; display: flex; align-items: center; gap: var(--sp-2); }
.memories-voice-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); }
.memories-voice-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-3); min-width: 0; }
.memories-voice-subsettings {
  display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-3); min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card);
}
.memories-voice-subsettings > .ui-btn { align-self: flex-start; }
.memories-voice-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.memories-voice-fieldset > legend { padding: 0; margin-bottom: var(--sp-2); }
.memories-voice-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- sliders ---------- */
.memories-voice-range { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px var(--sp-3); min-width: 0; }
.memories-voice-range-label { grid-column: 1 / -1; font-size: var(--fs-sm); color: var(--ink-2); font-weight: 500; }
.memories-voice-range-value { font-size: var(--fs-sm); color: var(--ink); font-variant-numeric: tabular-nums; min-width: 6ch; text-align: right; }
.memories-voice-slider { width: 100%; min-width: 0; accent-color: var(--accent); height: 22px; background: transparent; }
.memories-voice-slider:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }

/* ---------- voice picker: languages, voices with previews ---------- */
.memories-voice-voices {
  display: flex; flex-direction: column; gap: 2px; max-height: 340px; overflow-y: auto; min-width: 0;
  padding: 4px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--field);
}
.memories-voice-lang { display: flex; flex-direction: column; gap: 2px; padding-top: 6px; }
.memories-voice-lang-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 2px 8px;
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.memories-voice-lang-note { text-transform: none; letter-spacing: 0; color: var(--muted); font-size: var(--fs-xs); }
.memories-voice-option {
  display: flex; align-items: center; gap: var(--sp-2); min-width: 0; min-height: 34px; padding: 2px 4px 2px 8px;
  border-radius: var(--radius-sm);
}
.memories-voice-option:hover { background: var(--row-hover); }
.memories-voice-option--on { background: var(--accent-soft); }
.memories-voice-option input { accent-color: var(--accent); margin: 0; flex: none; }
.memories-voice-option input:disabled + label { color: var(--faint); cursor: default; }
.memories-voice-option-label { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 0 8px; color: var(--ink); font-size: var(--fs-md); cursor: pointer; overflow-wrap: anywhere; }
.memories-voice-option-detail { color: var(--muted); font-size: var(--fs-sm); }

/* ---------- voice blend ---------- */
.memories-voice-blend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.memories-voice-blend-part {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: var(--sp-3); min-width: 0;
}

/* ---------- shortcuts ---------- */
.memories-voice-key { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 0; }
.memories-voice-key-btn { min-width: 132px; justify-content: center; }
.memories-voice-key-btn--live { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }

/* ---------- memory list ---------- */
.memories-voice-count { margin: 0; font-size: var(--fs-sm); color: var(--muted); }
.memories-voice-none { margin: 0; padding: var(--sp-3) 0; font-size: var(--fs-md); color: var(--muted); overflow-wrap: anywhere; }
.memories-voice-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; min-width: 0; }
.memories-voice-item {
  display: flex; align-items: flex-start; gap: var(--sp-3); min-width: 0;
  padding: var(--sp-3) 0; border-top: 1px solid var(--line);
}
.memories-voice-item:first-child { border-top: 0; padding-top: var(--sp-1); }
.memories-voice-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.memories-voice-item-text { margin: 0; color: var(--ink); font-size: var(--fs-md); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.memories-voice-item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: var(--fs-sm); color: var(--muted); min-width: 0; }
.memories-voice-path {
  color: var(--ink-2); min-width: 0; overflow-wrap: anywhere;
  padding: 1px 6px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
}
.memories-voice-age { white-space: nowrap; }
.memories-voice-item-actions { flex: none; display: flex; gap: 2px; opacity: .55; transition: opacity var(--dur); }
.memories-voice-item:hover .memories-voice-item-actions,
.memories-voice-item:focus-within .memories-voice-item-actions { opacity: 1; }
.memories-voice-foot { display: flex; justify-content: flex-end; padding-top: var(--sp-2); border-top: 1px solid var(--line); }
.memories-voice-form { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.memories-voice-list--compact .memories-voice-item { padding: var(--sp-2) 0; }
.memories-voice-clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.memories-voice-more { display: flex; justify-content: center; }
.memories-voice-source { min-width: 0; overflow-wrap: anywhere; }
.memories-voice-source a, .memories-voice-item-meta a { color: var(--accent); }
.memories-voice-index { color: var(--warn); }
.memories-voice-filters { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: flex-end; min-width: 0; }
.memories-voice-filters > * { flex: 1 1 150px; min-width: 0; }
.memories-voice-filters > .memories-voice-search { flex-basis: 100%; }
.memories-voice-check { display: flex; gap: var(--sp-2); align-items: flex-start; min-width: 0; }
.memories-voice-check > :first-child { flex: 1; min-width: 0; }
.memories-voice-check > .ui-btn { margin-top: 2px; }

/* ---------- dictation in the composer ---------- */
.memories-voice-dictate { display: flex; align-items: center; gap: 4px; flex: none; min-width: 0; }
.memories-voice-dictate--live {
  padding: 2px 2px 2px 4px; border-radius: var(--radius-pill); background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}
.memories-voice-dictate--live .ui-icon-btn.ui-icon-btn--sm { width: 26px; height: 26px; border-radius: 50%; }
.memories-voice-meter { display: flex; align-items: center; gap: 2px; height: 18px; padding: 0 2px; }
.memories-voice-meter-bar {
  display: block; width: 3px; height: 100%; border-radius: 2px; background: var(--accent);
  transform-origin: center; transition: transform 90ms linear;
}
.memories-voice-clock { font-size: var(--fs-sm); color: var(--ink); font-variant-numeric: tabular-nums; min-width: 4ch; text-align: center; }
.memories-voice-dictate .memories-voice-done.ui-icon-btn { border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.memories-voice-dictate .memories-voice-done.ui-icon-btn:hover:not(:disabled) { background: var(--accent); color: var(--accent-ink); filter: brightness(1.1); }
.memories-voice-busy { display: grid; place-items: center; width: 34px; height: 34px; color: var(--accent); }
.memories-voice-ptt { touch-action: none; user-select: none; -webkit-user-select: none; }
.memories-voice-ptt--live.ui-icon-btn { background: var(--accent); color: var(--accent-ink); border-radius: 50%; }

/* ---------- read aloud under replies ---------- */
.memories-voice-glyph .ui-icon { fill: currentColor; stroke: none; }
.memories-voice-glyph.ui-icon-btn { color: var(--accent); }
.memories-voice-now {
  display: flex; align-items: center; gap: 4px; min-width: 0; padding: 2px 4px 2px 10px;
  border: 1px solid var(--accent-line); border-radius: var(--radius-pill); background: var(--accent-soft);
}
.memories-voice-now-text { font-size: var(--fs-sm); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.memories-voice-read-busy { display: inline-grid; place-items: center; width: 24px; height: 24px; color: var(--accent); }

@media (max-width: 760px) {
  /* Phones: while recording, the bar covers the input (nothing to type meanwhile) instead of squeezing it. */
  .memories-voice-dictate--live {
    position: absolute; z-index: 2; inset: 6px 50px 6px 6px; justify-content: space-between;
    background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--panel-solid);
  }
  .memories-voice-dictate--live .memories-voice-meter { flex: 1; justify-content: center; gap: 4px; }
  .memories-voice-card { padding: var(--sp-3); }
  .memories-voice-card-head { flex-wrap: wrap; }
  .memories-voice-row { flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); }
  .memories-voice-row-text { flex: 1 1 200px; }
  .memories-voice-item-actions { opacity: 1; }
  .memories-voice-blend-part { grid-template-columns: minmax(0, 1fr) auto; }
  .memories-voice-blend-part > :first-child { grid-column: 1 / -1; }
  .memories-voice-key { align-items: flex-start; }
  .memories-voice-check { flex-direction: column; align-items: stretch; }
  .memories-voice-now-text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .memories-voice-meter-bar { transition: none; }
}

/* /features/images.css */
/* Feature "images": the /images page, the composer's image toggle and note, image tiles in replies, the viewer.
   Every class is prefixed "images-"; colours and spacing come from css/tokens.css. */

/* ---- shared bits ---- */
.images-hint { color: var(--muted); font-size: var(--fs-sm); }
.images-link { color: var(--accent); font-size: var(--fs-sm); text-decoration: none; }
.images-link:hover { text-decoration: underline; }
.images-link-btn { margin-top: var(--sp-3); text-decoration: none; }
.images-danger:hover:not(:disabled) { color: var(--danger); background: var(--danger-soft); }

/* ---- page ---- */
.images-page { display: flex; flex-direction: column; gap: var(--sp-4); }
.images-head { justify-content: space-between; align-items: flex-end; margin-bottom: 0; }
.images-head-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.images-head-text .ui-page-sub { margin: 0; }
.images-engine {
  display: flex; align-items: center; gap: var(--sp-3); min-width: 0; max-width: 100%; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--panel-solid);
}
.images-engine-text { color: var(--ink-2); font-size: var(--fs-sm); min-width: 0; overflow-wrap: anywhere; }

.images-tabs { margin-bottom: calc(-1 * var(--sp-2)); }
.images-panel { min-width: 0; }
.images-form { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.images-form .ui-field { margin: 0; min-width: 0; }
.images-form-row { display: grid; grid-template-columns: minmax(0, 230px) minmax(0, 150px) minmax(0, 1fr); gap: var(--sp-3); align-items: start; }
.images-form-wide { min-width: 0; }
.images-form-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-3); }
.images-hint--keys { margin-right: auto; }

.images-source {
  display: flex; align-items: center; gap: var(--sp-3); min-width: 0; padding: var(--sp-3);
  border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--card);
}
.images-source-img {
  width: 72px; height: 72px; flex: none; object-fit: cover; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--raise);
}
.images-source-text { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; flex: 1; min-width: 0; }
.images-source-name { color: var(--ink); font-size: var(--fs-md); max-width: 100%; overflow-wrap: anywhere; }
.images-source-empty { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-3); min-width: 0; }

.images-section { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.images-section-label { margin: var(--sp-2) 0 0; }
.images-section > .ui-btn { align-self: center; }

/* ---- tiles and galleries ---- */
.images-gallery {
  list-style: none; margin: 0; padding: 0; min-width: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-3);
}
.images-gallery-item { min-width: 0; }
.images-gallery--message { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 280px)); }

.images-tile {
  position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid);
  transition: border-color var(--dur) var(--ease);
}
.images-tile:hover, .images-tile:focus-within { border-color: var(--line-3); }
.images-tile--pending { padding: 0; }
.images-tile--pending .ui-skeleton { border-radius: 0; }
.images-tile-open {
  display: block; width: 100%; padding: 0; border: 0; background: var(--raise); cursor: zoom-in;
  aspect-ratio: 1 / 1; overflow: hidden;
}
.images-tile-open:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.images-tile-img { display: block; width: 100%; height: 100%; object-fit: cover; image-rendering: auto; transition: transform .3s var(--ease); }
.images-tile-open:hover .images-tile-img { transform: scale(1.02); }
.images-tile-prompt {
  margin: 0; padding: 8px 10px 0; color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.images-tile-actions { display: flex; justify-content: flex-end; gap: 2px; padding: 4px 6px; }

/* ---- viewer ---- */
.images-viewer { display: flex; flex-direction: column; gap: var(--sp-3); margin: 0; min-width: 0; }
.images-viewer-stage { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.images-viewer-img {
  display: block; flex: 1; min-width: 0; max-height: calc(100vh - 240px); object-fit: contain;
  border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--line);
}
.images-viewer-nav { flex: none; }
.images-viewer-actions {
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); min-width: 0;
  padding-top: var(--sp-3); border-top: 1px solid var(--line);
}
.images-viewer-actions > .ui-btn:first-child { margin-right: auto; }
.images-viewer-caption { color: var(--ink-2); font-size: var(--fs-md); line-height: var(--lh); overflow-wrap: anywhere; }

/* ---- composer ---- */
.images-composer-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.images-composer-note {
  display: flex; align-items: center; gap: var(--sp-2); width: 100%; min-width: 0; padding: 6px 6px 6px 10px;
  border: 1px solid var(--accent-line); border-radius: var(--radius); background: var(--accent-soft);
}
.images-composer-note-text { flex: 1; min-width: 0; color: var(--ink-2); font-size: var(--fs-sm); overflow-wrap: anywhere; }

/* ---- jobs ("Latest images") ---- */
.images-jobs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.images-job {
  display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; padding: 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
}
.images-job-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); min-width: 0; }
.images-job-prompt {
  flex: 1 1 200px; min-width: 0; color: var(--ink-2); font-size: var(--fs-sm);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.images-job-head .ui-btn { margin-left: auto; }
.images-job .images-gallery { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

/* ---- edit source and picker ---- */
.images-source--error { border-color: var(--danger); }
.images-picker {
  list-style: none; margin: 0 0 var(--sp-3); padding: 0; min-width: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: var(--sp-2);
}
.images-picker-item {
  display: block; width: 100%; padding: 0; aspect-ratio: 1 / 1; overflow: hidden; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--raise);
}
.images-picker-item:hover, .images-picker-item:focus-visible { border-color: var(--accent); }
.images-picker-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.images-picker-item img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ---- revised prompts, deleted images ---- */
.images-tile-revised {
  margin: 0; padding: 4px 10px 0; color: var(--muted); font-size: var(--fs-xs); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.images-tile-revised-label { color: var(--accent); }
.images-viewer-caption p { margin: 0; }
.images-viewer-revised { margin-top: 4px !important; color: var(--muted); font-size: var(--fs-sm); }
.images-tile-gone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 1 / 1;
  color: var(--muted); font-size: var(--fs-sm); background: var(--raise);
}
.images-tile-gone .ui-icon { width: 22px; height: 22px; opacity: .6; }

@media (max-width: 760px) {
  .images-form-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .images-form-wide { grid-column: 1 / -1; }
  .images-hint--keys { display: none; }
  .images-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
  .images-gallery--message { grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
  .images-viewer-stage { position: relative; }
  .images-viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 1; background: var(--overlay); }
  .images-viewer-nav:first-child { left: 6px; }
  .images-viewer-nav:last-child { right: 6px; }
  .images-viewer-img { max-height: calc(100vh - 280px); }
  .images-job .images-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .images-job-head .ui-btn { margin-left: 0; }
}

/* /features/admin-users-groups.css */
/* Feature "admin-users-groups": styles for atrium.features.adminusersgroups. Owned by the admin-users-groups task.
   Prefix every class with "admin-users-groups-" and use the tokens from css/tokens.css. */

/* The admin frame already pads its body. */
.shell-frame-body > .admin-users-groups-page { padding: 0 0 40px; max-width: none; }
/* Narrow content (phones, or a tablet with the sidebar open) switches layouts through this container. */
.admin-users-groups-page { container: aug-page / inline-size; }

.admin-users-groups-head-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 320px; }
.admin-users-groups-head-text .ui-page-title { overflow-wrap: anywhere; }
.admin-users-groups-head-text .ui-page-sub { margin: 0; overflow-wrap: anywhere; }
.admin-users-groups-page > .ui-notice { margin-bottom: var(--sp-3); }
.admin-users-groups-retry { margin-top: var(--sp-3); }

/* shared text bits */
.admin-users-groups-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.admin-users-groups-name { color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.admin-users-groups-email { color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.admin-users-groups-you { color: var(--muted); font-weight: 400; }
.admin-users-groups-none { color: var(--muted); }
.admin-users-groups-more { color: var(--muted); font-size: var(--fs-sm); }
.admin-users-groups-linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px; }
.admin-users-groups-linkbtn:hover { color: var(--ink); }

/* users: pending notice, toolbar, filters */
.admin-users-groups-pending { margin: 0 0 var(--sp-3); }
.admin-users-groups-tools { display: flex; gap: var(--sp-2); align-items: flex-start; margin: 0 0 var(--sp-2); flex-wrap: wrap; }
.admin-users-groups-search { flex: 1 1 260px; min-width: 0; margin: 0 0 var(--sp-3); }
.admin-users-groups-tools .admin-users-groups-search { margin: 0; }
.admin-users-groups-sort-select { display: none; flex: 1 1 200px; min-width: 0; }
.admin-users-groups-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 var(--sp-3); }

/* users table */
.admin-users-groups-table-wrap { position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid); overflow-x: auto; }
.admin-users-groups-table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.admin-users-groups-table th { text-align: left; font-weight: 500; font-size: var(--fs-sm); color: var(--muted); padding: 10px var(--sp-3);
  border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin-users-groups-table td { padding: 10px var(--sp-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-users-groups-table tbody tr:last-child td { border-bottom: 0; }
.admin-users-groups-table tbody tr:hover { background: var(--hover); }
.admin-users-groups-row--pending td:first-child { box-shadow: inset 2px 0 0 var(--warn); }
.admin-users-groups-sort { background: none; border: 0; padding: 2px 0; color: var(--muted); font: inherit; cursor: pointer; border-radius: 4px; }
.admin-users-groups-sort:hover { color: var(--ink); }
.admin-users-groups-sort--on { color: var(--ink); }
.admin-users-groups-sort-mark { color: var(--accent); }
.admin-users-groups-sort-sep { color: var(--faint); margin: 0 6px; }
.admin-users-groups-cell-user { display: flex; align-items: center; gap: var(--sp-3); min-width: 220px; }
.admin-users-groups-cell-groups { max-width: 200px; }
.admin-users-groups-cell-groups .ui-tag { margin: 2px 4px 2px 0; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.admin-users-groups-cell-active, .admin-users-groups-cell-joined { color: var(--ink-2); white-space: nowrap; }
.admin-users-groups-cell-label { display: none; }
.admin-users-groups-online { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 6px; vertical-align: 1px; }
.admin-users-groups-cell-actions { white-space: nowrap; text-align: right; }
.admin-users-groups-cell-actions > * + * { margin-left: 6px; }

/* pager */
.admin-users-groups-pager { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin: var(--sp-3) 0 0; min-height: 28px; }
.admin-users-groups-range, .admin-users-groups-page-no { color: var(--muted); font-size: var(--fs-sm); }

/* dialogs */
.admin-users-groups-dialog-foot { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); }
.admin-users-groups-form { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.admin-users-groups-form-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); flex-wrap: wrap; }
.admin-users-groups-dialog-who { display: flex; align-items: center; gap: var(--sp-3); margin: 0 0 var(--sp-4); min-width: 0; }
.admin-users-groups-dialog-note { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-sm); margin: 0 0 var(--sp-3); }

/* a user's chats */
.admin-users-groups-chats-search { margin: 0 0 var(--sp-3); }
.admin-users-groups-chat-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.admin-users-groups-chat-list li + li { border-top: 1px solid var(--line); }
.admin-users-groups-chat-row { display: flex; align-items: center; gap: var(--sp-2); width: 100%; min-width: 0; background: none; border: 0; padding: 10px var(--sp-3);
  color: var(--ink); font: inherit; font-size: var(--fs-md); text-align: left; cursor: pointer; }
.admin-users-groups-chat-row:hover { background: var(--hover); }
.admin-users-groups-chat-title { flex: 1; }
.admin-users-groups-chat-age { color: var(--muted); font-size: var(--fs-sm); flex: none; }
.admin-users-groups-more-row { display: flex; justify-content: center; margin: var(--sp-3) 0 0; }
.admin-users-groups-transcript-head { margin: 0 0 var(--sp-2); }
.admin-users-groups-transcript-title { margin: 0 0 4px; font-size: var(--fs-base); font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.admin-users-groups-transcript-meta { margin: 0 0 var(--sp-3); color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.admin-users-groups-transcript { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.admin-users-groups-msg-user { align-self: flex-end; max-width: 85%; background: var(--raise); border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 8px 12px; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-users-groups-msg-ai { min-width: 0; color: var(--ink); }
.admin-users-groups-msg-meta { margin: 6px 0 0; color: var(--muted); font-size: var(--fs-sm); }

/* groups list */
.admin-users-groups-defaults { display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-width: 0; text-align: left; color: var(--ink); font: inherit;
  cursor: pointer; margin: 0 0 var(--sp-2); }
.admin-users-groups-defaults:hover { border-color: var(--line-3); background: var(--hover); }
.admin-users-groups-defaults > .ui-icon:first-child { color: var(--accent); flex: none; }
.admin-users-groups-defaults > .ui-icon:last-child { color: var(--muted); flex: none; }
.admin-users-groups-defaults-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.admin-users-groups-group-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid);
  overflow: hidden; }
.admin-users-groups-group-list li + li { border-top: 1px solid var(--line); }
.admin-users-groups-group-row { display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-width: 0; background: none; border: 0; padding: 12px var(--sp-3);
  color: var(--ink); font: inherit; font-size: var(--fs-md); text-align: left; cursor: pointer; }
.admin-users-groups-group-row:hover { background: var(--hover); }
.admin-users-groups-group-row > .ui-icon { color: var(--muted); flex: none; }
.admin-users-groups-group-icon { flex: none; width: 32px; height: 32px; border-radius: var(--radius-sm); display: inline-grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); }
.admin-users-groups-group-meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 12px; color: var(--muted); font-size: var(--fs-sm); flex: none;
  max-width: 45%; }

/* one group */
.admin-users-groups-back { margin: 0 0 var(--sp-2) -10px; }
.admin-users-groups-tabs { margin: 0 0 var(--sp-4); }
.admin-users-groups-panel { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.admin-users-groups-panel-sub { margin: 0; color: var(--muted); font-size: var(--fs-md); }
.admin-users-groups-panel .admin-users-groups-search { margin: 0; flex: none; }
.admin-users-groups-danger { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; border-color: var(--danger-line); }
.admin-users-groups-member-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid);
  overflow: hidden; }
.admin-users-groups-member-row { display: flex; align-items: center; gap: var(--sp-3); padding: 10px var(--sp-3); min-width: 0; }
.admin-users-groups-member-row + .admin-users-groups-member-row { border-top: 1px solid var(--line); }
.admin-users-groups-member-row--in { box-shadow: inset 2px 0 0 var(--accent); }
.admin-users-groups-member-row .ui-toggle { flex: none; }

/* permission switches */
.admin-users-groups-perms { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.admin-users-groups-perm-section { margin: 0; min-width: 0; }
.admin-users-groups-perm-head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.admin-users-groups-perm-title { color: var(--ink); font-weight: 600; font-size: var(--fs-md); }
.admin-users-groups-perm-count { color: var(--muted); font-size: var(--fs-sm); }
.admin-users-groups-perm-desc { margin: 4px 0 var(--sp-3); color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.admin-users-groups-perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px var(--sp-4); }
.admin-users-groups-perm-item { display: flex; flex-direction: column; gap: 2px; padding: 5px 0; min-width: 0; }
.admin-users-groups-perm-item .ui-toggle { text-align: left; overflow-wrap: anywhere; }
.admin-users-groups-perm-note { color: var(--muted); font-size: var(--fs-xs); padding-left: 44px; }

/* save bar under the switches */
.admin-users-groups-savebar { position: sticky; bottom: 0; z-index: 1; display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
  margin-top: var(--sp-3); padding: 10px var(--sp-3); background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius); }
.admin-users-groups-savebar--dirty { border-color: var(--accent-line); }
.admin-users-groups-savebar-note { color: var(--accent); font-size: var(--fs-sm); }

/* narrow: the table becomes one card per person */
@container aug-page (max-width: 640px) {
  .admin-users-groups-sort-select { display: block; }
  .admin-users-groups-table-wrap { overflow: visible; }
  .admin-users-groups-table, .admin-users-groups-table tbody { display: block; }
  .admin-users-groups-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .admin-users-groups-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px var(--sp-2); padding: 12px var(--sp-3);
    border-bottom: 1px solid var(--line); }
  .admin-users-groups-table tbody tr:last-child { border-bottom: 0; }
  .admin-users-groups-table td { display: block; padding: 0; border: 0; min-width: 0; }
  .admin-users-groups-table td.admin-users-groups-cell-user { grid-column: 1; grid-row: 1; min-width: 0; display: flex; }
  .admin-users-groups-table td.admin-users-groups-cell-actions { grid-column: 2; grid-row: 1; align-self: start; }
  .admin-users-groups-table td.admin-users-groups-cell-role,
  .admin-users-groups-table td.admin-users-groups-cell-groups { grid-column: 1 / -1; max-width: none; display: flex; flex-wrap: wrap; gap: 4px;
    padding-left: 44px; }
  .admin-users-groups-table td.admin-users-groups-cell-groups .ui-tag { margin: 0; }
  .admin-users-groups-table td.admin-users-groups-cell-groups:has(.admin-users-groups-none) { display: none; }
  .admin-users-groups-table td.admin-users-groups-cell-active,
  .admin-users-groups-table td.admin-users-groups-cell-joined { color: var(--muted); font-size: var(--fs-sm); white-space: normal; }
  .admin-users-groups-table td.admin-users-groups-cell-active { grid-column: 1; padding-left: 44px; }
  .admin-users-groups-table td.admin-users-groups-cell-joined { grid-column: 2; text-align: right; }
  .admin-users-groups-cell-label { display: inline; }
  .admin-users-groups-group-row { flex-wrap: wrap; }
  .admin-users-groups-group-meta { max-width: none; flex: 1 1 100%; justify-content: flex-start; padding-left: 44px; order: 3; }
  .admin-users-groups-perm-note { padding-left: 44px; }
}

/* ---- text helpers ---- */
.admin-users-groups-muted { color: var(--muted); font-size: var(--fs-sm); margin: 0 0 var(--sp-2); overflow-wrap: anywhere; }
.admin-users-groups-dialog-text { color: var(--ink-2); font-size: var(--fs-md); margin: 0; overflow-wrap: anywhere; }
.admin-users-groups-subhead { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); margin: var(--sp-2) 0 0; }
.admin-users-groups-col-groups { min-width: 120px; }
.admin-users-groups-perm-help { font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; }
.admin-users-groups-disclosure { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin: var(--sp-2) 0; }

/* the people picker (group members, hand-over) */
.admin-users-groups-picker { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; margin-top: var(--sp-3); }
.admin-users-groups-picked { display: flex; flex-wrap: wrap; gap: var(--sp-1); min-width: 0; }
.admin-users-groups-picker-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--radius-sm); max-height: 240px; overflow-y: auto; }
.admin-users-groups-picker-row { display: flex; align-items: center; gap: var(--sp-2); width: 100%; min-width: 0; padding: 6px var(--sp-2);
  background: none; border: 0; border-top: 1px solid var(--line); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.admin-users-groups-picker-list li:first-child .admin-users-groups-picker-row { border-top: 0; }
.admin-users-groups-picker-row:hover, .admin-users-groups-picker-row:focus-visible { background: var(--row-hover); }
.admin-users-groups-picker-none { color: var(--muted); font-size: var(--fs-sm); padding: var(--sp-2); }

/* sign-in identities */
.admin-users-groups-identities { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-3); padding-top: var(--sp-3);
  border-top: 1px solid var(--line); min-width: 0; }
.admin-users-groups-identity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.admin-users-groups-identity { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) 0; border-top: 1px solid var(--line); min-width: 0; flex-wrap: wrap; }
.admin-users-groups-identity:first-child { border-top: 0; }

/* members: selection and bulk changes */
.admin-users-groups-check { flex: none; width: 16px; height: 16px; accent-color: var(--accent); }
.admin-users-groups-bulkbar { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin: 0 0 var(--sp-2); padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--accent-line); border-radius: var(--radius-sm); background: var(--accent-soft); }

/* provisioning (SCIM) */
.admin-users-groups-scim-card { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-4); margin: 0 0 var(--sp-4); min-width: 0; }
.admin-users-groups-card-head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.admin-users-groups-card-title { margin: 0; font-size: var(--fs-base); font-weight: 600; color: var(--ink); }
.admin-users-groups-scim-row { display: flex; flex-direction: column; gap: 4px; }
.admin-users-groups-secret-row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; min-width: 0; }
.admin-users-groups-code { flex: 1; min-width: 0; padding: 6px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--raise); color: var(--ink); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.admin-users-groups-token-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.admin-users-groups-token-row { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) 0; border-top: 1px solid var(--line); min-width: 0; flex-wrap: wrap; }
.admin-users-groups-token-row:first-child { border-top: 0; }

/* /features/admin-connections-models.css */
/* Feature "admin-connections-models": Admin → Connections and Admin → Models. Owned by the admin-connections-models task.
   Every class is prefixed "admin-connections-models-"; colours and spacing come from css/tokens.css. */

/* ---- shared bits ---- */
.admin-connections-models-hint { margin: 0; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh); overflow-wrap: anywhere; }
.admin-connections-models-muted { color: var(--muted); }
.admin-connections-models-card {
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0;
}
p.admin-connections-models-card { margin: 0; }

/* the kit's empty-state icon size must not reach a button inside it */
.admin-connections-models-page .ui-empty .ui-btn .ui-icon { width: 16px; height: 16px; color: currentColor; stroke-width: 1.6; }

/* ---- page ---- */
.admin-connections-models-head { justify-content: space-between; align-items: flex-start; }
.admin-connections-models-heading { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 280px; }
.admin-connections-models-heading .ui-page-title,
.admin-connections-models-heading .ui-page-sub { margin: 0; overflow-wrap: anywhere; }

.admin-connections-models-section { margin: 0 0 var(--sp-8); min-width: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.admin-connections-models-section-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--sp-3); min-width: 0; }
.admin-connections-models-section-text { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.admin-connections-models-section-title {
  margin: 0; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent);
}
.admin-connections-models-section-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); min-width: 0; }
.admin-connections-models-section-actions .ui-toggle { margin-right: 4px; }
.admin-connections-models-section > .ui-empty { padding: 28px 16px; border: 1px dashed var(--line-2); border-radius: var(--radius); }

/* ---- lists (connections, models, arena) ---- */
.admin-connections-models-list {
  list-style: none; margin: 0; padding: 0; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid); overflow: hidden;
}
.admin-connections-models-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); padding: 12px 14px; min-width: 0;
  border-bottom: 1px solid var(--line);
}
.admin-connections-models-row:last-child { border-bottom: 0; }
.admin-connections-models-row:hover { background: var(--row-hover); }
.admin-connections-models-row-main { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.admin-connections-models-row-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; color: var(--ink); }
.admin-connections-models-row-name { min-width: 0; overflow-wrap: anywhere; }
.admin-connections-models-row-title .ui-tag { flex: none; }
.admin-connections-models-row-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-xs); min-width: 0;
}
.admin-connections-models-row-meta > span { overflow-wrap: anywhere; min-width: 0; }
.admin-connections-models-row-desc {
  margin: 0; color: var(--ink-2); font-size: var(--fs-sm); overflow: hidden; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.admin-connections-models-row-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: none; }
.admin-connections-models-row-actions .ui-toggle { margin-right: 6px; }
.admin-connections-models-row--off .admin-connections-models-row-name { color: var(--muted); }
.admin-connections-models-row-check { flex: 1 1 100%; min-width: 0; }

/* check result */
.admin-connections-models-check { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.admin-connections-models-check-models {
  list-style: none; margin: 0; padding: 8px 10px; display: flex; flex-wrap: wrap; gap: 4px 14px; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--raise); max-height: 160px; overflow-y: auto;
  font-size: var(--fs-sm); color: var(--ink-2);
}
.admin-connections-models-check-models li { overflow-wrap: anywhere; min-width: 0; }

/* options */
.admin-connections-models-options { display: flex; flex-direction: column; gap: var(--sp-4); }
.admin-connections-models-switch-row { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.admin-connections-models-switch-hint { padding-left: 46px; }

/* ---- forms (dialogs) ---- */
.admin-connections-models-form { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; padding-top: 4px; }
.admin-connections-models-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); min-width: 0; }
.admin-connections-models-form .ui-field-hint { overflow-wrap: anywhere; }
.admin-connections-models-form .ui-textarea { font-family: var(--font); line-height: var(--lh); resize: vertical; }
.admin-connections-models-field-switch { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.admin-connections-models-grid > .admin-connections-models-field-switch { align-self: center; }
.admin-connections-models-model-id { color: var(--ink-2); }
.admin-connections-models-dialog-foot { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); }

/* access */
.admin-connections-models-access {
  display: flex; flex-direction: column; gap: var(--sp-3); margin: 0; padding: 14px; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
}
.admin-connections-models-access legend { padding: 0 6px; margin-left: -6px; }
.admin-connections-models-access-list,
.admin-connections-models-access-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.admin-connections-models-access-results { padding: 4px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--raise); }
.admin-connections-models-access-row {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-solid);
}
.admin-connections-models-access-row > .ui-icon { flex: none; color: var(--ink-2); }
.admin-connections-models-access-name { flex: 1 1 auto; min-width: 0; font-size: var(--fs-md); color: var(--ink); }
.admin-connections-models-access-row .admin-connections-models-hint { flex: 0 1 auto; min-width: 0; }
.admin-connections-models-access-row .ui-btn, .admin-connections-models-access-row .ui-icon-btn { flex: none; }

/* arena model checkboxes */
.admin-connections-models-checks {
  list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px;
  min-width: 0; max-height: 220px; overflow-y: auto;
}
.admin-connections-models-checks li { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--fs-md); color: var(--ink-2); }
.admin-connections-models-checks input { flex: none; width: 16px; height: 16px; accent-color: var(--accent); }

/* ---- models page ---- */
.admin-connections-models-toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-2); min-width: 0; }
.admin-connections-models-search { flex: 1 1 260px; min-width: 0; }
.admin-connections-models-filter { flex: 0 1 220px; min-width: 0; }
.admin-connections-models-count { margin: 0; color: var(--muted); font-size: var(--fs-sm); }

.admin-connections-models-defaults { display: flex; flex-direction: column; gap: var(--sp-3); }
.admin-connections-models-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.admin-connections-models-chips li { display: inline-flex; min-width: 0; max-width: 100%; }

/* order dialog */
.admin-connections-models-order-tools { display: flex; gap: var(--sp-2); margin: var(--sp-3) 0; }
.admin-connections-models-order-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.admin-connections-models-order-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-solid);
}
.admin-connections-models-order-pos { flex: none; width: 24px; text-align: right; color: var(--muted); font-size: var(--fs-sm); }
.admin-connections-models-order-name { flex: 1; min-width: 0; display: flex; flex-direction: column; color: var(--ink); font-size: var(--fs-md); }
.admin-connections-models-order-row .ui-icon-btn { flex: none; }

@media (max-width: 760px) {
  .admin-connections-models-grid { grid-template-columns: minmax(0, 1fr); }
  .admin-connections-models-row { padding: 12px; }
  .admin-connections-models-row-actions { margin-left: 0; }
  .admin-connections-models-filter { flex: 1 1 160px; }
  .admin-connections-models-access-row .admin-connections-models-hint { display: none; }
}

/* ---- dialogs: parameter and capability groups, three-column grids, errors ---- */
.admin-connections-models-fieldset { border: 0; margin: var(--sp-3) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.admin-connections-models-fieldset > legend { padding: 0; margin-bottom: var(--sp-2); }
.admin-connections-models-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); min-width: 0; }
.admin-connections-models-error { margin: 0; color: var(--danger); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.admin-connections-models-row-error { margin: 4px 0 0; color: var(--danger); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.admin-connections-models-check-model--skipped { color: var(--muted); text-decoration: line-through; }
.admin-connections-models-limits { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-3); min-width: 0; }
.admin-connections-models-limits-foot { display: flex; justify-content: flex-end; gap: var(--sp-2); margin-top: var(--sp-3); }
.admin-connections-models-defaults-add { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-3); max-width: 760px; min-width: 0; }

@media (max-width: 760px) {
  .admin-connections-models-grid3 { grid-template-columns: 1fr; }
}

/* /features/admin-settings.css */
/* Feature "admin-settings": styles for atrium.features.adminsettings. Owned by the admin-settings task.
   Prefix every class with "admin-settings-" and use the tokens from css/tokens.css. */

.admin-settings-page { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; padding-bottom: var(--sp-6); }
.admin-settings-head { display: flex; flex-direction: column; gap: 4px; margin-top: var(--sp-2); }

/* section tabs: wrap instead of scrolling sideways (nine of them) */
.admin-settings-tabs { flex-wrap: wrap; overflow: visible; row-gap: 0; }
.admin-settings-tabs .ui-tab { white-space: nowrap; }

.admin-settings-panel { min-width: 0; }
.admin-settings-stack, .admin-settings-form { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.admin-settings-stack + .admin-settings-section, .admin-settings-form + .admin-settings-section { margin-top: var(--sp-4); }

/* sections (cards) */
.admin-settings-section {
  display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-4);
}
.admin-settings-section-head { display: flex; flex-direction: column; gap: 2px; }
.admin-settings-section-title { font-size: var(--fs-base); font-weight: 600; color: var(--ink); }
.admin-settings-section-desc, .admin-settings-text { font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; margin: 0; }

/* a setting: text left, control right */
.admin-settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); min-width: 0;
  padding: var(--sp-2) 0; border-top: 1px solid var(--line);
}
.admin-settings-section-head + .admin-settings-row { border-top: 0; }
.admin-settings-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.admin-settings-row-label { font-size: var(--fs-md); color: var(--ink); }
.admin-settings-row-desc { font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; }
.admin-settings-row-control { flex: none; display: flex; align-items: center; gap: var(--sp-2); }

.admin-settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-3); min-width: 0; }
.admin-settings-section .ui-textarea { font-size: var(--fs-md); }

.admin-settings-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); min-width: 0; }
.admin-settings-actions--start { justify-content: flex-start; }

/* the save bar stays at the bottom of the view while the form has changes */
.admin-settings-savebar {
  display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: var(--sp-2); min-width: 0;
  padding: 0 var(--sp-1); border: 1px solid transparent; border-radius: var(--radius);
}
.admin-settings-savebar--dirty {
  position: sticky; bottom: var(--sp-3); z-index: 2; padding: var(--sp-3) var(--sp-4);
  background: var(--panel-solid); border-color: var(--accent-line); box-shadow: var(--shadow-raise);
}
.admin-settings-savebar-text { margin-right: auto; font-size: var(--fs-sm); color: var(--muted); }
.admin-settings-savebar--dirty .admin-settings-savebar-text { color: var(--ink-2); }

/* status list (sign-in methods) */
.admin-settings-status { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.admin-settings-status-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-width: 0;
  padding: var(--sp-2) 0; border-top: 1px solid var(--line);
}
.admin-settings-status-row:first-child { border-top: 0; }
.admin-settings-status-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

/* lists (webhooks) */
.admin-settings-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.admin-settings-list-row {
  display: flex; align-items: center; gap: var(--sp-3); min-width: 0; padding: var(--sp-2) 0; border-top: 1px solid var(--line);
}
.admin-settings-list-row:first-child { border-top: 0; }
.admin-settings-list-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.admin-settings-list-title { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-md); color: var(--ink); min-width: 0; }
.admin-settings-list-sub { font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; }
.admin-settings-list-actions { display: flex; align-items: center; gap: var(--sp-1); flex: none; }

/* editable cards (banners, suggestions) */
.admin-settings-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.admin-settings-card {
  display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0;
  padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--raise);
}
.admin-settings-card-head { display: flex; align-items: center; gap: var(--sp-1); min-width: 0; }
.admin-settings-card-title { margin-right: auto; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }

/* dialog form (webhook) */
.admin-settings-dialog-form { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.admin-settings-dialog-toggle { padding: var(--sp-1) 0; }
.admin-settings-dialog-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); padding-top: var(--sp-2); }

@media (max-width: 760px) {
  .admin-settings-row { align-items: flex-start; }
  .admin-settings-list-row { flex-wrap: wrap; }
  .admin-settings-list-actions { margin-left: auto; }
  .admin-settings-section { padding: var(--sp-3); }
  .admin-settings-savebar--dirty { bottom: var(--sp-2); }
}

/* the kit's select has no error slot; ours sits right under it */

/* ---- fields and helpers shared by the sections ---- */
.admin-settings-field { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.admin-settings-field-switch { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-1) 0; }
.admin-settings-chips { display: flex; flex-wrap: wrap; gap: var(--sp-1); min-width: 0; }
.admin-settings-duration { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.admin-settings-error { min-width: 0; }
.admin-settings-problems { margin: 0; padding-left: var(--sp-4); color: var(--danger); font-size: var(--fs-sm); }
.admin-settings-break { overflow-wrap: anywhere; word-break: break-word; }
.admin-settings-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.admin-settings-subsection { display: flex; flex-direction: column; gap: var(--sp-2); padding-top: var(--sp-3); border-top: 1px solid var(--line); min-width: 0; }
.admin-settings-savebar-meta { font-size: var(--fs-sm); color: var(--muted); }
.admin-settings-code {
  min-width: 0; flex: 1; padding: 6px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--raise);
  font-size: var(--fs-sm); color: var(--ink); overflow-wrap: anywhere;
}
.admin-settings-secret-row { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; flex-wrap: wrap; }
.admin-settings-pre {
  margin: 0; max-height: 280px; overflow: auto; padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--raise); font-size: var(--fs-sm); color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere;
}
.admin-settings-list-row--off .admin-settings-list-title { color: var(--muted); }

/* check and test results */
.admin-settings-check-value { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; flex-wrap: wrap; justify-content: flex-end; }
.admin-settings-check-detail { font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; }
.admin-settings-check .admin-settings-status-text { font-size: var(--fs-md); color: var(--ink-2); }
.admin-settings-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-1); }
.admin-settings-step { display: flex; align-items: flex-start; gap: var(--sp-2); min-width: 0; font-size: var(--fs-sm); }
.admin-settings-step--ok { color: var(--ok); }
.admin-settings-step--fail { color: var(--danger); }
.admin-settings-step-name { flex: none; color: var(--ink); }
.admin-settings-step-detail { color: var(--muted); overflow-wrap: anywhere; min-width: 0; }
.admin-settings-try { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.admin-settings-try-row { display: flex; align-items: flex-end; gap: var(--sp-2); flex-wrap: wrap; min-width: 0; }
.admin-settings-try-row > .ui-field { flex: 1 1 220px; min-width: 0; }
.admin-settings-results, .admin-settings-hits { margin: 0; padding-left: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-1); font-size: var(--fs-sm); min-width: 0; }
.admin-settings-results a { color: var(--accent); overflow-wrap: anywhere; }
.admin-settings-hit { overflow-wrap: anywhere; color: var(--ink-2); }

/* allowed voices */
.admin-settings-voices { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; padding-top: var(--sp-2); border-top: 1px solid var(--line); }
.admin-settings-voices-head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.admin-settings-voice-grid {
  list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-1) var(--sp-3);
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); max-height: 260px; overflow-y: auto; min-width: 0;
}
.admin-settings-voice { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--ink-2); cursor: pointer; min-width: 0; }
.admin-settings-voice input, .admin-settings-event input { accent-color: var(--accent); flex: none; }

/* banners */
.admin-settings-banner { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.admin-settings-banner-title { font-size: var(--fs-md); font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.admin-settings-banner-sample { font-size: var(--fs-sm); color: var(--ink-2); overflow-wrap: anywhere; }
.admin-settings-banner-sample p { margin: 0; }
.admin-settings-banner-foot { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; font-size: var(--fs-sm); color: var(--muted); }

/* webhooks: events and deliveries */
.admin-settings-events { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; padding-top: var(--sp-3); }
.admin-settings-event-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.admin-settings-event label { display: flex; align-items: baseline; gap: var(--sp-2); padding: 3px 0 3px var(--sp-4); font-size: var(--fs-sm); cursor: pointer; min-width: 0; flex-wrap: wrap; }
.admin-settings-event--family label { padding-left: 0; }
.admin-settings-event-name { color: var(--ink); }
.admin-settings-event--family .admin-settings-event-name { font-weight: 600; }
.admin-settings-deliveries { flex-basis: 100%; display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3); margin-top: var(--sp-1);
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--raise); min-width: 0; }
.admin-settings-delivery-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.admin-settings-delivery { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; padding: var(--sp-1) 0; border-top: 1px solid var(--line); min-width: 0; }
.admin-settings-delivery:first-child { border-top: 0; }
.admin-settings-delivery-type { font-size: var(--fs-md); color: var(--ink); }
.admin-settings-delivery .admin-settings-text { flex: 1 1 220px; min-width: 0; }

/* usage */
.admin-settings-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--sp-2); margin: 0; }
.admin-settings-stat { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--raise); min-width: 0; }
.admin-settings-stat dt { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.admin-settings-stat dd { margin: 0; font-size: var(--fs-lg); color: var(--ink); overflow-wrap: anywhere; }
.admin-settings-table-wrap { overflow-x: auto; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.admin-settings-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.admin-settings-table th, .admin-settings-table td { padding: 6px 10px; text-align: right; border-top: 1px solid var(--line); white-space: nowrap; }
.admin-settings-table th { color: var(--muted); font-weight: 500; border-top: 0; }
.admin-settings-table th:first-child, .admin-settings-table td:first-child { text-align: left; white-space: normal; overflow-wrap: anywhere; }
.admin-settings-price { flex-direction: row; align-items: flex-start; }
.admin-settings-price .admin-settings-grid { flex: 1; }

/* audit log */
.admin-settings-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) auto; gap: var(--sp-2); align-items: end; min-width: 0; }
.admin-settings-audit { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.admin-settings-audit-row { display: flex; flex-direction: column; gap: var(--sp-1); padding: var(--sp-2) 0; border-top: 1px solid var(--line); min-width: 0; }
.admin-settings-audit-row:first-child { border-top: 0; }
.admin-settings-audit-head { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; min-width: 0; }
.admin-settings-audit-time { flex: none; font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.admin-settings-audit-action { font-size: var(--fs-md); color: var(--accent); overflow-wrap: anywhere; }
.admin-settings-audit-head .admin-settings-text { flex: 1 1 160px; }
.admin-settings-audit-details { margin: 0; padding-left: var(--sp-4); font-size: var(--fs-sm); color: var(--ink-2); overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .admin-settings-filters { grid-template-columns: 1fr 1fr; }
  .admin-settings-price { flex-direction: column; }
}
/* links inside text are underlined (not told apart by colour alone) */
.admin-settings-text a, .admin-settings-section-desc a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* /features/channels.css */
/* Feature `channels`: Channels sidebar tab, the channel list (/channels), channel pages, threads, the composer,
   settings and members. Classes are prefixed `channels-`; colours and spacing come from css/tokens.css. */

/* ---- sidebar tab ---- */
.channels-side { display: flex; flex-direction: column; min-width: 0; }
.channels-side-label { justify-content: space-between; margin-right: 2px; }
.channels-side-label .ui-icon-btn { width: 24px; height: 24px; color: var(--muted); }
.channels-side-label-text { flex: 1; min-width: 0; }
.channels-side-loading { padding: 4px 8px; }
.channels-side-empty { margin: 2px 8px 8px; color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; }
.channels-side-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.channels-side-row--unread .ui-list-row-text { color: var(--ink); font-weight: 600; }
.channels-mention-badge { background: var(--accent); color: var(--accent-ink); }
.channels-side-list .ui-badge + .ui-badge { margin-left: -4px; }

/* ---- forms (create, settings) ---- */
.channels-form { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.channels-form-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); }

/* ---- /channels ---- */
.channels-index { display: flex; flex-direction: column; gap: var(--sp-3); }
.channels-index-head { justify-content: space-between; align-items: flex-start; gap: var(--sp-3); flex-wrap: wrap; }
.channels-index-head-text { display: flex; flex-direction: column; gap: 4px; flex: 1 1 260px; min-width: 0; }
.channels-index-head-text .ui-page-title, .channels-index-head-text .ui-page-sub { margin: 0; }
.channels-index-tools { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; min-width: 0; }
.channels-index-tools .ui-field { margin: 0; }
.channels-index-search { flex: 1 1 240px; min-width: 0; }
.channels-index-chips { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.channels-index-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.channels-index-list > li + li { border-top: 1px solid var(--line); }
.channels-index-row {
  display: flex; align-items: flex-start; gap: var(--sp-3); padding: 12px 14px; min-width: 0;
  color: var(--ink); text-decoration: none; border-radius: var(--radius);
}
.channels-index-row:hover { text-decoration: none; background: var(--row-hover); }
.channels-index-row:hover .channels-index-name > .truncate { color: var(--accent); }
.channels-index-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.channels-index-row > .ui-icon { color: var(--muted); margin-top: 2px; flex: none; }
.channels-index-main { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.channels-index-name { display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; font-size: var(--fs-base); }
.channels-index-name > .truncate { flex: 0 1 auto; }
.channels-index-desc { color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.5; overflow-wrap: anywhere; }
.channels-index-meta { display: flex; align-items: center; gap: 8px; flex: none; color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }
.channels-index-more { display: flex; justify-content: center; padding: var(--sp-2) 0; }

/* ---- channel page ---- */
.channels-topbar { font-weight: 500; color: var(--ink); min-width: 0; }
.channels-page { position: relative; display: flex; min-height: 0; min-width: 0; height: 100%; }
.channels-page--loading { flex-direction: column; padding: var(--sp-6) var(--sp-5); max-width: var(--content-w); margin: 0 auto; width: 100%; }
.channels-main { position: relative; display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.channels-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); min-width: 0;
  padding: 12px var(--sp-5); border-bottom: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(8px);
}
.channels-head-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.channels-title { display: flex; align-items: center; gap: 2px; margin: 0; font-size: var(--fs-lg); font-weight: 600; min-width: 0; }
.channels-title-hash { color: var(--accent); }
.channels-desc {
  margin: 0; color: var(--muted); font-size: var(--fs-sm); line-height: 1.45; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.channels-head-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.channels-ended { padding: var(--sp-2) var(--sp-5) 0; }

.channels-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
.channels-list { display: flex; flex-direction: column; padding: var(--sp-3) var(--sp-5) var(--sp-2); min-width: 0; max-width: 980px; }
.channels-older { display: flex; justify-content: center; padding: var(--sp-2) 0; }
.channels-start { padding: var(--sp-6) 0 var(--sp-3); border-bottom: 1px solid var(--line); margin-bottom: var(--sp-2); }
.channels-start-title { margin: 0 0 4px; font-size: var(--fs-lg); font-weight: 600; overflow-wrap: anywhere; }
.channels-start-sub { margin: 0; color: var(--muted); font-size: var(--fs-sm); }
.channels-day, .channels-new, .channels-thread-count {
  display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-3) 0 var(--sp-1);
  color: var(--muted); font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase;
}
.channels-day::before, .channels-day::after, .channels-new::after, .channels-thread-count::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.channels-day::before { flex: 0 0 12px; }
.channels-new { color: var(--accent); font-weight: 600; }
.channels-new::after { background: var(--accent-line); }
.channels-jump { position: absolute; left: 50%; transform: translateX(-50%); bottom: 112px; z-index: 2; }
.channels-jump .ui-btn { box-shadow: var(--shadow-raise); }
.channels-typing { min-height: 20px; padding: 0 var(--sp-5); color: var(--muted); font-size: var(--fs-xs); font-style: italic; }
.channels-compose { padding: 0 var(--sp-5) var(--sp-4); }

/* ---- a message ---- */
.channels-msg { position: relative; display: flex; gap: var(--sp-3); padding: 8px 10px; margin: 0 -10px; border-radius: var(--radius-sm); min-width: 0; }
.channels-msg:hover, .channels-msg:focus-within { background: var(--row-hover); }
.channels-msg--compact { padding-top: 2px; padding-bottom: 2px; }
.channels-msg--pending { opacity: .62; }
.channels-msg--failed { background: var(--danger-soft); }
.channels-msg--pinned { box-shadow: inset 2px 0 0 var(--accent-line); }
.channels-msg--head { margin-bottom: var(--sp-1); }
.channels-msg-gutter { flex: none; width: 28px; display: flex; justify-content: center; padding-top: 2px; }
.channels-msg-time-side { visibility: hidden; color: var(--muted); font-size: 10px; line-height: 22px; white-space: nowrap; }
.channels-msg:hover .channels-msg-time-side, .channels-msg:focus-within .channels-msg-time-side { visibility: visible; }
.channels-model-avatar { background: var(--accent-soft); color: var(--accent); }
.channels-msg-main { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.channels-msg-pinned { display: flex; align-items: center; gap: 5px; color: var(--accent); font-size: var(--fs-xs); }
.channels-msg-head { display: flex; align-items: baseline; gap: var(--sp-2); min-width: 0; flex-wrap: wrap; }
.channels-msg-author { font-weight: 600; color: var(--ink); max-width: 100%; }
.channels-msg-head .ui-tag { align-self: center; }
.channels-msg-time { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }
.channels-msg-edited { color: var(--muted); font-size: var(--fs-xs); }
.channels-msg-deleted { color: var(--muted); font-style: italic; font-size: var(--fs-md); }
.channels-msg-body { min-width: 0; overflow-wrap: anywhere; font-size: var(--fs-base); }
.channels-msg-body .message-render > :first-child { margin-top: 0; }
.channels-msg-body .message-render > :last-child { margin-bottom: 0; }
.channels-msg-note { color: var(--muted); font-size: var(--fs-sm); }
.channels-msg-note--error { color: var(--danger); }
.channels-msg-stop { display: flex; }
.channels-msg-sending { color: var(--muted); font-size: var(--fs-xs); }
.channels-msg-failed { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--danger); font-size: var(--fs-sm); }

.channels-msg-actions {
  position: absolute; top: -12px; right: 8px; display: flex; gap: 1px; padding: 2px; z-index: 1;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--raise); box-shadow: var(--shadow-raise);
  opacity: 0; pointer-events: none; transition: opacity var(--dur);
}
.channels-msg:hover > .channels-msg-actions, .channels-msg:focus-within > .channels-msg-actions { opacity: 1; pointer-events: auto; }
.channels-msg:focus { outline: none; }
.channels-msg:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* attachments */
.channels-files { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.channels-file {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; padding: 6px 10px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--card); color: var(--ink-2); font-size: var(--fs-sm); text-decoration: none;
}
.channels-file:hover { border-color: var(--line-3); color: var(--ink); text-decoration: none; }
.channels-file-size { color: var(--muted); font-size: var(--fs-xs); flex: none; }
.channels-file-image { display: block; max-width: min(320px, 100%); border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); }
.channels-file-image img { display: block; max-width: 100%; max-height: 240px; object-fit: cover; }

/* reactions */
.channels-reactions { display: flex; flex-wrap: wrap; gap: 4px; }
.channels-reaction {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: var(--radius-pill);
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink-2); font-size: var(--fs-sm); max-width: 100%;
}
.channels-reaction:hover:not(:disabled) { border-color: var(--line-3); color: var(--ink); }
.channels-reaction--mine { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.channels-reaction:disabled { cursor: default; opacity: .8; }
.channels-reaction-emoji { line-height: 1; }
.channels-reaction-code { font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.channels-reaction-count { font-variant-numeric: tabular-nums; font-size: var(--fs-xs); }

/* thread link under a message */
.channels-thread-link {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; max-width: 100%; padding: 3px 8px; margin-left: -8px;
  border-radius: var(--radius-sm); color: var(--accent); font-size: var(--fs-sm); flex-wrap: wrap;
}
.channels-thread-link:hover { background: var(--accent-soft); }
.channels-thread-age { color: var(--muted); font-size: var(--fs-xs); }
.channels-thread-live { color: var(--ink-2); font-size: var(--fs-xs); font-style: italic; }

/* reaction picker */
.channels-picker-pop { min-width: 0; }
.channels-picker { display: flex; flex-direction: column; gap: 8px; padding: 8px; width: min(280px, calc(100vw - 32px)); }
.channels-picker-quick { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.channels-picker-emoji { height: 30px; border-radius: var(--radius-sm); font-size: 17px; line-height: 1; }
.channels-picker-emoji:hover { background: var(--hover); }
.channels-picker-other { display: flex; gap: 6px; min-width: 0; }
.channels-picker-input {
  flex: 1; min-width: 0; height: 30px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--field); color: var(--ink); font: inherit; font-size: var(--fs-sm);
}
.channels-picker-input:focus { border-color: var(--accent-line); outline: none; }

/* ---- composer ---- */
.channels-composer { position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.channels-composer-box {
  display: flex; align-items: flex-end; gap: 6px; padding: 6px 6px 6px 8px; border-radius: var(--radius-lg); min-width: 0;
  border: 1px solid var(--line-2); background: var(--field); backdrop-filter: blur(10px); transition: border-color var(--dur);
}
.channels-composer-box:focus-within { border-color: var(--line-3); }
.channels-composer-input {
  flex: 1; min-width: 0; resize: none; border: 0; outline: 0; background: none; color: var(--ink); padding: 7px 4px;
  max-height: 240px; line-height: 1.45; font: inherit; font-size: var(--fs-base); overflow-y: auto;
}
.channels-composer-input::placeholder { color: var(--muted); }
.channels-composer-box .ui-icon-btn { width: 32px; height: 32px; border-radius: 9px; flex: none; }
.channels-composer-box .channels-send { border-radius: 50%; background: var(--line-2); color: var(--muted); }
.channels-composer-box .channels-send--ready { background: var(--accent); color: var(--accent-ink); }
.channels-composer-box .channels-send--ready:hover:not(:disabled) { background: var(--accent); color: var(--accent-ink); filter: brightness(1.08); }
.channels-composer--edit .channels-composer-box { border-radius: var(--radius); }
.channels-composer-error { color: var(--danger); font-size: var(--fs-xs); }
.channels-edit-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.channels-edit-hint { color: var(--muted); font-size: var(--fs-xs); margin-right: auto; }

.channels-mentions {
  position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 3; list-style: none; margin: 0; padding: 4px;
  width: min(360px, 100%); max-height: 260px; overflow-y: auto;
  border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--raise); box-shadow: var(--shadow-pop);
}
.channels-mention { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; min-width: 0; }
.channels-mention > .ui-icon { color: var(--muted); flex: none; }
.channels-mention--active { background: var(--accent-soft); }
.channels-mention--active > .ui-icon { color: var(--accent); }
.channels-mention-name { color: var(--ink); flex: 0 1 auto; }
.channels-mention-sub { color: var(--muted); font-size: var(--fs-xs); flex: 1 1 auto; text-align: right; }

.channels-uploads { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.channels-upload {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; padding: 2px 2px 2px 10px;
  border: 1px solid var(--line-2); border-radius: var(--radius-pill); background: var(--card); font-size: var(--fs-sm); color: var(--ink-2);
}
.channels-upload > .ui-icon { color: var(--muted); flex: none; }
.channels-upload-state { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }
.channels-upload--error { border-color: var(--danger-line); }
.channels-upload--error .channels-upload-state { color: var(--danger); white-space: normal; }

/* ---- thread panel ---- */
.channels-thread {
  display: flex; flex-direction: column; width: 400px; flex: none; min-height: 0; min-width: 0;
  border-left: 1px solid var(--line); background: var(--panel-solid);
}
.channels-thread-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: 10px 12px 10px var(--sp-4); border-bottom: 1px solid var(--line); min-width: 0; }
.channels-thread-title { display: flex; align-items: baseline; gap: 4px; margin: 0; font-size: var(--fs-md); font-weight: 600; min-width: 0; }
.channels-thread-in { color: var(--muted); font-weight: 400; font-size: var(--fs-sm); }
.channels-thread-scroll { padding: var(--sp-3) var(--sp-4) var(--sp-2); }
.channels-thread-scroll .channels-list { padding: 0; }
.channels-thread .channels-typing { padding: 0 var(--sp-4); }
.channels-thread .channels-compose { padding: 0 var(--sp-4) var(--sp-4); }

@media (max-width: 1080px) {
  .channels-thread { width: 340px; }
}
@media (max-width: 900px) {
  /* The thread covers the channel on narrow screens. */
  .channels-thread { position: absolute; inset: 0; width: auto; z-index: 4; border-left: 0; }
}
@media (max-width: 760px) {
  .channels-head { padding: 10px var(--sp-3); }
  .channels-list { padding: var(--sp-2) var(--sp-3); }
  .channels-typing { padding: 0 var(--sp-3); }
  .channels-compose { padding: 0 var(--sp-3) var(--sp-3); }
  .channels-head-actions .ui-icon-btn { width: 30px; height: 30px; }
  .channels-msg { margin: 0 -6px; padding: 8px 6px; gap: var(--sp-2); }
  .channels-msg-actions { right: 4px; }
}

/* ---- settings and members ---- */
.channels-settings-panel { padding-top: var(--sp-3); min-width: 0; }
.channels-about { display: flex; flex-direction: column; gap: var(--sp-2); }
.channels-about-desc { margin: 0; color: var(--ink-2); line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.channels-about-note { margin: 0; color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; }
.channels-facts { display: flex; flex-wrap: wrap; gap: 4px var(--sp-4); color: var(--muted); font-size: var(--fs-sm); }
.channels-danger-label { margin-left: 0; color: var(--danger); }
.channels-danger { display: flex; flex-direction: column; border: 1px solid var(--danger-line); border-radius: var(--radius); }
.channels-danger-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 12px 14px; flex-wrap: wrap; }
.channels-danger-row + .channels-danger-row { border-top: 1px solid var(--line); }
.channels-danger-row > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 220px; }
.channels-danger-title { color: var(--ink); font-size: var(--fs-md); }
.channels-danger-sub { color: var(--muted); font-size: var(--fs-sm); line-height: 1.45; }

.channels-members-ro, .channels-members-edit { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.channels-members-edit .ui-section-label { margin-left: 0; margin-bottom: 0; }
.channels-members { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.channels-member { display: flex; align-items: center; gap: var(--sp-2); padding: 8px 10px; min-width: 0; }
.channels-member + .channels-member { border-top: 1px solid var(--line); }
.channels-member > .ui-icon { color: var(--muted); flex: none; }
.channels-member-who { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.channels-member-name { color: var(--ink); min-width: 0; flex: 1 1 auto; }
.channels-member-sub { color: var(--muted); font-size: var(--fs-xs); }
.channels-member-role { color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; flex: none; }
.channels-member-error { color: var(--danger); font-size: var(--fs-xs); }
.channels-member-level { flex: 0 1 150px; min-width: 0; }
.channels-member-level .ui-field { margin: 0; }
.channels-members-add { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.channels-members-results { list-style: none; margin: 0; padding: 4px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--raise); }
.channels-members-result { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border-radius: var(--radius-sm); text-align: left; min-width: 0; }
.channels-members-result:hover { background: var(--hover); }
.channels-members-result > .ui-icon { color: var(--muted); flex: none; }

/* ---- pins and search ---- */
.channels-found { list-style: none; margin: var(--sp-3) 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.channels-found-row {
  display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 10px 12px; text-align: left; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
}
.channels-found-row:hover { border-color: var(--line-3); }
.channels-found-head { display: flex; align-items: baseline; gap: var(--sp-2); min-width: 0; flex-wrap: wrap; }
.channels-found-meta { color: var(--accent); font-size: var(--fs-xs); }
.channels-found-text {
  color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* /features/calendar.css */
/* Feature `calendar`: the calendar page and events. Classes are prefixed `calendar-`; colours and spacing come from css/tokens.css.
   A calendar's own colour (user data, `#rrggbb`) arrives as the custom property `--cal-color` on the element that shows it. */

.calendar-page { display: flex; flex-direction: column; min-height: 0; min-width: 0; height: 100%; }
.calendar-unavailable { justify-content: center; padding: var(--sp-6); }

/* head: range title, navigation, views, actions */
.calendar-head {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); min-width: 0;
  padding: 10px var(--sp-5); border-bottom: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(8px);
}
.calendar-title { margin: 0; font-size: var(--fs-lg); font-weight: 600; min-width: 0; flex: 1 1 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar-nav { display: flex; align-items: center; gap: 4px; }
.calendar-loading { display: inline-flex; padding-left: 4px; }
.calendar-tools { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; min-width: 0; }
.calendar-views { flex: none; }
.calendar-list-toggle { display: none; }

/* body: the calendar list beside the view */
.calendar-body { flex: 1; min-height: 0; min-width: 0; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.calendar-side { min-height: 0; overflow-y: auto; border-right: 1px solid var(--line); padding: var(--sp-4) var(--sp-3); background: var(--panel); }
.calendar-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); overflow-y: auto; }
.calendar-main--week, .calendar-main--day { overflow: hidden; }

/* calendar list */
.calendar-list { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.calendar-list-section { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.calendar-list-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.calendar-list-head .ui-section-label, .calendar-list-section > .ui-section-label { margin: 0; }
.calendar-cals { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.calendar-cal { display: flex; align-items: center; gap: 4px; min-width: 0; border-radius: var(--radius-sm); padding-right: 2px; }
.calendar-cal:hover { background: var(--row-hover); }
.calendar-cal-label { flex: 1; display: flex; align-items: center; gap: var(--sp-2); min-width: 0; padding: 6px 6px; cursor: pointer; }
.calendar-cal-check { flex: none; width: 15px; height: 15px; margin: 0; accent-color: var(--cal-color); cursor: pointer; }
.calendar-cal-check:not(:checked) { opacity: .7; }
.calendar-cal-text { display: flex; flex-direction: column; min-width: 0; }
.calendar-cal-name { font-size: var(--fs-md); color: var(--ink); }
.calendar-cal-sub { font-size: var(--fs-sm); color: var(--muted); }

/* event chips (month grid, all-day row) */
.calendar-chip {
  display: flex; align-items: center; gap: 5px; width: 100%; min-width: 0; padding: 2px 6px; border: 0; border-radius: 5px;
  background: transparent; color: var(--ink-2); font: inherit; font-size: var(--fs-sm); text-align: left; cursor: pointer;
}
.calendar-chip:hover { background: var(--hover); color: var(--ink); }
.calendar-chip--filled {
  background: color-mix(in srgb, var(--cal-color) 30%, var(--panel-solid)); color: var(--ink); font-weight: 500;
  box-shadow: inset 3px 0 0 var(--cal-color);
}
.calendar-chip--filled:hover { background: color-mix(in srgb, var(--cal-color) 42%, var(--panel-solid)); color: var(--ink); }
.calendar-chip-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--cal-color); }
.calendar-chip-time { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.calendar-chip-title { flex: 1; min-width: 0; }
.calendar-chip-repeat { flex: none; display: inline-flex; opacity: .65; }
.calendar-more { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: var(--fs-xs); padding: 0 6px; cursor: pointer; }
.calendar-more:hover { color: var(--accent); }

/* month */
.calendar-month { display: flex; flex-direction: column; flex: 1; min-height: 420px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.calendar-month-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); flex: 1; min-height: 0; }
.calendar-month-head { flex: none; background: var(--panel-solid); border-bottom: 1px solid var(--line); }
.calendar-month-weekday { padding: 6px 8px; color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; }
.calendar-wd-short { display: none; }
.calendar-day { display: flex; flex-direction: column; gap: 2px; min-width: 0; min-height: 92px; padding: 4px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.calendar-month-row .calendar-day:nth-child(7n) { border-right: 0; }
.calendar-month-row:last-child .calendar-day { border-bottom: 0; }
.calendar-day--outside { background: var(--card); }
.calendar-day--outside .calendar-day-num { color: var(--muted); }
.calendar-day-num {
  align-self: flex-start; min-width: 26px; height: 24px; padding: 0 6px; border: 0; border-radius: var(--radius-pill);
  background: transparent; color: var(--ink-2); font: inherit; font-size: var(--fs-sm); cursor: pointer;
}
.calendar-day-num:hover { background: var(--hover); color: var(--ink); }
.calendar-day--today .calendar-day-num { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.calendar-day--focus .calendar-day-num:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.calendar-day-events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; min-width: 0; }

/* week and day: all-day row, hours, columns */
.calendar-grid { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.calendar-grid-head, .calendar-allday, .calendar-grid-body { display: grid; grid-template-columns: 52px repeat(var(--cal-days), minmax(0, 1fr)); }
.calendar-grid-head { background: var(--panel-solid); border-bottom: 1px solid var(--line); }
.calendar-grid-gutter { min-width: 0; }
.calendar-grid-day {
  display: flex; align-items: baseline; justify-content: center; gap: 6px; min-width: 0; padding: 6px 2px; border: 0;
  background: transparent; color: var(--ink-2); font: inherit; cursor: pointer;
}
.calendar-grid-day:hover { color: var(--ink); background: var(--hover); }
.calendar-grid-wd { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.calendar-grid-num { font-size: var(--fs-lg); }
.calendar-grid-day--today .calendar-grid-num { color: var(--accent); font-weight: 600; }
.calendar-allday { border-bottom: 1px solid var(--line); max-height: 120px; overflow-y: auto; }
.calendar-allday-label { color: var(--muted); font-size: var(--fs-xs); padding: 6px 4px; text-align: right; }
.calendar-allday-cell { min-width: 0; padding: 3px 2px; border-left: 1px solid var(--line); min-height: 28px; }
.calendar-grid-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.calendar-grid-body { position: relative; height: calc(24 * var(--cal-hour)); }
.calendar-hours { position: relative; }
.calendar-hour { position: absolute; right: 6px; transform: translateY(-50%); color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.calendar-col {
  position: relative; min-width: 0; border-left: 1px solid var(--line); cursor: copy;
  background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 100% var(--cal-hour);
}
.calendar-col--today { background-color: color-mix(in srgb, var(--accent) 4%, transparent); }
.calendar-col-events { list-style: none; margin: 0; padding: 0; }
.calendar-slot { position: absolute; padding: 1px 2px; box-sizing: border-box; }
.calendar-block {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; height: 100%; min-width: 0; overflow: hidden;
  padding: 3px 6px; border: 0; border-left: 3px solid var(--cal-color); border-radius: 5px; cursor: pointer;
  background: color-mix(in srgb, var(--cal-color) 22%, var(--raise)); color: var(--ink); font: inherit; font-size: var(--fs-sm); text-align: left;
}
.calendar-block:hover { background: color-mix(in srgb, var(--cal-color) 32%, var(--raise)); }
.calendar-block-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.calendar-block-time { color: var(--ink-2); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.calendar-block--short { flex-direction: row; align-items: center; gap: 6px; padding-top: 1px; padding-bottom: 1px; }
.calendar-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); pointer-events: none; }
.calendar-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }

/* agenda */
.calendar-agenda { display: flex; flex-direction: column; gap: var(--sp-3); max-width: var(--content-w); width: 100%; }
.calendar-agenda-day { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: var(--sp-3); padding-bottom: var(--sp-3); border-bottom: 1px solid var(--line); }
.calendar-agenda-date { margin: 0; font-size: inherit; font-weight: inherit; }
.calendar-agenda-datebtn { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; border: 0; background: transparent; color: var(--ink-2); font: inherit; cursor: pointer; padding: 4px 0; text-align: left; }
.calendar-agenda-datebtn:hover { color: var(--ink); }
.calendar-agenda-num { font-size: var(--fs-xl); color: var(--ink); }
.calendar-agenda-wd { font-size: var(--fs-sm); color: var(--muted); }
.calendar-agenda-today { font-size: var(--fs-xs); color: var(--accent-ink); background: var(--accent); border-radius: var(--radius-pill); padding: 1px 8px; }
.calendar-agenda-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.calendar-agenda-row {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-width: 0; padding: 8px 10px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--ink); font: inherit; font-size: var(--fs-md); text-align: left; cursor: pointer;
}
.calendar-agenda-row:hover { background: var(--row-hover); }
.calendar-agenda-time { flex: none; width: 116px; color: var(--ink-2); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.calendar-agenda-title { flex: 1 1 auto; min-width: 0; }
.calendar-agenda-where { flex: 0 1 30%; min-width: 0; color: var(--muted); font-size: var(--fs-sm); }

/* details */
.calendar-details { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.calendar-details-row { display: flex; align-items: flex-start; gap: var(--sp-3); min-width: 0; overflow-wrap: anywhere; }
.calendar-details-row > .ui-icon { flex: none; margin-top: 2px; color: var(--muted); }
.calendar-details-row > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.calendar-details-sub { color: var(--muted); font-size: var(--fs-sm); }
.calendar-details-reminders { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.calendar-details-desc { padding-top: var(--sp-2); border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.calendar-details-desc p { margin: 0 0 .6em; }
.calendar-swatch { flex: none; width: 12px; height: 12px; margin: 3px 2px 0; border-radius: 3px; background: var(--cal-color); }

/* forms */
.calendar-form { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.calendar-form-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: flex-end; min-width: 0; }
.calendar-form-row > * { flex: 1 1 150px; min-width: 0; }
.calendar-form-times { align-items: flex-start; }
.calendar-form-times > * { flex: 1 1 130px; }
.calendar-form-toggle { flex: 0 0 auto; padding-bottom: 6px; }
.calendar-repeat { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; margin: 0; padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius); }
.calendar-repeat > legend { padding: 0 4px; }
.calendar-weekdays { display: flex; flex-wrap: wrap; gap: 4px; }
.calendar-weekday {
  min-width: 38px; height: 32px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--radius-pill);
  background: transparent; color: var(--ink-2); font: inherit; font-size: var(--fs-sm); cursor: pointer;
}
.calendar-weekday:hover { border-color: var(--line-3); color: var(--ink); }
.calendar-weekday--on { background: var(--accent-soft-2); border-color: var(--accent-line); color: var(--accent); }
.calendar-rule-preview { display: flex; flex-direction: column; gap: 2px; margin: 0; font-size: var(--fs-sm); color: var(--ink-2); }
.calendar-rule-next { color: var(--muted); }
.calendar-reminders { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.calendar-reminder-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.calendar-scope { display: flex; flex-direction: column; gap: var(--sp-2); margin: 0; padding: 0; border: 0; }
.calendar-scope-option { display: flex; align-items: center; gap: var(--sp-2); padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.calendar-scope-option:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
.calendar-scope-option input { accent-color: var(--accent); margin: 0; }
.calendar-colors { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.calendar-color { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; background: var(--cal-color); cursor: pointer; padding: 0; }
.calendar-color--on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--bg) inset; }
.calendar-color-custom { display: inline-flex; }
.calendar-color-custom input { width: 34px; height: 28px; padding: 0; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: transparent; cursor: pointer; }
.calendar-file { color: var(--ink-2); font: inherit; font-size: var(--fs-sm); max-width: 100%; }
.calendar-file::file-selector-button {
  margin-right: var(--sp-2); padding: 5px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--raise); color: var(--ink); font: inherit; cursor: pointer;
}
.calendar-file::file-selector-button:hover { background: var(--hover); }
.calendar-import-result p { margin: 0 0 var(--sp-2); }
.calendar-import-errors { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); color: var(--ink-2); overflow-wrap: anywhere; }
.calendar-import-code { color: var(--warn); }
.calendar-feed-url { display: flex; align-items: flex-end; gap: var(--sp-2); flex-wrap: wrap; min-width: 0; }
.calendar-feed-url > .ui-field { flex: 1 1 240px; min-width: 0; }

/* sharing */
.calendar-share { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.calendar-share-add { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.calendar-share-results, .calendar-share-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.calendar-share-result {
  display: flex; align-items: center; gap: var(--sp-2); width: 100%; min-width: 0; padding: 6px 8px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.calendar-share-result:hover { background: var(--row-hover); }
.calendar-share-row { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; padding: 4px 0; }
.calendar-share-who { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.calendar-share-row .ui-field { flex: 0 0 auto; margin: 0; }

/* tablets and phones: the calendar list moves into a sheet */
@media (max-width: 1024px) {
  .calendar-body { grid-template-columns: minmax(0, 1fr); }
  .calendar-side { display: none; }
  .calendar-list-toggle { display: inline-flex; }
}
@media (max-width: 760px) {
  .calendar-head { padding: 8px var(--sp-3); }
  .calendar-title { flex-basis: 100%; font-size: var(--fs-base); }
  .calendar-tools { flex: 1 1 100%; justify-content: space-between; flex-wrap: nowrap; }
  .calendar-views { flex: 1 1 auto; min-width: 0; overflow-x: auto; }
  .calendar-views .ui-tab { padding-left: 8px; padding-right: 8px; }
  .calendar-main { padding: var(--sp-2); }
  .calendar-wd-long { display: none; }
  .calendar-wd-short { display: inline; }
  .calendar-month { min-height: 360px; }
  .calendar-month-weekday { padding: 4px; text-align: center; }
  .calendar-day { min-height: 64px; padding: 2px 1px; }
  .calendar-day-num { align-self: center; min-width: 22px; height: 22px; padding: 0 4px; }
  .calendar-chip { padding: 1px 3px; font-size: var(--fs-xs); }
  .calendar-chip-time, .calendar-chip-repeat, .calendar-chip-dot { display: none; }
  .calendar-chip:not(.calendar-chip--filled) { background: color-mix(in srgb, var(--cal-color) 22%, transparent); color: var(--ink); }
  .calendar-grid-head, .calendar-allday, .calendar-grid-body { grid-template-columns: 34px repeat(var(--cal-days), minmax(0, 1fr)); }
  .calendar-grid-day { flex-direction: column; align-items: center; gap: 0; }
  .calendar-grid-num { font-size: var(--fs-md); }
  .calendar-hour { right: 3px; }
  .calendar-block { padding: 2px 3px; }
  .calendar-grid--days-7 .calendar-block-time { display: none; }
  .calendar-agenda-day { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .calendar-agenda-time { width: 92px; }
  .calendar-agenda-where { display: none; }
}
@media (max-width: 420px) {
  .calendar-new-text { display: none; }
  .calendar-views .ui-tab { padding-left: 6px; padding-right: 6px; letter-spacing: 0; }
}

/* /features/automations.css */
/* Feature `automations`: scheduled prompts and their runs. Classes are prefixed `automations-`; colours and spacing come from css/tokens.css. */

/* ---- shared ---- */
.automations-hint { margin: 0; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh); overflow-wrap: anywhere; }
.automations-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); min-width: 0; }
.automations-back {
  display: inline-flex; align-items: center; gap: 6px; margin: 8px 0 0; color: var(--muted); font-size: var(--fs-sm);
  text-decoration: none; max-width: 100%; overflow-wrap: anywhere;
}
.automations-back:hover { color: var(--ink); text-decoration: none; }
.automations-banner { margin: 0 0 var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.automations-section-title {
  margin: 0 0 var(--sp-3); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent);
}
.automations-page .ui-empty .ui-btn .ui-icon { width: 16px; height: 16px; color: currentColor; stroke-width: 1.6; }

/* ---- page head ---- */
.automations-head { justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: var(--sp-3); }
.automations-heading { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 320px; }
.automations-heading .ui-page-title, .automations-heading .ui-page-sub { margin: 0; overflow-wrap: anywhere; }
.automations-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-width: 0; }
.automations-next { margin: 0; color: var(--ink-2); font-size: var(--fs-sm); overflow-wrap: anywhere; }

/* ---- list ---- */
.automations-toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0 0 var(--sp-4); min-width: 0; }
.automations-search { flex: 1 1 260px; min-width: 0; }
.automations-filter { flex: 0 1 200px; min-width: 0; }
.automations-list {
  list-style: none; margin: 0 0 var(--sp-3); padding: 0; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid); overflow: hidden;
}
.automations-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); padding: 12px 14px; min-width: 0;
  border-bottom: 1px solid var(--line);
}
.automations-row:last-child { border-bottom: 0; }
.automations-row:hover { background: var(--row-hover); }
.automations-row-main { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.automations-row-title { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink); text-decoration: none; }
a.automations-row-title:hover { text-decoration: none; }
a.automations-row-title:hover .automations-row-name { text-decoration: underline; text-underline-offset: 3px; }
.automations-row-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.automations-row-title .ui-tag { flex: none; }
.automations-row-schedule { margin: 0; color: var(--ink-2); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.automations-row-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: var(--fs-xs); min-width: 0; }
.automations-row-meta > span { overflow-wrap: anywhere; }
.automations-row-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: none; }
.automations-row-actions .ui-toggle { margin-right: 6px; }
.automations-row--off .automations-row-name { color: var(--muted); }

/* ---- detail ---- */
.automations-card { display: flex; flex-direction: column; gap: var(--sp-4); margin: 0 0 var(--sp-6); min-width: 0; }
.automations-card .automations-section-title { margin: 0; }
.automations-facts {
  margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-3) var(--sp-5); min-width: 0;
}
.automations-fact { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.automations-fact dt { color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; }
.automations-fact dd { margin: 0; color: var(--ink); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.automations-fact dd a { text-decoration: underline; text-underline-offset: 3px; }
.automations-prompt {
  margin: 0; padding: 10px 12px; background: var(--raise); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; font-size: var(--fs-sm); color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 260px; overflow-y: auto;
}
.automations-runs-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); margin: 0 0 var(--sp-3); }
.automations-runs-head .automations-section-title { margin: 0; }
.automations-runs-empty { padding: var(--sp-4) 0; }
.automations-runs {
  list-style: none; margin: 0 0 var(--sp-3); padding: 0; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid); overflow: hidden;
}
.automations-run {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); padding: 10px 14px; min-width: 0;
  border-bottom: 1px solid var(--line);
}
.automations-run:last-child { border-bottom: 0; }
.automations-run-main { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.automations-run-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.automations-run-time { color: var(--ink); font-size: var(--fs-sm); }
.automations-run-trigger { color: var(--muted); font-size: var(--fs-xs); }
.automations-run-meta { margin: 0; color: var(--muted); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.automations-run-error { margin: 0; color: var(--danger); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.automations-run-code { color: var(--muted); font-size: var(--fs-xs); }
.automations-run-warnings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); color: var(--ink-2); }
.automations-run-warnings li { overflow-wrap: anywhere; }
.automations-run-actions { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; flex: none; }
.automations-run-chat { font-size: var(--fs-sm); }

/* ---- editor ---- */
.automations-form { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.automations-section {
  display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; padding: var(--sp-4);
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid);
}
.automations-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: var(--sp-3); min-width: 0; }
.automations-grid > * { min-width: 0; }
.automations-toggles { display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-5); min-width: 0; }
.automations-vars { list-style: none; margin: -4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.automations-vars li { min-width: 0; max-width: 100%; }
.automations-vars .ui-chip { max-width: 100%; }
.automations-form-actions { padding-top: var(--sp-2); }

/* pick lists (tool servers, knowledge bases) */
.automations-pick { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.automations-pick-list {
  list-style: none; margin: 0; padding: 4px; display: flex; flex-direction: column; gap: 2px; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--field); max-height: 220px; overflow-y: auto;
}
.automations-pick-item { display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); min-width: 0; }
.automations-pick-item:hover { background: var(--hover); }
.automations-pick-item input { margin: 3px 0 0; accent-color: var(--accent); flex: none; width: 15px; height: 15px; }
.automations-pick-item label { display: flex; flex-direction: column; gap: 2px; min-width: 0; cursor: pointer; }
.automations-pick-name { color: var(--ink); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.automations-pick-sub { color: var(--muted); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.automations-pick-item--missing .automations-pick-name { color: var(--warn); }

/* schedule */
.automations-schedule { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.automations-days { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.automations-day {
  min-width: 48px; height: 32px; padding: 0 10px; border-radius: var(--radius-pill); border: 1px solid var(--line-2);
  background: transparent; color: var(--ink-2); font: inherit; font-size: var(--fs-sm); cursor: pointer;
  transition: background var(--dur), border-color var(--dur), color var(--dur);
}
.automations-day:hover { background: var(--hover); color: var(--ink); }
.automations-day[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.automations-preview {
  display: flex; flex-direction: column; gap: var(--sp-2); padding: 12px 14px; min-width: 0;
  border: 1px dashed var(--line-2); border-radius: var(--radius-sm); background: var(--raise);
}
.automations-preview-summary { margin: 0; color: var(--ink); font-size: var(--fs-md); font-weight: 500; overflow-wrap: anywhere; }
.automations-preview-label { display: block; margin: 0 0 4px; color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; }
.automations-preview-list { margin: 0 0 6px; padding: 0 0 0 1.4em; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); color: var(--ink-2); min-width: 0; }
.automations-preview-list li { overflow-wrap: anywhere; }
.automations-preview-local { margin-left: 10px; color: var(--muted); font-size: var(--fs-xs); }
.automations-preview-loading { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-sm); }
.automations-preview-errors { display: flex; flex-direction: column; gap: 4px; }
.automations-preview-errors p { margin: 0; }

/* ---- admin › automations ---- */
.automations-admin { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.automations-admin .ui-page-title, .automations-admin .ui-page-sub { margin: 0; overflow-wrap: anywhere; }
.automations-admin-form { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }

@media (max-width: 760px) {
  .automations-row-actions { margin-left: 0; width: 100%; justify-content: flex-end; }
  .automations-run-actions { margin-left: 0; }
  .automations-section { padding: var(--sp-3); }
  .automations-preview-local { display: block; margin-left: 0; }
}

/* /features/notifications.css */
/* Feature `notifications`: the top-bar bell, notification list and preferences. Classes are prefixed `notifications-`; colours and spacing come from css/tokens.css. */

/* the bell */
.notifications-bell { display: inline-flex; flex: none; }
.notifications-bell .ui-icon-btn { position: relative; }
.notifications-bell-badge {
  position: absolute; top: 1px; right: 0; min-width: 16px; height: 16px; padding: 0 4px;
  display: inline-grid; place-items: center; border-radius: var(--radius-pill);
  background: var(--accent); color: var(--accent-ink); font-size: 9.5px; font-weight: 700; line-height: 1;
  box-shadow: 0 0 0 2px var(--panel-solid); pointer-events: none;
}

/* the panel under the bell */
.ui-popover.notifications-panel { width: min(400px, calc(100vw - 16px)); max-width: min(400px, calc(100vw - 16px)); max-height: min(78vh, 560px); padding: 0; }
.notifications-panel-body { display: flex; flex-direction: column; min-width: 0; }
.notifications-panel-head { display: flex; align-items: center; gap: var(--sp-2); padding: 10px 10px 6px 14px; min-width: 0; }
.notifications-panel-title { font-size: var(--fs-base); font-weight: 600; }
.notifications-panel-count { color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; }
.notifications-panel-filter { display: flex; gap: 6px; padding: 0 14px 8px; }
.notifications-panel-foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  padding: 6px 8px 6px 14px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--panel-solid);
}
.notifications-panel-link { color: var(--accent); font-size: var(--fs-sm); }
.notifications-panel-link:hover { text-decoration: underline; }
.notifications-panel-pad { padding: 8px 14px 12px; }
.notifications-empty { color: var(--muted); font-size: var(--fs-md); padding: 18px 14px 22px; text-align: center; }

/* rows (panel and page) */
.notifications-list { list-style: none; margin: 0; padding: 0 6px 6px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notifications-row { position: relative; display: flex; align-items: flex-start; gap: 4px; border-radius: var(--radius-sm); min-width: 0; }
.notifications-row:hover { background: var(--row-hover); }
.notifications-row-main {
  flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 10px; padding: 9px 4px 9px 8px;
  text-align: left; border-radius: var(--radius-sm); color: var(--ink-2);
}
.notifications-row-icon {
  flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: var(--radius-sm);
  background: var(--raise); color: var(--muted);
}
.notifications-row--unread .notifications-row-icon { background: var(--accent-soft); color: var(--accent); }
.notifications-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notifications-row-title { font-size: var(--fs-md); color: var(--ink-2); overflow-wrap: anywhere; }
.notifications-row--unread .notifications-row-title { color: var(--ink); font-weight: 600; }
.notifications-row-count {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: var(--radius-pill);
  background: var(--raise); color: var(--muted); font-size: var(--fs-xs); font-weight: 600; vertical-align: 1px;
}
.notifications-row-body {
  font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.notifications-row-meta { font-size: var(--fs-xs); color: var(--muted); overflow-wrap: anywhere; }
.notifications-row-dot { flex: none; width: 8px; height: 8px; margin-top: 10px; border-radius: 50%; background: var(--accent); }
.notifications-row-actions { display: flex; flex-direction: column; gap: 2px; padding: 7px 4px 0 0; flex: none; }

/* the page */
.notifications-page .ui-page-head { align-items: baseline; }
.notifications-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-4); min-width: 0; }
.notifications-toolbar-filters { display: flex; gap: 6px; }
.notifications-toolbar-kind { min-width: 0; width: 200px; max-width: 100%; }
.notifications-toolbar-kind .ui-field { margin: 0; }
.notifications-toolbar-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.notifications-list--page { padding: 0; background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; }
.notifications-list--page .notifications-row-body { -webkit-line-clamp: 4; }
.notifications-more { display: flex; justify-content: center; margin-top: var(--sp-4); }
.notifications-error { color: var(--danger); font-size: var(--fs-sm); margin-top: var(--sp-2); }

/* settings */
.notifications-settings { display: flex; flex-direction: column; gap: var(--sp-6); min-width: 0; }
.notifications-section { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.notifications-section-title { font-size: var(--fs-lg); font-weight: 500; }
.notifications-section-desc { color: var(--muted); font-size: var(--fs-md); max-width: 68ch; }
.notifications-prefs-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid); }
.notifications-prefs { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.notifications-prefs th, .notifications-prefs td { padding: 10px 14px; text-align: left; vertical-align: middle; border-top: 1px solid var(--line); }
.notifications-prefs thead th { white-space: nowrap;
  border-top: 0; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
}
.notifications-prefs td { width: 1%; white-space: nowrap; text-align: center; }
.notifications-prefs thead th:not(:first-child) { text-align: center; }
.notifications-prefs th[scope="row"] { font-weight: 400; }
.notifications-prefs-label { display: block; color: var(--ink); }
.notifications-prefs-desc { display: block; color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }

.notifications-secret-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-top: var(--sp-2); min-width: 0; }
.notifications-secret-value {
  flex: 1 1 260px; min-width: 0; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--field);
  border: 1px solid var(--line-2); color: var(--ink); font-size: var(--fs-sm); overflow-wrap: anywhere; user-select: all;
}
.notifications-hook-status { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.notifications-hook-why { color: var(--ink-2); font-size: var(--fs-sm); }
.notifications-hook-form { display: flex; flex-direction: column; gap: var(--sp-3); max-width: 620px; min-width: 0; }
.notifications-hook-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.notifications-hook-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px var(--sp-4); font-size: var(--fs-sm); margin: 0; }
.notifications-hook-facts dt { color: var(--muted); }
.notifications-hook-facts dd { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.notifications-hook-help { font-size: var(--fs-sm); color: var(--ink-2); max-width: 68ch; }
.notifications-hook-help summary { cursor: pointer; color: var(--accent); width: max-content; max-width: 100%; }
.notifications-hook-help p { margin-top: var(--sp-2); }

@media (max-width: 760px) {
  .notifications-toolbar-actions { margin-left: 0; }
  .notifications-prefs th, .notifications-prefs td { padding: 9px 10px; }
}

/* /features/telemetry.css */
/* Feature `telemetry`: usage dashboards (admin) and the user's own usage. Classes are prefixed `telemetry-`; colours and spacing come from css/tokens.css. */

/* Chart series (categorical, fixed order, never cycled). Validated for the dark panel #0b1016: every slot inside the
   OKLCH lightness band 0.48–0.67, ≥ 3:1 against the panel, adjacent pairs ΔE ≥ 13 for deutan/protan vision and ≥ 19
   for normal vision. Slot 1 is the accent teal stepped down into the band (the accent itself is too light to sit
   beside the others). `other` and "no group" are neutral grey. */
:root {
  --telemetry-series-1: #2ea3b8;
  --telemetry-series-2: #d95926;
  --telemetry-series-3: #9085e9;
  --telemetry-series-4: #c98500;
  --telemetry-series-5: #d55181;
  --telemetry-series-6: #008300;
  --telemetry-series-7: #3987e5;
  --telemetry-series-8: #e66767;
  --telemetry-other: var(--line-3);
}

/* admin page */
.telemetry-page { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.telemetry-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
.telemetry-head .ui-btn .ui-icon { width: 14px; height: 14px; }
.telemetry-panel { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }

/* filters: one row above everything they scope */
.telemetry-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2) var(--sp-3); min-width: 0; }
.telemetry-filter { min-width: 0; flex: 0 1 140px; }
.telemetry-filter--range { flex-basis: 160px; }
.telemetry-filter .ui-field { margin: 0; }
.telemetry-chips { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2); min-width: 0; }
.telemetry-fresh { color: var(--muted); font-size: var(--fs-sm); }
.telemetry-error { color: var(--danger); font-size: var(--fs-sm); }
.telemetry-empty { color: var(--muted); font-size: var(--fs-md); padding: var(--sp-4) 0; }
.telemetry-muted { color: var(--muted); }
.telemetry-block { display: block; font-size: var(--fs-xs); }

/* while the next answer loads, the last one stays, dimmed */
.telemetry-stale { opacity: .55; transition: opacity var(--dur); }

/* stat tiles */
.telemetry-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: var(--sp-3); min-width: 0; }
.telemetry-tile { background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.telemetry-tile-label { color: var(--muted); font-size: var(--fs-sm); }
.telemetry-tile-value { color: var(--ink); font-size: 22px; font-weight: 600; margin-top: 4px; overflow-wrap: anywhere; }
.telemetry-tile-sub { color: var(--muted); font-size: var(--fs-xs); margin-top: 4px; overflow-wrap: anywhere; }

/* cards */
.telemetry-card { background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.telemetry-card-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-3); }
.telemetry-card-title { font-size: var(--fs-base); font-weight: 600; }
.telemetry-card-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); min-width: 0; flex: 1 1 280px; }
.telemetry-card-tools .telemetry-filter { flex: 0 1 160px; }
.telemetry-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--sp-4); min-width: 0; }

/* chart */
.telemetry-chart { position: relative; min-width: 0; }
.telemetry-chart-tools { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.telemetry-link-btn { color: var(--accent); font-size: var(--fs-sm); padding: 2px 4px; border-radius: var(--radius-sm); }
.telemetry-link-btn:hover { text-decoration: underline; }
.telemetry-plot { position: relative; min-width: 0; width: 100%; overflow: hidden; border-radius: var(--radius-sm); }
.telemetry-plot:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }
.telemetry-svg { display: block; }
.telemetry-grid { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.telemetry-baseline { stroke: var(--line-3); stroke-width: 1; shape-rendering: crispEdges; }
.telemetry-tick { fill: var(--muted); font-size: 10.5px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.telemetry-band { fill: var(--hover); }
.telemetry-crosshair { stroke: var(--line-3); stroke-width: 1; }
.telemetry-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.telemetry-dot { stroke: var(--panel-solid); stroke-width: 2; }

.telemetry-legend { list-style: none; margin: 0 0 var(--sp-2); padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--fs-sm); min-width: 0; }
.telemetry-legend li { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.telemetry-legend-label { color: var(--ink-2); overflow-wrap: anywhere; }
.telemetry-legend-total { color: var(--muted); }
.telemetry-key-box { flex: none; width: 10px; height: 10px; border-radius: 3px; }
.telemetry-key-line { flex: none; width: 12px; height: 2px; border-radius: 1px; }

.telemetry-tooltip-live { position: absolute; inset: 0 auto auto 0; pointer-events: none; }
.telemetry-tooltip {
  position: absolute; top: 4px; min-width: 160px; max-width: 220px; padding: 8px 10px;
  background: var(--raise); border: 1px solid var(--line-2); border-radius: var(--radius-sm); box-shadow: var(--shadow-raise);
  font-size: var(--fs-sm); z-index: 2;
}
.telemetry-tooltip-when { color: var(--muted); font-size: var(--fs-xs); margin-bottom: 4px; }
.telemetry-tooltip-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.telemetry-tooltip-value { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.telemetry-tooltip-label { color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* tables */
.telemetry-table-wrap { position: relative; overflow-x: auto; min-width: 0; }
.telemetry-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.telemetry-table th, .telemetry-table td { padding: 7px 10px; border-top: 1px solid var(--line); text-align: left; vertical-align: middle; }
.telemetry-table thead th { border-top: 0; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.telemetry-table tbody th { font-weight: 400; color: var(--ink); }
.telemetry-table tbody tr:hover { background: var(--row-hover); }
.telemetry-num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.telemetry-name { overflow-wrap: anywhere; min-width: 120px; }
.telemetry-row-other th, .telemetry-row-other td { color: var(--muted) !important; }
.telemetry-bar-col { width: 22%; min-width: 80px; }
.telemetry-actions { white-space: nowrap; width: 1%; }
.telemetry-actions > * { vertical-align: middle; }
.telemetry-bar { display: block; height: 8px; border-radius: 4px; background: var(--accent-soft); overflow: hidden; min-width: 40px; }
.telemetry-bar-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--accent); }
.telemetry-more { display: flex; justify-content: center; margin-top: var(--sp-3); }

/* live activity */
.telemetry-barlist, .telemetry-people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.telemetry-barlist li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(60px, 40%) auto; align-items: center; gap: var(--sp-3); font-size: var(--fs-sm); }
.telemetry-people li { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); min-width: 0; }
.telemetry-people .telemetry-name { flex: 1; min-width: 0; }

/* settings › my usage */
.telemetry-settings { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.telemetry-section { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.telemetry-section-title { font-size: var(--fs-lg); font-weight: 500; }
.telemetry-section-desc { color: var(--muted); font-size: var(--fs-md); max-width: 68ch; }

@media (max-width: 760px) {
  .telemetry-filter, .telemetry-filter--range { flex: 1 1 140px; }
  .telemetry-card { padding: 12px; }
  .telemetry-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .telemetry-tile-value { font-size: 18px; }
}

/* /features/evaluations.css */
/* Feature `evaluations`: reply ratings, arena reveal, admin ratings and leaderboard. Classes are prefixed `evaluations-`; colours and spacing come from css/tokens.css. */

/* ---- on replies: thumbs and the arena label ---- */
.evaluations-rate { display: inline-flex; align-items: center; gap: 2px; }
.evaluations-thumb { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.evaluations-thumb-btn--on { color: var(--accent); background: var(--accent-soft); }
.evaluations-thumb-btn--on .evaluations-thumb { fill: var(--accent-soft-2); }
.evaluations-thumb-btn[aria-busy="true"] { opacity: .6; cursor: progress; }
.evaluations-reveal { display: inline-flex; min-width: 0; max-width: 100%; margin-left: var(--sp-1); }
.evaluations-reveal .ui-tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- the rating dialog ---- */
.evaluations-dialog-lead { margin: 0; color: var(--ink-2); font-size: var(--fs-md); }
.evaluations-value { display: flex; gap: var(--sp-2); margin: 0 0 var(--sp-1); flex-wrap: wrap; }
.evaluations-value-opt { gap: 6px; cursor: pointer; }
.evaluations-value-opt .evaluations-thumb { width: 14px; height: 14px; }
.evaluations-value-opt--on { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.evaluations-reasons { display: flex; flex-wrap: wrap; gap: 6px; }
.evaluations-fields { display: flex; flex-direction: column; gap: var(--sp-3); }
.evaluations-remove { margin-right: auto; }

/* ---- admin page ---- */
.shell-frame-body > .evaluations-page { padding: 0 0 40px; max-width: none; }
.evaluations-page { container: evaluations-page / inline-size; min-width: 0; }
.evaluations-head-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.evaluations-head-text .ui-page-sub { margin: 0; }
.evaluations-panel { padding-top: var(--sp-4); min-width: 0; }
.evaluations-muted { color: var(--muted); }
.evaluations-linkbtn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0; color: var(--ink); font: inherit;
  cursor: pointer; text-align: left; overflow-wrap: anywhere; text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 3px; }
.evaluations-linkbtn:hover { color: var(--accent); text-decoration-color: var(--accent-line); }

/* toolbar: filters, then the actions on the right */
.evaluations-tools { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: flex-end; margin: 0 0 var(--sp-4); }
.evaluations-tools > .ui-field { flex: 0 1 190px; min-width: 140px; }
.evaluations-tools-end { display: flex; gap: var(--sp-2); align-items: center; margin-left: auto; flex-wrap: wrap; }
.evaluations-active-filters { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin: calc(-1 * var(--sp-2)) 0 var(--sp-3); }
.evaluations-summary { margin: 0 0 var(--sp-3); color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }

/* leaderboard */
.evaluations-table-wrap { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid); overflow-x: auto; }
.evaluations-table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.evaluations-table th { text-align: left; font-weight: 500; font-size: var(--fs-sm); color: var(--muted); padding: 10px var(--sp-3);
  border-bottom: 1px solid var(--line); white-space: nowrap; }
.evaluations-table td { padding: 10px var(--sp-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.evaluations-table tbody tr:last-child td { border-bottom: 0; }
.evaluations-table tbody tr:hover { background: var(--row-hover); }
.evaluations-table .evaluations-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.evaluations-rank { color: var(--muted); width: 1%; }
.evaluations-elo { color: var(--ink); font-weight: 600; }
.evaluations-model-cell { min-width: 140px; }
.evaluations-up-count { color: var(--ok); }
.evaluations-down-count { color: var(--danger); }
.evaluations-ci { display: grid; grid-template-columns: auto minmax(60px, 120px); gap: 2px var(--sp-2); align-items: center; min-width: 190px; }
.evaluations-ci-text { font-variant-numeric: tabular-nums; white-space: nowrap; }
.evaluations-ci-bar { position: relative; height: 6px; border-radius: var(--radius-pill); background: var(--raise); }
.evaluations-ci-range { position: absolute; top: 0; bottom: 0; border-radius: var(--radius-pill); background: var(--accent-soft-2); }
.evaluations-ci-point { position: absolute; top: -2px; width: 2px; height: 10px; margin-left: -1px; background: var(--accent); border-radius: 1px; }
.evaluations-ci-level { grid-column: 1 / -1; font-size: var(--fs-xs); color: var(--muted); }
.evaluations-ci-level--low { color: var(--warn); }
.evaluations-ci-level--high { color: var(--ok); }

/* ratings list */
.evaluations-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid); }
.evaluations-row { display: flex; flex-direction: column; gap: 6px; padding: 12px var(--sp-3); min-width: 0; }
.evaluations-row + .evaluations-row { border-top: 1px solid var(--line); }
.evaluations-row:hover { background: var(--row-hover); }
.evaluations-row-head { display: flex; align-items: center; gap: var(--sp-2) var(--sp-3); flex-wrap: wrap; min-width: 0; }
.evaluations-row-link { color: var(--ink); font-weight: 500; overflow-wrap: anywhere; min-width: 0; text-decoration: none; }
.evaluations-row-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.evaluations-row-meta { margin-left: auto; font-size: var(--fs-sm); }
.evaluations-row-tags { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.evaluations-row-tags .ui-tag { max-width: 100%; overflow-wrap: anywhere; }
.evaluations-row-comment { margin: 0; color: var(--ink-2); font-size: var(--fs-md); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; }
.evaluations-more { display: flex; justify-content: center; margin: var(--sp-3) 0 0; }
.evaluations-value-mark { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-sm); font-weight: 500; flex: none; }
.evaluations-value-mark .evaluations-thumb { width: 14px; height: 14px; }
.evaluations-value-mark--up { color: var(--ok); }
.evaluations-value-mark--down { color: var(--danger); }

/* one rating */
.evaluations-back { margin: 0 0 var(--sp-3); }
.evaluations-detail { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.evaluations-detail-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.evaluations-detail-title { margin: 0; font-size: var(--fs-lg); }
.evaluations-detail-title .evaluations-value-mark { font-size: var(--fs-lg); }
.evaluations-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--sp-2) var(--sp-4); margin: 0; font-size: var(--fs-md); }
.evaluations-facts dt { color: var(--muted); }
.evaluations-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.evaluations-pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.evaluations-comparisons { margin: 0; padding-left: var(--sp-4); }
.evaluations-snapshot { margin-top: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.evaluations-snapshot .ui-section-label { margin: 0; }
.evaluations-snapshot > p { margin: 0; font-size: var(--fs-sm); }
.evaluations-snap-block { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.evaluations-snap-label { font-size: var(--fs-sm); color: var(--muted); }
.evaluations-snap-text { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bubble); padding: var(--sp-3);
  max-height: 360px; overflow: auto; font-size: var(--fs-md); line-height: var(--lh); }

/* by tag */
.evaluations-tags { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid); }
.evaluations-tag + .evaluations-tag { border-top: 1px solid var(--line); }
.evaluations-tag-head { display: grid; grid-template-columns: 12px minmax(0, 1fr) minmax(60px, 160px) auto; gap: var(--sp-3); align-items: center;
  padding: 12px var(--sp-3); cursor: pointer; list-style: none; }
.evaluations-tag-head::-webkit-details-marker { display: none; }
.evaluations-tag-head::before { content: "▸"; color: var(--muted); }
details[open] > .evaluations-tag-head::before { content: "▾"; }
.evaluations-tag-head:hover { background: var(--row-hover); }
.evaluations-tag-name { font-weight: 500; overflow-wrap: anywhere; min-width: 0; }
.evaluations-tag-counts { font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.evaluations-tag-models { list-style: none; margin: 0; padding: 0 var(--sp-3) var(--sp-3) calc(2 * var(--sp-3) + 12px); display: flex; flex-direction: column; gap: 6px; }
.evaluations-tag-models > li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(60px, 160px) auto; gap: var(--sp-3); align-items: center; font-size: var(--fs-md); }
.evaluations-tag-model-name { color: var(--ink-2); overflow-wrap: anywhere; min-width: 0; }
.evaluations-bar { display: block; height: 6px; border-radius: var(--radius-pill); background: var(--danger-soft); overflow: hidden; }
.evaluations-bar-up { display: block; height: 100%; background: var(--ok); opacity: .7; }

/* narrow content (phones, or a tablet with the sidebar open) */
@container evaluations-page (max-width: 620px) {
  .evaluations-tools > .ui-field { flex: 1 1 140px; }
  .evaluations-tools-end { margin-left: 0; width: 100%; }
  .evaluations-tag-head { grid-template-columns: 12px minmax(0, 1fr) auto; }
  .evaluations-tag-models > li { grid-template-columns: minmax(0, 1fr) auto; }
  .evaluations-tag-head .evaluations-bar { grid-column: 2 / -1; grid-row: 2; }
  .evaluations-tag-models .evaluations-bar { grid-column: 1 / -1; grid-row: 2; }
  .evaluations-ci { grid-template-columns: auto; min-width: 0; }
  .evaluations-ci-bar { display: none; }
  .evaluations-row-meta { margin-left: 0; width: 100%; }
  .evaluations-facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .evaluations-facts dd { margin-bottom: var(--sp-2); }
}
