/*
 * The staff console, in the product's own clothes.
 *
 * The console used to be Google's Material 3 — an app bar, a pill-shaped drawer,
 * Roboto — on the argument that a back office should look like a back office.
 * It now looks like Mosaic: the same Geist skin the product wears by default,
 * its tokens copied here by value (client/src/theme/skins.css, the
 * `data-skin='geist'` blocks, and the dark palette from tokens.css), the same
 * sidebar with 30px rows and a hairline edge, the same 20px titles, the same
 * Vercel tables. Somebody who spends the morning in the product and the
 * afternoon here should not have to change gear.
 *
 * Copied rather than imported: the console has no bundler, and the product's
 * stylesheets assume React components this page does not have. When the
 * product's Geist tokens move, these should follow.
 *
 * The public pages this service serves (signup, confirm, account) keep
 * styles.css; nothing here reaches them.
 */

/* ------------------------------------------------------------------ tokens */

:root {
  color-scheme: light;

  --bg-app: #fafafa;
  --bg-sidebar: #fafafa;
  --bg-panel: #ffffff;
  --bg-raised: #fafafa;
  --bg-hover: #f0f0f1;
  --bg-active: #e6e6e7;
  --bg-input: #ffffff;
  --bg-overlay: rgba(0, 0, 0, 0.32);

  --border: #ebebeb;
  --border-strong: #d4d4d4;
  --focus: #0070f3;

  --text: #1e1e1f;
  --text-body: #4d4d4d;
  --text-muted: #666666;
  --text-dim: #767676;

  --accent-action: #171717;
  --accent-action-hover: #000000;
  --on-accent: #ffffff;
  --accent-subtle: rgba(23, 23, 23, 0.07);
  --accent-brand: #ff6c37;
  /* The brand hue mixed towards the ink until it reads on a wash: the product's `--accent-brand-ink`. */
  --brand-ink: #a24a2a;
  --brand-subtle: #ffeae3;

  --ok: #228759;
  --ok-subtle: rgba(34, 135, 89, 0.12);
  --err: #ee0000;
  --err-subtle: rgba(238, 0, 0, 0.1);
  --warn: #a35200;
  --warn-subtle: rgba(255, 178, 36, 0.12);
  --info: #0070f3;
  --info-subtle: rgba(0, 112, 243, 0.1);
  --personal: #6e56cf;

  --shadow-card: 0 0 0 1px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-popover: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 16px -4px rgba(0, 0, 0, 0.06);
  --shadow-dialog: 0 1px 2px rgba(0, 0, 0, 0.06), 0 16px 40px -8px rgba(0, 0, 0, 0.18);
  --shadow-control: 0 1px 1px rgba(0, 0, 0, 0.03);

  /* Three tiers, as the product has them: 8px surfaces, 6px controls, 4px marks. */
  --radius-lg: 8px;
  --radius: 6px;
  --radius-sm: 4px;

  --fs-micro: 11px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-title: 20px;

  --control-h: 32px;
  --sidebar-w: 240px;
  --rail-w: 52px;

  --font: 'Geist', 'Geist Variable', 'Segoe UI Variable Text', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    'Helvetica Neue', Arial, sans-serif;
  --mono: 'Geist Mono', 'Geist Mono Variable', 'Cascadia Code', 'JetBrains Mono', Consolas, 'SF Mono', Menlo,
    monospace;

  --ease: cubic-bezier(0.2, 0, 0, 1);
}

:root[data-theme='dark'] {
  color-scheme: dark;

  --bg-app: #212121;
  --bg-sidebar: #141414;
  --bg-panel: #2a2a2a;
  --bg-raised: #303030;
  --bg-hover: #343434;
  --bg-active: #3c3c3c;
  --bg-input: #1c1c1c;
  --bg-overlay: rgba(0, 0, 0, 0.55);

  --border: #2e2e2e;
  --border-strong: #3d3d3d;
  --focus: #3d97f5;

  --text: #e8e8e8;
  --text-body: #c4c4c4;
  --text-muted: #9e9e9e;
  --text-dim: #6b6b6b;

  --accent-action: #ff6c37;
  --accent-action-hover: #ff8149;
  --on-accent: #ffffff;
  --accent-subtle: rgba(255, 108, 55, 0.14);
  --brand-ink: #f8a080;
  --brand-subtle: #2c1810;

  --ok: #3ecf8e;
  --ok-subtle: rgba(62, 207, 142, 0.16);
  --err: #ed5b5b;
  --err-subtle: rgba(237, 91, 91, 0.16);
  --warn: #eea23e;
  --warn-subtle: rgba(238, 162, 62, 0.16);
  --info: #3d97f5;
  --info-subtle: rgba(61, 151, 245, 0.16);
  --personal: #9e8cfc;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-popover: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 20px -4px rgba(0, 0, 0, 0.3);
  --shadow-dialog: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -8px rgba(0, 0, 0, 0.5);
  --shadow-control: 0 1px 1px rgba(0, 0, 0, 0.16);
}

/* -------------------------------------------------------------------- base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg-app);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5 {
  margin: 0;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}
a:hover {
  text-decoration-color: currentColor;
}

code,
kbd,
pre {
  font-family: var(--mono);
  font-size: 0.92em;
}

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

.muted {
  color: var(--text-muted);
}
.small {
  font-size: var(--fs-xs);
}
.spacer {
  flex: 1;
}
.nowrap {
  white-space: nowrap;
}
.path {
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9em;
}
.error {
  color: var(--err);
  font-size: var(--fs-sm);
}

.ico {
  display: inline-flex;
  flex: none;
  width: 16px;
  height: 16px;
}
[data-icon] > svg,
.ico > svg {
  display: block;
  width: 16px;
  height: 16px;
}
[data-icon] {
  display: inline-flex;
  flex: none;
}

/* ----------------------------------------------------------------- buttons */

button {
  font: inherit;
  color: inherit;
}

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--control-h);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  box-shadow: var(--shadow-control);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    color 0.12s ease;
}
button:hover,
.btn:hover {
  background: var(--bg-hover);
}
button:disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.primary {
  border-color: transparent;
  background: var(--accent-action);
  color: var(--on-accent);
}
.primary:hover {
  background: var(--accent-action-hover);
}
.primary.is-danger {
  background: var(--err);
}

.ghost,
.tonal {
  background: var(--bg-panel);
}
.ghost.sm,
.btn.sm {
  height: 26px;
  padding: 0 8px;
  font-size: var(--fs-xs);
}
.ghost.danger,
.text-btn.danger {
  color: var(--err);
}
.ghost.is-test {
  border-color: transparent;
  background: var(--brand-subtle);
  color: var(--brand-ink);
}

.text-btn {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.text-btn:hover {
  background: var(--bg-hover);
}

.icon-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--text-muted);
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.is-staff-only .admin-only {
  display: none !important;
}

/* ------------------------------------------------------------------- forms */

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-input);
  box-shadow: var(--shadow-control);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-md);
  font-weight: 400;
}
input,
select {
  height: var(--control-h);
  padding: 0 10px;
}
textarea {
  padding: 8px 10px;
  line-height: 1.55;
  resize: vertical;
}
textarea.prose {
  font-family: var(--font);
}
input::placeholder,
textarea::placeholder {
  color: var(--text-dim);
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent);
}
input[type='checkbox'],
input[type='radio'] {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  box-shadow: none;
  accent-color: var(--accent-action);
}
input[type='search'] {
  -webkit-appearance: none;
  appearance: none;
}

label.check-inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}

fieldset {
  margin: 0;
  padding: 12px 14px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
legend {
  padding: 0 6px;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 500;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.toggle-row {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.toggle {
  position: relative;
  flex: none;
  display: inline-flex;
}
.toggle input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.toggle-track {
  width: 32px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background 0.14s ease;
}
.toggle-knob {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.14s var(--ease);
}
.toggle input:checked + .toggle-track {
  background: var(--accent-action);
}
.toggle input:checked + .toggle-track .toggle-knob {
  transform: translateX(14px);
}
.toggle input:focus-visible + .toggle-track {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.toggle-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.toggle-copy small {
  color: var(--text-muted);
  font-weight: 400;
}

/* A choice of a few, as the product's segmented control: a well with the chosen one raised. */
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: var(--radius);
  background: var(--bg-hover);
}
.segmented button {
  height: 26px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  box-shadow: none;
  color: var(--text-muted);
  font-weight: 500;
}
.segmented button:hover {
  background: transparent;
  color: var(--text);
}
.segmented button[aria-pressed='true'] {
  border-color: var(--border);
  background: var(--bg-panel);
  box-shadow: var(--shadow-card);
  color: var(--text);
}

/* Tabs with a count, as the product's sub-tabs: words, and a line under the one chosen. */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
.tab {
  height: 30px;
  padding: 0 10px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  box-shadow: none;
  color: var(--text-muted);
  font-weight: 500;
}
.tab:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.tab[aria-pressed='true'] {
  background: var(--accent-subtle);
  color: var(--text);
}
.tab-count {
  min-width: 18px;
  padding: 0 5px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: var(--fs-micro);
  font-variant-numeric: tabular-nums;
  line-height: 17px;
}
.tab[aria-pressed='true'] .tab-count {
  background: var(--bg-panel);
  color: var(--text);
}

/* ------------------------------------------------------------------- notes */

/*
 * A warning is Geist's: amber words on an amber wash with no edge, after the
 * triangle. An error is a note, not a fill: a hairline of red around the
 * panel's own surface and the words in red. As the product's `Banner`.
 */
.note {
  display: block;
  position: relative;
  margin: 0 0 16px;
  padding: 10px 12px 10px 36px;
  border-radius: var(--radius);
  background: var(--warn-subtle);
  color: var(--warn);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.note::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 12px;
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8.55846 2H7.44148L1.88975 13.5H14.1102L8.55846 2ZM9.90929 1.34788C9.65902 0.829456 9.13413 0.5 8.55846 0.5H7.44148C6.86581 0.5 6.34092 0.829454 6.09065 1.34787L0.192608 13.5653C-0.127943 14.2293 0.355835 15 1.09316 15H14.9068C15.6441 15 16.1279 14.2293 15.8073 13.5653L9.90929 1.34788ZM8.74997 4.75V8.75H7.24997V4.75H8.74997ZM7.99997 12C8.55226 12 8.99997 11.5523 8.99997 11C8.99997 10.4477 8.55226 10 7.99997 10C7.44769 10 6.99997 10.4477 6.99997 11C6.99997 11.5523 7.44769 12 7.99997 12Z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8.55846 2H7.44148L1.88975 13.5H14.1102L8.55846 2ZM9.90929 1.34788C9.65902 0.829456 9.13413 0.5 8.55846 0.5H7.44148C6.86581 0.5 6.34092 0.829454 6.09065 1.34787L0.192608 13.5653C-0.127943 14.2293 0.355835 15 1.09316 15H14.9068C15.6441 15 16.1279 14.2293 15.8073 13.5653L9.90929 1.34788ZM8.74997 4.75V8.75H7.24997V4.75H8.74997ZM7.99997 12C8.55226 12 8.99997 11.5523 8.99997 11C8.99997 10.4477 8.55226 10 7.99997 10C7.44769 10 6.99997 10.4477 6.99997 11C6.99997 11.5523 7.44769 12 7.99997 12Z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}
.note strong {
  color: inherit;
}
.note .path {
  color: inherit;
}
.note.is-error {
  border: 1px solid color-mix(in srgb, var(--err) 24%, var(--bg-panel));
  background: color-mix(in srgb, var(--err) 3%, var(--bg-panel));
  color: var(--err);
}
.note.is-error::before {
  transform: rotate(180deg);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 4.41015 11.5899 1.5 8 1.5C4.41015 1.5 1.5 4.41015 1.5 8C1.5 11.5899 4.41015 14.5 8 14.5ZM8 16C12.4183 16 16 12.4183 16 8C16 3.58172 12.4183 0 8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16ZM6.25 7H7.74999C8.30227 7 8.74999 7.44772 8.74999 8V12.25H7.24999V8.5H6.25V7ZM8 6C8.55229 6 9 5.55228 9 5C9 4.44772 8.55229 4 8 4C7.44772 4 7 4.44772 7 5C7 5.55228 7.44772 6 8 6Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 4.41015 11.5899 1.5 8 1.5C4.41015 1.5 1.5 4.41015 1.5 8C1.5 11.5899 4.41015 14.5 8 14.5ZM8 16C12.4183 16 16 12.4183 16 8C16 3.58172 12.4183 0 8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16ZM6.25 7H7.74999C8.30227 7 8.74999 7.44772 8.74999 8V12.25H7.24999V8.5H6.25V7ZM8 6C8.55229 6 9 5.55228 9 5C9 4.44772 8.55229 4 8 4C7.44772 4 7 4.44772 7 5C7 5.55228 7.44772 6 8 6Z'/%3E%3C/svg%3E");
}

/* Said first on Compliance, in the plainest words: a card, not a warning. */
.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 24px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
}
.notice p {
  color: var(--text-body);
  font-size: var(--fs-sm);
}
.notice strong {
  color: var(--text);
}
.notice-icon svg {
  display: block;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 1.6;
  stroke-linecap: round;
}

/* ------------------------------------------------------------------- shell */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

.mark {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  background: var(--accent-brand);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.sidebar {
  --nav-h: 30px;
  --nav-inset: 8px;
  --nav-gap: 8px;
  --nav-ink: #4d4d4d;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
  background: var(--bg-sidebar);
}
:root[data-theme='dark'] .sidebar {
  --nav-ink: var(--text-muted);
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 8px 0 14px;
}
.sidebar-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 600;
  white-space: nowrap;
}
.sidebar-title span {
  color: var(--text-muted);
  font-weight: 500;
}
.sidebar-fold {
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  color: var(--text-dim);
}
.sidebar-fold:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.sidebar-search {
  position: relative;
  display: flex;
  align-items: center;
  margin: 4px 8px 8px;
}
.sidebar-search-mark {
  position: absolute;
  left: 1px;
  z-index: 1;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  color: var(--text-dim);
  pointer-events: none;
}
.sidebar-search input {
  height: var(--nav-h);
  padding: 0 30px 0 32px;
  border-color: var(--border);
  background: var(--bg-panel);
  font-size: var(--fs-sm);
}
.sidebar-kbd {
  position: absolute;
  right: 7px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text-dim);
  font-size: var(--fs-micro);
  line-height: 16px;
  pointer-events: none;
}
.sidebar-search.is-open .sidebar-kbd {
  display: none;
}

.command-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  width: min(420px, calc(100vw - 24px));
  max-height: min(480px, 70vh);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  box-shadow: var(--shadow-popover);
}
.command-group {
  padding: 8px 8px 4px;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 500;
}
.command-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  height: auto;
  min-height: 34px;
  padding: 6px 8px;
  border: none;
  background: transparent;
  box-shadow: none;
  color: var(--text);
  font-weight: 400;
  text-align: left;
  white-space: normal;
}
.command-item .ico {
  color: var(--text-muted);
}
.command-item > span:last-child {
  display: flex;
  flex: 1;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.command-item small {
  overflow: hidden;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.command-item:hover,
.command-item.is-selected {
  background: var(--bg-hover);
}
.command-empty {
  padding: 16px 8px;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  text-align: center;
}

.nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
  min-height: 0;
  overflow-y: auto;
  padding: 0 8px 12px;
}
.nav-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--nav-gap);
  width: 100%;
  height: var(--nav-h);
  padding: 0 var(--nav-inset);
  border: none;
  background: transparent;
  box-shadow: none;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-align: left;
}
.nav-link [data-icon] {
  color: var(--nav-ink);
}
.nav-link:hover {
  background: var(--bg-hover);
}
.nav-link.is-active {
  background: var(--accent-subtle);
  font-weight: 600;
}
.nav-link.is-active [data-icon] {
  color: var(--text);
}
.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-group {
  height: 24px;
  margin-top: 14px;
  padding: 0 var(--nav-inset);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 500;
  line-height: 24px;
}

.sidebar-foot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px;
  border-top: 1px solid var(--border);
}
.account-btn {
  flex: 1;
  justify-content: flex-start;
  gap: 10px;
  min-width: 0;
  height: 40px;
  padding: 0 6px;
  border: none;
  background: transparent;
  box-shadow: none;
  text-align: left;
}
.account-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.account-text > span,
.account-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-text > span {
  font-size: var(--fs-sm);
  font-weight: 500;
}
.account-text small {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 400;
}

.account-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 8px;
  z-index: 30;
  width: 240px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  box-shadow: var(--shadow-popover);
}
.account-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.account-hello {
  overflow: hidden;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu-item {
  justify-content: flex-start;
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border: none;
  background: transparent;
  box-shadow: none;
  font-weight: 400;
}
.menu-item [data-icon] {
  color: var(--text-muted);
}

.avatar {
  --avatar: #6b6b6b;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--avatar);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}
.avatar-lg {
  width: 34px;
  height: 34px;
  font-size: 14px;
}
.avatar-xl {
  width: 64px;
  height: 64px;
  font-size: 26px;
}

/* Folded: the marks only, as the product's rail. Wide screens only: on a phone the sidebar is a sheet and always opens whole. */
@media (min-width: 861px) {
  .app.is-rail {
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
  }
  .app.is-rail .sidebar-title,
  .app.is-rail .nav-label,
  .app.is-rail .account-text,
  .app.is-rail .sidebar-search input,
  .app.is-rail .sidebar-kbd,
  .app.is-rail #theme-toggle {
    display: none;
  }
  .app.is-rail .sidebar-head {
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    height: auto;
    padding: 12px 0 6px;
  }
  .app.is-rail .sidebar-search {
    justify-content: center;
    margin: 0 8px 8px;
  }
  .app.is-rail .sidebar-search-mark {
    position: static;
    pointer-events: auto;
    border-radius: var(--radius);
  }
  .app.is-rail .sidebar-search-mark:hover {
    background: var(--bg-hover);
    color: var(--text);
  }
  .app.is-rail .nav-link {
    justify-content: center;
    padding: 0;
  }
  .app.is-rail .nav-link + .nav-group,
  .app.is-rail .nav-group {
    display: block;
    height: 1px;
    margin: 8px 6px;
    background: var(--border);
    font-size: 0;
  }
  .app.is-rail .sidebar-foot {
    justify-content: center;
  }
  .app.is-rail .account-btn {
    flex: none;
    justify-content: center;
    width: 36px;
    padding: 0;
  }
}

.mobilebar {
  display: none;
}
.drawer-scrim {
  display: none;
}

/* -------------------------------------------------------------------- page */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 28px 32px 64px;
}
.view {
  max-width: 1240px;
  margin: 0 auto;
}

.view-head {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 24px;
}
.view-head > div:first-child {
  flex: 1;
  min-width: 0;
}
.view-head h2 {
  font-size: var(--fs-title);
  line-height: 28px;
}
.view-head p {
  max-width: 76ch;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: var(--fs-md);
}
.view-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.view-foot {
  margin-top: 10px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin: 32px 0 12px;
}
.section-head h3 {
  font-size: var(--fs-md);
}
.section-head p {
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

.card,
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  box-shadow: var(--shadow-card);
}
.panel {
  overflow: hidden;
}
.card-head {
  padding: 14px 16px 10px;
}
.card-head h4 {
  font-size: var(--fs-md);
}
.card-head p {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.scroll {
  overflow-x: auto;
}
.empty {
  padding: 40px 16px;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  text-align: center;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.filters input[type='search'] {
  flex: 0 1 300px;
  min-width: 200px;
}
.filters select {
  width: auto;
  max-width: 260px;
}

.is-loading :is(.kpis, .chart-card, .split, .panel, .funnel, .answers) {
  opacity: 0.55;
  transition: opacity 0.12s ease;
}

/* ------------------------------------------------------------------ tables */

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: var(--fs-md);
}
th,
td {
  height: 48px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
th:first-child,
td:first-child {
  padding-left: 16px;
}
th:last-child,
td:last-child {
  padding-right: 16px;
}
thead th {
  height: 40px;
  background: var(--bg-raised);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 500;
  white-space: nowrap;
}
tbody td {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
tbody tr:last-child td {
  border-bottom: none;
}
tbody tr:hover td {
  background: var(--bg-raised);
}
tr.is-link {
  cursor: pointer;
}
tr.is-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}
td.strong {
  font-weight: 500;
}
td.quiet {
  color: var(--text-muted);
  white-space: nowrap;
}
th.n,
td.n {
  text-align: right;
}
td.right {
  text-align: right;
  white-space: nowrap;
}
td.right > * + * {
  margin-left: 6px;
}
.source-unknown {
  color: var(--text-dim);
}

.lead-who,
.person {
  display: flex;
  min-width: 0;
}
.lead-who {
  flex-direction: column;
  line-height: 1.3;
}
.lead-who span {
  font-weight: 500;
}
.lead-who small,
.person small {
  display: block;
  color: var(--text-muted);
  font-size: var(--fs-xs);
}
.person {
  align-items: center;
  gap: 10px;
}
.tenant-said {
  display: block;
  margin-top: 1px;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 400;
}

/* ---------------------------------------------------------- badges, chips */

/* A mark, not a button: the 4px rung, set small. */
.badge,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  color: var(--text-body);
  font-size: var(--fs-xs);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}
.badge.is-ok,
.chip.is-current,
.chip.is-paid {
  background: var(--ok-subtle);
  color: var(--ok);
}
.badge.is-info {
  background: var(--info-subtle);
  color: var(--info);
}
.badge.is-warn,
.chip.is-warn,
.chip.is-expired {
  background: var(--warn-subtle);
  color: var(--warn);
}
.badge.is-brand,
.chip.is-admin {
  background: var(--brand-subtle);
  color: var(--brand-ink);
}
.chip.is-superseded {
  color: var(--text-muted);
}

.view :is(.is-implemented, .is-partial, .is-accepted, .is-gap) {
  --status: var(--text-muted);
  --status-subtle: var(--bg-hover);
}
.view .is-implemented {
  --status: var(--ok);
  --status-subtle: var(--ok-subtle);
}
.view .is-partial {
  --status: var(--warn);
  --status-subtle: var(--warn-subtle);
}
.view .is-gap {
  --status: var(--err);
  --status-subtle: var(--err-subtle);
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 20px;
  padding: 0 7px 0 6px;
  border-radius: var(--radius-sm);
  background: var(--status-subtle);
  color: var(--status);
  font-size: var(--fs-xs);
  font-weight: 500;
  white-space: nowrap;
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ------------------------------------------------------- overview, figures */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  box-shadow: var(--shadow-card);
}
.kpi-label {
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.kpi-value {
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 32px;
}
.kpi-sub {
  color: var(--text-muted);
  font-size: var(--fs-xs);
}
.kpi-sub .up {
  color: var(--ok);
  font-weight: 500;
}
.kpi-sub .down {
  color: var(--err);
  font-weight: 500;
}

.chart-card {
  margin-top: 16px;
}
.chart-body {
  position: relative;
  padding: 8px 16px 14px;
}
.chart svg {
  display: block;
  width: 100%;
  overflow: visible;
}
.chart .grid-line {
  stroke: var(--border);
  stroke-width: 1;
  shape-rendering: crispEdges;
}
.chart .axis {
  fill: var(--text-muted);
  font-family: var(--font);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.chart .bar {
  fill: var(--accent-brand);
  transition: opacity 0.12s ease;
}
.chart .hit {
  fill: transparent;
  cursor: default;
}
.chart .hit:focus {
  outline: none;
}
.chart.is-hovering .bar {
  opacity: 0.35;
}
.chart.is-hovering .bar.is-on {
  opacity: 1;
}
.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  pointer-events: none;
}
.tooltip {
  position: absolute;
  z-index: 2;
  min-width: 120px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  box-shadow: var(--shadow-popover);
  font-size: var(--fs-xs);
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 10px));
  white-space: nowrap;
}
.tooltip strong {
  display: block;
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 600;
}
.tooltip span {
  color: var(--text-muted);
}
.chart-table {
  padding: 0 16px 14px;
  font-size: var(--fs-sm);
}
.chart-table summary {
  color: var(--text-muted);
  cursor: pointer;
}
.chart-table table {
  min-width: 0;
  margin-top: 8px;
  font-size: var(--fs-sm);
}
.chart-table th,
.chart-table td {
  height: 34px;
}

.said-panel {
  margin-top: 16px;
}
.said {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  padding: 8px 16px 18px;
}
.said-question h5 {
  margin: 0 0 8px;
  font-size: var(--fs-sm);
}
.said-row {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.said-bar {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: var(--radius-sm);
  background: var(--accent-subtle);
}
:root:not([data-theme='dark']) .said-bar {
  background: rgba(255, 108, 55, 0.14);
}
.said-answer,
.said-count {
  position: relative;
}
.said-count {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.said-none {
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

.funnel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.funnel-step {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  box-shadow: var(--shadow-card);
}
.funnel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.funnel-label {
  font-weight: 500;
}
.funnel-value {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.funnel-track {
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--bg-hover);
}
.funnel-bar {
  min-width: 2px;
  height: 100%;
  border-radius: 3px;
  background: var(--accent-brand);
}
.funnel-hint {
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.activation-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 16px;
  font-size: var(--fs-sm);
}
.activation-foot label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}

/* ------------------------------------------------------------------- packs */

.packs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}
.pack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  box-shadow: var(--shadow-card);
}
.pack h3 {
  font-size: var(--fs-md);
}
.pack p {
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.pack-holders {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.pack-holder {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-body);
  font-size: var(--fs-xs);
}
.pack-none {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

/* -------------------------------------------------------------- compliance */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--fs-xs);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: default;
}
.legend-swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--status);
}
.domains {
  display: flex;
  flex-direction: column;
}
.domain {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.domain:last-child {
  border-bottom: none;
}
.domain-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.domain-name {
  font-size: var(--fs-sm);
  font-weight: 500;
}
.domain-count {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.domain-track {
  height: 8px;
  border-radius: 4px;
  background: var(--bg-hover);
}
.domain-fill {
  display: flex;
  gap: 2px;
  min-width: 8px;
  height: 100%;
  overflow: hidden;
  border-radius: 4px;
}
.domain-seg {
  min-width: 3px;
  background: var(--status);
}
.domain-fill.is-prose {
  width: 100%;
  background: repeating-linear-gradient(-45deg, var(--status) 0 5px, transparent 5px 10px);
  opacity: 0.5;
}
.domain-note {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.coverage {
  max-height: 420px;
  overflow-y: auto;
  padding: 4px 16px 14px;
}
.cover {
  display: grid;
  grid-template-columns: 62px 1fr 44px;
  align-items: center;
  gap: 12px;
  height: 30px;
  cursor: default;
}
.cover-code {
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.cover-track {
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--bg-hover);
}
.cover-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--ok);
}
.cover.is-partial .cover-fill {
  background: var(--warn);
}
.cover.is-none .cover-n {
  color: var(--err);
}
.cover-n {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.control-cell {
  min-width: 300px;
  max-width: 460px;
}
.control-name {
  display: -webkit-box;
  overflow: hidden;
  font-weight: 500;
  line-height: 19px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.control-caveat {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  line-height: 17px;
}
#compliance-table td {
  height: auto;
  padding-top: 12px;
  padding-bottom: 12px;
  vertical-align: top;
}
#compliance-table td.quiet {
  max-width: 190px;
  white-space: normal;
}
.codes {
  max-width: 130px;
}
.code {
  display: inline-block;
  margin: 0 6px 2px 0;
  color: var(--text-body);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.evidence {
  max-width: 230px;
}
.evidence .path {
  display: block;
  overflow: hidden;
  font-size: var(--fs-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.evidence small,
.evidence-none {
  color: var(--text-muted);
  font-size: var(--fs-xs);
}
.evidence-none {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}
.pager label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 400;
}
.pager select {
  width: auto;
  height: 28px;
  padding: 0 6px;
  font-size: var(--fs-sm);
}
.pager button {
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
}

/* ------------------------------------------------------------------- stack */

.stack-swatch,
.stack-edge,
.stack-arrow {
  --data: var(--border-strong);
}
:is(.stack-swatch, .stack-edge, .stack-arrow).is-customer {
  --data: var(--accent-brand);
}
:is(.stack-swatch, .stack-edge, .stack-arrow).is-personal {
  --data: var(--personal);
}
:is(.stack-swatch, .stack-edge, .stack-arrow).is-none {
  --data: var(--text-muted);
}
.stack-swatch {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: var(--data);
}
.stack-legend-hint {
  margin-left: auto;
}
.stack-scroll {
  overflow-x: auto;
  padding: 16px 12px 8px;
}
.stack-graph {
  display: block;
  width: 100%;
  min-width: 900px;
  height: auto;
  font-family: var(--font);
}
.stack-group rect {
  fill: var(--bg-raised);
  stroke: var(--border-strong);
  stroke-dasharray: 4 4;
}
.stack-group text {
  fill: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}
.stack-edge {
  fill: none;
  stroke: var(--data);
  stroke-width: 1.5;
  transition: opacity 120ms ease;
}
.stack-edge.is-none {
  stroke-dasharray: 5 4;
}
.stack-arrow {
  fill: var(--data);
}
.stack-edge.is-faded {
  opacity: 0.12;
}
.stack-node {
  cursor: pointer;
  outline: none;
  transition: opacity 120ms ease;
}
.stack-node rect {
  fill: var(--bg-panel);
  stroke: var(--border-strong);
  stroke-width: 1;
}
.stack-node.is-person rect {
  fill: var(--bg-hover);
}
.stack-node:hover rect {
  stroke: var(--text-muted);
}
.stack-node:focus-visible rect {
  stroke: var(--focus);
  stroke-width: 2;
}
.stack-node.is-selected rect {
  stroke: var(--text);
  stroke-width: 2;
}
.stack-node.is-faded {
  opacity: 0.35;
}
.stack-node-title {
  fill: var(--text);
  font-size: 13px;
  font-weight: 500;
}
.stack-node-sub {
  fill: var(--text-muted);
  font-size: 11px;
}
.stack-detail {
  margin-top: 16px;
}
.stack-detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 0;
}
.stack-detail-head h4 {
  font-size: var(--fs-md);
}
.stack-detail-body {
  max-width: 80ch;
  padding: 8px 16px 4px;
  color: var(--text-body);
  font-size: var(--fs-sm);
}
.stack-detail-body p {
  margin: 0 0 8px;
}
.stack-code {
  color: var(--text-muted);
}
.stack-flows {
  margin: 12px 0 0;
  padding: 0;
  border-top: 1px solid var(--border);
  list-style: none;
}
.stack-flows li {
  display: grid;
  grid-template-columns: minmax(160px, 220px) 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
}
.stack-flows li:last-child {
  border-bottom: none;
}
.stack-flow-who {
  justify-content: flex-start;
  gap: 8px;
  height: auto;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  font-weight: 500;
  text-align: left;
}
.stack-flow-who:hover {
  background: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.stack-flow-dir {
  min-width: 34px;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 400;
}
.stack-flow-what {
  color: var(--text-body);
}
.stack-flow-kind {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  white-space: nowrap;
}

/* ----------------------------------------------------------------- profile */

.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 0 24px;
  text-align: center;
}
.profile-hero h2 {
  margin-top: 10px;
  font-size: var(--fs-title);
}
.profile-hero p {
  color: var(--text-muted);
}
.settings-card {
  max-width: 760px;
  margin: 0 auto 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  box-shadow: var(--shadow-card);
}
.settings-head {
  position: relative;
  padding: 14px 16px 10px;
}
.settings-head h3 {
  font-size: var(--fs-md);
}
.settings-head p {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.settings-head .text-btn {
  position: absolute;
  top: 10px;
  right: 10px;
}
.settings-row {
  display: grid;
  grid-template-columns: 170px 1fr auto;
  align-items: center;
  gap: 16px;
  width: 100%;
  height: auto;
  min-height: 48px;
  padding: 10px 16px;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text);
  font-weight: 400;
  text-align: left;
  white-space: normal;
}
button.settings-row:hover {
  background: var(--bg-raised);
}
.settings-row.is-static {
  grid-template-columns: 170px 1fr;
}
.settings-label {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
}
.settings-value {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: var(--fs-md);
}
.settings-chevron {
  color: var(--text-dim);
}
.settings-row .segmented {
  justify-self: start;
}
.sessions {
  margin: 0;
  padding: 0;
  list-style: none;
}
.session {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.session > .ico {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
}
.session strong {
  display: block;
  font-weight: 500;
}
.session small {
  color: var(--text-muted);
  font-size: var(--fs-xs);
}
.session-current {
  color: var(--ok);
  font-size: var(--fs-sm);
  font-weight: 500;
}

/* ------------------------------------------------------------------- leads */

.lead-far {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  color: var(--text-body);
  font-size: var(--fs-sm);
}
.pips {
  display: inline-flex;
  flex: none;
  gap: 3px;
}
.pip {
  width: 6px;
  height: 14px;
  border-radius: 2px;
  background: var(--bg-active);
}
.pip.is-on {
  background: var(--ok);
}

/* One lead, as a sheet from the right: the product's inspector, not a modal in the middle. */
dialog.sheet {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(460px, 100vw);
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  border-width: 0 0 0 1px;
  border-radius: 0;
  animation: sheet-in 0.2s var(--ease);
}
@keyframes sheet-in {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
}
dialog.sheet > form {
  min-height: 100%;
  gap: 14px;
}
.sheet-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.sheet-head > div {
  flex: 1;
  min-width: 0;
}
.sheet-head h2 {
  overflow-wrap: anywhere;
}
.sheet-title {
  margin-top: 8px;
  font-size: var(--fs-sm);
}
.inbound-stage {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--text-body);
  font-size: var(--fs-sm);
}
.facts {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 6px 12px;
  margin: 0;
  padding: 12px 0;
  border-block: 1px solid var(--border);
  font-size: var(--fs-sm);
}
.facts dt {
  color: var(--text-muted);
}
.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.steps {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}
.steps li {
  position: relative;
  display: grid;
  grid-template-columns: 16px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.steps li.is-done {
  color: var(--text);
}
.steps small {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  text-align: right;
}
.step-mark {
  width: 10px;
  height: 10px;
  margin-left: 3px;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
}
.steps li.is-done .step-mark {
  border-color: var(--ok);
  background: var(--ok);
}
#inbound-marks {
  flex-wrap: wrap;
  align-self: flex-start;
}

/* ------------------------------------------------------------------ social */

.social {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: start;
  gap: 20px;
}
.social-main {
  min-width: 0;
}
.social-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 0;
}
.social-side .note {
  margin: 0;
}

.ask-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
}
.ask-card textarea {
  min-height: 64px;
}
.ask-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
#social-voice-field select {
  max-width: 280px;
}

.answers {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.answer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  box-shadow: var(--shadow-card);
}
.answer-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.answer-head > div:first-child {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.answer-meta {
  color: var(--text-muted);
  font-size: var(--fs-xs);
}
.answer-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}
.answer-asked summary,
.answer-sources summary {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  cursor: pointer;
}
.answer-asked p {
  max-height: 220px;
  margin-top: 6px;
  overflow-y: auto;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--bg-raised);
  color: var(--text-body);
  font-size: var(--fs-sm);
  white-space: pre-wrap;
}
.answer-sources ul {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: var(--fs-sm);
}
.answer-thinking {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.answer .note {
  margin: 0;
}
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2.4s;
  }
}

/* The strategist's Markdown: reading copy, set a little looser than the interface. */
.md {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text);
  font-size: var(--fs-md);
  line-height: 1.6;
}
.md ul,
.md ol {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding-left: 20px;
}
.md h5 {
  margin-top: 4px;
  font-size: var(--fs-md);
}
.md code {
  padding: 1px 4px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
}
.md-quote {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 10px 10px 14px;
  border-left: 3px solid var(--accent-brand);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--bg-raised);
}
.md-quote blockquote {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  margin: 0;
  white-space: pre-line;
}

.lane {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0 16px 14px;
  font-size: var(--fs-sm);
}
.lane dt {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 500;
}
.lane dt:first-child {
  margin-top: 0;
}
.lane dd {
  margin: 0;
}
.lane .md {
  gap: 4px;
  font-size: inherit;
  line-height: inherit;
}
/* STRATEGY.md writes each after its label, so in lower case. */
.lane dd::first-letter {
  text-transform: uppercase;
}
.voices {
  margin: 0;
  padding: 0 0 6px;
  list-style: none;
}
.voices li {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm);
}
.voices strong {
  font-weight: 500;
}
.voices span {
  color: var(--text-muted);
  font-size: var(--fs-xs);
}
.posts {
  display: flex;
  flex-direction: column;
}
.post {
  border-top: 1px solid var(--border);
}
.post summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  cursor: pointer;
  list-style: none;
}
.post summary::-webkit-details-marker {
  display: none;
}
.post summary:hover {
  background: var(--bg-raised);
}
.post-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}
.post-text strong {
  font-size: var(--fs-sm);
  font-weight: 500;
}
.post-text small {
  color: var(--text-muted);
  font-size: var(--fs-xs);
}
.post[open] > :not(summary) {
  margin: 0 16px 12px;
}
.post-scores {
  color: var(--text-muted);
  font-size: var(--fs-xs);
}
.copy-block {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.copy-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 4px 4px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 500;
}
.copy-text {
  max-height: 280px;
  overflow-y: auto;
  padding: 10px;
  font-size: var(--fs-sm);
  line-height: 1.55;
  white-space: pre-wrap;
}

/* ----------------------------------------------------------------- dialogs */

dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-panel);
  box-shadow: var(--shadow-dialog);
  color: var(--text);
}
dialog.wide {
  width: min(680px, calc(100vw - 32px));
}
dialog::backdrop {
  background: var(--bg-overlay);
}
dialog > form,
dialog > div {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
}
dialog h2 {
  font-size: var(--fs-lg);
  line-height: 24px;
}
dialog > form > p,
dialog > div > p {
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
dialog menu,
menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 4px 0 0;
  padding: 0;
}
dialog menu {
  margin: 6px -20px -20px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-raised);
}
dialog.sheet menu {
  position: sticky;
  bottom: 0;
  margin-top: auto;
}
/* The sheet opens on its heading rather than its close button: somebody opening a lead means to read it. */
dialog.sheet h2:focus {
  outline: none;
}
menu.inline {
  justify-content: flex-start;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
}
#key-text,
.secret {
  font-family: var(--mono);
  font-size: var(--fs-sm);
}
.secret {
  letter-spacing: 0.04em;
}

.tenant-licences {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tenant-licences h3 {
  margin-top: 6px;
  font-size: var(--fs-sm);
}
.tenant-licence {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
}

.mfa > div {
  gap: 18px;
}
.mfa-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
}
.mfa-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
}
.mfa-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--text);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mfa-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mfa-title p {
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.mfa-badge {
  padding: 0 7px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
}
.mfa-badge[data-state='on'] {
  background: var(--ok-subtle);
  color: var(--ok);
}
.mfa-badge[data-state='required'] {
  background: var(--warn-subtle);
  color: var(--warn);
}
.mfa-required {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--warn-subtle);
  color: var(--warn) !important;
  font-size: var(--fs-sm);
}
.mfa-plan {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  list-style: none;
  counter-reset: mfa;
}
.mfa-plan li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  counter-increment: mfa;
}
.mfa-plan li + li {
  border-top: 1px solid var(--border);
}
.mfa-plan li::before {
  content: counter(mfa);
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-hover);
  color: var(--text);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.mfa-plan b {
  color: var(--text);
  font-weight: 500;
}
.mfa-steps {
  margin: 0 0 14px;
  padding-left: 20px;
  color: var(--text-body);
  font-size: var(--fs-sm);
  line-height: 22px;
}
.mfa-steps li + li {
  margin-top: 6px;
}
.mfa-secret {
  display: block;
  margin: 8px 0 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  font-size: 14px;
  letter-spacing: 0.08em;
  word-break: break-all;
}
.mfa-code {
  max-width: 180px;
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: 0.3em;
}
.mfa-done,
.mfa-status {
  margin-bottom: 12px;
  color: var(--text-body) !important;
  font-size: var(--fs-sm);
}
.mfa-recovery {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--bg-hover);
  font-size: 13px;
  line-height: 22px;
  columns: 2;
}
.mfa-off-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.mfa-off-form input {
  max-width: 180px;
}
.mfa-note {
  margin-right: auto;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

/* ---------------------------------------------------------------- snackbar */

/* What just happened, bottom right as the product's toasts: ink on the page's opposite. */
.snackbar {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(440px, calc(100vw - 40px));
  padding: 10px 10px 10px 14px;
  border-radius: var(--radius-lg);
  background: var(--text);
  box-shadow: var(--shadow-popover);
  color: var(--bg-panel);
  font-size: var(--fs-sm);
  animation: toast-in 0.18s var(--ease);
}
@keyframes toast-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}
.snackbar.is-error {
  background: var(--bg-panel);
  border: 1px solid color-mix(in srgb, var(--err) 30%, var(--bg-panel));
  color: var(--err);
}
.snackbar-action {
  height: 26px;
  padding: 0 8px;
  border: none;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font-weight: 600;
}
.snackbar-action:hover {
  background: rgba(127, 127, 127, 0.2);
}

/* ----------------------------------------------------------------- sign in */

.signin {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px 16px;
}
.signin-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(380px, 100%);
  padding: 28px 28px 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-panel);
  box-shadow: var(--shadow-card);
}
.signin-card .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-lg);
  font-weight: 600;
}
.brand-soft {
  color: var(--text-muted);
  font-weight: 500;
}
.signin-card .muted {
  margin-top: -6px;
  font-size: var(--fs-sm);
}
.signin-card .primary {
  height: 36px;
  margin-top: 4px;
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 1100px) {
  .social {
    grid-template-columns: minmax(0, 1fr);
  }
  .social-side {
    position: static;
  }
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(280px, 86vw);
    box-shadow: var(--shadow-dialog);
    transform: translateX(-100%);
    transition: transform 0.2s var(--ease);
  }
  .app.is-drawer-open .sidebar {
    transform: none;
  }
  .app.is-drawer-open .drawer-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: var(--bg-overlay);
  }
  .mobilebar {
    display: flex;
    flex: none;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-sidebar);
  }
  .mobilebar .sidebar-title {
    flex: 1;
  }
  .body {
    padding: 20px 16px 48px;
  }
  .view-head {
    flex-direction: column;
    gap: 12px;
  }
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .settings-row,
  .settings-row.is-static {
    grid-template-columns: 1fr auto;
    gap: 2px 12px;
  }
  .settings-row .settings-label {
    grid-column: 1 / -1;
  }
  .stack-flows li {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .filters input[type='search'] {
    flex: 1 1 100%;
  }
}

@media (max-width: 480px) {
  .mfa-head {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .mfa-badge {
    grid-column: 2;
    justify-self: start;
  }
  .facts {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .facts dd {
    margin-bottom: 6px;
  }
}
