:root {
  color-scheme: dark;
  --bg: #0a0b0d;
  --bg-elev: #111317;
  --bg-strip: #0c0e12;
  --ink: #e8eaee;
  --ink-2: #94a3b8;
  --ink-3: #5b6470;
  --hair: rgba(148,163,184,.10);
  --hair-2: rgba(148,163,184,.18);
  --hair-strong: rgba(148,163,184,.32);
  --accent: oklch(0.80 0.13 215);
  --accent-ink: oklch(0.86 0.13 215);
  --accent-soft: oklch(0.80 0.13 215 / 0.12);
  --accent-glow: oklch(0.80 0.13 215 / 0.35);
  --grid: rgba(148,163,184,.14);
  --success: oklch(0.80 0.13 150);
  --warning: oklch(0.80 0.13 75);
  --danger: oklch(0.80 0.13 25);
  --focus-ring: var(--accent);
  --font-display: "Sofia Sans", "Sofia Sans Fallback", ui-sans-serif, system-ui, sans-serif;
  --font-body: var(--font-display);
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --font-accent: "Instrument Serif", Georgia, serif;
  --space: 4px;
  --pad-x: clamp(20px, 4vw, 56px);
  --radius: 0;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #fafaf9;
  --bg-elev: #ffffff;
  --bg-strip: #f4f4f2;
  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #94a3b8;
  --hair: rgba(15,23,42,.08);
  --hair-2: rgba(15,23,42,.14);
  --hair-strong: rgba(15,23,42,.32);
  --accent: oklch(0.55 0.13 230);
  --accent-ink: oklch(0.45 0.14 230);
  --accent-soft: oklch(0.55 0.13 230 / 0.10);
  --accent-glow: oklch(0.55 0.13 230 / 0.18);
  --grid: rgba(15,23,42,.05);
  --success: oklch(0.55 0.13 150);
  --warning: oklch(0.55 0.13 75);
  --danger: oklch(0.55 0.13 25);
  --focus-ring: var(--accent);
}

/* self-host woff2 in a later PR */
@font-face {
  font-family: "Sofia Sans Fallback";
  src: local("Arial"), local("Liberation Sans"), local("Helvetica");
  size-adjust: 96.2%;
  ascent-override: 93.6%;
  descent-override: 31.2%;
  line-gap-override: 0%;
}
*, *::before, *::after {
  box-sizing: border-box;
  border-radius: var(--radius);
}

body, h1, h2, p { margin: 0; }

body {
  min-width: 0;
  color: var(--ink);
  background: var(--bg);
  font: 400 16px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
a { color: inherit; }
::selection { background: var(--accent-glow); }

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

h1, h2 {
  font-family: var(--font-display);
  font-weight: 300;
  letter-spacing: -.03em;
}

h1 { font-size: clamp(54px, 7.4vw, 112px); line-height: .95; }
h2 { font-size: clamp(36px, 5.2vw, 76px); line-height: 1; }

h1 em, h2 em {
  color: var(--accent-ink);
  font: italic 400 1em/1 var(--font-accent);
}

.lead {
  max-width: 52ch;
  color: var(--ink-2);
  font-size: clamp(16px, 1.3vw, 20px);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
.btn, .chip, .section-bar, .card, .tag, .field, .field__control, .shell, .notice, .switcher__menu, .sidebar__item {
  border-radius: var(--radius);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: calc(2 * var(--space));
  min-height: 34px;
  padding: 0 14px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--hair-strong);
  font: 500 12px/1 var(--font-body);
  letter-spacing: .04em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, background-color .2s ease;
}

.btn:not(:disabled, [aria-disabled="true"]):hover {
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.btn--primary:not(:disabled, [aria-disabled="true"]):hover {
  background: var(--accent-ink);
  color: var(--bg);
}

.btn--large { min-height: 48px; padding-inline: 22px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: default; }

.dot {
  flex: 0 0 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.btn--primary .dot { background: currentColor; }

.chip, .tag, .section-bar, .field__label, .shell__link {
  font: 400 11px/1.4 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.chip {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.tag {
  padding: 4px 8px;
  border: 1px solid var(--hair-2);
  color: var(--ink-2);
  font-size: 10px;
}

.section-bar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: calc(2 * var(--space));
  padding: 14px var(--pad-x);
  border-block: 1px solid var(--hair-2);
  color: var(--ink-2);
  letter-spacing: .16em;
}

.section-bar__number { color: var(--accent-ink); }
.section-bar__aside { color: var(--ink-3); }

.card {
  min-width: 0;
  background: var(--bg);
  transition: background-color .3s ease;
}

.card:hover { background: var(--bg-strip); }

.card__bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: calc(2 * var(--space));
  padding: 14px 20px;
  border-bottom: 1px solid var(--hair);
}

.card__body {
  display: grid;
  gap: calc(3 * var(--space));
  padding: 24px 20px 28px;
  color: var(--ink-2);
}

.card__body h2 {
  color: var(--ink);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 400;
  letter-spacing: -.015em;
  line-height: 1.1;
}

.field { display: grid; gap: calc(2 * var(--space)); }
.field__label { color: var(--ink-2); }
.field__hint, .field__error { font-size: 13px; }
.field__hint { color: var(--ink-2); }
.field__error { color: var(--danger); }

.field__control {
  width: 100%;
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid var(--hair-strong);
  background: var(--bg-elev);
  color: var(--ink);
  font-size: 14px;
}

.field__control:focus-visible { border-color: var(--accent); }
.field--error .field__control { border-color: var(--danger); }

.shell {
  max-width: 1280px;
  min-height: 100vh;
  margin-inline: auto;
  border-inline: 1px solid var(--hair-2);
}

.skip-link {
  position: absolute;
  inset: 8px auto auto 8px;
  z-index: 2;
  padding: 8px 14px;
  background: var(--bg-elev);
  transform: translateY(-200%);
}

.skip-link:focus { transform: none; }

.shell__nav {
  position: sticky;
  z-index: 1;
  top: 0;
  display: flex;
  min-height: 62px;
  border-bottom: 1px solid var(--hair-2);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
}

.shell__brand, .shell__link, .shell__actions {
  display: flex;
  align-items: center;
  padding-inline: var(--pad-x);
}

.shell__brand, .shell__link {
  border-right: 1px solid var(--hair-2);
  text-decoration: none;
}

.shell__brand {
  gap: calc(2 * var(--space));
  font-size: 21px;
  font-weight: 500;
}

.shell__links { display: flex; }
.shell__link { padding-inline: clamp(10px, 2vw, 28px); color: var(--ink-2); }
.shell__brand:hover, .shell__link:hover { background: var(--accent-soft); color: var(--ink); }
.shell__actions { margin-left: auto; }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--hair-strong);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
}

.theme-toggle:hover { color: var(--accent-ink); border-color: var(--accent); }
.theme-toggle__icon::before { content: "◐"; }
.theme-toggle[aria-label="Theme: dark"] .theme-toggle__icon::before { content: "●"; }
.theme-toggle[aria-label="Theme: light"] .theme-toggle__icon::before { content: "○"; }

.page-intro {
  display: grid;
  gap: calc(5 * var(--space));
  padding: clamp(56px, 8vw, 112px) var(--pad-x) clamp(36px, 6vw, 72px);
  background-image:
    linear-gradient(0deg, transparent calc(100% - 1px), var(--grid) 100%),
    linear-gradient(90deg, transparent calc(100% - 1px), var(--grid) 100%);
  background-size: 80px 80px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--hair-2);
  background: var(--hair-2);
  gap: 1px;
}

.login-form {
  display: grid;
  justify-items: start;
  gap: calc(4 * var(--space));
  max-width: 480px;
  padding: 24px var(--pad-x) 56px;
}

.login-form .field { width: 100%; }

/* Text links: mono, uppercase, accent underline. */
.text-link {
  padding-bottom: 4px;
  border-bottom: 1px solid var(--accent);
  color: var(--ink-2);
  font: 400 11px/1.4 var(--font-mono);
  letter-spacing: .16em;
  text-decoration: none;
  text-transform: uppercase;
}

.text-link:hover { color: var(--accent-ink); }

.field__control:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

/* Notices: one ruled line with a status dot. */
.notice {
  display: flex;
  align-items: baseline;
  gap: calc(3 * var(--space));
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--hair-2);
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 14px;
}

.notice .dot { transform: translateY(-2px); }
.notice--success { border-left-color: var(--success); }
.notice--success .dot { background: var(--success); }
.notice--error {
  border-left-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}
.notice--error .dot { background: var(--danger); }

/* Key/value rows ruled by --hair. */
.kv { margin: 0; }

.kv__row {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr);
  gap: calc(4 * var(--space));
  padding: 14px var(--pad-x);
  border-bottom: 1px solid var(--hair);
}

.kv__key {
  color: var(--ink-3);
  font: 400 11px/1.6 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.kv__value { margin: 0; color: var(--ink); overflow-wrap: anywhere; }

/* Signed-in frame: sticky ruled nav, sidebar cell list, main column. */
.shell--app { display: flex; flex-direction: column; }

.shell__account {
  max-width: 28ch;
  overflow: hidden;
  color: var(--ink-3);
  font: 400 11px/1.4 var(--font-mono);
  letter-spacing: .08em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell__nav .shell__actions { gap: calc(3 * var(--space)); }
.shell__signout { display: flex; margin: 0; }

.app {
  display: grid;
  flex: 1;
  grid-template-columns: 240px minmax(0, 1fr);
}

.app__main { min-width: 0; }
.app__main:focus { outline: none; }

.sidebar { border-right: 1px solid var(--hair-2); }

.sidebar__list {
  position: sticky;
  top: 62px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidebar__item {
  display: flex;
  gap: calc(3 * var(--space));
  padding: 14px 20px;
  border-bottom: 1px solid var(--hair-2);
  border-left: 2px solid transparent;
  color: var(--ink-2);
  font: 400 11px/1.4 var(--font-mono);
  letter-spacing: .14em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color .2s ease, background-color .2s ease;
}

.sidebar__item:hover { background: var(--bg-strip); color: var(--ink); }
.sidebar__number { color: var(--ink-3); }

.sidebar__item[aria-current="page"] {
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}

.sidebar__item[aria-current="page"] .sidebar__number { color: var(--accent-ink); }

/* Workspace switcher: a disclosure cell in the nav. */
.switcher {
  position: relative;
  display: flex;
  border-right: 1px solid var(--hair-2);
}

.switcher__summary {
  display: grid;
  align-content: center;
  gap: 2px;
  min-width: 180px;
  padding: 0 var(--pad-x);
  cursor: pointer;
  list-style: none;
}

.switcher__summary::-webkit-details-marker { display: none; }
.switcher__summary::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1px solid var(--ink-3);
  border-bottom: 1px solid var(--ink-3);
  transform: translateY(-70%) rotate(45deg);
}

.switcher__summary:hover, .switcher[open] .switcher__summary { background: var(--accent-soft); }

.switcher__label {
  color: var(--ink-3);
  font: 400 10px/1.2 var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
}

.switcher__current { padding-right: 18px; font-size: 14px; }

.switcher__menu {
  position: absolute;
  top: 100%;
  left: -1px;
  z-index: 3;
  min-width: calc(100% + 2px);
  margin: 0;
  padding: 0;
  border: 1px solid var(--hair-2);
  background: var(--bg-elev);
  list-style: none;
}

.switcher__option, .switcher__empty {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: calc(4 * var(--space));
  padding: 12px 16px;
  border-bottom: 1px solid var(--hair);
  font-size: 14px;
  text-decoration: none;
}

.switcher__empty { color: var(--ink-2); }
.switcher__option:hover { background: var(--bg-strip); }
.switcher__option[aria-current="true"] { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }

/* Dashboard content. */
.page-head {
  display: grid;
  gap: calc(3 * var(--space));
  padding: clamp(36px, 5vw, 64px) var(--pad-x) clamp(24px, 3vw, 40px);
}

.page-head h1 { font-size: clamp(32px, 4vw, 56px); line-height: 1; }
.page-body { display: grid; gap: calc(4 * var(--space)); padding: 24px var(--pad-x) 48px; }
.page-body .notice { max-width: 72ch; }

/* A lane's own view in the frame (DashboardFrame): the section bar opens the page right
   under the nav (no doubled rule) and the view's headings use the page-head scale. */
.app__main > .section-bar:first-child { border-top: 0; }
.app__main .page-body h1 { font-size: clamp(32px, 4vw, 56px); line-height: 1; }
.app__main .page-body h2 { font-size: clamp(22px, 3vw, 30px); line-height: 1.1; }
.cards--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card__meta { color: var(--ink-3); font: 400 11px/1.4 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; }

/* Signed-out frame: heading cell and form cell side by side. */
.auth {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  min-height: calc(100vh - 62px);
}

.auth__intro { align-content: end; border-right: 1px solid var(--hair-2); }
.auth__intro h1 { font-size: clamp(48px, 6vw, 96px); }
.auth__panel { display: flex; flex-direction: column; }
.auth__panel .login-form { max-width: 520px; }

.form-links {
  display: flex;
  flex-wrap: wrap;
  gap: calc(5 * var(--space));
  padding: 0 var(--pad-x) 56px;
}

/* Load-in motion; prefers-reduced-motion disables it in base.css. */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.page-intro > *, .page-head > * { animation: fade-up .9s cubic-bezier(.2, .7, .2, 1) both; }
.page-intro > :nth-child(2), .page-head > :nth-child(2) { animation-delay: .18s; }
.page-intro > :nth-child(3), .page-head > :nth-child(3) { animation-delay: .30s; }

@media (max-width: 1100px) {
  .shell__nav { flex-wrap: wrap; }
  .shell__account { display: none; }
}

@media (max-width: 980px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--hair-2); }
  .sidebar__list { position: static; display: flex; overflow-x: auto; }
  .sidebar__item {
    border-bottom: 2px solid transparent;
    border-left: 0;
    border-right: 1px solid var(--hair-2);
    white-space: nowrap;
  }
  .sidebar__item[aria-current="page"] { border-bottom-color: var(--accent); }
  .auth { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .auth__intro { border-right: 0; border-bottom: 1px solid var(--hair-2); }
  .cards--three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .cards, .cards--three { grid-template-columns: minmax(0, 1fr); }
  .shell__actions { padding-inline: 12px; }
  .shell__brand { padding-inline: 12px; }
  .switcher { order: 3; width: 100%; border-top: 1px solid var(--hair-2); border-right: 0; }
  .switcher__summary { width: 100%; min-height: 48px; }
  .kv__row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  /* Tighter section cells so three sections fit a 390px screen (the strip still scrolls). */
  .sidebar__item { gap: 8px; padding: 14px 12px; }
}

@media (max-width: 420px) {
  .shell__nav .btn { padding-inline: 10px; }
  .shell__link { padding-inline: 10px; }
}

.members-page {
  display: grid;
  gap: 0.75rem;
  overflow-wrap: anywhere;
  max-width: 80rem;
  margin-inline: auto;
  padding: var(--pad-x);
  border-inline: 1px solid var(--hair);
}

.members-page form {
  display: inline-flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.25rem 0.5rem 0.25rem 0;
}

.members-page label,
.members-table th {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.members-page input,
.members-page select {
  background: var(--bg-elev);
  color: var(--ink);
  border: 1px solid var(--hair-strong);
  padding: 0.4rem;
}

.members-table {
  overflow-x: auto;
}

.members-table table {
  width: 100%;
  border-collapse: collapse;
}

.members-table :is(th, td) {
  padding: 0.5rem;
  border: 1px solid var(--hair);
  text-align: left;
}

.members-table th {
  background: var(--bg-strip);
}
.crm-shell {
  display: grid;
  gap: calc(var(--space) * 4);
}

.crm-toolbar,
.crm-command fieldset,
.crm-totals {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: calc(var(--space) * 3);
}

.crm-panel,
.crm-column {
  min-width: 0;
  border: 1px solid var(--hair-2);
  background: var(--bg-elev);
}

.crm-panel {
  padding: calc(var(--space) * 4);
}

.crm-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(16rem, 1fr);
  overflow-x: auto;
}

.crm-column + .crm-column {
  border-inline-start: 0;
}

.crm-column-body,
.crm-timeline {
  display: grid;
  gap: calc(var(--space) * 2);
  padding: calc(var(--space) * 3);
}

.crm-column .card,
.crm-column .card:hover {
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: none;
}

.crm-rotting {
  color: var(--warning);
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.crm-table-scroll {
  overflow-x: auto;
}

.crm-table {
  width: 100%;
  border-collapse: collapse;
  text-align: start;
}

.crm-table th,
.crm-table td {
  border: 1px solid var(--hair-2);
  padding: calc(var(--space) * 2) calc(var(--space) * 3);
}

.crm-table thead {
  background: var(--bg-strip);
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.crm-table tbody tr:hover {
  background: var(--bg-strip);
}

.crm-command fieldset {
  border: 0;
  min-width: 0;
  padding: 0;
}

.crm-command .crm-editor {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
}

.crm-shell label {
  display: grid;
  gap: var(--space);
}

.crm-shell input,
.crm-shell select,
.crm-shell textarea {
  min-width: 0;
  border: 1px solid var(--hair-strong);
  border-radius: var(--radius);
  background: var(--bg-strip);
  color: var(--ink);
  padding: calc(var(--space) * 2);
  font: inherit;
}

.crm-shell summary {
  cursor: pointer;
}

.crm-feedback:empty,
.crm-feedback ul:empty {
  display: none;
}
.schedule-page .theme-toggle { display: none; }

.schedule {
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 48px);
}

.schedule-section {
  border: 1px solid var(--hair-2);
  margin-block: 20px;
  background: var(--bg);
}

.schedule-section__title {
  border-bottom: 1px solid var(--hair-2);
  margin: 0;
  padding: 10px 16px;
  font: 12px var(--font-mono);
  text-transform: uppercase;
}

.schedule-section__body {
  display: grid;
  gap: 12px;
  min-inline-size: 0;
  padding: 16px;
}

.schedule-list a,
.schedule-cell {
  display: block;
  border: 1px solid var(--hair);
  padding: 8px 12px;
  overflow-wrap: anywhere;
}

.schedule-list a + a { margin-top: -1px; }

.schedule-list a[aria-current] {
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
}

.schedule-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 12px;
}

.schedule-details dt {
  color: var(--ink-2);
  font: 11px var(--font-mono);
  text-transform: uppercase;
}

.schedule-details dd { margin-inline-start: 0; }

/* Upstream scheduling forms */
.schedule-editor__details {
  border: 1px solid var(--hair-2);
  border-radius: 0;
}
.schedule-editor__details + .schedule-editor__details {
  border-top: 0;
}
.schedule-editor__details > summary {
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-family: var(--font-mono);
  text-transform: uppercase;
}
.schedule-editor__details[open] > summary {
  border-bottom: 1px solid var(--hair-2);
}
.schedule-editor__details > .text-link {
  display: inline-block;
  margin: 0 1rem 1rem;
}
.schedule-editor__form {
  justify-items: stretch;
  max-width: none;
  padding: 1rem;
}
.schedule-editor__form > .btn {
  justify-self: start;
}
.schedule-editor__row {
  min-width: 0;
  margin: 0;
  padding: 0.75rem;
  border: 1px solid var(--hair-2);
  display: grid;
  gap: 0.75rem;
}
.schedule-editor__row > legend {
  padding-inline: 0.4rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
}
.schedule-editor__windows {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.schedule-editor__checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}
.schedule-editor__check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: fit-content;
}
.schedule-editor__check > input[type="checkbox"] {
  width: auto;
  margin: 0;
}
.schedule-editor__form textarea {
  min-width: 0;
  resize: vertical;
  font-family: var(--font-mono);
}
.schedule-location .kv__row {
  grid-template-columns: minmax(0, 6rem) minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
}
.schedule-embed__code {
  margin: 0.25rem 0 0;
  padding: 0.75rem;
  border: 1px solid var(--hair-2);
  border-radius: 0;
  overflow-x: auto;
  font: 12px/1.5 var(--font-mono);
}
@media (max-width: 36rem) {
  .schedule-editor__windows {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* Workspace pages (/, /pages, /tasks, /activity): square corners, hairline cells, mono
   labels. Only tokens, so both themes follow. */

.ws-flash { padding: 16px var(--pad-x) 0; }
.ws-flash .notice { max-width: 72ch; }

/* Count strip: contiguous cells. */
.ws-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  border-top: 1px solid var(--hair-2);
  background: var(--hair-2);
}

.ws-stat {
  display: grid;
  gap: calc(2 * var(--space));
  padding: 18px 20px;
  background: var(--bg);
}

.ws-stat dt, .ws-meta, .ws-heading, .ws-table thead th, .ws-tab, .ws-disclosure > summary {
  font: 400 11px/1.4 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.ws-stat dt, .ws-meta { color: var(--ink-3); }
.ws-stat dd { margin: 0; color: var(--ink); font-size: clamp(22px, 3vw, 30px); line-height: 1.1; }

.ws-heading { margin: 0; color: var(--ink-2); }
.ws-heading--bar { padding: 10px var(--pad-x); border-bottom: 1px solid var(--hair); background: var(--bg-strip); }
.ws-title { margin: 0; overflow-wrap: anywhere; }
.ws-prose { max-width: 72ch; margin: 0; color: var(--ink-2); overflow-wrap: anywhere; white-space: pre-wrap; }
.ws-empty, .ws-readonly { margin: 0; color: var(--ink-2); font-size: 14px; }
.ws-readonly { max-width: 72ch; }
.ws-back, .ws-more { justify-self: start; }
.ws-group { display: grid; min-width: 0; }
.page-body > .ws-group { gap: calc(2 * var(--space)); }

.ws-link { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.ws-link:hover, .ws-link:focus-visible { color: var(--accent-ink); text-decoration: underline; }
.ws-link[aria-current="true"] { color: var(--accent-ink); }

/* Tabs: a row of contiguous cells. */
.ws-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: calc(4 * var(--space)); }
.ws-tabs { display: flex; flex-wrap: wrap; border: 1px solid var(--hair-2); justify-self: start; }

.ws-tab {
  padding: 9px 12px;
  color: var(--ink-2);
  text-decoration: none;
}

.ws-tab + .ws-tab { border-left: 1px solid var(--hair-2); }
.ws-tab:hover { background: var(--bg-strip); color: var(--ink); }
.ws-tab[aria-current="true"] { background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }

/* Tables: contiguous cells, mono uppercase header row. */
.ws-scroll { overflow-x: auto; }

.ws-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: start;
}

.ws-table th, .ws-table td {
  padding: 10px 14px;
  border: 1px solid var(--hair-2);
  font-weight: 400;
  text-align: start;
  vertical-align: top;
}

.ws-table th:first-child, .ws-table td:first-child { padding-left: var(--pad-x); border-left: 0; }
.ws-table th:last-child, .ws-table td:last-child { border-right: 0; }
.ws-table thead { background: var(--bg-strip); }
.ws-table thead th { color: var(--ink-2); white-space: nowrap; }
.ws-table tbody th { min-width: 16ch; }
.ws-table tbody td { color: var(--ink-2); }
.ws-table tbody tr:hover { background: var(--bg-strip); }

/* Board: lanes are cells with a section-bar header. */
.ws-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(15rem, 1fr);
  overflow-x: auto;
  border-bottom: 1px solid var(--hair-2);
}

.ws-lane { min-width: 0; }
.ws-lane + .ws-lane { border-left: 1px solid var(--hair-2); }
.ws-lane .section-bar { padding-inline: 16px; border-top: 0; }
.ws-lane__body { display: grid; align-content: start; }
.ws-lane__body > .ws-empty, .ws-lane__body > .ws-more { padding: 14px 16px; }

.ws-card {
  display: grid;
  gap: calc(2 * var(--space));
  justify-items: start;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hair);
}

.ws-card p { margin: 0; }
.ws-card:hover { background: var(--bg-strip); }

.ws-move { display: flex; flex-wrap: wrap; align-items: center; gap: calc(1.5 * var(--space)); margin: 0; }
.ws-move__button { min-height: 26px; padding: 0 8px; font-size: 10px; }

/* Lists: ruled rows. */
.ws-list, .ws-thread { display: grid; margin: 0; padding: 0; border-top: 1px solid var(--hair); list-style: none; }

.ws-list__item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: calc(2 * var(--space)) calc(4 * var(--space));
  padding: 10px 0;
  border-bottom: 1px solid var(--hair);
  font-size: 14px;
}

.ws-events .ws-event__detail { flex: 1 1 24ch; min-width: 0; }
.ws-event__actor { min-width: 9ch; }

.ws-tone {
  flex: 0 0 6px;
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--ink-3);
}

.ws-tone--blue { background: var(--accent); }
.ws-tone--violet { background: var(--accent-ink); }
.ws-tone--green { background: var(--success); }
.ws-tone--amber { background: var(--warning); }
.ws-tone--red { background: var(--danger); }

.ws-comment { display: grid; gap: calc(1.5 * var(--space)); padding: 12px 0; border-bottom: 1px solid var(--hair); }
.ws-comment p { margin: 0; }
.ws-comment__author { color: var(--ink-2); }

.ws-blocks { display: grid; gap: 1px; border: 1px solid var(--hair-2); background: var(--hair-2); }
.ws-block { display: grid; gap: calc(2 * var(--space)); padding: 16px; background: var(--bg-elev); }
.ws-block__bar { display: flex; }
.ws-block .ws-heading { color: var(--ink); }

/* Forms: labelled controls in a wrapping grid. */
.ws-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
  align-items: end;
  gap: calc(4 * var(--space));
  max-width: 60rem;
  margin: 0;
}

.ws-form > .btn { justify-self: start; }
.ws-form > p { margin: 0; }
.ws-field { display: grid; gap: calc(2 * var(--space)); min-width: 0; }
.ws-field--wide { grid-column: 1 / -1; }
.ws-field textarea.field__control { min-height: 5.5rem; resize: vertical; font-family: inherit; }
.ws-search { display: flex; flex-wrap: wrap; align-items: end; gap: calc(2 * var(--space)); margin: 0; }
.ws-search .field__control { min-width: 14rem; }

.ws-disclosure { border: 1px solid var(--hair-2); }
.ws-disclosure > summary { padding: 12px 14px; color: var(--ink-2); cursor: pointer; }
.ws-disclosure > summary:hover, .ws-disclosure[open] > summary { background: var(--bg-strip); color: var(--ink); }
.ws-disclosure[open] > summary { border-bottom: 1px solid var(--hair-2); }
.ws-disclosure > .ws-form { padding: 16px 14px; }

.ws-danger { border-color: var(--danger); color: var(--danger); }
.ws-danger:not(:disabled):hover { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }

.ws-link:focus-visible, .ws-tab:focus-visible, .ws-disclosure > summary:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

@media (max-width: 980px) {
  .ws-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .ws-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ws-table th:first-child, .ws-table td:first-child { padding-left: 14px; }
}

/* Planning views share the workspace's ruled cells and scroll within the page. */
.ws-cal, .ws-gantt, .ws-load { min-width: 0; }
.ws-cal-scroll, .ws-gantt-scroll, .ws-load-scroll {
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--hair-2);
}
.ws-cal-scroll:focus-visible, .ws-gantt-scroll:focus-visible, .ws-load-scroll:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.ws-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(136px, 1fr)); }
.ws-cal-day + .ws-cal-day { border-inline-start: 1px solid var(--hair-2); }
.ws-cal-day header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--hair-2);
  background: var(--bg-strip);
}
.ws-cal-day.today header, .ws-load-day.today {
  box-shadow: inset 0 2px var(--accent);
  color: var(--accent-ink);
}
.ws-cal-day p, .ws-cal-more { padding: 8px 10px; }
.ws-cal-more { display: block; }
.ws-cal-task, .ws-gantt-task {
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr);
  align-items: center;
  gap: 2px 8px;
  padding: 8px 10px;
}
.ws-cal-task { border-bottom: 1px solid var(--hair); }
.ws-cal-task small, .ws-gantt-task small { grid-column: 2; color: var(--ink-2); }
.ws-cal-task.done strong { text-decoration: line-through; }

.ws-gantt-chart { --ws-gantt-label: 220px; position: relative; min-width: 860px; }
.ws-gantt-row { display: grid; grid-template-columns: var(--ws-gantt-label) 1fr; border-bottom: 1px solid var(--hair); }
.ws-gantt-head, .ws-gantt-group, .ws-load-head, .ws-load-group { background: var(--bg-strip); }
.ws-gantt-head > span, .ws-gantt-weeks span, .ws-gantt-group { padding: 8px 10px; }
.ws-gantt-group { border-bottom: 1px solid var(--hair-2); }
.ws-gantt-weeks { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.ws-gantt-weeks span { border-inline-start: 1px solid var(--hair-2); }
.ws-gantt-track {
  position: relative;
  display: grid;
  align-items: center;
  min-height: 38px;
  background: repeating-linear-gradient(to right, var(--hair-2) 0 1px, transparent 1px calc(100% / 6));
}
.ws-gantt-bar, .ws-gantt-ghost {
  display: inline-block;
  border: 1px solid transparent;
  box-sizing: border-box;
  height: 8px;
}
.ws-gantt-track .ws-gantt-bar, .ws-gantt-track .ws-gantt-ghost { position: absolute; }
.ws-gantt-track .ws-gantt-bar { top: calc(50% - 8px); }
.ws-gantt-track .ws-gantt-ghost { top: calc(50% + 2px); }
.ws-gantt-ghost { border-color: var(--ink-2); border-style: dashed; }
.ws-gantt .backlog { background: var(--ink-3); }
.ws-gantt .progress { background: var(--accent); }
.ws-gantt .review { background: var(--warning); }
.ws-gantt .done { background: var(--success); }
.ws-gantt .ws-gantt-slip.red { color: var(--danger); }
.ws-gantt .ws-gantt-slip.amber { color: var(--warning); }
.ws-gantt .ws-gantt-slip.green { color: var(--success); }
.ws-gantt-offscreen { padding: 0 10px; color: var(--ink-2); }
.ws-gantt-today {
  position: absolute;
  inset: 0 0 0 var(--ws-gantt-label);
  pointer-events: none;
}
.ws-gantt-today::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 var(--ws-gantt-today);
  border-left: 1px solid var(--accent);
}
.ws-gantt .ws-gantt-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ws-gantt-legend, .ws-load-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.ws-gantt-legend span, .ws-load-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ws-gantt-legend i, .ws-load-legend i { width: 14px; }

.ws-load-grid { width: max-content; }
.ws-load-row { display: grid; grid-template-columns: 188px repeat(84, 44px); }
.ws-load-row, .ws-load-group { border-bottom: 1px solid var(--hair-2); }
.ws-load-label {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 188px;
  padding: 8px 10px;
  border-inline-end: 1px solid var(--hair-2);
  background: var(--bg-elev);
  overflow-wrap: anywhere;
}
.ws-load-row .ws-load-label small { display: block; }
.ws-load-label small { color: var(--ink-2); }
.ws-load-avatar { border: 1px solid var(--hair-2); padding: 3px; font-family: var(--font-mono); }
.ws-load-day, .ws-load-cell { display: grid; justify-items: center; align-items: end; border-inline-end: 1px solid var(--hair); }
.ws-load-day { padding: 4px; }
.ws-load-day small { min-height: 1.4em; }
.ws-load-day.weekend, .ws-load-cell.weekend { background: var(--bg-strip); }
.ws-load-cell { position: relative; min-height: 38px; }
.ws-load-cell i { position: absolute; inset: auto 0 0; }
.ws-load-cell b { z-index: 0; background: var(--bg-elev); padding-inline: 2px; font: 400 11px/1.4 var(--font-mono); }
.ws-load-cell b:empty { display: none; }
.ws-load-swatch { height: 10px; }
.ws-load-cell.under i, .ws-load-swatch.under { background: var(--accent-soft); }
.ws-load-cell.near i, .ws-load-swatch.near { background: var(--warning); }
.ws-load-cell.over i, .ws-load-swatch.over { border: 1px solid var(--danger); }
.ws-load-reader {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (max-width: 640px) {
  .ws-gantt .ws-gantt-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ws-load-row { grid-template-columns: 124px repeat(84, 44px); }
  .ws-load-label { width: 124px; }
}
@media (forced-colors: active) {
  .ws-cal-day.today header, .ws-load-day.today { border-block-start: 2px solid Highlight; }
  .ws-gantt-bar, .ws-gantt-ghost, .ws-load-cell:not(.empty) i, .ws-load-swatch { border: 1px solid CanvasText; }
  .ws-gantt-ghost { border-style: dashed; }
  .ws-gantt-today::before { border-color: Highlight; }
  .ws-load-cell.over i, .ws-load-swatch.over { border: 2px solid Highlight; }
}
@media (prefers-reduced-motion: reduce) {
  .ws-cal-scroll, .ws-gantt-scroll, .ws-load-scroll { scroll-behavior: auto; }
}

.ws-ai { border-top: 1px solid var(--hair-2); }
.ws-ai-row {
  display: grid;
  gap: calc(3 * var(--space));
  margin: 0;
  padding: 12px var(--pad-x);
  border-bottom: 1px solid var(--hair);
}
.ws-ai-actions { display: flex; flex-wrap: wrap; align-items: center; gap: calc(3 * var(--space)); }
.ws-ai-proposals, .ws-ai-citations { list-style: none; margin: 0; padding: 0; }
.ws-ai-title { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.ws-ai-citations {
  display: grid;
  gap: calc(2 * var(--space));
  max-width: 72ch;
}
.ws-ai-citations li { border-left: 1px solid var(--hair-2); padding-inline-start: 12px; }
.ws-ai-citations a { text-decoration: underline; text-underline-offset: .2em; }
.ws-ai-citations blockquote { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.billing-section {
  padding: 1rem 0;
  border-top: 1px solid var(--hair);
}

.billing-section h2, .billing-table thead th {
  font: 600 .75rem var(--font-mono);
  text-transform: uppercase;
}

.billing-section .tag, .billing-section .text-link, .billing-muted {
  margin-inline-end: .5rem;
}

.billing-muted { color: var(--ink-2); }
.billing-table-scroll { overflow-x: auto; }

.billing-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.billing-table th, .billing-table td {
  padding: .5rem .65rem;
  border: 1px solid var(--hair);
}

.billing-table tbody th { font-weight: 500; }

.billing-viewer {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
