/* Plant SQCDPI — shared screen kit. Loaded after app.css; every non-board screen is built from these parts. */

/* Page frame */
.page {
  display: grid;
  gap: var(--space-4);
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

.page--narrow {
  max-width: 1080px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3) var(--space-5);
}

.page-head__eyebrow {
  margin: 0 0 var(--space-1);
  color: var(--ink-2);
  font-size: var(--text-small);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.page-head__eyebrow a {
  color: inherit;
  text-decoration: none;
}

.page-head__eyebrow a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.page-head__title {
  margin: 0;
  font-size: var(--text-metric);
  font-weight: 700;
  line-height: 1.15;
}

.page-head__sub {
  margin: var(--space-1) 0 0;
  max-width: 72ch;
  color: var(--ink-2);
  font-size: var(--text-control);
}

.page-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Panels */
.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--rule);
}

.panel__title {
  margin: 0;
  font-size: var(--text-control);
  font-weight: 700;
}

.panel__meta {
  margin: 0;
  color: var(--ink-2);
}

.panel__body {
  padding: var(--space-4);
}

.panel__body--flush {
  padding: 0;
}

.panel__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--rule);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.grid-main-side {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: var(--space-4);
  align-items: start;
}

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

.stack {
  display: grid;
  gap: var(--space-4);
  align-content: start;
}

/* KPI tiles */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
}

.kpi {
  display: grid;
  gap: 2px;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--status-ink, var(--rule));
  border-radius: var(--radius-card);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-card);
}

a.kpi:hover {
  border-color: var(--ink-2);
  border-left-color: var(--status-ink, var(--ink-2));
}

a.kpi[aria-current="true"] {
  outline: 2px solid var(--ink);
  outline-offset: -1px;
}

.kpi__label {
  color: var(--ink-2);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi__value {
  font-family: var(--font-value);
  font-size: var(--text-metric);
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
}

.kpi__sub {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-2);
  color: var(--ink-2);
}

.kpi__spark {
  height: 32px;
  margin-top: var(--space-1);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-body);
}

.table th {
  position: sticky;
  top: 0;
  padding: var(--space-2) var(--space-4);
  background: var(--surface-2);
  border-bottom: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: var(--text-small);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}

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

.table tbody tr:hover td {
  background: var(--surface-2);
}

.table .num {
  text-align: right;
  font-family: var(--font-value);
  font-size: var(--text-control);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table .nowrap {
  white-space: nowrap;
}

.table .muted,
.muted {
  color: var(--ink-2);
}

.table__title {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

a.table__title:hover {
  text-decoration: underline;
}

.table__sub {
  display: block;
  margin-top: 2px;
  color: var(--ink-2);
}

.table tr.is-overdue td:first-child {
  box-shadow: inset 3px 0 0 var(--off-goal);
}

/* Filters toolbar */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-2) var(--space-3);
}

.filters .field {
  min-width: 160px;
}

.filters__spacer {
  flex: 1 1 auto;
}

/* Forms */
.field {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.field__label {
  color: var(--ink);
  font-weight: 600;
}

.field__label .optional {
  color: var(--ink-2);
  font-weight: 400;
}

.field__hint {
  margin: 0;
  color: var(--ink-2);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-3) var(--space-4);
}

.form-stack {
  display: grid;
  gap: var(--space-4);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 40px;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  font-size: var(--text-control);
  transition: border-color var(--motion), box-shadow var(--motion);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--ink-2);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent);
}

.textarea {
  min-height: 84px;
  resize: vertical;
  line-height: 1.4;
}

.input--num {
  font-family: var(--font-value);
  font-size: var(--text-section);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--ink);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: 0 var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font-size: var(--text-body);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--motion), border-color var(--motion), color var(--motion);
}

.btn--primary {
  background: var(--action);
  border-color: var(--action);
  color: var(--fg-on-action);
}

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

.btn--secondary {
  background: var(--bg-surface);
  border-color: var(--border-strong);
  color: var(--fg);
}

.btn--secondary:hover {
  border-color: var(--fg-muted);
  background: var(--bg-elevated);
}

.btn--ghost {
  background: transparent;
  color: var(--focus);
  padding: 0 var(--space-2);
}

.btn--ghost:hover {
  background: var(--info-tint);
}

.btn--danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--danger-fg);
}

.btn--sm {
  min-height: 32px;
  padding: 0 var(--space-3);
}

.btn--lg {
  min-height: 48px;
  padding: 0 var(--space-5);
  font-size: var(--text-control);
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: 999px;
  background: var(--status-tint, var(--paper));
  color: var(--status-ink, var(--ink-2));
  font-size: var(--text-small);
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge--neutral {
  --status-ink: var(--ink-2);
  --status-tint: color-mix(in srgb, var(--ink) 7%, transparent);
}

.badge--info {
  --status-ink: var(--info);
  --status-tint: var(--info-tint);
}

.badge--good {
  --status-ink: var(--on-goal);
  --status-tint: var(--on-goal-tint);
}

.badge--warn {
  --status-ink: var(--watch);
  --status-tint: var(--watch-tint);
}

.badge--bad {
  --status-ink: var(--off-goal);
  --status-tint: var(--off-goal-tint);
}

.pillar-chip {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--action);
  color: var(--fg-on-action);
  font-family: var(--font-value);
  font-weight: 700;
  font-size: var(--text-body);
  flex-shrink: 0;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--focus) 14%, var(--surface));
  color: var(--focus);
  font-size: var(--text-small);
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  user-select: none;
}

.avatar--photo {
  background: var(--bg-muted);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 10%, transparent);
}

.avatar__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar--sm {
  width: 24px;
  height: 24px;
  font-size: 11px;
}

.avatar--lg {
  width: 42px;
  height: 42px;
  font-size: 15px;
}

.avatar--xl {
  width: 84px;
  height: 84px;
  font-size: 28px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), inset 0 0 0 1px var(--border);
}

.who {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
}

/* Tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  border-bottom: 1px solid var(--rule);
}

.tabs__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--ink-2);
  font-weight: 600;
  text-decoration: none;
}

.tabs__link:hover {
  color: var(--ink);
}

.tabs__link[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.tabs__count {
  padding: 0 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  font-size: var(--text-small);
}

/* Status stepper */
.steps {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps__item {
  display: grid;
  gap: var(--space-1);
  padding-top: var(--space-2);
  border-top: 4px solid var(--rule);
  color: var(--ink-2);
  font-weight: 600;
}

.steps__item.is-done {
  border-top-color: var(--on-goal);
  color: var(--ink);
}

.steps__item.is-current {
  border-top-color: var(--ink);
  color: var(--ink);
}

.steps__item small {
  color: var(--ink-2);
  font-weight: 400;
}

/* Timeline */
.timeline {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline__item {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: var(--space-3);
  padding-bottom: var(--space-4);
}

.timeline__item::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 30px;
  bottom: 0;
  width: 2px;
  background: var(--rule);
}

.timeline__item:last-child::before {
  display: none;
}

.timeline__head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  align-items: baseline;
}

.timeline__time {
  color: var(--ink-2);
}

.timeline__body {
  margin: var(--space-1) 0 0;
}

/* Definition list */
.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--space-2) var(--space-4);
  margin: 0;
}

.facts dt {
  color: var(--ink-2);
}

.facts dd {
  margin: 0;
  font-weight: 600;
}

/* Empty state */
.empty {
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  padding: var(--space-7) var(--space-4);
  color: var(--ink-2);
  text-align: center;
}

.empty__title {
  margin: 0;
  color: var(--ink);
  font-size: var(--text-control);
  font-weight: 700;
}

.empty p {
  margin: 0;
  max-width: 48ch;
}

/* Toasts */
.toasts {
  position: fixed;
  right: var(--space-5);
  bottom: var(--space-5);
  z-index: 200;
  display: grid;
  gap: var(--space-2);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 280px;
  max-width: 440px;
  padding: var(--space-3) var(--space-4);
  background: var(--action);
  color: var(--fg-on-action);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-menu);
  font-weight: 600;
  animation: toast-in 180ms ease-out;
}

.toast--error {
  background: var(--off-goal);
}

.toast__close {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: var(--text-section);
  cursor: pointer;
}

@keyframes toast-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}

/* Inline callout */
.callout {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-card);
  background: var(--info-tint);
  border: 1px solid color-mix(in srgb, var(--info) 25%, transparent);
}

.callout--warn {
  background: var(--watch-tint);
  border-color: color-mix(in srgb, var(--watch) 30%, transparent);
}

.callout--bad {
  background: var(--off-goal-tint);
  border-color: color-mix(in srgb, var(--off-goal) 30%, transparent);
}

.callout p {
  margin: 0;
}

/* Horizontal bar list (breakdowns, Pareto) */
.bars {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.bars__row {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr) 112px;
  gap: var(--space-3);
  align-items: center;
}

.bars__label {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bars__track {
  position: relative;
  height: 14px;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  border-radius: 999px;
  overflow: visible;
}

.bars__fill {
  height: 100%;
  border-radius: 999px;
  background: var(--status-ink, var(--ink-2));
}

.bars__mark {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  background: var(--ink);
}

.bars__value {
  font-family: var(--font-value);
  font-size: var(--text-control);
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Section nav for settings */
.side-nav {
  display: grid;
  gap: 2px;
  align-content: start;
}

.side-nav__link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-control);
  color: var(--ink-2);
  font-weight: 600;
  text-decoration: none;
}

.side-nav__link:hover {
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  color: var(--ink);
}

.side-nav__link[aria-current="page"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--rule);
}

.settings {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}

@media (max-width: 900px) {
  .settings {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Inline edit rows inside tables */
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.inline-form .input,
.inline-form .select {
  width: auto;
  min-width: 120px;
  min-height: 34px;
  font-size: var(--text-body);
}

details.disclose > summary {
  list-style: none;
  cursor: pointer;
}

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

/* Top bar (used when a page has no board context) */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-5);
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  min-height: 52px;
}

.topbar__crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
}

.topbar__crumbs li + li::before {
  content: "/";
  margin-right: var(--space-2);
  color: var(--rule);
}

.topbar__crumbs a {
  color: var(--ink-2);
  text-decoration: none;
}

.topbar__crumbs a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.rail {
  width: 80px;
  overflow-y: auto;
}

.rail__brand {
  color: var(--ink);
  text-decoration: none;
}

.rail__link {
  width: 64px;
  text-decoration: none;
  color: var(--ink-2);
}

.rail__foot {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-top: auto;
  padding-top: var(--space-3);
}

.sr-only--focusable:focus {
  position: fixed;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 300;
  width: auto;
  height: auto;
  clip: auto;
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border: 2px solid var(--focus);
}

/* Context bar */
.context-bar {
  padding: var(--space-2) var(--space-5);
  background: var(--surface-2);
}

.context-bar__form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-2) var(--space-4);
}

.ctx-field {
  display: grid;
  gap: 2px;
}

.ctx-field__label {
  color: var(--ink-2);
  font-size: var(--text-small);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ctx-field .select,
.ctx-field .input {
  min-height: 36px;
  width: auto;
  min-width: 150px;
  font-size: var(--text-body);
  padding: var(--space-1) var(--space-2);
}

.ctx-date {
  display: flex;
  gap: var(--space-1);
  align-items: center;
}

.ctx-date .input {
  min-width: 150px;
}

.ctx-date__step {
  min-height: 36px;
  width: 32px;
  padding: 0;
  font-size: var(--text-section);
  line-height: 1;
}

.segment__btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.ctx-field .segment__btn {
  min-height: 28px;
}

.segment--block {
  display: flex;
}

.segment--block .segment__btn {
  flex: 1 1 0;
  justify-content: center;
}

.rail__group {
  margin: var(--space-3) 0 var(--space-1);
  color: var(--ink-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

/* Entry */
.entry-pick {
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(240px, 1fr) auto minmax(220px, 1fr);
  gap: var(--space-4) var(--space-5);
  align-items: end;
  padding: var(--space-4) var(--space-5);
}

@media (max-width: 1200px) {
  .entry-pick {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.entry-pick__form,
.entry-pick__date {
  margin: 0;
}

.entry-pick__step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: var(--space-2);
  align-items: end;
}

.entry-pick__num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: 6px;
  border-radius: 50%;
  background: var(--action);
  color: var(--fg-on-action);
  font-weight: 700;
}

.entry-pick__static {
  margin: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--ink-2);
}

.select--lg {
  min-height: 44px;
  font-weight: 600;
}

.segment__hint {
  margin-left: var(--space-1);
  font-weight: 400;
  opacity: 0.75;
  font-size: var(--text-small);
}

.entry-pick .segment__btn {
  min-height: 34px;
}

.entry-pick__progress {
  display: grid;
  gap: var(--space-1);
}

.entry-pick__count {
  font-size: var(--text-control);
}

.entry-pick__count strong {
  font-family: var(--font-value);
  font-size: var(--text-section);
}

.entry-pick__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  min-height: 20px;
}

.meter {
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  overflow: hidden;
}

.meter > span {
  display: block;
  height: 100%;
  background: var(--on-goal);
  border-radius: 999px;
  transition: width 240ms ease;
}

.entry-form {
  display: grid;
  gap: var(--space-5);
  padding-bottom: 96px;
}

.entry-group {
  display: grid;
  gap: var(--space-3);
}

.entry-group__head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.entry-group__title {
  margin: 0;
  font-size: var(--text-section);
  font-weight: 700;
}

.mcards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-3);
}

.mcard {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--status-ink, var(--rule));
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  transition: border-color var(--motion), box-shadow var(--motion);
}

.mcard[data-status="not_entered"] {
  border-top-color: var(--rule);
}

.mcard:focus-within {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent), var(--shadow-card);
}

.mcard.is-dirty {
  background: color-mix(in srgb, var(--info) 3%, var(--surface));
}

.mcard.has-error {
  border-color: var(--off-goal);
}

.mcard.is-locked {
  background: var(--surface-2);
}

.mcard__head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: flex-start;
}

.mcard__name {
  margin: 0;
  font-size: var(--text-control);
  font-weight: 700;
}

.mcard__question {
  margin: 2px 0 0;
  color: var(--ink-2);
}

.mcard__status {
  flex-shrink: 0;
}

.mcard[data-status="not_entered"] .mcard__status {
  --status-ink: var(--ink-2);
  --status-tint: color-mix(in srgb, var(--ink) 7%, transparent);
}

.mcard[data-status="on_goal"] .mcard__status {
  --status-tint: var(--on-goal-tint);
}

.mcard[data-status="watch"] .mcard__status {
  --status-tint: var(--watch-tint);
}

.mcard[data-status="off_goal"] .mcard__status {
  --status-tint: var(--off-goal-tint);
}

.input--xl {
  min-height: 56px;
  font-size: var(--text-metric);
  font-weight: 700;
}

.unit-input {
  position: relative;
  display: block;
}

.unit-input[data-suffix]:not([data-suffix=""]):not([data-suffix="$"])::after {
  content: attr(data-suffix);
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-2);
  font-weight: 600;
  pointer-events: none;
}

.unit-input[data-suffix]:not([data-suffix=""]) .input {
  padding-right: 56px;
}

.unit-input[data-suffix="$"]::after {
  content: none;
}

.unit-input[data-suffix="$"]::before {
  content: "$";
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-2);
  font-weight: 600;
  font-size: var(--text-section);
}

.unit-input[data-suffix="$"] .input {
  padding-left: 32px;
  padding-right: var(--space-3);
}

.ratio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: var(--space-1) var(--space-2);
  align-items: end;
}

.ratio__of {
  padding-bottom: 12px;
  color: var(--ink-2);
}

.ratio__result {
  grid-column: 1 / -1;
  min-height: 24px;
  font-family: var(--font-value);
  font-size: var(--text-section);
  font-weight: 700;
  color: var(--status-ink, var(--ink));
}

.passfail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.passfail__opt {
  position: relative;
  cursor: pointer;
}

.passfail__opt input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.passfail__opt span {
  display: grid;
  place-items: center;
  min-height: 56px;
  border: 2px solid color-mix(in srgb, var(--ink) 18%, var(--rule));
  border-radius: var(--radius-control);
  font-size: var(--text-section);
  font-weight: 700;
  color: var(--ink-2);
  transition: all var(--motion);
}

.passfail__opt input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.passfail__opt--pass input:checked + span {
  background: var(--on-goal);
  border-color: var(--on-goal);
  color: var(--fg-on-action);
}

.passfail__opt--fail input:checked + span {
  background: var(--off-goal);
  border-color: var(--off-goal);
  color: var(--fg-on-action);
}

.passfail__opt input:disabled + span {
  cursor: not-allowed;
  opacity: 0.7;
}

.mcard__facts {
  display: grid;
  grid-template-columns: auto auto minmax(80px, 1fr);
  gap: var(--space-3);
  align-items: center;
  margin: 0;
  padding-top: var(--space-2);
  border-top: 1px dashed var(--rule);
}

.mcard__facts dt {
  color: var(--ink-2);
  font-size: var(--text-small);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mcard__facts dd {
  margin: 0;
  font-weight: 600;
  white-space: nowrap;
}

.mcard__spark {
  justify-self: stretch;
}

.spark {
  display: block;
  width: 100%;
  height: 28px;
  overflow: visible;
}

.spark--empty {
  display: block;
  text-align: right;
  font-size: var(--text-small);
  height: auto;
}

.spark__line {
  fill: none;
  stroke: color-mix(in srgb, var(--ink) 35%, transparent);
  stroke-width: 1.5;
}

.spark__target {
  stroke: var(--ink);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0.6;
}

.spark__dot {
  stroke: var(--status-ink, var(--ink-2));
  stroke-width: 6;
  stroke-linecap: round;
}

.mcard__error {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  background: var(--off-goal-tint);
  color: var(--off-goal);
  border-radius: var(--radius-control);
  font-weight: 600;
}

.mcard__problem {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--off-goal-tint);
  border: 1px solid color-mix(in srgb, var(--off-goal) 25%, transparent);
  border-radius: var(--radius-control);
}

.mcard__problem[hidden] {
  display: none;
}

.mcard__card {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-control);
  background: var(--surface-2);
  border: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
}

.mcard__card:hover {
  border-color: var(--ink-2);
}

.mcard__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-1) var(--space-3);
  color: var(--ink-2);
  font-size: var(--text-small);
}

.mcard__lock {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-weight: 600;
}

.mcard__lock svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.savebar {
  position: fixed;
  left: 80px;
  right: 0;
  bottom: 0;
  z-index: 50;
  padding: var(--space-3) var(--space-5);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--rule);
  box-shadow: 0 -4px 16px rgba(20, 24, 31, 0.06);
}

.savebar__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  max-width: 1440px;
  margin: 0 auto;
}

.savebar__text {
  display: grid;
}

.savebar.is-dirty [data-dirty-count] {
  color: var(--focus);
}

.kbd-hint {
  padding: 1px 6px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--surface) 20%, transparent);
  font-family: var(--font-text);
  font-size: var(--text-small);
  font-weight: 600;
}

body:has(.savebar) .toasts {
  bottom: 96px;
}

/* Story chart additions */
.story__event {
  fill: color-mix(in srgb, var(--off-goal) 10%, transparent);
}

.story__dates {
  position: relative;
  height: 18px;
  margin-top: var(--space-1);
  color: var(--ink-2);
  font-size: var(--text-small);
}

.story__dates span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}

.story__dates span:first-child { transform: none; }
.story__dates span:last-child { transform: translateX(-100%); }

/* Section heading between panels */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin: 0 0 var(--space-3);
}

.section-head__title {
  margin: 0;
  font-size: var(--text-section);
}

.insight {
  margin: 0 0 var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-left: 3px solid var(--ink);
  background: var(--surface-2);
  font-weight: 600;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: var(--text-small);
  font-weight: 700;
  color: var(--status-ink, var(--ink-2));
  background: color-mix(in srgb, var(--status-ink, var(--ink-2)) 12%, transparent);
}

.status-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.pillar-chip--lg {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 22px;
  vertical-align: -6px;
}

/* Pillar drill hero */
.pillar-hero {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: var(--space-5);
  padding: var(--space-5);
  align-items: start;
}

.pillar-hero__wheel {
  display: grid;
  justify-items: center;
  gap: var(--space-2);
}

.pillar-hero__wheel svg {
  width: 100%;
  max-width: 280px;
  height: auto;
}

.pillar-hero__legend {
  margin: 0;
  text-align: center;
  font-size: var(--text-small);
}

.pillar-hero__story {
  min-width: 0;
}

.pillar-hero__headline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.pillar-hero__value {
  margin: 2px 0;
  font-family: var(--font-value);
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  color: var(--status-ink, var(--ink));
}

@media (max-width: 900px) {
  .pillar-hero { grid-template-columns: 1fr; }
}

/* Metric tiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-3);
}

.tile {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--status-ink, var(--rule));
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  color: inherit;
  text-decoration: none;
  transition: border-color var(--motion), transform var(--motion);
}

.tile:hover {
  border-color: var(--ink-2);
  border-top-color: var(--status-ink, var(--ink-2));
  transform: translateY(-1px);
}

.tile__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-2);
}

.tile__name {
  font-weight: 700;
}

.tile__badge {
  flex-shrink: 0;
  color: var(--status-ink, var(--ink-2));
  background: color-mix(in srgb, var(--status-ink, var(--ink-2)) 12%, transparent);
}

.tile__value {
  font-family: var(--font-value);
  font-size: var(--text-metric);
  font-weight: 700;
  line-height: 1.1;
}

.tile__meta,
.tile__foot {
  color: var(--ink-2);
  font-size: var(--text-small);
}

.tile__spark {
  height: 36px;
  margin: var(--space-1) 0;
}

.tile__spark .spark {
  width: 100%;
  height: 36px;
}

.tile__foot {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--rule);
}

/* Yes / No verdict for effectiveness check */
.verdict {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.verdict__opt {
  position: relative;
  display: grid;
  gap: 2px;
  padding: var(--space-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-control);
  background: var(--surface);
  cursor: pointer;
}

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

.verdict__opt strong { font-size: var(--text-control); }
.verdict__opt span { color: var(--ink-2); font-size: var(--text-small); }

.verdict__opt:has(input:checked) {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.verdict__opt--yes:has(input:checked) { border-color: var(--on-goal); box-shadow: inset 0 0 0 1px var(--on-goal); background: var(--on-goal-tint); }
.verdict__opt--no:has(input:checked) { border-color: var(--off-goal); box-shadow: inset 0 0 0 1px var(--off-goal); background: var(--off-goal-tint); }

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

/* Segmented radio choice */
.choice {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--rule);
  border-radius: var(--radius-control);
  overflow: hidden;
  background: var(--surface);
}

.choice__opt {
  position: relative;
  padding: 7px 14px;
  font-weight: 600;
  cursor: pointer;
  border-right: 1px solid var(--rule);
  user-select: none;
}

.choice__opt:last-child { border-right: 0; }

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

.choice__opt:has(input:checked) {
  background: var(--action);
  color: var(--fg-on-action);
}

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

/* 5-why */
.whys {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.whys__row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: var(--space-2);
  align-items: center;
}

.whys__label {
  font-weight: 700;
  color: var(--ink-2);
  font-size: var(--text-small);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.whys--read .whys__row {
  align-items: start;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--rule);
}

.whys--read .whys__row:last-child { border-bottom: 0; }

.step-num {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: var(--space-2);
  border-radius: 50%;
  background: var(--action);
  color: var(--fg-on-action);
  font-size: var(--text-small);
  font-weight: 700;
  vertical-align: 1px;
}

.step-num.is-done {
  background: var(--on-goal);
}

.quick-action {
  padding: var(--space-4);
  border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
}

.quick-action__grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(160px, 1fr) 150px 130px;
  gap: var(--space-3);
  align-items: end;
}

@media (max-width: 900px) {
  .quick-action__grid { grid-template-columns: 1fr 1fr; }
}

/* Report center */
.report-types {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
}

.report-type {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-card);
}

.report-type:hover { border-color: var(--ink-2); }

.report-type[aria-current="page"] {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink), var(--shadow-card);
}

.report-type__name { font-weight: 700; font-size: var(--text-control); }
.report-type__desc { color: var(--ink-2); font-size: var(--text-small); }

.report-sheet__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 2px solid var(--ink);
}

.report-sheet__title { margin: 0; font-size: var(--text-section); }

.report-sheet__body {
  padding: var(--space-4) var(--space-5) var(--space-5);
  overflow-x: auto;
}

.rpt h2 {
  margin: var(--space-5) 0 var(--space-2);
  font-size: var(--text-small);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-2);
}

.rpt-table { width: 100%; border-collapse: collapse; }
.rpt-table th { text-align: left; font-size: var(--text-small); color: var(--ink-2); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.rpt-table td { padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.rpt-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rpt-table a { color: inherit; font-weight: 600; }

.rpt-kpis { width: 100%; border-collapse: separate; border-spacing: var(--space-3) 0; margin: 0 calc(-1 * var(--space-3)) var(--space-3); }
.rpt-kpis td { border: 1px solid var(--rule); border-left-width: 4px; border-radius: var(--radius-control); padding: var(--space-2) var(--space-3); vertical-align: top; }
.rpt-kpis span { display: block; font-size: var(--text-small); color: var(--ink-2); }
.rpt-kpis b { display: block; font-family: var(--font-value); font-size: 24px; line-height: 1.2; }

.rpt .muted { color: var(--ink-2); }
.rpt .s-on_goal { color: var(--on-goal); }
.rpt .s-watch { color: var(--watch); }
.rpt .s-off_goal { color: var(--off-goal); }
.rpt .s-not_entered, .rpt .s-no_production { color: var(--not-entered); }
.rpt .b-on_goal { border-left-color: var(--on-goal); }
.rpt .b-watch { border-left-color: var(--watch); }
.rpt .b-off_goal { border-left-color: var(--off-goal); }

.rpt-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.rpt-dot.on_goal { background: var(--on-goal); }
.rpt-dot.watch { background: var(--watch); }
.rpt-dot.off_goal { background: var(--off-goal); }
.rpt-dot.not_entered { background: var(--not-entered); }
.rpt-dot.no_production { background: var(--bg-muted); border: 1px solid var(--border); }

.rpt-grid { border-collapse: separate; border-spacing: 2px; width: 100%; }
.rpt-grid th { font-size: 11px; color: var(--ink-2); font-weight: 600; text-align: center; padding: 2px; }
.rpt-grid th.name, .rpt-grid td.name { text-align: left; white-space: nowrap; padding-right: var(--space-3); }
.rpt-grid td { text-align: center; font-size: 11px; }
.rpt-grid td.name { font-size: var(--text-body); }
.rpt-grid td.name a { color: inherit; }
.rpt-grid .num { text-align: right; white-space: nowrap; padding-left: var(--space-2); }

.rpt-cell { display: block; min-width: 18px; height: 22px; line-height: 22px; border-radius: 3px; color: var(--fg-on-action); font-size: 10px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rpt-cell.on_goal { background: var(--on-goal); }
.rpt-cell.watch { background: var(--watch); color: var(--fg-on-inverse); }
.rpt-cell.off_goal { background: var(--off-goal); }
.rpt-cell.not_entered { background: var(--bg-muted); color: var(--not-entered); }
.rpt-cell.no_production { background: var(--bg-elevated); color: var(--fg-subtle); }
.rpt-table .rpt-cell { height: 14px; }

.rpt-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: var(--text-small); font-weight: 600; background: var(--bg-muted); color: var(--fg); white-space: nowrap; }
.rpt-pill.bad { background: var(--off-goal-tint); color: var(--off-goal); }
.rpt-pill.good { background: var(--on-goal-tint); color: var(--on-goal); }
.rpt-pill.warn { background: var(--watch-tint); color: var(--watch); }
.rpt-pill.info { background: var(--info-tint); color: var(--info); }

.rpt-empty { padding: var(--space-3); color: var(--ink-2); border: 1px dashed var(--rule); border-radius: var(--radius-control); }

/* Settings */
.side-nav__link--stacked {
  align-items: flex-start;
}

.side-nav__label {
  display: block;
}

.side-nav__desc {
  display: block;
  margin-top: 1px;
  font-size: var(--text-small);
  font-weight: 400;
  color: var(--ink-2);
}

.side-nav__extra {
  display: grid;
  gap: 2px;
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--rule);
}

.side-nav__extra .side-nav__link {
  font-weight: 500;
  font-size: var(--text-small);
}

.spacer {
  flex: 1 1 auto;
}

.is-inactive > td,
.panel.is-inactive {
  opacity: .6;
}

.edit-row > td {
  background: var(--surface-2);
  padding: var(--space-4);
  box-shadow: inset 3px 0 0 var(--ink);
}

.edit-block {
  background: var(--surface-2);
  border-bottom: 1px solid var(--rule);
}

.table__group > td {
  padding-top: var(--space-4);
  background: var(--surface-2);
  font-weight: 700;
  font-size: var(--text-small);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-2);
}

.table__group .pillar-chip {
  width: 20px;
  height: 20px;
  font-size: var(--text-small);
  margin-right: 4px;
}

.choice.is-disabled {
  opacity: .65;
}

.choice.is-disabled .choice__opt {
  cursor: not-allowed;
}

/* Metric library */
.preset {
  display: grid;
  gap: var(--space-2);
  align-content: start;
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.preset.is-adopted {
  background: var(--surface-2);
}

.preset__question {
  margin: 0;
  color: var(--ink-2);
}

.preset__facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2) var(--space-3);
  margin: var(--space-1) 0 0;
}

.preset__facts dt {
  font-size: var(--text-small);
  color: var(--ink-2);
}

.preset__facts dd {
  margin: 0;
  font-weight: 600;
}

.preset__foot {
  display: flex;
  justify-content: flex-end;
  padding-top: var(--space-2);
  border-top: 1px solid var(--rule);
}

.mono,
.code-sample {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.code-sample {
  margin: var(--space-2) 0 0;
  padding: var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-control);
  overflow-x: auto;
}

/* Stacked link list inside a panel */
.link-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.link-list li + li {
  border-top: 1px solid var(--rule);
}

.link-list a {
  display: grid;
  gap: 2px;
  padding: var(--space-3) var(--space-4);
  color: inherit;
  text-decoration: none;
}

.link-list a:hover {
  background: var(--surface-2);
}

.table th.num {
  font-family: inherit;
  font-size: inherit;
}

[hidden] {
  display: none !important;
}

.verdict__opt > span {
  display: grid;
  gap: 2px;
  color: var(--ink-2);
  font-size: var(--text-small);
}

.verdict__opt > span strong {
  color: var(--ink);
  font-size: var(--text-control);
}

/* Icons */
.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--sm {
  width: 15px;
  height: 15px;
}

.btn .icon {
  margin-left: -2px;
}

.btn--danger:hover {
  background: color-mix(in srgb, var(--off-goal) 85%, var(--ink));
}

.btn--danger-ghost {
  background: transparent;
  border-color: color-mix(in srgb, var(--off-goal) 35%, var(--rule));
  color: var(--off-goal);
}

.btn--danger-ghost:hover {
  background: var(--off-goal-tint);
  border-color: var(--off-goal);
}

/* Icon-only buttons in table rows and cards. Each has a title and aria-label. */
.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  justify-content: flex-end;
}

.row-actions form {
  display: inline-flex;
  margin: 0;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--motion), color var(--motion), border-color var(--motion);
}

.icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--rule);
  color: var(--ink);
}

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

.icon-btn--danger:hover {
  background: var(--off-goal-tint);
  border-color: color-mix(in srgb, var(--off-goal) 35%, var(--rule));
  color: var(--off-goal);
}

.icon-btn--good:hover {
  background: var(--on-goal-tint);
  border-color: color-mix(in srgb, var(--on-goal) 35%, var(--rule));
  color: var(--on-goal);
}

.icon-btn[aria-expanded="true"] {
  background: var(--info-tint);
  color: var(--focus);
}

.table td.actions-cell,
.table th.actions-cell {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

/* Confirmation modal */
body.has-modal {
  overflow: hidden;
}

.dialog.confirm {
  width: min(460px, 100%);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-4);
  padding: var(--space-5);
  animation: confirm-in 140ms ease-out;
}

@keyframes confirm-in {
  from { transform: translateY(6px) scale(.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.confirm__icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--off-goal-tint);
  color: var(--off-goal);
}

.confirm__icon .icon {
  width: 22px;
  height: 22px;
}

.confirm[data-tone="primary"] .confirm__icon {
  background: var(--info-tint);
  color: var(--info);
}

.confirm__text .dialog__title {
  margin: 2px 0 var(--space-2);
  font-size: 18px;
}

.confirm__body {
  margin: 0;
  color: var(--ink-2);
  line-height: 1.5;
}

.confirm__note {
  margin: var(--space-3) 0 0;
  font-size: var(--text-small);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.confirm__actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding-top: var(--space-4);
  border-top: 1px solid var(--rule);
}

/* Danger zone at the foot of a record page */
.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border: 1px solid color-mix(in srgb, var(--off-goal) 30%, var(--rule));
  border-radius: var(--radius-card);
  background: color-mix(in srgb, var(--off-goal) 3%, var(--surface));
}

.danger-zone__title {
  margin: 0;
  font-weight: 700;
}

.danger-zone__sub {
  margin: 2px 0 0;
  color: var(--ink-2);
  font-size: var(--text-small);
}

/* Audit log and activity timelines */
.audit-verb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.trail {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.trail::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--rule);
}

.trail__item {
  position: relative;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: var(--space-3);
  padding: var(--space-2) 0 var(--space-3);
}

.trail__dot {
  position: relative;
  z-index: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 2px solid var(--rule);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-2);
}

.trail__dot[data-tone="good"] { border-color: var(--on-goal); color: var(--on-goal); }
.trail__dot[data-tone="bad"] { border-color: var(--off-goal); color: var(--off-goal); }
.trail__dot[data-tone="warn"] { border-color: var(--watch); color: var(--watch); }
.trail__dot[data-tone="info"] { border-color: var(--info); color: var(--info); }

.trail__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px var(--space-2);
}

.trail__when {
  color: var(--ink-2);
  font-size: var(--text-small);
  margin-left: auto;
  white-space: nowrap;
}

.trail__summary {
  margin: 2px 0 0;
  color: var(--ink-2);
}

.changes {
  margin: var(--space-2) 0 0;
  padding: var(--space-2) var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-control);
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px var(--space-3);
  font-size: 13px;
}

.changes dt {
  color: var(--ink-2);
  font-weight: 600;
}

.changes dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.changes del {
  color: var(--off-goal);
  text-decoration-color: color-mix(in srgb, var(--off-goal) 60%, transparent);
}

.changes ins {
  color: var(--on-goal);
  text-decoration: none;
  font-weight: 600;
}

.changes__arrow {
  color: var(--ink-2);
  margin: 0 4px;
}

details.audit-row > summary {
  list-style: none;
  cursor: pointer;
}

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

.audit-row__toggle {
  color: var(--focus);
  font-size: var(--text-small);
  font-weight: 600;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: var(--text-small);
}
.panel__title:has(> .icon) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.panel__title > .icon {
  color: var(--ink-2);
}

.page-head__actions form {
  display: inline-flex;
  margin: 0;
}

/* Board dashboard: summary, wheels, action list, two-lane handover */
.dash {
  display: grid;
  gap: var(--space-5);
  min-width: 0;
}

.dash__head {
  margin-bottom: 0;
}

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

@media (max-width: 1100px) {
  .dash__kpis {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }
}

.kpi__of {
  font-size: 18px;
  color: var(--ink-2);
  font-weight: 600;
}

.dash__section {
  display: grid;
  gap: var(--space-3);
  min-width: 0;
}

.dash__section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
}

.dash__section-title {
  margin: 0;
  font-size: var(--text-section);
}

.dash__section-head .board__keys {
  margin: 0;
}

.dash .wheel-wall {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

@media (max-width: 1360px) {
  .dash .wheel-wall {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .dash .wheel-wall {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.dash__split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: var(--space-4);
  align-items: start;
}

@media (max-width: 1180px) {
  .dash__split {
    grid-template-columns: minmax(0, 1fr);
  }
}

.dash__tabs {
  padding: 0 var(--space-4);
}

.tabs__count[data-tone="bad"] {
  background: var(--off-goal);
  color: var(--fg-on-action);
}

.dash__actions td {
  vertical-align: middle;
}

.dash__actions .table__title {
  display: block;
  max-width: 46ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pillar-chip--xs {
  width: 18px;
  height: 18px;
  font-size: 10px;
  vertical-align: 1px;
}

.prio {
  font-weight: 700;
}

.prio--high { color: var(--off-goal); }
.prio--medium { color: var(--watch); }
.prio--low { color: var(--ink-2); }

.table__sub.is-late {
  color: var(--off-goal);
  font-weight: 700;
}

.dash__more {
  color: var(--ink-2);
  font-size: var(--text-small);
}

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

.decision {
  display: grid;
  gap: 2px;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--rule);
  color: inherit;
  text-decoration: none;
  border-left: 3px solid var(--off-goal);
}

.decision-list li:first-child .decision {
  border-top: 0;
}

.decision:hover {
  background: var(--surface-2);
}

.decision__meta {
  font-size: var(--text-small);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.decision__body {
  font-weight: 600;
}

.decision__metric {
  font-size: var(--text-small);
  color: var(--ink-2);
}

.handover-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  align-items: stretch;
}

@media (max-width: 900px) {
  .handover-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.handover-lane {
  display: flex;
  flex-direction: column;
}

.handover-lane__title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.handover-lane__title .icon {
  margin: 0;
}

.hnotes {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

.hnote {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: start;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--rule);
  border-left: 3px solid var(--rule);
}

.hnotes .hnote:first-child {
  border-top: 0;
}

.hnote[data-kind="problem"] { border-left-color: var(--off-goal); }
.hnote[data-kind="watch_out"] { border-left-color: var(--watch); }
.hnote[data-kind="information"] { border-left-color: var(--info); }

.hnote__meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px var(--space-2);
  font-size: var(--text-small);
}

.hnote__kind {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: 11px;
}

.hnote[data-kind="problem"] .hnote__kind { color: var(--off-goal); }
.hnote[data-kind="watch_out"] .hnote__kind { color: var(--watch); }
.hnote[data-kind="information"] .hnote__kind { color: var(--info); }

.hnote__body {
  margin: 4px 0 0;
  line-height: 1.45;
}

.hnote__actions {
  margin: 0;
}

.handover-lane__form {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4) var(--space-4);
  border-top: 1px solid var(--rule);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
}

.handover-lane__form .textarea {
  min-height: 0;
  resize: vertical;
}

.handover-lane__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.choice--sm .choice__opt {
  padding: 4px 10px;
  font-size: 13px;
}

.empty--compact {
  padding: var(--space-4);
  flex: 1;
}

.empty--compact p {
  margin: 0;
}

body.tv-mode .dash__split,
body.tv-mode .handover-grid {
  gap: var(--space-3);
}
