/* Ghost Crew: tokens copied from apps/chores/styles.css (not imported), page shell,
   components, focus ring and the single reduced-motion block.
   Animation uses transform and opacity only. Bar width may transition. */

/* ---------- Tokens (same names and values as the chores app) ---------- */
:root {
  /* Color */
  --color-primary: #F1BF68;
  --color-on-primary: #422C00;
  --color-primary-container: #B58938;
  --color-on-primary-container: #271900;
  --color-secondary: #D2C4B2;
  --color-on-secondary: #251913;
  --color-surface: #1C110B;
  --color-on-surface: #F5DED4;
  --color-surface-container-low: #251913;
  --color-surface-container: #291D17;
  --color-surface-container-high: #342721;
  --color-surface-container-highest: #3F322B;
  --color-on-surface-variant: #D2C4B2;
  --color-outline: #9B8F7E;
  --color-outline-variant: #4F4538;
  --color-paper: #F6F0E2;
  --color-on-paper: #1D1C13;
  --color-paper-dim: #E8E2D4;
  --color-on-paper-dim: #49473D;
  --color-paper-outline: #CBC6B9;
  --color-brass: #D3A450;
  --color-on-brass: #271900;
  --color-brass-subtle: #5F4100;
  --color-on-brass-subtle: #FFDEAA;
  --color-error: #BA1A1A;
  --color-on-error: #FFFFFF;

  /* Walnut grain: glows and grain lines as channels so rules stay token based */
  --color-glow-purple: rgba(132, 74, 178, 0.38);
  --color-glow-purple-mid: rgba(92, 52, 132, 0.18);
  --color-glow-teal: rgba(42, 136, 116, 0.32);
  --color-glow-teal-mid: rgba(32, 96, 84, 0.14);
  --color-glow-violet: rgba(122, 68, 164, 0.34);
  --color-glow-violet-mid: rgba(82, 46, 114, 0.14);
  --color-grain-light: rgba(255, 222, 170, 0.015);
  --color-grain-dark: rgba(10, 5, 2, 0.16);
  --color-shadow: rgba(8, 4, 1, 0.5);
  --color-shadow-strong: rgba(8, 4, 1, 0.65);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-section: 48px;
  --space-page-margin: 32px;

  /* Size */
  --size-touch: 44px;
  --size-content-max: 1152px;
  --size-focus-ring: 3px;
  --size-focus-gap: 2px;
  --size-border: 1px;
  --size-border-strong: 2px;

  /* Radius */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Type families, with system fallbacks */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-headline: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Type scale: size / line height / letter spacing / weight */
  --font-size-display-lg: 44px;
  --line-height-display-lg: 52px;
  --letter-spacing-display-lg: -0.5px;
  --font-size-display-lg-mobile: 32px;
  --line-height-display-lg-mobile: 38px;
  --letter-spacing-display-lg-mobile: -0.25px;
  --font-size-headline-lg: 32px;
  --line-height-headline-lg: 40px;
  --font-size-headline-md: 24px;
  --line-height-headline-md: 30px;
  --letter-spacing-headline-md: -0.15px;
  --font-size-headline-sm: 20px;
  --line-height-headline-sm: 26px;
  --font-size-title-md: 16px;
  --line-height-title-md: 24px;
  --font-size-body-lg: 16px;
  --line-height-body-lg: 24px;
  --font-size-body-md: 14px;
  --line-height-body-md: 22px;
  --font-size-label-lg: 14px;
  --line-height-label-lg: 20px;
  --letter-spacing-label-lg: 0.25px;
  --font-size-label-md: 12px;
  --line-height-label-md: 16px;
  --letter-spacing-label-md: 0.4px;
  --font-size-label-sm: 11px;
  --line-height-label-sm: 14px;
  --letter-spacing-label-sm: 0.5px;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;

  /* Motion */
  --duration-fast: 150ms;
  --duration-base: 240ms;
  --duration-slow: 400ms;
  --ease-out: cubic-bezier(0.2, 0, 0, 1);

  /* Elevation */
  --shadow-button: 0 4px 8px -2px var(--color-shadow);
  --shadow-ticket: 0 8px 18px -6px var(--color-shadow), 0 2px 4px var(--color-shadow);
  --shadow-lift: 0 18px 32px -8px var(--color-shadow-strong), 0 6px 12px var(--color-shadow);
  --shadow-plate: inset 0 2px 12px var(--color-grain-dark), 0 18px 36px -12px var(--color-shadow-strong);
}

/* Agents-only tokens, built on the shared ones */
:root {
  --duration-pick: 900ms;
  /* one pick; the 300ms gap between picks is sequenced in JS */
  --size-bar-height: 16px;
  --size-ghost: 56px;
  --size-pick-badge: 24px;
  --size-eye-shift: 3px;
  --accent-pixel: var(--color-brass);
  --accent-sage: var(--color-glow-teal);
  --accent-bolt: var(--color-glow-violet);
}

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

html {
  background-color: var(--color-surface);
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--color-surface);
  color: var(--color-on-surface);
  font-family: var(--font-body);
  font-size: var(--font-size-body-lg);
  line-height: var(--line-height-body-lg);
  font-weight: var(--font-weight-regular);
  -webkit-font-smoothing: antialiased;
}

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

h1,
h2,
h3 {
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

h1 {
  font-family: var(--font-display);
  font-size: var(--font-size-display-lg-mobile);
  line-height: var(--line-height-display-lg-mobile);
  letter-spacing: var(--letter-spacing-display-lg-mobile);
  font-weight: var(--font-weight-semibold);
}

h2 {
  font-family: var(--font-headline);
  font-size: var(--font-size-headline-md);
  line-height: var(--line-height-headline-md);
  letter-spacing: var(--letter-spacing-headline-md);
  font-weight: var(--font-weight-semibold);
}

h3 {
  font-family: var(--font-headline);
  font-size: var(--font-size-headline-sm);
  line-height: var(--line-height-headline-sm);
  font-weight: var(--font-weight-semibold);
}

h1:focus {
  outline: none;
}

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

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

/* ---------- Page shell and walnut background ---------- */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--color-surface);
  background-image:
    radial-gradient(ellipse 70% 60% at 85% 15%, var(--color-glow-purple) 0%, var(--color-glow-purple-mid) 45%, transparent 75%),
    radial-gradient(ellipse 65% 55% at 90% 52%, var(--color-glow-teal) 0%, var(--color-glow-teal-mid) 48%, transparent 78%),
    radial-gradient(ellipse 60% 50% at 80% 88%, var(--color-glow-violet) 0%, var(--color-glow-violet-mid) 45%, transparent 75%),
    repeating-linear-gradient(92deg, var(--color-grain-light) 0, var(--color-grain-light) 2px, transparent 2px, transparent 14px),
    repeating-linear-gradient(89deg, var(--color-grain-dark) 0, var(--color-grain-dark) 3px, transparent 3px, transparent 22px);
}

.shell {
  width: 100%;
  max-width: var(--size-content-max);
  margin-inline: auto;
  padding: var(--space-xl) var(--space-lg);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-section);
}

.shell-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.shell-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

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

.brand-name {
  font-family: var(--font-display);
  font-size: var(--font-size-headline-md);
  line-height: var(--line-height-headline-md);
  letter-spacing: var(--letter-spacing-headline-md);
  font-weight: var(--font-weight-semibold);
  color: var(--color-on-surface);
}

/* "Simulated" label: text plus dashed border, so it does not rely on color */
.sim-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-md);
  border: var(--size-border) dashed var(--color-outline);
  border-radius: var(--radius-full);
  background-color: var(--color-surface-container);
  color: var(--color-primary);
  font-size: var(--font-size-label-md);
  line-height: var(--line-height-label-md);
  letter-spacing: var(--letter-spacing-label-md);
  font-weight: var(--font-weight-medium);
}

.guidance {
  max-width: 65ch;
  color: var(--color-on-surface-variant);
}

.shell-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-section);
}

/* ---------- Headline block ---------- */
.headline-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-lg);
  border: var(--size-border) solid var(--color-outline-variant);
  border-radius: var(--radius-xl);
  background-color: var(--color-surface-container-high);
  box-shadow: var(--shadow-plate);
}

.headline-figure {
  font-family: var(--font-display);
  font-size: var(--font-size-headline-lg);
  line-height: var(--line-height-headline-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
}

/* ---------- Two columns: stacked by default (naive first), side by side from 768px ---------- */
.columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  align-items: start;
}

.column {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  min-width: 0;
  padding: var(--space-lg);
  border: var(--size-border) solid var(--color-outline-variant);
  border-radius: var(--radius-xl);
  background-color: var(--color-surface-container);
  box-shadow: var(--shadow-plate);
}

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

.column-caption {
  color: var(--color-on-surface-variant);
  font-size: var(--font-size-body-md);
  line-height: var(--line-height-body-md);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

/* ---------- Buttons (at least 44px by 44px) ---------- */
button {
  font: inherit;
  color: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-width: var(--size-touch);
  min-height: var(--size-touch);
  padding: var(--space-sm) var(--space-lg);
  border: var(--size-border-strong) solid transparent;
  border-radius: var(--radius-lg);
  background-color: var(--color-primary);
  color: var(--color-on-primary);
  font-family: var(--font-body);
  font-size: var(--font-size-label-lg);
  line-height: var(--line-height-label-lg);
  letter-spacing: var(--letter-spacing-label-lg);
  font-weight: var(--font-weight-semibold);
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow-button);
  touch-action: manipulation;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
}

/* display: inline-flex above would otherwise override the hidden attribute (Skip must be hidden) */
.btn[hidden] {
  display: none;
}

.btn:hover {
  background-color: var(--color-brass);
}

.btn:active {
  transform: scale(0.96);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  background-color: var(--color-surface-container-high);
  color: var(--color-on-surface-variant);
  border-style: dashed;
  border-color: var(--color-outline);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: none;
}

.btn-secondary:hover {
  background-color: var(--color-brass-subtle);
  color: var(--color-on-brass-subtle);
}

/* ---------- Focus ring: brass, visible on dark and on paper ---------- */
:focus-visible {
  outline: var(--size-focus-ring) solid var(--color-brass);
  outline-offset: var(--size-focus-gap);
  box-shadow: 0 0 0 var(--size-focus-gap) var(--color-surface);
}

/* ---------- Agent rows ---------- */
.agent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.agent-row {
  --accent: var(--color-brass);
  --eye-x: 0;
  --eye-y: 0;
  display: grid;
  grid-template-columns: var(--size-ghost) 1fr;
  gap: var(--space-sm) var(--space-md);
  align-items: start;
  padding: var(--space-md);
  border: var(--size-border) solid var(--color-outline-variant);
  border-radius: var(--radius-lg);
  background-color: var(--color-surface-container-low);
}

.agent-row[data-agent="0"] {
  --accent: var(--accent-pixel);
}

.agent-row[data-agent="1"] {
  --accent: var(--accent-sage);
}

.agent-row[data-agent="2"] {
  --accent: var(--accent-bolt);
}

/* Picker gets a brass ring, so the cue is not motion alone */
.agent-row.is-picking {
  border-color: var(--color-brass);
  outline: var(--size-focus-ring) solid var(--color-brass);
  outline-offset: calc(var(--size-focus-gap) * -1);
}

.ghost {
  width: var(--size-ghost);
  height: calc(var(--size-ghost) * 1.25);
  transform-origin: 50% 100%;
}

.ghost svg {
  width: 100%;
  height: 100%;
}

/* Eye look: JS sets --eye-x and --eye-y (-1, 0 or 1) on the row when a pick starts */
.ghost [data-part="eyes"] {
  transform: translate(calc(var(--eye-x) * var(--size-eye-shift)), calc(var(--eye-y) * var(--size-eye-shift)));
  transition: transform var(--duration-fast) var(--ease-out);
}

/* Ghost hop */
.agent-row.is-picking .ghost {
  animation: ghost-hop var(--duration-pick) var(--ease-out);
}

@keyframes ghost-hop {

  0%,
  100% {
    transform: translateY(0);
  }

  25% {
    transform: translateY(calc(var(--space-sm) * -1));
  }

  50% {
    transform: translateY(0);
  }

  75% {
    transform: translateY(calc(var(--space-xs) * -1));
  }
}

.agent-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  min-width: 0;
}

.agent-name {
  font-family: var(--font-headline);
  font-size: var(--font-size-title-md);
  line-height: var(--line-height-title-md);
  font-weight: var(--font-weight-semibold);
  color: var(--color-on-surface);
}

.agent-specialty {
  font-size: var(--font-size-label-md);
  line-height: var(--line-height-label-md);
  letter-spacing: var(--letter-spacing-label-md);
  color: var(--color-on-surface-variant);
}

/* ---------- Tickets ---------- */
.ticket-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  min-height: var(--size-touch);
}

.ticket {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: var(--size-touch);
  padding: var(--space-xs) var(--space-md);
  border: var(--size-border) solid var(--color-paper-outline);
  border-radius: var(--radius);
  background-color: var(--color-paper);
  color: var(--color-on-paper);
  font-size: var(--font-size-label-lg);
  line-height: var(--line-height-label-lg);
  font-weight: var(--font-weight-medium);
  box-shadow: var(--shadow-ticket);
  max-width: 100%;
  overflow-wrap: anywhere;
  transition:
    transform var(--duration-base) var(--ease-out),
    opacity var(--duration-base) var(--ease-out);
}

.ticket-hours {
  flex: none;
  white-space: nowrap;
  color: var(--color-on-paper-dim);
  font-size: var(--font-size-label-md);
  font-weight: var(--font-weight-semibold);
}

/* Pick-number badge: the number is text, the circle is brass */
.pick-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--size-pick-badge);
  height: var(--size-pick-badge);
  padding-inline: var(--space-xs);
  border-radius: var(--radius-full);
  background-color: var(--color-brass);
  color: var(--color-on-brass);
  font-size: var(--font-size-label-md);
  line-height: var(--line-height-label-md);
  font-weight: var(--font-weight-semibold);
}

.ticket.is-arriving {
  animation: ticket-arrive var(--duration-pick) var(--ease-out) both;
}

@keyframes ticket-arrive {
  from {
    opacity: 0;
    transform: translateY(var(--space-md));
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Unassigned pool ---------- */
.pool {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-md);
  border: var(--size-border-strong) dashed var(--color-outline);
  border-radius: var(--radius-lg);
  background-color: var(--color-surface-container-low);
}

.pool-label {
  font-family: var(--font-headline);
  font-size: var(--font-size-title-md);
  line-height: var(--line-height-title-md);
  font-weight: var(--font-weight-semibold);
}

.pool .ticket-list:empty::before {
  content: "All tickets are assigned.";
  align-self: center;
  color: var(--color-on-surface-variant);
  font-size: var(--font-size-body-md);
}

/* ---------- Workload bars (shared scale; JS sets --load as a percent number) ---------- */
.load {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
}

.meter {
  flex: 1;
  min-width: 140px;
  height: var(--size-bar-height);
  border: var(--size-border) solid var(--color-outline);
  border-radius: var(--radius-full);
  background-color: var(--color-surface);
  overflow: hidden;
}

.meter-fill {
  display: block;
  height: 100%;
  width: calc(var(--load, 0) * 1%);
  border-radius: var(--radius-full);
  background-color: var(--accent);
  transition: width var(--duration-slow) var(--ease-out);
}

.load-hours {
  min-width: 48px;
  font-size: var(--font-size-label-lg);
  line-height: var(--line-height-label-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-on-surface);
  text-align: right;
}

/* Slowest mark: text label with a solid border and a triangle, not color alone */
.slowest-mark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border: var(--size-border-strong) solid var(--color-primary);
  border-radius: var(--radius-sm);
  background-color: var(--color-brass-subtle);
  color: var(--color-on-brass-subtle);
  font-size: var(--font-size-label-md);
  line-height: var(--line-height-label-md);
  letter-spacing: var(--letter-spacing-label-md);
  font-weight: var(--font-weight-semibold);
}

.slowest-mark::before {
  content: "\25B2";
}

.slowest-mark[hidden] {
  display: none;
}

/* ---------- EF1 badges (icon plus text, detail on focus or activation) ---------- */
.ef1-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.ef1-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.ef1-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: var(--space-sm);
  min-width: var(--size-touch);
  min-height: var(--size-touch);
  padding: var(--space-xs) var(--space-md);
  border: var(--size-border-strong) solid var(--color-paper-outline);
  border-radius: var(--radius-full);
  background-color: var(--color-paper);
  color: var(--color-on-paper);
  font-size: var(--font-size-label-lg);
  line-height: var(--line-height-label-lg);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  touch-action: manipulation;
}

.ef1-badge::before {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--space-lg);
  height: var(--space-lg);
  border-radius: var(--radius-full);
  font-size: var(--font-size-label-md);
  line-height: 1;
  font-weight: var(--font-weight-semibold);
}

/* Pass: check icon, solid border. Fail: cross icon, dashed border. */
.ef1-badge[data-ef1="pass"] {
  border-style: solid;
  border-color: var(--color-brass-subtle);
}

.ef1-badge[data-ef1="pass"]::before {
  content: "\2713";
  background-color: var(--color-brass-subtle);
  color: var(--color-on-brass-subtle);
}

.ef1-badge[data-ef1="fail"] {
  border-style: dashed;
  border-color: var(--color-error);
}

.ef1-badge[data-ef1="fail"]::before {
  content: "\2717";
  background-color: var(--color-error);
  color: var(--color-on-error);
}

.ef1-detail {
  display: none;
  max-width: 65ch;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  background-color: var(--color-surface-container-highest);
  color: var(--color-on-surface);
  font-size: var(--font-size-body-md);
  line-height: var(--line-height-body-md);
}

.ef1-item:focus-within .ef1-detail,
.ef1-item.is-open .ef1-detail,
.ef1-badge[aria-expanded="true"]+.ef1-detail {
  display: block;
}

/* ---------- Hours table ---------- */
.hours {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.table-wrap {
  overflow-x: auto;
  border: var(--size-border) solid var(--color-outline-variant);
  border-radius: var(--radius-lg);
  background-color: var(--color-surface-container);
}

.hours-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-body-md);
  line-height: var(--line-height-body-md);
}

.hours-table caption {
  padding: var(--space-md);
  text-align: left;
  font-family: var(--font-headline);
  font-size: var(--font-size-title-md);
  font-weight: var(--font-weight-semibold);
}

.hours-table th,
.hours-table td {
  padding: var(--space-sm) var(--space-md);
  border-top: var(--size-border) solid var(--color-outline-variant);
  text-align: left;
  white-space: nowrap;
}

.hours-table td {
  font-variant-numeric: tabular-nums;
}

.hours-table thead th {
  color: var(--color-on-surface-variant);
  font-weight: var(--font-weight-semibold);
}

.hours-table td.is-min {
  color: var(--color-primary);
  font-weight: var(--font-weight-semibold);
  text-decoration: underline;
}

/* ---------- EF1 explainer ---------- */
.explainer {
  max-width: 65ch;
  padding: var(--space-md) var(--space-lg);
  border: var(--size-border) solid var(--color-outline-variant);
  border-radius: var(--radius-xl);
  background-color: var(--color-surface-container);
  color: var(--color-on-surface-variant);
}

/* ---------- Error fallback ---------- */
.error-message {
  max-width: 65ch;
  padding: var(--space-lg);
  border: var(--size-border-strong) dashed var(--color-error);
  border-radius: var(--radius-xl);
  background-color: var(--color-paper);
  color: var(--color-on-paper);
}

.columns[hidden],
.headline-block[hidden],
.error-message[hidden] {
  display: none;
}

/* ---------- Responsive ---------- */
@media (min-width: 768px) {
  .shell {
    padding: var(--space-section);
  }

  h1 {
    font-size: var(--font-size-display-lg);
    line-height: var(--line-height-display-lg);
    letter-spacing: var(--letter-spacing-display-lg);
  }

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

/* ---------- Reduced motion (the only such block) ---------- */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .btn:active {
    transform: none;
  }

  .ghost,
  .ghost [data-part="eyes"],
  .ticket {
    transform: none !important;
  }

  /* The picker keeps the highlight ring, so the turn is still visible without a hop. */
  .agent-row.is-picking {
    border-color: var(--color-brass);
    outline: var(--size-focus-ring) solid var(--color-brass);
  }
}

/* ---------- Agent count control (same look as the chores "Who's home" buttons) ---------- */
.agent-count-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-md);
  max-width: 420px;
}

.count-choice,
.source-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  min-height: var(--size-touch);
  padding: var(--space-md);
  border: var(--size-border-strong) solid var(--color-paper-outline);
  border-radius: var(--radius-lg);
  background-color: var(--color-paper);
  color: var(--color-on-paper);
  font-family: var(--font-body);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}

.count-choice:hover,
.source-choice:hover {
  border-color: var(--color-brass);
}

.count-choice:active,
.source-choice:active {
  transform: scale(0.97);
}

.count-choice-num {
  font-family: var(--font-display);
  font-size: var(--font-size-display-lg);
  line-height: 1;
  font-weight: var(--font-weight-semibold);
}

.count-choice-label,
.source-choice-label {
  font-size: var(--font-size-body-md);
  color: var(--color-on-paper-dim);
}

.count-choice-state,
.source-choice-state {
  min-height: var(--line-height-label-lg);
  font-size: var(--font-size-label-lg);
  font-weight: var(--font-weight-semibold);
}

.count-choice[aria-pressed="true"],
.source-choice[aria-pressed="true"] {
  border-color: var(--color-on-brass);
  background-color: var(--color-brass);
  color: var(--color-on-brass);
}

.count-choice[aria-pressed="true"] .count-choice-label,
.source-choice[aria-pressed="true"] .source-choice-label {
  color: var(--color-on-brass);
}

@media (prefers-reduced-motion: reduce) {
  .count-choice,
  .source-choice {
    transition: none;
  }

  .count-choice:active,
  .source-choice:active {
    transform: none;
  }
}

/* Source control: two wide buttons (same look as the agent count) and the Kiro form fields */
.source-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
  max-width: 420px;
}
.source-choice {
  text-align: center;
}
.kiro-form[hidden],
.import-form[hidden] {
  display: none;
}
.kiro-input {
  flex: 1 1 100%;
  min-height: calc(var(--size-touch) * 3);
  resize: vertical;
  font-family: var(--font-body);
}
.kiro-check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: var(--size-touch);
  color: var(--color-on-surface);
  font-size: var(--font-size-body-md);
  line-height: var(--line-height-body-md);
}
.kiro-checkbox {
  width: var(--size-touch);
  height: var(--size-touch);
  margin: 0;
  accent-color: var(--color-brass);
}
/* ---------- Custom crew: editable hours table, messages, task controls ---------- */
.shell-main>*,
.hours,
.headline-block {
  min-width: 0;
}

/* The table keeps a readable width and scrolls sideways inside its own box, never the page */
.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.hours-table {
  min-width: calc(var(--size-touch) * 10);
}

.hours-table th,
.hours-table td {
  vertical-align: top;
}

.hours-table input {
  display: block;
  width: 100%;
  min-width: calc(var(--size-touch) * 2);
  min-height: var(--size-touch);
  padding: var(--space-xs) var(--space-sm);
  border: var(--size-border-strong) solid var(--color-outline);
  border-radius: var(--radius);
  background-color: var(--color-surface);
  color: var(--color-on-surface);
  font-family: var(--font-body);
  font-size: var(--font-size-body-md);
  line-height: var(--line-height-body-md);
  font-weight: var(--font-weight-regular);
  transition: border-color var(--duration-fast) var(--ease-out);
}

.hours-table input[type="number"] {
  font-variant-numeric: tabular-nums;
}

.hours-table input:hover {
  border-color: var(--color-brass);
}

/* Invalid: dashed red border here, the message text is below the field */
.hours-table input[aria-invalid="true"] {
  border-style: dashed;
  border-color: var(--color-error);
}

.hours-table input:disabled {
  border-style: dashed;
  color: var(--color-on-surface-variant);
  cursor: not-allowed;
}

.hours-table .agent-col {
  min-width: calc(var(--size-touch) * 3);
}
/* Strength select: fills its header cell, so 4 agents at 360px scroll inside .table-wrap only */
.strength-field {
  display: block;
  margin-top: var(--space-xs);
}
.strength-label {
  display: block;
  color: var(--color-on-surface-variant);
  font-size: var(--font-size-label-md);
  line-height: var(--line-height-label-md);
  letter-spacing: var(--letter-spacing-label-md);
  font-weight: var(--font-weight-medium);
}
.strength-select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: var(--size-touch);
  padding: var(--space-xs) var(--space-sm);
  border: var(--size-border-strong) solid var(--color-outline);
  border-radius: var(--radius);
  background-color: var(--color-surface);
  color: var(--color-on-surface);
  font-family: var(--font-body);
  font-size: var(--font-size-body-md);
  line-height: var(--line-height-body-md);
  transition: border-color var(--duration-fast) var(--ease-out);
}
.strength-select:hover {
  border-color: var(--color-brass);
}

/* Inline validation text: words, a dashed border and a leading mark, not color alone */
.field-message {
  display: block;
  max-width: calc(var(--size-touch) * 4);
  margin-top: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border: var(--size-border) dashed var(--color-error);
  border-radius: var(--radius-sm);
  background-color: var(--color-paper);
  color: var(--color-on-paper);
  font-size: var(--font-size-label-md);
  line-height: var(--line-height-label-md);
  letter-spacing: var(--letter-spacing-label-md);
  font-weight: var(--font-weight-medium);
  white-space: normal;
}

.field-message::before {
  content: "Fix: ";
  font-weight: var(--font-weight-semibold);
}

.field-message[hidden] {
  display: none;
}

/* Area tag under the task name, and the one-line source note above the table */
.area-tag {
  display: inline-block;
  margin-top: var(--space-xs);
  padding: 0 var(--space-sm);
  border: var(--size-border) solid var(--color-outline);
  border-radius: var(--radius-sm);
  color: var(--color-on-surface-variant);
  font-size: var(--font-size-label-md);
  line-height: var(--line-height-label-md);
  letter-spacing: var(--letter-spacing-label-md);
  font-weight: var(--font-weight-medium);
}
.source-note {
  max-width: 65ch;
  margin: 0;
  color: var(--color-on-surface-variant);
  font-size: var(--font-size-body-md);
  line-height: var(--line-height-body-md);
}
.source-note[hidden] {
  display: none;
}
/* Task name cell: the remove button sits at the right edge of the row header */
.hours-table .task-cell {
  position: relative;
  padding-right: calc(var(--size-touch) + var(--space-md));
}

.remove-task,
.task-remove-btn {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--size-touch);
  height: var(--size-touch);
  min-width: var(--size-touch);
  min-height: var(--size-touch);
  padding: 0;
  border: var(--size-border-strong) solid var(--color-primary);
  border-radius: var(--radius-lg);
  background-color: transparent;
  color: var(--color-primary);
  font-family: var(--font-body);
  font-size: var(--font-size-headline-sm);
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.remove-task:hover,
.task-remove-btn:hover {
  background-color: var(--color-brass-subtle);
  color: var(--color-on-brass-subtle);
}

.remove-task:active,
.task-remove-btn:active {
  transform: scale(0.96);
}

/* Disabled: dashed outline and muted text; the reason is written in .task-controls-reason */
.remove-task:disabled,
.task-remove-btn:disabled {
  border-style: dashed;
  border-color: var(--color-outline);
  background-color: var(--color-surface-container-high);
  color: var(--color-on-surface-variant);
  cursor: not-allowed;
  transform: none;
}

/* Add task button, count reason */
.task-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm) var(--space-md);
}

.add-task {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--size-touch);
  min-height: var(--size-touch);
  padding: var(--space-sm) var(--space-lg);
  border: var(--size-border-strong) solid var(--color-primary);
  border-radius: var(--radius-lg);
  background-color: transparent;
  color: var(--color-primary);
  font-family: var(--font-body);
  font-size: var(--font-size-label-lg);
  line-height: var(--line-height-label-lg);
  letter-spacing: var(--letter-spacing-label-lg);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  touch-action: manipulation;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.add-task:hover {
  background-color: var(--color-brass-subtle);
  color: var(--color-on-brass-subtle);
}

.add-task:active {
  transform: scale(0.96);
}

.add-task:disabled {
  border-style: dashed;
  border-color: var(--color-outline);
  background-color: var(--color-surface-container-high);
  color: var(--color-on-surface-variant);
  cursor: not-allowed;
  transform: none;
}

.task-controls-reason,
.deal-reason {
  max-width: 65ch;
  min-width: 0;
  color: var(--color-on-surface);
  font-size: var(--font-size-body-md);
  line-height: var(--line-height-body-md);
}

.task-controls-reason[hidden],
.deal-reason[hidden],
.cost-row[hidden] {
  display: none;
}

/* Deal reason sits under the controls, with a dashed border so it reads as a notice */
.deal-reason {
  padding: var(--space-sm) var(--space-md);
  border: var(--size-border) dashed var(--color-outline);
  border-radius: var(--radius);
  background-color: var(--color-surface-container-high);
}

#reset-btn,
#copy-link-btn {
  align-self: flex-start;
}

/* ---------- Import form and share link (built by render-table.js) ---------- */
.import-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm) var(--space-md);
  min-width: 0;
}

.import-label,
.link-field-label {
  flex: 1 0 100%;
  color: var(--color-on-surface);
  font-size: var(--font-size-label-lg);
  line-height: var(--line-height-label-lg);
  letter-spacing: var(--letter-spacing-label-lg);
  font-weight: var(--font-weight-semibold);
}

.import-input,
.link-field-input {
  flex: 1 1 calc(var(--size-touch) * 4);
  min-width: 0;
  min-height: var(--size-touch);
  padding: var(--space-xs) var(--space-sm);
  border: var(--size-border-strong) solid var(--color-outline);
  border-radius: var(--radius);
  background-color: var(--color-surface);
  color: var(--color-on-surface);
  font-family: var(--font-body);
  font-size: var(--font-size-body-md);
  line-height: var(--line-height-body-md);
  transition: border-color var(--duration-fast) var(--ease-out);
}

.import-input:hover,
.link-field-input:hover {
  border-color: var(--color-brass);
}

.import-input::placeholder {
  color: var(--color-on-surface-variant);
  opacity: 1;
}

.import-btn {
  flex: 0 0 auto;
}

/* Message: words with a dashed border, not color alone; wraps and never widens the page */
.import-message,
.copy-link-reason {
  flex: 1 0 100%;
  max-width: 65ch;
  min-width: 0;
  padding: var(--space-sm) var(--space-md);
  border: var(--size-border) dashed var(--color-outline);
  border-radius: var(--radius);
  background-color: var(--color-surface-container-high);
  color: var(--color-on-surface);
  font-size: var(--font-size-body-md);
  line-height: var(--line-height-body-md);
  overflow-wrap: anywhere;
}

.copy-link-reason {
  flex: 0 1 auto;
}

.link-copied-note {
  color: var(--color-on-surface);
  font-size: var(--font-size-body-md);
}
.link-copied-note[hidden],
.import-message[hidden],
.copy-link-reason[hidden],
.link-field[hidden] {
  display: none;
}

.link-field {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  min-width: 0;
}

.link-field-input {
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
}

/* Agent count wrapper (the buttons use .count-choice above) */
.agent-count,
#agent-count {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  min-width: 0;
}

/* Cost row: two text lines inside the headline block */
.cost-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-lg);
  max-width: 65ch;
  color: var(--color-on-surface-variant);
  font-size: var(--font-size-body-md);
  line-height: var(--line-height-body-md);
  font-variant-numeric: tabular-nums;
}

.cost-line {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: reduce) {

  .hours-table input,
  .import-input,
  .link-field-input,
  .remove-task,
  .task-remove-btn,
  .add-task {
    transition: none;
  }

  .remove-task:active,
  .task-remove-btn:active,
  .add-task:active {
    transform: none;
  }
}

/* ---------- Send to GitHub section (built by render-assign.js) ---------- */
.send-section {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-sm);
  min-width: 0;
  max-width: 65ch;
  padding: var(--space-md) var(--space-lg);
  border: var(--size-border) solid var(--color-outline-variant);
  border-radius: var(--radius-xl);
  background-color: var(--color-surface-container);
}

.send-section[hidden],
.send-status:empty {
  display: none;
}

.send-token-input {
  width: 100%;
  min-width: 0;
  min-height: var(--size-touch);
  padding: var(--space-xs) var(--space-sm);
  border: var(--size-border-strong) solid var(--color-outline);
  border-radius: var(--radius);
  background-color: var(--color-surface);
  color: var(--color-on-surface);
  font-family: var(--font-body);
  font-size: var(--font-size-body-md);
  line-height: var(--line-height-body-md);
  transition: border-color var(--duration-fast) var(--ease-out);
}

.send-token-input:hover {
  border-color: var(--color-brass);
}

.send-token-help {
  color: var(--color-on-surface-variant);
  font-size: var(--font-size-label-md);
  line-height: var(--line-height-label-md);
  letter-spacing: var(--letter-spacing-label-md);
  overflow-wrap: anywhere;
}

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

/* Status: words with a dashed border, not color alone; wraps at 360px */
.send-status {
  min-width: 0;
  padding: var(--space-sm) var(--space-md);
  border: var(--size-border) dashed var(--color-outline);
  border-radius: var(--radius);
  background-color: var(--color-surface-container-high);
  color: var(--color-on-surface);
  font-size: var(--font-size-body-md);
  line-height: var(--line-height-body-md);
  overflow-wrap: anywhere;
}

/* Agent label tag on an agent row, same look as .area-tag */
.agent-label-tag {
  display: inline-block;
  align-self: flex-start;
  max-width: 100%;
  padding: 0 var(--space-sm);
  border: var(--size-border) solid var(--color-outline);
  border-radius: var(--radius-sm);
  color: var(--color-on-surface-variant);
  font-size: var(--font-size-label-md);
  line-height: var(--line-height-label-md);
  letter-spacing: var(--letter-spacing-label-md);
  font-weight: var(--font-weight-medium);
  overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: reduce) {
  .send-token-input {
    transition: none;
  }
}
