/* Component layer. Consumes tokens.css only — no raw colors or font stacks.
   Every component renders under Paper and Console (ADR 0004). */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.45;
  background: var(--surface);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition:
    background var(--dur) var(--ease),
    color var(--dur) var(--ease);
}

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

.ic {
  fill: none;
  vertical-align: -0.2em;
  flex-shrink: 0;
}

/* Machine matter is monospaced, human matter is not */
.machine {
  font-family: var(--font-mono);
}

/* Present to assistive tech only (state words like "unread") */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  border: 1px solid var(--rule-strong);
  padding: 0 4px;
  line-height: 15px;
  color: var(--text-soft);
  background: var(--surface);
}

/* ── App shell ─────────────────────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  height: 100dvh;
}

.side {
  min-width: 0;
  background: var(--surface-sunken);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* Soft, themed scrollbars on every scroll surface — a thin thumb over a
   transparent track, so the rails don't wear the chunky OS default. */
.side,
.main,
.issue-main,
.issue-props {
  scrollbar-width: thin;
  scrollbar-color: var(--rule-strong) transparent;
}

.side::-webkit-scrollbar,
.main::-webkit-scrollbar,
.issue-main::-webkit-scrollbar,
.issue-props::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.side::-webkit-scrollbar-track,
.main::-webkit-scrollbar-track,
.issue-main::-webkit-scrollbar-track,
.issue-props::-webkit-scrollbar-track {
  background: transparent;
}

.side::-webkit-scrollbar-thumb,
.main::-webkit-scrollbar-thumb,
.issue-main::-webkit-scrollbar-thumb,
.issue-props::-webkit-scrollbar-thumb {
  background: var(--rule-strong);
  border-radius: 5px;
}

.side::-webkit-scrollbar-thumb:hover,
.main::-webkit-scrollbar-thumb:hover,
.issue-main::-webkit-scrollbar-thumb:hover,
.issue-props::-webkit-scrollbar-thumb:hover {
  background: var(--text-faint);
}

.brand {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--rule);
}

.brand-word {
  display: block;
  font-weight: 600;
  font-size: 15px;
}

.brand-word::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  background: var(--accent);
  margin-right: 8px;
}

.brand-domain {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  margin-left: 17px;
}

.workspace {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
}

.workspace:hover {
  background: var(--surface-raised);
}

.workspace-mark {
  width: 20px;
  height: 20px;
  border: 1px solid var(--rule-strong);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.workspace-name {
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav {
  flex: 1;
  padding: 10px 0 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 5px 16px;
  border: 0;
  border-left: 2px solid transparent;
  background: none;
  font: inherit;
  text-align: left;
  color: var(--text-soft);
  cursor: pointer;
}

.nav-item:hover {
  background: var(--surface-raised);
  color: var(--text);
}

.nav-item.active {
  background: var(--surface);
  border-left-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}

.nav-item .lbl {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-section {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  color: var(--text-faint);
  padding: 16px 16px 5px;
  text-transform: uppercase;
}

.nav-sub {
  padding-left: 37px;
}

.team-key {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.side-foot {
  border-top: 1px solid var(--rule);
  padding: 10px 16px 12px;
}

.me {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

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

.agent-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--agent-text);
  padding: 4px 0 0 9px;
}

.theme-toggle {
  margin-top: 12px;
  width: 100%;
  justify-content: center;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 20px;
  border-bottom: 1px solid var(--rule);
}

.crumb {
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crumb-here {
  font-weight: 600;
  color: var(--text);
}

.spacer {
  flex: 1;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  border: 1px solid transparent;
  background: none;
  color: var(--text);
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
}

.btn-primary {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--text-on-accent);
}

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

.btn-ghost {
  border-color: var(--rule-strong);
  color: var(--text-soft);
}

.btn-ghost:hover {
  border-color: var(--text);
  color: var(--text);
}

.btn-text {
  color: var(--text-soft);
  padding-left: 6px;
  padding-right: 6px;
}

.btn-text:hover {
  color: var(--text);
  background: var(--surface-raised);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

/* ── Inputs ────────────────────────────────────────────────────────────── */

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

fieldset.field {
  border: 0;
  margin: 0;
  padding: 0;
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
}

.input {
  font: inherit;
  font-size: 13px;
  padding: 5px 9px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--text);
}

.input::placeholder {
  color: var(--text-faint);
}

.input:hover {
  border-color: var(--rule-strong);
}

.input:focus {
  outline: 2px solid var(--focus);
  outline-offset: -1px;
  border-color: var(--focus);
}

.input:disabled {
  opacity: 0.55;
  background: var(--surface-sunken);
}

/* ── Chips, badges, labels ─────────────────────────────────────────────── */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: var(--accent-wash);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 2px 9px;
}

.badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 0 5px;
  line-height: 16px;
  border: 1px solid var(--rule-strong);
  color: var(--text);
  min-width: 20px;
  text-align: center;
}

.badge-hot {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--text-on-accent);
  font-weight: 600;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--text-soft);
  border: 1px solid var(--rule);
  padding: 0 6px;
  line-height: 16px;
  background: var(--surface);
}

.tag i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.lamp {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lamp-ok);
}

/* ── Label management rows (workspace settings and the team Labels page) ── */

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

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

.label-count {
  flex: 1;
  font-size: 10.5px;
  color: var(--text-faint);
}

/* ── The user-pickable palette: state dots and label dots ──────────────── */

.palette-gray {
  background: var(--palette-gray);
}

.palette-red {
  background: var(--palette-red);
}

.palette-orange {
  background: var(--palette-orange);
}

.palette-amber {
  background: var(--palette-amber);
}

.palette-green {
  background: var(--palette-green);
}

.palette-teal {
  background: var(--palette-teal);
}

.palette-blue {
  background: var(--palette-blue);
}

.palette-purple {
  background: var(--palette-purple);
}

/* ── Workflow states: named steps, machine-readable categories ─────────── */

.state-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.state-cat {
  margin-bottom: 16px;
}

.state-cat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--rule-strong);
  padding-bottom: 3px;
}

.state-cat-name {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.state-cat-code {
  margin-left: auto;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--text-faint);
}

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

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

.state-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border: 1px solid var(--rule);
  font-size: 12px;
  cursor: pointer;
}

.color-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.color-option:hover {
  border-color: var(--rule-strong);
}

.color-option:has(input:checked) {
  border-color: var(--rule-strong);
  background: var(--surface-selected);
}

.color-option:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

/* ── Attribution: humans are round ink, agents are machine-printed chips ── */

.avatar {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text);
  color: var(--surface);
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}

.agent-mark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0 6px;
  line-height: 18px;
  background: var(--agent-bg);
  color: var(--agent-fg);
  border: 1px solid var(--agent-border);
  white-space: nowrap;
}

.agent-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-owner {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
}

/* An Agent's avatar: a square machine dot in its chosen palette color.
   Rimmed in agent ink so it stays legible on Console's reverse-video chip. */
.agent-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--agent-fg);
}

/* ── Hairline list primitives ──────────────────────────────────────────── */

.group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 14px 20px 6px;
  border-bottom: 1px solid var(--rule-strong);
}

.group-title {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.group-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}

.group-cat {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--text-faint);
  text-transform: uppercase;
}

.group-more {
  padding: 6px 20px 12px 14px;
  border-bottom: 1px solid var(--rule);
}

.row {
  display: grid;

  /* Key hugs its content (cross-team keys outgrow a fixed column), title
     flexes; every later cell (labels, state, meta, actions) sizes to content
     in its own implicit column. */
  grid-auto-flow: column;
  grid-template-columns: minmax(74px, max-content) minmax(0, 1fr);
  grid-auto-columns: auto;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  height: 36px;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
}

.row:has(.row-check) {
  grid-template-columns: auto minmax(74px, max-content) minmax(0, 1fr);
}

.row-check {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

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

.row.selected {
  background: var(--surface-selected);
  box-shadow: inset 2px 0 0 var(--accent);
}

.row-key {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}

.row-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
}

/* One anchor per row; spans keep their grid cells */
.row-link {
  display: contents;
}

@media (width <= 640px) {
  .row-meta {
    display: none;
  }
}

/* ── Empty states teach the next action ────────────────────────────────── */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 20px;
  border: 1px dashed var(--rule-strong);
  text-align: center;
}

.empty-title {
  font-weight: 600;
}

.empty-body {
  color: var(--text-soft);
  max-width: 42ch;
}

/* ── Search: one field, ranked results, highlighted matches ────────────── */

.search-form {
  padding: 14px 20px;
  border-bottom: 1px solid var(--rule);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 640px;
}

.search-field-icon {
  color: var(--text-faint);
  flex: none;
}

.search-input {
  flex: 1;
  font-size: 14px;
}

.search-result {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 9px 20px;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
}

.search-result:hover {
  background: var(--surface-sunken);
}

.search-result-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.search-result-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-labels {
  display: flex;
  gap: 4px;
  flex: none;
}

.search-result-state {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  font-size: 11px;
  color: var(--text-soft);
}

.search-result-by {
  flex: none;
}

.search-snippet {
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.search-snippet mark {
  background: var(--accent-wash);
  color: var(--accent-strong);
  font-weight: 600;
  border-radius: 2px;
  padding: 0 1px;
}

@media (width <= 640px) {
  .search-result-state-name,
  .search-result-labels {
    display: none;
  }
}

/* ── Auth: the door to the desk ────────────────────────────────────────── */

.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-card {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-brand {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}

.auth-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
}

.auth-body {
  margin: 0;
  color: var(--text-soft);
}

/* Emails are unbroken machine strings; let them wrap inside the card */
.auth-body .machine {
  overflow-wrap: anywhere;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form .btn {
  justify-content: center;
}

.input-code {
  font-size: 20px;
  letter-spacing: 0.35em;
  text-align: center;
}

.auth-note {
  margin: 0;
  font-size: 12px;
  color: var(--text-faint);
  border-top: 1px dashed var(--rule);
  padding-top: 12px;
}

.auth-alt {
  display: flex;
  gap: 8px;
}

/* ── Onboarding: pick your instrument ──────────────────────────────────── */

.onboard {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 20px;
}

.onboard-card {
  width: min(680px, 100%);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.onboard-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.onboard-eyebrow {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.onboard-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.onboard-body {
  margin: 0;
  color: var(--text-soft);
  max-width: 60ch;
}

.onboard-note {
  margin: 0;
  font-size: 12px;
  color: var(--text-faint);
}

.onboard-submit {
  align-self: flex-start;
}

.theme-picker {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  border: 0;
}

.theme-option {
  position: relative;
  display: block;
  cursor: pointer;
}

.theme-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-option-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--rule);
  transition: border-color var(--dur) var(--ease);
}

.theme-option:hover .theme-option-card {
  border-color: var(--rule-strong);
}

.theme-option:has(input:checked) .theme-option-card {
  border-color: var(--accent);
  background: var(--surface-selected);
}

.theme-option:has(input:focus-visible) .theme-option-card {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.theme-option-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.theme-option-label {
  font-weight: 600;
}

.theme-option-tag {
  font-size: 12px;
  color: var(--text-soft);
}

/* A live theme island: nested data-theme resolves the other instrument's
   tokens (ADR 0004), so both render true, side by side, before you choose. */
.tp-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  border: 1px solid var(--rule);
}

.tp-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
}

.tp-crumb {
  font-size: 11px;
  color: var(--text-soft);
}

.tp-spacer {
  flex: 1;
}

.tp-btn {
  padding: 3px 8px;
  font-size: 11px;
  background: var(--accent);
  color: var(--text-on-accent);
}

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

.tp-key {
  font-size: 11px;
  color: var(--text-soft);
}

.tp-title {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The footer toggle is a form now (persists per user); lay the button out
   as if the form were not there. */
.theme-form {
  display: contents;
}

/* ── Flash messages ────────────────────────────────────────────────────── */

.flashes {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: min(480px, calc(100vw - 24px));
}

.flash {
  margin: 0;
  padding: 7px 12px;
  font-size: 12.5px;
  background: var(--surface-raised);
  border: 1px solid var(--rule-strong);
  color: var(--text);
}

.flash-alert {
  border-color: var(--accent-strong);
  background: var(--accent-wash);
}

/* ── Settings: the device list is the safety valve ─────────────────────── */

.settings-body {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px;
}

.settings-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
}

.settings-note {
  margin: 0 0 20px;
  color: var(--text-soft);
}

.settings-whoami {
  font-size: 11.5px;
  color: var(--text-soft);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* group-head's full-bleed padding double-indents inside the padded settings column */
.settings-body .group-head {
  padding-inline: 0;
}

.settings-section {
  margin-bottom: 28px;
}

.session-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
}

.session-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
}

.session-device {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  min-width: 0;
}

.session-meta {
  font-size: 10.5px;
  color: var(--text-faint);
  white-space: nowrap;
}

@media (width <= 640px) {
  .session-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .session-meta {
    grid-column: 1 / -1;
    grid-row: 2;
    white-space: normal;
  }
}

/* ── Workspace switcher: a details disclosure, no JS ───────────────────── */

.switcher summary {
  list-style: none;
}

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

.switcher[open] > summary .ic {
  transform: rotate(180deg);
}

.switcher-menu {
  padding: 4px 0;
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--rule);
}

/* ── Links and button_to forms inside flex/grid shells ─────────────────── */

a.nav-item,
a.btn,
.row a {
  text-decoration: none;
}

.row a {
  color: inherit;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.row-actions form,
.foot-links form,
.topbar form {
  display: contents;
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding-top: 8px;
}

/* ── Standalone forms ──────────────────────────────────────────────────── */

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 420px;
  margin-bottom: 28px;
}

.form .btn {
  align-self: flex-start;
}

.field-hint {
  margin: 0;
  font-size: 11px;
  color: var(--text-faint);
}

.field-error {
  margin: 0;
  font-size: 12px;
  color: var(--accent-strong);
}

.slug-input {
  display: flex;
  align-items: center;
  gap: 6px;
}

.slug-prefix {
  font-size: 12px;
  color: var(--text-faint);
}

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

.main > .empty {
  margin: 20px;
}

/* ── Issue rows: key and state are machine matter ──────────────────────── */

.row-state {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-soft);
  white-space: nowrap;
}

.row-labels {
  display: flex;
  align-items: center;
  gap: 5px;

  /* Chips never crush the issue title */
  max-width: 30%;
  overflow: hidden;
}

/* Long label names ellipsize inside the chip instead of bursting it */
.tag-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (width <= 640px) {
  .row-state-name,
  .row-labels {
    display: none;
  }
}

/* ── Collapsible state groups: the list remembers what you folded ──────── */

.group > .group-head {
  align-items: center;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.group > .group-head::-webkit-details-marker {
  display: none;
}

.group-caret {
  color: var(--text-faint);
  transition: transform var(--dur-fast) var(--ease);
}

.group:not([open]) .group-caret {
  transform: rotate(-90deg);
}

/* ── Filter bar: every filtered view is a URL ──────────────────────────── */

.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-sunken);
}

.filter-bar-mark {
  color: var(--text-faint);
  flex-shrink: 0;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  line-height: 20px;
  padding: 1px 2px 1px 8px;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  white-space: nowrap;
}

.filter-chip-dim {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.filter-chip-x {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  color: var(--text-faint);
}

.filter-chip-x:hover {
  color: var(--text);
}

.filter-add {
  font-size: 12px;
  padding: 3px 7px;
}

/* ── Bulk bar: select rows, dispatch them together ─────────────────────── */

.bulk-bar[hidden] {
  display: none;
}

.bulk-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 20px;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--rule-strong);
}

.bulk-bar .input {
  font-size: 12px;
  padding: 3px 7px;
}

.bulk-count {
  font-size: 11px;
  color: var(--text-soft);
}

/* ── Ticker: the team's last change, live and attributed ───────────────── */

.ticker {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 5px 20px;
  border-bottom: 1px solid var(--rule);
  font-size: 12px;
  color: var(--text-soft);
  white-space: nowrap;
}

.ticker-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.ticker-issue {
  flex-shrink: 0;
  text-decoration: none;
}

.ticker-issue:hover .row-key {
  color: var(--text);
}

.ticker-who {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 0;
  max-width: 45%;
}

.ticker-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Agent entries print in mono: the attribution language of the product */
.ticker-agent .ticker-text {
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.ticker time {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--text-faint);
}

/* ── Board: columns by state, drag is the transition ───────────────────── */

.board {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.board-status {
  margin: 0;
  padding: 0 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-strong);
}

.board-status:not(:empty) {
  padding-top: 6px;
}

.board-cols {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  overflow-x: auto;
}

.board-col {
  flex: 0 0 236px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--rule);
}

.board-col-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px 7px;
  border-bottom: 1px solid var(--rule-strong);
}

.board-col-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}

.board-cards {
  flex: 1;
  min-height: 120px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.board-more {
  align-self: flex-start;
  margin: 4px 8px 10px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  cursor: grab;
}

.card:active {
  cursor: grabbing;
}

.card:hover {
  background: var(--surface-raised);
}

.card.sortable-ghost {
  opacity: 0.45;
  border-style: dashed;
}

.card-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: inherit;
  text-decoration: none;
}

.card-title {
  font-size: 12.5px;
  line-height: 1.35;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.card-meta .row-labels {
  max-width: 100%;
}

/* ── Issue detail: human matter left, machine props right ──────────────── */

.issue {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
}

.issue-main {
  min-width: 0;
  padding: 20px;
  overflow-y: auto;
}

/* The scroll container stays full-width so its scrollbar sits at the column edge
   next to the sidebar; the reading blocks center inside it, so a wide monitor
   splits the leftover space on both sides instead of one void on the right. */
.issue-main > * {
  max-width: 1000px;
  margin-inline: auto;
}

.issue-title {
  margin: 0 auto 12px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.issue-props {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  overflow-y: auto;
  border-left: 1px solid var(--rule);
  background: var(--surface-sunken);
}

.prop {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.prop .input {
  width: 100%;
}

.prop-value {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.prop-chips {
  flex-wrap: wrap;
}

.prop-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.prop-head-link {
  font-size: 11px;
  color: var(--text-faint);
  text-decoration: none;
}

.prop-head-link:hover {
  color: var(--text);
  text-decoration: underline;
}

.label-chip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}

.label-chip-item {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

.label-chip-item form {
  display: contents;
}

.prop-meta {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dashed var(--rule);
}

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

@media (width <= 900px) {
  .issue {
    min-height: auto;
    grid-template-columns: minmax(0, 1fr);
  }

  /* One page scroll on narrow screens; the split-scroll only makes sense wide. */
  .issue-main,
  .issue-props {
    overflow-y: visible;
  }

  .issue-props {
    border-left: 0;
    border-bottom: 1px solid var(--rule);

    /* Properties above the history: triage-and-reply without scrolling past it */
    order: -1;
  }
}

/* Wide-viewport-only button labels collapse to their icon at phone width.
   Visually hidden, not display:none — role="status" still announces. */
@media (width <= 640px) {
  .btn-label-wide {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* ── Sub-issues and relations: the issue's place in the plan ───────────── */

.blocked-banner {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 0 auto 14px;
  padding: 8px 12px;
  border: 1px solid var(--accent-strong);
  border-left-width: 3px;
  background: var(--accent-wash);
  font-size: 12.5px;
}

.blocked-banner-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-strong);
  white-space: nowrap;
}

.blocked-banner-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.blocked-banner-issue {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.blocked-banner-issue:hover .blocked-banner-title {
  text-decoration: underline;
}

.blocked-banner-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub-progress {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-soft);
  white-space: nowrap;
}

.sub-meter {
  align-self: center;
  width: 72px;
  height: 4px;
  appearance: none;
  border: none;
  background: var(--surface-raised);
}

.sub-meter::-webkit-progress-bar {
  background: var(--surface-raised);
}

.sub-meter::-webkit-progress-value {
  background: var(--accent);
}

.sub-meter::-moz-progress-bar {
  background: var(--accent);
}

/* The count says it all on phones; the bar would burst the group head */
@media (width <= 640px) {
  .sub-meter {
    display: none;
  }
}

.quick-add {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.quick-add > .field-error {
  flex-basis: 100%;
}

.quick-add-title {
  flex: 1 1 220px;
  min-width: 0;
}

.quick-add-key {
  flex: 0 1 110px;
  min-width: 0;
}

.quick-add-option {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-soft);
  white-space: nowrap;
}

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

.relation {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
}

.relation-kind {
  flex: none;
  min-width: 92px;
  font-size: 11px;
  color: var(--text-soft);
}

.relation-blocked .relation-kind {
  color: var(--accent-strong);
  font-weight: 700;
}

.relation-issue {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex: 1;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.relation-issue:hover .relation-title {
  text-decoration: underline;
}

.relation-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Links: titled URLs, the PR bridge ─────────────────────────────────── */

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

.link-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
}

.link-row > .ic {
  flex: none;
  color: var(--text-soft);
}

.link-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  text-decoration: none;
}

.link-title:hover {
  text-decoration: underline;
}

.link-host {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--text-faint);
}

.quick-add-url {
  flex: 2 1 240px;
  min-width: 0;
}

/* ── Attachments: inline images and file chips ─────────────────────────── */

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.attachment {
  display: flex;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
}

.attachment-image img {
  display: block;
  max-width: min(320px, 100%);
  max-height: 220px;
  border: 1px solid var(--rule-strong);
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 8px;
  border: 1px solid var(--rule-strong);
  background: var(--surface-raised);
  color: var(--text);
  text-decoration: none;
  font-size: 11px;
}

.attachment-chip:hover {
  border-color: var(--accent);
}

.attachment-chip > .ic {
  flex: none;
  color: var(--text-soft);
}

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

.attachment-size {
  color: var(--text-faint);
  white-space: nowrap;
}

.attach-field,
.attach-form {
  margin-top: 10px;
}

.attach-input {
  min-width: 0;
  font-size: 12px;
  color: var(--text-soft);
}

.dropzone-over {
  outline: 1px dashed var(--accent);
  outline-offset: 3px;
}

.section-empty {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--text-faint);
}

.prop-parent {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  font-size: 12.5px;
  color: var(--text);
  text-decoration: none;
}

.prop-parent:hover .prop-parent-title {
  text-decoration: underline;
}

.prop-parent-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Rendered Markdown (the one sanitized pipeline) ────────────────────── */

.prose {
  max-width: 68ch;
}

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

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  margin: 18px 0 6px;
  font-size: 14px;
  font-weight: 700;
}

.prose h1 {
  font-size: 15px;
}

.prose p,
.prose ul,
.prose ol,
.prose table {
  margin: 0 0 10px;
}

.prose a {
  color: var(--accent-strong);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--surface-sunken);
  border: 1px solid var(--rule);
  padding: 0 3px;
}

.prose pre {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-sunken);
  border: 1px solid var(--rule);
  padding: 10px 12px;
  overflow-x: auto;
}

.prose pre code {
  background: none;
  border: 0;
  padding: 0;
}

.prose blockquote {
  margin: 0 0 10px;
  padding-left: 12px;
  border-left: 2px solid var(--rule-strong);
  color: var(--text-soft);
}

/* Wide tables (agents paste these constantly) scroll inside themselves,
   never the page */
.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.prose th,
.prose td {
  border: 1px solid var(--rule);
  padding: 4px 8px;
  text-align: left;
}

.prose hr {
  border: 0;
  border-top: 1px dashed var(--rule-strong);
}

.prose img {
  max-width: 100%;
}

.prose-empty {
  margin: 0 auto;
  color: var(--text-faint);
}

/* ── Issue page: a wide reading column, a spec spine, a tabbed record ───── */

/* The centered .issue-main bounds the reading column, so description and comment
   prose fill it; other surfaces keep the global 68ch. */
.issue-main .prose {
  max-width: none;
}

.issue-desc {
  margin: 0 auto 4px;
  padding-left: 18px;
  border-left: 2px solid var(--rule);
}

.issue-desc .prose > :first-child {
  margin-top: 0;
}

.issue-desc .prose > p:first-child {
  font-size: 14px;
  line-height: 1.6;
}

/* Top-level sections are accent landmarks; h3 stays a subordinate heading so a
   description's own hierarchy survives instead of flattening to one level. */
.issue-desc .prose h1,
.issue-desc .prose h2 {
  margin: 22px 0 7px;
  padding-bottom: 3px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-strong);
  border-bottom: 1px solid var(--rule);
}

.issue-desc .prose h3 {
  margin: 16px 0 5px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
}

.issue-desc .prose li {
  margin: 4px 0;
}

.issue-desc .prose li::marker {
  color: var(--rule-strong);
}

/* The accreting record — comments, activity, links, sub-issues, relations,
   attachments — under one sticky tab strip. Panels ship in the HTML; the tabs
   controller reveals one at a time (JS-required). */
.issue-record {
  margin-top: 20px;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  background: var(--surface);
  border-bottom: 1px solid var(--rule-strong);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  padding: 10px 12px 9px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-soft);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease);
}

.tab:hover {
  color: var(--text);
}

.tab[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

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

.tab-count {
  padding: 0 5px;
  border: 1px solid var(--rule);
  font-size: 10.5px;
  line-height: 16px;
  color: var(--text-faint);
}

.tab[aria-selected="true"] .tab-count {
  color: var(--accent-strong);
  border-color: var(--accent-strong);
}

.pane {
  padding-top: 12px;
}

.pane[hidden] {
  display: none;
}

.pane-lead {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
}

/* ── Write | Preview tabs on Markdown fields ───────────────────────────── */

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

.mdtabs .btn.active {
  color: var(--text);
  background: var(--surface-raised);
}

.md-preview {
  min-height: 120px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  background: var(--surface);
}

/* Markdown source is written in the machine register, like a code editor */
.md-source {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
}

.issue-form {
  max-width: 560px;
}

/* ── Mentions: members called into the thread by handle ────────────────── */

.mention {
  background: var(--accent-wash);
  color: var(--text);
  padding: 0 3px;
  border-radius: 2px;
}

/* Agent mentions print in agent ink, like every agent trace */
.mention-agent {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--agent-bg);
  color: var(--agent-fg);
  border: 1px solid var(--agent-border);
}

.mention-anchor {
  position: relative;
}

.mention-anchor .input {
  width: 100%;
}

.mention-menu {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + 2px);
  z-index: 30;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--rule-strong);
  background: var(--surface-raised);
}

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

.mention-option {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}

.mention-option:hover,
.mention-option.active {
  background: var(--surface-selected);
}

.mention-none {
  margin: 0;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-faint);
}

/* ── Comments: the conversation, attributed like everything else ───────── */

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

.comment {
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}

.comment-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
}

.comment-head time {
  font-size: 10.5px;
  color: var(--text-faint);
  white-space: nowrap;
}

.comment-edited {
  font-size: 10.5px;
  font-style: italic;
  color: var(--text-faint);
}

.comment-body {
  margin-top: 6px;
  overflow-wrap: break-word;
}

/* Agent comments print in mono: the attribution language of the product */
.comment-agent .comment-body {
  font-family: var(--font-mono);
  font-size: 12px;
}

.comment-tombstone {
  margin: 0;
  font-size: 12.5px;
  font-style: italic;
  color: var(--text-faint);
}

.comments-empty {
  font-size: 12.5px;
  color: var(--text-faint);
}

.comment-form {
  margin-top: 12px;
}

/* ── Activity: the attributed history of every issue ───────────────────── */

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

.act {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 12.5px;
}

.act-who {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 0;
  max-width: 45%;
}

.act-text {
  flex: 1;
  min-width: 0;
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Agent entries print in mono: the attribution language of the product */
.act-agent .act-text {
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.act time {
  font-size: 10.5px;
  color: var(--text-faint);
  white-space: nowrap;
}

/* ── Triage: the dispatch queue — accept routes to human, agent, or backlog ── */

.triage-item {
  padding: 10px 20px 12px;
  border-bottom: 1px solid var(--rule);
}

.triage-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 26px;
}

.triage-row .row-title {
  font-weight: 600;
}

.triage-reporter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 12px;
  color: var(--text-soft);
}

.triage-reporter time {
  font-size: 10.5px;
  color: var(--text-faint);
}

.triage-flag {
  border-color: var(--accent);
  background: var(--accent-wash);
  white-space: nowrap;
}

.triage-actions {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.triage-more summary {
  list-style: none;
}

.triage-more summary::-webkit-details-marker {
  display: none;
}

.triage-more[open] summary {
  border-color: var(--text);
  color: var(--text);
}

.triage-form {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.triage-question {
  flex: 1 1 260px;
  min-width: 0;
  resize: vertical;
}

/* ── Inbox: the personal feed — agent work groups per issue ────────────── */

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

.inbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  min-height: 40px;
  border-bottom: 1px solid var(--rule);
  font-size: 12.5px;
}

.inbox-row:hover {
  background: var(--surface-sunken);
}

.inbox-row form {
  display: contents;
}

.inbox-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.inbox-unread .inbox-dot {
  background: var(--accent);
}

.inbox-who {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  max-width: 30%;
}

.inbox-text {
  color: var(--text-soft);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Agent-actor rows print in mono: the attribution language of the product */
.inbox-agent .inbox-text,
.inbox-group .inbox-text {
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.inbox-issue {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.inbox-issue:hover .inbox-issue-title {
  text-decoration: underline;
}

.inbox-issue-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-row > time,
.inbox-fold summary > time {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--text-faint);
  white-space: nowrap;
}

/* The agent group: one row per issue, the action list folds out */
.inbox-group {
  align-items: flex-start;
}

.inbox-fold {
  flex: 1;
  min-width: 0;
}

.inbox-fold summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  cursor: pointer;
  list-style: none;
}

.inbox-fold summary::-webkit-details-marker {
  display: none;
}

.inbox-fold:not([open]) .group-caret {
  transform: rotate(-90deg);
}

.inbox-group-read {
  margin-top: 7px;
}

.inbox-actions {
  list-style: none;
  margin: 0 0 8px;
  padding: 0 0 0 17px;
  border-left: 1px solid var(--rule);
}

.inbox-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.inbox-action-who {
  flex-shrink: 0;
}

.inbox-action-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--agent-text);
  text-decoration: none;
}

.inbox-action-text:hover {
  text-decoration: underline;
}

.inbox-action time {
  font-size: 10.5px;
  color: var(--text-faint);
  white-space: nowrap;
}

.inbox-channels {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 20px;
}

.inbox-email {
  display: contents;
}

.inbox-email-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-soft);
  cursor: pointer;
}

.inbox-email-toggle input {
  accent-color: var(--accent);
  margin: 0;
}

.inbox-push {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inbox-push-prompt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--rule-strong);
  border-left: 2px solid var(--accent);
  background: var(--surface-raised);
  border-radius: 3px;
}

.inbox-push-prompt-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  color: var(--text-soft);
}

.inbox-push-prompt-text svg {
  flex-shrink: 0;
  color: var(--accent);
}

.inbox-push-unsupported {
  font-size: 12px;
  color: var(--text-faint);
}

@media (width <= 640px) {
  .inbox-row > time,
  .inbox-fold summary > time {
    display: none;
  }
}

/* ── Projects: cross-team deliverable containers ───────────────────────── */

.project-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--rule-strong);
}

.project-name {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.project-props {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px 28px;
}

.project-props .prop {
  min-width: 120px;
}

.project-head .prose {
  max-width: 72ch;
  margin-top: 14px;
}

.project-row {
  grid-template-columns: minmax(0, 1fr);
}

.project-legend {
  color: var(--text-faint);
  font-size: 10.5px;
}

.project-legend-item + .project-legend-item::before {
  content: "· ";
}

.overdue-flag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-strong);
  text-transform: uppercase;
}

/* Stacked <progress> layers segment the bar by category without inline
   styles (the CSP forbids them): each layer paints its cumulative count,
   larger sums sit lower, and only the difference shows through. */
.cat-meter {
  position: relative;
  width: 120px;
  height: 5px;
  background: var(--surface-raised);
}

.cat-meter-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  appearance: none;
  border: none;
  background: none;
}

.cat-meter-layer::-webkit-progress-bar {
  background: transparent;
}

.cat-meter-layer[data-category="done"]::-webkit-progress-value {
  background: var(--palette-green);
}

.cat-meter-layer[data-category="in_progress"]::-webkit-progress-value {
  background: var(--palette-amber);
}

.cat-meter-layer[data-category="todo"]::-webkit-progress-value {
  background: var(--palette-blue);
}

.cat-meter-layer[data-category="backlog"]::-webkit-progress-value {
  background: var(--palette-gray);
}

.cat-meter-layer[data-category="triage"]::-webkit-progress-value {
  background: var(--palette-orange);
}

.cat-meter-layer[data-category="done"]::-moz-progress-bar {
  background: var(--palette-green);
}

.cat-meter-layer[data-category="in_progress"]::-moz-progress-bar {
  background: var(--palette-amber);
}

.cat-meter-layer[data-category="todo"]::-moz-progress-bar {
  background: var(--palette-blue);
}

.cat-meter-layer[data-category="backlog"]::-moz-progress-bar {
  background: var(--palette-gray);
}

.cat-meter-layer[data-category="triage"]::-moz-progress-bar {
  background: var(--palette-orange);
}

/* ── Cycles: per-team time-boxes ───────────────────────────────────────── */

.cycle-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--rule-strong);
}

.cycle-head-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.cycle-name {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.cycle-props {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px 28px;
}

.cycle-props .prop {
  min-width: 120px;
}

.cycle-points {
  color: var(--text-faint);
}

.cycle-points::before {
  content: "· ";
}

.cycle-status {
  padding: 1px 6px;
  border: 1px solid var(--rule-strong);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cycle-status[data-status="active"] {
  border-color: var(--accent-strong);
  color: var(--accent-strong);
}

.cycle-status[data-status="past"] {
  color: var(--text-faint);
}

/* ── Trash: deleted, not canceled ──────────────────────────────────────── */

.trash-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--accent-strong);
  background: var(--accent-wash);
}

/* ── Trust package: export, deletion, the read-only grace lock ─────────── */

.grace-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--accent-strong);
  background: var(--accent-wash);
}

.grace-banner-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text);
}

.grace-banner .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.export-status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.export-status {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.export-status-ready {
  color: var(--palette-green);
}

.export-status-pending {
  color: var(--text-soft);
}

.export-status-failed {
  color: var(--palette-red);
}

.export-when {
  font-size: 11px;
  color: var(--text-faint);
}

.danger-zone {
  border: 1px solid var(--accent-strong);
  padding: 16px;
  background: var(--surface-sunken);
}

.danger-zone .group-head {
  padding-inline: 0;
}

.danger-form {
  max-width: 360px;
}

/* ── Styleguide chrome ─────────────────────────────────────────────────── */

.sg {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.sg-section > h2 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--rule-strong);
  padding-bottom: 6px;
  margin: 0 0 12px;
}

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

.sg-themes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.sg-pane {
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  border: 1px solid var(--rule);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sg-pane-name {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.sg-swatch {
  width: 130px;
}

.sg-swatch .sw {
  height: 40px;
  border: 1px solid var(--rule);
}

.sg-swatch code {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-soft);
}

.sw-surface {
  background: var(--surface);
}

.sw-surface-sunken {
  background: var(--surface-sunken);
}

.sw-surface-raised {
  background: var(--surface-raised);
}

.sw-surface-selected {
  background: var(--surface-selected);
}

.sw-text {
  background: var(--text);
}

.sw-text-soft {
  background: var(--text-soft);
}

.sw-text-faint {
  background: var(--text-faint);
}

.sw-rule {
  background: var(--rule);
}

.sw-rule-strong {
  background: var(--rule-strong);
}

.sw-accent {
  background: var(--accent);
}

.sw-accent-strong {
  background: var(--accent-strong);
}

.sw-accent-wash {
  background: var(--accent-wash);
}

.sw-text-on-accent {
  background: var(--text-on-accent);
}

.sw-agent-text {
  background: var(--agent-text);
}

.sw-lamp-ok {
  background: var(--lamp-ok);
}

.sw-palette-gray {
  background: var(--palette-gray);
}

.sw-palette-red {
  background: var(--palette-red);
}

.sw-palette-orange {
  background: var(--palette-orange);
}

.sw-palette-amber {
  background: var(--palette-amber);
}

.sw-palette-green {
  background: var(--palette-green);
}

.sw-palette-teal {
  background: var(--palette-teal);
}

.sw-palette-blue {
  background: var(--palette-blue);
}

.sw-palette-purple {
  background: var(--palette-purple);
}

.sg-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sg-icon code {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-soft);
}

.sg-type-sample {
  margin: 0;
}

.sg-type-sample .note {
  color: var(--text-faint);
  font-size: 11px;
}

/* ── Responsive: usable to tablet, sidebar becomes a drawer at phone width ── */

.nav-toggle {
  display: none;
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 30;
  width: 42px;
  height: 42px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--rule-strong);
  background: var(--surface-raised);
  color: var(--text);
  cursor: pointer;
}

/* ── Members & Agents: the roster, agents under their accountable Owners ── */

.member-list {
  list-style: none;
  margin: 0;
  padding: 0 20px;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 3px 0;
  border-bottom: 1px solid var(--rule);
}

.member-agent-row {
  padding-left: 28px;
}

.member-agent-link {
  display: inline-flex;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.member-agent-link:hover .agent-name {
  text-decoration: underline;
}

.member-role {
  font-size: 10.5px;
  padding: 0 5px;
  line-height: 16px;
  border: 1px solid var(--rule-strong);
  color: var(--text-faint);
}

.member-archive {
  margin-top: 20px;
}

.member-archive-summary {
  cursor: pointer;
}

.members .settings-note {
  margin: 6px 0 0;
  padding: 0 20px;
}

.members .empty {
  margin: 16px 20px;
}

/* ── Invitations: admin-issued, email-bound, single-use ────────────────── */

.invite-form {
  max-width: none;
}

.invite-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.invite-field-email {
  flex: 1 1 260px;
}

.invite-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}

.invite-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 3px 0;
  border-bottom: 1px solid var(--rule);
}

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

.invite-expiry {
  font-size: 11.5px;
  color: var(--text-faint);
  white-space: nowrap;
}

.nav-item .avatar {
  width: 16px;
  height: 16px;
  font-size: 9px;
}

.nav-item .agent-mark {
  font-size: 10.5px;
}

.profile {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.profile .group-head,
.profile .settings-note {
  padding-inline: 0;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-head .agent-mark {
  font-size: 14px;
  line-height: 26px;
  padding: 0 10px;
}

.profile-head .agent-dot {
  width: 10px;
  height: 10px;
}

.profile-props {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.profile-teams {
  flex-wrap: wrap;
  gap: 4px 12px;
}

.profile-team {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-size: 12.5px;
  color: inherit;
  text-decoration: none;
}

.profile-team:hover {
  text-decoration: underline;
}

.check-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 12.5px;
  cursor: pointer;
}

/* Agent options print in agent ink where the browser lets options be styled */
.opt-agent {
  font-family: var(--font-mono);
  color: var(--agent-text);
}

.mention-handle {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--text-faint);
}

/* ── API keys: shown once, mono forever ────────────────────────────────── */

.key-reveal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid var(--accent-strong);
  background: var(--accent-wash);
}

.key-reveal-title {
  flex-basis: 100%;
  margin: 0;
  font-weight: 700;
}

.key-token {
  font-family: var(--font-mono);
  font-size: 12.5px;
  word-break: break-all;
  user-select: all;
}

.key-reveal-note {
  flex-basis: 100%;
  margin: 0;
  font-size: 12px;
  color: var(--text-soft);
}

.mcp-snippet {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 8px 0;
  padding: 10px 14px;
  border: 1px solid var(--rule);
}

.key-list {
  list-style: none;
  margin: 8px 0;
  padding: 0;
}

.key-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  border-bottom: 1px solid var(--rule);
}

/* ── Keyboard: ⌘K palette, shortcut reference, focus cursor, key hints ───── */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.overlay:not([hidden]) {
  display: flex;
  justify-content: center;
}

.overlay-scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
}

.palette {
  align-items: flex-start;
  padding: 12vh 16px 16px;
}

.shortcut-overlay {
  align-items: center;
  padding: 16px;
}

.palette-panel,
.overlay-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface-raised);
  border: 1px solid var(--rule-strong);
}

.palette-panel {
  width: min(560px, 100%);
  max-height: 70vh;
}

.palette-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--rule);
}

.palette-input {
  flex: 1;
  border: 0;
  padding: 0;
  background: none;
  font-size: 15px;
}

.palette-input:focus {
  outline: none;
}

.palette-results {
  overflow-y: auto;
  padding: 6px;
}

.palette-group + .palette-group {
  margin-top: 6px;
}

.palette-group-head {
  padding: 6px 8px 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.palette-cmd {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  cursor: pointer;
  color: var(--text);
}

.palette-cmd-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.palette-cmd-hint {
  flex: none;
}

.palette-cmd.active {
  background: var(--surface-selected);
  box-shadow: inset 2px 0 0 var(--accent);
}

.palette-search {
  color: var(--text-soft);
}

.palette-search .ic {
  color: var(--text-faint);
}

.shortcut-panel {
  width: min(680px, 100%);
  max-height: 84vh;
  overflow-y: auto;
}

.overlay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule);
}

.overlay-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.shortcut-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px 28px;
  padding: 16px;
}

.shortcut-group-head {
  margin: 0 0 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.shortcut-list {
  margin: 0 0 12px;
}

.shortcut-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 4px 0;
  border-bottom: 1px solid var(--rule);
}

.shortcut-keys {
  flex: none;
  display: flex;
  gap: 3px;
  min-width: 64px;
}

.shortcut-desc {
  margin: 0;
  color: var(--text-soft);
}

/* j/k cursor over list / triage / inbox rows */
.kbd-cursor {
  background: var(--surface-selected);
  box-shadow: inset 3px 0 0 var(--accent);
}

/* Key hints that ride on labels and buttons */
.btn-kbd {
  margin-inline-start: 6px;
}

.prop-hint {
  margin-inline-start: 4px;
}

.kbd-hint {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 7px;
  padding: 0 0 10px;
  margin-bottom: 10px;
  border: 0;
  border-bottom: 1px dashed var(--rule);
  background: none;
  font: inherit;
  font-size: 11.5px;
  color: var(--text-faint);
  text-align: start;
  cursor: pointer;
}

.kbd-hint:hover {
  color: var(--text-soft);
}

.board-hint {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--text-faint);
}

/* ── Two-factor: the second door, machine-precise ──────────────────────── */

.settings-title .ic {
  vertical-align: -3px;
  color: var(--text-soft);
}

.two-factor-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 24px;
}

.two-factor-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--lamp-ok);
  color: var(--lamp-ok);
}

.two-factor-recovery-count {
  font-size: 11.5px;
  color: var(--text-faint);
}

.two-factor-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 320px;
}

.two-factor-input {
  max-width: 240px;
}

.two-factor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-danger {
  color: var(--palette-red);
  border-color: var(--palette-red);
  align-self: flex-start;
}

.two-factor-empty {
  align-items: flex-start;
  text-align: start;
}

.enroll-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 420px;
  margin-bottom: 24px;
}

.enroll-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
}

.enroll-step-num {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-on-accent);
  background: var(--accent);
}

.enroll-step-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.enroll-step-title {
  font-weight: 600;
}

.enroll-step-note {
  font-size: 12px;
  color: var(--text-soft);
}

.qr-plate {
  width: min(200px, 100%);
  padding: 12px;
  margin: 4px 0 8px;
  color: var(--qr-ink);
  background: var(--qr-bg);
  border: 1px solid var(--rule);
}

.qr-plate svg {
  display: block;
  width: 100%;
  height: auto;
}

.enroll-secret-label {
  font-size: 12px;
  color: var(--text-soft);
}

.enroll-secret {
  font-size: 13px;
  letter-spacing: 0.08em;
  word-break: break-all;
  user-select: all;
  color: var(--text);
}

.recovery-codes {
  max-width: 420px;
  padding: 16px;
  border: 1px solid var(--accent-strong);
  background: var(--accent-wash);
}

.recovery-code-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 20px;
  margin: 0 0 14px;
  padding-left: 22px;
}

.recovery-code {
  font-size: 14px;
  letter-spacing: 0.06em;
  user-select: all;
}

.recovery-codes-warning {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--text-soft);
}

@media (width <= 640px) {
  .recovery-code-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (width <= 640px) {
  .board-hint {
    display: none;
  }

  .shortcut-groups {
    grid-template-columns: 1fr;
  }

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

  .side {
    display: none;
  }

  .nav-toggle {
    display: grid;
  }

  .app.nav-open .side {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 84vw);
    z-index: 20;
    border-right: 1px solid var(--rule-strong);
  }
}

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

/* ── Landing (signed-out marketing surface) ────────────────────────────────
   The landing is also the product's speed statement: it reuses the same
   tokens and component atoms so it renders correctly under both instruments
   and looks like the tool, not a generic marketing page. */

.landing {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.landing-top {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px clamp(16px, 5vw, 48px);
  border-bottom: 1px solid var(--rule);
}

.landing-brand {
  text-decoration: none;
  color: inherit;
}

.landing-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

/* Language switcher: a hairline segmented control, no JS */
.locale-switch {
  display: inline-flex;
  border: 1px solid var(--rule-strong);
}

.locale-opt {
  font: inherit;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 4px 9px;
  border: none;
  background: none;
  color: var(--text-soft);
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
}

.locale-opt + .locale-opt {
  border-left: 1px solid var(--rule-strong);
}

.locale-opt:hover {
  color: var(--text);
}

.locale-opt.is-active {
  background: var(--accent-wash);
  color: var(--text);
}

.landing-main {
  flex: 1;
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 0 clamp(16px, 5vw, 48px);
}

.landing-eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-strong);
  margin: 0 0 10px;
}

/* Hero */
.landing-hero {
  padding: clamp(40px, 8vw, 88px) 0 clamp(28px, 5vw, 56px);
  border-bottom: 1px solid var(--rule);
}

.landing-hero-title {
  margin: 0;
  max-width: 18ch;
  font-size: clamp(30px, 5.5vw, 52px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.landing-hero-body {
  margin: 20px 0 0;
  max-width: 60ch;
  font-size: clamp(15px, 2vw, 17px);
  color: var(--text-soft);
}

.landing-hero-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.landing-cta {
  font-size: 15px;
  padding: 10px 20px;
}

.landing-hero-note {
  font-size: 12.5px;
  color: var(--text-faint);
}

.landing-shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 20px;
  margin-top: clamp(32px, 5vw, 56px);
}

/* Rendered board preview: a theme island built from real board atoms */
.landing-shot {
  margin: 0;
  min-width: 0;
}

.landing-shot-frame {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--rule-strong);
  overflow: hidden;
}

.landing-shot-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--rule);
}

.landing-shot-crumb {
  font-size: 12px;
  color: var(--text-soft);
}

.landing-shot-instrument {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.landing-shot-ticker {
  margin: 0;
}

.landing-shot-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
  border-top: 1px solid var(--rule);
}

.landing-shot-col {
  background: var(--surface);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.landing-shot-col-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.landing-shot-col-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.landing-shot-col-head .board-count {
  margin-left: auto;
}

.landing-shot-card {
  cursor: default;
}

/* Sections */
.landing-section {
  padding: clamp(40px, 7vw, 80px) 0;
  border-bottom: 1px solid var(--rule);
}

.landing-section-head {
  max-width: 62ch;
}

.landing-section-title {
  margin: 0;
  font-size: clamp(22px, 3.5vw, 32px);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.landing-section-lead {
  margin: 14px 0 0;
  font-size: clamp(14px, 1.8vw, 16px);
  color: var(--text-soft);
}

/* Wedge: alternating copy + real-component demo */
.landing-wedge {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: clamp(28px, 4vw, 44px);
}

.landing-wedge-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 48px);
  align-items: center;
  padding: clamp(20px, 3vw, 32px) 0;
}

.landing-wedge-row + .landing-wedge-row {
  border-top: 1px solid var(--rule);
}

.landing-wedge-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
}

.landing-wedge-copy p {
  margin: 0;
  max-width: 46ch;
  color: var(--text-soft);
}

.landing-wedge-demo {
  min-width: 0;
  background: var(--surface-sunken);
  border: 1px solid var(--rule);
  padding: 14px;
}

.landing-wedge-demo .act-list,
.landing-wedge-demo .triage-item {
  margin: 0;
}

.landing-wedge-demo .ticker + .ticker {
  margin-top: 6px;
}

/* MCP one-liner snippet */
.landing-snippet {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.landing-snippet-label {
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.landing-snippet-code {
  margin: 0;
  padding: 12px;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  color: var(--text);
  font-size: 12px;
  line-height: 1.6;
}

/* Core loop grid */
.landing-core {
  list-style: none;
  margin: clamp(28px, 4vw, 44px) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}

.landing-core-item {
  background: var(--surface);
  padding: 20px;
}

.landing-core-item-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
}

.landing-core-item-body {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-soft);
}

/* No lock-in */
.landing-lockin-demo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: clamp(24px, 3vw, 36px);
  padding: 16px;
  background: var(--surface-sunken);
  border: 1px solid var(--rule);
}

.landing-lockin-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text);
}

.landing-lockin-note {
  color: var(--text-soft);
  font-size: 13px;
}

/* Two instruments */
.landing-instrument-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: clamp(28px, 4vw, 44px);
}

.landing-instrument {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.landing-instrument .tp-preview {
  padding: 14px;
}

.landing-instrument-name {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.landing-instrument-label {
  font-weight: 700;
}

.landing-instrument-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}

/* Final call to action */
.landing-final {
  text-align: center;
  padding: clamp(56px, 9vw, 104px) 0;
}

.landing-final-title {
  margin: 0;
  font-size: clamp(24px, 4vw, 38px);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.landing-final-body {
  margin: 14px auto 28px;
  max-width: 48ch;
  color: var(--text-soft);
  font-size: clamp(14px, 1.8vw, 16px);
}

.landing-final-legal {
  margin: 20px 0 0;
  font-size: 12px;
  color: var(--text-faint);
}

.landing-final-legal a,
.landing-foot-links a,
.legal-cross a {
  color: var(--accent-strong);
}

/* Footer */
.landing-foot {
  border-top: 1px solid var(--rule);
  padding: clamp(28px, 4vw, 44px) clamp(16px, 5vw, 48px);
}

.landing-foot-main {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
  width: min(1080px, 100%);
  margin: 0 auto;
}

.landing-foot-tagline {
  margin: 8px 0 0;
  max-width: 34ch;
  font-size: 12.5px;
  color: var(--text-soft);
}

.landing-foot-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.landing-foot-links a {
  text-decoration: none;
  font-size: 13px;
}

.landing-foot-links a:hover {
  text-decoration: underline;
}

.landing-foot-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.landing-foot-rights {
  width: min(1080px, 100%);
  margin: 20px auto 0;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

/* Legal pages (ToS + privacy) */
.legal {
  max-width: 68ch;
  padding: clamp(40px, 7vw, 72px) 0 clamp(48px, 8vw, 88px);
}

.legal-title {
  margin: 8px 0 0;
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.legal-updated {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--text-faint);
}

.legal-intro {
  margin: 20px 0 0;
  font-size: clamp(15px, 2vw, 17px);
  color: var(--text-soft);
}

.legal-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}

.legal-section-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
}

.legal-section p {
  margin: 0;
  color: var(--text-soft);
}

.legal-cross {
  margin-top: 32px;
  font-size: 13px;
  color: var(--text-faint);
}

@media (width <= 720px) {
  .landing-wedge-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .landing-wedge-flip .landing-wedge-copy {
    order: -1;
  }
}

@media (width <= 560px) {
  .landing-signin {
    display: none;
  }
}
