/*
 * HBV HF21 Top Design Foundation S1
 * Presentation, accessibility and decision-context layer only.
 * No API, algorithm, database, authorization or export-gate semantics are changed here.
 */
:root[data-hbv-hf21="s1"] {
  --hf21-brand: #155eef;
  --hf21-brand-strong: #0b3fb5;
  --hf21-brand-soft: #eaf2ff;
  --hf21-cyan: #0f8ea8;
  --hf21-ink: #10213a;
  --hf21-muted: #64748b;
  --hf21-line: #dbe5f2;
  --hf21-surface: #ffffff;
  --hf21-canvas: #f4f7fb;
  --hf21-success: #14845d;
  --hf21-warning: #b56b08;
  --hf21-danger: #c63b35;
  --hf21-radius: 14px;
  --hf21-shadow: 0 10px 28px rgba(32, 62, 104, .08);
}

html[data-hbv-hf21="s1"] body {
  background: var(--hf21-canvas);
}

/* Persistent six-step decision journey */
.hf21-journey-rail {
  position: sticky;
  top: 0;
  z-index: 32;
  display: grid;
  grid-template-columns: minmax(220px, .72fr) minmax(620px, 2.2fr) auto;
  gap: 14px;
  align-items: center;
  margin: 0 24px 18px;
  padding: 12px 14px;
  border: 1px solid rgba(155, 177, 207, .45);
  border-radius: 0 0 var(--hf21-radius) var(--hf21-radius);
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 8px 26px rgba(38, 69, 111, .07);
  backdrop-filter: blur(14px);
}
.hf21-journey-summary { min-width: 0; }
.hf21-journey-summary span,
.hf21-mode-switch > span {
  display: block;
  color: var(--hf21-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.hf21-journey-summary b {
  display: block;
  margin-top: 3px;
  color: var(--hf21-ink);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hf21-journey-summary small { display: block; margin-top: 2px; color: var(--hf21-muted); font-size: 11px; }
.hf21-journey-steps {
  display: grid;
  grid-template-columns: repeat(6, minmax(76px, 1fr));
  gap: 7px;
}
.hf21-journey-step {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  min-height: 42px;
  padding: 7px 9px;
  border: 1px solid var(--hf21-line);
  border-radius: 11px;
  background: #fff;
  color: var(--hf21-ink);
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.hf21-journey-step:hover,
.hf21-journey-step:focus-visible {
  border-color: #8eb4f8;
  box-shadow: 0 6px 16px rgba(21, 94, 239, .10);
  transform: translateY(-1px);
  outline: none;
}
.hf21-journey-step > i {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #eef3f9;
  color: #6a7890;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}
.hf21-journey-step span { min-width: 0; }
.hf21-journey-step b { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hf21-journey-step small { display: block; margin-top: 1px; color: var(--hf21-muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hf21-journey-step.done { border-color: #b8e1cf; background: #f5fcf8; }
.hf21-journey-step.done > i { background: #dff4e9; color: var(--hf21-success); }
.hf21-journey-step.current { border-color: #7facfa; background: var(--hf21-brand-soft); box-shadow: inset 0 0 0 1px rgba(21, 94, 239, .08); }
.hf21-journey-step.current > i { background: var(--hf21-brand); color: #fff; }
.hf21-journey-step.blocked { border-color: #f0c3bf; background: #fff8f7; }
.hf21-journey-step.blocked > i { background: #fde8e6; color: var(--hf21-danger); }

/* Family / advisor information-density switch */
.hf21-mode-switch { display: grid; gap: 5px; min-width: 154px; }
.hf21-mode-buttons { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--hf21-line); border-radius: 10px; background: #f4f7fb; }
.hf21-mode-buttons button {
  min-height: 32px;
  flex: 1;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #64748b;
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}
.hf21-mode-buttons button.active { background: #fff; color: var(--hf21-brand-strong); box-shadow: 0 2px 8px rgba(35, 69, 118, .10); }

/* Progressive disclosure for admission evidence cards */
.result-card[data-hf21-evidence="ready"] { position: relative; overflow: clip; }
.hf21-card-decision-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--hf21-line);
}
.hf21-card-decision-copy { min-width: 0; color: var(--hf21-muted); font-size: 11px; line-height: 1.55; }
.hf21-card-decision-copy b { color: var(--hf21-ink); }
.hf21-evidence-toggle {
  flex: none;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid #b8c9e2;
  border-radius: 9px;
  background: #fff;
  color: var(--hf21-brand-strong);
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}
.hf21-evidence-toggle:hover,
.hf21-evidence-toggle:focus-visible { border-color: #6d9ff5; background: #f3f7ff; outline: none; }
body[data-hf21-view-mode="family"] .result-card[data-hf21-evidence="ready"]:not(.hf21-evidence-expanded) .intel-history-grid,
body[data-hf21-view-mode="family"] .result-card[data-hf21-evidence="ready"]:not(.hf21-evidence-expanded) .supply-card-strip,
body[data-hf21-view-mode="family"] .result-card[data-hf21-evidence="ready"]:not(.hf21-evidence-expanded) .risk-calibration-strip,
body[data-hf21-view-mode="family"] .result-card[data-hf21-evidence="ready"]:not(.hf21-evidence-expanded) .false-safe-note,
body[data-hf21-view-mode="family"] .result-card[data-hf21-evidence="ready"]:not(.hf21-evidence-expanded) .historical-support-card,
body[data-hf21-view-mode="family"] .result-card[data-hf21-evidence="ready"]:not(.hf21-evidence-expanded) .history-gap-view {
  display: none !important;
}
body[data-hf21-view-mode="advisor"] .result-list { gap: 10px; }
body[data-hf21-view-mode="advisor"] .result-card { padding: 14px !important; border-radius: 11px !important; }
body[data-hf21-view-mode="advisor"] .result-card h4 { font-size: 15px !important; }
body[data-hf21-view-mode="advisor"] .result-stats-grid { gap: 7px !important; }
body[data-hf21-view-mode="advisor"] .result-stat { padding: 9px !important; }
body[data-hf21-view-mode="advisor"] .hf21-card-decision-copy { display: none; }
body[data-hf21-view-mode="advisor"] .hf21-evidence-toggle { min-height: 30px; }

/* Consistent page posture and state language */
.hf21-page-context {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(150px, .55fr));
  gap: 10px;
  margin: 14px 0 18px;
  padding: 12px;
  border: 1px solid var(--hf21-line);
  border-radius: var(--hf21-radius);
  background: linear-gradient(135deg, #fff, #f5f9ff);
  box-shadow: var(--hf21-shadow);
}
.hf21-page-context > div { min-width: 0; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.82); }
.hf21-page-context span { display: block; color: var(--hf21-muted); font-size: 10px; font-weight: 800; letter-spacing: .04em; }
.hf21-page-context b { display: block; margin-top: 4px; color: var(--hf21-ink); font-size: 13px; line-height: 1.45; }
.hf21-page-context small { display: block; margin-top: 3px; color: var(--hf21-muted); font-size: 10px; line-height: 1.45; }
.hf21-network-banner {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 12000;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(520px, calc(100vw - 28px));
  padding: 10px 14px;
  border-radius: 999px;
  background: #15253d;
  color: #fff;
  box-shadow: 0 14px 36px rgba(15, 30, 52, .25);
  font-size: 12px;
  font-weight: 750;
}
.hf21-network-banner.online { background: #146b4f; }
.hf21-network-banner[hidden] { display: none !important; }

/* Auxiliary/admin pages: clearer context and table boundaries */
.hf21-admin-context {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) repeat(3, minmax(140px, .55fr));
  gap: 10px;
  margin: 14px 0 18px;
  padding: 12px;
  border: 1px solid var(--hf21-line);
  border-radius: var(--hf21-radius);
  background: #fff;
  box-shadow: var(--hf21-shadow);
}
.hf21-admin-context > div { padding: 8px 10px; border-left: 3px solid #c8d8ee; }
.hf21-admin-context > div:first-child { border-left-color: var(--hf21-brand); }
.hf21-admin-context span { display: block; color: var(--hf21-muted); font-size: 10px; font-weight: 800; }
.hf21-admin-context b { display: block; margin-top: 3px; color: var(--hf21-ink); font-size: 13px; }
.hf21-admin-context small { display: block; margin-top: 2px; color: var(--hf21-muted); font-size: 10px; line-height: 1.45; }
.hf21-table-shell { max-width: 100%; overflow: auto; border: 1px solid var(--hf21-line); border-radius: 12px; background: #fff; }
.hf21-table-shell > table { margin: 0 !important; border: 0 !important; }
.hf21-table-shell thead { position: sticky; top: 0; z-index: 2; }

@media (max-width: 1280px) {
  .hf21-journey-rail { grid-template-columns: 1fr; position: static; }
  .hf21-journey-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .hf21-mode-switch { justify-self: start; }
  .hf21-page-context, .hf21-admin-context { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .hf21-journey-rail { margin: 0 12px 14px; padding: 10px; }
  .hf21-journey-steps { display: flex; overflow-x: auto; padding-bottom: 3px; scroll-snap-type: x proximity; }
  .hf21-journey-step { min-width: 126px; scroll-snap-align: start; }
  .hf21-page-context, .hf21-admin-context { grid-template-columns: 1fr; }
  .hf21-card-decision-bar { align-items: flex-start; flex-direction: column; }
  .hf21-evidence-toggle { width: 100%; }
}
@media (max-width: 540px) {
  .hf21-journey-summary { display: block; }
  .hf21-mode-switch { width: 100%; }
  .hf21-journey-step { min-width: 116px; }
}
@media (prefers-reduced-motion: reduce) {
  .hf21-journey-step { transition: none; }
}
@media (forced-colors: active) {
  .hf21-journey-step.current,
  .hf21-journey-step.done,
  .hf21-journey-step.blocked { border: 2px solid CanvasText; }
}
@media print {
  .hf21-journey-rail,
  .hf21-mode-switch,
  .hf21-network-banner,
  .hf21-evidence-toggle { display: none !important; }
  body[data-hf21-view-mode="family"] .result-card .intel-history-grid,
  body[data-hf21-view-mode="family"] .result-card .supply-card-strip,
  body[data-hf21-view-mode="family"] .result-card .risk-calibration-strip,
  body[data-hf21-view-mode="family"] .result-card .false-safe-note { display: initial !important; }
}
