:root {
  --ink: #172033;
  --muted: #667085;
  --paper: #fbf8f2;
  --surface: #ffffff;
  --line: #d9d5ca;
  --control-line: #8a8a8a;
  --indigo: #284fa3;
  --indigo-strong: #1d3f89;
  --terracotta: #b9573d;
  --terracotta-text: #a94530;
  --success: #17603d;
  --danger: #a33232;
  --radius: 16px;
  --shadow: 0 16px 40px rgb(31 41 55 / 9%);
}

* { box-sizing: border-box; }

body {
  min-width: 0;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
a { color: var(--indigo-strong); }

.tracker-shell {
  width: min(100% - 32px, 980px);
  margin: 0 auto;
  padding: 28px 0 48px;
}

.tracker-header { margin-bottom: 28px; }
.eyebrow {
  margin: 0 0 6px;
  color: var(--terracotta-text);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.tracker-title, .page-title { margin: 0; font-size: clamp(2rem, 7vw, 3.25rem); line-height: 1.08; }
.tracker-intro, .page-intro, .hint { color: var(--muted); }

.workflow-choices { display: grid; gap: 16px; }
.workflow-card, .choice-card, .form-panel, .summary-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.workflow-card, .choice-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  color: inherit;
  text-decoration: none;
}
.workflow-card:hover, .choice-card:hover { border-color: var(--indigo); }
.workflow-icon, .choice-card__icon {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 12px;
  background: #e9edfa;
  color: var(--indigo-strong);
  font-size: 1.35rem;
}

.form-panel { padding: 20px; }
fieldset.form-section {
  min-inline-size: 0;
  max-width: 100%;
  margin: 0;
  padding: clamp(16px, 3vw, 24px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
fieldset.form-section > legend {
  max-width: 100%;
  margin: 0;
  padding: 0 .35rem;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.form-section + .form-section { margin-top: 24px; }
.form-panel > section.form-section { padding-top: 24px; border-top: 1px solid var(--line); }
.form-section h2 { margin: 0 0 14px; font-size: 1.2rem; }
.field-grid { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; color: var(--ink); font-weight: 700; }
.field input, .field select, .field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--control-line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  padding: 11px 12px;
}
.field textarea { min-height: 112px; resize: vertical; }

.segmented-control { display: flex; flex-wrap: wrap; gap: 8px; }
.segmented-control label { cursor: pointer; }
.segmented-control input { position: absolute; opacity: 0; }
.segmented-control span {
  display: block;
  border: 1px solid var(--control-line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  font-weight: 700;
}
.segmented-control input:checked + span { border-color: var(--indigo); background: #e9edfa; color: var(--indigo-strong); }
.segmented-control input:focus-visible + span {
  outline: 3px solid var(--terracotta);
  outline-offset: 3px;
}

.participant-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.participant-tile { position: relative; cursor: pointer; }
.participant-tile input { position: absolute; opacity: 0; }
.participant-tile span {
  display: block;
  overflow-wrap: anywhere;
  border: 1px solid var(--control-line);
  border-radius: 10px;
  padding: 11px;
  background: var(--surface);
  font-weight: 700;
}
.participant-tile input:checked + span { border-color: var(--indigo); background: #e9edfa; color: var(--indigo-strong); }
.participant-tile input:focus-visible + span {
  outline: 3px solid var(--terracotta);
  outline-offset: 3px;
}

.summary-card { padding: 18px; }
.summary-card h2 { margin-top: 0; font-size: 1rem; }
.status { margin-top: 16px; border-radius: 10px; padding: 12px; }
.status--success { background: #e7f5ed; color: var(--success); }
.status--error { background: #fbe9e8; color: var(--danger); }
.status--info { background: #e9edfa; color: var(--indigo-strong); }

.button, .button-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  background: var(--indigo);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}
.button:hover, .button-primary:hover { background: var(--indigo-strong); }
.button:disabled, .button[aria-busy="true"], .button-primary:disabled, .button-primary[aria-busy="true"] { cursor: wait; opacity: .65; }
.button[aria-busy="true"]::after, .button-primary[aria-busy="true"]::after { content: "…"; margin-left: .25em; }

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

.back-link { display: inline-block; margin-bottom: 22px; font-weight: 750; text-decoration: none; }
.section-help { margin: 0 0 16px; color: var(--muted); }
.button-secondary { margin: 0 0 14px; min-height: 42px; border: 1px solid var(--control-line); border-radius: 10px; padding: 9px 12px; background: var(--surface); color: var(--indigo-strong); font-weight: 750; cursor: pointer; }
.analytics-grid { display: grid; gap: 14px; margin: 20px 0; }
.analytics-grid ul { margin: 0; padding-left: 20px; }
.table-section { margin-top: 24px; padding: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.table-section h2 { margin: 0 0 14px; font-size: 1.1rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
th { color: var(--muted); font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; }
.empty { color: var(--muted); }

@media (min-width: 720px) {
  .tracker-shell { padding-top: 48px; }
  .workflow-choices, .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field--full, .field--wide { grid-column: 1 / -1; }
  .participant-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
