/* Factory UI styles. Order: 1 tokens, 2 base, 3 layout, 4 shared parts. Parts that belong to one component live in that
   component's .razor.css next to it. Everything is served by the app: no web fonts, no CDN.

   The accent colour is set once, in Layout/MainLayout.razor (FluentDesignTheme). Fluent derives its tokens from it and
   this file reads them (--accent-fill-rest and friends), so the Fluent buttons and the hand-made parts always agree.
   The neutrals and status colours below are ours; each pair was checked for 4.5:1 text contrast on the surfaces it
   sits on, in both themes. */

/* ---------- 1. Tokens ---------- */

:root {
  color-scheme: light dark;

  /* Accent: from Fluent, with the configured colour only as a fallback before Fluent has started. */
  --accent: var(--accent-fill-rest, #0e7c86);
  --accent-hover: var(--accent-fill-hover, #0b6a73);
  --accent-text: var(--accent-foreground-rest, #0b6b74);
  --on-accent: var(--foreground-on-accent-rest, #ffffff);
  --accent-wash: color-mix(in srgb, var(--accent) 10%, var(--surface));

  /* Neutrals (light) */
  --page: #f3f5f8;
  --surface: #ffffff;
  --surface-sunken: #eceff3;
  --line: #dde2e9;
  --line-strong: #c2cad4;
  --text: #17212b;
  --text-muted: #53616f;
  --text-faint: #66727e;

  /* Status: foreground for text and icons, background for the pill. Never used alone to carry meaning. */
  --st-good: #0b6b3f;  --st-good-bg: #e3f4ea;
  --st-bad: #b3261e;   --st-bad-bg: #fbe7e5;
  /* A filled button that destroys something: the fill, and the text that reads on it. */
  --danger-fill: #b3261e; --danger-on: #ffffff;
  --st-warn: #85540a;  --st-warn-bg: #fdf0d5;
  --st-info: #1b5aa3;  --st-info-bg: #e4eefa;
  --st-muted: #53616f; --st-muted-bg: #e9edf1;

  /* Type scale: 12 / 13 / 15 / 17 / 20 / 24 / 28 px at a 16px root. Body is 15px for a denser read. */
  --font: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-md: 0.9375rem;
  --fs-lg: 1.0625rem;
  --fs-xl: 1.25rem;
  --fs-2xl: 1.5rem;
  --fs-3xl: 1.75rem;

  /* Spacing: a 4px scale. */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;

  /* Shape and depth */
  --r-sm: 4px;
  --r-md: 8px;
  --r-pill: 999px;
  --shadow-1: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 1px rgb(16 24 40 / 4%);
  --shadow-2: 0 4px 12px rgb(16 24 40 / 10%), 0 1px 3px rgb(16 24 40 / 8%);

  --header-h: 3.5rem;
  --focus: var(--accent-text);
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0e1318;
    --surface: #161c23;
    --surface-sunken: #0b0f13;
    --line: #28313b;
    --line-strong: #3a4653;
    --text: #e7ecf1;
    --text-muted: #9eabb8;
    --text-faint: #8a97a4;

    --st-good: #5fd39a;  --st-good-bg: #12301f;
    --st-bad: #ff948b;   --st-bad-bg: #3a1613;
    --danger-fill: #ff948b; --danger-on: #2a0b08;
    --st-warn: #f3bb55;  --st-warn-bg: #36270a;
    --st-info: #86bcf6;  --st-info-bg: #11263f;
    --st-muted: #9eabb8; --st-muted-bg: #222b34;

    --shadow-1: 0 1px 2px rgb(0 0 0 / 40%);
    --shadow-2: 0 4px 14px rgb(0 0 0 / 50%);
  }
}

/* ---------- 2. Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }

body {
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; overflow-wrap: anywhere; }
h1 { font-size: var(--fs-2xl); font-weight: 650; }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
h4 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
code, pre, kbd { font-family: var(--mono); font-size: 0.875em; }
code { overflow-wrap: anywhere; }

a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

/* Keyboard focus is always visible. Blazor focuses the page's h1 after each navigation so screen readers announce the
   new page; a heading that was focused by the program, not by a key, gets no ring. */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
h1[tabindex]:focus:not(:focus-visible) { outline: none; }
h1[tabindex]:focus-visible { outline: none; }

::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--sp-2); top: -4rem; z-index: 20; padding: var(--sp-2) var(--sp-4);
  background: var(--surface); color: var(--text); border-radius: var(--r-md); box-shadow: var(--shadow-2);
}
.skip-link:focus { top: var(--sp-2); }

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.boot-message { padding: var(--sp-5); color: var(--text-muted); }

/* Text written by a model or a tool: plain text, its line breaks kept, long lines wrapped. */
.plain-text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- 3. Layout ---------- */

.shell-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.shell-bar {
  max-width: 72rem; margin: 0 auto; min-height: var(--header-h); padding: 0 var(--sp-4);
  display: flex; align-items: center; gap: var(--sp-5);
}
.brand { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--text); font-weight: 650; font-size: var(--fs-lg); text-decoration: none; }
.brand:hover { text-decoration: none; }
/* min-width lets the navigation shrink below its content and scroll inside the bar, so a third item on a narrow
   screen never pushes the whole page wider than the window. */
.shell-nav { display: flex; align-self: stretch; gap: var(--sp-1); flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.shell-nav::-webkit-scrollbar { display: none; }
.shell-nav a { white-space: nowrap; }
.shell-nav a {
  display: inline-flex; align-items: center; padding: 0 var(--sp-3); color: var(--text-muted); text-decoration: none;
  font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.shell-nav a:hover { color: var(--text); }
.shell-nav a.active { color: var(--text); border-bottom-color: var(--accent); }
.shell-nav a:focus-visible { outline-offset: -4px; }

.shell-main { max-width: 72rem; margin: 0 auto; padding: var(--sp-5) var(--sp-4) var(--sp-7); }
.shell-main > * + * { margin-top: var(--sp-5); }
.narrow { max-width: 42rem; }

.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--sp-3) var(--sp-4); }
.page-header .lede { margin-top: var(--sp-1); color: var(--text-muted); }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }

.section { display: grid; gap: var(--sp-3); }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--sp-2); }
.section-head .count { color: var(--text-muted); font-size: var(--fs-sm); font-weight: 400; margin-left: var(--sp-2); }

.stack { display: grid; gap: var(--sp-3); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }
.list { list-style: none; display: grid; gap: var(--sp-3); }

/* ---------- 4. Shared parts ---------- */

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: var(--sp-4); box-shadow: var(--shadow-1);
}
.card.flat { box-shadow: none; }
.card.compact { padding: var(--sp-3) var(--sp-4); }

/* Buttons that are links (navigation). Fluent buttons are used for actions. Same 4px radius and weight as Fluent's. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: 2rem;
  padding: 0 var(--sp-4); border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface);
  color: var(--text); font: inherit; font-weight: 600; font-size: var(--fs-md); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-sunken); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--accent-text); }
.btn.quiet:hover { background: var(--accent-wash); }

/* Status pill: shape + word + colour. */
.pill {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.1rem 0.55rem 0.1rem 0.4rem; border-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: 600; line-height: 1.4; white-space: nowrap;
  color: var(--tone-fg); background: var(--tone-bg);
}
.tone-good { --tone-fg: var(--st-good); --tone-bg: var(--st-good-bg); }
.tone-bad { --tone-fg: var(--st-bad); --tone-bg: var(--st-bad-bg); }
.tone-warn { --tone-fg: var(--st-warn); --tone-bg: var(--st-warn-bg); }
.tone-info { --tone-fg: var(--st-info); --tone-bg: var(--st-info-bg); }
.tone-muted { --tone-fg: var(--st-muted); --tone-bg: var(--st-muted-bg); }

/* A running status looks alive: the icon breathes. Still without motion: the word says Running. */
.pill.alive .icon { animation: breathe 2s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.35; } }

.icon { flex: none; display: inline-block; vertical-align: -0.125em; }

/* Token meter */
.meter { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-muted); }
.meter-bar { width: 4.5rem; height: 6px; border-radius: var(--r-pill); background: var(--surface-sunken); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.meter-fill { display: block; height: 100%; background: var(--st-info); border-radius: inherit; }
.meter.high .meter-fill { background: var(--st-warn); }
.meter.full .meter-fill { background: var(--st-bad); }
.meter.wide .meter-bar { width: 9rem; }

/* Chips for commits, branches */
.chip {
  display: inline-flex; align-items: center; gap: 0.25rem; padding: 0 0.4rem; border-radius: var(--r-sm);
  background: var(--surface-sunken); border: 1px solid var(--line); color: var(--text-muted);
  font-family: var(--mono); font-size: var(--fs-xs); line-height: 1.5; max-width: 100%; overflow-wrap: anywhere;
}

/* Notices: present, not shouting. */
.notice {
  display: flex; gap: var(--sp-2); align-items: flex-start; padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm); border: 1px solid transparent; font-size: var(--fs-sm);
  color: var(--tone-fg); background: var(--tone-bg);
}
.notice > .icon { margin-top: 0.15rem; }
.notice-body { color: var(--text); min-width: 0; }
.notice-body ul { padding-left: 1.1rem; }
.notice-error { --tone-fg: var(--st-bad); --tone-bg: var(--st-bad-bg); }
.notice-warn { --tone-fg: var(--st-warn); --tone-bg: var(--st-warn-bg); }
.notice-info { --tone-fg: var(--st-info); --tone-bg: var(--st-info-bg); }
.stale { margin-left: auto; }

/* Loading placeholders that match the layout they stand in for. */
.skeleton { display: grid; gap: var(--sp-3); }
.skeleton-line, .skeleton-block {
  border-radius: var(--r-sm); background: linear-gradient(90deg, var(--surface-sunken) 25%, var(--line) 50%, var(--surface-sunken) 75%);
  background-size: 300% 100%; animation: shimmer 1.6s ease-in-out infinite;
}
.skeleton-line { height: 0.9rem; }
.skeleton-block { height: 4.25rem; border-radius: var(--r-md); }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* Empty states: say what is missing and what to do about it. */
.empty { display: grid; justify-items: center; gap: var(--sp-2); padding: var(--sp-6) var(--sp-4); text-align: center; color: var(--text-muted); }
.empty h2, .empty h3 { color: var(--text); }
.empty .icon-wrap { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: var(--r-pill); background: var(--accent-wash); color: var(--accent-text); margin-bottom: var(--sp-1); }
.empty p { max-width: 32rem; }
.empty .btn { margin-top: var(--sp-2); }
.empty.calm { padding: var(--sp-4); grid-auto-flow: column; justify-content: start; text-align: left; gap: var(--sp-3); }

/* Forms (Fluent fields inside) */
.form-section { display: grid; gap: var(--sp-4); }
.form-section > header { display: grid; gap: 2px; }
.form-section > header p { color: var(--text-muted); font-size: var(--fs-sm); }
.form fluent-text-field, .form fluent-text-area, .answer-form fluent-text-field, .answer-form fluent-text-area, .field fluent-text-field, .field fluent-text-area { width: 100%; }
.field { display: grid; gap: var(--sp-1); }
.help { color: var(--text-muted); font-size: var(--fs-sm); }
.field-error { color: var(--st-bad); font-size: var(--fs-sm); display: flex; gap: var(--sp-1); align-items: center; }
.optional-tag { color: var(--text-faint); font-weight: 400; font-size: var(--fs-sm); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }

/* Disclosures for details, output and the raw event */
details.disclosure > summary {
  cursor: pointer; color: var(--text-muted); font-size: var(--fs-sm); list-style: none; display: inline-flex; align-items: center; gap: 0.25rem;
  border-radius: var(--r-sm);
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: ""; width: 0.4rem; height: 0.4rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 0.12s; margin-right: 0.2rem; }
details.disclosure[open] > summary::before { transform: rotate(45deg); }
details.disclosure > summary:hover { color: var(--text); }
.codeblock {
  margin: var(--sp-1) 0 0; padding: var(--sp-2) var(--sp-3); background: var(--surface-sunken); border: 1px solid var(--line);
  border-radius: var(--r-sm); font-family: var(--mono); font-size: var(--fs-xs); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 20rem; overflow: auto; color: var(--text);
}

#blazor-error-ui {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: var(--sp-3) var(--sp-5);
  background: var(--st-bad); color: #fff; z-index: 1000;
}
#blazor-error-ui a { color: #fff; margin-left: var(--sp-4); }

@media (max-width: 40rem) {
  :root { --fs-2xl: 1.3rem; }
  .shell-bar { gap: var(--sp-3); }
  .shell-nav a { padding: 0 var(--sp-2); }
  /* The mark alone stands for the product here; its link still carries the name for screen readers. */
  .brand-name { display: none; }
  .shell-main { padding-top: var(--sp-4); }
  .btn { min-height: 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .pill.alive .icon, .skeleton-line, .skeleton-block { animation: none; }
  details.disclosure > summary::before { transition: none; }
}

/* Windows high contrast: keep shapes visible when colours are replaced. */
@media (forced-colors: active) {
  .pill, .chip, .notice, .card { border: 1px solid CanvasText; }
  .meter-fill { background: Highlight; }
}

/* Small helpers used by several components */
.inline-heading { font-size: var(--fs-lg); margin-bottom: var(--sp-1); }
.repo { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--text-muted); max-width: 100%; }
.repo-name { font-family: var(--mono); font-size: var(--fs-sm); color: var(--text); overflow-wrap: anywhere; }
.stale-note { display: flex; align-items: center; gap: var(--sp-1); color: var(--text-muted); font-size: var(--fs-sm); }
.card.attention { border-left: 4px solid var(--st-warn); overflow: hidden; }
.card.list { overflow: hidden; gap: 0; padding: 0; }
.session-actions { justify-content: flex-end; }
.confirm-text { font-size: var(--fs-sm); color: var(--text); }
.tab-panel { padding-top: var(--sp-2); }
.timeline { list-style: none; margin-top: var(--sp-2); }
.tl-order { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.05em; }
.stack fluent-text-field, .stack fluent-text-area { width: 100%; }
.step-note-label { display: block; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }
.answer-form { display: grid; gap: var(--sp-3); max-width: 42rem; }
.answer-form h4 { margin-top: var(--sp-1); }
/* Fluent's own elements are not reached by scoped styles, so rules about them live here. */
.search-form fluent-text-field { flex: 1 1 16rem; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.card.form-section { padding: var(--sp-5); }
.form-legend { padding: 0; margin-bottom: var(--sp-4); font-size: var(--fs-lg); font-weight: 600; display: flex; align-items: center; gap: var(--sp-2); }
.step-number { display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: var(--r-pill); background: var(--accent-wash); color: var(--accent-text); font-size: var(--fs-sm); font-weight: 700; }
.form-section.optional { background: var(--surface-sunken); box-shadow: none; }

/* Workspaces */
.create-form { display: flex; flex-wrap: wrap; align-items: end; gap: var(--sp-2); }
.ws-grid { grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); }
.ws-card { display: grid; gap: var(--sp-3); align-content: start; }
.ws-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.ws-top h2 { font-size: var(--fs-lg); }
.ws-facts { display: grid; gap: var(--sp-2); margin: 0; }
.ws-facts > div { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: space-between; }
.ws-facts dt { color: var(--text-muted); }
.ws-facts dd { margin: 0; text-align: right; }
.ws-actions .ws-delete { margin-left: auto; }
/* Confirming a deletion must not look like the ordinary primary action. */
fluent-button.danger::part(control) { background: var(--danger-fill); color: var(--danger-on); border-color: transparent; }
fluent-button.danger:hover::part(control) { filter: brightness(0.92); }
.confirm { padding: var(--sp-3); border: 1px solid var(--st-bad); border-radius: var(--r-sm); background: var(--st-bad-bg); display: grid; gap: var(--sp-2); }
.ws-facts dt { font-weight: 400; }

/* Administration: rows of summaries, one grid per kind of row, a wrapping line on a phone. */
.admin-list { overflow: hidden; }
.admin-row {
  display: grid; gap: var(--sp-2) var(--sp-4); align-items: center; padding: var(--sp-3) var(--sp-4);
  grid-template-columns: minmax(0, 1fr) 8rem 10.5rem 8rem auto;
}
.admin-row + .admin-row { border-top: 1px solid var(--line); }
.admin-row:hover { background: var(--accent-wash); }
.move-admin-row { grid-template-columns: minmax(0, 1fr) 7rem 8rem auto; }
/* "Files are being copied" is the longest status a workspace has */
.workspace-admin-row { grid-template-columns: minmax(0, 1fr) 12rem 10.5rem 8rem auto; }
.audit-row { grid-template-columns: minmax(0, 1fr) 8rem; }
.ar-main { display: grid; gap: 2px; min-width: 0; }
.ar-title { font-weight: 600; overflow-wrap: anywhere; }
.ar-sub { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); color: var(--text-muted); font-size: var(--fs-sm); }
.ar-reason { max-width: 70ch; font-size: var(--fs-sm); }
.ar-age { font-size: var(--fs-sm); text-align: right; }
.ar-tokens { font-size: var(--fs-sm); }
.ar-actions { justify-content: flex-end; }
.ar-wide { grid-column: 1 / -1; }
.admin-filters { display: flex; flex-wrap: wrap; align-items: end; gap: var(--sp-3); }
.admin-filters .field { min-width: 0; }
.admin-count { margin-left: auto; font-size: var(--fs-sm); }
.admin-note { max-width: 70ch; font-size: var(--fs-sm); margin-bottom: var(--sp-3); }
/* A plain select, drawn like Fluent's text field next to it. */
.select {
  min-height: 2rem; padding: 0 var(--sp-2); border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface);
  color: var(--text); font: inherit;
}
.field > label { font-size: var(--fs-md); }

/* Moving a session: offers to the signed-in person, their own requests, and the notice on the session */
.shell-main > .move-inbox { margin-top: 0; }
.move-inbox > section { margin-top: var(--sp-5); }
.offer-item { display: grid; grid-template-columns: auto 1fr auto; gap: var(--sp-3); align-items: start; padding: var(--sp-4); }
.offer-item + .offer-item { border-top: 1px solid var(--line); }
.offer-icon { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: var(--r-pill); background: var(--st-warn-bg); color: var(--st-warn); }
.offer-main { min-width: 0; display: grid; gap: var(--sp-1); }
.offer-main h3 { font-size: var(--fs-lg); }
.offer-meta { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); color: var(--text-muted); font-size: var(--fs-sm); }
.offer-reason { max-width: 70ch; }
.quiet-heading { font-size: var(--fs-md); color: var(--text-muted); font-weight: 600; }
.quiet-heading .count { font-weight: 400; margin-left: var(--sp-2); }
.outgoing { list-style: none; }
.outgoing-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-4); font-size: var(--fs-sm); padding: var(--sp-2) 0; }
.outgoing-item + .outgoing-item { border-top: 1px solid var(--line); }
.move-notice { display: grid; gap: var(--sp-2); border-left: 4px solid var(--st-info); }
.move-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); font-size: var(--fs-sm); }
.move-form header { display: grid; gap: 2px; }
.ws-grid ~ .move-form, .move-form + .ws-grid { margin-top: var(--sp-4); }
.move-kind { display: inline-flex; align-items: center; gap: var(--sp-1); font-size: var(--fs-sm); color: var(--text-muted); font-weight: 600; margin-right: var(--sp-2); }
.offer-kind { margin: 0; }
.offer-explain, .move-caveat, .ws-preparing { max-width: 70ch; font-size: var(--fs-sm); }
/* Inside a workspace's card: a quiet band, not a second card */
.move-notice.embedded { display: grid; gap: var(--sp-2); border-left: 4px solid var(--st-info); padding-left: var(--sp-3); }

@media (max-width: 52rem) {
  .admin-row, .move-admin-row, .workspace-admin-row, .audit-row { display: flex; flex-wrap: wrap; align-items: center; }
  .ar-main, .ar-wide { flex: 1 1 100%; }
  .ar-age { text-align: left; }
  .ar-actions { margin-left: auto; }
  .admin-count { margin-left: 0; flex-basis: 100%; }
}
@media (max-width: 40rem) {
  .offer-item { grid-template-columns: auto 1fr; }
  .offer-item > .actions { grid-column: 1 / -1; }
}

/* Choosing a person by name */
.person-picker { display: grid; gap: var(--sp-2); }
.field-label { font-size: var(--fs-md); }
.person-results { list-style: none; padding: var(--sp-1); display: grid; }
.person-option { display: grid; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); cursor: pointer; }
.person-option:hover, .person-option.active { background: var(--accent-wash); }
.person-sub { font-size: var(--fs-sm); }
.person-chip { font-family: var(--font); font-size: var(--fs-md); padding: 0.1rem 0.25rem 0.1rem 0.6rem; gap: var(--sp-2); color: var(--text); align-items: center; width: fit-content; }
.chip-remove { display: grid; place-items: center; border: 0; background: transparent; color: var(--text-muted); cursor: pointer; padding: 2px; border-radius: var(--r-sm); }
.chip-remove:hover { color: var(--text); background: var(--surface); }

/* Use and cost: a summary strip, then people as rows that wrap two by two on a phone. Existing tokens only. */
.input {
  min-height: 2rem; width: 100%; padding: 0 var(--sp-2); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); font: inherit;
}
.usage-controls .usage-period { align-self: center; margin-top: var(--sp-4); }
.usage-prices-button { margin-left: auto; }
.link-button { border: 0; background: none; padding: 0; font: inherit; color: var(--accent-text); text-decoration: underline; cursor: pointer; }
.usage-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: var(--sp-3); margin: var(--sp-3) 0; }
.usage-tile { display: grid; gap: var(--sp-1); align-content: start; min-width: 0; }
.usage-label { color: var(--text-muted); font-size: var(--fs-sm); }
.usage-big { font-size: var(--fs-2xl); font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.usage-value { font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.usage-split { display: grid; grid-template-columns: auto 1fr; gap: 0 var(--sp-3); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.usage-split dt { color: var(--text-muted); font-weight: 400; }
.usage-split dd { margin: 0; text-align: right; }
.usage-list { margin-bottom: var(--sp-3); }
.usage-person + .usage-person { border-top: 1px solid var(--line); }
.usage-line {
  display: grid; grid-template-columns: minmax(0, 1fr) repeat(4, minmax(5.5rem, 8rem)); gap: var(--sp-2) var(--sp-4);
  align-items: start; padding: var(--sp-3) var(--sp-4);
}
.usage-cell { display: grid; gap: 2px; min-width: 0; align-content: start; }
.usage-name { min-width: 0; overflow-wrap: anywhere; }
.usage-toggle { display: inline-flex; align-items: center; gap: var(--sp-2); border: 0; background: none; padding: 0; font: inherit; color: var(--text); cursor: pointer; text-align: left; }
.usage-toggle:hover { color: var(--accent-text); }
.usage-weeks { list-style: none; margin: 0; padding: 0; background: var(--surface-sunken); border-top: 1px solid var(--line); }
.usage-week + .usage-week { border-top: 1px solid var(--line); }
.usage-week .usage-name { padding-left: calc(16px + var(--sp-2)); }
.usage-weeks-empty { padding: var(--sp-3) var(--sp-4); font-size: var(--fs-sm); }
.usage-breakdown { font-size: var(--fs-sm); }
.usage-note { margin-top: var(--sp-3); }
.price-editor { margin: var(--sp-3) 0; }
.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: var(--sp-3); align-items: start; }
.price-models { border: 0; padding: 0; margin: 0; display: grid; gap: var(--sp-3); min-width: 0; }
.price-models legend { font-size: var(--fs-md); font-weight: 600; padding: 0; margin-bottom: var(--sp-1); }
.price-model { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: var(--sp-3); align-items: start; }
.price-remove { padding-top: 1.5rem; }
@media (max-width: 52rem) {
  .usage-line { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-line > .usage-name { grid-column: 1 / -1; }
  .usage-week .usage-name { padding-left: 0; }
  .price-model { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .price-model > .field:first-child { grid-column: 1 / -1; }
  .price-remove { padding-top: 0; grid-column: 1 / -1; }
  .usage-prices-button { margin-left: 0; }
}

/* Settings: notifications. Existing tokens only; every row wraps so nothing is wider than a phone. */
.notify-page { display: grid; gap: var(--sp-5); max-width: 48rem; }
.notify-page > * + * { margin-top: 0; }
.notify-skeleton { height: 14rem; }
.notify-group { display: grid; gap: var(--sp-3); min-width: 0; }
.notify-group legend { font-size: var(--fs-md); font-weight: 600; padding: 0; margin-bottom: var(--sp-2); }
.choice { display: flex; gap: var(--sp-3); align-items: flex-start; cursor: pointer; min-width: 0; }
.choice input { flex: none; width: 1.1rem; height: 1.1rem; margin: 0.2rem 0 0; accent-color: var(--accent); }
.choice-text { display: grid; gap: 2px; min-width: 0; }
.choice-label { font-weight: 500; }
.choice.unavailable { cursor: not-allowed; }
.choice.unavailable .choice-label { color: var(--text-muted); }
.notify-address .field-label { font-weight: 600; }
.notify-current { padding: var(--sp-2) var(--sp-3); background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--r-sm); min-width: 0; }
.notify-hint { overflow-wrap: anywhere; }
.notify-saved { display: inline-flex; align-items: center; gap: var(--sp-1); color: var(--st-good); font-weight: 600; }
.notify-test { display: flex; gap: var(--sp-2); align-items: flex-start; color: var(--text); font-size: var(--fs-sm); }
.notify-list { gap: 0; }
.notify-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-2) var(--sp-4); padding: var(--sp-3) var(--sp-4); align-items: start; }
.notify-item + .notify-item { border-top: 1px solid var(--line); }
.notify-main { display: grid; gap: 2px; min-width: 0; }
.notify-title { font-size: var(--fs-md); }
.notify-text { color: var(--text-muted); font-size: var(--fs-sm); }
.notify-reason { color: var(--st-bad); font-size: var(--fs-sm); }
.notify-side { display: grid; justify-items: end; gap: var(--sp-1); }
.notify-when { font-size: var(--fs-sm); white-space: nowrap; }
@media (max-width: 40rem) {
  .notify-item { grid-template-columns: minmax(0, 1fr); }
  .notify-side { grid-row: 1; justify-items: start; grid-auto-flow: column; justify-content: space-between; align-items: center; }
  .card.form-section.notify-form { padding: var(--sp-4); }
}
