:root {
  color-scheme: light dark;
  --bg: #edf0f4;
  --surface: #ffffff;
  --sunken: #f3f5f8;
  --dialog: var(--surface);
  --comment: var(--sunken);
  --selected: #e8e9ec; /* neutral grey, not blue: black and white only (TRK-665) */
  --selected-text: #000000;
  --text: #101828;
  --muted: #5b6474;
  --border: #e3e8ef;
  --accent: #2459e0;
  --accent-text: #ffffff;
  --danger: #c0352b;
  --pass: #1a7f4b;
  --low: #5d6677;
  --medium: #8f5a00;
  --high: #c0480f;
  --urgent: #c0352b;
  /* Status colours (TRK-330): To do blue, In progress amber, Blocked red, In review purple, Done green */
  --chart-todo: #2a78d6;
  --chart-in_progress: #e59400;
  --chart-in_review: #8a5cd6;
  --chart-blocked: #d9483b;
  --chart-custom: #8a8f98;
  --chart-done: #1baf7a;
  --chart-passed: #1baf7a;
  --chart-failed: #c0352b;
  --chart-created: #2a78d6;
  --chart-completed: #138a63;
  --chart-not_run: #7f8794;
  --chart-story: #1baf7a;
  --chart-task: #2a78d6;
  --chart-bug: #eb6834;
  --social-1: #2a78d6;
  --social-2: #eb6834;
  --social-3: #1baf7a;
  --social-4: #eda100;
  --social-5: #e87ba4;
  --social-6: #008300;
  --social-7: #6250d6;
  --social-8: #e34948;
}

/* Dark colours twice: once when following the browser, once when chosen in settings */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0c0c0e;
    --surface: #151518;
    --sunken: #1a1a1e;
    --dialog: var(--surface);
    --comment: var(--sunken);
    --selected: #26272b;
    --selected-text: #ffffff;
    --text: #ededef;
    --muted: #9095a0;
    --border: #26262c;
    --accent: #9ba3ff;
    --accent-text: #10131a;
    --danger: #f0857b;
    --pass: #5fd39a;
    --low: #a0a8b8;
    --medium: #e6b35c;
    --high: #f09a6c;
    --urgent: #f0857b;
    --chart-todo: #3987e5;
    --chart-in_progress: #c98500;
    --chart-in_review: #9b7be8;
    --chart-blocked: #e5534b;
    --chart-custom: #8a8f98;
    --chart-done: #199e70;
    --chart-passed: #2cbf8c;
    --chart-failed: #c8402c;
    --chart-created: #3987e5;
    --chart-completed: #22a87a;
    --chart-not_run: #8f94a3;
    --chart-story: #2cc08a;
    --chart-task: #3987e5;
    --chart-bug: #f07a48;
    --social-1: #3987e5;
    --social-2: #d95926;
    --social-3: #199e70;
    --social-4: #c98500;
    --social-5: #d55181;
    --social-6: #008300;
    --social-7: #9085e9;
    --social-8: #e66767;
  }
}

:root[data-theme="dark"],
:root[data-theme="graphite"],
:root[data-theme="midnight"],
:root[data-theme="onyx"],
:root[data-theme="contrast-dark"] {
  --bg: #0c0c0e;
  --surface: #151518;
  --sunken: #1a1a1e;
  --dialog: var(--surface);
  --comment: var(--sunken);
  --selected: #26272b;
  --selected-text: #ffffff;
  --text: #ededef;
  --muted: #9095a0;
  --border: #26262c;
  --accent: #9ba3ff;
  --accent-text: #10131a;
  --danger: #f0857b;
  --pass: #5fd39a;
  --low: #a0a8b8;
  --medium: #e6b35c;
  --high: #f09a6c;
  --urgent: #f0857b;
  --chart-todo: #3987e5;
  --chart-in_progress: #c98500;
  --chart-in_review: #9b7be8;
  --chart-blocked: #e5534b;
  --chart-custom: #8a8f98;
  --chart-done: #199e70;
  --chart-passed: #2cbf8c;
  --chart-failed: #c8402c;
  --chart-created: #3987e5;
  --chart-completed: #22a87a;
  --chart-not_run: #8f94a3;
  --chart-story: #2cc08a;
  --chart-task: #3987e5;
  --chart-bug: #f07a48;
  --social-1: #3987e5;
  --social-2: #d95926;
  --social-3: #199e70;
  --social-4: #c98500;
  --social-5: #d55181;
  --social-6: #008300;
  --social-7: #9085e9;
  --social-8: #e66767;
  color-scheme: dark;
}

:root[data-theme="light"],
:root[data-theme="mist"],
:root[data-theme="paper"],
:root[data-theme="contrast-light"] {
  color-scheme: light;
}

/* Other themes only change what differs from their light or dark base */
:root[data-theme="mist"] {
  --bg: #eef1f5;
  --surface: #f7f9fb;
  --sunken: #e4e9f0;
  --selected: #dbe4f3;
  --selected-text: #254a9e;
  --text: #1f2733;
  --muted: #4e5868;
  --border: #d3dae4;
  --pass: #15693e;
  --high: #a53c0b;
}

:root[data-theme="paper"] {
  --bg: #faf6ee;
  --surface: #fffdf8;
  --sunken: #f1ebdf;
  --selected: #efe3cd;
  --selected-text: #6b4410;
  --text: #2b2620;
  --muted: #5e5548;
  --border: #e0d6c4;
  --accent: #8f5310;
  --mention: #2459e0; /* mentions stay blue on the brown theme */
  --low: #5e5548;
  --pass: #15693e;
  --high: #a53c0b;
}

:root[data-theme="contrast-light"] {
  --sunken: #f0f0f0;
  --selected: #dfe8ff;
  --selected-text: #00238a;
  --text: #000000;
  --muted: #333333;
  --border: #595959;
  --accent: #0034c4;
  --danger: #a01208;
  --pass: #0a5c33;
  --low: #333333;
  --medium: #6b4200;
  --high: #8f3000;
  --urgent: #a01208;
}

:root[data-theme="graphite"] {
  --bg: #1c1d20;
  --surface: #26282c;
  --sunken: #212226;
  --selected: #343840;
  --selected-text: #d6dbe6;
  --text: #eceef2;
  --muted: #aeb4bf;
  --border: #3a3d43;
  --accent: #a7b4cc;
}

:root[data-theme="midnight"] {
  --bg: #0b1220;
  --surface: #131c2e;
  --sunken: #0f1726;
  --selected: #1f2f52;
  --selected-text: #b3c6ff;
  --text: #e6ecf7;
  --muted: #9fb0c9;
  --border: #26344d;
  --accent: #7fa4ff;
}

:root[data-theme="contrast-dark"] {
  --bg: #000000;
  --surface: #1a1a1a;
  --sunken: #141414;
  --selected: #1a2c66;
  --selected-text: #ffffff;
  --text: #ffffff;
  --muted: #d0d0d0;
  --border: #8a8a8a;
  --accent: #9db8ff;
  --accent-text: #000000;
  --danger: #ffaca4;
  --pass: #6fe8ac;
  --low: #d0d0d0;
  --medium: #ffcd70;
  --high: #ffb085;
  --urgent: #ffaca4;
}

/* Onyx (TRK-624): neutral near-black with no blue tint and an indigo accent.
   Darkest at the edges and sidebar, a slightly lifted main panel, cards one step above that. */
:root[data-theme="onyx"] {
  --bg: #0d0d0e;
  --surface: #18191a;
  --sunken: #131313;
  --selected: #202021;
  --selected-text: #ededef;
  --text: #dfe0e2;
  --muted: #8e8f91;
  --border: #252628;
  --accent: #8189e6; /* Onyx's indigo, light enough for links and focus rings on black */
  --accent-text: #0d0d0e;
}

/* Shape tokens (TRK-217): light themes get the soft, floating look; dark themes the crisp graphite look.
   Colours above stay per theme; these change type, corners, shadows and how panels sit. */
:root {
  --font-ui: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --shadow-card: 0 0 0 1px rgb(16 24 40 / 5%), 0 1px 2px rgb(16 24 40 / 4%), 0 6px 16px -6px rgb(16 24 40 / 8%);
  --shadow-card-hover: 0 0 0 1px rgb(16 24 40 / 6%), 0 2px 4px rgb(16 24 40 / 5%), 0 14px 28px -8px rgb(16 24 40 / 16%);
  --shadow-panel: 0 0 0 1px rgb(16 24 40 / 4%), 0 8px 24px -12px rgb(16 24 40 / 12%);
  --shadow-pop: 0 0 0 1px rgb(16 24 40 / 6%), 0 18px 40px -10px rgb(16 24 40 / 28%);
  --card-border: transparent;
  --card-border-hover: transparent;
  --panel-bg: var(--surface);
  --panel-border: transparent;
  --sidebar-bg: var(--surface);
  --sidebar-shadow: var(--shadow-panel);
  --lane-bg: var(--sunken);
  --lift: -2px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1); /* enter and lift: fast start, soft landing (TRK-599) */
  /* Main buttons are black and white only (TRK-665): black with white text on light themes, white with black text on dark */
  --primary: #000000;
  --primary-text: #ffffff;
  --brand-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); /* the check on the placeholder logo, in the button's text color */
  --primary-shadow: 0 1px 2px rgb(16 24 40 / 12%), 0 6px 14px -6px color-mix(in srgb, var(--primary) 60%, transparent), inset 0 1px 0 rgb(255 255 255 / 18%);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --font-ui: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    --radius-sm: 7px;
    --radius: 8px;
    --radius-lg: 10px;
    --radius-xl: 12px;
    --shadow-card: inset 0 1px 0 rgb(255 255 255 / 3%), 0 1px 2px rgb(0 0 0 / 30%);
    --shadow-card-hover: inset 0 1px 0 rgb(255 255 255 / 4%), 0 8px 18px -8px rgb(0 0 0 / 70%);
    --shadow-panel: inset 0 1px 0 rgb(255 255 255 / 3%);
    --shadow-pop: 0 0 0 1px var(--border), 0 20px 48px -12px rgb(0 0 0 / 70%);
    --card-border: var(--border);
    --card-border-hover: color-mix(in srgb, var(--border) 75%, var(--text));
    --panel-bg: color-mix(in srgb, var(--surface) 50%, var(--bg));
    --panel-border: color-mix(in srgb, var(--border) 70%, var(--bg));
    --sidebar-bg: transparent;
    --sidebar-shadow: none;
    --lane-bg: transparent;
    --lift: -1px;
    --primary: #ffffff;
    --primary-text: #000000;
    --brand-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
    --primary-shadow: inset 0 0 0 1px rgb(255 255 255 / 8%), 0 1px 2px rgb(0 0 0 / 40%);
  }
}

:root[data-theme="dark"],
:root[data-theme="graphite"],
:root[data-theme="midnight"],
:root[data-theme="onyx"],
:root[data-theme="contrast-dark"] {
  --font-ui: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius-sm: 7px;
  --radius: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --shadow-card: inset 0 1px 0 rgb(255 255 255 / 3%), 0 1px 2px rgb(0 0 0 / 30%);
  --shadow-card-hover: inset 0 1px 0 rgb(255 255 255 / 4%), 0 8px 18px -8px rgb(0 0 0 / 70%);
  --shadow-panel: inset 0 1px 0 rgb(255 255 255 / 3%);
  --shadow-pop: 0 0 0 1px var(--border), 0 20px 48px -12px rgb(0 0 0 / 70%);
  --card-border: var(--border);
  --card-border-hover: color-mix(in srgb, var(--border) 75%, var(--text));
  --panel-bg: color-mix(in srgb, var(--surface) 50%, var(--bg));
  --panel-border: color-mix(in srgb, var(--border) 70%, var(--bg));
  --sidebar-bg: transparent;
  --sidebar-shadow: none;
  --lane-bg: transparent;
  --lift: -1px;
  --primary: #ffffff;
  --primary-text: #000000;
  --brand-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  --primary-shadow: inset 0 0 0 1px rgb(255 255 255 / 8%), 0 1px 2px rgb(0 0 0 / 40%);
}

/* Onyx's main panel sits on #131313 with a faint edge; cards barely lift off it */
:root[data-theme="onyx"] {
  --panel-bg: #131313;
  --panel-border: #1c1d1e;
  --card-border: #1f2022;
  --card-border-hover: #2c2d30;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

/* For the frame a theme switch lands in, nothing animates, so no colour lingers from the old theme (TRK-338) */
.theme-switching *,
.theme-switching *::before,
.theme-switching *::after {
  transition: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.5 var(--font-ui); /* type scale from the reference screenshot (TRK-626) */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

input,
select,
textarea {
  min-width: 0;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

/* The list a dropdown opens is drawn in the theme's colors, not the system menu (TRK-469).
   Browsers without customizable selects (Safari and Firefox today) keep the system menu,
   which still follows the theme's light or dark color-scheme. */
@supports (appearance: base-select) {
  select:not([multiple], [size], [data-measuring]),
  select:not([multiple], [size], [data-measuring])::picker(select) {
    appearance: base-select;
  }
  select:not([multiple], [size], [data-measuring]) {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
  }
  /* As big as the plain dropdown was (select-size.js measures it); any rule that sets a size wins */
  select:not([data-measuring]) { width: var(--select-w, auto); height: var(--select-h, auto); }
  select:not([data-measuring])::picker-icon {
    flex: none;
    color: var(--muted);
    font-size: 0.8em;
    transition: rotate 0.15s;
  }
  /* The chosen item (select-size.js adds this button) ends in "…" before the arrow, never under it (TRK-484) */
  select:not([multiple], [size], [data-measuring]) > button {
    all: unset;
    display: block;
    flex: 1 1 auto;
    min-width: 0;
  }
  select:not([multiple], [size], [data-measuring]) > button > selectedcontent {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  select:open::picker-icon { rotate: 180deg; }
  select:not([data-measuring])::picker(select) {
    margin-top: 4px;
    padding: 4px;
    min-width: anchor-size(width);
    max-height: min(320px, 60vh);
    overflow-y: auto;
    background: var(--dialog);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-pop);
  }
  select:not([data-measuring]) option {
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    white-space: nowrap;
  }
  select:not([data-measuring]) option:hover,
  select:not([data-measuring]) option:focus-visible {
    background: var(--selected);
    color: var(--selected-text);
    outline: none;
  }
  select:not([data-measuring]) option:checked { font-weight: 600; }
  select:not([data-measuring]) option::checkmark { color: var(--accent); }
  select:not([data-measuring]) option:disabled { color: var(--muted); }
}

textarea {
  width: 100%;
  min-height: 90px;
  resize: vertical;
}

button {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s, color 0.15s;
}

button:hover {
  background-color: var(--sunken);
  border-color: color-mix(in srgb, var(--border) 70%, var(--muted));
}

button:active {
  transform: translateY(0.5px);
}

button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-text);
  font-weight: 600;
  box-shadow: var(--primary-shadow);
}

button.primary:hover {
  background: color-mix(in srgb, var(--primary) 84%, var(--bg));
  border-color: color-mix(in srgb, var(--primary) 84%, var(--bg));
}

button.ghost {
  background: transparent;
}

button.danger {
  color: var(--danger);
}

/* The red confirm button in the app's own confirm box (TRK-308) */
button.danger-fill,
button.danger-fill:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--surface);
  font-weight: 600;
}

dialog.confirm-box {
  width: min(420px, calc(100vw - 32px));
}

dialog.confirm-box h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

dialog.confirm-box p {
  margin: 0 0 18px;
  color: var(--muted);
}

/* Type CONFIRM before a delete that can't be undone (TRK-445) */
dialog.confirm-box .confirm-word-label {
  display: grid;
  gap: 6px;
  margin: -6px 0 18px;
  font-size: 13px;
  color: var(--muted);
}

dialog.confirm-box .confirm-word-label strong {
  color: var(--text);
  letter-spacing: 0.04em;
}

dialog.confirm-box button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.icon-button {
  display: inline-flex;
  padding: 8px;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.icon-button:hover {
  border-color: transparent;
  color: var(--text);
}

svg.icon {
  display: block;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentcolor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 60px;
  padding: 0 16px;
  background: var(--bg);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: 12px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand::before {
  content: "";
  width: 28px;
  height: 28px;
  background: var(--primary)
    var(--brand-check)
    center / 16px no-repeat;
  border-radius: var(--radius-sm);
  box-shadow: var(--primary-shadow);
}

/* An uploaded logo takes the tick mark's place (TRK-508) */
.brand.has-logo::before {
  display: none;
}

.brand-logo {
  width: 28px;
  height: 28px;
  flex: none;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.auth .brand.has-logo {
  display: flex;
  justify-content: center;
}

.brand-logo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.brand-preview {
  display: inline-flex;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* The search box with its results list under it (TRK-305) */
.search-box {
  position: relative;
  flex: 1;
  max-width: 560px;
  margin-left: auto;
}

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  z-index: 5;
  max-height: min(420px, 70vh);
  overflow-y: auto;
  padding: 6px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgb(0 0 0 / 16%);
}

.search-group {
  padding: 8px 12px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.search-option {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 12px;
  cursor: pointer;
}

.search-option[aria-selected="true"] {
  background: var(--selected);
  color: var(--selected-text);
}

.search-option-label,
.search-option small {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.search-option small,
.search-empty {
  color: var(--muted);
  font-size: 12px;
}

.search-empty {
  padding: 8px 12px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 240px;
  padding: 3px 4px 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  white-space: nowrap;
}

/* Only the label shortens; the × always stays in the chip (TRK-1029) */
.filter-chip-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-chip-remove {
  flex-shrink: 0;
  padding: 0 6px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

#search {
  width: 100%;
  height: 38px;
  padding-left: 36px;
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a909b' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E")
    12px center / 16px no-repeat;
  border-radius: var(--radius);
}

.current-user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 4px 10px 4px 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}

.current-user:hover,
.current-user[aria-current="page"] {
  background: var(--sunken);
  color: var(--text);
}

.layout {
  display: flex;
  gap: 12px;
  min-height: calc(100vh - 60px);
  padding: 0 12px 12px;
}

/* The wrap holds the menu's width and its border handle (TRK-221); the menu itself scrolls */
#sidebar-wrap {
  position: sticky;
  /* Above the page, so a page that positions its own parts (Channels) can't cover the show arrow,
     which hangs over the page's edge while the menu is hidden (TRK-401) */
  z-index: 3;
  top: 60px;
  align-self: flex-start;
  flex: 0 0 var(--sidebar-w, 248px);
  /* Without this a flex item is at least as wide as its longest line, so one long card title in
     Recent stretched the menu across the page (TRK-295). Long names end in … with the full title on hover. */
  min-width: 0;
  max-width: var(--sidebar-w, 248px);
  height: calc(100vh - 72px);
}

/* The menu card fills its column to the bottom of the window, however few items it has (TRK-281) */
#sidebar {
  box-sizing: border-box;
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  padding: 12px;
  background: var(--sidebar-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--sidebar-shadow);
}

.sidebar-hidden #sidebar {
  display: none;
}

/* A hidden menu leaves only its arrow, so the gap closes up */
.sidebar-hidden #sidebar-wrap {
  margin-right: -12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 2px;
  padding: 8px 10px;
  overflow: hidden;
  text-align: left;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: transparent;
  border-color: transparent;
  border-radius: var(--radius);
  color: color-mix(in srgb, var(--text) 78%, var(--muted));
}

.nav-item:hover {
  background: var(--sunken);
  border-color: transparent;
  color: var(--text);
}

.nav-item[aria-current="page"] {
  background: var(--selected);
  color: var(--selected-text);
  font-weight: 600;
}

.nav-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 8px 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

/* The side menu's own headings are small capitals, as in the mockup (TRK-220) */
#sidebar > .nav-heading,
#sidebar > .nav-slot > .nav-heading {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* One icon row per area (TRK-220); its arrow shows the area's items */
#sidebar > .nav-item .nav-icon,
#sidebar > .nav-slot > .nav-item .nav-icon,
.nav-group-item .nav-icon {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: none;
}

.nav-group {
  position: relative;
  margin-bottom: 2px;
}

.nav-group-item {
  margin-bottom: 0;
  padding-right: 58px;
}

.nav-group .fold-arrow {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  transform: translateY(-50%);
}

.nav-group-actions {
  position: absolute;
  top: 50%;
  right: 30px;
  display: flex;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.15s;
}

.nav-group:hover .nav-group-actions,
.nav-group:focus-within .nav-group-actions {
  opacity: 1;
}

.nav-group-actions button {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 6px;
  line-height: 1;
}

/* An area's items open right below its row, lined up with it, so a narrow menu keeps its width for names (TRK-395) */
/* A light shade marks where an open sub-menu starts and ends, without an indent (TRK-516) */
.nav-group-body {
  margin: 2px 0 8px;
  padding: 3px;
  background: color-mix(in srgb, var(--sunken) 60%, transparent);
  border-radius: calc(var(--radius) + 3px);
}

.nav-group-body .nav-item:hover {
  background: color-mix(in srgb, var(--sunken), var(--text) 6%);
}

.nav-group-body .nav-item:last-child {
  margin-bottom: 0;
}

.nav-group-body .nav-item {
  padding-top: 6px;
  padding-bottom: 6px;
}

.nav-subheading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 10px 4px 4px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-subheading-toggle {
  flex: 1;
  min-width: 0;
  margin: -4px 4px -4px -6px;
  padding: 4px 6px;
  background: none;
  border: 0;
  border-radius: 6px;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-transform: inherit;
}

.nav-subheading-toggle:hover {
  background: var(--sunken);
  color: var(--text);
}

.nav-subheading .nav-add {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 6px;
}

.nav-heading button {
  padding: 0 7px;
}

/* Clicking a heading's name folds it; it highlights on hover like a menu item (TRK-456) */
.nav-heading .heading-toggle {
  flex: 1;
  min-width: 0;
  margin: -4px 6px -4px -6px;
  padding: 4px 6px;
  overflow: hidden;
  background: none;
  border: 0;
  border-radius: 6px;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-overflow: ellipsis;
  text-transform: inherit;
  white-space: nowrap;
}

.nav-heading .heading-toggle:hover {
  background: var(--sunken);
  color: var(--text);
}

.project-mark {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 22px;
  height: 22px;
  background: var(--primary); /* black and white like the buttons (TRK-665) */
  color: var(--primary-text);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
}

.project-mark.large {
  width: 34px;
  height: 34px;
  font-size: 16px;
}

.avatar {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 24px;
  height: 24px;
  background: var(--sunken);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
}

.avatar-empty {
  background: transparent;
  border: 1px dashed color-mix(in srgb, var(--muted) 60%, transparent);
}

main {
  flex: 1;
  min-width: 0;
  padding: 28px 32px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-panel);
}

.crumb {
  color: var(--muted);
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 2px 0 10px;
}

/* Quiet headings (TRK-626): page titles are small and medium weight, not big and bold */
h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
}

.tabs button {
  padding: 8px 12px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
}

.tabs button[aria-current="page"] {
  border-bottom-color: var(--accent);
  color: var(--selected-text);
  font-weight: 600;
}

/* + Create sits at the right end of a space's view tabs */
.tabs #new-issue {
  flex: none;
  align-self: center;
  margin: 0 0 6px auto;
  padding: 6px 14px;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  color: var(--primary-text);
  font-weight: 600;
}

.tabs #new-issue:hover {
  background: color-mix(in srgb, var(--primary) 84%, var(--bg));
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.toolbar .end {
  margin-left: auto;
}

.home-section {
  margin-bottom: 32px;
}

.home-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.segments {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--sunken);
  border-radius: var(--radius);
}

.segments button {
  padding: 5px 12px;
  background: transparent;
  border-color: transparent;
  border-radius: calc(var(--radius) - 3px);
  color: var(--muted);
}

.segments button:hover {
  background: transparent;
  border-color: transparent;
  color: var(--text);
}

.segments button[aria-current="page"] {
  background: var(--surface);
  border-color: var(--card-border);
  box-shadow: 0 1px 3px rgb(16 24 40 / 12%);
  color: var(--text);
  font-weight: 600;
}

.project-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.project-card {
  padding: 16px;
  text-align: left;
  border-color: var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.project-card:hover {
  background: var(--surface);
  border-color: var(--card-border-hover);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(var(--lift));
}

.project-card strong {
  display: block;
  margin-top: 10px;
  overflow-wrap: anywhere;
}

.project-card span.sub {
  color: var(--muted);
  font-size: 12px;
}

.work-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  text-align: left;
  background: transparent;
  border-color: transparent;
  border-radius: var(--radius);
}

.work-row:hover {
  background: var(--sunken);
  border-color: transparent;
}

.work-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.work-text small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.work-when {
  flex: none;
  color: var(--muted);
  font-size: 12px;
}

.type-icon {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  background: var(--sunken);
  border-radius: var(--radius-sm);
  color: var(--selected-text);
}

.type-icon.bug {
  color: var(--urgent);
}

.type-icon.story {
  color: var(--medium);
}

.team-panel {
  max-width: 760px;
  margin-bottom: 14px;
}

.invite-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.invite-form input {
  flex: 1 1 220px;
}

.new-link {
  margin-top: 14px;
  padding: 12px;
  background: var(--selected);
  border-radius: 8px;
}

.new-link p.sub {
  margin-bottom: 8px;
}

.team-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.team-row:last-child {
  border-bottom: 0;
}

.team-you {
  color: var(--muted);
  font-size: 12px;
}

.auth-back {
  justify-self: center;
}

/* The reset command stays on one line, scrolls if it must, and has its own Copy button (TRK-313) */
.auth-command {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0; /* a grid item, so without this the long command widens it past the card (TRK-313) */
}

.auth-code {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  overflow-x: auto;
  background: var(--sunken);
  border-radius: 6px;
  white-space: nowrap;
}

.auth-hint {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.875em;
}

.nav-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item .type-icon {
  width: 22px;
  height: 22px;
}

.docs-layout {
  position: relative;
  display: grid;
  grid-template-columns: var(--docs-tree-w, 240px) minmax(0, 1fr);
  /* The hide arrow (22px) sits in the middle of this gap, so it keeps 9px from the page list and the
     title, whether the list is open or hidden (TRK-401) */
  gap: 40px;
  align-items: start;
}

/* TRK-402: too narrow for the list and the page side by side, so the list sits above the page */
.docs-layout.docs-narrow {
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.docs-layout.docs-narrow .doc-tree {
  position: static;
  max-height: 240px;
  padding-right: 0;
  padding-bottom: 12px;
  border-right: 0;
  border-bottom: 1px solid var(--border);
}

.docs-layout.docs-narrow > .pane-resizer {
  display: none;
}

.doc-tree {
  position: sticky;
  top: 68px;
  max-height: calc(100vh - 92px);
  padding-right: 12px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

.doc-tree .nav-heading:first-child {
  margin-top: 4px;
}

/* A selected or hovered first page keeps clear space under its heading and + button (TRK-458) */
.doc-tree .nav-heading {
  margin-bottom: 12px;
}

.doc-trash {
  color: var(--muted);
}

/* New folder and Trash sit under the page list (TRK-403) */
.doc-tree-end {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

.doc-tree-end > button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.doc-tree-end .nav-icon {
  width: 15px;
  height: 15px;
  margin: 0;
}

/* A folder's heading has its menu beside the + */
.doc-folder-actions {
  display: inline-flex;
  gap: 4px;
}

.doc-folder-actions .nav-icon {
  width: 14px;
  height: 14px;
  margin: 0;
}

.doc-folder-empty {
  margin: 2px 0 6px 26px;
  color: var(--muted);
  font-size: 13px;
}

/* Dragging in the page list (TRK-434): a folder heading grabs, a line shows where it lands, and a
   folder or the Trash lights up when the drop goes inside it */
.doc-folder-heading {
  position: relative;
  margin-top: 14px;
  padding-top: 4px;
  padding-bottom: 4px;
  border-radius: 6px;
  cursor: grab;
}

.doc-tree .tree-row[draggable="true"] {
  position: relative;
  border-radius: 6px;
}

/* Pages show where a dragged page lands: a line above or below, or lit up to go inside (TRK-463) */
.doc-tree .tree-row.drop-before::before,
.doc-tree .tree-row.drop-after::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 1px;
  background: var(--primary);
  pointer-events: none;
}

.doc-tree .tree-row.drop-before::before {
  top: -2px;
}

.doc-tree .tree-row.drop-after::after {
  bottom: 0;
}

.doc-tree .tree-row.drop-inside .nav-item,
.doc-space-heading.drop-inside {
  color: var(--text);
  background: var(--selected);
  outline: 2px solid var(--primary);
  outline-offset: -1px;
  border-radius: 6px;
}

.doc-tree .dragging {
  opacity: 0.45;
}

.doc-folder-heading.drop-before::before,
.doc-folder-heading.drop-after::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 1px;
  background: var(--primary);
  pointer-events: none;
}

.doc-folder-heading.drop-before::before {
  top: -4px;
}

.doc-folder-heading.drop-after::after {
  bottom: -4px;
}

.doc-folder-heading.drop-inside,
.doc-trash.drop-inside {
  color: var(--text);
  background: var(--selected);
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

/* A folder inside a folder steps in, so the nesting shows */
.doc-subfolders {
  margin-left: 12px;
  padding-left: 4px;
  border-left: 1px solid var(--border);
}

.doc-subfolders .nav-heading {
  margin-top: 10px;
}

.form-row-buttons {
  display: flex;
  gap: 8px;
}

.form-actions .start {
  margin-right: auto;
}

/* A button that can't be used yet says so by looking off */
.form-actions .danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Page buttons carry the same line icons as the main sidebar */
.doc-actions > button,
.doc-trash,
.doc-trash-empty {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.doc-actions > button .nav-icon,
.doc-trash .nav-icon,
.doc-trash-empty .nav-icon {
  width: 15px;
  height: 15px;
  margin: 0;
}

.doc-content {
  min-width: 0;
}

.doc-content .page-head .end {
  margin-left: auto;
}

.doc-content p.sub {
  margin: 4px 0 16px;
}

.doc-section {
  margin: 24px 0 8px;
}

.doc-comments {
  margin-top: 32px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.doc-comment {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 12px;
  background: var(--comment);
  border-radius: 8px;
}

.doc-comment-main {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}

.doc-comment-main > :first-child + * {
  margin-top: 2px;
}

.doc-comment-main p {
  margin: 4px 0 0;
}

.doc-comment-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.doc-comment-head small {
  color: var(--muted);
  font-size: 12px;
}

.doc-comment-form textarea {
  width: 100%;
}

/* The title and its buttons stay in view while a long page scrolls, just under the top bar */
.doc-head {
  position: sticky;
  top: 60px;
  z-index: 1;
  margin: -12px 0 12px;
  padding: 12px 0 8px;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border);
}

.doc-head p.sub {
  margin-bottom: 0;
}

@media (max-width: 760px) {
  .doc-head {
    top: var(--topbar-h, 102px);
  }
}

.doc-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 2px 0;
}

.doc-actions h1 {
  flex: 1 1 240px;
  overflow-wrap: anywhere;
}

/* Docs are for reading, so their titles keep the larger size the quiet interface headings left (TRK-626) */
.doc-actions h1,
.doc-body h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.doc-title-input {
  flex: 1 1 240px;
  font-size: 20px;
  font-weight: 700;
}

.doc-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 10px 0;
}

.doc-tools button {
  padding: 3px 9px;
  font-size: 12px;
}

.doc-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 14px;
}

.doc-text {
  min-height: 62vh;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.doc-preview {
  min-width: 0;
  padding: 12px 14px;
  overflow-wrap: anywhere;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.doc-split .doc-preview {
  max-height: 62vh;
  overflow-y: auto;
}

.doc-body {
  font-size: 15px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.doc-body img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  cursor: zoom-in;
}

.doc-body h2 {
  margin: 22px 0 8px;
  font-size: 22px;
}

.doc-body h3 {
  margin: 18px 0 6px;
  font-size: 18px;
}

.doc-body h4 {
  margin: 14px 0 4px;
  font-size: 15px;
}

.doc-body p,
.doc-body ul,
.doc-body ol,
.doc-body pre,
.doc-body blockquote {
  margin: 0 0 10px;
}

.doc-body blockquote {
  padding: 2px 12px;
  color: var(--muted);
  border-left: 3px solid var(--border);
}

.doc-body code {
  padding: 1px 4px;
  background: var(--sunken);
  border-radius: 4px;
  font: 13px ui-monospace, SFMono-Regular, Menlo, monospace;
}

.doc-body pre {
  padding: 10px 12px;
  overflow-x: auto;
  background: var(--sunken);
  border-radius: 6px;
}

.doc-body pre code {
  padding: 0;
  background: none;
}

.doc-body a {
  color: var(--selected-text);
}

.doc-body hr {
  margin: 16px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.doc-body table {
  min-width: 0;
}

.doc-body .table-wrap {
  margin-bottom: 10px;
}

.doc-body li.check-item {
  margin-left: -20px;
  list-style: none;
}

.check-item input {
  margin-right: 6px;
}

.issue-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  vertical-align: middle;
  text-decoration: none;
}

.issue-chip .type-icon {
  width: 18px;
  height: 18px;
}

.theme-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.theme-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.theme-card.on {
  border-color: var(--accent);
  background: var(--selected);
}

.theme-sample {
  flex: none;
  width: 44px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #ffffff; /* each sample shows its own theme, whichever is active */
}

.theme-sample.dark {
  background: #14171f;
}

.theme-sample.mist {
  background: #eef1f5;
}

.theme-sample.paper {
  background: #faf6ee;
}

.theme-sample.contrast-light {
  background: #ffffff;
  border-color: #000000;
}

.theme-sample.graphite {
  background: #26282c;
}

.theme-sample.midnight {
  background: #0b1220;
}

.theme-sample.contrast-dark {
  background: #000000;
}

.theme-sample.onyx {
  background: linear-gradient(90deg, #0d0d0e 30%, #18191a 30%);
  box-shadow: inset -6px 0 0 #8189e6;
}

.theme-sample.system {
  background: linear-gradient(90deg, #ffffff 50%, #14171f 50%);
}

.bell {
  position: relative;
  margin-left: auto;
}

/* TRK-943: Help, before the bell, with its small menu */
.help-wrap {
  position: relative;
  margin-left: auto;
}

.help-wrap + .bell {
  margin-left: 0;
}

.help-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 5;
  width: max-content;
  max-width: min(280px, calc(100vw - 24px));
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgb(0 0 0 / 16%);
  transform-origin: top right;
  animation: help-menu-in 150ms cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes help-menu-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
}

.help-menu a {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
}

.help-menu a span {
  color: var(--muted);
  font-size: 0.8125rem;
}

.help-menu a:hover,
.help-menu a:focus-visible {
  background: var(--sunken);
}

@media (prefers-reduced-motion: reduce) {
  .help-menu {
    animation: none;
  }
}

.bell + .current-user {
  margin-left: 0;
}

.badge {
  position: absolute;
  top: -5px;
  right: -6px;
  min-width: 17px;
  padding: 0 4px;
  background: var(--urgent);
  color: var(--bg);
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  line-height: 17px;
}

.star {
  display: inline-flex;
  flex: none;
  padding: 5px;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.star.on {
  color: var(--medium);
}

.star.on svg {
  fill: currentcolor;
}

.work-line {
  display: flex;
  align-items: center;
  gap: 4px;
}

.work-line .work-row {
  flex: 1;
  min-width: 0;
}

/* Section widgets on the Dashboard (TRK-278): a meeting that's over fades, Join sits at the end */
.work-line.over .work-row {
  opacity: 0.6;
}

.work-row > .nav-icon {
  flex: none;
  color: var(--muted);
}

.widget-join {
  flex: none;
  padding: 4px 12px;
}

.notification {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  margin-bottom: 4px;
  padding: 10px;
  text-align: left;
  background: transparent;
  border-color: transparent;
}

.notification:hover {
  background: var(--sunken);
}

.notification.unread {
  background: var(--selected);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.filter-menu {
  position: relative;
}

.filter-menu summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  list-style: none;
}

.filter-menu summary::-webkit-details-marker {
  display: none;
}

.time-window {
  width: auto;
}

.sort-by {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.window-count {
  color: var(--muted);
  font-size: 13px;
}

.filter-panel {
  position: absolute;
  z-index: 1;
  width: 220px;
  margin-top: 4px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgb(0 0 0 / 16%);
}

.timeline {
  min-width: 760px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 260px 1fr;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.timeline-row:last-child {
  border-bottom: 0;
}

.timeline-axis {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.timeline-axis > span {
  padding: 8px 12px;
}

.timeline-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 12px;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.timeline-name .overdue {
  flex: none;
  margin-left: auto;
  font-size: 11px;
}

.timeline-lane {
  position: relative;
  height: 40px;
  border-left: 1px solid var(--border);
}

.timeline-axis .timeline-lane {
  height: 34px;
}

.tick {
  position: absolute;
  top: 8px;
  white-space: nowrap;
}

.today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--text);
}

.timeline-bar {
  position: absolute;
  top: 12px;
  display: flex;
  gap: 1px;
  min-width: 8px;
  height: 16px;
  overflow: hidden;
  border-radius: 4px;
}

/* One per status in an epic, as wide as its share of the epic's cards (TRK-607) */
.timeline-segment {
  flex: 1 1 0;
  min-width: 2px;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
}

.timeline-count {
  color: var(--muted);
}

.legend.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
}

.today-key {
  width: 2px;
  height: 12px;
  background: var(--text);
}

p.sub {
  color: var(--muted);
  font-size: 12px;
}

.issue-path {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.subtask-count {
  margin-left: 8px;
  color: var(--muted);
  font-weight: 400;
}

.progress {
  height: 6px;
  margin-bottom: 8px;
  overflow: hidden;
  background: var(--sunken);
  border-radius: 3px;
}

.progress div {
  height: 100%;
  background: var(--accent);
}

.subtask-row {
  flex-wrap: nowrap;
  background: var(--sunken);
}

.subtask-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.subtask-form input {
  flex: 1;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.stat {
  padding: 12px 14px;
}

.stat strong {
  display: block;
  font-size: 16px;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
}

/* Summary widgets: one size in a grid; whatever doesn't fit scrolls inside its widget */
.panels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  grid-auto-rows: 380px;
  gap: 14px;
}

.panels > .panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-scroll {
  flex: 1;
  min-height: 0;
  margin-right: -8px;
  padding-right: 8px;
  overflow-y: auto;
}

.panel {
  min-width: 0;
  padding: 16px;
}

.panel p.sub {
  margin: 2px 0 14px;
  color: var(--muted);
}

.panel h3 {
  margin: 14px 0 6px;
  font-size: 13px;
}

.panel h3:first-of-type {
  margin-top: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-head h2 {
  flex: 1;
  min-width: 0;
}

.drag-handle {
  color: var(--muted);
  cursor: grab;
  user-select: none;
}

.panel-hide {
  padding: 0 6px;
  color: var(--muted);
}

.panel.dragging {
  opacity: 0.5;
}

.panel.drop {
  outline: 2px dashed var(--selected-text);
  outline-offset: 2px;
}

.widget-menu .filter-panel {
  right: 0;
}

.widget-list {
  width: 260px;
  list-style: none;
}

.widget-list li {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}

.widget-list li:last-child {
  margin: 10px 0 0;
}

.widget-list label {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
}

.widget-list input {
  width: auto;
}

.widget-list .ghost {
  padding: 2px 8px;
}

.progress {
  height: 6px;
  margin: 6px 0 4px;
  overflow: hidden;
  background: var(--sunken);
  border-radius: 3px;
}

/* Same look as the epic bar on cards */
.progress div {
  height: 100%;
  background: var(--accent);
}

.trend .legend {
  margin-bottom: 12px;
}

/* In a fixed-height widget the chart keeps its axis titles inside, so Date isn't cut off (TRK-326) */
.panel .trend svg {
  max-height: 180px;
}

.trend svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.trend .grid {
  stroke: var(--border);
  stroke-width: 1;
}

.trend .axis-label {
  fill: var(--muted);
  font-size: 10px;
}

/* What each burndown axis measures (TRK-326) */
.trend .axis-title {
  font-weight: 600;
}

.trend .series {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.trend .series.ideal {
  stroke: var(--muted);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}

.legend .swatch.ideal {
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--muted) 0 3px, transparent 3px 5px);
}

.trend .hover-line {
  stroke: var(--muted);
  stroke-width: 1;
  visibility: hidden;
}

.summary-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.summary-list li {
  margin-bottom: 10px;
  overflow-wrap: anywhere;
}

.summary-list small,
.summary-empty {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary-empty {
  margin: 0;
}

.link {
  padding: 0;
  background: none;
  border: 0;
  color: var(--selected-text);
  text-align: left;
  text-decoration: underline;
}

.hero {
  margin-bottom: 8px;
  font-size: 28px;
  font-weight: 700;
}

.hero span {
  margin-left: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.stack {
  display: flex;
  gap: 2px;
  height: 18px;
  margin-bottom: 14px;
}

.stack div {
  min-width: 4px;
  height: 100%;
}

.stack div:first-child {
  border-radius: 4px 0 0 4px;
}

.stack div:last-child {
  border-radius: 0 4px 4px 0;
}

.stack div:only-child {
  border-radius: 4px;
}

.legend {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.legend .value {
  margin-left: auto;
  color: var(--muted);
}

.feed-date {
  margin: 14px 0 8px;
  font-weight: 600;
}

.feed-date:first-of-type {
  margin-top: 0;
}

.feed-item {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.feed-item small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.feed-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.lozenge {
  display: inline-block;
  padding: 1px 9px;
  background: var(--sunken);
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.lozenge.in_progress,
.lozenge.in_review {
  background: var(--selected);
  color: var(--selected-text);
}

.lozenge.passed {
  background: var(--pass);
  border-color: var(--pass);
  color: var(--accent-text);
}

.lozenge.failed {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--accent-text);
}

.criterion {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.criterion.replaced {
  opacity: 0.7;
}

.criterion.replaced strong {
  text-decoration: line-through;
}

.criterion-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.criterion-head > strong {
  flex: 1;
}

.correction-form {
  display: flex;
  flex-basis: 100%;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0;
  order: 1;
}

.correction-form[hidden] {
  display: none;
}

.test-row,
.test-add {
  padding: 6px 0;
  border-top: 1px solid var(--border);
}

.test-row summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.test-add summary {
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.test-kind {
  color: var(--muted);
  font-size: 12px;
}

.runs h3 {
  margin-bottom: 8px;
}

.run {
  margin-bottom: 8px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--accent) 4%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: 10px;
}

.run > summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  cursor: pointer;
  list-style: none;
}

.run > summary::-webkit-details-marker {
  display: none;
}

.run-bot {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.run-who {
  min-width: 0;
}

.run-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* TRK-539: a ring that turns while an agent works, on the run and on its board card */
.run-spinner {
  flex: none;
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: run-spin 0.9s linear infinite;
}

@keyframes run-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .run-spinner { animation-duration: 3s; }
}

.run-state {
  flex: none;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 12px;
  font-weight: 600;
}

.run-live {
  color: var(--accent);
}

.run-done {
  color: var(--pass);
}

.run-failed,
.run-lost {
  color: var(--danger);
}

/* The feed: one row per step, cut to one line until clicked */
.feed {
  margin: 10px 0 0;
  max-height: 340px;
  overflow-y: auto;
  font-size: 13px;
}

.feed-row summary {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: flex-start;
  padding: 4px 4px;
  border-radius: 6px;
  cursor: pointer;
  list-style: none;
}

.feed-row summary::-webkit-details-marker {
  display: none;
}

.feed-row summary:hover {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

.feed-row summary > .icon {
  flex: none;
  margin-top: 2px;
  color: var(--muted);
  transform: rotate(-90deg);
  transition: transform 0.15s;
}

.feed-row[open] summary > .icon {
  transform: none;
}

.feed-text {
  display: block;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.feed-row[open] .feed-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.feed-text > * + * {
  margin-left: 6px;
}

.feed-text .icon {
  display: inline-block;
  vertical-align: -3px;
  color: var(--accent);
}

.feed-say em {
  color: var(--muted);
}

.feed-tool strong {
  color: var(--text);
}

.feed-result,
.feed-plain {
  color: var(--muted);
}

.feed-label {
  color: var(--muted);
}

/* The latest step on a board card while an agent works on it */
.card-live {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: -4px 0 10px;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  font-size: 12px;
}

.card-live .run-spinner {
  width: 11px;
  height: 11px;
}

.card-live-text {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.run-result {
  margin: 8px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Claude (TRK-486): a button beside the search box opens a full-height panel docked on the right */
:root {
  --claude-grad: linear-gradient(135deg, #7b5cff 0%, #3d7bff 45%, #19b6c9 75%, #ff8a5c 100%);
  --claude-glow: 0 0 0 1px rgb(123 92 255 / 18%), 0 6px 18px -6px rgb(61 123 255 / 45%);
  --claude-sparkle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1.5c.5 4.9 2.6 8.2 9.5 10.5-6.9 2.3-9 5.6-9.5 10.5-.5-4.9-2.6-8.2-9.5-10.5C9.4 9.7 11.5 6.4 12 1.5Z'/%3E%3Cpath d='M19.5 1c.2 1.7.9 2.8 3 3.5-2.1.7-2.8 1.8-3 3.5-.2-1.7-.9-2.8-3-3.5 2.1-.7 2.8-1.8 3-3.5Z'/%3E%3C/svg%3E");
}

.claude-mark {
  position: relative;
  flex: none;
  display: inline-block;
  width: 18px;
  height: 18px;
  background: var(--claude-grad);
  background-size: 200% 200%;
  -webkit-mask: var(--claude-sparkle) center / contain no-repeat;
  mask: var(--claude-sparkle) center / contain no-repeat;
}

.claude-mark.sm {
  width: 15px;
  height: 15px;
}

.claude-mark.xl {
  width: 56px;
  height: 56px;
  animation: claude-drift 6s ease-in-out infinite;
}

.claude-mark.off {
  filter: grayscale(1);
  opacity: 0.55;
  animation: none;
}

.claude-mark.spin {
  animation: claude-pulse 1.4s ease-in-out infinite;
}

@keyframes claude-drift {
  0%, 100% { background-position: 0% 50%; transform: rotate(0deg) scale(1); }
  50% { background-position: 100% 50%; transform: rotate(8deg) scale(1.06); }
}

@keyframes claude-pulse {
  0%, 100% { transform: scale(0.85) rotate(0deg); opacity: 0.7; }
  50% { transform: scale(1.1) rotate(45deg); opacity: 1; }
}

/* The top bar's button: a pill beside the search box with the shortcut in it */
.ask-claude {
  position: relative;
  display: inline-flex;
  flex: none;
  gap: 8px;
  align-items: center;
  height: 36px;
  padding: 0 10px 0 12px;
  color: var(--text);
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.ask-claude::before {
  content: "";
  position: absolute;
  inset: -1px;
  padding: 1px;
  border-radius: inherit;
  background: var(--claude-grad);
  opacity: 0;
  transition: opacity 0.18s ease;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}

.ask-claude:hover,
.ask-claude.on {
  background: var(--surface);
  border-color: transparent;
  box-shadow: var(--claude-glow);
}

.ask-claude:hover::before,
.ask-claude.on::before {
  opacity: 1;
}

.ask-claude .claude-mark {
  width: 16px;
  height: 16px;
}

.ask-claude:hover .claude-mark,
.ask-claude.on .claude-mark {
  animation: claude-drift 3s ease-in-out infinite;
}

.ask-claude kbd {
  padding: 1px 6px;
  color: var(--muted);
  font: 500 11px/18px Inter, system-ui, sans-serif;
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* The panel: a card the height of the window below the top bar, like the menu on the left */
#agent-chat {
  position: fixed;
  top: 60px;
  right: 12px;
  bottom: 12px;
  z-index: 40;
  width: var(--claude-w, 420px);
  max-width: calc(100vw - 24px);
}

#agent-chat[hidden] {
  display: none;
}

/* A wide window makes room, so the page and Claude sit side by side, and a card's popup centres in what's left */
@media (min-width: 1100px) {
  :root.claude-open .layout {
    padding-right: calc(var(--claude-w, 420px) + 24px);
  }

  :root.claude-open dialog#dialog {
    right: calc(var(--claude-w, 420px) + 24px);
    width: min(680px, calc(100vw - var(--claude-w, 420px) - 56px));
  }
}

:root.claude-resizing,
:root.claude-resizing * {
  cursor: col-resize !important;
  user-select: none;
}

.chat-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  height: 100%;
  overflow: hidden;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-pop);
  animation: claude-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* A soft wash of the brand colours behind the top of the panel */
.chat-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 220px;
  background: radial-gradient(120% 90% at 85% -10%, rgb(123 92 255 / 13%), transparent 60%),
    radial-gradient(90% 70% at 0% -20%, rgb(25 182 201 / 11%), transparent 60%);
  pointer-events: none;
}

@keyframes claude-in {
  from { opacity: 0; transform: translateX(24px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.claude-resize {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  width: 8px;
  cursor: col-resize;
}

.claude-resize::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 2px;
  width: 3px;
  height: 36px;
  border-radius: 3px;
  background: var(--border);
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 0.15s ease, background 0.15s ease;
}

.claude-resize:hover::after,
.claude-resize:focus-visible::after,
:root.claude-resizing .claude-resize::after {
  opacity: 1;
  background: var(--accent);
}

.chat-head {
  position: relative;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 14px 12px 10px 16px;
}

.chat-head > .claude-mark {
  width: 22px;
  height: 22px;
}

.claude-title {
  display: flex;
  flex: 1;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.claude-title h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.claude-status {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 2px 8px 2px 7px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--sunken);
  border-radius: 999px;
}

.claude-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
}

.claude-status.on {
  color: var(--pass);
  background: color-mix(in srgb, var(--pass) 12%, transparent);
}

.claude-status.on::before {
  background: var(--pass);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pass) 22%, transparent);
}

.claude-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.claude-icon:hover:not(:disabled),
.claude-icon[aria-expanded="true"] {
  color: var(--text);
  background: var(--sunken);
}

.claude-icon:disabled {
  opacity: 0.4;
  cursor: default;
}

.claude-menu-wrap {
  position: relative;
}

.claude-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 3;
  display: grid;
  gap: 2px;
  width: 240px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  animation: claude-in 0.16s ease-out;
}

/* Chat history (TRK-502): + keeps the old chat, and this list opens it again */
.claude-history {
  left: 12px;
  right: 12px;
  width: auto;
  max-height: min(460px, 70vh);
  overflow-y: auto;
  padding: 8px;
}

.claude-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 6px 8px;
}

.claude-history-head .claude-menu-item {
  padding: 5px 8px;
  font-size: 12.5px;
}

.claude-history-head .claude-menu-item:disabled {
  opacity: 0.45;
  cursor: default;
}

.claude-history-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.claude-history-list li {
  display: flex;
  align-items: center;
  border-radius: 8px;
}

.claude-history-list li:hover,
.claude-history-list li.current {
  background: var(--sunken);
}

.claude-history-open {
  display: grid;
  flex: 1;
  gap: 1px;
  min-width: 0;
  padding: 8px 10px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 0;
}

.claude-history-open:hover {
  background: transparent;
}

.claude-history-open span,
.claude-recent-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.claude-history-open small,
.claude-recent-row small {
  color: var(--muted);
  font-size: 11.5px;
}

.claude-history-list li.current .claude-history-open span {
  font-weight: 600;
}

.claude-history-delete {
  width: 28px;
  height: 28px;
  margin-right: 4px;
  opacity: 0;
}

.claude-history-list li:hover .claude-history-delete,
.claude-history-delete:focus-visible {
  opacity: 1;
}

.claude-history-delete:hover:not(:disabled) {
  color: var(--danger);
}

@media (hover: none) {
  .claude-history-delete {
    opacity: 1;
  }
}

.claude-history-empty {
  margin: 0;
  padding: 12px 10px;
  color: var(--muted);
}

.claude-recent {
  width: 100%;
  margin-top: 20px;
  text-align: left;
}

.claude-recent-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.claude-recent-head .link {
  font-size: 12px;
}

.claude-recent-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.claude-recent-row .icon {
  color: var(--muted);
}

.claude-recent-row:hover {
  background: var(--sunken);
}

.claude-menu .chat-switch {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.claude-menu .chat-switch span {
  display: grid;
  gap: 1px;
}

.claude-menu .chat-switch small,
.claude-byline small {
  color: var(--muted);
  font-size: 11.5px;
}

.claude-menu-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.claude-menu-item:hover,
.claude-menu .chat-switch:hover {
  background: var(--sunken);
}

.chat-list {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 6px 16px 12px;
  overflow-y: auto;
  scrollbar-width: thin;
}

/* The empty chat: the mark, a greeting and questions that fit what's open */
.claude-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100%;
  box-sizing: border-box;
  justify-content: center;
  padding: 24px 4px;
  text-align: center;
}

.claude-hero h3 {
  margin: 16px 0 6px;
  font: 600 22px/1.25 "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--text), color-mix(in srgb, var(--text) 60%, #7b5cff));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.claude-hero > p {
  max-width: 300px;
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.5;
}

.claude-suggest {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  width: 100%;
}

.claude-suggestion {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-height: 64px;
  padding: 12px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.claude-suggestion .icon {
  flex: none;
  margin-top: 1px;
  color: var(--accent);
}

.claude-suggestion:hover {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: var(--claude-glow);
  transform: translateY(-1px);
}

/* Messages: the person's in a bubble on the right, Claude's in the open with its mark */
.chat-message {
  margin: 0 0 18px;
  animation: claude-msg 0.22s ease-out;
}

/* A redraw of the open panel (menus, new chat), or a message that only changed, doesn't replay the entrance (TRK-505, TRK-504) */
.chat-panel.settled,
.chat-message.settled {
  animation: none;
}

@keyframes claude-msg {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.chat-message.from-me {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-left: 40px;
}

.chat-message.from-me p {
  margin: 0;
  padding: 9px 13px;
  color: var(--selected-text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--selected);
  border-radius: 16px 16px 4px 16px;
}

.claude-about {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.claude-byline {
  display: flex;
  gap: 7px;
  align-items: center;
  margin-bottom: 6px;
  font-size: 13px;
}

.claude-reply .doc-body {
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.claude-reply .doc-body > :first-child {
  margin-top: 0;
}

.claude-reply .doc-body > :last-child {
  margin-bottom: 0;
}

.claude-reply pre {
  overflow-x: auto;
}

.claude-step {
  margin: 8px 0 0;
  font-size: 13px;
}

/* A line of text with light running through it while Claude works */
.claude-shimmer {
  color: transparent;
  background: linear-gradient(90deg, var(--muted) 0%, var(--muted) 35%, var(--text) 50%, var(--muted) 65%, var(--muted) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: claude-shine 1.8s linear infinite;
}

@keyframes claude-shine {
  from { background-position: 100% 0; }
  to { background-position: -150% 0; }
}

.chat-save {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 8px;
  opacity: 0.0;
  transition: opacity 0.15s ease;
}

.chat-message:hover .chat-save,
.chat-message:focus-within .chat-save,
.chat-message.from-agent:last-child .chat-save {
  opacity: 1;
}

@media (hover: none) {
  .chat-save {
    opacity: 1;
  }
}

.claude-act {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  background: transparent;
  border: 0;
  border-radius: 7px;
}

.claude-act:hover {
  color: var(--text);
  background: var(--sunken);
}

.claude-act.done {
  color: var(--pass);
}

/* The bottom: ways to start a question, then the box */
.claude-foot {
  padding: 8px 12px 12px;
  background: linear-gradient(to bottom, transparent, var(--surface) 18px);
}

.claude-starters {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.claude-starters button {
  flex: none;
  padding: 4px 11px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.claude-starters button:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.claude-input {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 10px 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.claude-input:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent), var(--shadow-card);
}

.claude-input textarea {
  width: 100%;
  min-height: 24px;
  max-height: 200px;
  padding: 2px 0;
  color: var(--text);
  font: inherit;
  line-height: 1.5;
  background: transparent;
  border: 0;
  outline: 0;
  box-shadow: none;
  resize: none;
}

.claude-input textarea:focus {
  outline: 0;
  box-shadow: none;
}

.claude-input textarea:disabled {
  cursor: not-allowed;
}

.claude-context {
  display: flex;
}

.claude-chip {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  max-width: 100%;
  padding: 3px 4px 3px 8px;
  font-size: 12px;
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.claude-chip-title {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.claude-chip-x {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  background: transparent;
  border: 0;
  border-radius: 5px;
}

.claude-chip-x:hover {
  color: var(--text);
  background: var(--border);
}

button.claude-chip.add {
  padding-right: 8px;
  color: var(--muted);
  border-style: dashed;
}

.claude-input-foot {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.claude-private {
  flex: 1;
  color: var(--muted);
  font-size: 11.5px;
}

/* TRK-498: files waiting to be sent, and the button that picks them */
.claude-attach {
  width: 28px;
  height: 28px;
  margin-left: -4px;
}

.claude-files {
  margin: 0;
}

.chat-message.from-me .attachments {
  justify-content: flex-end;
  margin: 0 0 4px;
}

.claude-send {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  background: var(--claude-grad);
  border: 0;
  border-radius: 50%;
  box-shadow: var(--claude-glow);
  transition: transform 0.15s ease, opacity 0.15s ease, filter 0.15s ease;
}

.claude-send:hover:not(:disabled) {
  transform: translateY(-1px);
}

.claude-input.empty .claude-send,
.claude-send:disabled {
  filter: grayscale(1);
  opacity: 0.35;
  box-shadow: none;
}

.claude-send:disabled {
  cursor: not-allowed;
}

/* Below a wide window the panel floats over the page; on a phone it fills the screen */
@media (max-width: 1099px) {
  .ask-claude kbd {
    display: none;
  }
}

@media (max-width: 760px) {
  .ask-claude {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .ask-claude-label {
    display: none;
  }

  #agent-chat {
    inset: 0;
    z-index: 60;
    width: auto;
    max-width: none;
  }

  .chat-panel {
    border: 0;
    border-radius: 0;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    animation-name: claude-up;
  }

  .claude-resize {
    display: none;
  }
}

@keyframes claude-up {
  from { opacity: 0; transform: translateY(32px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .chat-panel,
  .chat-message,
  .claude-menu,
  .claude-mark,
  .claude-shimmer {
    animation: none !important;
  }
}

.agent-wait {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.agent-wait-mark {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #d92d20;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  line-height: 18px;
  text-align: center;
}

/* What a card still needs before Done: a hint, not an alarm (TRK-298) */
.done-hint {
  padding: 8px 10px;
  background: var(--sunken);
  border-left: 3px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.test-warning {
  padding: 8px 10px;
  background: var(--sunken);
  border-left: 3px solid var(--danger);
  border-radius: 4px;
  overflow-wrap: anywhere;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: var(--sunken);
}

td .cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.overdue {
  color: var(--urgent);
  font-weight: 600;
}

.board {
  display: grid;
  grid-auto-flow: column;
  /* Narrow enough that the five default columns fit beside the side menu at 1280px (TRK-319) */
  grid-auto-columns: minmax(160px, 1fr);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

/* On a tablet the side menu takes room, so 160px columns made cards taller than wide; wider columns keep them about square and the board scrolls sideways (SITE-22) */
@media (min-width: 761px) and (max-width: 1099px) {
  .board {
    grid-auto-columns: minmax(200px, 1fr);
  }
}

.column {
  min-width: 0;
  min-height: 60vh;
  padding: 10px;
  background: var(--lane-bg);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  transition: border-color 0.15s, background-color 0.15s;
}

.column-rows {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.column-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.column-row input {
  flex: 1;
}

.column-row button:disabled {
  opacity: 0.4;
}

.column.drop,
.section-list.drop {
  border-color: var(--accent);
}

.column h2 {
  margin: 4px 6px 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

/* Column headers drag the column (TRK-219); the grip also takes the arrow keys */
.column {
  position: relative;
}

.column-head {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 0;
  cursor: grab;
  user-select: none;
}

.column-head:active {
  cursor: grabbing;
}

.column-grip {
  width: 22px;
  height: 22px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 6px;
  cursor: inherit;
  opacity: 0.35;
  transition: opacity 0.15s, background-color 0.15s;
}

.column-grip .icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
  stroke: none;
}

.column:hover .column-grip,
.column-grip:focus-visible {
  opacity: 1;
}

.column.column-dragging {
  opacity: 0.45;
}

.column-insert-before::before,
.column-insert-after::after {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 2px;
  background: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

.column-insert-before::before {
  left: -9px;
}

.column-insert-after::after {
  right: -9px;
}

.card {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  padding: 14px;
  text-align: left;
  background: var(--surface);
  border-color: var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}

/* Lift only under a mouse: on a phone a tapped card would stay raised (TRK-599) */
@media (hover: hover) and (pointer: fine) {
  .card:hover {
    background: var(--surface);
    border-color: var(--card-border-hover);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(var(--lift));
  }
}

.card:active {
  transform: scale(0.98);
  transition-duration: 0.1s;
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .card:hover,
  .card:active {
    transform: none;
  }
}

.column-empty {
  margin: 4px 0 0;
  padding: 10px 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.card.dragging,
.row.dragging {
  opacity: 0.4;
}

.card-title {
  display: block;
  margin-bottom: 12px;
  overflow-wrap: anywhere; /* a long word wraps inside the card (TRK-318) */
  font-weight: 500;
  line-height: 1.45;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.meta .assignee {
  margin-left: auto;
}

.priority-low {
  color: var(--low);
}

.priority-medium {
  color: var(--medium);
}

.priority-high {
  color: var(--high);
}

.priority-urgent {
  color: var(--urgent);
  font-weight: 600;
}

.section {
  margin-bottom: 20px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.section-head h2 {
  font-size: 13px;
  font-weight: 500;
}

.section-head .count {
  color: var(--muted);
  font-size: 12px;
}

.section-head .actions {
  margin-left: auto;
}

/* Past sprints under the Backlog (TRK-672): each sprint is a smaller heading inside the section */
.past-sprint {
  margin: 0 0 10px 18px;
}

.past-sprint .section-head h3 {
  font-size: 13px;
  font-weight: 500;
}

.past-sprint .section-list {
  min-height: 0;
}

.past-sprint .muted {
  padding: 8px 10px;
  font-size: 12px;
}

.section-list {
  min-height: 44px;
  padding: 4px;
  background: var(--sunken);
  border: 1px solid transparent;
  border-radius: 8px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 4px;
  padding: 8px 10px;
  text-align: left;
  background: var(--surface);
}

.row .row-title {
  flex: 1 1 200px;
}

.empty {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.empty-action p {
  margin: 0 0 12px;
}

.auth {
  max-width: 380px;
  margin: 12vh auto 0;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.auth {
  text-align: left;
}

.auth .brand {
  display: block;
  margin: 0 0 4px;
  font-size: 22px;
  text-align: center;
}

.auth h1 {
  font-size: 16px;
  text-align: center;
}

.form label.remember {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth button.primary {
  width: 100%;
}

.field-error {
  margin: -4px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.auth-error {
  margin: 0;
  color: var(--danger);
}

.auth-switch {
  margin: 4px 0 0;
  color: var(--muted);
  text-align: center;
}

dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 24px;
  background: var(--dialog);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-pop);
}

dialog::backdrop {
  background: rgb(10 14 22 / 45%);
  backdrop-filter: blur(3px);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--muted);
}

.form {
  display: grid;
  gap: 12px;
}

.form label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.form label > * {
  color: var(--text);
  font-size: 13px;
}

/* A form's dropdown fills its column like a text box, also when its list is theme-coloured (TRK-479) */
.form label > select {
  width: 100%;
}

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

/* A select is as wide as its longest option; each box fills its own cell and no more (TRK-480) */
.fields > label {
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
}

.fields > label > * {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.fields > label > select {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* A long name is cut with "…" before the arrow, which stays at the box's right edge with a gap (TRK-484) */
@supports (appearance: base-select) {
  .fields > label > select:not([data-measuring]) {
    display: flex;
    gap: 8px;
  }
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

dialog h3 {
  margin: 20px 0 8px;
  font-size: 13px;
}

.mention-list {
  /* placed at the caret by mentionList (TRK-233) */
  position: fixed;
  z-index: 1000;
  width: max-content;
  min-width: 220px;
  max-width: min(320px, calc(100vw - 16px));
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgb(0 0 0 / 18%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.mention-list[hidden] {
  display: none;
}

.mention-option {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 7px 10px;
  background: none;
  border: 0;
  border-radius: 0;
  color: var(--text);
  text-align: left;
}

.mention-option.active {
  background: var(--selected);
  color: var(--selected-text);
}

.mention-option small {
  color: inherit;
  opacity: 0.8;
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin-top: 6px;
  white-space: normal;
}

.attachments:empty {
  display: none;
}

.attachments img {
  display: block;
  max-width: 220px;
  max-height: 150px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.attachments a:has(img) {
  cursor: zoom-in;
}

dialog.image-popup {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.image-frame {
  display: flex;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: 48px;
  overflow: auto;
}

.image-frame img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  border-radius: 6px;
  cursor: zoom-in;
}

.image-popup.zoomed .image-frame img {
  max-width: none;
  max-height: none;
  height: auto;
  flex: none; /* a flex item would shrink back to the window's width */
  cursor: zoom-out;
}

/* Zoomed in, the image drags to move around it (TRK-466) */
.image-popup.zoomed .image-frame.panning,
.image-popup.zoomed .image-frame.panning img {
  cursor: grabbing;
  user-select: none;
}

/* The zoom buttons: −, the level, +, Fit (TRK-466) */
.image-zoom {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  color: #fff;
  background: rgb(0 0 0 / 78%);
  border-radius: 999px;
  transform: translateX(-50%);
}

.image-zoom button {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  font-size: 18px;
  line-height: 1;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.image-zoom .image-zoom-fit {
  font-size: 13px;
}

.image-zoom button:hover:not(:disabled) {
  background: rgb(255 255 255 / 18%);
}

.image-zoom button:disabled {
  opacity: 0.4;
  cursor: default;
}

.image-zoom-level {
  min-width: 46px;
  font-size: 13px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.image-close {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
  color: #fff;
  background: rgb(0 0 0 / 60%);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

/* The gallery's previous/next buttons and its "n of m" count (TRK-258) */
.image-step {
  position: fixed;
  top: 50%;
  z-index: 1;
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 30px;
  line-height: 1;
  color: #fff;
  background: rgb(0 0 0 / 60%);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transform: translateY(-50%);
}

.image-prev {
  left: 12px;
}

.image-next {
  right: 12px;
}

.image-step:disabled {
  opacity: 0.3;
  cursor: default;
}

.image-count {
  position: fixed;
  bottom: 12px;
  left: 50%;
  z-index: 1;
  padding: 4px 12px;
  color: #fff;
  font-size: 14px;
  background: rgb(0 0 0 / 60%);
  border-radius: 999px;
  transform: translateX(-50%);
}

/* Room for the side buttons, and a frame that lets a swipe through instead of scrolling sideways */
.image-popup.gallery .image-frame {
  padding: 48px 64px;
  touch-action: pan-y pinch-zoom;
}

.image-popup.gallery.zoomed .image-frame {
  touch-action: auto;
}

@media (max-width: 600px) {
  .image-popup.gallery .image-frame {
    padding: 56px 8px;
  }

  .image-step {
    top: auto;
    bottom: 8px;
    transform: none;
  }
}

.attach-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}

.comment {
  margin-bottom: 8px;
  padding: 8px 10px;
  background: var(--comment);
  border-radius: 6px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.activity {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
}

#tooltip {
  position: fixed;
  z-index: 5;
  display: none;
  padding: 4px 8px;
  background: var(--text);
  color: var(--bg);
  border-radius: 4px;
  font-size: 12px;
  pointer-events: none;
}

/* Top centre, clear of the chat bubble, and above dialogs (TRK-310) */
#toast {
  position: fixed;
  top: 68px;
  left: 50%;
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(520px, calc(100vw - 32px));
  transform: translateX(-50%);
  padding: 10px 14px;
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-pop);
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

#toast.show {
  opacity: 1;
  pointer-events: auto;
}

#toast.error {
  background: var(--danger);
  color: var(--surface);
  font-weight: 500;
}

#toast .toast-action {
  padding: 2px 8px;
  background: transparent;
  border: 1px solid currentColor;
  border-radius: 6px;
  color: inherit;
  font-weight: 600;
}

#toast .toast-close {
  padding: 0 4px;
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 18px;
  line-height: 1;
}

#mobile-nav {
  display: none;
}

@media (max-width: 760px) {
  .topbar {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 12px;
  }

  .search-box {
    flex: 1 1 100%;
    order: 5;
    max-width: none;
    margin-left: 0;
  }

  /* Create and the bell move to the bottom bar on a phone */
  #new-issue,
  #notifications,
  .current-user span:not(.avatar) {
    display: none;
  }

  .topbar .current-user {
    margin-left: auto;
    padding: 4px;
  }

  /* TRK-943: Help takes the space before the avatar on a phone */
  .topbar .help-wrap ~ .current-user {
    margin-left: 0;
  }

  .layout {
    display: block;
    /* The top bar is taller on a phone (it wraps the search box), so the page no longer scrolls 42px too far (TRK-322) */
    min-height: calc(100dvh - var(--topbar-h, 102px));
    padding: 0 8px calc(96px + env(safe-area-inset-bottom));
  }

  /* The menu opens as a floating drawer over the page instead of pushing it down. It fills the height
     between the top bar and the tab bar at the bottom, and scrolls inside when it's longer (TRK-281) */
  #sidebar {
    display: none;
    position: fixed;
    top: 64px;
    bottom: calc(86px + env(safe-area-inset-bottom));
    left: 8px;
    z-index: 20;
    width: min(320px, calc(100vw - 16px));
    height: auto;
    max-height: none;
    background: var(--surface);
    border: 1px solid var(--panel-border);
    box-shadow: var(--shadow-pop);
  }

  #sidebar.mobile-open {
    display: block;
  }

  main {
    padding: 18px 16px;
    border-radius: var(--radius-lg);
  }

  /* One column at a time, swiped sideways, with the next one peeking in */
  .board {
    grid-auto-columns: 84%;
    gap: 12px;
    margin: 0 -16px;
    padding: 0 16px 8px;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 16px;
  }

  .board .column {
    scroll-snap-align: start;
  }

  #mobile-nav {
    position: fixed;
    right: 10px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    left: 10px;
    z-index: 15;
    display: flex;
    align-items: center;
    padding: 6px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 22px;
    box-shadow: var(--shadow-pop);
  }

  #mobile-nav button {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-height: 52px;
    padding: 6px 0;
    background: transparent;
    border: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
  }

  #mobile-nav button svg.icon {
    width: 22px;
    height: 22px;
  }

  #mobile-nav button[aria-current="page"] {
    color: var(--selected-text);
  }

  #mobile-nav .mobile-create {
    flex: 0 0 52px;
    height: 52px;
    margin: 0 6px;
    background: var(--primary);
    border-radius: 16px;
    color: var(--primary-text);
    box-shadow: var(--primary-shadow);
    justify-content: center;
  }

  #mobile-nav .mobile-badge {
    position: absolute;
    top: 6px;
    margin-left: 14px;
    width: 8px;
    height: 8px;
    background: var(--urgent);
    border-radius: 50%;
  }

  #mobile-nav button:has(.mobile-badge) {
    position: relative;
  }

  /* Keep toasts above the bottom bar */
  #toast {
    top: calc(12px + env(safe-area-inset-top));
  }

  .tabs,
  .segments {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .segments button {
    white-space: nowrap;
  }

  .toolbar {
    gap: 8px;
  }

  .toolbar .end {
    margin-left: 0;
  }

  .docs-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px; /* a phone has no hide arrow, so the list and the page keep their old spacing */
  }

  .doc-tree {
    position: static;
    max-height: 240px;
    padding-right: 0;
    padding-bottom: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}

.token-command {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.token-command input {
  flex: 1;
  min-width: 0;
}

/* TRK-494: switches the connect command between Windows and Mac or Linux */
.agent-os {
  display: block;
  margin: -8px 0 16px;
}

.assigner {
  display: block;
  margin-bottom: 8px;
}
/* Settings > Your agents: which coding agent the listener starts (TRK-542) */
.agent-adapter { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-weight: 600; }
.agent-adapter select { font-weight: 400; }
/* TRK-738: the model under the agent's program */
.agent-model { margin-bottom: 12px; }
.agent-model .agent-adapter { margin-bottom: 6px; }
.agent-model-other { display: flex; gap: 8px; margin-bottom: 6px; max-width: 420px; }
.agent-model-other input { flex: 1; min-width: 0; font-family: var(--mono, ui-monospace, monospace); }
.agent-model-note { margin: 0 0 12px; }
.run-model, .at-work-model { font-size: 12px; overflow-wrap: anywhere; }
/* Your agents laid out as steps, with a connection state (TRK-579) */
.agent-steps { margin: 0 0 16px; padding-left: 22px; display: grid; gap: 12px; }
.agent-steps li { padding-left: 4px; }
.agent-steps li > span { display: block; margin-bottom: 6px; color: var(--muted, inherit); }
.agent-steps .token-command { margin-bottom: 6px; }
.agent-steps .agent-os { margin: 0; }
.agent-alt { border-top: 1px solid var(--border, rgb(127 127 127 / 0.2)); padding-top: 12px; margin-bottom: 16px; }
.agent-alt h3 { margin-top: 0; }
.agent-alt > summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
.agent-manual { margin-bottom: 16px; }
.agent-manual summary { cursor: pointer; color: var(--muted, inherit); margin-bottom: 6px; }
.agent-none { margin-bottom: 16px; }
/* Connected agents first, then Connect an agent, with space between (TRK-586) */
.agents-page .agents-connected { margin-bottom: 32px; }
.agents-connected .team-row { margin-bottom: 0; }
.agent-who { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 16px; }
.agent-who h3 { margin-top: 0; }
.agent-who .sub { margin-bottom: 0; }
/* The status light: green connected, yellow connecting, red not connected */
.agent-light { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #e5484d; box-shadow: 0 0 0 3px rgb(229 72 77 / 0.18); }
.agent-light-connected { background: #30a46c; box-shadow: 0 0 0 3px rgb(48 164 108 / 0.2); }
.agent-light-connecting { background: #f5b301; box-shadow: 0 0 0 3px rgb(245 179 1 / 0.22); animation: agent-light-pulse 1.4s ease-in-out infinite; }
@keyframes agent-light-pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .agent-light-connecting { animation: none; } }
/* TRK-1275: the agent's name and program above its connections; rename in place; old connections and why it can't start */
.agent-summary { display: grid; gap: 2px; padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.agent-summary small, .agent-problem { color: var(--muted); }
.agent-problem { color: #e5484d; }
.agent-name-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.agent-rename { font-size: 12px; }
.agent-rename-form { display: flex; gap: 6px; align-items: center; }
.agent-rename-form input { min-width: 220px; }
.agent-old { font-size: 11px; padding: 1px 6px; border-radius: 999px; background: var(--surface-2, rgb(127 127 127 / 0.12)); color: var(--muted); }
.agent-clear-old { margin-top: 12px; }
/* Agents connected by hand (TRK-541) */
.agent-snippet { margin: 4px 0 16px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2, rgb(127 127 127 / 0.1)); font-size: 12px; overflow-x: auto; white-space: pre; }


.notify-group {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 16px;
}

.notify-row {
  display: grid;
  grid-template-columns: 1fr 130px 100px;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
}

.notify-head {
  border-bottom: 1px solid var(--border);
}

.notify-cell {
  padding-left: 1px;
}

/* The column names, written once above the groups (TRK-477) */
.notify-columns {
  padding-top: 0;
  padding-bottom: 6px;
  color: var(--muted);
  font-size: 12.5px;
}

/* Toggle switch drawn on a real checkbox (TRK-342) */
.switch {
  appearance: none;
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  margin: 0;
  border: 1px solid var(--muted);
  border-radius: 10px;
  background: transparent;
  vertical-align: middle;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.switch::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s, background 0.15s;
}

.switch:checked {
  border-color: var(--primary);
  background: var(--primary);
}

.switch:checked::before {
  background: var(--primary-text);
  transform: translateX(14px);
}

.switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.assigner .switch {
  margin-right: 6px;
}

.agent-switch small {
  color: var(--muted);
}

/* On a phone, the columns narrow so the row text keeps its room */
@media (max-width: 600px) {
  .notify-row {
    grid-template-columns: minmax(0, 1fr) 64px 48px;
    padding: 10px 12px;
  }
}

.notify-indent {
  margin: 4px 0 0 24px;
}

/* TRK-41: no mailbox sends notification emails */
.panel p.sub.notify-warning {
  color: var(--danger);
}

.notify-mailbox {
  margin-bottom: 12px;
}

.fold-arrow,
.nav-heading .fold-arrow {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--muted);
}

.fold-arrow:hover {
  background: var(--sunken);
}

.fold-arrow .icon {
  width: 12px;
  height: 12px;
  transition: transform 0.1s;
}

.fold-arrow[aria-expanded="false"] .icon {
  transform: rotate(-90deg);
}

.fold-gap {
  flex: none;
  width: 18px;
}

.fold-title {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.tree-row,
.space-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.tree-row .nav-item {
  flex: 1;
  min-width: 0;
}

.space-row {
  margin: 4px 0 2px;
}

.space-name {
  flex: 1;
  min-width: 0;
  padding: 3px 4px;
  overflow: hidden;
  text-align: left;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: transparent;
  border-color: transparent;
  font-weight: 600;
}

.space-add {
  padding: 0 7px;
}

.space-name:hover {
  background: var(--sunken);
  border-color: transparent;
}

.space-edit {
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  opacity: 0;
}

.space-row:hover .space-edit,
.project-row:hover .project-edit,
.project-row:focus-within .project-edit,
.space-edit:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .space-edit { opacity: 1; }
}

.space-body {
  padding-left: 0;
}

.crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.crumb-move {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  min-width: 0;
}

/* A long space name mustn't widen the page (TRK-381) */
.crumb-move select {
  max-width: min(200px, 50vw);
  text-overflow: ellipsis;
}

.crumb {
  min-width: 0;
  overflow-wrap: anywhere;
}

.type-icon.epic {
  color: var(--epic, #8270db);
}

.epic-tag {
  max-width: 140px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--epic, #8270db);
  font-size: 12px;
}

.epic-progress {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.epic-bar {
  display: inline-block;
  width: 72px;
  height: 6px;
  overflow: hidden;
  background: var(--sunken);
  border-radius: 3px;
}

.epic-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

/* Team chat */
.channel-page {
  position: relative;
  display: flex;
  height: calc(100vh - 72px);
  margin: -28px -32px;
}

.channel-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

/* The Channels page title, like Mail and Docs have (TRK-293) */
.channel-page-title {
  padding: 16px 20px 4px;
}

.channel-head {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
}

.channel-title {
  flex: 1;
  min-width: 0;
}

/* Line icons in the channel header (TRK-331) */
.channel-head .nav-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin: 0;
  vertical-align: -2px;
}

.call-start button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.channel-title h1 {
  margin: 0;
  overflow: hidden;
  font-size: 17px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.channel-title p {
  margin: 0;
  overflow: hidden;
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.channel-head input[type="search"] {
  width: 180px;
}

.msg-list {
  flex: 1;
  min-height: 0;
  padding: 12px 0;
  overflow-y: auto;
}

.msg {
  position: relative;
  display: flex;
  gap: 10px;
  padding: 6px 20px;
}

.msg:hover {
  background: var(--sunken);
}

.msg.pinned {
  background: var(--selected);
}

.msg > .avatar {
  flex: none;
}

.msg-main {
  flex: 1;
  min-width: 0;
}

.msg-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}

.msg-head time,
.msg-head small {
  color: var(--muted);
  font-size: 12px;
}

.msg-body {
  overflow-wrap: anywhere;
}

.msg-body > :first-child {
  margin-top: 0;
}

.msg-body > :last-child {
  margin-bottom: 0;
}

/* An @name anywhere: comments, docs, chat, notes (blue, so it stands out from the text around it) */
.mention {
  padding: 0 3px;
  color: var(--mention, var(--accent));
  font-weight: 600;
  background: var(--selected);
  border-radius: 4px;
}

.reply-link {
  padding: 0;
  color: var(--accent);
  font: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

.reply-link {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
}

.msg-tools {
  position: absolute;
  top: -10px;
  right: 20px;
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.msg:hover .msg-tools,
.msg:focus-within .msg-tools {
  display: flex;
}

.msg-tools button {
  position: relative;
  padding: 3px 6px;
  background: none;
  border: 0;
}

/* The word under each icon shows at once, without waiting for the browser's slow title tooltip */
.msg-tools button[data-tip]:hover::after,
.msg-tools button[data-tip]:focus-visible::after,
.composer-bar button[data-tip]:hover::after,
.composer-bar button[data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 4;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 6px;
  color: var(--surface);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
  background: var(--text);
  border-radius: 4px;
}

.composer-bar button[data-tip] {
  position: relative;
}

/* The composer sits at the bottom, so its words show above the icon */
.composer-bar button[data-tip]:hover::after,
.composer-bar button[data-tip]:focus-visible::after {
  top: auto;
  bottom: calc(100% + 4px);
}

.emoji-menu {
  position: absolute;
  z-index: 3;
  top: 18px;
  right: 20px;
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.emoji-menu button {
  padding: 4px 6px;
  background: none;
  border: 0;
}

.msg-day,
.msg-new {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 10px 20px;
  color: var(--muted);
  font-size: 12px;
}

.msg-day::before,
.msg-day::after,
.msg-new::before,
.msg-new::after {
  flex: 1;
  height: 1px;
  background: var(--border);
  content: "";
}

.msg-new {
  color: var(--danger);
}

.msg-new::before,
.msg-new::after {
  background: var(--danger);
}

.reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.reaction {
  padding: 1px 7px;
  font-size: 13px;
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.reaction.mine {
  background: var(--selected);
  border-color: var(--accent);
}

.msg-files,
.panel-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.msg-image {
  padding: 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: zoom-in;
}

.msg-image img {
  display: block;
  max-width: min(360px, 100%);
  max-height: 240px;
  border-radius: 8px;
}

.msg-file {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.msg-file span {
  display: grid;
}

.msg-file small {
  color: var(--muted);
}

.msg-edit textarea,
.composer textarea {
  width: 100%;
  resize: vertical;
}

.composer {
  flex: none;
  margin: 0 20px 14px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.channel-panel .composer {
  margin: 8px 12px 12px;
}

.composer textarea {
  background: transparent;
  border: 0;
  outline: 0;
}

.composer-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.file-chip {
  padding: 2px 8px;
  font-size: 13px;
  background: var(--sunken);
  border-radius: 6px;
}

.file-chip button {
  margin-left: 4px;
  padding: 0 2px;
  background: none;
  border: 0;
}

.composer-bar {
  display: flex;
  gap: 2px;
  align-items: center;
  padding-right: 44px; /* clear of the floating chat button */
}

.composer-bar > button:not(.primary) {
  min-width: 28px;
  padding: 2px 6px;
  background: none;
  border: 0;
}

.composer-hint {
  flex: 1;
  margin-left: 8px;
  overflow: hidden;
  font-size: 12px;
  white-space: nowrap;
}

.channel-join {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-top: 1px solid var(--border);
}

.channel-panel {
  display: flex;
  flex: 0 0 var(--channel-panel-w, 340px);
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
}

.channel-panel[hidden] {
  display: none;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
}

.panel-head button {
  padding: 0 7px;
}

.thread-body,
.panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.channel-panel .msg {
  padding: 6px 14px;
}

.channel-panel .msg-tools {
  right: 8px;
}

.panel-body {
  padding: 4px 14px 14px;
}

.panel-note {
  padding: 14px;
}

.panel-section h3 {
  margin: 14px 0 6px;
  font-size: 13px;
}

.panel-field {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
}

.panel-field textarea,
.panel-field input {
  width: 100%;
}

.panel-people {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.panel-people span:not(.avatar) {
  display: flex;
  gap: 8px;
  align-items: center;
}

.panel-list {
  display: grid;
  gap: 6px;
  overflow-y: auto;
}

.panel-message {
  display: grid;
  gap: 2px;
  padding: 6px 8px;
  text-align: left;
  background: var(--sunken);
  border: 0;
  border-radius: 6px;
}

.panel-message small {
  color: var(--muted);
}

.panel-message span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.channel-panel > .panel-list {
  padding: 12px 14px;
}

.channel-row {
  width: 100%;
}

.channel-row.unread {
  font-weight: 700;
}

.channel-mark {
  flex: none;
  width: 18px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.channel-name {
  flex: 1;
  overflow: hidden;
  text-align: left;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.channel-badge {
  min-width: 18px;
  padding: 0 5px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  background: var(--danger);
  border-radius: 999px;
}

.nav-add {
  padding: 0 7px;
}

.browse-list {
  display: grid;
  gap: 4px;
  max-height: 50vh;
  overflow-y: auto;
}

.browse-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.browse-open {
  display: grid;
  flex: 1;
  min-width: 0;
  text-align: left;
  background: none;
  border: 0;
}

@media (max-width: 760px) {
  .channel-page {
    height: calc(100dvh - var(--topbar-h, 102px) - 96px);
    margin: -18px -16px;
  }

  .channel-head input[type="search"] {
    display: none;
  }

  /* The name and member count get their own line; Mute, Call, Video and Details wrap below it (TRK-322) */
  .channel-head {
    flex-wrap: wrap;
    padding: 10px 12px;
  }

  .channel-title {
    flex: 1 1 100%;
  }

  .channel-panel {
    position: fixed;
    z-index: 20;
    inset: 0;
  }

  .composer-hint {
    visibility: hidden;
  }
}

.load-earlier {
  display: block;
  margin: 4px auto 8px;
}

.emoji-menu button {
  white-space: nowrap;
}

/* Whiteboards */
:root {
  /* The card colours the user picked (TRK-471). Older names draw as the nearest one: purple is light purple,
     blue light blue, green light green and gray grey. Words on every one stay dark, at least 4.5:1. */
  --wb-red: #e88a8d;
  --wb-pink: #ea83ac;
  --wb-orange: #f49f66;
  --wb-yellow: #ffd675;
  --wb-forest: #75ae94;
  --wb-green: #c8e8c9;
  --wb-azure: #6ab3f2;
  --wb-blue: #c8dffb;
  --wb-violet: #9e8eeb;
  --wb-purple: #d1c6f1;
  --wb-gray: #b5b5b5;
  --wb-slate: #8a8d92;
  --wb-white: #ffffff;
  --wb-ink: #1c2230;
  --wb-dot: rgba(93, 102, 119, 0.35);
}

.wb-list-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.wb-cards {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
}

.wb-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  text-align: left;
  min-width: 0;
  overflow-wrap: anywhere; /* a long title with no spaces wraps instead of widening the page (TRK-386) */
}

.wb-card:hover {
  border-color: var(--accent);
}

/* The card's own delete button sits in its top-right corner (TRK-445) */
.wb-card-wrap {
  position: relative;
  display: grid;
  min-width: 0;
}

.wb-card-wrap .wb-card {
  padding-right: 44px;
}

.wb-card-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.wb-card-delete svg {
  width: 16px;
  height: 16px;
}

.wb-card-delete:hover,
.wb-card-delete:focus-visible {
  color: var(--danger);
  border-color: var(--border);
  background: var(--surface);
}

.wb-page {
  /* Fills the main panel: 60px top bar, 12px gap under the panel */
  height: calc(100vh - 72px);
  margin: -28px -32px;
  border-radius: inherit;
  overflow: hidden;
  position: relative;
}

.wb-stage {
  background-color: var(--sunken);
  background-image: radial-gradient(var(--wb-dot) 1px, transparent 1px);
  inset: 0;
  overflow: hidden;
  position: absolute;
}

.wb-canvas {
  cursor: default;
  display: block;
  height: 100%;
  touch-action: none;
  user-select: none;
  width: 100%;
}

.wb-canvas[data-tool="hand"] {
  cursor: grab;
}

.wb-canvas:not([data-tool="select"]):not([data-tool="hand"]) {
  cursor: crosshair;
}

/* The richer look (TRK-261). Each colour is set once as --wb-c; fills shade gently from a lit top to the
   full colour, edges are a deeper tone of the same colour, and items sit on a soft shadow. */
.wb-tone-red, .wb-fill.red, .wb-shade-top.red, .wb-shade-bottom.red, .wb-section.red, .wb-section-band.red { --wb-c: var(--wb-red); }
.wb-tone-pink, .wb-fill.pink, .wb-shade-top.pink, .wb-shade-bottom.pink, .wb-section.pink, .wb-section-band.pink { --wb-c: var(--wb-pink); }
.wb-tone-orange, .wb-fill.orange, .wb-shade-top.orange, .wb-shade-bottom.orange, .wb-section.orange, .wb-section-band.orange { --wb-c: var(--wb-orange); }
.wb-tone-yellow, .wb-fill.yellow, .wb-shade-top.yellow, .wb-shade-bottom.yellow, .wb-section.yellow, .wb-section-band.yellow { --wb-c: var(--wb-yellow); }
.wb-tone-forest, .wb-fill.forest, .wb-shade-top.forest, .wb-shade-bottom.forest, .wb-section.forest, .wb-section-band.forest { --wb-c: var(--wb-forest); }
.wb-tone-green, .wb-fill.green, .wb-shade-top.green, .wb-shade-bottom.green, .wb-section.green, .wb-section-band.green { --wb-c: var(--wb-green); }
.wb-tone-azure, .wb-fill.azure, .wb-shade-top.azure, .wb-shade-bottom.azure, .wb-section.azure, .wb-section-band.azure { --wb-c: var(--wb-azure); }
.wb-tone-blue, .wb-fill.blue, .wb-shade-top.blue, .wb-shade-bottom.blue, .wb-section.blue, .wb-section-band.blue { --wb-c: var(--wb-blue); }
.wb-tone-violet, .wb-fill.violet, .wb-shade-top.violet, .wb-shade-bottom.violet, .wb-section.violet, .wb-section-band.violet { --wb-c: var(--wb-violet); }
.wb-tone-purple, .wb-fill.purple, .wb-shade-top.purple, .wb-shade-bottom.purple, .wb-section.purple, .wb-section-band.purple { --wb-c: var(--wb-purple); }
.wb-tone-gray, .wb-fill.gray, .wb-shade-top.gray, .wb-shade-bottom.gray, .wb-section.gray, .wb-section-band.gray { --wb-c: var(--wb-gray); }
.wb-tone-slate, .wb-fill.slate, .wb-shade-top.slate, .wb-shade-bottom.slate, .wb-section.slate, .wb-section-band.slate { --wb-c: var(--wb-slate); }
.wb-tone-white, .wb-fill.white, .wb-shade-top.white, .wb-shade-bottom.white, .wb-section.white, .wb-section-band.white { --wb-c: var(--wb-white); }

.wb-fill {
  --wb-c: var(--wb-white);
  fill: url(#wb-shade-white);
  filter: url(#wb-shadow);
  stroke: color-mix(in srgb, var(--wb-c) 62%, #1c2230);
  stroke-width: 1.25;
}

.wb-fill.red { fill: url(#wb-shade-red); }
.wb-fill.pink { fill: url(#wb-shade-pink); }
.wb-fill.orange { fill: url(#wb-shade-orange); }
.wb-fill.yellow { fill: url(#wb-shade-yellow); }
.wb-fill.forest { fill: url(#wb-shade-forest); }
.wb-fill.green { fill: url(#wb-shade-green); }
.wb-fill.azure { fill: url(#wb-shade-azure); }
.wb-fill.blue { fill: url(#wb-shade-blue); }
.wb-fill.violet { fill: url(#wb-shade-violet); }
.wb-fill.purple { fill: url(#wb-shade-purple); }
.wb-fill.gray { fill: url(#wb-shade-gray); }
.wb-fill.slate { fill: url(#wb-shade-slate); }

.wb-shade-top { stop-color: color-mix(in srgb, var(--wb-c) 80%, #ffffff); }
.wb-shade-bottom { stop-color: color-mix(in srgb, var(--wb-c) 94%, #1c2230); }

/* Shadows cost the most when there are hundreds of items on screen, and can't be seen from far out */
.wb-world.far .wb-fill,
.wb-world.far .wb-file {
  filter: none;
}

.wb-hit {
  fill: transparent;
}

/* A cylinder's lid catches the light, so the top reads clearly as the top of a drum (TRK-260, TRK-261) */
.wb-fill .wb-lid {
  fill: color-mix(in srgb, var(--wb-c) 35%, #ffffff);
}

.wb-pick-shape svg {
  fill: none;
  height: 20px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
  width: 20px;
}

.wb-pick-shape svg .f {
  fill: currentColor;
  fill-opacity: 0.14;
}

.wb-words {
  pointer-events: none;
}

.wb-text {
  align-items: center;
  color: var(--wb-ink);
  display: flex;
  height: 100%;
  justify-content: center;
  line-height: 1.25;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-align: center;
  white-space: pre-wrap;
}

.wb-text.text {
  color: var(--text);
  justify-content: flex-start;
  text-align: left;
}

.wb-arrow {
  fill: none;
  stroke: color-mix(in srgb, var(--text) 82%, transparent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.wb-arrow-preview {
  pointer-events: none;
}

.wb-head {
  fill: color-mix(in srgb, var(--text) 82%, transparent);
  stroke-linejoin: round;
}

/* Shape fills are always light, so the outline stays dark in both themes. It's wide because half of it falls outside the shape. */
.wb-fill.wb-dashed {
  stroke: rgba(28, 34, 48, 0.7);
  stroke-width: 4;
}

.wb-tools button[hidden] {
  display: none;
}

.wb-file {
  fill: var(--surface);
  filter: url(#wb-shadow);
  rx: 6px;
  stroke: var(--border);
}

.wb-file-name {
  align-items: center;
  box-sizing: border-box;
  color: var(--text);
  display: flex;
  font-size: 14px;
  height: 100%;
  overflow: hidden;
  padding: 0 12px;
  white-space: nowrap;
}

.wb-ticket {
  box-sizing: border-box;
  color: var(--text);
  display: grid;
  font-size: 14px;
  gap: 4px;
  height: 100%;
  overflow: hidden;
  padding: 10px 12px;
}

.wb-ticket-top {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.wb-ticket-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wb-ticket small {
  color: var(--muted);
}

.wb-ticket-results {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  max-height: 320px;
  overflow: auto;
}

.wb-ticket-results button {
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wb-vote {
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 50%;
  font-size: 13px;
  height: 28px;
  left: -14px;
  min-width: 28px;
  padding: 0;
  pointer-events: auto;
  position: absolute;
  top: -14px;
}

.wb-vote.on {
  background: var(--primary);
  color: var(--primary-text);
}

.wb-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  margin-right: 4px;
  white-space: nowrap;
}

.wb-timer[hidden] {
  display: none;
}

.wb-round {
  align-content: flex-start;
  bottom: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wb-round h2,
.wb-round p {
  margin: 0;
  width: 100%;
}

.wb-suggestion {
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
  width: 100%;
}

.wb-suggestion p {
  white-space: pre-wrap;
}

.wb-embed {
  align-items: center;
  display: flex;
  gap: 12px;
  margin: 8px 0;
  max-width: 420px;
  padding: 8px;
  text-align: left;
  width: 100%;
}

.wb-embed span {
  display: grid;
  gap: 2px;
}

.wb-embed-picture {
  background: var(--bg);
  border-radius: 4px;
  flex: none;
  height: 72px;
  width: 120px;
}

.wb-embed-item {
  fill: var(--accent);
  opacity: 0.6;
}

.wb-embed-item.section {
  opacity: 0.2;
}

.wb-present {
  align-items: center;
  display: flex;
  gap: 8px;
  left: 50%;
  max-width: calc(100% - 32px);
  padding: 6px 10px;
  top: 88px;
  transform: translateX(-50%);
  z-index: 3;
}

.workflow-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.workflow-form [hidden] {
  display: none;
}

.link-row {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.link-row > .link {
  flex: 1;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-row > input {
  flex: 1;
}

/* The link box with its suggestions and its inline problem (TRK-340) */
.link-row:has(> .link-key) {
  align-items: flex-start;
}

.link-key {
  position: relative;
  display: grid;
  flex: 1;
  gap: 4px;
  min-width: 0;
}

.link-suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 5;
  width: 100%;
  max-height: 240px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 18%);
}

.link-suggest[hidden] {
  display: none;
}

/* The key never wraps; a long title is cut short instead */
.link-suggest .mention-option > :first-child {
  flex: none;
  white-space: nowrap;
}

.link-suggest .mention-option small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-problem {
  color: var(--danger);
  font-size: 12px;
}

.link-problem:empty {
  display: none;
}

.link-key input[aria-invalid="true"] {
  border-color: var(--danger);
}

.wb-session {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  left: 16px;
  max-width: calc(100% - 32px);
  padding: 6px 10px;
  top: 148px;
  z-index: 3;
}

.wb-session[hidden] {
  display: none;
}

.wb-present span {
  white-space: nowrap;
}

.wb-present textarea {
  min-height: 0;
  min-width: 160px;
  width: 280px;
}

.wb-pins {
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
}

.wb-pin {
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 14px 14px 14px 2px;
  font-size: 12px;
  left: 0;
  min-width: 0;
  padding: 3px 7px;
  pointer-events: auto;
  position: absolute;
  top: -26px;
}

.wb-thread,
.wb-comment-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  max-height: 60%;
  overflow: auto;
  padding: 10px;
  position: absolute;
  width: 280px;
  z-index: 3;
}

.wb-comment-list {
  bottom: 60px;
  right: 12px;
  top: 76px;
}

.wb-comment-list h2 {
  font-size: 15px;
  margin: 0 0 8px;
}

.wb-thread-tools,
.wb-thread-send {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: space-between;
}

.wb-thread-list {
  display: grid;
  gap: 8px;
  margin: 8px 0;
}

.wb-comment {
  align-items: start;
  display: grid;
  gap: 8px;
  grid-template-columns: auto 1fr auto;
}

.wb-comment p {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.wb-comment button {
  min-width: 0;
  padding: 0 6px;
}

.wb-thread-input {
  margin-bottom: 6px;
  position: relative;
}

.wb-thread-input textarea {
  box-sizing: border-box;
  min-height: 0;
  width: 100%;
}

.wb-comment-row {
  display: grid;
  gap: 2px;
  margin-bottom: 4px;
  text-align: left;
  width: 100%;
}

.wb-comment-row small {
  color: var(--muted);
}

.wb-guide {
  stroke: var(--accent);
  stroke-dasharray: 4 4;
}

.wb-map {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  height: 120px;
  position: absolute;
  right: 12px;
  top: 76px;
  touch-action: none;
  width: 180px;
}

.wb-map[hidden] {
  display: none;
}

.wb-keys {
  display: grid;
  gap: 6px 16px;
  grid-template-columns: auto 1fr;
  margin: 0 0 12px;
}

.wb-keys dt {
  font-weight: 600;
}

.wb-keys dd {
  color: var(--muted);
  margin: 0;
}

.wb-section {
  fill: var(--wb-c);
  fill-opacity: 0.1;
  stroke: var(--wb-c);
  stroke-opacity: 0.75;
  stroke-width: 1.5;
}

.wb-section.white { --wb-c: var(--muted); }

/* The title sits in a band of the section's own colour, so groups read at a glance (TRK-261) */
.wb-section-band {
  fill: var(--wb-c);
  fill-opacity: 0.32;
}

.wb-section-band.white { --wb-c: var(--muted); fill-opacity: 0.22; }

.wb-section-label {
  pointer-events: none;
}

.wb-section-title {
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 32px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wb-section-title.empty {
  color: var(--muted);
  font-weight: 400;
}

.wb-ink {
  fill: none;
  stroke: var(--text);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wb-ink.yellow { stroke: #e2b100; }
.wb-ink.orange { stroke: #e8730c; }
.wb-ink.pink { stroke: #d6409f; }
.wb-ink.purple { stroke: #a35cd6; }
.wb-ink.blue { stroke: #2a78d6; }
.wb-ink.green { stroke: #1baf7a; }
.wb-ink.gray { stroke: #8a93a3; }
.wb-ink.red { stroke: #d9483b; }
.wb-ink.forest { stroke: #2f8a62; }
.wb-ink.azure { stroke: #2a78d6; }
.wb-ink.violet { stroke: #7b4fe0; }
.wb-ink.slate { stroke: #5d6879; }
.wb-ink.glow { opacity: 0.4; }

.wb-arrow-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
}

/* Labels sit on a rounded tag of the page colour, so they stay readable where they cross lines and sections */
.wb-arrow-label {
  fill: var(--text);
  font-size: 14px;
  font-weight: 500;
  paint-order: stroke;
  stroke: var(--surface);
  stroke-linejoin: round;
  stroke-width: 10px;
}

.wb-overlay .wb-picked {
  fill: none;
  pointer-events: none;
  stroke: var(--accent);
}

.wb-handle {
  cursor: nwse-resize;
  fill: var(--surface);
  stroke: var(--accent);
}

.wb-grow {
  cursor: pointer;
  fill: var(--accent);
  opacity: 0.85;
}

.wb-grow:hover {
  opacity: 1;
}

.wb-grow-plus {
  pointer-events: none;
  stroke: var(--surface);
}

.wb-marquee {
  fill: color-mix(in srgb, var(--accent) 12%, transparent);
  pointer-events: none;
  stroke: var(--accent);
}

.wb-top,
.wb-tools,
.wb-history,
.wb-zoom,
.wb-find,
.wb-bar {
  background: var(--surface);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  position: absolute;
}

.wb-top {
  align-items: center;
  display: flex;
  gap: 8px;
  left: 12px;
  padding: 6px 8px;
  right: 12px;
  top: 12px;
  overflow-x: auto;
}

.wb-top > * {
  flex-shrink: 0;
}

.wb-back {
  border: 0;
  background: none;
}

.wb-title {
  background: none;
  border: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: min(320px, 40vw);
}

.wb-gap {
  flex: 1;
}

.wb-role {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.wb-who {
  display: flex;
  gap: 2px;
}

.wb-tools {
  display: flex;
  flex-direction: column;
  gap: 2px;
  left: 12px;
  padding: 6px;
  top: 76px;
  border-radius: var(--radius-lg);
  /* One column running down to just above undo and redo; tools that still don't fit scroll into view (TRK-262, TRK-272) */
  max-height: calc(100% - 76px - 64px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y proximity;
  scrollbar-width: none;
}

.wb-tools::-webkit-scrollbar {
  display: none;
}

/* A soft shade on each edge that has more tools past it. The surface-coloured covers scroll with the tools
   and hide the shade once the list reaches that end. */
.wb-tools {
  background:
    linear-gradient(var(--surface) 40%, transparent) center top / 100% 30px no-repeat local,
    linear-gradient(transparent, var(--surface) 60%) center bottom / 100% 30px no-repeat local,
    radial-gradient(farthest-side at 50% 0, rgba(15, 23, 41, 0.22), transparent) center top / 100% 12px no-repeat scroll,
    radial-gradient(farthest-side at 50% 100%, rgba(15, 23, 41, 0.22), transparent) center bottom / 100% 12px no-repeat scroll,
    var(--surface);
}

.wb-tools button {
  position: relative;
  flex: none;
  scroll-snap-align: start;
  align-items: center;
  background: none;
  border: 0;
  border-radius: var(--radius);
  color: color-mix(in srgb, var(--text) 82%, var(--muted));
  display: flex;
  height: 38px;
  justify-content: center;
  padding: 0;
  width: 38px;
}

.wb-tools button:hover {
  background: var(--sunken);
  color: var(--text);
}

.wb-tools button[aria-pressed="true"] {
  background: var(--primary);
  color: var(--primary-text);
  box-shadow: var(--primary-shadow);
}

.wb-tools svg {
  fill: none;
  height: 20px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
  width: 20px;
}

.wb-tools svg .f {
  fill: currentColor;
  fill-opacity: 0.14;
}

.wb-tools svg {
  height: 22px;
  stroke-width: 1.6;
  width: 22px;
}

/* Tool icons (TRK-272): spots of colour on the line drawings. Solid spots have no outline of their own. */
.wb-ico .k { fill: currentColor; }
.wb-ico .y, .wb-ico .yd, .wb-ico .o, .wb-ico .g, .wb-ico .b, .wb-ico .v, .wb-ico .p, .wb-ico .r { stroke: none; }
.wb-ico .y { fill: #f7c548; }
.wb-ico .yd { fill: #dc9c18; }
.wb-ico .o { fill: #f3873a; }
.wb-ico .g { fill: #1fb07b; }
.wb-ico .b { fill: #4b8bff; }
.wb-ico .v { fill: #8a6cf7; }
.wb-ico .p { fill: #f472b6; }
.wb-ico .r { fill: #ef4444; }
.wb-ico .tb { fill: #4b8bff; fill-opacity: 0.3; }
.wb-ico .tg { fill: #1fb07b; fill-opacity: 0.3; }
.wb-ico .tg2 { fill: #1fb07b; fill-opacity: 0.55; }
.wb-ico .to { fill: #f3873a; fill-opacity: 0.32; }
.wb-ico .tv { fill: #8a6cf7; fill-opacity: 0.3; }
.wb-ico .tp { fill: #f472b6; fill-opacity: 0.32; }
.wb-ico .sb { stroke: #4b8bff; }
.wb-ico .sy { stroke: #f7c548; }
.wb-ico .so { stroke: #f3873a; }
.wb-ico .sr { stroke: #ef4444; }

/* On the chosen tool's coloured background, tints and lines in the tool's colour turn white so they still show */
.wb-tools button[aria-pressed="true"] .wb-ico :is(.tb, .tg, .tg2, .to, .tv, .tp) { fill: #ffffff; fill-opacity: 0.32; }
.wb-tools button[aria-pressed="true"] .wb-ico .sb { stroke: #ffffff; }

/* Arrows that tuck the top bar, the tool rail and the map away (TRK-272) */
.wb-fold {
  position: absolute;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-pop);
  color: var(--muted);
}

.wb-fold:hover {
  color: var(--text);
}

.wb-fold svg {
  fill: none;
  height: 14px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
  transition: transform 0.15s ease;
  width: 14px;
}

.wb-fold-top {
  border-radius: 0 0 8px 8px;
  border-top: 0;
  height: 16px;
  left: 50%;
  top: 57px;
  transform: translateX(-50%);
  width: 48px;
}

.wb-fold-top svg { transform: rotate(180deg); }
.wb-folded-top .wb-fold-top { top: 0; }
.wb-folded-top .wb-fold-top svg { transform: none; }
.wb-folded-top .wb-top { display: none; }

.wb-fold-tools,
.wb-fold-map {
  height: 44px;
  top: 88px;
  width: 16px;
}

.wb-fold-tools {
  border-left: 0;
  border-radius: 0 8px 8px 0;
  left: 63px;
}

.wb-fold-tools svg { transform: rotate(90deg); }
.wb-folded-tools .wb-tools { display: none; }
.wb-folded-tools .wb-fold-tools { left: 0; }
.wb-folded-tools .wb-fold-tools svg { transform: rotate(-90deg); }
.wb-tools[hidden] + .wb-fold-tools { display: none; }

.wb-fold-map {
  border-right: 0;
  border-radius: 8px 0 0 8px;
  right: 193px;
}

.wb-fold-map svg { transform: rotate(-90deg); }
.wb-folded-map .wb-fold-map { right: 0; }
.wb-folded-map .wb-fold-map svg { transform: rotate(90deg); }

/* With the top bar away, the rail and the map move up into its place */
.wb-folded-top .wb-tools,
.wb-folded-top .wb-map { top: 12px; }
.wb-folded-top .wb-tools { max-height: calc(100% - 12px - 64px); }
.wb-folded-top .wb-fold-tools,
.wb-folded-top .wb-fold-map { top: 24px; }

.wb-tools button[aria-pressed="true"] svg .f {
  fill-opacity: 0.28;
}

.wb-sep {
  flex: none;
  width: 22px;
  height: 1px;
  margin: 4px auto;
  background: var(--border);
}

/* Tooltip with the tool's name and its key. It sits outside the toolbar, which scrolls and would cut it off (TRK-262) */
.wb-tool-tip {
  position: absolute;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transform: translateY(-50%);
  pointer-events: none;
}

.wb-tool-tip[hidden] {
  display: none;
}

.wb-tool-tip kbd {
  font: inherit;
  opacity: 0.7;
}

.wb-history,
.wb-zoom {
  bottom: 12px;
  display: flex;
  gap: 2px;
  padding: 4px;
}

.wb-history {
  left: 12px;
}

.wb-zoom {
  right: 76px; /* leaves room for the chat icon */
}

.wb-history button,
.wb-zoom button {
  background: none;
  border: 0;
  color: var(--text);
  min-width: 32px;
  padding: 4px 8px;
}

.wb-history button:disabled {
  opacity: 0.4;
}

.wb-bar {
  align-items: center;
  z-index: 2;
  display: flex;
  gap: 4px;
  padding: 6px;
  white-space: nowrap;
}

.wb-bar[hidden],
.wb-tools[hidden],
.wb-history[hidden] {
  display: none;
}

.wb-swatch {
  border: 1px solid rgba(28, 34, 48, 0.3);
  border-radius: 50%;
  height: 22px;
  min-width: 0;
  padding: 0;
  width: 22px;
}

.wb-swatch.on {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.wb-swatch.red { background: var(--wb-red); }
.wb-swatch.pink { background: var(--wb-pink); }
.wb-swatch.orange { background: var(--wb-orange); }
.wb-swatch.yellow { background: var(--wb-yellow); }
.wb-swatch.forest { background: var(--wb-forest); }
.wb-swatch.green { background: var(--wb-green); }
.wb-swatch.azure { background: var(--wb-azure); }
.wb-swatch.blue { background: var(--wb-blue); }
.wb-swatch.violet { background: var(--wb-violet); }
.wb-swatch.purple { background: var(--wb-purple); }
.wb-swatch.gray { background: var(--wb-gray); }
.wb-swatch.slate { background: var(--wb-slate); }
.wb-swatch.white { background: var(--wb-white); }
.wb-swatch.ink.yellow { background: #e2b100; }
.wb-swatch.ink.orange { background: #e8730c; }
.wb-swatch.ink.pink { background: #d6409f; }
.wb-swatch.ink.purple { background: #a35cd6; }
.wb-swatch.ink.blue { background: #2a78d6; }
.wb-swatch.ink.green { background: #1baf7a; }
.wb-swatch.ink.gray { background: #8a93a3; }
.wb-swatch.ink.white { background: var(--text); }

.wb-emoji {
  font-size: 16px;
  height: 28px;
  line-height: 1;
  min-width: 0;
  padding: 0;
  width: 28px;
}

.wb-emoji[aria-pressed="true"] {
  outline: 2px solid var(--accent);
}

.wb-by {
  color: var(--muted);
  font-size: 12px;
  padding: 0 4px;
}

.wb-stamp {
  align-items: center;
  display: flex;
  height: 100%;
  justify-content: center;
  line-height: 1;
}

.wb-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.wb-reactions .wb-chip[aria-pressed="true"] {
  border-color: var(--accent);
  outline: 1px solid var(--accent);
}

.wb-pen {
  left: 64px;
  top: 76px;
}

.wb-width {
  align-items: center;
  display: inline-flex;
  height: 26px;
  justify-content: center;
  min-width: 0;
  padding: 0;
  width: 26px;
}

.wb-width[aria-pressed="true"] {
  outline: 2px solid var(--accent);
}

.wb-width span {
  background: var(--text);
  border-radius: 50%;
}

.danger-text {
  color: var(--danger);
}

.wb-edit {
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid var(--accent);
  border-radius: 3px;
  color: var(--wb-ink);
  line-height: 1.25;
  outline: none;
  padding: 8px;
  position: absolute;
  resize: none;
  text-align: center;
}

.wb-edit.text,
.wb-edit.section {
  text-align: left;
}

/* Only the editor shows the words while they're written, not a faded copy behind it (TRK-478) */
.wb-editing .wb-text,
.wb-editing .wb-section-title,
.wb-editing .wb-arrow-label {
  visibility: hidden;
}

.wb-edit.section {
  min-height: 0;
}

.wb-cursors {
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
}

.wb-cursor {
  left: 0;
  position: absolute;
  top: 0;
  transition: transform 0.45s linear;
}

.wb-cursor::before {
  border-left: 12px solid var(--who);
  border-bottom: 6px solid transparent;
  border-top: 6px solid transparent;
  content: "";
  display: block;
  height: 0;
  transform: rotate(45deg);
  width: 0;
}

.wb-agent-cursor {
  transition: transform 0.45s ease-in-out, opacity 0.4s ease-out;
}

.wb-cursor.wb-agent-cursor span {
  color: var(--surface);
}

.wb-agent-cursor span::before {
  content: "✦ ";
}

.wb-agent-cursor.fading {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .wb-agent-cursor {
    transition: opacity 0.4s ease-out;
  }
}

.wb-cursor span {
  background: var(--who);
  border-radius: 4px;
  color: #ffffff;
  font-size: 12px;
  left: 12px;
  padding: 2px 6px;
  position: absolute;
  top: 12px;
  white-space: nowrap;
}

.wb-person {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 8px;
}

@media (max-width: 760px) {
  .wb-page {
    /* Ends above the bottom bar (the layout keeps 96px for it) */
    height: calc(100dvh - var(--topbar-h, 102px) - 96px);
    margin: -18px -16px;
  }

  .wb-tools {
    bottom: 60px;
    flex-direction: row;
    left: 12px;
    overflow-x: auto;
    right: 12px;
    top: auto;
    scrollbar-width: none;
    max-height: none;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
  }

  .wb-tools {
    background:
      linear-gradient(to right, var(--surface) 40%, transparent) left center / 30px 100% no-repeat local,
      linear-gradient(to right, transparent, var(--surface) 60%) right center / 30px 100% no-repeat local,
      radial-gradient(farthest-side at 0 50%, rgba(15, 23, 41, 0.22), transparent) left center / 12px 100% no-repeat scroll,
      radial-gradient(farthest-side at 100% 50%, rgba(15, 23, 41, 0.22), transparent) right center / 12px 100% no-repeat scroll,
      var(--surface);
  }

  .wb-tools button {
    flex: none;
  }

  .wb-sep {
    width: 1px;
    height: 22px;
    margin: auto 4px;
  }

  /* No hover on touch, and a tooltip would sit off screen */
  .wb-tool-tip {
    display: none;
  }

  .wb-map {
    height: 80px;
    width: 120px;
  }

  /* On a phone the tools are a row along the bottom, so their arrow sits on top of the row */
  .wb-fold-tools {
    border-left: 1px solid var(--panel-border);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    bottom: 111px;
    height: 16px;
    left: 50%;
    top: auto;
    transform: translateX(-50%);
    width: 48px;
  }

  .wb-fold-tools svg { transform: none; }
  .wb-folded-tools .wb-fold-tools { bottom: 60px; left: 50%; }
  .wb-folded-tools .wb-fold-tools svg { transform: rotate(180deg); }
  .wb-folded-top .wb-fold-tools { top: auto; }
  .wb-fold-map { right: 133px; }

  .wb-top {
    scrollbar-width: none;
  }

  /* Undo and redo move up under the title bar; the zoom bar needs the bottom row */
  .wb-history {
    bottom: auto;
    top: 64px;
  }

  .wb-pen {
    bottom: 116px;
    left: 12px;
    overflow-x: auto;
    right: 12px;
    top: auto;
  }
}

.wb-chip {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(28, 34, 48, 0.3);
  border-radius: 4px;
  color: var(--wb-ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  min-width: 0;
  padding: 1px 6px;
  pointer-events: auto;
}

.wb-ticket-list {
  color: var(--muted);
  margin: 0 0 12px;
  max-height: 200px;
  overflow: auto;
  padding-left: 20px;
}

.wb-history-dialog {
  width: min(640px, calc(100vw - 48px));
}

.wb-history-body {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
}

.wb-versions {
  display: grid;
  align-content: start;
  gap: 4px;
  max-height: 320px;
  overflow-y: auto;
}

.wb-version {
  display: grid;
  gap: 2px;
  text-align: left;
}

.wb-version.active {
  border-color: var(--accent);
  outline: 1px solid var(--accent);
}

.wb-version small {
  color: var(--muted);
}

.wb-version-picture {
  background: var(--bg);
  border-radius: 6px;
  height: 200px;
  width: 100%;
}

@media (max-width: 600px) {
  .wb-history-body {
    grid-template-columns: 1fr;
  }
}

.wb-bar button[aria-pressed="true"] {
  background: var(--primary);
  color: var(--primary-text);
}

.wb-laser {
  pointer-events: none;
}

.wb-laser-line {
  stroke: #ff3b30;
  stroke-linecap: round;
}

.wb-laser-dot {
  fill: #ff3b30;
}

.wb-canvas[data-tool="laser"] {
  cursor: crosshair;
}

.wb-find {
  align-items: center;
  display: flex;
  gap: 4px;
  left: 50%;
  padding: 4px;
  top: 64px;
  transform: translateX(-50%);
  z-index: 3;
}

.wb-find input {
  width: min(220px, 40vw);
}

.wb-find button {
  background: none;
  border: 0;
  color: var(--text);
  min-width: 28px;
  padding: 4px 6px;
}

.wb-find-count {
  color: var(--muted);
  font-size: 12px;
  min-width: 64px;
  text-align: center;
  white-space: nowrap;
}

.wb-template-manage {
  display: flex;
  gap: 8px;
  margin-top: -4px;
}

/* Hand-drawn shapes keep their fill, and the sketchy line on top is the only edge */
.wb-fill.wb-sketch-fill {
  stroke: none;
}

.wb-sketch {
  fill: none;
  stroke: rgba(28, 34, 48, 0.8);
  stroke-width: 2;
  stroke-linecap: round;
}

/* Boxed like the fields beside it, though it can't be typed in (TRK-467) */
.ai-tokens {
  display: block;
  min-width: 0;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-variant-numeric: tabular-nums;
  cursor: default;
}

/* CRM (TRK-165) */
.crm-head h1 {
  margin: 0 0 12px;
}

/* Title on the left, CRM switcher and Manage CRMs on the right (TRK-517) */
.crm-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.crm-head-actions { display: flex; align-items: center; gap: 8px; }
.crm-head-actions:empty { display: none; }
.crm-head-actions .ghost { display: inline-flex; align-items: center; gap: 6px; }
.crm-head-actions .ghost svg { width: 16px; height: 16px; }

.crm-back {
  margin-bottom: 8px;
}

.crm-record-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.crm-record-head .end {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.crm-details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 20px;
  max-width: 640px;
  margin: 0 0 24px;
}

.crm-details dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 22px;
}

.crm-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.crm-section {
  margin-top: 8px;
}

.crm-search input {
  flex: 1;
  min-width: 200px;
  max-width: 420px;
}

.crm-link {
  white-space: nowrap;
}

.crm-actions {
  display: flex;
  gap: 8px;
}

.crm-board {
  grid-auto-columns: minmax(200px, 1fr);
  grid-template-rows: 100%;
}

/* Columns scroll inside a board that fits the window (TRK-475) */
.crm-board .crm-column {
  min-height: 0;
  overflow-y: auto;
}

/* A sideways scrollbar that stays visible, even where the system hides scrollbars until you scroll */
.crm-board::-webkit-scrollbar {
  height: 10px;
}

.crm-board::-webkit-scrollbar-thumb {
  background: var(--border-strong, var(--border));
  border-radius: 999px;
}

.crm-board::-webkit-scrollbar-track {
  background: transparent;
}

.crm-column h2 {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.crm-total {
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}

.crm-column.won h2 {
  color: var(--low);
}

.crm-column.lost h2 {
  color: var(--urgent);
}

.crm-stage {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--sunken);
  font-size: 12px;
  font-weight: 600;
}

.crm-stage.won {
  color: var(--low);
}

.crm-stage.lost {
  color: var(--urgent);
}

.crm-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.crm-history {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.crm-history li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.crm-history small {
  margin-left: auto;
}

/* A task's Linked to: the kind of record, then a picker for it (TRK-406) */
.crm-link-picker {
  display: grid;
  gap: 6px;
}

/* One box to search and pick a company, contact or deal (TRK-455) */
.crm-combo { display: grid; }
/* The list opens under the box, inside the form, so a dialog's edge never cuts it off; the field beside it keeps its size */
.fields:has(.crm-combo) { align-items: start; }
.crm-combo-list { list-style: none; margin: 4px 0 0; padding: 4px; max-height: 200px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.crm-combo-list[hidden] { display: none; }
.crm-combo-list li { padding: 6px 8px; border-radius: 6px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-combo-list li.none { color: var(--muted); font-style: italic; }
.crm-combo-list li.active, .crm-combo-list li:hover { background: var(--hover, rgba(127, 127, 127, 0.15)); }
.crm-combo-list li[aria-selected="true"] { font-weight: 600; }
.crm-combo-list li.crm-combo-empty { cursor: default; color: var(--muted); background: none; }

/* Company and contact pickers: a search box over the list (TRK-405) */
.crm-picker {
  display: grid;
  gap: 6px;
}

/* What removing a pipeline stage touches (TRK-411) */
/* TRK-435: a deal's contacts who work at another company */
.crm-mismatch:empty { display: none; }
.crm-mismatch,
.crm-stage-warning {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-left: 3px solid var(--medium);
  border-radius: 6px;
  background: var(--surface-2, var(--surface));
  font-size: 13px;
}

.crm-chance {
  width: 64px;
  flex: none !important;
}

.crm-activity {
  max-width: 820px;
  margin-bottom: 24px;
}

.crm-composer {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.crm-composer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.crm-composer-row button {
  margin-left: auto;
}

.crm-timeline {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.crm-entry {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.crm-entry .doc-body {
  margin-top: 6px;
}

.crm-entry .doc-body > :first-child {
  margin-top: 0;
}

.crm-entry .doc-body > :last-child {
  margin-bottom: 0;
}

.crm-entry-head,
.crm-event {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.crm-event {
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.crm-event small,
.crm-when {
  margin-left: auto;
}

.crm-small {
  padding: 2px 6px;
  font-size: 12px;
}

.crm-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.crm-toggle button {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.crm-toggle button.selected {
  background: var(--sunken);
  color: var(--selected-text);
  font-weight: 600;
}

.crm-tasks {
  display: grid;
  gap: 6px;
  max-width: 820px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.crm-task {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.crm-task.done .crm-task-title {
  color: var(--muted);
  text-decoration: line-through;
}

.crm-task-title {
  text-align: left;
}

/* TRK-533: a task's description under its title, and its file count */
.crm-task-main {
  display: grid;
  min-width: 0;
  flex: 0 1 auto;
}

.crm-task-description {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 420px;
}

.crm-task-files {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
}

.crm-task-attach {
  display: grid;
  gap: 4px;
}

.crm-task-attach > .label {
  color: var(--muted);
  font-size: 12px;
}

.crm-task-attach .attachments {
  margin-top: 0;
}

.crm-task-kept {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.crm-task-kept:empty {
  display: none;
}

.crm-task-file {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.crm-task-file img {
  max-width: 96px;
  max-height: 64px;
}

.crm-due {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.crm-due.overdue {
  color: var(--urgent);
}

.crm-reminder {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: default;
}

.crm-reminder .form-actions {
  margin-left: auto;
}

/* CRM custom fields (TRK-171) */
.form label.check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

/* CRM filters and saved views (TRK-172) */
.crm-view-bar { flex-wrap: wrap; gap: 8px; }
.crm-view-bar select { max-width: 240px; }
.crm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.crm-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 2px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
}
.crm-chip .link { padding: 0 6px; text-decoration: none; }
.crm-sort { font: inherit; color: inherit; text-decoration: none; white-space: nowrap; padding: 0; }
.crm-columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px 12px; }

/* Several CRMs (TRK-427): the switcher in the side menu, and the list in Manage CRMs */
.crm-spaces { display: grid; gap: 6px; margin-bottom: 8px; }
.crm-space-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; }
.crm-space-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* CRM CSV import (TRK-173) */
.crm-mapping { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 12px; }
.crm-import h2 { font-size: 15px; margin: 12px 0 4px; }
.crm-import-summary { font-weight: 600; margin: 12px 0 4px; }
.crm-import-errors { margin: 0; padding-left: 20px; max-height: 160px; overflow: auto; font-size: 13px; }

/* CRM dashboard (TRK-174). Series colours are the first two slots of a colour-blind-checked palette. */
:root {
  --crm-s1: #2a78d6;
  --crm-s2: #eb6834;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --crm-s1: #3987e5;
    --crm-s2: #d95926;
  }
}
:root[data-theme="dark"] {
  --crm-s1: #3987e5;
  --crm-s2: #d95926;
}
.crm-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 12px 0; }
.crm-tile { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.crm-tile-value { font-size: 24px; font-weight: 650; margin: 4px 0; font-variant-numeric: tabular-nums; }
.crm-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 12px; }
.crm-panel { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; min-width: 0; }
.crm-panel h2 { font-size: 15px; margin: 0 0 10px; }
.crm-bar { display: block; border-radius: 4px; }
.crm-s1 { background: var(--crm-s1); }
.crm-s2 { background: var(--crm-s2); }
.crm-hbars { display: grid; gap: 8px; }
.crm-hbar { display: grid; grid-template-columns: minmax(70px, 110px) 1fr auto; align-items: center; gap: 8px; font-size: 13px; }
.crm-hbar-track { height: 14px; }
.crm-hbar-track .crm-bar { height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; }
.crm-hbar-value { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.crm-legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.crm-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.crm-vbars { display: flex; align-items: stretch; gap: 8px; height: 150px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.crm-vbar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.crm-vbar-group .sub { font-size: 11px; white-space: nowrap; }
.crm-vbar-pair { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.crm-vbar-pair .crm-bar { width: 40%; max-width: 18px; border-radius: 4px 4px 0 0; }
.crm-table-view { margin-top: 8px; font-size: 13px; }
.crm-table-view summary { cursor: pointer; color: var(--muted); }
.crm-panel .table-wrap { font-size: 13px; }
.crm-panel th,
.crm-panel td { padding: 6px 8px; }
.crm-panel table, .crm-rules table { min-width: 0; }

/* TRK-175 linked work */
.crm-work { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.crm-work li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.crm-work li .link { text-align: left; }
.crm-link-forms { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 8px; }
.crm-link-forms .link-row input, .crm-link-forms .link-row select { min-width: 0; max-width: 260px; }
.crm-found { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 6px; }

/* TRK-180 CRM previews in channels */
.crm-previews { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.crm-preview { display: flex; align-items: center; gap: 10px; max-width: 460px; padding: 8px 10px; text-align: left; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; }
.crm-preview-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.crm-preview-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* TRK-153 workload widget */
.workload-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; }
.workload-name { display: flex; align-items: center; gap: 6px; min-width: 0; text-align: left; }
.workload-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workload-row .progress { margin: 0; grid-column: 1 / -1; grid-row: 2; }

/* Social planner (TRK-182) */
.social-pic {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-right: 8px;
  overflow: hidden;
  background: var(--sunken);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-weight: 600;
  object-fit: cover;
}

.social-muted {
  color: var(--muted);
}

.social-paused td {
  opacity: 0.65;
}

.social-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 8px;
}

.social-toolbar h2 {
  margin: 0;
  font-size: 1.05rem;
}

.social-nav,
.social-filters,
.social-mode {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.social-nav h2 {
  min-width: 10ch;
  margin: 0 6px;
}

.social-filters {
  margin-left: auto;
}

.social-mode button[aria-pressed="true"] {
  background: var(--selected);
  color: var(--selected-text);
}

.social-zone {
  margin: 0 0 8px;
}

.social-month {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.social-weekday {
  padding: 4px 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.social-weekday.social-today {
  color: var(--selected-text);
}

.social-day {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 96px;
  padding: 4px;
  overflow: hidden;
  cursor: pointer;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.social-day.other {
  background: var(--sunken);
}

.social-day.other .social-date {
  color: var(--muted);
}

.social-date {
  align-self: flex-end;
  font-size: 0.8rem;
}

.social-day.social-today .social-date {
  padding: 0 6px;
  background: var(--selected);
  color: var(--selected-text);
  border-radius: 10px;
  font-weight: 600;
}

.social-day.drop,
.social-slot.drop {
  outline: 2px dashed var(--selected-text);
  outline-offset: -2px;
}

.social-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1px;
  width: 100%;
  min-width: 0;
  padding: 2px 6px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.78rem;
  text-align: left;
  cursor: grab;
}

.social-card.draft {
  border-style: dashed;
  color: var(--muted);
}

.social-card.idea {
  border-style: dotted;
  color: var(--muted);
}

/* Queue (TRK-189) */
.social-queue {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.social-queue-account {
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.social-queue-account p {
  margin: 6px 0;
}

.social-queue-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.social-queue-head .link {
  margin-left: auto;
}

.social-slots {
  font-variant-numeric: tabular-nums;
}

.social-queue-list {
  display: grid;
  gap: 4px;
  margin: 6px 0 0;
  padding-left: 18px;
}

.social-slot-rows {
  display: grid;
  gap: 6px;
}

.form .social-add-slot {
  justify-self: start;
}

.social-slot-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Approvals (TRK-188) */
.social-review {
  display: grid;
  gap: 6px;
  padding: 10px;
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.social-review h2 {
  margin: 0;
  font-size: 0.95rem;
}

.social-review textarea {
  width: 100%;
}

.social-yours {
  color: var(--selected-text);
  font-weight: 600;
}

.social-history ol {
  margin: 6px 0 0;
  padding-left: 20px;
}

.social-history li {
  margin-bottom: 4px;
}

.social-history blockquote {
  margin: 2px 0 0;
  padding-left: 8px;
  border-left: 2px solid var(--border);
  color: var(--muted);
}

/* Board (TRK-187) */
.social-board {
  grid-auto-columns: minmax(190px, 1fr);
}

.social-board .column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.social-board .column h2 {
  margin-bottom: 2px;
}

.social-board .column.closed {
  opacity: 0.45;
}

.social-board .column.published h2 {
  color: var(--low);
}

.social-board .column.failed h2 {
  color: var(--urgent);
}

.social-board-card .meta {
  flex-wrap: wrap;
}

.social-idea-box {
  display: grid;
  gap: 6px;
}

.social-idea-box textarea {
  width: 100%;
  resize: vertical;
}

.social-idea-box button {
  justify-self: start;
}

.social-card-top {
  display: flex;
  align-items: center;
  gap: 4px;
}

.social-card-tag {
  margin-left: auto;
  font-size: 0.7rem;
  text-transform: uppercase;
}

.social-card-time {
  flex: none;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.social-card-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.social-dots {
  display: inline-flex;
  flex: none;
  gap: 2px;
}

.social-dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--surface);
}

.social-week {
  display: grid;
  grid-template-columns: 52px repeat(7, minmax(0, 1fr));
  max-height: 70vh;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.social-week .social-weekday {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg);
}

.social-hour-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.social-hour {
  padding: 2px 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.social-slot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 36px;
  padding: 2px;
  cursor: pointer;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.social-row {
  cursor: pointer;
}

.social-post-link {
  max-width: 24ch;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.social-over,
.social-count.over,
.social-problem {
  color: var(--chart-failed);
  font-weight: 600;
}

.social-problem:empty {
  display: none;
}

.social-composer {
  min-width: 0;
}

.social-field {
  display: grid;
  gap: 4px;
}

.social-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.form .social-pick {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  font-size: 13px;
}

.form .social-pick > * {
  font-size: inherit;
}

.form .social-pick > .social-muted {
  color: var(--muted);
}

.social-versions {
  display: grid;
  gap: 10px;
}

.social-version {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.social-version-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.social-count {
  margin-left: auto;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.social-preview {
  padding: 10px;
  background: var(--sunken);
  border-radius: 6px;
}

.social-preview-head {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}

.social-preview-text {
  max-height: 12em;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .social-day {
    min-height: 64px;
  }

  .social-card-text {
    display: none;
  }

  .social-filters {
    margin-left: 0;
  }
}

.social-composer .spacer {
  flex: 1;
}

.social-composer button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.social-names {
  display: grid;
  gap: 2px;
  white-space: nowrap;
}

/* ---- Mail (TRK-197) ---- */
.mail-servers { display: flex; flex-direction: column; gap: 2px; font-size: 0.85em; color: var(--muted); }
.mail-hint { display: block; color: var(--muted); font-weight: normal; }
.mail-help { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--surface-2, var(--surface)); }
.mail-help p { margin: 4px 0 6px; }
.mail-details summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
.mail-details[open] { display: flex; flex-direction: column; gap: 10px; }
.mail-server { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.mail-server legend { padding: 0 4px; font-weight: 600; }
.mail-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mail-error { color: var(--danger, #c9372c); margin: 0; }

/* Mail: folders, list and reading pane (TRK-203) */
.mail-panes { position: relative; display: grid; grid-template-columns: var(--mail-folders-w, 200px) var(--mail-list-w, 320px) minmax(0, 1fr); border: 1px solid var(--border); border-radius: 8px; min-height: 70vh; overflow: hidden; background: var(--surface); }
.mail-folders { border-right: 1px solid var(--border); padding: 8px; background: var(--sunken); display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.mail-account-name { font-size: 0.8em; font-weight: 600; color: var(--muted); padding: 4px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; width: 100%; background: none; border: 0; border-radius: 6px; font-family: inherit; text-align: left; cursor: pointer; gap: 6px; align-items: center; }
.mail-account-name:hover { background: var(--sunken); color: var(--text); }
.mail-account-address { overflow: hidden; text-overflow: ellipsis; }
.mail-account-folded > :not(.mail-account-name) { display: none; }
.mail-folder { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 6px 8px; border: 0; background: none; color: var(--text); border-radius: 6px; cursor: pointer; text-align: left; font: inherit; }
.mail-folder:hover { background: var(--surface); }
.mail-folder[aria-current="page"] { background: var(--selected); color: var(--selected-text); font-weight: 600; }
.mail-count { font-size: 0.8em; font-weight: 600; color: var(--accent); }
.mail-list { border-right: 1px solid var(--border); overflow-y: auto; max-height: 80vh; min-width: 0; }
.mail-list-head, .mail-read-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.mail-list-head h2, .mail-read-head h2 { margin: 0; font-size: 1.05em; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mail-rows { list-style: none; margin: 0; padding: 0; }
.mail-row-item { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text); text-align: left; font: inherit; cursor: pointer; min-width: 0; }
.mail-row-item:hover { background: var(--sunken); }
.mail-row-item[aria-current="true"] { background: var(--selected); }
.mail-row-item.unread { box-shadow: inset 3px 0 0 var(--accent); }
.mail-row-item.unread .mail-from, .mail-row-item.unread .mail-subject { font-weight: 700; }
.mail-row-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mail-row-top .mail-from { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row-top time { font-size: 0.8em; color: var(--muted); white-space: nowrap; }
.mail-subject, .mail-snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mail-snippet { color: var(--muted); font-size: 0.88em; }
.mail-thread-size { font-size: 0.75em; color: var(--muted); border: 1px solid var(--border); border-radius: 8px; padding: 0 5px; }
.mail-clip, .mail-flag { font-size: 0.85em; }
.mail-flag { color: var(--danger); }
.mail-more { margin: 10px auto; display: block; }
.mail-read { overflow-y: auto; max-height: 80vh; min-width: 0; }
.mail-pick { margin-top: 20vh; }
.mail-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.mail-back { display: none; }
.mail-banner { margin: 10px 12px 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--sunken); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 0.9em; }
.mail-message { margin: 10px 12px; border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; }
.mail-message summary { display: flex; gap: 8px; align-items: baseline; padding: 10px 0; cursor: pointer; min-width: 0; }
.mail-message summary .mail-from { font-weight: 600; white-space: nowrap; }
.mail-message summary time { font-size: 0.8em; color: var(--muted); white-space: nowrap; order: 3; margin-left: auto; }
.mail-message summary .mail-snippet { flex: 1; }
.mail-message[open] summary .mail-snippet { visibility: hidden; }
.mail-meta { font-size: 0.85em; color: var(--muted); display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; overflow-wrap: anywhere; }
.mail-meta strong { color: var(--text); }
.mail-frame { display: block; width: 100%; height: 200px; border: 0; border-radius: 6px; background: #fff; margin-bottom: 12px; }
.mail-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 12px; }
.mail-attachments { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.mail-attachments li { border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; font-size: 0.9em; }
@media (max-width: 900px) {
  .mail-panes { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .mail-folders { border-right: 0; border-bottom: 1px solid var(--border); flex-direction: row; overflow-x: auto; }
  .mail-account { display: flex; gap: 4px; align-items: center; }
  .mail-folder { width: auto; white-space: nowrap; gap: 6px; }
  .mail-list, .mail-read { max-height: none; border-right: 0; }
  .mail-panes:not(.reading) .mail-read { display: none; }
  .mail-panes.reading .mail-list, .mail-panes.reading .mail-folders { display: none; }
  .mail-back { display: inline-block; }
}
.mail-read-head h2 { flex: 1 1 100%; order: 1; }
.mail-read-head .mail-actions { order: 2; }
.mail-read-head .mail-back { order: 0; }
.mail-row-item, .mail-folder { border-radius: 0; box-shadow: none; }
.mail-folder { border-radius: 6px; }
/* Sorting mail (TRK-205) */
.mail-rows li { display: flex; align-items: flex-start; border-bottom: 1px solid var(--border); }
.mail-rows li .mail-row-item { border-bottom: 0; padding-left: 6px; flex: 1; }
.mail-rows li.picked, .mail-rows li.picked .mail-row-item { background: var(--selected); }
/* The unread bar marks the whole row, on its left edge before the tick box (TRK-265) */
.mail-rows li.unread { box-shadow: inset 3px 0 0 var(--accent); }
.mail-rows li .mail-row-item.unread { box-shadow: none; }
.mail-tick { flex: none; margin: 11px 0 0 12px; width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.mail-list-head .mail-tick, .mail-bulk .mail-tick { margin: 0; }
.mail-bulk { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mail-list > .mail-bulk { padding: 8px 12px; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 2; background: var(--surface); }
.mail-bulk-pane { margin: 20vh auto 0; padding: 0 24px; max-width: 460px; display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; }
.mail-bulk-pane h2 { margin: 0; font-size: 1.1em; }
.mail-bulk-pane .mail-bulk { justify-content: center; }
.mail-ticked h2 { font-size: 0.95em; }
.mail-bulk button { padding: 3px 8px; font-size: 0.88em; }
.mail-bulk select { font-size: 0.88em; max-width: 140px; }
.mail-pin { font-size: 0.8em; }
.mail-folder-row { display: flex; align-items: center; }
.mail-folder-row .mail-folder { flex: 1; min-width: 0; }
.mail-folder-edit { padding: 2px 6px; opacity: 0; }
.mail-folder-row:hover .mail-folder-edit, .mail-folder-edit:focus-visible { opacity: 1; }
.mail-folder.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--surface); }
.mail-folder-new { font-size: 0.85em; padding: 4px 8px; text-align: left; }
.mail-undo { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 16px; border-radius: 8px; background: var(--text); color: var(--surface); box-shadow: 0 4px 16px rgb(0 0 0 / 0.25); max-width: calc(100vw - 32px); }
.mail-undo[hidden] { display: none; }
.mail-undo .link { color: var(--surface); font-weight: 700; text-decoration: underline; }
.mail-undo .mail-undo-close { color: var(--surface); padding: 0 6px; }
@media (hover: none) { .mail-folder-edit { opacity: 1; } }
/* Searching mail (TRK-206) */
.mail-search { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.mail-search-box { flex: 1 1 240px; min-width: 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.mail-search-box:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.mail-search-scope { padding: 7px 8px; }
.mail-filter-button[aria-expanded="true"] { background: var(--selected); color: var(--selected-text); }
.mail-filters { flex: 1 1 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 12px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.mail-filters[hidden] { display: none; }
.mail-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85em; color: var(--muted); }
.mail-filters input:not([type="checkbox"]) { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--sunken); color: var(--text); font: inherit; font-size: 1.05em; }
.mail-filter-dates, .mail-filter-checks { grid-column: 1 / -1; display: flex; gap: 12px 20px; flex-wrap: wrap; align-items: flex-end; }
.mail-filter-dates label { flex: 0 1 180px; }
.mail-filters .mail-filter-check { flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-size: 0.9em; }
.mail-filters .form-actions { grid-column: 1 / -1; margin: 0; }
.mail-rows mark { background: color-mix(in srgb, var(--accent) 28%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }
.mail-in { font-size: 0.72em; color: var(--muted); border: 1px solid var(--border); border-radius: 8px; padding: 0 6px; white-space: nowrap; max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
.mail-snippet.mail-excerpt { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mail-server-search { text-align: center; padding: 8px 12px 16px; }
.mail-server-search .sub { margin: 0; }
/* Several mailboxes (TRK-207) */
.mail-all-inboxes { margin-bottom: 6px; font-weight: 600; }
.mail-box { font-size: 0.72em; color: var(--accent, var(--muted)); white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; }
/* Mail meets issues and the CRM (TRK-213) */
.ticket-email > span:nth-child(2) { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.crm-email p { margin: 4px 0 2px; overflow-wrap: anywhere; }

/* Sending options (TRK-208) */
.mail-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 8px 0 4px; padding: 8px 12px; border-radius: 8px; background: var(--hover, rgba(127,127,127,0.12)); font-size: 0.9em; }
.mail-banner-error { color: var(--danger, #c0392b); }
.mail-template-menu { display: flex; flex-direction: column; align-items: stretch; gap: 2px; margin: 0 0 6px; padding: 4px; border: 1px solid var(--border); border-radius: 8px; max-height: 240px; overflow: auto; }
.mail-template-item { text-align: left; background: none; border: 0; padding: 6px 8px; border-radius: 6px; color: inherit; cursor: pointer; }
.mail-template-item:hover, .mail-template-item:focus-visible { background: var(--hover, rgba(127,127,127,0.12)); }
.mail-template-save { border-top: 1px solid var(--border); border-radius: 0 0 6px 6px; color: var(--accent); }
.mail-template-none { margin: 4px 8px; }
.mail-later-quicks { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.mail-later-quick { justify-content: flex-start; text-align: left; }
.mail-count.failed { background: var(--danger, #c0392b); color: #fff; }
.mail-not-sent { color: var(--danger, #c0392b); }
.mail-outbox { margin-bottom: 6px; }
.mail-settings { margin-top: 24px; max-width: 720px; }
.mail-settings h2 { font-size: 1em; margin: 20px 0 8px; }
.mail-setting { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mail-templates { list-style: none; padding: 0; margin: 0; }
.mail-templates li { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.mail-templates li .social-muted { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Writing mail (TRK-204) */
.mail-list-head .mail-new { padding: 4px 12px; }
.mail-compose { display: flex; flex-direction: column; padding: 0 12px 12px; }
.mail-field { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 6px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.mail-field-label { color: var(--muted); font-size: 0.85em; width: 56px; flex: none; }
.mail-field > input, .mail-field > select { flex: 1; min-width: 120px; border: 0; background: none; color: var(--text); font: inherit; padding: 4px 0; outline: none; }
.mail-field > select:disabled { opacity: 1; appearance: none; }
.mail-field:focus-within { border-bottom-color: var(--accent); }
.mail-chips { display: contents; }
.mail-chip { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; padding: 1px 2px 1px 8px; border-radius: 12px; background: var(--sunken); border: 1px solid var(--border); font-size: 0.88em; overflow-wrap: anywhere; }
.mail-chip-x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1.1em; line-height: 1; padding: 0 5px; border-radius: 50%; }
.mail-chip-x:hover { color: var(--danger); }
.mail-ccbcc { margin-left: auto; font-size: 0.85em; }
.mail-suggest { position: absolute; z-index: 20; top: 100%; left: 56px; right: 0; max-width: 420px; margin: 2px 0 0; padding: 4px 0; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15); }
.mail-suggest-item { padding: 6px 10px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9em; }
.mail-suggest-item span { color: var(--muted); }
.mail-suggest-item[aria-selected="true"], .mail-suggest-item:hover { background: var(--selected); }
.mail-crm { font-size: 0.75em; border: 1px solid var(--border); border-radius: 6px; padding: 0 4px; margin-left: 4px; }
.mail-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.mail-tool { padding: 3px 8px; min-width: 30px; font-size: 0.9em; }
.mail-editor { min-height: 260px; padding: 12px 2px; outline: none; overflow-wrap: anywhere; line-height: 1.5; }
.mail-editor img { max-width: 100%; height: auto; }
.mail-editor blockquote { margin: 0 0 0 0.8ex; border-left: 2px solid var(--border); padding-left: 1ex; color: var(--muted); }
.mail-editor img[data-blocked-src] { display: none; }
.mail-draft-files { margin-top: 8px; }
.mail-draft-files li { display: inline-flex; align-items: center; gap: 4px; }
.mail-save-state { font-size: 0.8em; color: var(--muted); margin-right: 4px; }
/* Posting by hand (TRK-195) */
.social-by-hand {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.social-by-hand h2 {
  margin: 0;
  font-size: 0.95rem;
}

.social-by-hand .sub {
  margin: 0;
}

.social-hand-row {
  display: grid;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.social-hand-row .social-preview-text {
  white-space: pre-wrap;
  max-height: 8em;
  overflow: auto;
}

.social-hand-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.social-hand-actions input {
  flex: 1 1 200px;
  min-width: 0;
}

.social-posted {
  margin: 0;
}

/* Post results (TRK-193) */
.social-results {
  margin: 0;
  font-size: 0.85rem;
}

.social-results-head {
  margin: 16px 0 8px;
  font-size: 0.95rem;
}

/* Publishing through Buffer (TRK-190) */
.social-buffer-state,
.social-buffer-failed {
  margin: 0;
}

.social-buffer-state {
  color: var(--muted);
}

.social-buffer-failed {
  color: var(--chart-failed);
  font-weight: 600;
}

.social-buffer {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.social-buffer h2 {
  margin: 0;
  font-size: 0.95rem;
}

.social-buffer .sub {
  margin: 0;
}

.social-buffer-channels {
  display: grid;
  gap: 6px;
}

.social-buffer-channels h3 {
  margin: 4px 0 0;
  font-size: 0.85rem;
}

/* Long channel and account names wrap instead of pushing Add account out of the box */
.social-buffer-channels table {
  min-width: 0;
}

.social-buffer-channels td .cell {
  flex-wrap: wrap;
  white-space: normal;
}

.social-overdue {
  color: var(--chart-failed);
  font-weight: 600;
  font-size: 0.8rem;
}

/* Sidebar line icons (navicons.js). In a row they sit at the start; only inside a small box are they centred (TRK-226). */
.nav-icon {
  width: 16px;
  height: 16px;
  display: block;
  flex: none;
  margin: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.channel-mark .nav-icon,
.type-icon .nav-icon {
  margin: 0 auto;
}

/* Media library (TRK-191) */
.social-media-browser {
  display: grid;
  gap: 10px;
}

.social-media-upload {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.social-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.social-media-grid > .empty {
  grid-column: 1 / -1;
}

.social-media-tile {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  min-width: 0;
}

.social-media-tile figcaption {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.social-media-tile strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.social-media-thumb {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: var(--sunken);
  font-size: 2rem;
}

.social-media-actions {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: center;
}

.social-media-field {
  display: grid;
  gap: 8px;
}

.social-media-chosen {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.social-media-chip {
  position: relative;
  display: grid;
  gap: 2px;
  width: 96px;
  margin: 0;
}

.social-media-chip figcaption {
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.social-media-chip button {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 24px;
  padding: 0 6px;
  background: var(--surface);
}

.social-media-picker {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--sunken);
}

.social-media-picker .social-media-grid {
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  max-height: 260px;
  overflow: auto;
}

.social-media-pick {
  display: grid;
  gap: 4px;
  padding: 4px;
  font-size: 0.75rem;
  text-align: left;
  border: 2px solid transparent;
  border-radius: 8px;
  background: none;
  min-width: 0;
}

.social-media-pick span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.social-media-pick.on {
  border-color: var(--accent);
}

.social-media-flags:empty {
  display: none;
}

.social-media-flags {
  margin: 0;
  color: var(--medium);
  font-size: 0.85rem;
}

.social-hand-media {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.social-uses {
  display: grid;
  gap: 6px;
  padding-left: 18px;
}

/* Pane borders (TRK-221): the pointer turns into the double-sided arrow, and dragging resizes */
.pane-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 6;
  width: 12px;
  margin-left: -6px;
  cursor: col-resize;
  touch-action: none;
}

.pane-resizer::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 5px;
  width: 2px;
  border-radius: 1px;
  background: transparent;
  transition: background-color 0.15s 0.1s;
}

.pane-resizer:hover::before,
.pane-resizer:focus-visible::before,
.pane-resizing .pane-resizer:active::before {
  background: var(--primary);
}

.pane-resizer:focus-visible {
  outline: none;
}

.pane-resizer.hidden-pane {
  cursor: default;
}

.pane-resizer.hidden-pane::before {
  display: none;
}

.pane-resizing,
.pane-resizing * {
  cursor: col-resize !important;
  user-select: none;
}

.pane-toggle {
  position: sticky;
  top: 14px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin: 14px 0 0 -5px;
  padding: 0;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}

.pane-toggle .icon {
  width: 12px;
  height: 12px;
  transition: transform 0.15s;
}

.pane-resizer:hover .pane-toggle,
.pane-toggle:focus-visible,
.hidden-pane .pane-toggle {
  opacity: 1;
}

.pane-toggle:hover {
  color: var(--text);
  background: var(--surface);
}

.hidden-pane .pane-toggle .icon {
  transform: rotate(180deg);
}

/* A hidden pane keeps its place in the grid at no width; phones have their own layout */
@media (min-width: 761px) {
  .docs-tree-hidden .doc-tree,
  .mail-folders-hidden .mail-folders {
    visibility: hidden;
    overflow: hidden;
    padding: 0;
    border: 0;
  }

  /* The mail box clips its edges, so a hidden folder list keeps a thin strip that holds the
     whole show arrow instead of cutting it in half on the left border */
  .mail-folders-hidden .mail-panes {
    --mail-folders-w: 30px;
  }

  .mail-folders-hidden .mail-panes .mail-folders {
    visibility: visible;
    border-right: 1px solid var(--border);
  }

  .mail-folders-hidden .mail-panes .mail-folders > * {
    visibility: hidden;
  }

  .mail-folders-hidden .mail-panes .pane-toggle {
    margin-left: -18px;
  }
}

/* The chat keeps room however wide its side panel is dragged; phones show the panel on its own */
@media (min-width: 761px) {
  .channel-panel {
    max-width: calc(100% - 320px);
  }
}

.channel-page:not(:has(.channel-panel:not([hidden]))) .pane-resizer {
  display: none;
}

@media (max-width: 760px) {
  .pane-resizer {
    display: none;
  }

  #sidebar-wrap {
    position: static;
    flex: none;
    max-width: none;
    height: auto;
    margin: 0;
  }

  .sidebar-hidden #sidebar.mobile-open {
    display: block;
  }
}

/* Campaigns, labels and templates (TRK-192) */
.social-plan-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--muted);
}

.social-campaign-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.social-label {
  color: var(--muted);
}

.social-colours {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.social-colour {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.social-colour input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.social-colour span {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}

.social-colour input:checked + span {
  box-shadow: 0 0 0 2px var(--text);
}

.social-colour input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.social-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 560px) {
  .social-two {
    grid-template-columns: 1fr;
  }
}

.social-field-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.social-insert {
  width: auto;
  font-size: 0.85rem;
}

.social-templates {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.social-templates .section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.social-templates h2 {
  margin: 0;
  font-size: 1rem;
}

.social-template-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social-template-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.social-template-body {
  margin: 4px 0 0;
  white-space: pre-wrap;
  color: var(--muted);
}

.social-row-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: flex-end;
  white-space: nowrap;
}

/* Profile tab (TRK-224): your avatar beside your details */
.profile-card {
  display: flex;
  align-items: center;
  gap: 20px;
}

.profile-avatar {
  flex: none;
  width: 64px;
  height: 64px;
  font-size: 22px;
}

.profile-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 20px;
  margin: 0;
}

.profile-facts dt {
  color: var(--muted);
}

.profile-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .profile-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Editing a page in place (TRK-231): it looks as it does when read */
.doc-content .doc-body[title] {
  cursor: text;
}

.doc-empty {
  cursor: text;
}

.doc-title-inline {
  min-width: 0;
  padding: 2px 6px;
  margin-left: -7px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 1.6em;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.doc-title-inline:hover,
.doc-title-inline:focus {
  border-color: var(--border);
  outline: none;
}

.doc-tools-sticky {
  align-items: center;
  margin: 8px 0 0;
}

.doc-tools .doc-mode {
  margin-left: auto;
}

.doc-editable {
  position: relative;
  min-height: 45vh;
  padding: 2px 0 40px;
  outline: none;
  caret-color: var(--primary);
}

.doc-editable.is-empty::before {
  content: attr(data-placeholder);
  position: absolute;
  top: 2px;
  left: 0;
  color: var(--muted);
  pointer-events: none;
}

.doc-editable table td,
.doc-editable table th {
  min-width: 80px;
}

/* A checklist item draws its own box, which a click in the item's left edge ticks */
.doc-editable li[data-checked] {
  position: relative;
  margin-left: -20px;
  padding-left: 26px;
  list-style: none;
}

.doc-editable li[data-checked]::before {
  content: "";
  position: absolute;
  top: 0.3em;
  left: 2px;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--muted);
  border-radius: 4px;
  cursor: pointer;
}

.doc-editable li[data-checked="true"]::before {
  content: "✓";
  display: grid;
  place-items: center;
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-text);
  font-size: 11px;
  line-height: 1;
}

.doc-editable li[data-checked="true"] {
  color: var(--muted);
  text-decoration: line-through;
}

@media (max-width: 760px) {
  .doc-tools-sticky {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .doc-tools-sticky button {
    flex: none;
  }
}

/* ---- Calendar (TRK-234) ---- */
:root {
  --cal-now: #d13438;
  --cal-event: color-mix(in srgb, var(--accent) 18%, var(--surface));
  --cal-event-edge: var(--accent);
  --cal-today: color-mix(in srgb, var(--accent) 6%, transparent);
  --cal-google: color-mix(in srgb, #0b8043 18%, var(--surface));
  --cal-google-edge: #0b8043;
}

.cal-page {
  display: flex;
  flex-direction: column;
  /* Room for the Calendar title above (TRK-293) */
  height: calc(100vh - 178px);
  min-height: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.cal-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.cal-toolbar .cal-today {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cal-toolbar .cal-today .nav-icon { width: 16px; height: 16px; }
.cal-arrow { font-size: 20px; line-height: 1; padding: 2px 10px; }
.cal-spacer { flex: 1; }
.cal-picker-wrap { position: relative; }

.cal-month {
  font-weight: 650;
  font-size: 16px;
  background: none;
  border: 0;
  color: var(--text);
  padding: 4px 8px;
}

.cal-picker {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  width: 240px;
  padding: 10px;
  background: var(--dialog);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.18);
}

.cal-picker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-picker-months { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.cal-picker-months button[aria-pressed="true"] { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }

.cal-views { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.cal-views button { border: 0; border-radius: 0; background: none; padding: 5px 12px; }
.cal-views button[aria-pressed="true"] { background: var(--selected); color: var(--selected-text); font-weight: 600; }

.cal-head {
  display: grid;
  border-bottom: 1px solid var(--border);
  padding-right: var(--cal-scrollbar, 0);
}

.cal-day-head {
  display: flex;
  flex-direction: column;
  padding: 8px 12px 6px;
  border-left: 1px solid var(--border);
  border-top: 3px solid transparent;
  min-width: 0;
}

.cal-date { font-size: 22px; font-weight: 500; line-height: 1.2; }
.cal-weekday { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-day-head.cal-is-today { border-top-color: var(--accent); }
.cal-day-head.cal-is-today .cal-date,
.cal-day-head.cal-is-today .cal-weekday { color: var(--accent); font-weight: 650; }

.cal-body { flex: 1; overflow-y: auto; scrollbar-gutter: stable; }
.cal-head { scrollbar-gutter: stable; overflow-y: hidden; }
.cal-grid { display: grid; position: relative; }
.cal-hours { border-right: 1px solid var(--border); }

.cal-hour-label {
  box-sizing: border-box;
  padding: 2px 10px 0 0;
  text-align: right;
  color: var(--muted);
  font-size: 12px;
  transform: translateY(-8px);
}

.cal-col {
  position: relative;
  border-left: 1px solid var(--border);
  cursor: cell;
  background-image: linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 100% 56px;
}

.cal-col.cal-is-today { background-color: var(--cal-today); }

.cal-col::after {
  /* the half-hour dashes, repeated every hour */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(to right, var(--muted) 0 3px, transparent 3px 7px);
  background-size: 100% 1px;
  background-position: 0 28px;
  opacity: 0.25;
  -webkit-mask: repeating-linear-gradient(to bottom, transparent 0 28px, #000 28px 29px, transparent 29px 56px);
  mask: repeating-linear-gradient(to bottom, transparent 0 28px, #000 28px 29px, transparent 29px 56px);
  background-repeat: repeat;
}

.cal-event {
  position: absolute;
  z-index: 1;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 8px;
  overflow: hidden;
  border-radius: 6px;
  border-left: 4px solid var(--cal-event-edge);
  background: var(--cal-event);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  container-type: inline-size; /* narrow blocks tidy their Join button (TRK-252) */
}

.cal-event > * { flex-shrink: 0; }
.cal-event strong,
.cal-event .cal-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-event.cal-live strong { padding-right: 48px; }
.cal-event .cal-sub { color: var(--muted); font-size: 12px; }
.cal-event:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-event.cal-movable { cursor: grab; touch-action: none; }
.cal-event.cal-dragging { cursor: grabbing; z-index: 5; opacity: 0.85; box-shadow: 0 6px 16px rgb(0 0 0 / 0.25); }
.cal-event.cal-dragging:has(.cal-drag-time) { overflow: visible; }
.cal-event .cal-drag-time { position: absolute; top: 100%; left: 0; margin-top: 2px; padding: 1px 6px; border-radius: 4px; background: var(--surface); color: var(--text); box-shadow: 0 2px 6px rgb(0 0 0 / 0.2); }
.cal-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; cursor: ns-resize; }
.cal-resize::after { content: ""; position: absolute; left: 50%; bottom: 2px; width: 16px; height: 2px; margin-left: -8px; border-radius: 1px; background: currentColor; opacity: 0; }
.cal-event.cal-movable:hover .cal-resize::after { opacity: 0.4; }
.cal-event.cal-live { background: color-mix(in srgb, var(--accent) 55%, var(--surface)); }
.cal-event.cal-pending { background: repeating-linear-gradient(135deg, var(--cal-event) 0 8px, color-mix(in srgb, var(--cal-event) 82%, var(--surface)) 8px 16px); }
.cal-event.cal-live.cal-pending { background: color-mix(in srgb, var(--accent) 55%, var(--surface)); }
.cal-event.cal-declined { opacity: 0.55; text-decoration: line-through; }
.cal-event .cal-repeat { position: absolute; right: 8px; bottom: 4px; color: var(--muted); }
.cal-event.cal-live .cal-sub,
.cal-event.cal-live .cal-repeat { color: var(--text); }

.cal-join {
  position: absolute;
  top: 4px;
  right: 6px;
  padding: 2px 10px;
  font-weight: 600;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.cal-join .nav-icon { display: none; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* A narrow block (overlapping meetings, small windows) shows Join as a camera icon,
   and the narrowest put it under the title, so the title is never covered (TRK-252) */
@container (max-width: 103px) { /* the block's inner width, about 120 px outside */
  .cal-event.cal-live strong { padding-right: 26px; }
  .cal-join { right: 3px; padding: 2px 4px; }
  .cal-join .nav-icon { display: block; }
  .cal-join .cal-join-text { display: none; }
}
/* A narrow block widens on hover or focus to show its whole title and Join (TRK-252) */
.cal-event.cal-peek { min-width: 200px; z-index: 4; box-shadow: 0 4px 12px rgb(0 0 0 / 0.22); }
@container (max-width: 49px) { /* about 70 px outside */
  .cal-event.cal-live strong { padding-right: 0; }
  .cal-join { position: static; align-self: flex-start; order: 1; }
}

.cal-now {
  position: absolute;
  left: -1px;
  right: 0;
  z-index: 2;
  height: 2px;
  background: var(--cal-now);
  pointer-events: none;
}

.cal-now::before {
  content: "";
  position: absolute;
  left: -5px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cal-now);
}

.cal-repeat { font-size: 13px; line-height: 1; }

/* Your calendars beside the grid (TRK-422 to TRK-424) */
.cal-split { position: relative; flex: 1; display: flex; min-height: 0; }
.cal-view { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.cal-side { flex: none; width: min(var(--cal-side-w, 196px), 30%); padding: 10px 16px 10px 12px; border-right: 1px solid var(--border); overflow-y: auto; font-size: 13px; }
.cal-side-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 4px 0 2px; color: var(--muted); }
.cal-side-head:not(:first-child) { margin-top: 14px; }
.cal-side-toggle { font-weight: inherit; }
.cal-side-toggle:hover { color: var(--text); text-decoration: none; }
.cal-side-add { width: 26px; height: 26px; padding: 0; font-size: 18px; line-height: 1; }
.cal-side-list { list-style: none; margin: 0; padding: 0; }
.cal-side-row { display: flex; align-items: center; gap: 2px; border-radius: 6px; }
.cal-side-row:hover { background: var(--hover, var(--sunken)); }
.cal-side-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 4px 4px; cursor: pointer; }
.cal-side-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-side-name input { flex: none; width: 16px; height: 16px; margin: 0; }
.cal-side-off .cal-side-name span { color: var(--muted); }
.cal-side-more { flex: none; width: 24px; height: 24px; padding: 0; opacity: 0; }
.cal-side-row:hover .cal-side-more, .cal-side-more:focus-visible { opacity: 1; }
@media (hover: none) { .cal-side-more { opacity: 1; } }
.cal-swatch { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 3px; }
.cal-in { display: flex; align-items: center; gap: 8px; }
.cal-which { gap: 10px; }
.cal-colours { display: flex; flex-wrap: wrap; gap: 8px; }
.cal-colour { width: 26px; height: 26px; padding: 0; border: 2px solid transparent; border-radius: 999px; box-shadow: inset 0 0 0 2px var(--surface); cursor: pointer; }
.cal-colour[aria-checked="true"] { border-color: var(--text); }
.cal-shares { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; border-top: 1px solid var(--border); }
.cal-share-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cal-share { display: flex; align-items: center; gap: 8px; }
.cal-share-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-share-all { width: 24px; text-align: center; }
.cal-form .form-actions .cal-spacer { flex: 1; }
/* One line: share controls and Delete on the left, Cancel and Save on the right; it wraps on a narrow screen (TRK-451) */
.cal-dialog-actions { flex-wrap: wrap; align-items: center; justify-content: flex-start; row-gap: 8px; }
.cal-share-add { display: flex; gap: 8px; min-width: 0; }
.cal-share-add select:first-child { width: 140px; min-width: 0; }
.cal-dialog-end { display: flex; gap: 8px; margin-left: auto; }
@media (max-width: 560px) {
  dialog .cal-form { min-width: 0; } /* beats the .cal-form rule further down */
  .cal-share-add { flex: 1 1 100%; }
  .cal-share-add select:first-child { flex: 1; min-width: 0; width: auto; }
}
@media (max-width: 760px) {
  /* On a phone the calendars sit in a row above the grid */
  .cal-split { flex-direction: column; }
  .cal-side { width: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 10px; border-right: 0; border-bottom: 1px solid var(--border); overflow: visible; }
  .cal-side-head { margin: 0 !important; }
  .cal-side-head strong { display: none; }
  .cal-side-list { display: contents; }
  .cal-side-name { padding: 2px 0; }
  .cal-split > .pane-resizer { display: none; }
}
/* Hidden, the list keeps a thin strip that holds the whole show arrow (TRK-447) */
@media (min-width: 761px) {
  .cal-side-hidden .cal-split { --cal-side-w: 30px; }
  .cal-side-hidden .cal-side { padding: 0; overflow: hidden; }
  .cal-side-hidden .cal-side > * { visibility: hidden; }
  .cal-side-hidden .cal-split .pane-toggle { margin-left: -18px; }
}

/* Month */
.cal-month-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(96px, 1fr);
  overflow-y: auto;
}

.cal-month-weekday {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 13px;
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-height: 0;
}

.cal-month-grid { grid-template-rows: auto; }

.cal-month-day {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 6px;
  min-width: 0;
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: cell;
}

.cal-month-day.cal-other-month { background: var(--sunken); }
.cal-month-day.cal-other-month .cal-month-date { color: var(--muted); }
.cal-month-date { align-self: flex-start; background: none; border: 0; padding: 2px 6px; border-radius: 999px; font-weight: 600; color: var(--text); }
.cal-month-day.cal-is-today .cal-month-date { background: var(--accent); color: var(--accent-text); }

.cal-line {
  display: flex;
  gap: 6px;
  align-items: center;
  width: 100%;
  min-width: 0;
  padding: 2px 6px;
  border: 0;
  border-left: 3px solid var(--cal-event-edge);
  border-radius: 4px;
  background: var(--cal-event);
  color: var(--text);
  font-size: 12px;
  text-align: left;
}

.cal-line.cal-live { background: color-mix(in srgb, var(--accent) 55%, var(--surface)); }
.cal-line-time { color: var(--muted); flex: none; }
.cal-line-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.cal-more { font-size: 12px; align-self: flex-start; }

/* Dialogs */
.cal-form { display: flex; flex-direction: column; gap: 10px; min-width: min(520px, 86vw); }
.cal-form > input:first-child { font-size: 18px; font-weight: 600; }
.cal-when { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cal-until { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.cal-check { display: inline-flex; gap: 6px; align-items: center; }
.cal-muted { color: var(--muted); font-size: 13px; margin: 0; }
.cal-people { position: relative; }
.cal-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px; border: 1px solid var(--border); border-radius: 8px; }
.cal-chips input { flex: 1; min-width: 140px; border: 0; outline: 0; background: none; }
.cal-chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 10px; border-radius: 999px; background: var(--selected); color: var(--selected-text); font-size: 13px; }
.cal-chip button { padding: 0 6px; }
.cal-chip-guest { background: transparent; color: var(--text); border: 1px dashed var(--border); }
.cal-guest-mark { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px dashed var(--border); font-size: 12px; color: var(--muted); flex: none; }
.cal-people-list { display: flex; flex-direction: column; }
.cal-people-list:empty { display: none; }
.cal-people-list button { display: flex; gap: 8px; align-items: center; text-align: left; background: none; border: 0; padding: 6px 8px; border-radius: 6px; }
.cal-people-list button:hover { background: var(--sunken); }
.cal-details { display: flex; flex-direction: column; gap: 8px; min-width: min(440px, 86vw); }
.cal-details p { margin: 0; }
.cal-notes { white-space: pre-wrap; }
.cal-attendees { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cal-attendee { display: flex; gap: 8px; align-items: center; }
.cal-attendee small { color: var(--muted); margin-left: auto; }
.cal-note .crm-mark .nav-icon { width: 18px; height: 18px; }

@media (max-width: 760px) {
  .cal-page { height: calc(100vh - 241px); }
  .cal-mode-day .cal-head, .cal-mode-day .cal-grid { grid-template-columns: 44px 1fr !important; }
  .cal-mode-week .cal-head, .cal-mode-week .cal-grid { grid-template-columns: 44px repeat(7, minmax(44px, 1fr)) !important; }
  .cal-mode-week .cal-body, .cal-mode-week .cal-head { overflow-x: auto; }
  .cal-day-head { padding: 6px 4px; }
  .cal-date { font-size: 16px; }
  .cal-event { padding: 2px 4px; font-size: 11px; }
  .cal-event strong { padding-right: 0; }
  .cal-month-grid { grid-auto-rows: minmax(64px, 1fr); }
  .cal-line-time { display: none; }
}

/* Calls (TRK-241 to TRK-246): a dark window over the app, like Teams. A bar on top, the people below,
   and when someone presents, their screen fills the stage with everyone's tiles in a column on the right. */
:root {
  /* Light themes (TRK-268): a pale stage and a white bar, like Teams in its light theme */
  --call-bg: #ebebef;
  --call-bar: #ffffff;
  --call-tile: #d9d9e0;
  --call-text: #1f1f24;
  --call-muted: #5d5d68;
  --call-on: #5b5fc7;
  --call-leave: #c4314b;
  --call-hand: #d29b00;
  --call-line: rgb(0 0 0 / 0.12);
  --call-hover: rgb(0 0 0 / 0.05);
  --call-outline: rgb(0 0 0 / 0.28);
  --call-shadow: 0 6px 20px rgb(0 0 0 / 0.16);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --call-bg: #1b1b1f; --call-bar: #29292e; --call-tile: #34343a; --call-text: #f5f5f7; --call-muted: #b4b4bc;
    --call-on: #7f85f5; --call-hand: #f2c94c; --call-line: rgb(255 255 255 / 0.14); --call-hover: rgb(255 255 255 / 0.08);
    --call-outline: rgb(255 255 255 / 0.4); --call-shadow: 0 6px 20px rgb(0 0 0 / 0.45);
  }
}
:root[data-theme="dark"],
:root[data-theme="graphite"],
:root[data-theme="midnight"],
:root[data-theme="onyx"],
:root[data-theme="contrast-dark"] {
  --call-bg: #1b1b1f; --call-bar: #29292e; --call-tile: #34343a; --call-text: #f5f5f7; --call-muted: #b4b4bc;
  --call-on: #7f85f5; --call-hand: #f2c94c; --call-line: rgb(255 255 255 / 0.14); --call-hover: rgb(255 255 255 / 0.08);
  --call-outline: rgb(255 255 255 / 0.4); --call-shadow: 0 6px 20px rgb(0 0 0 / 0.45);
}
.call-ring {
  position: fixed; right: 20px; bottom: 20px; z-index: 1001;
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; max-width: calc(100vw - 32px);
  background: var(--call-bar); color: var(--call-text); border-radius: 12px; box-shadow: 0 10px 30px rgb(0 0 0 / 0.35);
  animation: call-ring-in 0.2s ease-out;
}
.call-ring-text { display: grid; }
.call-ring-text span { color: var(--call-muted); font-size: 13px; }
.call-ring-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.call-ring button, .call-presenting-bar button { border: 0; border-radius: 6px; padding: 7px 12px; color: var(--call-text); background: var(--call-tile); cursor: pointer; }
.call-ring .call-accept { background: #237b4b; }
.call-ring .call-decline { background: var(--call-leave); }
@keyframes call-ring-in { from { transform: translateY(20px); opacity: 0; } }

/* Choosing devices (TRK-250): the preview before joining, and the Devices panel in a call */
/* The join screen before a call (TRK-269), like Teams': who you are, the title, the camera on the left,
   audio choices on the right, and Join now at the bottom. It follows the call window's light or dark colours. */
.call-join {
  position: fixed; inset: 0; z-index: 1002; overflow: auto; display: grid; justify-items: center; align-items: start;
  padding: 28px 16px; background: var(--call-bg); color: var(--call-text);
}
.call-join-page { width: min(960px, 100%); display: grid; gap: 18px; }
.call-join-wait { text-align: center; color: var(--call-muted); margin-top: 20vh; }
.call-join .nav-icon { width: 18px; height: 18px; stroke-width: 1.6; flex: none; }
.call-join-me {
  justify-self: center; display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; max-width: 100%;
  border-radius: 10px; background: var(--call-bar); border: 1px solid var(--call-line);
}
.call-join-me .avatar { width: 36px; height: 36px; font-size: 14px; }
.call-join-who { display: grid; min-width: 0; }
.call-join-who strong { font-size: 13px; }
.call-join-who small { color: var(--call-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.call-join-title { margin: 0; text-align: center; font-size: 24px; font-weight: 600; overflow-wrap: anywhere; }
.call-join-main { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.call-join-video { border-radius: 12px; overflow: hidden; background: var(--call-bar); border: 1px solid var(--call-line); }
.call-join-preview { position: relative; aspect-ratio: 16 / 9; display: grid; place-items: center; background: var(--call-tile); }
.call-join-preview video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.call-join-off { display: grid; justify-items: center; gap: 10px; color: var(--call-muted); font-size: 13px; }
.call-join-off .nav-icon { width: 40px; height: 40px; stroke-width: 1.3; }
.call-join-bar, .call-join-row { display: flex; align-items: center; gap: 10px; }
.call-join-bar { padding: 10px 12px; }
.call-join-select { position: relative; flex: 1; min-width: 0; display: flex; }
.call-join-select select {
  appearance: none; width: 100%; min-width: 0; padding: 6px 28px 6px 10px; border-radius: 6px; border: 1px solid var(--call-line);
  background: transparent; color: inherit; font: inherit; font-size: 13px; text-overflow: ellipsis; cursor: pointer;
}
.call-join-select select option { background: var(--call-bar); color: var(--call-text); }
.call-join-select select::picker(select) { background: var(--call-bar); color: var(--call-text); border-color: var(--call-line); }
.call-join-select select option { color: var(--call-text); }
.call-join-select select option:hover, .call-join-select select option:focus-visible { background: var(--call-hover); color: var(--call-text); }
.call-join-select select::picker-icon { display: none; } /* it draws its own chevron */
.call-join-select .nav-icon { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; pointer-events: none; color: var(--call-muted); }
.call-switch {
  position: relative; flex: none; width: 40px; height: 22px; padding: 0; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--call-muted); background: transparent;
}
.call-switch-knob { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--call-muted); transition: transform 0.15s; }
.call-switch[aria-checked="true"] { background: var(--call-on); border-color: var(--call-on); }
.call-switch[aria-checked="true"] .call-switch-knob { background: #fff; transform: translateX(18px); }
.call-switch:focus-visible, .call-join-select select:focus-visible, .call-join-actions button:focus-visible { outline: 2px solid var(--call-on); outline-offset: 2px; }
.call-join-audio { display: grid; gap: 10px; }
.call-join-card { display: grid; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--call-bar); border: 1px solid var(--call-line); }
.call-join-card.call-join-picked { border-color: var(--call-on); }
.call-join-radio { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 13px; cursor: pointer; }
.call-join-radio input { accent-color: var(--call-on); width: 16px; height: 16px; margin: 0; }
.call-join-test { justify-self: start; padding: 0; border: 0; background: none; color: var(--call-on); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }
.call-join-actions { display: flex; justify-content: flex-end; gap: 8px; }
.call-join-actions button { padding: 8px 20px; border-radius: 6px; border: 1px solid var(--call-line); background: var(--call-bar); color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.call-join-actions .primary { background: var(--call-on); border-color: var(--call-on); color: #fff; }
@media (max-width: 760px) {
  .call-join { padding: 16px 12px; }
  .call-join-main { grid-template-columns: 1fr; }
  .call-join-title { font-size: 20px; }
  .call-join-actions button { flex: 1; }
}
.call-level { height: 6px; border-radius: 3px; background: var(--call-tile); overflow: hidden; }
.call-level-fill { display: block; height: 100%; width: 0; background: #3fb950; transition: width 0.08s linear; }

body.in-call { overflow: hidden; }
.call-window {
  position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column;
  background: var(--call-bg); color: var(--call-text);
}
.call-window.call-mini { inset: auto 16px 16px auto; width: 380px; height: auto; border-radius: 12px; overflow: hidden; border: 1px solid var(--call-line); box-shadow: 0 10px 30px rgb(0 0 0 / 0.4); }
.call-window.call-mini .call-label, .call-window.call-mini .call-panel { display: none; }
.call-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 12px; background: var(--call-bar); min-height: 56px; flex-wrap: wrap;
  position: relative; z-index: 4; /* its menus open over the people below */
}
.call-when { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.call-clock { font-variant-numeric: tabular-nums; font-weight: 600; }
/* Recording (TRK-247): a red dot and who records, for everyone in the call */
.call-rec { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; background: rgba(196, 49, 75, 0.18); color: #ff8a9b; font-size: 12px; font-weight: 600; white-space: nowrap; }
.call-rec-dot { width: 8px; height: 8px; border-radius: 50%; background: #e5484d; animation: call-rec-pulse 1.6s ease-in-out infinite; }
@keyframes call-rec-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .call-rec-dot { animation: none; } }
/* TRK-675: the meeting organiser's Claude listening in the call */
.call-agent { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--call-text) 12%, transparent); color: var(--call-text); font-size: 12px; font-weight: 600; white-space: nowrap; }
.call-agent-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: 0.8; }
/* TRK-679: below 1280px the pill shrinks to its dot, with the words in its tooltip, so the bar stays on one row */
@media (max-width: 1279px) {
  .call-agent { padding: 4px; }
  .call-agent-text { display: none; }
}
.call-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.call-btn:disabled:hover { background: transparent; }
.call-title { color: var(--call-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
.call-buttons { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
/* The bar's buttons (TRK-268): a thin line icon over a small label. Active ones get a rounded outline. */
.call-btn {
  display: grid; justify-items: center; gap: 3px; min-width: 52px; padding: 6px 8px;
  border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--call-text); cursor: pointer; font-size: 11px; line-height: 1.1;
}
.call-btn:hover { background: var(--call-hover); }
.call-btn:focus-visible, .call-chevron:focus-visible { outline: 2px solid var(--call-on); outline-offset: 1px; }
.call-btn.call-on { border-color: var(--call-outline); background: var(--call-hover); }
.call-btn.call-on .call-glyph { color: var(--call-on); }
.call-btn.call-leave { flex-direction: row; background: var(--call-leave); color: #fff; padding: 6px 16px; margin-left: 4px; }
.call-btn.call-leave:hover { background: #a4283e; }
.call-glyph { position: relative; display: grid; place-items: center; height: 20px; }
.call-glyph .nav-icon { width: 20px; height: 20px; stroke-width: 1.5; }
.call-badge {
  position: absolute; top: -5px; right: -9px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px;
  background: var(--call-tile); color: var(--call-text); font-size: 10px; line-height: 15px; text-align: center;
}
.call-sep { width: 1px; height: 32px; background: var(--call-line); margin: 0 6px; }
.call-split { position: relative; display: inline-flex; align-items: stretch; }
.call-split .call-btn { border-top-right-radius: 0; border-bottom-right-radius: 0; padding-right: 4px; }
.call-chevron {
  display: grid; place-items: center; width: 18px; padding: 0; border: 1px solid transparent; border-left: 0;
  border-radius: 0 8px 8px 0; background: transparent; color: var(--call-muted); cursor: pointer;
}
.call-chevron .nav-icon { width: 13px; height: 13px; stroke-width: 2; }
.call-chevron:hover { background: var(--call-hover); color: var(--call-text); }
.call-chevron.call-on { border-color: var(--call-outline); background: var(--call-hover); }
.call-device-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 3; width: max-content; min-width: 230px; max-width: min(320px, 90vw);
  display: grid; padding: 6px; border-radius: 10px; background: var(--call-bar); color: var(--call-text);
  border: 1px solid var(--call-line); box-shadow: var(--call-shadow);
}
.call-menu-head { margin: 6px 8px 4px; font-size: 11px; font-weight: 600; color: var(--call-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.call-device-menu > p.call-muted { margin: 4px 8px; font-size: 12px; }
.call-device-menu button {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border: 0; border-radius: 6px;
  background: transparent; color: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.call-device-menu button:hover { background: var(--call-hover); }
.call-menu-tick { display: grid; place-items: center; width: 16px; flex: none; color: var(--call-on); }
.call-menu-tick .nav-icon { width: 15px; height: 15px; stroke-width: 2; }
/* TRK-706: Claude's voice under the speaker: a list of this browser's voices and a button that plays a sample */
.call-menu-voice { display: flex; align-items: center; gap: 6px; padding: 2px 8px 6px; }
.call-device-menu .call-menu-sample { flex: none; justify-content: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--call-line); }
.call-menu-sample .nav-icon { width: 15px; height: 15px; }
.call-menu-sample:focus-visible { outline: 2px solid var(--call-on); outline-offset: 2px; }
.call-name-muted { display: inline-grid; vertical-align: -2px; margin-right: 4px; }
.call-name-muted .nav-icon { width: 13px; height: 13px; }
.call-hand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--call-hand); color: #1f1f24; }
.call-hand-mark .nav-icon { width: 18px; height: 18px; }
.call-btn.call-off .call-glyph { color: var(--call-muted); }
.call-react-wrap { position: relative; }
.call-react-menu {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 6px; z-index: 2;
  display: flex; gap: 2px; padding: 6px; background: var(--call-bar); border-radius: 10px; box-shadow: 0 6px 20px rgb(0 0 0 / 0.4);
}
.call-react-menu[hidden] { display: none; }
.call-react-menu button { border: 0; background: transparent; font-size: 22px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.call-react-menu button:hover { background: var(--call-hover); }

.call-main { flex: 1; display: flex; min-height: 0; }
.call-stage { flex: 1; min-width: 0; padding: 12px; display: flex; position: relative; }
.call-stage > * { flex: 1; min-height: 0; }
.call-panel { width: 280px; border-left: 1px solid var(--call-line); padding: 14px; overflow: auto; background: var(--call-bar); }
.call-panel[hidden] { display: none; }
.call-panel h2 { font-size: 15px; margin: 0 0 10px; }
/* The call's chat (TRK-251): messages fill the panel, the box to write stays at the bottom */
.call-panel[data-kind="chat"] { display: flex; flex-direction: column; gap: 10px; width: 320px; padding-bottom: 12px; }
.call-panel[data-kind="chat"][hidden] { display: none; }
.call-chat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.call-chat-top h2 { margin: 0; }
.call-agent-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px; border: 1px solid var(--call-line); border-radius: 8px; font-size: 13px; color: var(--call-text); }
.call-agent-row[hidden] { display: none; }
.call-agent-row button { flex: none; font-size: 12px; padding: 4px 10px; border-radius: 6px; }
.call-agent-actions { display: flex; flex: none; gap: 6px; }
/* TRK-710: three buttons don't fit beside the text in the panel, so they go on their own line below it */
.call-agent-row { flex-wrap: wrap; }
.call-agent-row > span:first-child { flex: 1 1 100%; }
.call-agent-row > .call-agent-actions { flex: 1 1 100%; min-width: 0; flex-wrap: wrap; }
.call-agent-actions:empty { display: none; }
/* TRK-710: the organiser picks the agent's wake word in the row itself */
.call-wake-form { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.call-wake-form label { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.call-wake-input { flex: 1; min-width: 0; font: inherit; font-weight: 400; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--call-line); background: var(--call-tile); color: var(--call-text); }
.call-wake-form small { font-size: 12px; line-height: 1.35; }
.call-wake-form .call-agent-actions { justify-content: flex-end; }
.call-chat-open { font-size: 12px; padding: 3px 8px; background: none; color: var(--call-text); border: 1px solid var(--call-line); border-radius: 6px; }
.call-chat-list { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.call-chat-msg { padding: 6px 8px; border-radius: 8px; background: color-mix(in srgb, var(--call-text) 6%, transparent); margin-top: 6px; }
.call-chat-msg.more { margin-top: 0; }
.call-chat-msg.mine { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.call-chat-head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 2px; }
.call-chat-head small { color: var(--call-muted); }
.call-chat-spoken { display: block; color: var(--call-muted); font-size: 11px; margin-bottom: 2px; } /* TRK-685 */
.call-chat-msg p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.call-chat-form { display: flex; gap: 6px; align-items: flex-end; }
.call-chat-input { flex: 1; min-width: 0; resize: none; font: inherit; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--call-line); background: var(--call-tile); color: var(--call-text); }
@media (max-width: 600px) {
  /* On a phone the chat fills the call; Chat again goes back to the people */
  .call-panel[data-kind="chat"] { width: auto; flex: 1; border-left: 0; }
  .call-main:has(.call-panel[data-kind="chat"]:not([hidden])) .call-stage { display: none; }
}
.call-people { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.call-people li { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.call-people small { grid-column: 2; color: var(--call-muted); }
.call-muted { color: var(--call-muted); font-size: 13px; }

.call-grid { display: grid; gap: 10px; align-content: stretch; position: relative; }
.call-grid.call-n2 { grid-template-columns: 1fr 1fr; }
.call-grid.call-n3, .call-grid.call-n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.call-grid.call-n9 { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; }
.call-grid.call-n16 { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 1fr; }
.call-waiting { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 8px 14px; border-radius: 20px; background: rgb(0 0 0 / 0.5); color: var(--call-text); }
.call-tile {
  position: relative; display: flex; align-items: center; justify-content: center; min-height: 120px;
  background: var(--call-tile); border-radius: 10px; overflow: hidden; outline: 2px solid transparent; outline-offset: -2px;
}
.call-tile.call-hand { outline-color: var(--call-hand); }
.call-tile video { width: 100%; height: 100%; object-fit: cover; }
.call-tile video.call-hidden, .call-hidden { display: none; }
.call-avatar .avatar { width: 72px; height: 72px; font-size: 28px; }
.call-name {
  position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); padding: 3px 8px; border-radius: 6px;
  background: rgb(0 0 0 / 0.55); color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.call-hand-mark { position: absolute; top: 8px; right: 8px; }
/* A connection that failed says so over the tile (TRK-418) */
.call-trouble {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 16px; text-align: center; background: rgb(0 0 0 / 0.7); color: #fff; font-size: 13px; z-index: 2;
}
.call-trouble strong { font-size: 15px; }
/* Reactions float in a layer of their own over the call, one element each (TRK-473) */
.call-floats { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.call-float { position: absolute; font-size: 40px; animation: call-float 3s ease-out forwards; pointer-events: none; }
@keyframes call-float { from { transform: translate(-50%, 0); opacity: 1; } to { transform: translate(-50%, -120px); opacity: 0; } }

/* TRK-681: the organiser's Claude as a tile, in black and white: its avatar in a turning ring and a line saying what it's doing */
.call-agent-tile { flex-direction: column; gap: 12px; padding: 12px 12px 40px; }
.call-agent-face { position: relative; display: grid; place-items: center; width: 96px; height: 96px; }
.call-agent-face .avatar { width: 72px; height: 72px; font-size: 28px; background: var(--call-text); color: var(--call-tile); }
.call-agent-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--call-text) 0 12%, transparent 12% 25%, var(--call-text) 25% 37%, transparent 37% 50%, var(--call-text) 50% 62%, transparent 62% 75%, var(--call-text) 75% 87%, transparent 87%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  opacity: 0.55; animation: call-agent-turn 8s linear infinite;
}
.call-agent-tile[data-doing="working"] .call-agent-ring { opacity: 1; animation-duration: 1.6s; }
.call-agent-tile[data-doing="off"] .call-agent-ring { opacity: 0.25; animation: none; }
@keyframes call-agent-turn { to { transform: rotate(360deg); } }
.call-agent-doing {
  margin: 0; max-width: 100%; color: var(--call-text); font-size: 14px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.call-column .call-agent-tile { gap: 6px; padding: 8px 8px 32px; }
.call-column .call-agent-face { width: 56px; height: 56px; }
.call-column .call-agent-face .avatar { width: 44px; height: 44px; font-size: 18px; }
.call-column .call-agent-doing { font-size: 12px; }
/* TRK-686: while Claude speaks its tile pulses and a caption with its name shows the words over the stage */
.call-agent-face::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--call-text); opacity: 0; pointer-events: none;
}
.call-agent-tile[data-speaking="true"] { outline-color: var(--call-text); }
.call-agent-tile[data-speaking="true"] .call-agent-face::after { animation: call-agent-pulse 1.2s cubic-bezier(0.23, 1, 0.32, 1) infinite; }
@keyframes call-agent-pulse { from { transform: scale(1); opacity: 0.6; } to { transform: scale(1.22); opacity: 0; } }
.call-agent-mute {
  position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 50%; background: rgb(0 0 0 / 0.45); color: #fff; cursor: pointer; transition: background-color 150ms ease, transform 120ms ease;
}
.call-agent-mute .nav-icon { width: 18px; height: 18px; }
.call-agent-mute[aria-pressed="true"] { background: var(--call-leave); }
.call-agent-mute:active { transform: scale(0.95); }
.call-agent-mute:focus-visible { outline: 2px solid var(--call-on); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .call-agent-mute:hover { background: rgb(0 0 0 / 0.65); }
  .call-agent-mute[aria-pressed="true"]:hover { background: color-mix(in srgb, var(--call-leave) 85%, #000); }
}
.call-caption {
  position: absolute; left: 50%; bottom: 20px; z-index: 4; display: flex; align-items: flex-start; gap: 10px;
  width: max-content; max-width: min(560px, calc(100% - 32px)); padding: 10px 14px; border-radius: 12px;
  background: rgb(0 0 0 / 0.78); color: #fff; box-shadow: var(--call-shadow); pointer-events: none;
  transform: translateX(-50%); animation: call-caption-in 200ms cubic-bezier(0.23, 1, 0.32, 1);
}
.call-caption-mark { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #fff; color: #111; }
.call-caption-mark .nav-icon { width: 16px; height: 16px; }
.call-caption > div { min-width: 0; }
.call-caption strong { display: block; font-size: 12px; font-weight: 600; opacity: 0.75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-caption p { margin: 2px 0 0; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; text-wrap: pretty; }
@keyframes call-caption-in { from { opacity: 0; transform: translate(-50%, 6px); } }
@media (prefers-reduced-motion: reduce) {
  .call-agent-ring { animation: none; }
  .call-agent-tile[data-speaking="true"] .call-agent-face::after { animation: none; opacity: 0.6; }
  .call-caption { animation: none; }
}

/* Someone presenting: their screen large, everyone's tiles in a column on the right */
.call-presenting, .call-speaker { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 10px; }
.call-screen-wrap { position: relative; display: flex; flex-direction: column; min-height: 0; background: #000; border-radius: 10px; overflow: hidden; }
.call-screen { flex: 1; width: 100%; min-height: 0; object-fit: contain; background: #000; }
/* The bar sits on the black stage in both themes, so its words are always light (TRK-693: they were dark on black in light themes) */
.call-presenting-bar { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 6px; background: rgb(255 255 255 / 0.1); color: #f5f5f7; font-size: 13px; }
.call-presenting-bar button { background: var(--call-leave); color: #fff; padding: 4px 10px; }
/* TRK-693: Claude's screen share, before its picture arrives: its moving ring and a line, on the black stage */
.call-presenting-what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-screen-waiting { --call-text: #f5f5f7; position: relative; display: grid; place-items: center; align-content: center; gap: 14px; color: #c9c9d1; font-size: 14px; text-align: center; padding: 16px; }
.call-screen-waiting .call-agent-ring { position: relative; inset: auto; width: 56px; height: 56px; opacity: 1; animation-duration: 1.6s; }
.call-column { display: flex; flex-direction: column; gap: 8px; overflow: auto; min-height: 0; }
.call-column .call-tile { flex: 0 0 auto; aspect-ratio: 16 / 10; min-height: 0; }
.call-column .call-avatar .avatar { width: 44px; height: 44px; font-size: 18px; }

/* Chat header buttons */
.call-start { display: inline-flex; gap: 4px; }
.call-join-btn { background: #237b4b; color: #fff; border-color: #237b4b; }
.call-live-mark { color: var(--pass); font-weight: 600; font-size: 13px; }

@media (max-width: 760px) {
  .call-label, .call-title { display: none; }
  /* On a phone the clock gets its own line and every button fits on one row below it (TRK-268) */
  .call-bar { gap: 2px; padding: 4px 8px 6px; }
  .call-when { width: 100%; }
  .call-buttons { width: 100%; flex-wrap: nowrap; justify-content: space-between; gap: 0; }
  .call-btn { min-width: 0; padding: 6px 5px; }
  .call-btn.call-leave { padding: 6px 10px; margin-left: 2px; }
  .call-chevron { width: 14px; }
  .call-sep { height: 24px; margin: 0 2px; }
  /* A device menu spans the bar's width, under it, instead of hanging off its small button */
  .call-split { position: static; }
  .call-device-menu { left: 8px; right: 8px; width: auto; max-width: none; }
  .call-presenting, .call-speaker { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) 110px; }
  .call-column { flex-direction: row; }
  .call-column .call-tile { height: 100%; aspect-ratio: 4 / 3; }
  .call-grid.call-n2 { grid-template-columns: 1fr; }
  .call-grid.call-n9, .call-grid.call-n16 { grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(120px, 1fr); overflow-y: auto; }
  .call-panel { position: absolute; inset: 56px 0 0 auto; width: min(280px, 80vw); }
  .call-window.call-mini { width: calc(100vw - 32px); bottom: calc(96px + env(safe-area-inset-bottom)); } /* above the bottom menu */
}
.call-window.call-mini .call-sep, .call-window.call-mini .call-chevron, .call-window.call-mini .call-badge { display: none; }
/* The call as a small bar (TRK-398): its top row moves it, then what's happening, then icon buttons */
.call-window.call-mini .call-bar { flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 4px; min-height: 0; padding: 6px 10px 8px; }
.call-mini-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: grab; touch-action: none; user-select: none; }
.call-mini-top:active { cursor: grabbing; }
.call-window.call-mini .call-title { max-width: 170px; }
.call-status { padding: 4px 2px 10px; font-size: 15px; border-bottom: 1px solid var(--call-line); overflow-wrap: anywhere; }
.call-window.call-mini .call-buttons { justify-content: space-between; flex-wrap: nowrap; padding-top: 4px; }
.call-window.call-mini .call-btn { min-width: 36px; padding: 6px; }
.call-window.call-mini .call-btn.call-leave { padding: 6px 10px; }
/* Out of sight but still in the page, so the people's sound goes on */
.call-window.call-mini .call-main { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
/* TRK-684: the call beside a whiteboard: a compact window with the board's name, Claude's tile, faces and "N others" */
.call-window.call-compact { width: 288px; overflow: visible; } /* the settings menu opens above it */
.call-window.call-compact .call-bar { gap: 8px; padding: 6px 10px 10px; border-radius: inherit; }
.call-compact-top { display: flex; align-items: center; gap: 6px; cursor: grab; touch-action: none; user-select: none; }
.call-compact-top:active { cursor: grabbing; }
.call-compact-top .call-clock { margin-left: auto; font-size: 13px; color: var(--call-muted); }
.call-compact-board {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; padding: 4px 6px; margin-left: -6px; border: 0; border-radius: 6px;
  background: none; color: inherit; font: inherit; font-weight: 600; cursor: pointer;
}
.call-compact-board span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-compact-board .nav-icon { width: 16px; height: 16px; flex-shrink: 0; }
.call-compact-board:hover { background: var(--call-hover); }
.call-compact-board:focus-visible, .call-compact-down:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.call-window.call-compact .call-agent-tile { min-height: 0; gap: 4px; padding: 10px 8px 40px; }
.call-window.call-compact .call-agent-face { width: 64px; height: 64px; }
.call-window.call-compact .call-agent-face .avatar { width: 48px; height: 48px; font-size: 18px; }
.call-window.call-compact .call-agent-doing { font-size: 13px; }
.call-compact-people { display: flex; align-items: center; gap: 4px; min-height: 32px; }
.call-compact-people .avatar { width: 28px; height: 28px; font-size: 11px; flex-shrink: 0; box-shadow: 0 0 0 2px var(--call-bar); }
.call-compact-people .avatar + .avatar { margin-left: -8px; }
.call-compact-count { margin-left: 6px; color: var(--call-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.call-window.call-compact .call-buttons { padding-top: 6px; border-top: 1px solid var(--call-line); }
.call-window.call-compact .call-device-menu { bottom: calc(100% + 6px); top: auto; left: 0; }
.call-compact-down {
  align-self: center; padding: 2px 6px; border: 0; border-radius: 6px; background: none; color: var(--call-muted);
  font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.call-compact-down:hover { color: var(--call-text); }
@media (max-width: 760px) {
  .call-window.call-compact { width: min(288px, calc(100vw - 32px)); }
}
.call-bar-end { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.call-sizes { display: flex; align-items: center; gap: 2px; }
.call-bar-end .call-sizes { padding-left: 8px; border-left: 1px solid var(--call-line); }
.call-size { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 6px; background: none; color: inherit; cursor: pointer; }
.call-size:hover { background: var(--call-hover); }
.call-size:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.call-size .nav-icon { width: 18px; height: 18px; }
/* Maximized: the whole browser window, edge to edge */
.call-window.call-max:not(.call-mini) { inset: 0; border: 0; border-radius: 0; box-shadow: none; }
/* On a phone the usual window already fills the screen, so only Minimize and Restore make sense */
@media (max-width: 760px) {
  .call-size[data-size="max"], .call-window:not(.call-mini) .call-size[data-size="normal"] { display: none; }
}

/* A meeting's guest link in its details (TRK-254) */
.cal-link { display: flex; align-items: center; gap: 6px; margin: 8px 0; }
/* A meeting's recordings (TRK-247): each row opens its player on click and closes it on the next */
.cal-recordings { margin: 8px 0; }
.cal-recordings h3 { font-size: 13px; margin: 0 0 4px; }
.cal-recordings ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.cal-rec-row { display: flex; align-items: center; gap: 6px; }
.cal-rec-open { flex: 1; min-width: 0; text-align: left; background: transparent; border: 0; padding: 4px 0; cursor: pointer; color: inherit; }
.cal-rec-open small { color: var(--muted, #888); margin-left: 6px; }
.cal-rec-video { width: 100%; max-height: 50vh; background: #000; border-radius: 6px; margin-top: 4px; }
.rec-group { border-top: 1px solid var(--border); padding: 6px 0; } /* TRK-708: the Recordings list in Docs */
.rec-meeting { display: flex; align-items: center; gap: 6px; width: 100%; background: transparent; border: 0; padding: 6px 0; cursor: pointer; color: inherit; font-weight: 600; text-align: left; overflow-wrap: anywhere; }
.rec-meeting small { color: var(--muted, #888); font-weight: 400; margin-left: auto; white-space: nowrap; }
.rec-meeting .chevron { display: inline-flex; transition: transform 0.15s; transform: rotate(-90deg); }
.rec-meeting[aria-expanded="true"] .chevron { transform: none; }
.rec-list { list-style: none; margin: 0 0 4px; padding: 0 0 0 22px; display: grid; gap: 4px; }
.rec-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rec-row .button { display: inline-flex; align-items: center; gap: 4px; }
.rec-open { flex: 1; min-width: 12rem; text-align: left; background: transparent; border: 0; padding: 4px 0; cursor: pointer; color: inherit; }
.rec-open small { color: var(--muted, #888); margin-left: 6px; }
.rec-video { width: 100%; max-height: 50vh; background: #000; border-radius: 6px; margin-top: 4px; }
.rec-missing { color: var(--danger, #c33); }
.rec-keep { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 8px; font-size: 13px; } /* TRK-709: how long recordings are kept */
.rec-keep select { width: auto; }
.rec-pin[aria-pressed="true"] { background: var(--sunken); border-color: var(--accent); color: var(--accent); }
.rec-pinned { color: var(--muted, #888); font-size: 13px; }
.cal-link input { flex: 1; min-width: 0; font-size: 13px; color: var(--selected-text); background: var(--sunken); }

/* The guest page a meeting link opens (TRK-254) */
body.meet-body { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--bg); color: var(--text); margin: 0; }
.meet-card { width: min(440px, 100%); padding: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.meet-card[hidden] { display: none; }
.meet-card h1 { font-size: 22px; margin: 4px 0 6px; overflow-wrap: anywhere; }
.meet-brand { margin: 0; color: var(--accent); font-weight: 600; font-size: 13px; }
.meet-muted { color: var(--muted); margin: 4px 0 12px; }
.meet-live { color: var(--pass); font-weight: 600; }
.meet-form { display: grid; gap: 6px; margin-top: 16px; }
.meet-form input { font-size: 15px; padding: 9px 10px; }
.meet-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* ---- Google Calendar events (TRK-255): green, like Google's own default, and read-only ---- */
.cal-event.cal-google { background: var(--cal-google); border-left-color: var(--cal-google-edge); }
.cal-line.cal-google { background: var(--cal-google); box-shadow: inset 3px 0 0 var(--cal-google-edge); }
.cal-allday { display: grid; border-bottom: 1px solid var(--border); padding-right: var(--cal-scrollbar, 0); }
.cal-allday-label { color: var(--muted); font-size: 12px; padding: 6px 8px; text-align: right; }
.cal-allday-day { display: flex; flex-direction: column; gap: 2px; padding: 3px; border-left: 1px solid var(--border); min-width: 0; }
.cal-allday-day .cal-line { width: 100%; }
.cal-google-note { font-size: 13px; }
.cal-google-form { max-width: 520px; }
.cal-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.cal-google-paste { display: flex; gap: 8px; }
.cal-google-paste input { flex: 1; min-width: 0; }
.cal-google-head { margin: 14px 0 4px; font-size: 13px; font-weight: 600; }
.cal-google-head:first-of-type { margin-top: 4px; }
.cal-error { color: var(--danger, #d13438); }

/* Icon cards (TRK-264): a clean white card, a deep coloured badge with a white line icon, a bold name and a muted detail */
.wb-badge.yellow, .wb-badge-top.yellow, .wb-badge-bottom.yellow { --wb-b: #e0a100; }
.wb-badge.orange, .wb-badge-top.orange, .wb-badge-bottom.orange { --wb-b: #ec6f1c; }
.wb-badge.pink, .wb-badge-top.pink, .wb-badge-bottom.pink { --wb-b: #db3f86; }
.wb-badge.purple, .wb-badge-top.purple, .wb-badge-bottom.purple { --wb-b: #7b4fe0; }
.wb-badge.blue, .wb-badge-top.blue, .wb-badge-bottom.blue { --wb-b: #2f6fe4; }
.wb-badge.green, .wb-badge-top.green, .wb-badge-bottom.green { --wb-b: #16a06e; }
.wb-badge.gray, .wb-badge-top.gray, .wb-badge-bottom.gray { --wb-b: #5d6879; }
.wb-badge.red, .wb-badge-top.red, .wb-badge-bottom.red { --wb-b: #d9483b; }
.wb-badge.forest, .wb-badge-top.forest, .wb-badge-bottom.forest { --wb-b: #2f8a62; }
.wb-badge.azure, .wb-badge-top.azure, .wb-badge-bottom.azure { --wb-b: #1f7ad6; }
.wb-badge.violet, .wb-badge-top.violet, .wb-badge-bottom.violet { --wb-b: #6a4fd6; }
.wb-badge.slate, .wb-badge-top.slate, .wb-badge-bottom.slate { --wb-b: #3d4452; }
.wb-badge.white, .wb-badge-top.white, .wb-badge-bottom.white { --wb-b: #2a3244; }
.wb-badge-top { stop-color: color-mix(in srgb, var(--wb-b) 78%, #ffffff); }
.wb-badge-bottom { stop-color: color-mix(in srgb, var(--wb-b) 82%, #0f1729); }

.wb-badge-back {
  filter: drop-shadow(0 2px 3px color-mix(in srgb, var(--wb-b) 45%, transparent));
}

.wb-badge-icon {
  fill: none;
  stroke: #ffffff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

.wb-fill.wb-card {
  stroke: color-mix(in srgb, #1c2230 14%, #ffffff);
  stroke-width: 1;
}

.wb-text.wb-card-words {
  flex-direction: column;
  gap: 3px;
  text-align: left;
}

.wb-text.wb-card-words strong {
  font-weight: 650;
  letter-spacing: -0.01em;
}

.wb-text.wb-card-words small {
  color: color-mix(in srgb, var(--wb-ink) 62%, #ffffff);
  font-size: 0.8em;
  line-height: 1.3;
}

.wb-world.far .wb-badge-back {
  filter: none;
}

.wb-icon-button {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.wb-icon-button svg,
.wb-icon-grid svg {
  fill: none;
  height: 20px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
  width: 20px;
}

/* Fills the dialog rather than the screen, or on a phone it spills past the dialog's padding (TRK-273) */
.wb-icon-picker {
  min-width: 0;
  width: 100%;
}

/* Cloud icons (TRK-271): the provider's own picture on a white tile, edged in the card's colour */
.wb-badge-tile {
  fill: #ffffff;
  stroke: color-mix(in srgb, var(--wb-b) 55%, #ffffff);
  stroke-width: 1.5;
  filter: drop-shadow(0 2px 3px color-mix(in srgb, var(--wb-b) 25%, transparent));
}

.wb-world.far .wb-badge-tile {
  filter: none;
}

.wb-icon-button img,
.wb-icon-grid img {
  height: 28px;
  object-fit: contain;
  width: 28px;
}

.wb-icon-button img {
  height: 20px;
  width: 20px;
}

.wb-icon-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.wb-icon-tabs button {
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  padding: 4px 12px;
}

.wb-icon-tabs button[aria-selected="true"] {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  font-weight: 600;
}

.wb-icon-group {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  grid-column: 1 / -1;
  margin: 8px 2px 0;
}

.wb-icon-picker input[type="search"] {
  width: 100%;
}

.wb-icon-grid button.wb-cloud-icon {
  text-transform: none;
}

.wb-icon-credit {
  font-size: 12px;
  margin: 0;
}

.wb-icon-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  max-height: min(420px, 60vh);
  min-height: 96px;
  overflow-y: auto;
  padding: 2px;
}

.wb-icon-grid button {
  align-items: center;
  overflow-wrap: anywhere;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  font-size: 12px;
  gap: 6px;
  padding: 10px 4px;
  text-transform: capitalize;
}

.wb-icon-grid button:hover,
.wb-icon-grid button[aria-pressed="true"] {
  border-color: var(--accent, #2f6fe4);
  color: var(--accent, #2f6fe4);
}

/* Settings tabs with line icons (TRK-276) */
.settings-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.settings-tabs .nav-icon {
  width: 17px;
  height: 17px;
}

/* A member's name keeps room on a phone; their buttons wrap below it instead */
.team-row .work-text {
  flex: 1 1 160px;
}

/* Dashboard (TRK-277) */
.dashboard-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
/* Switching between named dashboards (TRK-515): the page title opens the menu */
.dashboard-switch > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 2px 8px 2px 0;
  border: 0;
  background: none;
  cursor: pointer;
  min-width: 0;
}
.dashboard-switch > summary h1 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(60vw, 520px);
}
.dashboard-switch > summary .caret {
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}
.dashboard-switch > summary:hover .caret {
  color: var(--text);
}
.dashboard-switch-panel {
  width: min(300px, calc(100vw - 32px));
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding: 6px;
  left: 0;
}
.dashboard-switch-panel hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 6px 0;
}
.dashboard-switch-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  text-align: left;
  font-size: 13px;
}
.dashboard-switch-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-switch-item:hover:not(:disabled) {
  background: var(--sunken);
}
.dashboard-switch-item.current {
  font-weight: 600;
}
.dashboard-switch-item.danger {
  color: var(--danger);
}
.dashboard-switch-item .nav-icon {
  width: 15px;
  height: 15px;
  flex: none;
}
.dashboard-switch-panel h3 {
  margin: 8px 8px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.dashboard-owner {
  margin-left: auto;
  padding-left: 8px;
  color: var(--muted);
  font-size: 12px;
  flex: none;
  max-width: 40%;
}
.dashboard-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: -6px 0 12px;
}
.dashboard-note .nav-icon {
  width: 14px;
  height: 14px;
}
.share-dashboard .share-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: auto;
}
.share-dashboard .share-copy .nav-icon {
  width: 15px;
  height: 15px;
}
.share-people {
  max-height: 320px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.share-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
}
.share-row select {
  width: auto;
  flex: none;
}
.share-who {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-who .nav-icon {
  width: 18px;
  height: 18px;
}
.dashboard-head .dashboard-add {
  margin-left: auto;
}
.dashboard-add > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.dashboard-add > summary .nav-icon {
  width: 15px;
  height: 15px;
}
.dashboard-picker {
  width: min(420px, calc(100vw - 32px));
  max-height: min(70vh, 560px);
  overflow-y: auto;
  right: 0;
  left: auto;
}
.dashboard-picker h3 {
  margin: 12px 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.dashboard-picker h3:first-child {
  margin-top: 0;
}
.dashboard-picker select {
  width: 100%;
  margin-bottom: 8px;
}
.widget-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.widget-choice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 13px;
}
.widget-choice .nav-icon {
  width: 14px;
  height: 14px;
}
.widget-choice.added {
  color: var(--selected-text);
  border-color: var(--accent);
  opacity: 1;
}
.dashboard > .panel[data-wide] {
  grid-column: 1 / -1;
  grid-row: span 1;
}
.dashboard .panel-tools {
  display: inline-flex;
  margin-left: auto;
}
.dashboard .panel-tools button {
  padding: 2px 7px;
}
.dashboard .project-cards {
  margin: 0;
}
/* Every widget is as tall as its content, up to 360px, and a long one scrolls inside (TRK-287, TRK-289).
   Side-by-side widgets stretch to the tallest in their row, so a row stays even without empty boxes (TRK-335). */
.panels.dashboard {
  grid-auto-rows: auto;
  align-items: stretch;
}
.dashboard > .panel {
  max-height: 360px;
}
/* The handle and remove button stay quiet until the widget is hovered or has focus (TRK-335) */
.dashboard .drag-handle,
.dashboard .panel-tools {
  opacity: 0.25;
  transition: opacity 0.15s;
}
.dashboard > .panel:hover .drag-handle,
.dashboard > .panel:hover .panel-tools,
.dashboard > .panel:focus-within .drag-handle,
.dashboard > .panel:focus-within .panel-tools {
  opacity: 1;
}
@media (hover: none) {
  .dashboard .drag-handle,
  .dashboard .panel-tools {
    opacity: 1;
  }
}
/* Project cards share the widget's width instead of leaving a gap on the right */
.dashboard .project-cards {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
/* Issue rows in a narrow widget: the title gets the width, with the time under it */
.dashboard .work-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  column-gap: 10px;
  row-gap: 2px;
  padding: 8px;
}
.dashboard .work-row .type-icon {
  grid-row: span 2;
}
.dashboard .work-row .work-text {
  overflow-wrap: break-word;
}
/* A long title takes at most two lines, ending in …; the full title shows on hover (TRK-295) */
.work-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.dashboard .work-row .avatar {
  grid-column: 3;
  grid-row: 1 / span 2;
}
.dashboard .work-row .work-when {
  grid-column: 2;
  grid-row: 2;
}

/* The join screen and the call float over the app as a window on a desktop, like Teams (TRK-282).
   On a phone they keep the whole screen. */
.call-join-titlebar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: -28px -16px 0; padding: 8px 10px 8px 18px; font-size: 13px; color: var(--call-muted);
  background: var(--call-bar); border-bottom: 1px solid var(--call-line);
}
.call-join-close {
  width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; font-size: 20px; line-height: 1;
  background: transparent; color: var(--call-text);
}
.call-join-close:hover { background: var(--call-hover); }
@media (min-width: 768px) {
  .call-join { background: rgb(0 0 0 / 0.45); align-items: center; padding: 24px; }
  .call-join-page {
    width: min(1080px, 100%); max-height: calc(100vh - 48px); overflow: auto;
    padding: 0 28px 28px; border-radius: 12px; border: 1px solid var(--call-line);
    background: var(--call-bg); box-shadow: 0 24px 60px rgb(0 0 0 / 0.45);
  }
  .call-join-titlebar { position: sticky; top: 0; z-index: 2; margin: 0 -28px; }
  .call-window:not(.call-mini) {
    inset: 24px 40px; border-radius: 12px; overflow: hidden; border: 1px solid var(--call-line);
    box-shadow: 0 0 0 100vmax rgb(0 0 0 / 0.3), 0 24px 60px rgb(0 0 0 / 0.45);
  }
}

/* TRK-421: on a desktop the usual call window moves by its top bar and resizes from any edge or corner */
.call-grip { display: none; }
@media (min-width: 768px) {
  .call-window:not(.call-mini):not(.call-max) > .call-bar { cursor: grab; user-select: none; }
  .call-window:not(.call-mini):not(.call-max) > .call-bar :is(button, a, input, select) { cursor: pointer; }
  .call-window.call-moving > .call-bar { cursor: grabbing; }
  .call-window.call-moving, .call-window.call-resizing { user-select: none; }
  .call-window:not(.call-mini):not(.call-max) > .call-grip { display: block; position: absolute; z-index: 6; touch-action: none; }
  .call-grip[data-edge="n"], .call-grip[data-edge="s"] { left: 18px; right: 18px; height: 6px; cursor: ns-resize; }
  .call-grip[data-edge="e"], .call-grip[data-edge="w"] { top: 18px; bottom: 18px; width: 6px; cursor: ew-resize; }
  .call-grip[data-edge="n"] { top: 0; }
  .call-grip[data-edge="s"] { bottom: 0; }
  .call-grip[data-edge="e"] { right: 0; }
  .call-grip[data-edge="w"] { left: 0; }
  .call-grip[data-edge$="e"][data-edge^="n"], .call-grip[data-edge$="w"][data-edge^="s"] { width: 18px; height: 18px; cursor: nesw-resize; }
  .call-grip[data-edge$="w"][data-edge^="n"], .call-grip[data-edge$="e"][data-edge^="s"] { width: 18px; height: 18px; cursor: nwse-resize; }
  .call-grip[data-edge="ne"] { top: 0; right: 0; }
  .call-grip[data-edge="nw"] { top: 0; left: 0; }
  .call-grip[data-edge="se"] { bottom: 0; right: 0; }
  .call-grip[data-edge="sw"] { bottom: 0; left: 0; }
}

/* TRK-299: the link to Your agents stays on one line */
.agent-wait-link {
  flex: none;
  white-space: nowrap;
}

/* Each board column can add a card straight into it (TRK-307) */
/* The plus icon sits beside its label (TRK-599). Create keeps its own display, which a phone sets to none. */
.column-add {
  display: flex;
  align-items: center;
  gap: 6px;
}

.column-add svg {
  flex: none;
  width: 14px;
  height: 14px;
}

#new-issue svg {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  vertical-align: -2px;
}

.column-add {
  width: 100%;
  justify-content: flex-start;
  color: var(--muted);
  font-size: 13px;
}

/* Sidebar sections to show, in Settings > General (TRK-334) */
.sidebar-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}
.sidebar-choices .check-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Edit and Delete on a comment (TRK-311) sit after its time, small and quiet */
.doc-comment-head .comment-action {
  font-size: 12px;
}

/* Phones (TRK-339): tabs show a fade where more are hidden, the board toolbar folds behind More options,
   the chat button sits above the bottom bar instead of over the header, and a card's title grows to fit. */
.toolbar-more {
  display: none;
}
.title-field {
  min-height: 0;
  overflow: hidden;
  resize: none;
  line-height: 1.4;
}
@media (max-width: 600px) {
  .tabs.more-right {
    mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
  }
  .tabs.more-left {
    mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent);
  }
  .tabs.more-left.more-right {
    mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent);
  }
  .tabs button {
    white-space: nowrap;
  }
  .board-toolbar .toolbar-more {
    display: inline-flex;
    margin-left: auto;
  }
  .board-toolbar:not(.open) .sort-by,
  .board-toolbar:not(.open) > button:not(.toolbar-more, .rename-sprint) {
    display: none;
  }
}

/* Snooze and follow up (TRK-209) */
.mail-back-tag {
  padding: 0 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}

.mail-wake {
  color: var(--accent);
}

/* Mail rules (TRK-210) */
.mail-rules { margin-top: 8px; }
.mail-rules-head { display: flex; align-items: baseline; gap: 12px; }
.mail-rule-list li { flex-wrap: wrap; }
.mail-rule-list li .social-muted { white-space: normal; flex: 1 1 240px; }
.mail-rule-list li .cell { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.mail-rule-off strong, .mail-rule-off .social-muted { opacity: 0.6; }
.mail-rule-form h2 { font-size: 1em; margin: 12px 0 0; }
.mail-rule-field { display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: center; gap: 8px; }
@media (max-width: 520px) { .mail-rule-field { grid-template-columns: 1fr; gap: 2px; } }

/* Your agent and mail (TRK-214) */
.mail-agent-boxes { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.mail-agent-boxes fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: 0; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.mail-agent-boxes legend { padding: 0 4px; font-weight: 600; overflow-wrap: anywhere; }

/* Shared team mailboxes (TRK-215) */
.mail-assignee {
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  max-width: 10em;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mail-team { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.mail-team select { margin-left: 4px; }
.mail-replying { color: var(--accent); }
.mail-team-tag { margin-left: 6px; }
.mail-team-boxes { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; }

/* Focused inbox (TRK-216) */
.mail-focus-tabs {
  display: flex;
  gap: 16px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
}
.mail-focus-tabs button {
  padding: 6px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.mail-focus-tabs button[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* CRM automation builder (TRK-353): a column of cards, with the panel beside it, or under it on a phone */
.crm-status {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  background: var(--sunken);
  color: var(--muted);
}
.crm-status.on { background: color-mix(in srgb, var(--pass) 16%, transparent); color: var(--pass); }
.flow-head { display: grid; gap: 8px; margin-bottom: 12px; }
.flow-head > .link { justify-self: start; }
.flow-title { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.flow-title > input { flex: 1 1 260px; min-width: 0; font-size: 18px; font-weight: 600; }
.flow-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.flow-builder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
  min-height: 480px;
}
.flow-canvas {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 32px;
  min-width: 0;
  background-color: var(--sunken);
  background-image: radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 18px 18px;
}
.flow-card {
  display: block;
  width: min(100%, 340px);
  text-align: left;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.flow-card small {
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.flow-card.trigger { border-color: var(--accent); }
.flow-card.branch { border-style: dashed; }
.flow-card:hover { border-color: var(--accent); }
.flow-card.selected { outline: 2px solid var(--accent); outline-offset: 2px; }
.flow-line { width: 2px; height: 14px; background: var(--border); }
.flow-gap { display: flex; flex-direction: column; align-items: center; }
.flow-plus {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}
.flow-plus:hover:not(:disabled), .flow-plus.active { border-color: var(--accent); color: var(--accent); }
.flow-lanes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  width: min(100%, 620px);
  padding-top: 14px;
  border-top: 2px solid var(--border);
}
.flow-lane { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.flow-lane-label {
  margin-bottom: 8px;
  padding: 1px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  background: var(--selected);
  color: var(--selected-text);
}
.flow-lane.no .flow-lane-label { background: var(--sunken); color: var(--muted); border: 1px solid var(--border); }
.flow-end {
  padding: 2px 10px;
  border: 1px dashed color-mix(in srgb, var(--muted) 60%, transparent);
  border-radius: 12px;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
}
.flow-lanes + .flow-gap { margin-top: 4px; }
.flow-panel {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
  border-left: 1px solid var(--border);
  min-width: 0;
}
.flow-panel h3 { margin: 0; font-size: 15px; }
.flow-panel label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
.flow-panel label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.flow-panel label.check input { flex: none; margin-top: 2px; }
.flow-panel input:not([type="checkbox"]), .flow-panel select, .flow-panel textarea { width: 100%; box-sizing: border-box; font-weight: 400; }
.flow-panel .sub { margin: 0; }
.flow-kinds { display: grid; gap: 6px; }
.flow-kinds button { text-align: left; }
.flow-panel-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.flow-conditions { display: grid; gap: 8px; }
.flow-conditions ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.flow-conditions li .link { margin-left: 8px; }
.crm-status.run-done { background: color-mix(in srgb, var(--pass) 16%, transparent); color: var(--pass); }
.crm-status.run-failed { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
/* Run history (TRK-359) */
.flow-count { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }
.flow-count.passed { color: var(--pass); }
.flow-count.failed { color: var(--danger); }
.flow-runs { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.flow-run {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
}
.flow-run:hover { border-color: var(--accent); }
.flow-run .crm-status { align-self: center; min-width: 4.5em; text-align: center; box-sizing: border-box; }
.flow-run-name { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.flow-run small { grid-column: 2; }
.flow-run-steps { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 4px; font-size: 13px; }
.flow-run-steps li::before { content: "✓ "; color: var(--pass); }
.flow-run-steps li.failed { color: var(--danger); }
.flow-run-steps li.failed::before { content: "✕ "; }
@media (max-width: 760px) {
  .flow-builder { grid-template-columns: 1fr; }
  .flow-panel { border-left: 0; border-top: 1px solid var(--border); }
  .flow-lanes { grid-template-columns: 1fr; }
}
/* Upcoming automation steps on a record (TRK-359) */
.crm-upcoming { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.crm-upcoming li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; }
.crm-upcoming li > span { min-width: 0; overflow-wrap: anywhere; }
.crm-status.run-running { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }

/* Field picker beside step texts, and the preview under them (TRK-357) */
.flow-panel .code-box { display: flex; flex-direction: column; gap: 4px; }
.flow-panel .code-menu { align-self: flex-start; width: auto; font-size: 12px; padding: 2px 6px; }
.flow-preview:empty { display: none; }
.flow-preview { border: 1px dashed var(--border); border-radius: 8px; padding: 8px 10px; }
.flow-preview p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Dry run of an automation (TRK-360) */
.flow-card.tested-ok { border-left: 4px solid var(--done, #2e7d32); }
.flow-card.tested-fail { border-left: 4px solid var(--danger); }
.flow-tested { display: block; margin-top: 4px; font-size: 0.85em; color: var(--muted); overflow-wrap: anywhere; }
.flow-card.tested-fail .flow-tested { color: var(--danger); }
.flow-lane.untaken { opacity: 0.45; }
.flow-test-list { margin: 8px 0; padding-left: 20px; display: grid; gap: 6px; overflow-wrap: anywhere; }
.flow-test-list li.failed { color: var(--danger); }
.flow-test-note { border-left: 3px solid var(--danger); padding: 4px 8px; margin: 8px 0; }
.ok-text { color: var(--done, #2e7d32); font-weight: 600; }

/* Template gallery and the blanks a template leaves (TRK-361) */
.template-group { margin-top: 20px; }
.crm-describe textarea { width: 100%; box-sizing: border-box; font: inherit; }
.crm-describe .actions { margin-top: 8px; }
.crm-section.automation-gallery-head { margin-top: 32px; } /* TRK-674: templates sit below the list on one page */
.crm-draft-note { border: 1px solid #d08a1e; background: rgba(208, 138, 30, 0.08); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.crm-draft-note p { margin: 0; }
.crm-draft-note ul { margin: 6px 0 0; padding-left: 20px; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.template-card { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
/* The button sits at the foot of every card, so buttons in a row line up, with the amber hint beside it (TRK-396) */
.template-card > .actions { margin-top: auto; padding-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.template-card h4 { margin: 0; }
.template-card p { margin: 0; }
.template-steps { margin: 4px 0; padding-left: 18px; display: grid; gap: 3px; font-size: 0.9em; overflow-wrap: anywhere; }
.template-blanks { color: #9a5b00; font-size: 0.85em; }
.flow-card.blank { border-color: #d08a1e; box-shadow: 0 0 0 2px rgba(208, 138, 30, 0.25); }
.flow-panel select:has(option.pick:checked), .flow-people.blank { border-color: #d08a1e; background-color: rgba(208, 138, 30, 0.1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .template-blanks { color: #e3a74c; } }
:root[data-theme="dark"] .template-blanks { color: #e3a74c; }

/* Automation versions (TRK-363) */
.flow-versions { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 10px; }
.flow-versions li { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: grid; gap: 4px; overflow-wrap: anywhere; }
.flow-versions li > div:first-child { display: flex; gap: 8px; align-items: center; }
.flow-versions button { justify-self: start; }

/* Pause dates in the automation Limits panel (TRK-367) */
.flow-pauses { list-style: none; padding: 0; margin: 0 0 8px; }
.flow-pauses li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; }

/* Incoming webhook URL in the automation builder (TRK-364) */
.flow-webhook { display: grid; gap: 8px; margin: 8px 0; justify-items: start; }
.flow-hook-url { display: block; width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; overflow-wrap: anywhere; font-size: 12px; }
.flow-hook-example { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; padding: 8px; border: 1px solid var(--border); border-radius: 6px; margin: 0; }

/* Background effects (TRK-270): a grid of small tiles on the join screen and in the call's side panel */
.call-join-effects {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none; padding: 0; border-radius: 8px;
  border: 1px solid var(--call-line); background: transparent; color: var(--call-text); cursor: pointer;
}
.call-join-effects:hover { background: var(--call-hover); }
.call-join-effects.call-on { border-color: var(--call-on); color: var(--call-on); }
.call-join-effects:focus-visible, .call-bg-tile:focus-visible, .call-bg-add:focus-within { outline: 2px solid var(--call-on); outline-offset: 2px; }
.call-join-video > .call-bg { padding: 0 12px 12px; }
.call-bg { display: grid; gap: 8px; }
.call-bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.call-bg-tile {
  position: relative; display: grid; aspect-ratio: 16 / 10; padding: 0; overflow: hidden; border-radius: 8px;
  border: 2px solid transparent; outline: 1px solid var(--call-line); background: var(--call-tile); color: var(--call-text);
  font: inherit; cursor: pointer;
}
.call-bg-tile:hover { outline-color: var(--call-outline); }
.call-bg-tile.call-bg-on { border-color: var(--call-on); outline-color: var(--call-on); }
.call-bg-tile img, .call-bg-swatch { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.call-bg-swatch { display: grid; place-items: center; padding-bottom: 14px; font-size: 22px; color: var(--call-muted); }
.call-bg-swatch .nav-icon { width: 22px; height: 22px; }
.call-bg-blur { background: radial-gradient(circle at 50% 42%, var(--call-muted) 0 18%, transparent 19%), linear-gradient(135deg, #8fa7c4, #c9b6d9); filter: blur(2px); }
.call-bg-label {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; font-weight: 600; text-align: left;
  background: linear-gradient(transparent, rgb(0 0 0 / 0.55)); color: #fff;
}
.call-bg-note { margin: 0; font-size: 12px; }
.call-bg-preview { margin: 10px 0; border-radius: 8px; overflow: hidden; aspect-ratio: 16 / 9; background: var(--call-tile); }
.call-bg-preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.call-panel[data-kind="backgrounds"] { width: 300px; }
.call-device-menu .call-menu-effects { margin-top: 4px; border-top: 1px solid var(--call-line); border-radius: 0 0 6px 6px; padding-top: 9px; }

/* Sidebar items can be dragged into each person's own order (TRK-433). A line shows where one will land. */
.nav-slot,
.sub-item {
  position: relative;
}

.nav-slot.dragging,
.sub-item.dragging {
  opacity: 0.45;
}

.nav-slot.drop-before::before,
.nav-slot.drop-after::after,
.sub-item.drop-before::before,
.sub-item.drop-after::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent, var(--selected-text));
  pointer-events: none;
}

.nav-slot.drop-before::before,
.sub-item.drop-before::before {
  top: -2px;
}

.nav-slot.drop-after::after,
.sub-item.drop-after::after {
  bottom: -1px;
}
/* TRK-440: duplicate groups */
.crm-duplicates { display: grid; gap: 12px; max-height: 60vh; overflow-y: auto; }
.crm-duplicate-group { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 12px; display: grid; gap: 6px; justify-items: start; }
.crm-duplicate-group legend { color: var(--muted); font-size: 13px; padding: 0 4px; }
.form label.crm-duplicate { align-items: baseline; }
.form label.crm-duplicate input { width: auto; margin: 0; }

/* A fold's name is clickable, like its arrow (TRK-461) */
.fold-name {
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  cursor: pointer;
}

.fold-name:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* The page path above a Docs title: small and quiet, with room before the title (TRK-462) */
.doc-head .doc-crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
  margin-bottom: 8px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--muted);
}

.doc-crumb .link {
  padding: 0;
  color: var(--muted);
  font-size: inherit;
  text-decoration: none;
}

.doc-crumb .link:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.doc-crumb .crumb-sep {
  color: var(--border-strong, var(--muted));
  opacity: 0.7;
}

/* A card's AI tokens, in its header and on board and list cards (TRK-467) */
.ai-token-pill {
  margin-left: 8px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: var(--sunken);
  border-radius: 999px;
  white-space: nowrap;
}

.meta .ai-token-count {
  color: var(--muted);
  white-space: nowrap;
}

/* Outlook / Teams events (TRK-526): Outlook blue instead of Google green */
:root { --cal-outlook: color-mix(in srgb, #0f6cbd 16%, var(--surface)); --cal-outlook-edge: #0f6cbd; }
.cal-event.cal-outlook { background: var(--cal-outlook); border-left-color: var(--cal-outlook-edge); }
.cal-line.cal-outlook { background: var(--cal-outlook); box-shadow: inset 3px 0 0 var(--cal-outlook-edge); }
.cal-join-link a { font-weight: 600; }

/* Sync calendars menu (TRK-529) */
.cal-sync-menu { left: auto; right: 0; width: 240px; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.cal-sync-menu [role="menuitem"] { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; }
.cal-sync-menu [role="menuitem"]:hover, .cal-sync-menu [role="menuitem"]:focus-visible { background: var(--hover, color-mix(in srgb, var(--accent) 10%, transparent)); }
.cal-sync-on { font-size: 12px; color: #0b8043; }

/* The × that closes a popup, in its top-right corner (TRK-527) */
.popup-x {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.popup-x:hover { color: var(--text); background: color-mix(in srgb, var(--text) 10%, transparent); }
.popup-x.inline { position: static; }
/* Keep titles clear of the × */
dialog > .dialog-head, dialog > h1, dialog > h2, dialog > form > h1:first-child, dialog > form > h2:first-child { padding-right: 32px; }
.form-actions:empty { display: none; }
.mail-filters { position: relative; }
.mail-filters > .popup-x { top: 4px; right: 4px; }
.wb-thread > .popup-x { top: 4px; right: 4px; }
.wb-thread { padding-top: 32px; }
.call-chat-tools { display: flex; align-items: center; gap: 4px; }

/* TRK-530 Social composer: the form and a live preview side by side */
dialog:has(.social-builder) {
  width: min(1180px, calc(100vw - 32px));
}

@media (min-width: 1100px) {
  :root.claude-open dialog#dialog:has(.social-builder) {
    width: min(1180px, calc(100vw - var(--claude-w, 420px) - 56px));
  }
}

.social-builder {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.social-builder-edit {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.social-builder-preview {
  position: sticky;
  top: 0;
  display: grid;
  gap: 10px;
  min-width: 0;
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding: 12px;
  background: var(--sunken);
  border-radius: 10px;
}

.social-builder-preview h2 {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Below this the form gets too narrow; the preview stacks under it */
@media (max-width: 900px) {
  .social-builder {
    grid-template-columns: minmax(0, 1fr);
  }

  .social-builder-preview {
    position: static;
    max-height: none;
  }
}

.social-live-list {
  display: grid;
  gap: 14px;
}

.social-live-empty {
  margin: 0;
}

.social-live-network {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 0.8rem;
  color: var(--muted);
}

.social-live-post {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.social-live-head {
  display: flex;
  align-items: center;
  min-width: 0;
}

.social-live-who {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}

.social-live-who > * {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.social-live-who .social-muted {
  font-size: 0.8rem;
}

.social-live-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.95rem;
  line-height: 1.4;
}

.social-live-tag,
.social-live-mention,
.social-live-link {
  color: var(--accent);
}

.social-live-over {
  background: color-mix(in srgb, var(--danger) 18%, transparent);
  color: var(--danger);
  border-radius: 2px;
}

.social-live-media {
  display: grid;
  gap: 2px;
  overflow: hidden;
  border-radius: 10px;
}

.social-live-media.n2,
.social-live-media.n3,
.social-live-media.n4 {
  grid-template-columns: 1fr 1fr;
}

.social-live-media.n3 .social-live-tile:first-child {
  grid-row: span 2;
}

.social-live-tile {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #000;
}

.social-live-media.n3 .social-live-tile:first-child {
  aspect-ratio: auto;
}

.social-live-tile img,
.social-live-tile video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.social-live-play,
.social-live-more {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.6rem;
  font-weight: 600;
  pointer-events: none;
}

.social-live-more {
  background: rgb(0 0 0 / 50%);
}

.social-live-count {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 1px 7px;
  background: rgb(0 0 0 / 60%);
  color: #fff;
  border-radius: 999px;
  font-size: 0.75rem;
}

/* Network touches: Instagram is square and picture-first; LinkedIn and Facebook run media edge to edge */
.social-live-card[data-network="instagram"] .social-live-media {
  grid-template-columns: 1fr;
  border-radius: 0;
  margin: 0 -12px;
}

.social-live-card[data-network="instagram"] .social-live-media .social-live-tile.social-live-tile {
  aspect-ratio: 1;
}

.social-live-card[data-network="instagram"] .social-live-tile:not(:first-child) {
  display: none;
}

.social-live-noimage {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  margin: 0 -12px;
  background: var(--sunken);
  color: var(--muted);
  font-size: 0.85rem;
}

.social-live-card[data-network="linkedin"] .social-live-media,
.social-live-card[data-network="facebook"] .social-live-media {
  margin: 0 -12px;
  border-radius: 0;
}

.social-live-card[data-network="linkedin"] .social-live-post,
.social-live-card[data-network="facebook"] .social-live-post {
  border-radius: 8px;
}

/* The composer's column never grows past the dialog; its row of buttons wraps on a phone */
.social-composer {
  grid-template-columns: minmax(0, 1fr);
}

.social-composer > .form-actions {
  flex-wrap: wrap;
}

/* A popup's header and × stay put; only the body under them scrolls, with its scrollbar at the edge (TRK-532) */
dialog#dialog[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
dialog#dialog > .dialog-head { flex: none; }
dialog#dialog > .dialog-body {
  flex: 0 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  margin: 0 -24px -12px;
  padding: 0 24px 12px;
}
dialog#dialog > .dialog-body:first-child,
dialog#dialog > .popup-x + .dialog-body { padding-top: 2px; }
dialog#dialog > .dialog-body > h1:first-child, dialog#dialog > .dialog-body > h2:first-child,
dialog#dialog > .dialog-body > form > h1:first-child, dialog#dialog > .dialog-body > form > h2:first-child { padding-right: 32px; }

/* ---- Docs formatting (TRK-536): colours, highlights, alignment, toggles, banners and the toolbar menus ---- */
:root {
  --doc-gray: #787774;
  --doc-brown: #9f6b53;
  --doc-orange: #d9730d;
  --doc-yellow: #c29343;
  --doc-green: #448361;
  --doc-blue: #337ea9;
  --doc-purple: #9065b0;
  --doc-pink: #c14c8a;
  --doc-red: #d44c47;
  --doc-tint: 22%;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --doc-gray: #9b9b9b;
    --doc-brown: #ba856f;
    --doc-orange: #e38b3c;
    --doc-yellow: #d9b04c;
    --doc-green: #5fae84;
    --doc-blue: #5ba3d6;
    --doc-purple: #b087d6;
    --doc-pink: #d975ad;
    --doc-red: #e5706b;
    --doc-tint: 30%;
  }
}

:root[data-theme="dark"],
:root[data-theme="graphite"],
:root[data-theme="midnight"],
:root[data-theme="onyx"],
:root[data-theme="contrast-dark"] {
  --doc-gray: #9b9b9b;
  --doc-brown: #ba856f;
  --doc-orange: #e38b3c;
  --doc-yellow: #d9b04c;
  --doc-green: #5fae84;
  --doc-blue: #5ba3d6;
  --doc-purple: #b087d6;
  --doc-pink: #d975ad;
  --doc-red: #e5706b;
  --doc-tint: 30%;
}

.fg-gray { color: var(--doc-gray); }
.fg-brown { color: var(--doc-brown); }
.fg-orange { color: var(--doc-orange); }
.fg-yellow { color: var(--doc-yellow); }
.fg-green { color: var(--doc-green); }
.fg-blue { color: var(--doc-blue); }
.fg-purple { color: var(--doc-purple); }
.fg-pink { color: var(--doc-pink); }
.fg-red { color: var(--doc-red); }

[class*="bg-"]:is(.bg-gray, .bg-brown, .bg-orange, .bg-yellow, .bg-green, .bg-blue, .bg-purple, .bg-pink, .bg-red),
[class*="solid-"]:is(.solid-gray, .solid-brown, .solid-orange, .solid-yellow, .solid-green, .solid-blue, .solid-purple, .solid-pink, .solid-red) {
  padding: 1px 3px;
  border-radius: 4px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.bg-gray { background: color-mix(in srgb, var(--doc-gray) var(--doc-tint), transparent); }
.bg-brown { background: color-mix(in srgb, var(--doc-brown) var(--doc-tint), transparent); }
.bg-orange { background: color-mix(in srgb, var(--doc-orange) var(--doc-tint), transparent); }
.bg-yellow { background: color-mix(in srgb, var(--doc-yellow) var(--doc-tint), transparent); }
.bg-green { background: color-mix(in srgb, var(--doc-green) var(--doc-tint), transparent); }
.bg-blue { background: color-mix(in srgb, var(--doc-blue) var(--doc-tint), transparent); }
.bg-purple { background: color-mix(in srgb, var(--doc-purple) var(--doc-tint), transparent); }
.bg-pink { background: color-mix(in srgb, var(--doc-pink) var(--doc-tint), transparent); }
.bg-red { background: color-mix(in srgb, var(--doc-red) var(--doc-tint), transparent); }

/* A strong highlight is a solid colour with white letters, like a label */
:is(.solid-gray, .solid-brown, .solid-orange, .solid-yellow, .solid-green, .solid-blue, .solid-purple, .solid-pink, .solid-red) {
  padding: 2px 8px;
  border-radius: 6px;
  color: #fff;
}

.solid-gray { background: #6f6e69; }
.solid-brown { background: #8c5b45; }
.solid-orange { background: #e0702a; }
.solid-yellow { background: #c68f12; }
.solid-green { background: #3f8f63; }
.solid-blue { background: #2f74b5; }
.solid-purple { background: #7f56b8; }
.solid-pink { background: #c2477f; }
.solid-red { background: #c2413a; }

.doc-body h5 {
  margin: 1em 0 0.3em;
  font-size: 15px;
  font-weight: 700;
}

.doc-body [data-align="center"] { text-align: center; }
.doc-body [data-align="right"] { text-align: right; }
.doc-body [data-indent="1"] { padding-left: 28px; }
.doc-body [data-indent="2"] { padding-left: 56px; }
.doc-body [data-indent="3"] { padding-left: 84px; }
.doc-body [data-indent="4"] { padding-left: 112px; }

/* Banners: a quote with a coloured box and an icon for its kind */
.doc-body blockquote[data-banner] {
  position: relative;
  padding: 10px 14px 10px 40px;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  font-style: normal;
}

.doc-body blockquote[data-banner]::before {
  position: absolute;
  top: 10px;
  left: 14px;
  font-weight: 700;
}

.doc-body blockquote[data-banner="info"] { background: color-mix(in srgb, var(--doc-blue) 16%, transparent); }
.doc-body blockquote[data-banner="info"]::before { content: "ℹ"; color: var(--doc-blue); }
.doc-body blockquote[data-banner="success"] { background: color-mix(in srgb, var(--doc-green) 16%, transparent); }
.doc-body blockquote[data-banner="success"]::before { content: "✓"; color: var(--doc-green); }
.doc-body blockquote[data-banner="warning"] { background: color-mix(in srgb, var(--doc-yellow) 20%, transparent); }
.doc-body blockquote[data-banner="warning"]::before { content: "⚠"; color: var(--doc-orange); }
.doc-body blockquote[data-banner="error"] { background: color-mix(in srgb, var(--doc-red) 16%, transparent); }
.doc-body blockquote[data-banner="error"]::before { content: "!"; color: var(--doc-red); }
.doc-body blockquote[data-banner="note"] { background: color-mix(in srgb, var(--doc-gray) 16%, transparent); }
.doc-body blockquote[data-banner="note"]::before { content: "✎"; color: var(--doc-gray); }

/* Toggles: a summary line with an arrow; what's under it shows when open */
.doc-body details.doc-toggle,
.doc-editable .doc-toggle {
  margin: 0 0 0.6em;
}

.doc-body details.doc-toggle > summary {
  cursor: pointer;
  list-style: none;
}

.doc-body details.doc-toggle > summary::-webkit-details-marker {
  display: none;
}

.doc-body details.doc-toggle > summary::before,
.doc-editable .toggle-summary::before {
  content: "▸";
  display: inline-block;
  width: 22px;
  color: var(--muted);
  text-align: center;
  transition: transform 0.12s;
}

.doc-body details.doc-toggle[open] > summary::before,
.doc-editable .doc-toggle[data-open="true"] > .toggle-summary::before {
  transform: rotate(90deg);
}

.doc-editable .toggle-summary::before {
  cursor: pointer;
}

.doc-body .toggle-body {
  padding-left: 22px;
}

.doc-body .toggle-body p {
  margin: 0.25em 0;
}

.doc-editable .doc-toggle[data-open="false"] > .toggle-body {
  display: none;
}

/* The toolbar: grouped buttons and dropdown menus */
.doc-tools-sticky {
  gap: 2px;
}

.doc-tools .doc-tool {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-width: 30px;
  height: 30px;
  justify-content: center;
  padding: 0 7px;
  background: transparent;
  border-color: transparent;
  color: var(--text);
  font-size: 13px;
  box-shadow: none;
}

.doc-tools .doc-tool:hover,
.doc-tools .doc-tool[aria-expanded="true"],
.doc-tools .doc-tool.is-on {
  background: var(--sunken);
  border-color: transparent;
}

.doc-tools .doc-tool .icon {
  width: 16px;
  height: 16px;
}

.doc-tools .doc-tool .icon + .icon {
  width: 12px;
  height: 12px;
  color: var(--muted);
}

.doc-tools .doc-tool b,
.doc-tools .doc-tool i,
.doc-tools .doc-tool u,
.doc-tools .doc-tool s {
  font-size: 15px;
  font-family: Georgia, "Times New Roman", serif;
}

.doc-tools .doc-tool code {
  font-size: 12px;
  background: none;
  padding: 0;
}

.doc-tools .doc-turn {
  gap: 6px;
  min-width: 112px;
  justify-content: space-between;
  font-size: 13px;
}

.doc-tool-sep {
  width: 1px;
  height: 20px;
  margin: 0 4px;
  background: var(--border);
}

.doc-color-a {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  font-weight: 700;
  font-size: 12px;
}

.doc-menu {
  position: fixed;
  z-index: 60;
  min-width: 220px;
  max-height: min(70vh, 460px);
  overflow-y: auto;
  padding: 6px;
  background: var(--dialog);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px -8px rgb(16 24 40 / 28%);
}

.doc-menu-head {
  padding: 6px 8px 4px;
  color: var(--muted);
  font-size: 12px;
}

.doc-menu-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  box-shadow: none;
}

.doc-menu-row:hover {
  background: var(--sunken);
}

.doc-menu-glyph {
  display: inline-grid;
  place-items: center;
  width: 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.doc-menu-glyph sub {
  font-size: 9px;
}

.doc-menu-text {
  flex: 1;
}

.doc-menu kbd {
  color: var(--muted);
  font: 12px system-ui, sans-serif;
  background: none;
  border: 0;
}

.doc-menu-check {
  color: var(--text);
}

.doc-menu-arrow {
  color: var(--muted);
  transition: transform 0.12s;
}

.doc-menu-row[aria-expanded="true"] .doc-menu-arrow {
  transform: rotate(90deg);
}

.doc-menu-sub {
  padding-left: 18px;
}

.doc-menu-sep {
  margin: 6px 4px;
  border: 0;
  border-top: 1px solid var(--border);
}

.doc-banner-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.banner-info { background: var(--doc-blue); }
.banner-success { background: var(--doc-green); }
.banner-warning { background: var(--doc-yellow); }
.banner-error { background: var(--doc-red); }
.banner-note { background: var(--doc-gray); }

.doc-swatches {
  display: grid;
  grid-template-columns: repeat(5, 32px);
  gap: 4px;
  padding: 2px 6px 6px;
}

.doc-swatch {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: none;
}

.doc-swatch:hover {
  border-color: var(--text);
}

.doc-swatch span {
  font-weight: 700;
  font-size: 13px;
}

/* Headings fold and move (TRK-537): an arrow and a drag handle in the left margin of each heading */
.doc-fold {
  position: relative;
}

/* Room for the tools: the whole page moves in a little, so the title still lines up with the text */
.doc-content:has(> .doc-fold) {
  padding-left: 48px;
}

.doc-fold-tools {
  position: absolute;
  inset: 0 auto 0 -48px;
  width: 48px;
}

.doc-fold-row {
  position: absolute;
  right: 4px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.doc-fold-row button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
}

.doc-fold-row button svg {
  width: 16px;
  height: 16px;
}

.doc-fold-row button:hover:not(:disabled) {
  background: var(--hover, rgba(127, 127, 127, 0.15));
  color: var(--text);
}

.doc-fold-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.doc-fold-arrow svg {
  transition: transform 0.12s;
}

.doc-fold-arrow.folded svg {
  transform: rotate(-90deg);
}

.doc-fold-grip {
  cursor: grab;
  touch-action: none;
  opacity: 0;
}

.doc-fold-row.lit .doc-fold-grip,
.doc-fold-grip:focus-visible {
  opacity: 1;
}

.doc-fold-arrow:not(.folded) {
  opacity: 0.55;
}

.doc-fold-row.lit .doc-fold-arrow:not(:disabled) {
  opacity: 1;
}

@media (hover: none) {
  .doc-fold-grip {
    opacity: 1;
  }
}

.doc-body > .fold-hidden {
  display: none;
}

.doc-body > .is-dragging {
  opacity: 0.4;
}

.doc-drop-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  margin-top: -2px;
  border-radius: 2px;
  background: var(--accent, #2f6fde);
  pointer-events: none;
}

/* TRK-554: a card's code in its Development section, and its pull request marker on the board */
.development { display: grid; gap: 8px; margin-bottom: 8px; }
.dev-change { display: grid; gap: 2px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--sunken); }
.dev-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.dev-sub { color: var(--muted); font-size: 0.86em; }
.dev-label { color: var(--muted); font-size: 0.86em; }
.dev-state { flex: none; padding: 0 6px; border-radius: 999px; color: var(--surface); font-size: 0.78em; font-weight: 600; line-height: 1.6; }
.dev-checks.checks-passed { color: var(--pass); }
.dev-checks.checks-failed { color: var(--danger); }
.card-pr { display: inline-block; padding: 0 6px; border-radius: 999px; color: var(--surface); font-size: 0.72em; font-weight: 700; line-height: 1.6; }
.pr-open, .pr-closed { background: var(--low); }
.pr-passed { background: var(--pass); }
.pr-failed { background: var(--danger); }
.pr-merged { background: var(--chart-in_review); }

/* Integrations and a project's code settings (TRK-552) */
.integration { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.integration h3 { margin: 0 0 4px; }
.integration code { word-break: break-all; }
.copy-row { display: flex; align-items: flex-end; gap: 8px; }
.copy-row > :first-child { flex: 1; min-width: 0; }
.code-repos, .code-options { display: grid; gap: 6px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: 0; }
.form label.check-row { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
.form label.check-row > input { width: auto; margin: 0; }

/* A project's Code tab (TRK-556) */
.code-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.code-filter { border-radius: 999px; }
.code-filter[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.code-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin-bottom: 12px; }
.merge-mode-note { margin: 0; }
.code-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.code-layouts { display: flex; gap: 6px; }

/* The summary row and the Branches list (TRK-598) */
.code-summary { flex-basis: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.code-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 8px; text-align: left; font-weight: 400; }
.code-stat-n { font-size: 22px; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.code-stat-label { font-size: 13px; color: var(--muted); }
.code-stat.bad .code-stat-n { color: var(--danger); }
.branch-name { color: inherit; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; overflow-wrap: anywhere; }
.branch-commit { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.branch-ab { font-variant-numeric: tabular-nums; white-space: nowrap; }
.branch-stale { flex: none; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--muted); background: color-mix(in srgb, var(--muted) 16%, transparent); }
.branch-stale.stale-merged { color: var(--chart-in_review); background: color-mix(in srgb, var(--chart-in_review) 14%, transparent); }
.branch-row.stale .branch-name, .branch-row.stale .branch-commit { color: var(--muted); }

/* Pull requests as cards (TRK-596) */
.code-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.code-card { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 16px 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--sunken); cursor: pointer; transition: border-color 120ms ease, box-shadow 120ms ease; }
.code-card:hover, .code-card:focus-visible { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06); }
.code-card:hover .code-card-title { text-decoration: underline; }
.code-card-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.code-card-icon { flex: none; width: 16px; height: 16px; fill: var(--muted); }
.code-card-repo { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; font-size: 14px; color: var(--text); }
.code-card-age { flex: none; margin-left: auto; color: var(--muted); font-size: 13px; }
.code-card-title { text-decoration: none; text-align: left; font-weight: 600; font-size: 15px; line-height: 1.45; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.code-card-summary { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.code-card-meta { display: flex; align-items: center; gap: 4px 10px; min-width: 0; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.code-card-number { font-weight: 600; }
.code-card-branch { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.code-card-foot { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 4px; }
.code-card-avatar { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 22%, var(--surface)); color: var(--text); font-weight: 700; font-size: 14px; box-shadow: 0 0 0 2px var(--surface); }
.code-card-avatar.agent { background: var(--chart-in_review); color: #fff; }
.code-card-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.code-card-author { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-card-role { color: var(--muted); font-size: 13px; }
.code-card-merge { margin-left: auto; padding: 4px 14px; }
.code-card-state { flex: none; padding: 3px 10px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--text); background: color-mix(in srgb, var(--muted) 18%, transparent); }
.code-card-merge + .code-card-state { margin-left: 0; }
.code-card-who + .code-card-state { margin-left: auto; }
.code-card-state.state-open { color: var(--pass); background: color-mix(in srgb, var(--pass) 14%, transparent); }
.code-card-state.state-merged { color: var(--chart-in_review); background: color-mix(in srgb, var(--chart-in_review) 16%, transparent); }
.code-card-state.state-closed { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
@media (max-width: 600px) { .code-cards { grid-template-columns: 1fr; } }

/* A repo's commit graph (TRK-583): one colour per line of work */
.lane-0 { --lane: #2a78d6; } .lane-1 { --lane: #e59400; } .lane-2 { --lane: #8a5cd6; } .lane-3 { --lane: #1baf7a; }
.lane-4 { --lane: #d9483b; } .lane-5 { --lane: #0f9bb5; } .lane-6 { --lane: #c2509a; } .lane-7 { --lane: #7a8a12; }
.code-graph-repo { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 10px; }
.code-graph-repo select { width: auto; }
.code-graph { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow-x: auto; }
.graph-row { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 140px) 64px 84px; align-items: center; gap: 12px; height: 32px; padding-right: 12px; font-size: 13px; }
.graph-row:hover { background: var(--hover, rgba(127, 127, 127, 0.08)); }
.graph-svg { height: 32px; padding-left: 8px; }
.graph-cell { display: block; overflow: visible; }
.graph-line { fill: none; stroke: var(--lane); stroke-width: 2; }
.graph-dot { fill: var(--lane); stroke: var(--surface); stroke-width: 2; }
.graph-dot.merge { fill: var(--surface); stroke: var(--lane); }
.graph-message { display: flex; align-items: center; gap: 6px; min-width: 0; }
.graph-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.graph-ref { flex: none; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 7px; border: 1px solid var(--lane); border-radius: 999px; color: var(--lane); font-size: 12px; font-weight: 600; line-height: 1.5; }
.graph-ref.default { background: var(--lane); color: var(--surface); }
.graph-issue { flex: none; font-size: 12px; }
.graph-author, .graph-age { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.graph-sha { font-family: var(--mono, ui-monospace, monospace); font-size: 12px; color: var(--muted); }
@media (max-width: 600px) {
  .graph-row { grid-template-columns: auto minmax(0, 1fr) 64px; }
  .graph-author, .graph-age { display: none; }
}

/* A project's Settings tab (TRK-588) */
.project-settings { max-width: 760px; }
.project-settings h2 { font-size: 15px; margin: 24px 0 4px; }
.project-settings h2:first-of-type { margin-top: 8px; }
.setting-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.setting-text { min-width: 0; }
.setting-title { font-weight: 600; color: var(--text); }
.setting-text .sub { margin: 4px 0 0; }
.setting-note { margin-top: 8px; }
.setting-control { flex: none; padding-top: 2px; }
.setting-due { display: flex; align-items: center; gap: 12px; }
.setting-days-wrap { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.setting-days { width: 72px; }
/* The board's issue fields (TRK-610): a short note, then the switches wrapping in rows */
.setting-fields { padding: 8px 0 14px; }
.setting-fields > .sub { margin: 0 0 12px; }
/* The points scale (TRK-609): one line per step, the number then what it means */
.setting-scale { padding: 14px 0; border-bottom: 1px solid var(--border); }
.scale-steps { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.scale-step { display: flex; align-items: center; gap: 8px; }
.scale-points { width: 72px; flex: none; }
.scale-meaning { flex: 1; min-width: 0; }
.scale-remove { flex: none; }
.scale-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
@media (max-width: 600px) {
  .setting-row { flex-direction: column; gap: 10px; }
}
.code-row.opens { cursor: pointer; }
.code-row.opens:hover td { background: var(--sunken); }
.code-table td { vertical-align: top; }
.code-pr-link { overflow-wrap: anywhere; }
.code-issue { text-align: left; }
.code-agent { flex: none; padding: 0 6px; border-radius: 999px; background: var(--chart-in_review); color: var(--surface); font-size: 0.72em; font-weight: 700; line-height: 1.6; }
.code-empty { display: grid; gap: 8px; justify-items: start; max-width: 640px; text-align: left; }
.code-empty p { margin: 0; }

/* The Code widget on Summary and dashboards (TRK-560) */
.code-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.code-count { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; }
.code-count strong { display: block; font-size: 18px; }
.code-count span { color: var(--muted); font-size: 12px; }
.code-count.failing strong { color: var(--danger); }
.code-widget .code-widget-row a { overflow-wrap: anywhere; }
.code-widget-more { margin: -4px 0 10px; }
.code-widget-empty { display: grid; gap: 6px; }

/* TRK-512: agents asked in a channel thread */
.agent-working {
  display: block;
  margin-top: 4px;
  padding: 0;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-style: italic;
  background: none;
  border: 0;
  cursor: pointer;
}

.agent-status {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin: 8px 12px;
  padding: 6px 10px;
  font-size: 13px;
  background: var(--selected);
  border-radius: 6px;
}

.agent-status.failed,
.agent-status.stopped {
  font-style: italic;
}

.panel-agents {
  display: grid;
  gap: 8px;
}

.panel-agent {
  display: flex;
  gap: 8px;
  align-items: center;
}

.panel-agent > span:not(.avatar) {
  flex: 1;
}

/* One pull request in the Code tab: its diffs (TRK-592), and Merge and Decline (TRK-582) */
.code-back { margin-bottom: 8px; }
.code-pr-head { display: grid; gap: 4px; margin-bottom: 12px; }
.code-pr-title { margin: 0; font-size: 1.25rem; overflow-wrap: anywhere; }
.code-pr-title .dev-state { vertical-align: middle; }
.code-pr-head p { margin: 0; overflow-wrap: anywhere; }
.code-pr-issues { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.code-actions { display: grid; gap: 6px; padding: 12px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--sunken); }
.code-actions .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.code-actions p { margin: 0; }
.code-blocked { color: var(--high); }
.code-decline { display: grid; gap: 6px; }
.code-decline-note { width: 100%; box-sizing: border-box; }
.code-pr-body { white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 8px; max-height: 320px; overflow: auto; }
.code-files h3 { margin: 4px 0 8px; font-size: 1rem; }
.diff-add-count { color: var(--pass); font-weight: 600; }
.diff-del-count { color: var(--danger); font-weight: 600; }
.code-file { margin-bottom: 8px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.code-file > summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; padding: 8px 10px; background: var(--sunken); cursor: pointer; }
.code-file-name { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.86em; overflow-wrap: anywhere; }
.code-file-status { flex: none; padding: 0 6px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); font-size: 0.75em; font-weight: 600; }
.code-file-status.status-added { color: var(--pass); border-color: currentColor; }
.code-file-status.status-removed { color: var(--danger); border-color: currentColor; }
.diff-wrap { overflow-x: auto; }
.diff { width: 100%; border-collapse: collapse; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.5; }
.diff td { padding: 0 8px; vertical-align: top; }
.diff-num { width: 1%; min-width: 3ch; text-align: right; color: var(--muted); user-select: none; white-space: nowrap; }
.diff-code { white-space: pre; }
.diff-sign { display: inline-block; width: 1.5ch; color: var(--muted); user-select: none; }
.diff-add { background: color-mix(in srgb, var(--pass) 14%, transparent); }
.diff-del { background: color-mix(in srgb, var(--danger) 14%, transparent); }
.diff-hunk td, .diff-note td { padding: 2px 8px; color: var(--muted); background: color-mix(in srgb, var(--accent, #4f6bed) 8%, transparent); }
.diff-none { padding: 8px 10px; margin: 0; }
/* Commenting on a diff line (TRK-593) */
.diff-line-btn { all: unset; box-sizing: border-box; display: inline-block; min-width: 3ch; padding: 0 3px; border-radius: 4px; cursor: pointer; color: inherit; }
.diff-line-btn:hover { background: var(--accent); color: var(--surface); }
.diff-line-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.diff-comment-form td, .diff-comment-posted td { padding: 8px; background: var(--sunken); }
.diff-comment { display: grid; gap: 6px; max-width: 640px; font: 13px/1.5 var(--font-ui); white-space: normal; }
.diff-comment p { margin: 0; overflow-wrap: anywhere; }
.diff-comment textarea { width: 100%; box-sizing: border-box; }
.code-comment-hint { margin: 0 0 8px; }

/* Code colours and changed words in diffs (TRK-594, TRK-597) */
:root { --syn-keyword: #a626a4; --syn-string: #2b7a0b; --syn-comment: #8a8f98; --syn-number: #b35900; --syn-tag: #c0352b; --syn-attr: #8a5cd6; --syn-property: #1f6feb; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) { --syn-keyword: #d38cf0; --syn-string: #9ad27a; --syn-comment: #7f8794; --syn-number: #f0a35e; --syn-tag: #f08a80; --syn-attr: #c3a6ff; --syn-property: #79b8ff; }
}
:root[data-theme="dark"], :root[data-theme="graphite"], :root[data-theme="midnight"], :root[data-theme="onyx"], :root[data-theme="contrast-dark"] {
  --syn-keyword: #d38cf0; --syn-string: #9ad27a; --syn-comment: #7f8794; --syn-number: #f0a35e; --syn-tag: #f08a80; --syn-attr: #c3a6ff; --syn-property: #79b8ff;
}
.syn-keyword { color: var(--syn-keyword); }
.syn-string { color: var(--syn-string); }
.syn-comment { color: var(--syn-comment); font-style: italic; }
.syn-number { color: var(--syn-number); }
.syn-tag { color: var(--syn-tag); }
.syn-attr { color: var(--syn-attr); }
.syn-property { color: var(--syn-property); }
mark.diff-word { color: inherit; border-radius: 3px; padding: 1px 0; }
.diff-add mark.diff-word { background: color-mix(in srgb, var(--pass) 38%, transparent); }
.diff-del mark.diff-word { background: color-mix(in srgb, var(--danger) 38%, transparent); }
.code-file-type { flex: none; min-width: 2.4em; padding: 0 5px; border-radius: 4px; background: var(--accent); color: var(--surface); font-size: 0.7em; font-weight: 700; text-align: center; line-height: 1.7; align-self: center; }
.code-vscode { margin-left: auto; padding: 1px 8px; font-size: 12px; }
.code-folder { margin: 0 0 8px; }
@media (max-width: 600px) { .code-vscode { display: none; } }

/* ---- Loops page (TRK-615) ---- */
.loops-head {
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.loops-title {
  min-width: 0;
}

.loops-title .sub {
  margin: 4px 0 0;
  color: var(--muted);
}

.loops-list {
  display: grid;
  gap: 12px;
  max-width: 900px;
}

.loop-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  min-width: 0;
}

/* TRK-618: the template gallery under your loops */
.loop-gallery {
  margin-top: 32px;
}

.loop-gallery h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.loop-template-group h3 {
  margin: 16px 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.loop-templates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.loop-template {
  position: relative;
  min-width: 0;
}

.loop-template-pick {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  height: 100%;
  padding: 12px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 150ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .loop-template-pick:hover {
    border-color: var(--accent);
  }
}

.loop-template-pick:active {
  transform: scale(0.98);
}

.loop-template-line {
  font-size: 13px;
}

.loop-template-when {
  font-size: 12px;
}

.loop-template-remove {
  position: absolute;
  top: 6px;
  right: 6px;
}

.loop-save-template {
  margin-right: auto;
}

.loop-skeleton {
  height: 132px;
  background: var(--sunken);
  border-color: transparent;
}

.loop-main {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.loop-text {
  flex: 1;
  min-width: 0;
}

.loop-text p {
  margin: 4px 0 0;
}

.loop-name {
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.loop-meta {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.loop-next {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.loop-instruction {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.loop-actions {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.loop-actions .switch {
  margin-right: 4px;
}

.loop-runs-toggle {
  margin-top: 12px;
  padding: 4px 6px 4px 2px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.loop-runs-toggle:hover {
  color: var(--text);
}

.loop-runs {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.loop-run {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.loop-run time {
  font-variant-numeric: tabular-nums;
}

.loop-run .sub,
.loop-runs-empty {
  color: var(--muted);
}

.loop-runs-empty {
  margin: 8px 0 0;
  font-size: 13px;
}

.loop-run-text {
  flex-basis: 100%;
  margin: 0;
  overflow-wrap: anywhere;
}

p.loop-run-text {
  white-space: pre-wrap;
}

.loop-run-where {
  flex-basis: 100%;
  margin: 0;
  font-size: 13px;
}

.loop-run-problem {
  color: var(--danger);
}

.loop-may .sub,
.loop-conditions-set .sub {
  flex-basis: 100%;
  margin: 0 0 4px;
}

/* TRK-619: "Only when" conditions, one row each: field, is / is not, value, remove */
.loop-conditions {
  flex-basis: 100%;
  display: grid;
  gap: 8px;
}

.loop-conditions:empty {
  display: none;
}

.loop-condition {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) minmax(0, 1.4fr) auto;
  gap: 8px;
  align-items: center;
}

.loop-condition select {
  width: 100%;
  min-width: 0;
}

.loop-add-condition {
  justify-self: start;
}

.lozenge.run-skipped {
  color: var(--muted);
}

.loop-run-text.msg-body p {
  margin: 0 0 8px;
}

.lozenge.run-done {
  background: var(--pass);
  border-color: var(--pass);
  color: var(--accent-text);
}

.lozenge.run-failed {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--accent-text);
}

.lozenge.run-running,
.lozenge.run-queued {
  background: var(--selected);
  color: var(--selected-text);
}

.lozenge.run-missed {
  border-color: var(--danger);
  background: transparent;
  color: var(--danger);
}

.loop-form textarea {
  resize: vertical;
}

.loop-form [hidden] {
  display: none;
}

.loop-form label.check {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
}

.loop-days {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  padding: 0;
  border: 0;
}

.loop-days legend {
  margin-bottom: 4px;
  padding: 0;
}

.loop-enabled {
  display: flex;
  gap: 8px;
  align-items: center;
}

@media (max-width: 760px) {
  .loop-main {
    flex-direction: column;
    gap: 12px;
  }

  .loop-actions {
    justify-content: flex-start;
  }

  .loop-actions button {
    min-height: 44px;
  }
}

/* Settings > Brand (TRK-632). The logo stages and dark swatch strip are fixed light and dark on purpose: they
   preview the brand on a white and a near-black background whatever theme the app is in. */
.bk-kit { max-width: 760px; }
/* The head draws no box of its own, so its status row can stay in view (sticky inside the whole kit) while editing */
.bk-head { display: contents; }
.bk-intro { margin: 0 0 4px; max-width: 70ch; }
.bk-head-row { position: sticky; top: 60px; z-index: 1; margin: 0 0 10px; padding: 6px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 22px; background: var(--panel-bg, var(--bg)); }
.bk-status { font-size: 12px; color: var(--muted); }
.bk-status.saved::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--pass); vertical-align: middle; }
.bk-status.failed { color: var(--danger); }
.bk-history-toggle { margin-left: auto; font-size: 12px; }
.bk-history { margin: 0 0 14px; }
.bk-part h3 { font-size: 14px; margin: 18px 0 8px; }
.bk-part h3 .sub { font-weight: 400; }
.bk-note { margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; background: var(--selected); color: var(--selected-text); }
.bk-check { display: flex; align-items: center; gap: 8px; margin: 12px 0; }
/* Edit in place (TRK-666): an admin's values read as text, and only show they're a field on hover or focus */
.bk-inline { width: 100%; min-width: 0; margin: -4px 0 -4px -7px; padding: 3px 6px; font: inherit; color: var(--text); background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm); resize: none; overflow: hidden; }
textarea.bk-inline { display: block; field-sizing: content; min-height: 1lh; white-space: pre-wrap; }
.bk-inline::placeholder { color: var(--muted); font-style: italic; }
@media (hover: hover) and (pointer: fine) { .bk-inline:hover { border-color: var(--border); background: var(--surface); } }
.bk-inline:focus, .bk-inline:focus-visible { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: var(--ring); }
.bk-text { white-space: pre-wrap; }
.bk-logos { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 14px; }
.bk-logo { min-width: 0; display: grid; gap: 8px; align-content: start; }
.bk-logo-head { display: grid; gap: 2px; }
.bk-logo-stages { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
button.bk-logo-pick { padding: 0; width: 100%; cursor: pointer; background: none; transition: border-color 0.15s, box-shadow 0.15s; }
@media (hover: hover) and (pointer: fine) { button.bk-logo-pick:hover { border-color: var(--text); } }
button.bk-logo-pick:focus-visible { outline: none; box-shadow: var(--ring); }
.bk-logo-stage { aspect-ratio: 4 / 3; display: grid; place-items: center; padding: 12px; min-width: 0; }
.bk-logo-stage.light { background: #ffffff; color: #5b6474; }
.bk-logo-stage.dark { background: #0c0c0e; color: #a0a4ad; }
.bk-logo-stage .muted { color: inherit; font-size: 12px; }
.bk-logo-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.bk-file-name { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-file-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bk-swatches { list-style: none; margin: 0 0 10px; padding: 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; border-radius: 10px; border: 1px solid var(--border); }
.bk-swatches > li { min-width: 0; display: grid; }
.bk-swatches.on-light { background: #ffffff; color: #101828; }
.bk-swatches.on-dark { background: #0c0c0e; color: #ededef; }
.bk-swatch { min-width: 0; display: grid; gap: 2px; align-content: start; font-size: 12px; }
button.bk-swatch { margin: -4px; padding: 4px; color: inherit; font: inherit; font-size: 12px; text-align: left; background: none; border: 0; border-radius: 10px; cursor: pointer; transition: background-color 0.15s, box-shadow 0.15s; }
@media (hover: hover) and (pointer: fine) { button.bk-swatch:hover { background: rgb(127 127 127 / 0.12); } }
button.bk-swatch:focus-visible { outline: none; box-shadow: var(--ring); }
button.bk-swatch.open { box-shadow: 0 0 0 2px currentColor; }
.bk-swatch-chip { height: 56px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 15px; box-shadow: inset 0 0 0 1px rgb(127 127 127 / 0.25); }
.bk-swatch-new .bk-swatch-chip { font-size: 22px; font-weight: 400; box-shadow: none; border: 1px dashed rgb(127 127 127 / 0.6); opacity: 0.8; }
.bk-swatch-name { font-weight: 600; overflow-wrap: anywhere; }
.bk-swatch-hex { font-family: var(--mono, ui-monospace, monospace); opacity: 0.8; }
.bk-swatch-use { opacity: 0.75; overflow-wrap: anywhere; }
.bk-swatch-editor { margin: 0 0 12px; padding: 12px; display: grid; gap: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.bk-swatch-editor-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 96px; gap: 8px; align-items: center; }
.bk-swatch-editor input:not([type="color"]) { width: 100%; min-width: 0; }
.bk-swatch-editor input[type="color"] { width: 40px; height: 34px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; }
.bk-swatch-editor-actions { display: flex; justify-content: space-between; gap: 8px; }
.bk-hex { font-family: var(--mono, ui-monospace, monospace); }
.bk-hex-problem { margin: 0; }
.bk-list-rows { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 4px; }
.bk-list-rows li { display: flex; gap: 4px; align-items: center; }
.bk-list-rows li .bk-inline { flex: 1; margin: -4px 0; }
.bk-list-rows li .bk-inline:first-child { margin-left: -7px; }
.bk-items { margin: 0; padding-left: 18px; }
button.bk-remove { flex-shrink: 0; padding: 2px 8px; line-height: 1; font-size: 16px; color: var(--muted); }
button.bk-add { padding: 4px 0; border: 0; background: none; color: var(--muted); font-size: 12px; }
@media (hover: hover) and (pointer: fine) { button.bk-add:hover, button.bk-remove:hover { color: var(--text); } }
.bk-fonts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 18px; margin-bottom: 16px; }
.bk-font { min-width: 0; }
.bk-font h3 { margin-top: 4px; }
.bk-font-sample { margin: 0 0 8px; padding: 12px; border-radius: 8px; background: var(--sunken); overflow-wrap: anywhere; }
.bk-font-sample.heading { font-size: 22px; font-weight: 700; }
.bk-font-sample.body { font-size: 15px; }
.bk-font .bk-file-actions { margin-top: 10px; }
.bk-font .bk-facts { grid-template-columns: minmax(60px, 80px) minmax(0, 1fr); }
.bk-facts { margin: 0; display: grid; grid-template-columns: minmax(120px, 180px) minmax(0, 1fr); gap: 10px 16px; align-items: baseline; }
.bk-fact { display: contents; }
.bk-facts dt { color: var(--muted); }
.bk-facts dd { margin: 0; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bk-facts dd ul { margin: 0; padding-left: 18px; }
.bk-example { margin: 0 0 10px; padding: 10px 14px; border-radius: 8px; background: var(--sunken); white-space: pre-wrap; }
.bk-example-edit { display: flex; gap: 8px; align-items: flex-start; padding: 8px 8px 8px 14px; }
.bk-example-edit .bk-inline { margin: 0; }
.bk-changes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
/* History rows (TRK-641): look at a change's version and put it back */
.bk-change { min-width: 0; }
.bk-change-line { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.bk-change-line > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.bk-change-actions { display: inline-flex; flex-wrap: wrap; gap: 12px; flex-shrink: 0; font-size: 13px; }
.bk-version { margin: 6px 0 4px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--sunken); font-size: 13px; overflow-wrap: anywhere; }
.bk-version > div > .sub { margin: 0 0 6px; }
.bk-version-fields { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 0; }
.bk-version-fields dt { color: var(--muted); }
.bk-version-fields dd { margin: 0; min-width: 0; }
.bk-version-fields .bk-version-fields { grid-template-columns: max-content minmax(0, 1fr); }
.bk-version-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.bk-version-color { display: inline-flex; align-items: center; gap: 6px; }
.bk-version-swatch { flex-shrink: 0; width: 14px; height: 14px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgb(127 127 127 / 0.35); }
/* Kit ready (TRK-667): six dots for the six basics, and what's still missing */
.bk-ready { margin: 0 0 4px; display: flex; align-items: center; gap: 10px; font-weight: 600; }
.bk-ready-dots { display: inline-flex; gap: 4px; flex-shrink: 0; }
.bk-ready-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.bk-ready-dots span.on { background: var(--text); }
.bk-ready.done .bk-ready-dots span.on { background: var(--pass); }
/* Folds: extras stay closed until something in them is set, and open or close on click */
.bk-fold { margin-top: 12px; }
.bk-fold-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .bk-fold-toggle:hover { color: var(--text); } }
.bk-fold-toggle:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }
.bk-fold-caret { width: 0; height: 0; border-left: 5px solid currentColor; border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform 0.15s; }
.bk-fold.open > .bk-fold-toggle .bk-fold-caret { transform: rotate(90deg); }
.bk-fold-body { padding-top: 8px; }
.bk-fold-body > .bk-facts + .bk-check, .bk-fold-body > .bk-check { margin: 10px 0; }
.bk-rules > .bk-fold { margin-top: 0; }
.bk-rules > .bk-fold > .bk-fold-toggle { color: var(--text); font-size: 15px; }
.bk-tag { margin-left: 6px; padding: 0 5px; border-radius: 4px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; background: rgb(127 127 127 / 0.18); vertical-align: 1px; }
.bk-kind { display: flex; align-items: center; gap: 8px; }
.bk-tone { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bk-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; user-select: none; transition: background-color 0.15s, border-color 0.15s; }
.bk-chip input { margin: 0; }
.bk-chip:has(input:checked) { background: var(--selected); border-color: var(--text); color: var(--selected-text); }
.bk-chip:has(input:focus-visible) { box-shadow: var(--ring); }
.bk-tone .bk-tone-own { flex: 1 1 180px; width: auto; margin: 0; }
/* Font picker (TRK-668): the name box searches the pinned Google Fonts list, each result in its own face */
.bk-font-picker { position: relative; min-width: 0; }
.bk-font-results { position: absolute; z-index: 5; top: calc(100% + 6px); left: -7px; min-width: min(280px, calc(100vw - 48px)); right: 0; max-height: 304px; overflow-y: auto; margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgb(16 24 40 / 0.14); overscroll-behavior: contain; }
.bk-font-results[hidden] { display: none; }
.bk-font-results [role="option"] { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap; }
@media (hover: hover) and (pointer: fine) { .bk-font-results [role="option"]:hover { background: var(--sunken); } }
.bk-font-results [role="option"][aria-selected="true"] { background: var(--selected); color: var(--selected-text); }
.bk-font-face { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 17px; }
.bk-font-kind { flex-shrink: 0; font-size: 11px; color: var(--muted); }
.bk-font-none { padding: 8px 10px; color: var(--muted); font-size: 13px; white-space: normal; }
.bk-weights-block, .bk-weights-slot > .bk-facts { margin-top: 10px; }
.bk-weights-block > .sub { margin: 0 0 6px; }
.bk-weights { display: flex; flex-wrap: wrap; gap: 6px; }
.bk-weight { padding: 2px 9px; font-size: 13px; }
/* Live preview (TRK-668): beside the kit and in view on a wide screen; first on a narrow one. The sample stage takes
   the kit's own colors and fonts, never the app's, so it shows the brand as it is. */
.bk-layout { display: grid; gap: 0; }
.bk-parts { min-width: 0; }
.bk-preview { min-width: 0; }
.bk-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bk-preview-head h2 { margin: 0; }
.bk-preview-theme { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.bk-preview-theme button { border: 0; border-radius: 0; background: none; padding: 4px 12px; font-size: 13px; color: var(--muted); }
.bk-preview-theme button[aria-pressed="true"] { background: var(--selected); color: var(--selected-text); font-weight: 600; }
.bk-preview-theme button:focus-visible { outline: none; box-shadow: inset var(--ring); }
.bk-sample-stage { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; padding: 12px; border-radius: 10px; border: 1px solid var(--border); background: color-mix(in srgb, var(--s-bg) 92%, var(--s-text)); transition: background-color 0.15s; }
.bk-sample { min-width: 0; display: grid; gap: 10px; align-content: start; padding: 14px; border-radius: 10px; background: var(--s-bg); color: var(--s-text); font-family: var(--s-body); box-shadow: 0 0 0 1px rgb(127 127 127 / 0.18); overflow-wrap: anywhere; }
.bk-sample-post-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bk-sample-avatar { flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; object-fit: cover; }
.bk-sample-who { display: grid; min-width: 0; font-size: 13px; line-height: 1.3; }
.bk-sample-who strong, .bk-sample-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-sample-who span { opacity: 0.65; }
.bk-sample-body { margin: 0; font-size: 14px; line-height: 1.5; }
.bk-sample-image { display: grid; gap: 14px; align-content: space-between; min-width: 0; min-height: 160px; padding: 16px; border-radius: 8px; background: var(--s-primary); color: var(--s-on-primary); }
.bk-sample-stage .bk-sample-headline { margin: 0; font-family: var(--s-heading); font-size: 22px; font-weight: 700; line-height: 1.2; text-wrap: balance; }
.bk-sample-stage .bk-sample-image .bk-sample-headline { font-size: 24px; }
.bk-sample-logo { display: block; max-width: 120px; max-height: 32px; object-fit: contain; object-position: left center; }
.bk-sample-wordmark { font-weight: 700; font-size: 17px; }
.bk-sample-email-bar { padding-bottom: 10px; border-bottom: 1px solid rgb(127 127 127 / 0.25); }
.bk-sample-button { justify-self: start; padding: 8px 16px; border-radius: 8px; background: var(--s-accent); color: var(--s-on-accent); font-size: 14px; font-weight: 600; }
.bk-sample-hint { opacity: 0.55; font-style: italic; font-weight: 400; }
@media (max-width: 1239px) { .bk-preview { margin-bottom: 14px; } }
@media (min-width: 1240px) {
  .bk-kit { max-width: 1180px; }
  .bk-layout { grid-template-columns: minmax(0, 760px) minmax(340px, 400px); grid-template-areas: "parts preview"; gap: 0 20px; align-items: start; }
  .bk-parts { grid-area: parts; }
  .bk-preview { grid-area: preview; position: sticky; top: 104px; }
  .bk-sample-stage { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .bk-sample-stage { transition: none; } }
@media (max-width: 600px) {
  .bk-facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .bk-facts dd { margin-bottom: 8px; }
  .bk-inline { margin-left: 0; }
}
/* 16px on phones, so iOS doesn't zoom in when a field gets focus */
@media (max-width: 760px) { .bk-head-row { top: var(--topbar-h, 102px); } .bk-inline, .bk-swatch-editor input, .bk-swatch-editor select { font-size: 16px; } }

/* ---- Funnel pages (TRK-602) ---- */
.funnel-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  transition: border-color 150ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .funnel-row:hover { border-color: var(--accent); }
}
.funnel-row-name { font-weight: 600; overflow-wrap: anywhere; }
.funnel-row-meta { font-size: 12px; }
/* Funnels as ordered steps (TRK-724) */
.funnel-flows { gap: 8px; }
.funnel-flow { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.funnel-flow-head { display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 12px 14px; background: none; border: 0; text-align: left; cursor: pointer; color: var(--text); font: inherit; }
.funnel-flow-head .funnel-row-name { min-width: 0; }
.funnel-flow-head .sub { margin-left: auto; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.funnel-flow-chev { display: inline-flex; flex-shrink: 0; align-self: center; color: var(--muted); transform: rotate(-90deg); transition: transform 150ms ease; }
.funnel-flow-head[aria-expanded="true"] .funnel-flow-chev { transform: none; }
@media (prefers-reduced-motion: reduce) { .funnel-flow-chev { transition: none; } }
.funnel-flow.is-open { padding-bottom: 12px; }
.funnel-flow.is-open > :not(.funnel-flow-head) { margin-left: 14px; margin-right: 14px; }
.funnel-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.funnel-step { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.funnel-step-num { width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center; font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.funnel-step .funnel-section-tools { display: flex; gap: 4px; flex-shrink: 0; }
.funnel-flow-note, .funnel-flow-empty { margin-top: 10px; margin-bottom: 0; }
.funnel-flow-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.funnel-flow-add { display: flex; gap: 8px; margin-right: auto; min-width: 0; }
.funnel-flow-add select { min-width: 0; max-width: 260px; }
/* TRK-766: search, list or grid, and each funnel's summary and menu */
.funnel-list-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; max-width: 900px; }
.funnel-search { flex: 1 1 auto; min-width: 0; max-width: 360px; font-size: 16px; }
@media (min-width: 720px) { .funnel-search { font-size: 14px; } }
.funnel-view { display: inline-flex; margin-left: auto; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--sunken); flex-shrink: 0; }
.funnel-view button { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 0; border-radius: 6px; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.funnel-view button svg { width: 15px; height: 15px; }
.funnel-view button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.funnel-view button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (max-width: 520px) { .funnel-view button { padding: 6px 10px; } .funnel-view button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }
.funnel-flow-bar { display: flex; align-items: flex-start; }
.funnel-flow-bar .funnel-flow-head { flex: 1 1 auto; min-width: 0; align-items: flex-start; border-radius: 10px 0 0 10px; }
.funnel-flow-bar .funnel-flow-chev { align-self: flex-start; margin-top: 3px; }
.funnel-flow-summary { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.funnel-flow-summary .sub { margin-left: 0; flex-shrink: 1; }
.funnel-flow.is-open > .funnel-flow-bar { margin: 0; }
.funnel-more-wrap { position: relative; flex-shrink: 0; margin-left: auto; }
.funnel-flow-bar > .funnel-more-wrap { margin: 8px 8px 0 0; }
.funnel-more { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.funnel-more svg { width: 18px; height: 18px; }
.funnel-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 180px; padding: 6px; display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .14); transform-origin: top right; animation: funnel-menu-in 150ms cubic-bezier(0.23, 1, 0.32, 1); }
@keyframes funnel-menu-in { from { opacity: 0; transform: scale(.95); } }
@media (prefers-reduced-motion: reduce) { .funnel-menu { animation: none; } }
.funnel-menu [role="menuitem"] { width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.funnel-menu [role="menuitem"]:hover:not(:disabled), .funnel-menu [role="menuitem"]:focus-visible { background: var(--hover, color-mix(in srgb, var(--accent) 10%, transparent)); outline: none; }
.funnel-menu [role="menuitem"].danger { color: var(--danger); }
.funnel-menu [role="menuitem"]:disabled { color: var(--muted); cursor: default; }
/* TRK-769: a funnel's home */
.funnel-home-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; max-width: 900px; }
.funnel-home-back { flex: 0 0 auto; margin-right: 100%; }
.funnel-home-title { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.funnel-home-title h1 { margin: 0; overflow-wrap: anywhere; }
.funnel-home-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.funnel-home-body { margin-top: 16px; max-width: 900px; }
.funnel-home-tabs { max-width: 900px; }
.funnel-home-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.funnel-home-step { display: grid; grid-template-columns: auto 160px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.funnel-home-thumb { padding: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--sunken); overflow: hidden; cursor: pointer; }
.funnel-home-thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.funnel-home-step-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.funnel-home-step-body .funnel-row-name { padding: 0; text-align: left; }
.funnel-home-step .funnel-section-tools { display: flex; gap: 4px; }
@media (max-width: 640px) {
  .funnel-home-step { grid-template-columns: auto minmax(0, 1fr); }
  .funnel-home-thumb { grid-column: 2; }
  .funnel-home-step-body, .funnel-home-step .funnel-section-tools { grid-column: 2; }
}
.flow-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 0 0 16px; }
.flow-tile { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.flow-tile dt { font-size: 12px; color: var(--muted); }
.flow-tile dd { margin: 2px 0 0; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.flow-tile .sub { font-size: 12px; }
.flow-report-heading { font-size: 14px; color: var(--muted); font-weight: 600; margin: 20px 0 8px; }
.funnel-grid { list-style: none; margin: 0; padding: 0; max-width: 900px; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.funnel-card { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.funnel-card-open { display: block; padding: 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 10px 10px 0 0; background: var(--sunken); cursor: pointer; overflow: hidden; }
.funnel-card-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.funnel-thumb { position: relative; aspect-ratio: 16 / 10; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.funnel-thumb iframe { position: absolute; top: 0; left: 0; width: 1280px; height: 800px; border: 0; pointer-events: none; transform: scale(var(--thumb-scale, .2)); transform-origin: top left; background: #fff; }
.funnel-card-body { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px; min-width: 0; }
.funnel-card-body .funnel-row-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.funnel-card-body .funnel-more { width: 28px; height: 28px; }
dialog.funnel-flow-box { width: min(440px, calc(100vw - 32px)); }
/* New funnel: Blank, Ask your agent or From a template (TRK-765) */
dialog.funnel-new-way { width: min(480px, calc(100vw - 32px)); }
dialog.funnel-new-way h2 { margin: 0 0 4px; }
dialog.funnel-new-way form { display: grid; gap: 12px; margin-top: 12px; }
dialog.funnel-new-way .funnel-field textarea { font-size: 16px; }
dialog.funnel-new-way .funnel-field input { font-size: 16px; }
.funnel-new-body > .funnel-back { margin-bottom: 8px; }
.funnel-ways { display: grid; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.funnel-way { display: grid; gap: 2px; width: 100%; padding: 12px 14px; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; transition: border-color 150ms ease; }
.funnel-way .sub { font-size: 13px; }
.funnel-way-main { border-color: var(--accent); }
@media (hover: hover) and (pointer: fine) { .funnel-way:hover { border-color: var(--accent); } }
.funnel-way:active { transform: scale(0.98); }
@media (max-width: 600px) {
  .funnel-step { grid-template-columns: 28px minmax(0, 1fr); }
  .funnel-step .funnel-section-tools { grid-column: 2; }
  .funnel-flow-add select { font-size: 16px; }
}
/* TRK-760: a funnel's step report, a column per step with the drop between */
.flow-report { display: grid; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.flow-report-body { min-width: 0; container-type: inline-size; }
.flow-report-steps { list-style: none; margin: 0; padding: 0 0 4px; display: flex; align-items: stretch; gap: 0; overflow-x: auto; }
.flow-report-step { flex: 1 0 180px; min-width: 0; display: grid; align-content: start; gap: 6px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--sunken); }
.flow-report-num { font-size: 12px; font-weight: 600; color: var(--accent); }
.flow-report-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-report-visits { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.flow-report-visits .sub { font-size: 13px; font-weight: 400; }
.flow-report-bar { display: block; height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, transparent); overflow: hidden; }
.flow-report-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.flow-report-figures { display: grid; gap: 2px; margin: 4px 0 0; font-size: 13px; }
.flow-report-figures > div { display: flex; justify-content: space-between; gap: 8px; }
.flow-report-figures dt { color: var(--muted); }
.flow-report-figures dd { margin: 0; font-variant-numeric: tabular-nums; }
.flow-report-gap { flex: 0 0 112px; white-space: nowrap; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0 6px; text-align: center; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.flow-report-gap svg { transform: rotate(-90deg); }
.flow-report-drop.is-drop { color: var(--danger); font-weight: 600; }
/* Too narrow for the steps side by side: one under the other, the drop between them on one line */
@container (max-width: 680px) {
  .flow-report-steps { flex-direction: column; overflow: visible; }
  .flow-report-step { flex-basis: auto; }
  .flow-report-figures { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); column-gap: 20px; }
  .flow-report-gap { flex: none; flex-direction: row; gap: 8px; padding: 6px 0; }
  .flow-report-gap svg { transform: none; }
}
@media (max-width: 600px) {
  .flow-report .funnel-report-bar .funnel-field input { font-size: 16px; }
}

.funnel-head { gap: 8px; }
.funnel-name { flex: 1 1 220px; min-width: 0; max-width: 420px; font-weight: 600; }
.funnel-status { font-size: 12px; }
.funnel-head-end { display: flex; gap: 8px; margin-left: auto; }

/* A page's Edit and Report views (TRK-606) */
.funnel-tabs { margin-bottom: 12px; width: max-content; }
.funnel-report { display: grid; gap: 16px; }
.funnel-report-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.funnel-report-bar .funnel-field input { width: auto; font-size: 16px; }
/* TRK-644: A/B tests */
.funnel-ab { display: grid; gap: 8px; }
.funnel-ab-start { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.funnel-ab-start select, .funnel-ab-start input { font-size: 16px; }
.funnel-ab-start input { width: 6em; }
.funnel-ab-note { margin: 0; font-weight: 500; }
.funnel-ab-actions { display: flex; gap: 8px; }
.funnel-report-bar p { flex: 1 1 320px; margin: 0; font-size: 12px; max-width: 70ch; }
.funnel-report-body { display: grid; gap: 12px; }
.funnel-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 0; }
.funnel-totals div { padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.funnel-totals dt { font-size: 12px; color: var(--muted); }
.funnel-totals dd { margin: 4px 0 0; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.funnel-report-table table { min-width: 640px; }
.funnel-report-table td { font-variant-numeric: tabular-nums; text-align: right; }
.funnel-report-table th[scope="col"]:not(:first-child) { text-align: right; }
.funnel-report-table th[scope="row"] { font-weight: 400; font-size: 13px; color: var(--text); white-space: nowrap; }

.funnel-editor {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.funnel-sections { display: grid; gap: 10px; min-width: 0; }
.funnel-section, .funnel-signups { display: grid; gap: 10px; }
.funnel-signups p { margin: 0; }
.funnel-hint { margin-top: -6px; }
.funnel-section.is-hidden { opacity: 0.7; }
.funnel-section-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.funnel-section-tools { display: flex; gap: 2px; margin-left: auto; flex-shrink: 0; }
.funnel-section-tools button { padding: 2px 8px; }
.funnel-field { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.funnel-field input, .funnel-field textarea, .funnel-item input, .funnel-item textarea { width: 100%; color: var(--text); font-size: 13px; }
/* TRK-636: the form on other websites */
.funnel-embed, .funnel-bot-agent { display: grid; gap: 8px; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.funnel-snippet { font-family: var(--mono, ui-monospace, monospace); font-size: 12px; resize: vertical; overflow-wrap: anywhere; }
.funnel-embed-actions { display: flex; align-items: center; gap: 8px; }
.funnel-field textarea, .funnel-item textarea { resize: vertical; }
.funnel-items { display: grid; gap: 8px; margin: 0; padding: 8px; border: 1px solid var(--border); border-radius: 8px; min-width: 0; }
.funnel-items legend { padding: 0 4px; font-size: 12px; color: var(--muted); }
.funnel-item { display: grid; gap: 4px; }
.funnel-item > button { justify-self: start; padding: 2px 8px; font-size: 12px; }
/* TRK-719: a yes/no part of an entry, such as a plan that stands out, and the block picker */
.funnel-item-check { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text); }
.funnel-item-check input { width: auto; margin: 0; }
.funnel-items + .funnel-items { margin-top: 0; }
select.funnel-add-block { justify-self: start; max-width: 100%; font-size: 13px; }
/* TRK-750: the prebuilt section library. Thumbnails are the real section drawn at 1280px wide, scaled to 218px. */
.funnel-section-tools button[aria-pressed="true"] { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
dialog.funnel-global-box.prebuilt-box { width: min(760px, calc(100vw - 32px)); max-height: min(86vh, 900px); }
.prebuilt-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 12px; }
.prebuilt-bar input[type="search"] { flex: 1 1 200px; min-width: 0; font-size: 16px; }
.prebuilt-tone { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; padding: 2px; gap: 2px; background: var(--sunken); }
.prebuilt-tone button { border: 0; background: transparent; padding: 4px 12px; border-radius: 6px; font-size: 13px; color: var(--muted); }
.prebuilt-tone button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }
.prebuilt-group + .prebuilt-group { margin-top: 16px; }
.prebuilt-group h3 { margin: 0 0 8px; font-size: 13px; }
.prebuilt-group h3 .sub { font-weight: 400; }
.prebuilt-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, 218px); gap: 12px; justify-content: start; }
.prebuilt-tile { display: grid; gap: 6px; width: 218px; padding: 0; border: 0; background: none; text-align: left; color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer; }
.prebuilt-thumb { position: relative; display: block; width: 218px; height: 136px; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--sunken); transition: border-color 150ms ease; }
.prebuilt-thumb-frame { position: absolute; left: 0; top: 0; display: block; width: 1280px; height: 800px; border: 0; transform: scale(0.1703125); transform-origin: 0 0; pointer-events: none; }
.prebuilt-tile:focus-visible { outline: none; }
.prebuilt-tile:focus-visible .prebuilt-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .prebuilt-tile:hover .prebuilt-thumb { border-color: var(--accent); } }
div.prebuilt-tile { cursor: default; pointer-events: none; } /* TRK-1101: Saved sections only shows them; they add from the Add panel */
.prebuilt-name { overflow-wrap: anywhere; }
.prebuilt-none { margin: 12px 0; }
/* TRK-751: the Saved tab */
.prebuilt-tabs { margin: 0 0 8px; }
.prebuilt-saved { display: grid; gap: 2px; align-content: start; width: 218px; }
.prebuilt-who { font-size: 12px; overflow-wrap: anywhere; }
.prebuilt-actions { display: flex; gap: 4px; }
.prebuilt-actions button { padding: 2px 8px; font-size: 12px; }
@media (max-width: 520px) { .prebuilt-tiles { grid-template-columns: minmax(0, 218px); justify-content: center; } }

.funnel-preview { position: sticky; top: 12px; min-width: 0; }
.funnel-preview-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.funnel-preview-bar h2 { margin: 0; font-size: 13px; }
.funnel-stage { display: flex; justify-content: center; padding: 12px; background: var(--sunken); border: 1px solid var(--border); border-radius: 8px; }
.funnel-frame { display: block; width: 100%; height: min(75vh, 900px); border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.funnel-stage-phone .funnel-frame { width: 390px; max-width: 100%; }

@media (max-width: 900px) {
  .funnel-editor { grid-template-columns: minmax(0, 1fr); }
  .funnel-preview { position: static; }
}

/* TRK-768: a funnel's steps inside the editor */
.funnel-editor.has-steps { grid-template-columns: minmax(0, 240px) minmax(0, 340px) minmax(0, 1fr); }
.funnel-with-steps { display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); gap: 16px; align-items: start; }
.funnel-steps-panel { position: sticky; top: 12px; display: grid; gap: 10px; min-width: 0; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.funnel-steps-panel h2 { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.funnel-steps-panel p { margin: 0; }
.funnel-steps-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.funnel-steps-top .sub { flex-shrink: 0; font-size: 12px; font-variant-numeric: tabular-nums; }
.funnel-steps-search { width: 100%; }
.funnel-steps-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.funnel-steps-item { display: grid; grid-template-columns: 16px 24px minmax(0, 1fr); align-items: center; gap: 6px; padding: 6px; border: 1px solid transparent; border-radius: 6px; background: var(--surface); }
.funnel-steps-item .funnel-step-num { width: 24px; height: 24px; font-size: 12px; }
.funnel-steps-item.is-here { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.funnel-steps-item.is-over { border-color: var(--accent); border-style: dashed; }
.funnel-steps-item.is-dragging { opacity: 0.5; }
.funnel-steps-grip { display: grid; place-items: center; color: var(--muted); cursor: grab; }
.funnel-steps-grip .nav-icon { width: 14px; height: 14px; }
.funnel-steps-name { display: grid; gap: 1px; min-width: 0; padding: 2px 4px; text-align: left; background: none; border: 0; border-radius: 4px; color: var(--text); cursor: pointer; }
.funnel-steps-name .funnel-steps-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; font-size: 13px; }
.funnel-steps-name .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.funnel-steps-name[aria-current="page"] .funnel-steps-label { color: var(--accent); }
.funnel-steps-tools { grid-column: 2 / -1; display: flex; gap: 2px; }
.funnel-steps-tools button { display: grid; place-items: center; min-width: 28px; height: 26px; padding: 0 6px; font-size: 13px; }
.funnel-steps-tools .nav-icon { width: 14px; height: 14px; }
.funnel-steps-tools .danger { margin-left: auto; }
.funnel-steps-none { padding: 6px; font-size: 12px; }
.funnel-steps-add { display: grid; gap: 8px; }
.funnel-steps-choices { display: grid; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.funnel-steps-choice { display: grid; gap: 4px; }
.funnel-steps-choice .sub { font-size: 12px; }
.funnel-steps-choice select { width: 100%; }
.funnel-step-pick { display: flex; align-items: center; gap: 6px; min-width: 0; }
.funnel-step-pick .sub { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.funnel-step-pick select { max-width: 240px; }
@media (hover: hover) and (pointer: fine) {
  .funnel-steps-name:hover { background: var(--sunken); }
}
@media (max-width: 1200px) {
  .funnel-editor.has-steps { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); }
  .funnel-editor.has-steps .funnel-steps-panel { grid-column: 1 / -1; position: static; }
}
@media (max-width: 900px) {
  .funnel-editor.has-steps, .funnel-with-steps { grid-template-columns: minmax(0, 1fr); }
  .funnel-with-steps .funnel-steps-panel { position: static; }
  .funnel-steps-search, .funnel-steps-choice select, .funnel-step-pick select { font-size: 16px; }
  .funnel-step-pick { flex-basis: 100%; }
  .funnel-step-pick select { max-width: none; flex: 1; min-width: 0; }
  .funnel-head-end { flex-wrap: wrap; }
}

/* Publishing a funnel page (TRK-603) */
.funnel-live { font-size: 12px; overflow-wrap: anywhere; }
dialog.funnel-publish { width: min(480px, calc(100vw - 32px)); }
dialog.funnel-publish form { display: grid; gap: 10px; }
/* TRK-635: a page's versions */
dialog.funnel-versions { width: min(560px, calc(100vw - 32px)); }
.funnel-version-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: min(60vh, 520px); overflow: auto; }
.funnel-version { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.funnel-version-text { flex: 1; min-width: 0; }
.funnel-version-note { margin: 4px 0 0; overflow-wrap: anywhere; }
.funnel-version > button, .funnel-version > .sub { flex-shrink: 0; }
.funnel-slug { display: flex; align-items: center; gap: 2px; min-width: 0; }
.funnel-slug > .sub { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.funnel-slug input { flex: 1 1 140px; min-width: 0; }
dialog.funnel-publish textarea { width: 100%; resize: vertical; }
/* TRK-850: sample proof still on a page, listed before it goes live */
.funnel-sample-warning { padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border)); border-radius: 8px; background: color-mix(in srgb, var(--danger) 7%, var(--surface)); font-size: 13px; }
.funnel-sample-warning[hidden] { display: none; }
.funnel-sample-warning ul { margin: 6px 0; padding-left: 18px; }
.funnel-sample-warning li { overflow-wrap: anywhere; }
.funnel-sample-warning p { margin: 0; }
/* TRK-715: global sections, linked from many pages */
.funnel-global-tag { flex-shrink: 0; padding: 1px 6px; border-radius: 999px; font-size: 11px; font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.funnel-section-head > strong { min-width: 0; overflow-wrap: anywhere; }
.funnel-global-note { margin: 0; font-size: 12px; }
.funnel-global-actions { display: flex; flex-wrap: wrap; gap: 6px; }
dialog.funnel-global-box { width: min(520px, calc(100vw - 32px)); }
dialog.funnel-global-box > .funnel-field + .funnel-field, dialog.funnel-global-box > .funnel-items { margin-top: 10px; }
dialog.funnel-global-edit { width: min(600px, calc(100vw - 32px)); }
.funnel-global-form { display: grid; gap: 12px; }
.funnel-global-used { margin-top: 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--sunken); font-size: 13px; }
.funnel-global-used ul { list-style: none; margin: 8px 0 0; padding: 0; max-height: 160px; overflow: auto; display: grid; gap: 4px; }
.funnel-global-used li { display: flex; align-items: baseline; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.funnel-global-live { margin-left: auto; flex-shrink: 0; font-size: 11px; font-weight: 600; color: var(--pass); }
.funnel-global-edit .form-actions { margin-top: 14px; }
/* TRK-753: a page's own text and pictures on a global section */
.funnel-own { border-top: 1px solid var(--border); padding-top: 8px; }
.funnel-own > summary { cursor: pointer; font-size: 13px; font-weight: 600; padding: 2px 0; }
.funnel-own > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.funnel-own > p { margin: 4px 0 8px; font-size: 12px; }
.funnel-own-field + .funnel-own-field { margin-top: 8px; }
.funnel-own-label { display: flex; align-items: center; gap: 6px; min-width: 0; }
.funnel-own-mark { flex-shrink: 0; padding: 1px 6px; border-radius: 999px; font-size: 11px; font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.funnel-own-reset { margin-left: auto; flex-shrink: 0; padding: 2px 8px; font-size: 12px; }
.funnel-global-versions-open { margin-right: auto; }
.funnel-global-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: min(60vh, 480px); overflow: auto; }
.funnel-global-list li { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--border); }
.funnel-global-row-text { flex: 1; min-width: 0; display: grid; gap: 2px; overflow-wrap: anywhere; }
.funnel-global-list li > button, .funnel-global-list li > .sub { flex-shrink: 0; }

/* Funnel booking (TRK-643) */
.funnel-booking { display: grid; gap: 8px; }
.funnel-checkout { display: grid; gap: 8px; } /* TRK-649 */
.funnel-warn { margin: 0; padding: 8px 10px; border-left: 3px solid var(--medium); border-radius: 6px; background: var(--surface-2, var(--surface)); font-size: 13px; }
.funnel-host { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.funnel-team-list { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; } .funnel-team-list li { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border: 1px solid var(--border); border-radius: 999px; } .funnel-team .funnel-hint { flex-basis: 100%; } /* TRK-957 */
.funnel-booking-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 8px 12px; }
.funnel-booking-grid .funnel-field { min-width: 0; }
.funnel-days { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; min-width: 0; }
.funnel-days legend { padding: 0; margin-bottom: 4px; font-size: 12px; color: var(--muted); }
.funnel-days label { display: inline-flex; align-items: center; gap: 6px; }
.funnel-day-hours { border: 0; margin: 0; padding: 0; display: grid; gap: 6px; min-width: 0; } /* TRK-980 */
.funnel-day-hours legend { padding: 0; margin-bottom: 4px; font-size: 12px; color: var(--muted); }
.funnel-day-hours-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; min-height: 28px; }
.funnel-day-hours-row label { display: inline-flex; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0; }
.funnel-day-hours-row > .sub { font-variant-numeric: tabular-nums; }
.funnel-day-hours-times { display: flex; align-items: center; gap: 6px; flex-basis: 100%; padding-left: 22px; }
.funnel-day-hours-times input { min-width: 0; flex: 1 1 0; }
.funnel-add { justify-self: start; }

/* Funnel quiz (TRK-645) */
.funnel-quiz { display: grid; gap: 10px; }
.funnel-question { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--sunken); min-width: 0; }
.funnel-answer { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; }
.funnel-answer input { flex: 1 1 160px; min-width: 0; }
.funnel-answer select { flex: 0 1 auto; min-width: 0; max-width: 100%; }
.funnel-add-small { justify-self: start; }
.funnel-sub-head { margin: 8px 0 0; font-size: 13px; }

/* TRK-647: the Set up the whole funnel choice above the funnel templates */
.funnel-whole {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  max-width: 70ch;
  margin: 12px 0 4px;
  cursor: pointer;
}
.funnel-whole input { flex: none; margin-top: 3px; }

/* TRK-648: a test an agent suggests, on a funnel page's Report tab */
.funnel-idea {
  display: grid;
  gap: 6px;
  max-width: 70ch;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--sunken);
}
.funnel-idea p { margin: 0; }
.funnel-idea-reason { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Funnel pages on a workspace's own domain (TRK-646) */
/* TRK-783: a picture field with its Upload button */
.funnel-picture { display: flex; gap: 6px; min-width: 0; }
.funnel-picture > input { flex: 1 1 auto; min-width: 0; }
.funnel-picture-upload { flex-shrink: 0; }
.funnel-domains, .funnel-payments, .funnel-chatbots { display: grid; gap: 10px; margin-top: 32px; }
.funnel-domains h2, .funnel-payments h2, .funnel-chatbots h2 { margin: 0; font-size: 16px; }
/* TRK-1131: the Payments section */
.payments-stripe { margin-top: 0; max-width: 720px; }
.payments-transactions { display: grid; gap: 12px; }
.payments-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.payments-filters button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.payments-table table { min-width: 560px; }
.payments-table td { vertical-align: top; }
.payments-table td .sub { font-size: 12px; margin: 2px 0 0; }
.payments-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
/* TRK-1132: Payments > Settings > Invoices */
.inv-settings { margin-bottom: 32px; max-width: 760px; }
.inv-settings h3 { margin: 24px 0 8px; font-size: 14px; }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 16px; align-items: start; }
.inv-field { display: grid; gap: 4px; min-width: 0; }
.inv-label { font-size: 13px; color: var(--muted); }
.inv-field input, .inv-field textarea, .inv-field select { width: 100%; box-sizing: border-box; }
.inv-row { display: flex; flex-wrap: wrap; gap: 12px 16px; }
.inv-row .inv-field { width: 160px; }
.inv-preview { margin: 8px 0 12px; }
.inv-field .sub { color: var(--muted); }
.inv-logo { max-height: 48px; max-width: 200px; object-fit: contain; align-self: start; }
/* TRK-1162: the logo choice under Payments > Settings, its preview at the chosen size (as the client's page draws it) */
.inv-logo-settings { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 16px; }
.inv-logo-choice { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.inv-logo-preview { display: flex; align-items: center; padding: 12px; border: 1px dashed var(--border); border-radius: 10px; background: #fff; max-width: 320px; }
.inv-logo-settings .inv-logo { max-height: 56px; max-width: 200px; }
.inv-logo-settings .inv-logo.is-small { max-height: 36px; max-width: 140px; }
.inv-logo-settings .inv-logo.is-large { max-height: 88px; max-width: 280px; }
.inv-logo-buttons, .inv-logo-sizes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inv-logo-sizes [aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: var(--accent); }
.inv-rates { display: grid; gap: 8px; justify-items: start; }
.inv-rate { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inv-rate > input { width: 200px; }
.inv-pct { display: inline-flex; align-items: center; gap: 4px; }
.inv-pct input { width: 80px; }
.inv-rate [aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.inv-settings .form-row-buttons { margin-top: 20px; }
/* TRK-1179: each change saves by itself; while it saves, or if it failed, a small bar at the bottom of the screen says so */
.inv-number { display: flex; gap: 8px; align-items: center; }
.inv-number input { flex: none; width: 160px; }
.inv-number button { white-space: nowrap; }
.inv-row .inv-field:has(.inv-number > button:not([hidden])) { width: auto; }
.inv-number[hidden], .inv-number [hidden] { display: none; }
.inv-save-bar { display: none; }
.inv-save-bar.is-on { position: sticky; bottom: 12px; z-index: 5; display: flex; justify-content: flex-end; margin-top: 20px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--panel-border); border-radius: 12px; box-shadow: var(--shadow-pop); width: fit-content; margin-left: auto; }
.inv-status { font-size: 13px; color: var(--muted); }
.inv-status.saved::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--pass); vertical-align: middle; }
.inv-status.failed { color: var(--danger); }
@media (max-width: 760px) {
  .inv-save-bar.is-on { bottom: calc(92px + env(safe-area-inset-bottom)); }
}
/* TRK-1133: Payments > Products */
.prod-tab { max-width: 900px; }
.prod-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.prod-bar input[type=search] { flex: 1 1 220px; max-width: 320px; }
.prod-bar [aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.prod-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.prod-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 12px; }
.prod-row + .prod-row { border-top: 1px solid var(--border); }
.prod-main { flex: 1 1 220px; min-width: 0; }
.prod-main .sub { overflow-wrap: anywhere; }
.prod-price { font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 90px; text-align: right; }
.prod-tax { min-width: 80px; }
.prod-actions { display: inline-flex; gap: 6px; }
.prod-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }
.prod-form > input { flex: 1 1 180px; min-width: 0; }
.prod-price-in { display: inline-flex; gap: 4px; }
.prod-price-in input { width: 110px; }
.prod-price-in .prod-currency { width: 150px; text-overflow: ellipsis; } /* TRK-1181: a dropdown with each currency's code and name */
/* TRK-1134: Payments > Invoices */
.inv-tab { max-width: 1000px; }
.inv-tab .prod-bar select { width: auto; }
.inv-list-row { cursor: pointer; }
.inv-list-row:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.inv-list-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.inv-status { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--text); }
.inv-status.is-sent, .inv-status.is-viewed { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.inv-status.is-partly_paid { background: color-mix(in srgb, #d99a00 22%, transparent); }
.inv-status.is-paid { background: color-mix(in srgb, #1f9d55 22%, transparent); }
.inv-status.is-overdue { background: color-mix(in srgb, #d64545 22%, transparent); }
.inv-status.is-void { color: var(--muted); text-decoration: line-through; }
.inv-status.is-accepted { background: color-mix(in srgb, #1f9d55 22%, transparent); } /* TRK-1144: estimates */
.inv-status.is-declined { background: color-mix(in srgb, #d64545 22%, transparent); }
.inv-status.is-expired { color: var(--muted); }
.inv-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.inv-back { justify-self: start; }
.inv-page-head { display: flex; align-items: center; gap: 12px; }
.inv-page-head h2 { margin: 0; }
.inv-billto h3 { margin: 0 0 8px; }
.inv-client-find { position: relative; max-width: 360px; margin-bottom: 10px; }
.inv-client-find input { width: 100%; }
.inv-client-results { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; }
.inv-client-results:empty { display: none; }
.inv-client-results button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; }
.inv-client-results li.sub { padding: 6px 8px; }
.inv-lines table { width: 100%; }
.inv-lines td { vertical-align: top; }
.inv-line-what { min-width: 220px; }
.inv-line-what select, .inv-line-what input { width: 100%; }
.inv-line-what select + input { margin-top: 6px; }
.inv-lines input[type=number] { width: 100px; }
.inv-lines .inv-num { width: 72px; }
.inv-lines > .ghost { margin-top: 8px; }
.inv-foot { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: flex-start; justify-content: space-between; }
.inv-foot .inv-field { flex: 1 1 280px; }
.inv-totals { flex: 0 1 280px; display: grid; gap: 6px; font-variant-numeric: tabular-nums; }
.inv-total-row { display: flex; justify-content: space-between; gap: 16px; }
.inv-link { display: grid; gap: 6px; margin: 4px 0 18px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2, transparent); }
.inv-link-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inv-link-url { flex: 1 1 260px; min-width: 0; font-family: var(--mono, ui-monospace, monospace); font-size: 13px; }
.inv-link .sub { margin: 0; }
.inv-total-row.is-total { border-top: 1px solid var(--border); padding-top: 8px; font-weight: 700; font-size: 1.1em; }
/* TRK-1149: an item's small second line, and the discount on the whole invoice beside the totals */
.inv-line-what .inv-line-detail { margin-top: 6px; font-size: 0.9em; }
.inv-foot-side { flex: 0 1 300px; display: grid; gap: 14px; }
.inv-foot-side .inv-totals { flex: none; }
.inv-offer { display: grid; gap: 6px; }
.inv-offer-row { display: flex; gap: 8px; align-items: center; }
.inv-offer-row > input { flex: 1; min-width: 0; }
/* TRK-656: chatbots on the Funnels page; each name opens and closes its settings */
.funnel-bot-name { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: inherit; cursor: pointer; text-align: left; }
.funnel-bot-name::before { content: "▸"; display: inline-block; width: 1.1em; color: var(--muted); transition: transform .12s ease; }
.funnel-bot-name[aria-expanded="true"]::before { transform: rotate(90deg); }
.funnel-bot-name:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.funnel-bot-form { display: grid; gap: 8px; margin-top: 10px; }
.funnel-bot-actions { display: flex; gap: 8px; }
/* TRK-657: a chatbot's openers, each opened and closed by its name */
/* TRK-662: a chatbot's results */
.funnel-bot-results { display: grid; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.funnel-bot-results-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.funnel-bot-results-head select { font-size: 16px; }
.funnel-bot-results .funnel-report-table table { min-width: 480px; }
.funnel-bot-results .funnel-ab-note { font-size: 13px; }
.funnel-bot-rules { display: grid; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.funnel-bot-rules > p { margin: 0; }
.funnel-bot-rule { display: grid; gap: 4px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.funnel-domain { display: grid; gap: 8px; }
.funnel-domain-host { overflow-wrap: anywhere; min-width: 0; }
.funnel-domain-state { font-size: 12px; color: var(--muted); }
.funnel-domain-state.is-on { color: var(--pass); }
/* TRK-822: a domain's llms.txt settings, folded under its name */
.funnel-domain-llms { display: grid; gap: 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.funnel-domain-llms > .funnel-bot-name { justify-self: start; }
.funnel-llms-on { display: flex; align-items: center; gap: 8px; }
.funnel-domain-llms textarea { width: 100%; min-width: 0; font: inherit; font-size: 14px; }
.funnel-llms-versions-head { margin: 8px 0 0; font-size: 14px; }
.funnel-dns dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 0; }
.funnel-dns dt { font-weight: 600; }
.funnel-dns dd { margin: 0; overflow-wrap: anywhere; }
.funnel-domain-add { display: flex; flex-wrap: wrap; gap: 8px; }
.funnel-domain-add input { flex: 1 1 220px; min-width: 0; max-width: 360px; }

/* Agents at work (TRK-595) */
.at-work-list { display: grid; gap: 8px; margin-top: 10px; }
.at-work-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; }
.at-work-lost { opacity: 0.75; }
.at-work-main { min-width: 0; }
.at-work-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.at-work-issue { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.at-work-step { margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at-work-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 13px; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .at-work-row { grid-template-columns: auto minmax(0, 1fr); }
  .at-work-meta { grid-column: 2; flex-direction: row; align-items: center; gap: 12px; }
}

/* TRK-678: the meeting's summary from the organiser's Claude, in the meeting's details */
.cal-summaries, .cal-boards { margin: 8px 0; }
.cal-summaries h3, .cal-boards h3 { font-size: 13px; margin: 0 0 4px; }
.cal-board-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.cal-board-list li { overflow-wrap: anywhere; }
.cal-summary { display: grid; gap: 4px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; }
.cal-notes-link { margin: 0; overflow-wrap: anywhere; } /* TRK-707 */
.cal-meeting-cards { display: grid; gap: 2px; font-size: 13px; }
.cal-meeting-cards ul { margin: 0; padding-left: 18px; }
.cal-meeting-cards li { overflow-wrap: anywhere; }
.cal-card-key { font-weight: 600; white-space: nowrap; }


/* TRK-637: fill the brand kit from a website. Suggestions sit in the part they belong to, each kept or skipped. */
.bk-import-form { display: flex; gap: 8px; flex-wrap: wrap; }
.bk-import-form input { flex: 1 1 220px; min-width: 0; width: auto !important; }
.bk-import-result { margin-top: 12px; display: grid; gap: 8px; }
.bk-import-summary { margin: 0; }
.bk-import-summary:focus { outline: none; }
.bk-import-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bk-import-problems { font-size: 13px; color: var(--muted); }
.bk-suggests { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.bk-suggest { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border: 1px dashed var(--accent); border-radius: 10px; background: var(--sunken); }
.bk-suggest-body { flex: 1 1 auto; min-width: 0; display: grid; gap: 4px; }
.bk-suggest-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.bk-suggest-text { overflow-wrap: anywhere; }
blockquote.bk-suggest-text { margin: 0; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.bk-suggest-color { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.bk-suggest-chip { width: 24px; height: 24px; border-radius: 6px; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgb(127 127 127 / 0.3); }
.bk-suggest-logo { max-width: 320px; }
.bk-suggest-source { margin: 0; font-size: 12px; color: var(--muted); }
.bk-suggest-url { overflow-wrap: anywhere; }
.bk-suggest-actions { display: flex; gap: 6px; flex-shrink: 0; }
@media (max-width: 560px) { .bk-suggest { flex-direction: column; } }
.bk-import-toggle { font-size: 12px; }
@media (max-width: 760px) { .bk-import-form input { font-size: 16px; } }

/* TRK-694: Claude's screen, the page its listener's own browser window shows in the call */
.share-body {
  background: var(--bg, #fff);
  color: var(--text, #1c2230);
  margin: 0;
  min-height: 100vh;
}
.share {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100vh;
  padding: 24px 32px;
}
.share-head {
  align-items: baseline;
  column-gap: 12px;
  display: flex;
  flex-wrap: wrap;
}
.share-who,
.share-kind {
  color: var(--muted, #5d6677);
  font-size: 13px;
}
.share-kind {
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 1px 8px;
}
.share-title {
  flex-basis: 100%;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}
.share-empty {
  align-items: center;
  color: var(--muted, #5d6677);
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}
.share-refused p {
  font-size: 18px;
  line-height: 1.5;
  margin: 0;
  max-width: 34em;
}
.share-ended h1 {
  color: var(--text, #1c2230);
  font-size: 24px;
  margin: 0 0 8px;
}
.share-board {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.share-stage {
  left: 0;
  position: absolute;
  top: 0;
  transform-origin: 0 0;
}
.share-lines {
  left: 0;
  position: absolute;
  top: 0;
}
.share-lines line {
  stroke: var(--wb-slate);
  stroke-width: 2;
}
.share-item {
  align-items: center;
  background: var(--share-c, transparent);
  border-radius: 6px;
  box-sizing: border-box;
  color: var(--wb-ink);
  display: flex;
  font-size: 15px;
  justify-content: center;
  line-height: 1.35;
  overflow: hidden;
  padding: 10px;
  position: absolute;
  text-align: center;
  white-space: pre-wrap;
}
.share-note {
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.18);
}
.share-text {
  color: var(--text, #1c2230);
  justify-content: flex-start;
  text-align: left;
}
.share-shape {
  border: 2px solid var(--wb-slate);
}
.share-round {
  border-radius: 50%;
}
.share-section {
  align-items: flex-start;
  border: 2px solid var(--wb-slate);
  justify-content: flex-start;
  opacity: 0.85;
}
.share-record {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  overflow: auto;
}
.share-record dl {
  column-gap: 16px;
  display: grid;
  font-size: 16px;
  grid-template-columns: max-content minmax(0, 1fr);
  margin: 0;
  row-gap: 10px;
}
.share-record dt {
  color: var(--muted, #5d6677);
}
.share-record dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.share-list h2 {
  font-size: 15px;
  margin: 0 0 8px;
}
.share-list ul {
  font-size: 15px;
  line-height: 1.6;
  margin: 0;
  padding-left: 18px;
}

/* Check brand (TRK-639): a button beside a draft and the flags it finds, each with its fix */
.social-field-tools { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.brand-check-button { padding: 4px 10px; font-size: 13px; }
.brand-check { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--sunken); font-size: 13px; overflow-wrap: anywhere; }
.brand-check[hidden] { display: none; }
.brand-check-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.brand-check-pass { color: var(--pass); }
.brand-check-flags { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.brand-check-flags li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; }
.brand-check-text { min-width: 0; flex: 1 1 260px; }
.brand-check-flags .link { flex-shrink: 0; }
.brand-check-scope { margin: 8px 0 0; }

/* ---- Sites (TRK-712): five tabs, and each row's status and 30-day numbers ---- */
.sites-head { gap: 12px; }
.sites-head-actions { display: flex; gap: 8px; flex-shrink: 0; }
.sites-body { margin-top: 16px; }
.funnel-row-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sites-state { font-size: 11px; font-weight: 600; letter-spacing: .02em; padding: 1px 8px; border-radius: 999px; background: var(--hover, rgba(0,0,0,.06)); color: var(--muted); flex-shrink: 0; }
.sites-state.is-live { background: color-mix(in srgb, var(--pass) 16%, transparent); color: var(--pass); }
.sites-numbers { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; font-size: 13px; font-variant-numeric: tabular-nums; }
.sites-numbers strong { font-weight: 600; }
.sites-numbers .sub { font-size: 12px; }
dialog.confirm-box.funnel-new { width: min(1080px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; }
.funnel-new .loop-gallery { margin: 0; }
/* Funnel templates by value ladder (TRK-743) */
.funnel-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.funnel-chips .chip { padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 13px; transition: background-color 150ms ease, border-color 150ms ease; }
.funnel-chips .chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
@media (hover: hover) and (pointer: fine) { .funnel-chips .chip[aria-pressed="false"]:hover { border-color: var(--accent); } }
.funnel-rung { margin-top: 20px; }
.funnel-rung-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 10px; }
.funnel-rung-head h3, .funnel-rung-head h2 { margin: 0; font-size: 15px; }
.funnel-rung-head .sub { font-size: 13px; }
.funnel-price { padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--text); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.funnel-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.funnel-tpls li { min-width: 0; }
.funnel-tpl { display: flex; flex-direction: column; gap: 10px; width: 100%; height: 100%; padding: 10px; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; transition: border-color 150ms ease, transform 150ms cubic-bezier(0.23, 1, 0.32, 1); }
@media (hover: hover) and (pointer: fine) { .funnel-tpl:hover { border-color: var(--accent); } }
.funnel-tpl:active { transform: scale(0.98); }
.funnel-tpl-text { display: grid; gap: 2px; min-width: 0; }
.funnel-tpl-text .sub { font-size: 13px; }
.funnel-tpl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 12px; margin-top: auto; }
/* A page drawn at 1280px wide, scaled to its box by --s */
.funnel-shot { position: relative; aspect-ratio: 16 / 10; overflow: hidden; border: 1px solid var(--border); border-radius: 6px; background: #fff; pointer-events: none; }
.funnel-shot iframe { position: absolute; top: 0; left: 0; width: 1280px; height: 800px; border: 0; transform: scale(var(--s, 0.2)); transform-origin: 0 0; }
.funnel-shot-big { aspect-ratio: auto; height: 520px; border-radius: 0 0 8px 8px; border-top: 0; }
.funnel-shot-big iframe { height: calc(520px / var(--s, 0.5)); }
.funnel-strip { display: inline-flex; gap: 3px; }
.funnel-mini { display: inline-flex; flex-direction: column; gap: 2px; flex-shrink: 0; width: 18px; height: 24px; padding: 3px; box-sizing: border-box; background: var(--surface); border: 1px solid color-mix(in srgb, var(--muted) 45%, transparent); border-radius: 3px; overflow: hidden; }
.funnel-mini i { display: block; height: 2px; border-radius: 1px; background: color-mix(in srgb, var(--muted) 45%, transparent); flex-shrink: 0; }
.funnel-mini i.h { height: 3px; width: 80%; background: var(--text); opacity: .7; }
.funnel-mini i.f { height: 4px; background: transparent; border: 1px solid color-mix(in srgb, var(--muted) 60%, transparent); box-sizing: border-box; }
.funnel-mini i.b { height: 3px; width: 60%; background: var(--accent); }
.funnel-mini i.c { height: 3px; background: var(--accent); opacity: .45; }
.funnel-mini i.q { height: 3px; width: 70%; background: transparent; border: 1px solid var(--accent); box-sizing: border-box; }
.funnel-mini i.v { height: 6px; background: var(--text); opacity: .18; }
.funnel-back { margin-bottom: 10px; font-size: 13px; }
.funnel-detail { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 20px; margin-top: 14px; }
.funnel-detail-steps { display: grid; align-content: start; gap: 4px; margin: 0; padding: 0; list-style: none; }
.funnel-detail-steps button { display: grid; grid-template-columns: 24px auto minmax(0, 1fr); align-items: center; gap: 10px; width: 100%; padding: 8px; text-align: left; background: none; border: 1px solid transparent; border-radius: 8px; color: var(--text); }
.funnel-detail-steps button > span:last-child { display: grid; gap: 2px; }
.funnel-detail-steps .sub { font-size: 12px; }
.funnel-detail-steps .funnel-mini { width: 30px; height: 40px; gap: 3px; padding: 4px; }
.funnel-detail-steps button[aria-current="step"] { background: var(--sunken); border-color: var(--border); }
@media (hover: hover) and (pointer: fine) { .funnel-detail-steps button:hover { background: var(--sunken); } }
.funnel-detail-num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.funnel-detail-steps button[aria-current="step"] .funnel-detail-num { background: var(--text); border-color: var(--text); color: var(--bg); }
.funnel-detail-preview { min-width: 0; }
.funnel-detail-bar { padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px 8px 0 0; background: var(--sunken); font-size: 12px; overflow-wrap: anywhere; }
.funnel-detail-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.funnel-detail-foot .funnel-whole { flex: 1 1 320px; }
@media (max-width: 760px) {
  .funnel-detail { grid-template-columns: 1fr; }
  .funnel-shot-big { height: 360px; }
  .funnel-shot-big iframe { height: calc(360px / var(--s, 0.3)); }
}
@media (max-width: 600px) { .sites-head { flex-wrap: wrap; } }

/* Websites (TRK-713): one site's pages, menu, header, footer and preview */
.sites-site-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.sites-site-head .funnel-name { flex: 1 1 220px; min-width: 0; }
.sites-panel { display: grid; gap: 8px; }
.sites-panel h2 { font-size: 13px; margin: 0; }
.sites-panel textarea { width: 100%; box-sizing: border-box; resize: vertical; }
.sites-page { display: grid; gap: 8px; padding: 10px; cursor: default; }
.sites-page.is-shown { box-shadow: inset 3px 0 0 var(--accent); }
.sites-page-name { font-weight: 600; text-align: left; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
.sites-page-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.sites-in-menu { display: flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; padding-bottom: 6px; }
.sites-add-page { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.9fr) auto; gap: 8px; }
.sites-page .funnel-section-tools { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.sites-title { grid-column: 1 / -1; }
.sites-subhead { font-size: 12px; margin: 6px 0 0; color: var(--muted); font-weight: 600; }
/* TRK-791: the SEO check's findings, grouped by page */
.sites-seo, .sites-seo ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sites-seo-page { display: grid; gap: 6px; padding-top: 8px; border-top: 1px solid var(--border); }
.sites-seo-page > strong { overflow-wrap: anywhere; }
.sites-seo-finding { display: grid; gap: 2px; }
.sites-seo-finding .sub { color: var(--muted); font-size: 13px; }
.sites-redirects { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.sites-redirect { display: grid; grid-template-columns: minmax(0, auto) auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; }
.sites-redirect code { overflow-wrap: anywhere; font-size: 12px; }
.sites-files a { text-underline-offset: 2px; }
@media (max-width: 600px) {
  .sites-page-fields, .sites-add-page { grid-template-columns: minmax(0, 1fr); }
}
.sites-editor { grid-template-columns: minmax(0, 460px) minmax(0, 1fr); }
@media (max-width: 900px) { .sites-editor { grid-template-columns: minmax(0, 1fr); } }

/* Forms (TRK-721): each field is a row with its label, type, where it saves and whether it's needed */
.form-field { display: grid; gap: 8px; }
.form-field-name { min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.form-field-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: end; }
.form-field-grid select, .form-field-grid input:not([type="checkbox"]) { width: 100%; min-width: 0; }
.form-required { display: flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; padding-bottom: 6px; }
.form-points { border: 0; padding: 0; margin: 8px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.form-points legend { font-size: 0.8125rem; color: var(--muted); margin-bottom: 4px; padding: 0; }
.form-points input { width: 100%; min-width: 0; font-variant-numeric: tabular-nums; }
.form-tier + .form-tier { margin-top: 8px; }
.form-tier-message { display: grid; gap: 4px; margin: 8px 0; }
.form-tier textarea { width: 100%; }
.form-options textarea { width: 100%; }
@media (max-width: 600px) { .form-field-grid { grid-template-columns: minmax(0, 1fr); } }

/* Report chart (TRK-737): lines stretch with the drawing; labels, pins, guide and tip are HTML on top */
.funnel-totals dd.funnel-change { font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.funnel-totals dd.funnel-change.is-up { color: var(--pass); }
.funnel-totals dd.funnel-change.is-down { color: var(--danger); }
.funnel-report-empty { padding: 32px 16px; }
.funnel-report-emails h3, .funnel-report-popups h3 { font-size: 13px; margin: 8px 0 0; }
.funnel-report-popups { display: grid; gap: 8px; } /* TRK-827 */
.funnel-report-popups td { font-variant-numeric: tabular-nums; }
.funnel-report-emails h3 { font-size: 13px; margin: 8px 0 0; }
/* TRK-821: top countries and devices */
.funnel-places { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; }
.funnel-places-note { grid-column: 1 / -1; margin: 0; }
.funnel-place { display: grid; gap: 6px; min-width: 0; align-content: start; }
.funnel-place h3 { font-size: 13px; margin: 8px 0 0; }
.funnel-place-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 8px; }
.funnel-place-list li { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto 3.5em; gap: 12px; align-items: center; padding: 8px 12px; font-size: 13px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.funnel-place-list li:last-child { border-bottom: 0; }
.funnel-place-list li::after { content: ""; position: absolute; left: 12px; bottom: 3px; height: 2px; width: calc((100% - 24px) * var(--share) / 100%); max-width: calc(100% - 24px); background: var(--accent); opacity: 0.45; border-radius: 1px; }
.funnel-place-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.funnel-place-count { text-align: right; }
.funnel-place-share { text-align: right; color: var(--muted); }
@media (max-width: 640px) { .funnel-places { grid-template-columns: minmax(0, 1fr); } }
/* TRK-819: where visitors came from */
.funnel-report-sources { display: grid; gap: 6px; }
.funnel-report-sources h3 { font-size: 13px; margin: 8px 0 0; }
.funnel-sources-table table { min-width: 520px; }
.funnel-sources-table td { font-variant-numeric: tabular-nums; text-align: right; }
.funnel-sources-table th[scope="col"]:not(:first-child) { text-align: right; }
.funnel-sources-table th[scope="row"] { font-weight: 400; font-size: 13px; color: var(--text); }
.funnel-report-table tbody tr:last-child th, .funnel-sources-table tbody tr:last-child th { border-bottom: 0; }
.funnel-source-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; font: inherit; color: var(--text); cursor: pointer; }
.funnel-source-toggle::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); transition: transform 150ms ease; }
.funnel-source-toggle[aria-expanded="true"]::before { transform: rotate(45deg); }
.funnel-source-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.funnel-source-row th[scope="row"] { padding-left: 24px; white-space: normal; }
.funnel-source-name { display: block; overflow-wrap: anywhere; }
.funnel-source-row .sub { display: block; font-size: 12px; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) { .funnel-source-toggle::before { transition: none; } }
.funnel-table-toggle { justify-self: start; }
.report-chart-figure { margin: 0; display: grid; gap: 8px; padding: 12px 12px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.report-chart-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--muted); }
.report-chart-legend li { display: flex; align-items: center; gap: 6px; }
.report-chart-key { width: 14px; height: 3px; border-radius: 2px; background: currentColor; }
.report-chart-key.is-mark { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.report-chart { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; outline: none; border-radius: 6px; touch-action: pan-y; }
.report-chart:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.report-chart-y { display: flex; flex-direction: column; justify-content: space-between; height: 200px; font-size: 11px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; transform: translateY(-0.5em); }
.report-chart-main { min-width: 0; }
.report-chart-plot { position: relative; height: 200px; }
.report-chart-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.report-chart-grid { stroke: var(--border); stroke-width: 1; }
.report-chart-mark { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; opacity: .6; }
.report-chart-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.report-chart-area { stroke: none; fill: currentColor; opacity: .12; }
.report-chart-area:not(.tone-visits) { display: none; }
.tone-visits { color: var(--accent); }
.tone-signups { color: var(--pass); }
.tone-sent { color: var(--chart-todo); }
.tone-opened { color: var(--chart-in_review); }
.tone-clicked { color: var(--chart-in_progress); }
.report-chart-x { position: relative; height: 18px; margin-top: 6px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.report-chart-x span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.report-chart-x span:first-child { transform: none; }
.report-chart-x span:last-child:not(:first-child) { transform: translateX(-100%); }
.report-chart-pins { position: absolute; inset: 0; pointer-events: none; }
.report-chart-pin { position: absolute; top: -4px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 2px var(--surface); pointer-events: auto; }
.report-chart-guide { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--muted); opacity: .5; pointer-events: none; }
.report-chart-dot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 2px var(--surface); pointer-events: none; }
.report-chart-tip { position: absolute; top: 4px; z-index: 2; display: grid; gap: 2px; min-width: 150px; max-width: 240px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: 0 6px 20px rgba(0,0,0,.12); font-size: 12px; font-variant-numeric: tabular-nums; pointer-events: none; }
.report-chart-tip-note { color: var(--muted); border-top: 1px solid var(--border); padding-top: 4px; margin-top: 2px; }
@media (max-width: 600px) { .report-chart-y, .report-chart-plot { height: 160px; } }
/* Chats in Mail (TRK-660): visitors' chats with the chatbots, taken over and answered by the team */
.chat-panes { grid-template-columns: var(--mail-list-w, 320px) minmax(0, 1fr); }
.chat-panes .mail-read { display: flex; flex-direction: column; max-height: 80vh; }
.chat-facts { margin: 8px 12px 0; color: var(--muted); font-size: 0.88em; overflow-wrap: anywhere; }
.chat-answers { margin: 8px 12px 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 12px; font-size: 0.88em; }
.chat-answers dt { color: var(--muted); }
.chat-answers dd { margin: 0; overflow-wrap: anywhere; }
.chat-log { flex: 1; min-height: 200px; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { max-width: 80%; padding: 8px 12px; border-radius: 12px; background: var(--sunken); display: flex; flex-direction: column; gap: 2px; align-self: flex-start; }
.chat-msg.team { align-self: flex-end; background: var(--selected); color: var(--selected-text); }
.chat-msg.bot { border: 1px dashed var(--border); background: none; }
.chat-who { font-size: 0.78em; font-weight: 600; color: var(--muted); }
.chat-msg.team .chat-who { color: inherit; opacity: 0.8; }
.chat-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg time { font-size: 0.72em; color: var(--muted); align-self: flex-end; }
.chat-reply { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); align-items: flex-end; }
.chat-reply textarea { flex: 1; min-width: 0; resize: vertical; font: inherit; }
/* TRK-725: the chatbot agent's draft, waiting for a teammate to send, change or discard it */
.chat-draft { display: grid; gap: 8px; padding: 10px 12px; border-top: 1px dashed var(--border); background: var(--sunken); }
.chat-draft-head { margin: 0; font-size: 13px; }
.chat-draft textarea { width: 100%; resize: vertical; font: inherit; box-sizing: border-box; }
.chat-draft-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.chat-draft-wait { margin: 0; padding: 8px 12px; border-top: 1px dashed var(--border); font-size: 13px; }
@media (max-width: 900px) {
  .chat-panes { grid-template-columns: minmax(0, 1fr); }
  .chat-panes .mail-read, .chat-panes .mail-list { max-height: none; }
}

/* TRK-716: one block's settings in a drawer beside the page, opened from the block's toolbar */
.funnel-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(400px, 100vw);
  height: 100dvh;
  max-height: none;
  max-width: none;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: -12px 0 32px rgb(16 24 40 / 0.1);
  overflow: auto;
  overscroll-behavior: contain;
  z-index: 40;
}
.funnel-drawer[open] { display: flex; flex-direction: column; animation: funnel-drawer-in 220ms cubic-bezier(0.23, 1, 0.32, 1); }
@keyframes funnel-drawer-in { from { transform: translateX(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .funnel-drawer[open] { animation: none; } }
.funnel-drawer-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.funnel-drawer-head h2 { margin: 0; font-size: 1rem; }
.funnel-drawer-head .popup-x { position: static; }
.funnel-drawer .funnel-section { border: 0; border-radius: 0; margin: 0; padding: 16px 20px 24px; background: none; box-shadow: none; }
.funnel-drawer .funnel-section-head > strong { display: none; }
.funnel-drawer .funnel-section-head { justify-content: flex-end; }
/* TRK-717: asking the agent from the page editor */
dialog.funnel-ask { width: min(520px, calc(100vw - 32px)); }
.funnel-ask-form { display: grid; gap: 12px; margin-top: 8px; }
.funnel-ask-form label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
.funnel-ask-form textarea { width: 100%; resize: vertical; font: inherit; font-weight: 400; }
/* TRK-848: a block's quick changes, above the free-text request */
.funnel-ask-quick { display: flex; flex-wrap: wrap; gap: 8px; }
.funnel-ask-quick[hidden] { display: none; }
.funnel-ask-quick > button { min-height: 36px; }
.funnel-ask-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.funnel-ask-wait { position: fixed; z-index: 40; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px); padding: 8px 8px 8px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); box-shadow: 0 6px 24px rgb(0 0 0 / 0.12); }
.funnel-ask-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.funnel-ask-wait > button { flex-shrink: 0; }
.funnel-ask-dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: funnel-ask-pulse 1.4s ease-in-out infinite; }
@keyframes funnel-ask-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .funnel-ask-dot { animation: none; } }
dialog.funnel-ask-review { width: min(1100px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; overscroll-behavior: contain; }
.funnel-ask-review .funnel-ask-actions { position: sticky; bottom: -1px; padding: 12px 0 2px; background: var(--surface); }
.funnel-ask-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 12px 0; }
.funnel-ask-compare figure { margin: 0; min-width: 0; display: grid; gap: 6px; }
.funnel-ask-compare figcaption { font-size: 12px; font-weight: 600; color: var(--muted); }
.funnel-ask-frame { width: 100%; height: min(60vh, 560px); border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.funnel-ask-warn { margin: 4px 0 0; font-size: 13px; color: var(--danger); }
@media (max-width: 720px) {
  .funnel-ask-compare { grid-template-columns: minmax(0, 1fr); }
  .funnel-ask-frame { height: 30dvh; }
  .funnel-ask-form textarea, .funnel-ask-form select { font-size: 16px; }
}
/* TRK-718: a code block's editable spots, with its code folded below */
.funnel-code-block { display: grid; gap: 10px; }
.funnel-spots { display: grid; gap: 10px; }
.funnel-code-fold > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); padding: 4px 0; }
.funnel-code-fold[open] > summary { margin-bottom: 6px; }
.funnel-code-fold > .funnel-field + .funnel-field { margin-top: 10px; }
textarea.funnel-code { width: 100%; resize: vertical; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; tab-size: 2; white-space: pre; overflow-wrap: normal; overflow-x: auto; }
@media (max-width: 720px) { textarea.funnel-code { font-size: 16px; } }
/* TRK-789: what a button does, and its number, address or block beside it */
.funnel-action { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; min-width: 0; }
.funnel-action > select { flex: 0 1 auto; max-width: 100%; }
.funnel-action > input { flex: 1 1 180px; min-width: 0; }
.funnel-action > .sub { flex: 1 1 100%; font-size: 12px; }

/* Popups on a page (TRK-784): each row opens its settings and blocks when its name is clicked */
.funnel-popups { display: grid; gap: 8px; margin-top: 16px; }
.funnel-popups > h3 { margin: 0; font-size: 14px; }
.funnel-popup { display: grid; gap: 12px; }
.funnel-popup-toggle { display: grid; gap: 2px; min-width: 0; flex: 1; padding: 4px 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.funnel-popup-toggle > strong { overflow-wrap: anywhere; }
.funnel-popup-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.funnel-popup-body { display: grid; gap: 12px; }
.funnel-popup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px 12px; }
.funnel-popup-grid .funnel-field { min-width: 0; }
/* TRK-820: the Sites dashboard */
.funnel-totals dd.funnel-sales-orders { font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.sites-top-pages th[scope="row"] { font-weight: 400; text-align: left; }
.sites-top-pages th[scope="row"] .link { font: inherit; font-weight: 500; text-align: left; overflow-wrap: anywhere; }
.sites-page-site { display: block; font-size: 12px; color: var(--muted); }
/* TRK-788: a switched-off llms.txt box reads as off */
.sites-panel textarea:disabled { color: var(--muted); background: var(--sunken); cursor: not-allowed; }
/* TRK-777: testimonials picked from CRM notes */
.funnel-items-add { display: flex; flex-wrap: wrap; gap: 8px; }
.funnel-items-add > button { flex: 1 1 140px; }
dialog.funnel-quote-box { width: min(560px, calc(100vw - 32px)); }
dialog.funnel-quote-box input[type="search"] { width: 100%; margin-top: 8px; font-size: 16px; }
.funnel-quote-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: min(60vh, 520px); overflow: auto; }
.funnel-quote-list > li.sub { padding: 12px 0; }
.funnel-quote { display: grid; gap: 4px; padding: 10px 0; border-top: 1px solid var(--border); min-width: 0; }
.funnel-quote blockquote { margin: 0; white-space: pre-line; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.funnel-quote > .sub { margin: 0; font-size: 12px; overflow-wrap: anywhere; }
.funnel-quote > button { justify-self: start; }

/* TRK-1001: the Runs scripts switch in a Code block: a full-size box, its name on one line and what it does below */
.funnel-scripts-switch { align-items: flex-start; margin: 10px 0 4px; font-weight: 600; }
.funnel-scripts-switch input { width: 16px; height: 16px; margin-top: 2px; flex: none; }
.funnel-scripts-switch .sub { display: block; font-weight: 400; color: var(--muted); margin-top: 2px; }
/* TRK-1136: the Send box for an invoice */
.inv-send { width: min(560px, calc(100vw - 32px)); }
.inv-send-form { display: grid; gap: 12px; }
.inv-send-form select, .inv-send-form input, .inv-send-form textarea { width: 100%; box-sizing: border-box; }
.inv-send-form textarea { resize: vertical; min-height: 140px; }
.inv-send-note { margin: 0; }
/* TRK-1137: the payments on an invoice, and the Record payment box */
.inv-payments { display: grid; gap: 8px; margin: 0 0 18px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; }
.inv-payments-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.inv-payments-head h3 { margin: 0; font-size: 15px; }
.inv-payments > .sub { margin: 0; }
.inv-payment-list { list-style: none; margin: 0; padding: 0; }
.inv-payment { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.inv-payment:first-child { border-top: 0; }
.inv-payment-what { display: grid; gap: 2px; min-width: 0; }
.inv-payment-what .sub { font-size: 13px; }
.inv-payment-note { overflow-wrap: anywhere; }
.inv-record { width: min(480px, calc(100vw - 32px)); }
.inv-record .inv-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .inv-record .inv-row { grid-template-columns: 1fr; } }
/* TRK-1138: payment reminders: the switch on an invoice, and the schedule in Payments > Settings */
.inv-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.inv-check input { width: 16px; height: 16px; margin: 0; flex: none; }
.inv-reminders { display: grid; gap: 4px; padding-top: 8px; border-top: 1px solid var(--border); }
.inv-reminders .sub { margin: 0; }
.inv-reminder-settings { display: grid; gap: 8px; }
.inv-reminder-settings > .sub { margin: 0; }
.inv-reminder-days { display: flex; flex-wrap: wrap; gap: 8px 18px; }
/* TRK-1139: invoices on CRM records */
.crm-invoices-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.crm-invoices-title h2 { margin: 0; }
.crm-invoices-owed:empty { display: none; }
.inv-deal { margin: 4px 0 0; }

/* TRK-1141: owed now, overdue and paid this month above the invoice list */
.inv-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.inv-overview-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; text-align: left; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.inv-overview-tile:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.inv-overview-tile[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.inv-overview-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.inv-overview-amount { font-size: 20px; font-variant-numeric: tabular-nums; line-height: 1.3; }
.inv-overview-amount.is-none { font-size: 15px; font-weight: 500; color: var(--muted); }
.inv-overview-tile.is-overdue .inv-overview-amount:not(.is-none) { color: var(--danger); }
@media (max-width: 600px) { .inv-overview { grid-template-columns: minmax(0, 1fr); gap: 8px; } .inv-overview-tile { padding: 10px 12px; } .inv-overview-amount { font-size: 17px; } }
/* TRK-1143: repeating invoices */
.inv-repeat { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.inv-repeat-text { display: grid; gap: 2px; min-width: 0; flex: 1 1 260px; }
.inv-repeat-text p { margin: 0; }
.inv-repeat.is-paused .inv-repeat-text p:first-of-type { color: var(--muted); }
.inv-repeat-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.inv-repeat-error { color: var(--danger); }
.inv-repeat-every { display: flex; gap: 8px; align-items: center; }
.inv-repeat-every > input, .inv-repeat-end > input[type="number"] { width: 80px; flex: none; }
.inv-repeat-every > select { width: auto; flex: 1 1 0; min-width: 0; }
.inv-repeat-end { display: flex; gap: 8px; align-items: center; flex: 1 1 0; min-width: 0; }
.inv-repeat-end > input[type="date"] { width: auto; flex: 1 1 0; min-width: 0; }
.inv-repeat-end > .sub { white-space: nowrap; }
.inv-repeat-tag { margin-left: 6px; color: var(--muted); font-size: 13px; }
@media (max-width: 600px) { .inv-repeat { padding: 10px 12px; } .inv-repeat-actions { width: 100%; } }
