/* ===========================================================================
   AEGIS -- Adverse Event Guided Intake System
   SPN Solutions Inc. for CDC | RFQ 75D301-26-Q-00146

   Design intent: a federal health system that feels current rather than
   ceremonial. White ground, CDC palette, dense but calm information design,
   and motion used only to explain change -- never for decoration.

   Accessibility is structural here, not a pass at the end:
     - every colour pair below is checked against WCAG 2.1 AA and the ratio is
       recorded next to it
     - focus is always visible, never suppressed
     - nothing conveys meaning by colour alone
     - all spacing is rem so 200% zoom reflows instead of clipping
     - motion collapses to nothing under prefers-reduced-motion
   ======================================================================== */

/* Design tokens live in tokens.css, loaded before this file. */


/* ===========================================================================
   Reset
   ======================================================================== */
*, *::before, *::after { box-sizing: border-box; }
/* No global smooth scrolling: it races the router's scroll reset and leaves
   a new view part-scrolled, which hides the government banner on load.
   Smooth behaviour is opted into per-call where it actually helps. */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1,h2,h3,h4,h5 { margin: 0; font-weight: 650; line-height: 1.22; letter-spacing: -.018em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.3rem); }
h2 { font-size: clamp(1.25rem, 1.05rem + .7vw, 1.6rem); }
h3 { font-size: 1.1rem; }
h4 { font-size: .95rem; }
p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }
a { color: var(--cdc-blue); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--cdc-blue-deep); }
img, svg { max-width: 100%; }
ul, ol { margin: 0 0 1rem; padding-left: 1.4rem; }
li { margin-bottom: .35rem; }
table { border-collapse: collapse; width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Focus: visible on everything, always. WCAG 2.4.7. */
:focus-visible {
  outline: 3px solid var(--cdc-blue-bright);
  outline-offset: 2px;
  border-radius: 3px;
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--cdc-blue-light); color: var(--cdc-blue-deep); }

/* WCAG 2.3.3 / 2.2.2 -- honour the operating system preference. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===========================================================================
   Utilities
   ======================================================================== */
.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;
}
.skip-link {
  position: absolute; left: .75rem; top: -100%; z-index: 200;
  background: var(--cdc-blue); color: #fff; padding: .7rem 1.2rem;
  border-radius: 0 0 var(--r) var(--r); font-weight: 600; text-decoration: none;
  transition: top var(--t-fast);
}
.skip-link:focus { top: 0; color: #fff; }

/* Inline icons. An SVG with no width/height stretches to fill a flex parent,
   so every icon gets an intrinsic size here rather than at each call site. */
.ico { width: 1.15rem; height: 1.15rem; flex: none; }
.ico-lg { width: 1.5rem; height: 1.5rem; }
.callout-title .ico, .card-title .ico, .msg .ico { width: 1.05rem; height: 1.05rem; }
.kpi-label .ico { width: .95rem; height: .95rem; }

.mono { font-family: var(--mono); font-size: .86em; letter-spacing: -.02em; }
.muted { color: var(--ink-3); }
.small { font-size: .8125rem; }
.tiny  { font-size: .75rem; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }
.stack > * + * { margin-top: var(--gap, 1rem); }
.row { display: flex; align-items: center; gap: .6rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ===========================================================================
   Application shell
   ======================================================================== */
.shell { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.shell.rail-collapsed { --rail: 4.25rem; }

/* --- Left rail --------------------------------------------------------- */
.rail {
  grid-row: 1 / -1;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  z-index: 40;
  transition: width var(--t);
}
.rail-brand {
  display: flex; align-items: center; gap: .7rem;
  padding: 1.1rem 1rem 1rem;
  border-bottom: 1px solid var(--line-soft);
  min-height: var(--topbar);
}
.rail-mark {
  width: 2.25rem; height: 2.25rem; flex: none; border-radius: 9px;
  background: linear-gradient(135deg, var(--cdc-blue) 0%, var(--cdc-teal-bright) 100%);
  display: grid; place-items: center;
  box-shadow: 0 3px 10px -3px rgba(7,82,144,.55);
  position: relative; overflow: hidden;
}
.rail-mark::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 40%, rgba(255,255,255,.35) 50%, transparent 60%);
  transform: translateX(-100%);
  animation: sheen 7s ease-in-out infinite;
}
@keyframes sheen { 0%,72% { transform: translateX(-100%);} 84%,100%{ transform: translateX(100%);} }
.rail-mark svg { width: 1.3rem; height: 1.3rem; color: #fff; }
.rail-word { min-width: 0; }
.rail-word b {
  display: block; font-size: 1.06rem; font-weight: 750; letter-spacing: .05em;
  color: var(--cdc-blue-deep); line-height: 1.1;
}
.rail-word span {
  display: block; font-size: .625rem; color: var(--ink-4);
  text-transform: uppercase; letter-spacing: .1em; font-weight: 600; margin-top: 1px;
}
.rail-collapsed .rail-word { display: none; }

.rail-nav { flex: 1; overflow-y: auto; padding: .75rem .625rem 1rem; }
.rail-group { margin-bottom: 1.1rem; }
.rail-group-label {
  font-size: .625rem; text-transform: uppercase; letter-spacing: .11em;
  color: var(--ink-4); font-weight: 700; padding: 0 .625rem .4rem;
}
.rail-collapsed .rail-group-label { opacity: 0; height: .6rem; overflow: hidden; }

.rail-link {
  display: flex; align-items: center; gap: .7rem;
  padding: .58rem .625rem; border-radius: var(--r-sm);
  color: var(--ink-2); text-decoration: none; font-size: .875rem; font-weight: 520;
  position: relative; transition: background var(--t-fast), color var(--t-fast);
  min-height: 2.5rem;
}
.rail-link:hover { background: var(--surface-2); color: var(--cdc-blue); }
.rail-link .ico { flex: none; width: 1.15rem; height: 1.15rem; opacity: .78; }
.rail-link[aria-current="page"] {
  background: var(--cdc-blue-wash); color: var(--cdc-blue-deep); font-weight: 640;
}
.rail-link[aria-current="page"] .ico { opacity: 1; }
.rail-link[aria-current="page"]::before {
  content: ""; position: absolute; left: -.625rem; top: 50%; transform: translateY(-50%);
  width: 3px; height: 1.5rem; border-radius: 0 3px 3px 0; background: var(--cdc-blue);
}
.rail-link .txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-collapsed .rail-link .txt { display: none; }
.rail-collapsed .rail-link { justify-content: center; padding-inline: 0; }
.rail-badge {
  margin-left: auto; font-size: .625rem; font-weight: 700; padding: .1rem .4rem;
  border-radius: 99px; background: var(--cdc-gold-wash); color: var(--cdc-gold);
  border: 1px solid rgba(138,90,0,.2);
}
.rail-collapsed .rail-badge { display: none; }

.rail-foot { padding: .75rem; border-top: 1px solid var(--line-soft); }
.rail-foot img { width: 100%; max-width: 9.5rem; opacity: .9; }
.rail-collapsed .rail-foot img { display: none; }

/* --- Top bar ----------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.5rem; min-height: var(--topbar);
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { min-width: 0; }
.topbar-title b { display: block; font-size: .95rem; font-weight: 650; letter-spacing: -.01em; }
.topbar-title span { display: block; font-size: .75rem; color: var(--ink-3); }

.icon-btn {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; flex: none;
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm);
  cursor: pointer; color: var(--ink-2); transition: all var(--t-fast);
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--cdc-blue-light); color: var(--cdc-blue); }
.icon-btn svg { width: 1.1rem; height: 1.1rem; }

/* --- Main -------------------------------------------------------------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.view { padding: 1.75rem 1.5rem 4rem; max-width: 96rem; width: 100%; margin: 0 auto; }
.view-head { margin-bottom: 1.5rem; }
.view-eyebrow {
  font-size: .6875rem; text-transform: uppercase; letter-spacing: .12em;
  font-weight: 700; color: var(--cdc-teal); margin-bottom: .45rem;
  display: flex; align-items: center; gap: .5rem;
}
.view-eyebrow::after {
  content: ""; height: 1px; flex: 1;
  background: linear-gradient(90deg, var(--cdc-blue-light), transparent);
}
.view-lede { color: var(--ink-3); max-width: 62ch; margin-top: .6rem; font-size: 1.0625rem; }

/* ===========================================================================
   Cards, panels, grids
   ======================================================================== */
.grid { display: grid; gap: 1rem; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12.5rem), 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1.25rem;
  box-shadow: var(--sh-1); position: relative;
}
.card-pad-0 { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: .9rem;
}
.card-title { font-size: .95rem; font-weight: 650; letter-spacing: -.01em; }
.card-sub { font-size: .8125rem; color: var(--ink-3); margin-top: .15rem; }

/* Interactive cards -- the "everything drills down" affordance. */
.card-link {
  cursor: pointer; text-align: left; width: 100%; font: inherit; color: inherit;
  transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast);
}
.card-link:hover { transform: translateY(-2px); box-shadow: var(--sh-3); border-color: var(--cdc-blue-light); }
.card-link:active { transform: translateY(0); }
.card-link::after {
  content: "→"; position: absolute; right: 1.1rem; top: 1.1rem;
  color: var(--cdc-blue-bright); opacity: 0; transform: translateX(-4px);
  transition: all var(--t-fast); font-size: 1rem;
}
.card-link:hover::after, .card-link:focus-visible::after { opacity: 1; transform: translateX(0); }

/* A hairline of colour at the top of a card, used to group by domain. */
.card-accent::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 3px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: linear-gradient(90deg, var(--cdc-blue), var(--cdc-teal-bright));
}
.card-accent { padding-top: 1.4rem; }

/* ===========================================================================
   KPI tiles
   ======================================================================== */
.kpi { display: flex; flex-direction: column; gap: .3rem; }
.kpi-label {
  font-size: .6875rem; text-transform: uppercase; letter-spacing: .09em;
  font-weight: 700; color: var(--ink-4);
  display: flex; align-items: center; gap: .35rem;
}
.kpi-value {
  font-size: clamp(1.6rem, 1.3rem + 1vw, 2.15rem); font-weight: 700;
  letter-spacing: -.03em; color: var(--cdc-blue-deep); line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.kpi-value.is-good { color: var(--cdc-green); }
.kpi-value.is-warn { color: var(--cdc-gold); }
.kpi-value.is-bad  { color: var(--cdc-red); }
.kpi-meta { font-size: .75rem; color: var(--ink-3); }
.kpi-spark { margin-top: .4rem; height: 2.25rem; }

/* ===========================================================================
   Status chips -- shape + word, never colour alone (WCAG 1.4.1)
   ======================================================================== */
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .18rem .55rem; border-radius: 99px;
  font-size: .6875rem; font-weight: 700; letter-spacing: .02em;
  border: 1px solid transparent; white-space: nowrap;
}
.chip::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; flex: none; }
.chip-ok    { background: var(--cdc-green-wash); color: var(--cdc-green); border-color: rgba(31,122,61,.22); }
.chip-warn  { background: var(--cdc-gold-wash);  color: var(--cdc-gold);  border-color: rgba(138,90,0,.22); }
.chip-bad   { background: var(--cdc-red-wash);   color: var(--cdc-red);   border-color: rgba(196,18,48,.22); }
.chip-info  { background: var(--cdc-blue-wash);  color: var(--cdc-blue);  border-color: rgba(7,82,144,.2); }
.chip-neutral { background: var(--surface-2); color: var(--ink-3); border-color: var(--line); }
.chip-plain::before { display: none; }

/* ===========================================================================
   Buttons
   ======================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .65rem 1.15rem; min-height: 2.75rem;   /* 44px target, WCAG 2.5.5 */
  border-radius: var(--r-sm); border: 1px solid transparent;
  font-size: .875rem; font-weight: 620; cursor: pointer; text-decoration: none;
  transition: all var(--t-fast); white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 1.05rem; height: 1.05rem; flex: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--cdc-blue) 0%, #0a63ab 100%);
  color: #fff; box-shadow: 0 2px 8px -2px rgba(7,82,144,.5);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--cdc-blue-deep) 0%, var(--cdc-blue) 100%);
  box-shadow: 0 6px 18px -5px rgba(7,82,144,.6); transform: translateY(-1px); color: #fff;
}
.btn-secondary { background: var(--surface); color: var(--cdc-blue); border-color: var(--line); }
.btn-secondary:hover:not(:disabled) { background: var(--cdc-blue-wash); border-color: var(--cdc-blue-light); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--cdc-blue); }
.btn-danger { background: var(--cdc-red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #a30f28; color: #fff; }
.btn-sm { padding: .4rem .75rem; min-height: 2.25rem; font-size: .8125rem; }
.btn-lg { padding: .85rem 1.6rem; min-height: 3.25rem; font-size: 1rem; }
.btn-block { width: 100%; }

/* ===========================================================================
   Tooltips -- hover AND keyboard focus (WCAG 1.4.13)
   Every domain term in this system carries one.
   ======================================================================== */
.tip { position: relative; display: inline-flex; align-items: center; gap: .25rem; }
.tip-trigger {
  display: inline-grid; place-items: center;
  width: 1.05rem; height: 1.05rem; border-radius: 50%;
  background: var(--cdc-blue-wash); color: var(--cdc-blue);
  border: 1px solid rgba(7,82,144,.28);
  font-size: .625rem; font-weight: 800; cursor: help; flex: none; padding: 0;
  transition: all var(--t-fast); line-height: 1;
}
.tip-trigger:hover, .tip-trigger:focus-visible { background: var(--cdc-blue); color: #fff; }

.tip-bubble {
  position: fixed; z-index: 300; max-width: 24rem;
  background: var(--cdc-blue-deep); color: #fff;
  padding: .7rem .85rem; border-radius: var(--r-sm);
  font-size: .8125rem; line-height: 1.5; font-weight: 400;
  box-shadow: 0 12px 32px -10px rgba(4,54,95,.7);
  pointer-events: none; opacity: 0; transform: translateY(4px);
  transition: opacity var(--t-fast), transform var(--t-fast);
}
.tip-bubble.is-open { opacity: 1; transform: translateY(0); }
.tip-bubble b { color: var(--cdc-blue-light); font-weight: 700; }
.tip-bubble .tip-tag {
  display: block; margin-top: .4rem; padding-top: .4rem;
  border-top: 1px solid rgba(136,195,234,.28);
  font-family: var(--mono); font-size: .6875rem; color: var(--cdc-blue-light);
}

/* Any element can be a tooltip host without an icon. */
.has-tip { border-bottom: 1px dotted var(--cdc-blue-light); cursor: help; }

/* ===========================================================================
   Forms
   ======================================================================== */
.field { margin-bottom: 1.35rem; }
.field-label {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  font-size: .9375rem; font-weight: 620; margin-bottom: .3rem; color: var(--ink);
}
.field-req { color: var(--cdc-red); font-weight: 700; }
.field-opt { font-size: .75rem; color: var(--ink-4); font-weight: 500; }
.field-help { font-size: .8125rem; color: var(--ink-3); margin-bottom: .5rem; line-height: 1.5; }

.input, .select, .textarea {
  width: 100%; padding: .7rem .85rem; min-height: 2.875rem;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  font-size: 1rem;   /* 16px prevents iOS zoom-on-focus */
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--cdc-blue-light); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--cdc-blue-bright); box-shadow: var(--sh-focus);
}
.textarea { min-height: 7rem; resize: vertical; line-height: 1.6; }
.select {
  appearance: none; padding-right: 2.4rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%235b6472'%3E%3Cpath d='M4.2 6.2a1 1 0 0 1 1.4 0L8 8.6l2.4-2.4a1 1 0 1 1 1.4 1.4l-3.1 3.1a1 1 0 0 1-1.4 0L4.2 7.6a1 1 0 0 1 0-1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .8rem center; background-size: 1rem;
}
.input.is-error, .select.is-error, .textarea.is-error {
  border-color: var(--cdc-red); box-shadow: 0 0 0 3px rgba(196,18,48,.13);
}
.input-counter { font-size: .75rem; color: var(--ink-4); text-align: right; margin-top: .25rem; font-variant-numeric: tabular-nums; }

/* Radio / checkbox */
.opt-list { display: flex; flex-direction: column; gap: .5rem; }
.opt-list.is-inline { flex-direction: row; flex-wrap: wrap; }
.opt {
  display: flex; align-items: flex-start; gap: .65rem;
  padding: .7rem .85rem; border: 1px solid var(--line); border-radius: var(--r-sm);
  cursor: pointer; transition: all var(--t-fast); background: var(--surface);
  min-height: 2.75rem;
}
.opt:hover { border-color: var(--cdc-blue-light); background: var(--surface-2); }
.opt input { margin: .2rem 0 0; width: 1.1rem; height: 1.1rem; accent-color: var(--cdc-blue); flex: none; cursor: pointer; }
.opt:has(input:checked) { border-color: var(--cdc-blue); background: var(--cdc-blue-wash); }
.opt:has(input:focus-visible) { outline: 3px solid var(--cdc-blue-bright); outline-offset: 2px; }
.opt-text { font-size: .9375rem; }
.opt-desc { font-size: .8125rem; color: var(--ink-3); margin-top: .15rem; }

/* Large choice cards -- the branching drivers */
.cards-choice { display: grid; gap: .85rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.choice {
  position: relative; display: flex; flex-direction: column; gap: .4rem;
  padding: 1.25rem; border: 2px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); cursor: pointer; transition: all var(--t);
  text-align: left;
}
.choice:hover { border-color: var(--cdc-blue-light); box-shadow: var(--sh-2); transform: translateY(-2px); }
.choice:has(input:checked) {
  border-color: var(--cdc-blue); background: var(--cdc-blue-wash);
  box-shadow: 0 8px 24px -10px rgba(7,82,144,.42);
}
.choice:has(input:focus-visible) { outline: 3px solid var(--cdc-blue-bright); outline-offset: 3px; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice-title { font-size: 1rem; font-weight: 650; color: var(--cdc-blue-deep); padding-right: 1.75rem; }
.choice-desc { font-size: .875rem; color: var(--ink-3); line-height: 1.5; }
.choice-check {
  position: absolute; top: 1.25rem; right: 1.25rem;
  width: 1.35rem; height: 1.35rem; border-radius: 50%;
  border: 2px solid var(--line); display: grid; place-items: center; transition: all var(--t-fast);
}
.choice:has(input:checked) .choice-check { border-color: var(--cdc-blue); background: var(--cdc-blue); }
.choice:has(input:checked) .choice-check::after {
  content: ""; width: .42rem; height: .72rem; border: solid #fff;
  border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px,-1px);
}
.choice-badge {
  align-self: flex-start; margin-top: .3rem;
  font-size: .6875rem; font-weight: 700; padding: .2rem .55rem; border-radius: 99px;
  background: var(--cdc-teal); color: #fff;
}

/* Inline validation messages */
.msg { display: flex; align-items: flex-start; gap: .5rem; padding: .6rem .75rem; border-radius: var(--r-sm); font-size: .8125rem; line-height: 1.5; margin-top: .5rem; }
.msg svg { width: 1rem; height: 1rem; flex: none; margin-top: .15rem; }
.msg-error { background: var(--cdc-red-wash); color: #8a0d22; border: 1px solid rgba(196,18,48,.25); }
.msg-warn  { background: var(--cdc-gold-wash); color: #6b4600; border: 1px solid rgba(138,90,0,.25); }
.msg-hint  { background: var(--cdc-blue-wash); color: var(--cdc-blue-deep); border: 1px solid rgba(7,82,144,.2); }
.msg-ok    { background: var(--cdc-green-wash); color: #145c2c; border: 1px solid rgba(31,122,61,.25); }

/* ===========================================================================
   Stepper
   ======================================================================== */
.stepper { display: flex; gap: .35rem; margin-bottom: 1.5rem; overflow-x: auto; padding-bottom: .35rem; }
.step {
  display: flex; align-items: center; gap: .5rem; padding: .5rem .8rem;
  border-radius: 99px; font-size: .8125rem; font-weight: 600; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-3);
  cursor: pointer; transition: all var(--t-fast); min-height: 2.5rem;
}
.step:hover:not(:disabled) { border-color: var(--cdc-blue-light); color: var(--cdc-blue); }
.step:disabled { opacity: .45; cursor: not-allowed; }
.step-n {
  width: 1.35rem; height: 1.35rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); color: var(--ink-3); font-size: .6875rem; font-weight: 700; flex: none;
}
.step[aria-current="step"] { background: var(--cdc-blue); border-color: var(--cdc-blue); color: #fff; }
.step[aria-current="step"] .step-n { background: rgba(255,255,255,.25); color: #fff; }
.step.is-done { border-color: rgba(31,122,61,.35); color: var(--cdc-green); background: var(--cdc-green-wash); }
.step.is-done .step-n { background: var(--cdc-green); color: #fff; }

/* Progress */
.progress { height: .45rem; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress-bar {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--cdc-blue), var(--cdc-teal-bright));
  transition: width var(--t-slow);
}

/* ===========================================================================
   Tables
   ======================================================================== */
.table-wrap { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.table-scroll { overflow-x: auto; }
table.data { font-size: .8125rem; }
table.data thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2); text-align: left; font-weight: 700;
  font-size: .6875rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3);
  padding: .7rem .85rem; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: .65rem .85rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background var(--t-fast); }
table.data tbody tr:hover { background: var(--cdc-blue-wash); }
table.data tbody tr.is-clickable { cursor: pointer; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }

/* ===========================================================================
   Charts (hand-built SVG -- no external chart library, which keeps the CSP
   strict and the page weight low enough to hold the 3-second target)
   ======================================================================== */
.chart { width: 100%; display: block; overflow: visible; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .grid-line { stroke: var(--line-soft); stroke-width: 1; }
.chart .lbl { font-size: 10px; fill: var(--ink-4); font-family: var(--sans); }
.chart .lbl-strong { font-size: 11px; fill: var(--ink-2); font-weight: 600; }
.chart .bar { transition: opacity var(--t-fast); }
.chart .bar:hover { opacity: .78; }
.chart .line { fill: none; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.chart .dot { transition: r var(--t-fast); }

.legend { display: flex; flex-wrap: wrap; gap: .9rem; font-size: .75rem; color: var(--ink-3); margin-top: .6rem; }
.legend-item { display: flex; align-items: center; gap: .35rem; }
.legend-swatch { width: .7rem; height: .7rem; border-radius: 2px; flex: none; }

/* Horizontal bar list -- used for distributions */
.hbar { display: grid; grid-template-columns: minmax(6rem, 10rem) 1fr auto; gap: .65rem; align-items: center; padding: .3rem 0; }
.hbar-label { font-size: .8125rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: .6rem; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--cdc-blue), var(--cdc-blue-bright)); transition: width var(--t-slow); }
.hbar-val { font-size: .75rem; font-family: var(--mono); color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ===========================================================================
   Modal
   ======================================================================== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(4,54,95,.42); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 1.25rem;
  animation: fade var(--t) both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: var(--r-xl);
  max-width: 56rem; width: 100%; max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: 0 32px 80px -24px rgba(4,54,95,.5);
  animation: pop var(--t-slow) both;
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.35rem 1.5rem 1rem; border-bottom: 1px solid var(--line); }
.modal-body { padding: 1.5rem; overflow-y: auto; }
.modal-foot { padding: 1rem 1.5rem; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: .6rem; flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.modal-sm { max-width: 34rem; }
.modal-lg { max-width: 76rem; }

/* ===========================================================================
   Toast
   ======================================================================== */
.toasts { position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 500; display: flex; flex-direction: column; gap: .6rem; max-width: 24rem; }
.toast {
  display: flex; align-items: flex-start; gap: .65rem;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--cdc-blue);
  border-radius: var(--r); padding: .85rem 1rem; box-shadow: var(--sh-3);
  font-size: .875rem; animation: slidein var(--t-slow) both;
}
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.toast.is-ok  { border-left-color: var(--cdc-green); }
.toast.is-bad { border-left-color: var(--cdc-red); }
.toast.is-warn{ border-left-color: var(--cdc-gold); }

/* ===========================================================================
   Public-facing experience
   ======================================================================== */
.pub { background: var(--surface); }
.pub-band {
  background: var(--cdc-blue-deep); color: #fff; font-size: .75rem;
  padding: .45rem 1.5rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
}
.pub-band svg { width: .95rem; height: .95rem; flex: none; }

.pub-header {
  display: flex; align-items: center; gap: 1rem; padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.pub-nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.pub-nav a {
  padding: .5rem .8rem; border-radius: var(--r-sm); font-size: .875rem; font-weight: 560;
  color: var(--ink-2); text-decoration: none; transition: all var(--t-fast); min-height: 2.5rem;
  display: inline-flex; align-items: center;
}
.pub-nav a:hover { background: var(--cdc-blue-wash); color: var(--cdc-blue); }

.hero {
  position: relative; overflow: hidden;
  padding: clamp(2.5rem, 6vw, 4.5rem) 1.5rem;
  background:
    radial-gradient(1100px 460px at 12% -10%, rgba(136,195,234,.22), transparent 62%),
    radial-gradient(900px 420px at 92% 8%, rgba(0,163,173,.15), transparent 60%),
    var(--surface);
}
/* Faint engineering grid -- reads as instrumentation, not decoration. */
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(7,82,144,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(7,82,144,.045) 1px, transparent 1px);
  background-size: 3rem 3rem;
  mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 72%);
}
.hero-inner { position: relative; max-width: 74rem; margin: 0 auto; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .6875rem; text-transform: uppercase; letter-spacing: .13em; font-weight: 750;
  color: var(--cdc-teal); background: rgba(0,123,138,.09);
  padding: .35rem .75rem; border-radius: 99px; border: 1px solid rgba(0,123,138,.2);
  margin-bottom: 1.1rem;
}
.hero-eyebrow .pulse {
  width: .45rem; height: .45rem; border-radius: 50%; background: var(--cdc-teal-bright);
  box-shadow: 0 0 0 0 rgba(0,163,173,.7); animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0,163,173,.55); }
  70% { box-shadow: 0 0 0 .5rem rgba(0,163,173,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,163,173,0); }
}
.hero h1 { max-width: 20ch; margin-bottom: 1rem; }
.hero-sub { font-size: clamp(1rem, .95rem + .35vw, 1.1875rem); color: var(--ink-2); max-width: 58ch; margin-bottom: 1.5rem; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.hero-note { font-size: .875rem; color: var(--ink-3); display: flex; align-items: center; gap: .45rem; }

/* ===========================================================================
   Misc components
   ======================================================================== */
.callout {
  border: 1px solid var(--line); border-left: 3px solid var(--cdc-blue);
  background: var(--surface-2); border-radius: var(--r); padding: 1rem 1.15rem;
  font-size: .875rem; line-height: 1.6;
}
.callout-title { font-weight: 680; margin-bottom: .35rem; display: flex; align-items: center; gap: .45rem; }
.callout-teal { border-left-color: var(--cdc-teal); }
.callout-gold { border-left-color: var(--cdc-gold-bright); background: var(--cdc-gold-wash); }
.callout-red  { border-left-color: var(--cdc-red); background: var(--cdc-red-wash); }
.callout-green{ border-left-color: var(--cdc-green); background: var(--cdc-green-wash); }

.kv { display: grid; grid-template-columns: minmax(8rem, 14rem) 1fr; gap: .5rem 1rem; font-size: .875rem; }
.kv dt { color: var(--ink-3); font-weight: 560; }
.kv dd { margin: 0; color: var(--ink); }

.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; overflow-x: auto; }
.tab {
  padding: .7rem 1rem; border: none; background: none; cursor: pointer;
  font-size: .875rem; font-weight: 600; color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  transition: all var(--t-fast); min-height: 2.75rem;
}
.tab:hover { color: var(--cdc-blue); }
.tab[aria-selected="true"] { color: var(--cdc-blue); border-bottom-color: var(--cdc-blue); }

.code {
  font-family: var(--mono); font-size: .8125rem; line-height: 1.65;
  background: #04365f; color: #d7e9f7; padding: 1rem 1.15rem;
  border-radius: var(--r); overflow-x: auto; white-space: pre;
}
.code .k { color: #88c3ea; } .code .s { color: #9fe0c0; } .code .c { color: #7d9bb5; font-style: italic; }

.rule-expr {
  font-family: var(--mono); font-size: .75rem; background: var(--cdc-blue-wash);
  color: var(--cdc-blue-deep); padding: .18rem .45rem; border-radius: 4px;
  border: 1px solid rgba(7,82,144,.18); word-break: break-word;
}

.empty { text-align: center; padding: 3rem 1.5rem; color: var(--ink-3); }
.empty svg { width: 2.75rem; height: 2.75rem; opacity: .3; margin-bottom: .75rem; }

.spinner {
  width: 1.15rem; height: 1.15rem; border: 2px solid var(--line);
  border-top-color: var(--cdc-blue); border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; gap: .65rem; padding: 3rem; color: var(--ink-3); }

/* Sign-in */
.signin-page {
  min-height: 100vh; display: grid; grid-template-columns: 1fr; place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(900px 460px at 15% 0%, rgba(136,195,234,.24), transparent 60%),
    radial-gradient(760px 400px at 88% 100%, rgba(0,163,173,.15), transparent 58%),
    var(--surface);
}
.signin-card {
  width: 100%; max-width: 27rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: 2.25rem; box-shadow: var(--sh-3);
}
.signin-brand { display: flex; align-items: center; gap: .85rem; margin-bottom: 1.75rem; }

/* ===========================================================================
   Responsive -- PRS#2
   ======================================================================== */
@media (max-width: 1024px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: fixed; left: 0; top: 0; width: min(19rem, 86vw); height: 100dvh;
    transform: translateX(-102%); transition: transform var(--t);
    box-shadow: var(--sh-3);
  }
  .rail.is-open { transform: none; }
  .rail-scrim {
    position: fixed; inset: 0; background: rgba(4,54,95,.4); z-index: 35;
    animation: fade var(--t) both;
  }
  .shell.rail-collapsed { --rail: 17rem; }
}
@media (min-width: 1025px) { .rail-scrim, .rail-toggle-mobile { display: none; } }

@media (max-width: 640px) {
  .view { padding: 1.25rem 1rem 3rem; }
  .topbar { padding: 0 1rem; }
  .card { padding: 1rem; border-radius: var(--r); }
  .kv { grid-template-columns: 1fr; gap: .15rem .5rem; }
  .kv dd { margin-bottom: .6rem; }
  .hero { padding: 2rem 1rem 2.5rem; }
  .btn { width: auto; }
  .hero-actions .btn { flex: 1 1 100%; }
  .modal { max-height: 94vh; border-radius: var(--r-lg); }
}

/* ===========================================================================
   Print -- evaluators print evidence
   ======================================================================== */
@media print {
  .rail, .topbar, .toasts, .btn, .tip-trigger { display: none !important; }
  .shell { grid-template-columns: 1fr; }
  .card { break-inside: avoid; box-shadow: none; border-color: #999; }
  body { font-size: 11pt; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
}

/* Forced-colors (Windows High Contrast) -- keep structure legible. */
@media (forced-colors: active) {
  .card, .btn, .input, .select, .textarea, .opt, .choice { border: 1px solid ButtonBorder; }
  .chip::before { forced-color-adjust: none; }
  .progress-bar, .hbar-fill { forced-color-adjust: none; background: Highlight; }
}

/* ===========================================================================
   Command palette (Ctrl/Cmd+K)
   ======================================================================== */
.palette-trigger {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem .6rem .45rem .7rem; min-height: 2.5rem;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--ink-3);
  font-size: .8125rem; cursor: pointer; transition: all var(--t-fast);
}
.palette-trigger:hover { border-color: var(--cdc-blue-light); color: var(--cdc-blue); background: var(--cdc-blue-wash); }
.palette-trigger .ico { width: .95rem; height: .95rem; }
.palette-trigger kbd {
  font-family: var(--sans); font-size: .6875rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 4px; padding: .1rem .35rem; color: var(--ink-4);
}
@media (max-width: 900px) { .palette-trigger-label, .palette-trigger kbd { display: none; } }

.palette-backdrop {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(4,54,95,.38); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: min(14vh, 7rem) 1rem 1rem;
  animation: fade var(--t) both;
}
.palette {
  width: 100%; max-width: 40rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: 0 32px 80px -24px rgba(4,54,95,.55);
  display: flex; flex-direction: column; overflow: hidden;
  animation: pop var(--t-slow) both;
}
.palette-head {
  display: flex; align-items: center; gap: .65rem;
  padding: .9rem 1rem; border-bottom: 1px solid var(--line);
  color: var(--ink-3);
}
.palette-input {
  flex: 1; border: none; outline: none; background: none;
  font-size: 1rem; color: var(--ink); padding: 0;
}
.palette-input::placeholder { color: var(--ink-4); }
.palette-list { max-height: min(52vh, 26rem); overflow-y: auto; padding: .4rem; }
.palette-group {
  font-size: .625rem; text-transform: uppercase; letter-spacing: .11em;
  font-weight: 700; color: var(--ink-4); padding: .6rem .65rem .3rem;
}
.palette-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem .65rem; border-radius: var(--r-sm); cursor: pointer;
  color: var(--ink-2); min-height: 2.5rem;
}
.palette-item.is-active { background: var(--cdc-blue-wash); color: var(--cdc-blue-deep); }
.palette-item.is-active .ico { color: var(--cdc-blue); }
.palette-label { flex: 1; font-size: .875rem; font-weight: 550; }
.palette-hint { font-size: .75rem; color: var(--ink-4); font-family: var(--mono); }
.palette-empty { padding: 2rem; text-align: center; color: var(--ink-4); font-size: .875rem; }
.palette-foot {
  display: flex; gap: 1.1rem; padding: .6rem 1rem;
  border-top: 1px solid var(--line-soft); background: var(--surface-2);
  font-size: .6875rem; color: var(--ink-4);
}
.palette-foot kbd {
  font-family: var(--sans); font-weight: 600;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 3px; padding: 0 .25rem; margin-right: .2rem;
}

/* ===========================================================================
   Drop zone
   ======================================================================== */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .4rem; padding: 1.75rem 1.25rem; cursor: pointer;
  border: 2px dashed var(--line); border-radius: var(--r-lg);
  background: var(--surface-2); color: var(--ink-3);
  transition: all var(--t-fast); text-align: center;
}
.dropzone:hover { border-color: var(--cdc-blue-light); background: var(--cdc-blue-wash); color: var(--cdc-blue); }
.dropzone.is-over {
  border-color: var(--cdc-blue); background: var(--cdc-blue-wash); color: var(--cdc-blue-deep);
  transform: scale(1.01);
}
.dropzone .ico { color: var(--cdc-blue); opacity: .7; }
.dropzone-main { font-size: .9375rem; font-weight: 600; color: var(--ink); }
.dropzone-sub { font-size: .75rem; color: var(--ink-4); }
/* The visually-hidden file input still receives focus, so show the ring here. */
.sr-only:focus-visible + .dropzone { outline: 3px solid var(--cdc-blue-bright); outline-offset: 2px; }

/* ===========================================================================
   Chart readout (crosshair value display)
   ======================================================================== */
.chart-wrap { position: relative; }
.chart-readout {
  position: absolute; top: .4rem; right: .4rem;
  background: rgba(255,255,255,.96); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: .5rem .65rem;
  font-size: .75rem; line-height: 1.5; pointer-events: none;
  box-shadow: var(--sh-2); min-width: 8rem;
  backdrop-filter: blur(4px);
}
.chart-readout b { display: block; color: var(--cdc-blue-deep); font-size: .6875rem;
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: .25rem; }
.chart-readout-row { display: flex; align-items: center; gap: .35rem; color: var(--ink-2); }
.chart-readout-row b { display: inline; text-transform: none; letter-spacing: 0;
  font-family: var(--mono); margin: 0; font-size: .75rem; }
