/* Plant SQCDPI — component styles (tokens from tokens.css only) */

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

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--text-body);
  line-height: 1.45;
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--focus);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

:focus {
  outline: none;
}

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

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

/* Status vocabulary */
[data-status="on_goal"],
.status--on_goal {
  --status-ink: var(--on-goal);
  --status-tint: var(--on-goal-tint);
}

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

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

[data-status="not_entered"],
.status--not_entered {
  --status-ink: var(--not-entered);
  --status-tint: var(--not-entered-tint);
}

[data-status="no_production"],
.status--no_production {
  --status-ink: var(--not-entered);
  --status-tint: color-mix(in srgb, var(--not-entered) 6%, transparent);
}

.font-value {
  font-family: var(--font-value);
  font-variant-numeric: tabular-nums;
}

/* Layout shell */
.layout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);
  grid-template-areas:
    "rail context"
    "rail breadcrumb"
    "rail main";
  min-height: 100dvh;
}

.layout__rail {
  grid-area: rail;
}

.layout__context {
  grid-area: context;
}

.layout__breadcrumb {
  grid-area: breadcrumb;
}

.layout__main {
  grid-area: main;
  min-width: 0;
  padding: var(--space-4) var(--space-5) var(--space-6);
}

/* Rail */
.rail {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  width: 72px;
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: var(--space-4) var(--space-2);
  background: var(--surface);
  border-right: 1px solid var(--rule);
}

.rail__brand {
  display: grid;
  place-items: center;
  gap: 3px;
  font-family: var(--font-value);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--fg);
  margin-bottom: var(--space-3);
}

.rail__brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: block;
}

.rail__link {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  width: 56px;
  height: 52px;
  margin: 0 auto;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-control);
  color: var(--ink-2);
  text-decoration: none;
  transition: background var(--motion), color var(--motion);
}

.rail__link:hover {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  color: var(--ink);
}

.rail__link[aria-current="page"] {
  background: color-mix(in srgb, var(--focus) 12%, transparent);
  color: var(--focus);
  font-weight: 600;
}

.rail__icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rail__key {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1.7px solid currentColor;
  border-radius: var(--radius-control);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.rail__label {
  line-height: 1;
}

/* Context bar */
.context-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 20;
}

.context-bar__title {
  margin: 0;
  font-size: var(--text-section);
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 12rem;
}

.context-bar__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.segment {
  display: inline-flex;
  padding: var(--space-1);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 999px;
  gap: var(--space-1);
}

.segment__btn {
  min-height: 36px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: var(--text-body);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--motion), color var(--motion);
}

.segment__btn[aria-pressed="true"] {
  background: var(--action);
  color: var(--fg-on-action);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: var(--context-bar-height, 52px);
  z-index: 10;
}

.breadcrumb__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

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

.breadcrumb__item:not(:last-child)::after {
  content: "/";
  color: var(--rule);
}

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

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

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

/* Cards & surfaces */
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  padding: var(--space-4);
  box-shadow: var(--shadow-menu);
}

.card + .card {
  margin-top: var(--space-4);
}

.section-title {
  margin: 0 0 var(--space-3);
  font-size: var(--text-section);
  font-weight: 600;
}

/* Board: wheel wall plus handover column */
.board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--space-4);
  align-items: start;
}

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

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

.board__legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-5);
  padding: var(--space-2) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
}

.board__window {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  margin: 0;
  color: var(--ink-2);
}

.board__window strong {
  color: var(--ink);
}

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

.board__keys .status-mark {
  font-weight: 500;
  color: var(--ink-2);
}

.board__key-today {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--ink-2);
}

.board__today-mark {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 8px solid var(--ink);
}

/* Six pillar cards share row tracks so every part lines up across cards. */
.wheel-wall {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: auto;
  column-gap: var(--space-3);
  row-gap: var(--space-3);
}

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

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

.pillar-card {
  grid-row: span 5;
  display: grid;
  grid-template-rows: subgrid;
  row-gap: var(--space-3);
  min-width: 0;
  padding: var(--space-3) var(--space-4) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--status-ink, var(--rule));
  border-radius: var(--radius-card);
}

.pillar-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 24px;
}

.pillar-card__name {
  color: var(--ink);
  font-size: var(--text-control);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pillar-card__name:hover {
  text-decoration: underline;
}

.pillar-card__head .status-mark {
  flex-shrink: 0;
  white-space: nowrap;
  font-size: var(--text-body);
}

.pillar-card__wheel {
  display: grid;
  place-items: center;
}

.pillar-card__headline {
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: start;
  gap: 2px;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-control);
}

.pillar-card__headline:hover .pillar-card__value {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

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

.pillar-card__value {
  font-size: var(--text-metric);
  font-weight: 700;
  line-height: 1.05;
  white-space: nowrap;
}

.pillar-card__target {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-2);
  min-height: 2.9em;
  align-content: start;
  color: var(--ink-2);
  font-size: var(--text-body);
}

.pillar-card__gap {
  color: var(--status-ink, var(--ink-2));
  font-weight: 600;
}

.pillar-card__gap[data-status="on_goal"] {
  color: var(--ink-2);
  font-weight: 500;
}

.pillar-card__foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-self: end;
  padding-top: var(--space-3);
  border-top: 1px solid var(--rule);
}

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-2);
  font-size: var(--text-body);
  text-decoration: none;
  white-space: nowrap;
}

.chip:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}

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

.chip--alert {
  background: var(--off-goal-tint);
  color: var(--off-goal);
}

.chip--alert .chip__count {
  color: var(--off-goal);
}

.chip--quiet {
  opacity: 0.7;
}

/* Pillar wheel */
.wheel {
  width: 100%;
  max-width: 260px;
  margin: 0;
}

.wheel__svg {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  overflow: visible;
}

.wheel__seg {
  fill: var(--status-ink);
  transition: opacity var(--motion);
}

.wheel__seg[data-status="not_entered"] {
  fill: var(--surface);
  stroke: var(--not-entered);
  stroke-width: 0.45;
}

.wheel__seg[data-status="no_production"] {
  stroke: var(--not-entered);
  stroke-width: 0.3;
}

.wheel__seg--unowned {
  stroke: var(--ink);
  stroke-width: 0.8;
}

.wheel__link:hover .wheel__seg,
.wheel__link:focus-visible .wheel__seg {
  opacity: 0.7;
}

.wheel__link:focus-visible {
  outline: none;
}

.wheel__period {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.1;
  stroke-linecap: round;
}

.wheel__today {
  fill: var(--ink);
}

.wheel__hub {
  fill: var(--status-tint, var(--paper));
}

.wheel__letter {
  fill: var(--status-ink, var(--ink));
  font-family: var(--font-value);
  font-size: 26px;
  font-weight: 700;
  text-anchor: middle;
}

/* Story chart: one fixed frame for every chart type */
.story {
  display: grid;
  grid-template-rows: 2.9em auto;
  gap: var(--space-1);
  margin: 0;
}

.story__caption {
  color: var(--ink-2);
  font-size: var(--text-body);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.story__frame {
  position: relative;
  height: 72px;
}

.story__frame--tall {
  height: 160px;
}

.story__svg,
.story__cross {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.story__axis {
  stroke: var(--rule);
  stroke-width: 1;
}

.story__band {
  fill: var(--watch-tint);
}

.story__target {
  stroke: var(--ink-2);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}

.story__target-label {
  position: absolute;
  right: 0;
  transform: translateY(-100%);
  padding: 0 2px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--text-body);
  line-height: 1.1;
  white-space: nowrap;
  pointer-events: none;
}

.story__target-label.is-below {
  transform: translateY(2px);
}

.story__line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.story__dot,
.story__last {
  stroke: var(--status-ink, var(--ink));
  stroke-width: 5;
  stroke-linecap: round;
}

.story__last {
  stroke-width: 7;
}

.story__bar {
  fill: var(--status-ink, var(--not-entered));
}

.story__bar[data-status="on_goal"] {
  fill: color-mix(in srgb, var(--on-goal) 55%, var(--surface));
}

.story__cell {
  fill: var(--status-ink);
}

.story__cell[data-status="not_entered"] {
  fill: var(--surface);
  stroke: var(--not-entered);
  stroke-width: 0.6;
}

.story__empty {
  display: grid;
  place-items: center;
  height: 100%;
  margin: 0;
  color: var(--ink-2);
  border-bottom: 1px solid var(--rule);
}

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

.point > .card + .card {
  margin-top: 0;
}

.point__head {
  display: grid;
  gap: var(--space-2);
}

.point__figure {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
}

.metric-trend {
  padding-top: var(--space-2);
}

/* Callouts used by detail screens */
.handover-note {
  padding: var(--space-2) var(--space-3);
  border-left: 3px solid var(--watch);
  background: var(--watch-tint);
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  margin: 0 0 var(--space-2);
}

.handover-note--problem {
  border-left-color: var(--off-goal);
  background: var(--off-goal-tint);
}

.handover-note__meta {
  color: var(--ink-2);
  margin-bottom: var(--space-1);
}

.handover-lane {
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
}

.handover-lane__title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-body);
  font-weight: 700;
}

/* Handover column */
.handover {
  display: grid;
  gap: var(--space-3);
  align-content: start;
}

.handover__title {
  margin: 0;
  padding: var(--space-2) 0 0;
  font-size: var(--text-control);
  font-weight: 700;
}

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

.handover__lane-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
}

.handover__lane-head h3 {
  margin: 0;
  font-size: var(--text-body);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.handover__count,
.handover__ack {
  color: var(--ink-2);
  font-size: var(--text-body);
}

.handover__ack {
  color: var(--on-goal);
  font-weight: 600;
}

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

.handover__notes {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.note {
  display: block;
  padding: var(--space-2) var(--space-3);
  border-left: 3px solid var(--not-entered);
  background: var(--paper);
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  color: inherit;
  text-decoration: none;
}

.note[data-kind="problem"] {
  border-left-color: var(--off-goal);
  background: var(--off-goal-tint);
}

.note[data-kind="watch_out"] {
  border-left-color: var(--watch);
  background: var(--watch-tint);
}

.note--link:hover .note__body {
  text-decoration: underline;
}

.note__meta {
  display: flex;
  gap: var(--space-2);
  color: var(--ink-2);
  font-size: var(--text-body);
}

.note__kind {
  font-weight: 700;
  color: var(--ink);
}

.note__time {
  margin-left: auto;
}

.note__body {
  margin: 2px 0 0;
}

.note__author {
  margin: 2px 0 0;
  color: var(--ink-2);
  font-size: var(--text-body);
}

.handover__add summary {
  cursor: pointer;
  color: var(--focus);
  font-weight: 600;
  list-style: none;
}

.handover__add summary::before {
  content: "+ ";
}

.handover__form {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.handover__form .textarea {
  min-height: 64px;
}

/* Status marks */
.status-mark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  color: var(--status-ink, var(--ink));
}

.status-mark__shape {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.status-mark--on_goal .status-mark__shape {
  border-radius: 50%;
  background: var(--on-goal);
}

.status-mark--watch .status-mark__shape {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 11px solid var(--watch);
  background: none;
}

.status-mark--off_goal .status-mark__shape {
  border-radius: var(--radius-control);
  background: var(--off-goal);
}

.status-mark--not_entered .status-mark__shape {
  border-radius: 50%;
  border: 2px solid var(--not-entered);
  background: transparent;
}

.status-mark--no_production .status-mark__shape {
  border-radius: var(--radius-control);
  background: repeating-linear-gradient(
    -45deg,
    var(--not-entered),
    var(--not-entered) 2px,
    transparent 2px,
    transparent 4px
  );
}

/* Metric value blocks */
.metric-value {
  font-family: var(--font-value);
  font-size: var(--text-metric);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
}

.metric-value--headline {
  font-size: var(--text-headline);
}

.target-gap {
  color: var(--ink-2);
  font-size: var(--text-body);
}

/* Entry sheet */
.entry-sheet {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.entry-sheet__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  color: var(--ink-2);
}

.entry-sheet__table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.entry-sheet__table th,
.entry-sheet__table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}

.entry-sheet__table th {
  background: var(--paper);
  font-weight: 600;
  color: var(--ink-2);
}

.entry-sheet__table tr:last-child td {
  border-bottom: 0;
}

.entry-sheet__row[data-can-write="false"] .entry-field {
  opacity: 0.65;
  pointer-events: none;
}

.entry-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.entry-field__preview {
  min-height: 1.25rem;
}

.entry-field__preview[data-status] {
  color: var(--status-ink, var(--ink-2));
  font-weight: 600;
}

/* Forms */
.form-grid {
  display: grid;
  gap: var(--space-4);
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.form-row label {
  font-weight: 600;
  color: var(--ink-2);
}

.input,
.select,
.textarea {
  min-height: 40px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-control);
  background: var(--bg-elevated);
  color: var(--fg);
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

.ratio-field {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-2);
  align-items: center;
}

.pass-fail-field {
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: var(--radius-control);
  overflow: hidden;
}

.pass-fail-field__btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 var(--space-3);
  border: 0;
  background: var(--surface);
  cursor: pointer;
}

.pass-fail-field__btn[aria-pressed="true"] {
  background: var(--action);
  color: var(--fg-on-action);
}

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

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

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

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

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

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

/* Action rows */
.action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-3);
  padding: var(--space-3);
  border-bottom: 1px solid var(--rule);
}

.action-row:last-child {
  border-bottom: 0;
}

.action-row__title {
  font-weight: 600;
}

.action-row__meta {
  color: var(--ink-2);
  font-size: var(--text-body);
}

.tag {
  display: inline-block;
  padding: 2px var(--space-2);
  border-radius: 999px;
  font-size: var(--text-body);
  font-weight: 600;
  background: var(--status-tint, var(--paper));
  color: var(--status-ink, var(--ink-2));
}

.tag--overdue {
  --status-ink: var(--off-goal);
  --status-tint: var(--off-goal-tint);
}

/* Signed-out auth — SF startup two-column stage (NYRO Dynamics LTD) */
.layout-guest {
  min-height: 100dvh;
  margin: 0;
  color: var(--fg);
  font-family: var(--font-text);
  font-size: var(--text-body);
  background: var(--bg-page);
}

.guest-shell {
  min-height: 100dvh;
  width: 100%;
  display: flex;
}

/* Theme switcher (login + desk) */
.theme-switch {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-card);
}

.theme-switch--ghost {
  background: color-mix(in srgb, var(--bg-surface) 75%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: none;
}

.theme-switch__btn {
  min-height: 32px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--fg-muted);
  font: inherit;
  font-size: var(--text-small);
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background var(--motion), color var(--motion);
}

.theme-switch__btn:hover {
  color: var(--fg);
}

.theme-switch__btn[aria-pressed="true"] {
  background: var(--action);
  color: var(--fg-on-action);
}

.theme-switch--compact .theme-switch__btn {
  min-height: 28px;
  padding: 0 var(--space-2);
}

/* Topbar profile popover + /profile account page */
.user-menu {
  position: relative;
}

.user-menu__trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 4px 10px 4px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
  transition: border-color var(--motion), background var(--motion), box-shadow var(--motion);
}

.user-menu__trigger:hover,
.user-menu.is-open .user-menu__trigger {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.user-menu__who {
  display: grid;
  text-align: left;
  line-height: 1.15;
}

.user-menu__name {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
}

.user-menu__role {
  font-size: 11px;
  color: var(--fg-subtle);
}

.user-menu__chev {
  width: 14px;
  height: 14px;
  color: var(--fg-subtle);
  transition: transform var(--motion);
}

.user-menu.is-open .user-menu__chev {
  transform: rotate(180deg);
}

.user-menu__popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 90;
  width: 268px;
  padding: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-menu);
  animation: user-menu-in 140ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.user-menu__popover[hidden] {
  display: none !important;
}

@keyframes user-menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.user-menu__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 12px;
  border-bottom: 1px solid var(--border);
}

.user-menu__identity {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.user-menu__fullname {
  font-size: 14px;
  font-weight: 700;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu__handle {
  font-size: 12px;
  color: var(--fg-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu__group {
  padding: 6px 0;
  display: grid;
  gap: 2px;
  border-bottom: 1px solid var(--border);
}

.user-menu__item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  transition: background var(--motion), color var(--motion);
}

.user-menu__item:hover {
  background: color-mix(in srgb, var(--fg) 7%, transparent);
}

.user-menu__item--danger {
  color: var(--danger);
}

.user-menu__item--danger:hover {
  background: var(--off-goal-tint);
}

.user-menu__icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--fg-muted);
  flex-shrink: 0;
}

.user-menu__item--danger .user-menu__icon {
  color: currentColor;
}

.user-menu__theme {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.user-menu__theme-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
}

.user-menu__foot {
  padding-top: 6px;
}

.user-menu__logout-form {
  margin: 0;
}

/* Profile page */
.profile-grid {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}

.profile-card {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-card);
}

.profile-hero {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.profile-hero__name {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.profile-hero__meta {
  margin: 0;
  font-size: 13px;
  color: var(--fg-muted);
}

.profile-avatar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
}

.profile-file-btn {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.profile-file-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.profile-kv {
  display: grid;
  gap: 10px;
  margin: 0;
  font-size: 13px;
}

.profile-kv__row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
}

.profile-kv__row dt {
  color: var(--fg-subtle);
}

.profile-kv__row dd {
  margin: 0;
  font-weight: 600;
  color: var(--fg);
  text-align: right;
}

.profile-stack {
  display: grid;
  gap: var(--space-5);
}

@media (max-width: 860px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }
}

/* Linear / GitHub-style person hover card */
.has-hovercard {
  cursor: pointer;
}

.has-hovercard .avatar {
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.has-hovercard:hover .avatar {
  transform: scale(1.08);
  box-shadow: 0 0 0 2px var(--brand);
}

.person-card {
  position: fixed;
  z-index: 120;
  width: 264px;
  padding: 14px;
  display: grid;
  gap: 12px;
  background: var(--bg-surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-menu);
  animation: user-menu-in 130ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.person-card[hidden] {
  display: none !important;
}

.person-card__top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.person-card__avatar {
  width: 56px;
  height: 56px;
  font-size: 18px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14), inset 0 0 0 1px var(--border);
}

.person-card__id {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.person-card__name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.person-card__sub {
  font-size: 12px;
  color: var(--fg-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.person-card__dept {
  display: inline-flex;
  justify-self: start;
  margin-top: 2px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 700;
}

.person-card__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.person-card__stat {
  display: grid;
  gap: 1px;
}

.person-card__val {
  font-family: var(--font-value);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.05;
  color: var(--fg);
}

.person-card__val.is-bad {
  color: var(--off-goal);
}

.person-card__lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-subtle);
}

.person-card__foot {
  padding-top: 2px;
}

.person-card__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--fg) 5%, transparent);
  color: var(--fg);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: background var(--motion), color var(--motion);
}

.person-card__link:hover {
  background: var(--brand);
  color: var(--brand-fg);
}

.auth-stage {
  flex: 1;
  width: 100%;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(460px, 1.08fr) minmax(420px, 1fr);
}

/* Left showcase — always dark obsidian brand canvas */
.auth-showcase {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-7);
  padding: clamp(32px, 4.5vw, 56px);
  color: #F7F6F2;
  background: #0A0C10;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.auth-showcase::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(640px 420px at 14% 8%, color-mix(in srgb, var(--brand) 30%, transparent), transparent 68%),
    radial-gradient(560px 440px at 88% 92%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 70%),
    radial-gradient(480px 360px at 78% 18%, rgba(255, 255, 255, 0.045), transparent 65%);
  pointer-events: none;
}

.auth-showcase::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 85% 75% at 35% 45%, #000 25%, transparent 80%);
  pointer-events: none;
}

.auth-showcase__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

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

.auth-logo__img {
  height: 38px;
  width: auto;
  display: block;
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(8px);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(247, 246, 242, 0.86);
}

.auth-badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 12px var(--brand);
}

.auth-showcase__hero {
  display: grid;
  gap: var(--space-5);
  max-width: 540px;
}

.auth-showcase__kicker {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brand);
}

.auth-showcase__kicker::before {
  content: "";
  width: 24px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
}

.auth-showcase__headline {
  margin: 0;
  font-family: var(--font-text);
  font-size: clamp(38px, 4.2vw, 56px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.02;
  color: #FFFFFF;
}

.auth-showcase__headline span {
  color: rgba(247, 246, 242, 0.62);
}

.auth-showcase__sub {
  margin: 0;
  max-width: 48ch;
  font-size: 16px;
  line-height: 1.55;
  color: rgba(247, 246, 242, 0.68);
}

.auth-pillars {
  margin-top: var(--space-2);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.auth-pillar {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 6px 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
  backdrop-filter: blur(8px);
}

.auth-pillar__key {
  grid-row: span 2;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-family: var(--font-value);
  font-size: 16px;
  font-weight: 700;
  color: #FFFFFF;
  background: rgba(255, 68, 1, 0.18);
  border: 1px solid rgba(255, 68, 1, 0.42);
}

.auth-pillar__name {
  font-size: 13px;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.1;
}

.auth-pillar__state {
  font-size: 11px;
  font-weight: 600;
  color: rgba(247, 246, 242, 0.62);
  line-height: 1.1;
}

.auth-pillar__state[data-status="on_goal"] {
  color: #3DDB8A;
}

.auth-pillar__state[data-status="watch"] {
  color: #F0B429;
}

.auth-showcase__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: rgba(247, 246, 242, 0.52);
}

.auth-showcase__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-weight: 500;
}

.auth-copyright {
  margin: 0;
  color: rgba(247, 246, 242, 0.64);
  font-weight: 500;
}

/* Right sign-in pane */
.auth-pane {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(24px, 3.5vw, 44px);
  background:
    radial-gradient(620px 380px at 50% 0%, color-mix(in srgb, var(--brand) 9%, transparent), transparent 70%),
    var(--bg-page);
}

.auth-pane__top {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-4);
}

.auth-pane__mobile-logo {
  display: none;
  margin-right: auto;
  text-decoration: none;
}

.auth-pane__logo-light,
.auth-pane__logo-dark {
  height: 30px;
  width: auto;
}

.auth-pane__logo-dark {
  display: none;
}

[data-theme="dark"] .auth-pane__logo-light {
  display: none;
}

[data-theme="dark"] .auth-pane__logo-dark {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .auth-pane__logo-light,
  [data-theme="system"] .auth-pane__logo-light {
    display: none;
  }

  :root:not([data-theme="light"]):not([data-theme="dark"]) .auth-pane__logo-dark,
  [data-theme="system"] .auth-pane__logo-dark {
    display: block;
  }
}

.auth-pane__body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5) 0;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  display: grid;
  gap: var(--space-5);
  padding: clamp(24px, 3vw, 36px);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-login);
  animation: auth-rise 380ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes auth-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card {
    animation: none;
  }
}

.auth-card__head {
  display: grid;
  gap: 10px;
}

.auth-card__mark-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.auth-card__mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: block;
}

.auth-card__vendor {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-subtle);
}

.auth-card__title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.12;
  color: var(--fg);
}

.auth-card__lead {
  margin: 0;
  font-size: var(--text-body);
  line-height: 1.48;
  color: var(--fg-muted);
}

.auth__alert {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--off-goal) 28%, var(--border));
  background: var(--off-goal-tint);
  color: var(--off-goal);
  font-size: var(--text-body);
  font-weight: 600;
}

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

.auth__field {
  display: grid;
  gap: 7px;
}

.auth__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.auth__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}

.auth__input {
  width: 100%;
  min-height: 48px;
  padding: 0 15px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--bg-page);
  color: var(--fg);
  font: inherit;
  font-size: 15px;
  transition: border-color var(--motion), box-shadow var(--motion), background var(--motion);
}

.auth__input::placeholder {
  color: var(--fg-subtle);
}

.auth__input:hover {
  border-color: color-mix(in srgb, var(--fg) 32%, var(--border));
}

.auth__input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-glow);
  background: var(--bg-surface);
}

.auth__reveal {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--fg-muted);
  font: inherit;
  font-size: var(--text-small);
  font-weight: 600;
  cursor: pointer;
  transition: color var(--motion);
}

.auth__reveal:hover,
.auth__reveal[aria-pressed="true"] {
  color: var(--brand);
}

.auth__submit {
  width: 100%;
  min-height: 50px;
  margin-top: 4px;
  padding: 0 var(--space-4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 12px;
  background: var(--brand);
  color: var(--brand-fg);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 12px 28px -6px color-mix(in srgb, var(--brand) 48%, transparent);
  transition: background var(--motion), transform 150ms ease, box-shadow 150ms ease;
}

.auth__submit:hover {
  background: var(--brand-hover);
  transform: translateY(-1px);
  box-shadow: 0 16px 32px -6px color-mix(in srgb, var(--brand) 58%, transparent);
}

.auth__submit:active {
  transform: translateY(0);
}

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

.auth__submit-arrow {
  font-size: 17px;
  line-height: 1;
  transition: transform 150ms ease;
}

.auth__submit:hover .auth__submit-arrow {
  transform: translateX(3px);
}

.auth-card__trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--fg-subtle);
}

.auth-pane__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--fg-subtle);
  text-align: center;
}

.auth-pane__foot strong {
  color: var(--fg-muted);
  font-weight: 600;
}

@media (max-width: 960px) {
  .auth-stage {
    grid-template-columns: 1fr;
  }

  .auth-showcase {
    display: none;
  }

  .auth-pane__mobile-logo {
    display: inline-flex;
    align-items: center;
  }
}

@media (max-width: 480px) {
  .auth-pane {
    padding: var(--space-4);
  }

  .auth-card {
    padding: var(--space-5);
    border-radius: 16px;
  }
}

/* Dialog / shortcuts help */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--ink) 40%, transparent);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: var(--space-5);
}

/* Author display must not override the hidden attribute. */
.dialog-backdrop[hidden] {
  display: none !important;
}

.dialog {
  width: min(480px, 100%);
  background: var(--surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-menu);
  padding: var(--space-5);
}

.dialog__title {
  margin: 0 0 var(--space-4);
  font-size: var(--text-section);
}

.shortcuts-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-2);
}

.shortcuts-list li {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  color: var(--ink-2);
}

kbd {
  font-family: var(--font-text);
  font-size: var(--text-body);
  padding: 2px var(--space-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-control);
  background: var(--paper);
  color: var(--ink);
}

.empty-state {
  text-align: center;
  padding: var(--space-7) var(--space-4);
  color: var(--ink-2);
}

/* Meeting bar */
.meeting-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--watch-tint);
  border: 1px solid color-mix(in srgb, var(--watch) 25%, var(--rule));
  border-radius: var(--radius-card);
}

/* TV mode */
body.tv-mode {
  font-size: calc(var(--text-body) * 1.15);
}

body.tv-mode .metric-value--headline {
  font-size: var(--text-tv);
}

body.tv-mode .layout__rail {
  display: none;
}

body.tv-mode .layout {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "context"
    "breadcrumb"
    "main";
}

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

body.tv-mode .wheel {
  max-width: none;
}

body.tv-mode .board {
  grid-template-columns: minmax(0, 1fr);
}

body.tv-mode .handover__add {
  display: none;
}

body.tv-mode .btn,
body.tv-mode .segment__btn {
  min-height: 44px;
}

.tv-live {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--on-goal);
  font-weight: 700;
}

.tv-live__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--on-goal);
  animation: tv-pulse 1.8s ease-out infinite;
}

@keyframes tv-pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--on-goal) 50%, transparent);
  }
  70% {
    box-shadow: 0 0 0 8px color-mix(in srgb, var(--on-goal) 0%, transparent);
  }
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--on-goal) 0%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tv-live__dot {
    animation: none;
  }
}

/* Tablet / touch targets */
@media (max-width: 1024px), (pointer: coarse) {
  .btn,
  .segment__btn,
  .rail__link,
  .pass-fail-field__btn,
  .input,
  .select {
    min-height: 44px;
  }

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

  .entry-sheet__table {
    display: block;
    overflow-x: auto;
  }
}

/* Print */
@media print {
  body {
    background: var(--surface);
  }

  .rail,
  .context-bar__controls,
  .btn-toolbar,
  .dialog-backdrop {
    display: none !important;
  }

  .layout {
    display: block;
  }

  .layout__main {
    padding: 0;
  }

  .card,
  .pillar-card,
  .handover__lane {
    box-shadow: none;
    break-inside: avoid;
  }

  .wheel__seg,
  .story__svg {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  a[href]::after {
    content: "";
  }
}

.wheel__seg[data-status="future"] {
  fill: var(--paper);
  stroke: var(--rule);
  stroke-width: 0.3;
}

/* Classic DMS board — huddle-readable: number first, tint heat, wider cards */
.classic-wall {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  align-items: stretch;
}

.classic-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
  padding: var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.classic-col[data-status="on_goal"] { --status-ink: var(--on-goal); --status-tint: var(--on-goal-tint); }
.classic-col[data-status="watch"] { --status-ink: var(--watch); --status-tint: var(--watch-tint); }
.classic-col[data-status="off_goal"] { --status-ink: var(--off-goal); --status-tint: var(--off-goal-tint); }
.classic-col[data-status="not_entered"] { --status-ink: var(--not-entered); --status-tint: var(--not-entered-tint); }

.classic-col__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}

.classic-col__name {
  font-family: var(--font-value);
  font-size: var(--text-section);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--fg);
  text-decoration: none;
}

.classic-col__name:hover {
  color: var(--focus);
}

.classic-col__kpi {
  display: grid;
  gap: var(--space-1);
  text-decoration: none;
  color: inherit;
}

.classic-col__metric {
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--fg-muted);
}

.classic-col__value {
  font-size: clamp(28px, 2.4vw, 36px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.classic-col__kpi[data-status="on_goal"] .classic-col__value { color: var(--on-goal); }
.classic-col__kpi[data-status="watch"] .classic-col__value { color: var(--watch); }
.classic-col__kpi[data-status="off_goal"] .classic-col__value { color: var(--off-goal); }

.classic-col__meta,
.classic-col__pct {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: baseline;
  font-size: var(--text-small);
  color: var(--fg-muted);
}

.classic-col__gap {
  font-weight: 700;
  color: var(--status-ink, var(--fg));
}

.classic-heat {
  display: grid;
  gap: var(--space-2);
}

.classic-heat__bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
}

.classic-heat__label {
  font-size: var(--text-small);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-subtle);
}

.classic-heat__range {
  font-size: var(--text-small);
}

.classic-cal {
  display: grid;
  gap: 4px;
}

.classic-cal__weekdays,
.classic-cal--days .classic-cal__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.classic-cal--weeks .classic-cal__grid {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 4px;
}

.classic-cal--months .classic-cal__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.classic-cal__wd {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--fg-subtle);
  text-transform: uppercase;
}

/* Soft tint cells — readable ink, colour carries meaning */
.classic-cal__cell {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-height: 0;
  border-radius: 6px;
  font-family: var(--font-value);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-decoration: none;
  color: var(--fg-muted);
  background: var(--bg-elevated);
  border: 1px solid transparent;
  transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion);
}

a.classic-cal__cell:hover,
a.classic-cal__cell:focus-visible {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
  outline: none;
  z-index: 1;
}

.classic-cal__cell--pad {
  visibility: hidden;
}

.classic-cal__cell--future {
  background: transparent;
  color: var(--fg-subtle);
  border: 1px dashed var(--border);
  font-weight: 500;
}

.classic-cal__cell[data-status="on_goal"] {
  background: var(--on-goal-tint);
  color: var(--on-goal);
  border-color: color-mix(in srgb, var(--on-goal) 28%, transparent);
}

.classic-cal__cell[data-status="watch"] {
  background: var(--watch-tint);
  color: var(--watch);
  border-color: color-mix(in srgb, var(--watch) 28%, transparent);
}

.classic-cal__cell[data-status="off_goal"] {
  background: var(--off-goal-tint);
  color: var(--off-goal);
  border-color: color-mix(in srgb, var(--off-goal) 28%, transparent);
}

.classic-cal__cell[data-status="not_entered"] {
  background: var(--bg-elevated);
  color: var(--fg-subtle);
  border-color: var(--border);
}

.classic-cal__cell[data-status="no_production"] {
  background: repeating-linear-gradient(
    -45deg,
    var(--bg-muted),
    var(--bg-muted) 3px,
    var(--bg-elevated) 3px,
    var(--bg-elevated) 6px
  );
  color: var(--fg-subtle);
  border-color: var(--border);
}

.classic-cal__cell--today {
  box-shadow: inset 0 0 0 2px var(--fg);
  font-weight: 800;
}

/* Week strip: pure colour swatches, detail on hover */
.classic-cal__cell--swatch {
  aspect-ratio: 1;
  min-height: 14px;
  border-radius: 4px;
  font-size: 0;
  color: transparent;
}

.classic-cal__cell--swatch[data-status="on_goal"] { background: var(--on-goal); border-color: transparent; }
.classic-cal__cell--swatch[data-status="watch"] { background: var(--watch); border-color: transparent; }
.classic-cal__cell--swatch[data-status="off_goal"] { background: var(--off-goal); border-color: transparent; }
.classic-cal__cell--swatch[data-status="not_entered"] { background: var(--bg-muted); border-color: var(--border); }
.classic-cal__cell--swatch.classic-cal__cell--today {
  box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 3px var(--fg);
}

.classic-cal--months .classic-cal__cell {
  aspect-ratio: auto;
  min-height: 36px;
  padding: 8px 4px;
  font-size: var(--text-small);
  font-weight: 700;
}

.classic-col__caption {
  margin: 0;
  font-size: var(--text-small);
  color: var(--fg-subtle);
  line-height: 1.4;
}

.classic-col__causes-title {
  margin: 0 0 var(--space-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-subtle);
}

.classic-causes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
}

.classic-causes li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(48px, 1.2fr) auto;
  gap: var(--space-2);
  align-items: center;
}

.classic-causes__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-small);
  color: var(--fg);
}

.classic-causes__bar {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-muted);
  overflow: hidden;
}

.classic-causes__bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--off-goal);
}

.classic-causes__n {
  font-size: var(--text-small);
  font-weight: 700;
  color: var(--fg-muted);
  min-width: 1.25rem;
  text-align: right;
}

.classic-col__foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

@media (min-width: 1400px) {
  .classic-wall {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

@media (max-width: 640px) {
  .classic-wall {
    grid-template-columns: 1fr;
  }

  .classic-cal--weeks .classic-cal__grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

body.tv-mode .classic-wall {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.tv-mode .classic-col__causes,
body.tv-mode .classic-col__foot {
  display: none;
}

body.tv-mode .classic-col__value {
  font-size: var(--text-headline);
}
