/* Shared base, shell and components. Page sheets add layout only. */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  min-height: 100%;
  background-color: var(--navy);
  background-image:
    radial-gradient(1100px 620px at 88% -8%, rgba(5, 130, 190, 0.55), transparent 62%),
    radial-gradient(900px 560px at -12% 108%, rgba(255, 158, 24, 0.2), transparent 60%),
    radial-gradient(700px 480px at 40% 55%, rgba(5, 130, 190, 0.14), transparent 70%),
    linear-gradient(162deg, #00142F 0%, var(--navy) 46%, #073A6C 100%);
}
body {
  margin: 0;
  min-height: 100vh;
  font: 400 var(--fs-body)/1.5 var(--font);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
/* A faint drafting grid behind everything: the PVF trade's schematic paper, fading toward the bottom. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.35) 70%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.35) 70%, transparent 100%);
}
button, input, select, textarea { font: inherit; color: inherit; }
code, pre { font-family: var(--mono); font-size: 0.92em; }
a { color: var(--link); }
:focus-visible { outline: 3px solid rgba(5, 130, 190, 0.55); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---- shell ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--s5);
  padding: var(--s3) clamp(var(--s4), 3vw, var(--s8));
  background: var(--bar-glass);
  -webkit-backdrop-filter: var(--glass-blur);
          backdrop-filter: var(--glass-blur);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}
.brand { display: flex; align-items: center; gap: var(--s3); color: var(--on-bg); text-decoration: none; }
.brand-plate { display: block; padding: 7px 9px; background: #fff; border-radius: var(--r-sm); line-height: 0; }
.brand-plate img { height: 30px; width: auto; }
.brand-name { font-weight: 650; letter-spacing: -0.005em; white-space: nowrap; }
.brand-name small { display: block; font-size: var(--fs-micro); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; }
.nav { display: flex; gap: var(--s1); margin-right: auto; }
.nav a {
  position: relative;
  white-space: nowrap;
  padding: var(--s2) var(--s3);
  border-radius: var(--r-sm);
  color: var(--on-bg-2);
  font-weight: 560;
  text-decoration: none;
  transition: color var(--t-ui), background var(--t-ui);
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.nav a[aria-current="page"] { color: #fff; }
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: var(--s3); right: var(--s3); bottom: -13px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--orange);
}
.who { display: flex; flex: none; align-items: center; gap: var(--s3); color: var(--on-bg); }
.who-name { font-size: var(--fs-small); text-align: right; line-height: 1.25; white-space: nowrap; }
.who-name span { display: block; opacity: 0.7; }
.avatar {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), #2AA3DB);
  color: #fff;
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}

.page { width: min(1360px, 100%); margin: 0 auto; padding: var(--s8) clamp(var(--s4), 3vw, var(--s8)) var(--s10); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s6); color: var(--on-bg); text-shadow: var(--on-bg-shadow); }
.page-head h1 { margin: 0; font-size: var(--fs-display); line-height: 1.1; font-weight: 700; letter-spacing: -0.022em; }
.page-head p { margin: var(--s2) 0 0; max-width: 62ch; color: var(--on-bg-2); }

/* ---- surfaces ---- */
.card {
  position: relative;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
          backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: var(--s5);
}
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.card-title { margin: 0; white-space: nowrap; font-size: var(--fs-body); font-weight: 680; letter-spacing: -0.01em; }
/* the small uppercase label: eyebrows, field labels, table headings, step names in diagrams */
.eyebrow, .field-label { margin: 0; font-size: var(--fs-micro); font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.small { font-size: var(--fs-small); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 0.92em; }

/* ---- controls ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 40px;
  padding: 0 var(--s4);
  border: 0;
  border-radius: var(--r-md);
  font-weight: 620;
  cursor: pointer;
  transition: transform var(--t-press) ease-out, box-shadow var(--t-ui), background var(--t-ui), opacity var(--t-ui);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn-primary { color: #fff; background: linear-gradient(135deg, #0473A8 0%, var(--blue) 55%, #1C9AD6 100%); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 4px 14px rgba(5, 130, 190, 0.35); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 8px 22px rgba(5, 130, 190, 0.45); }
.btn-primary:active:not(:disabled) { transform: scale(0.97); }
.btn-quiet { color: var(--ink); background: rgba(0, 38, 82, 0.07); }
.btn-quiet:hover:not(:disabled) { background: rgba(0, 38, 82, 0.12); }
.btn-on-bg { white-space: nowrap; color: #fff; background: rgba(255, 255, 255, 0.1); min-height: 34px; padding: 0 var(--s3); font-size: var(--fs-small); }
.btn-on-bg:hover { background: rgba(255, 255, 255, 0.18); }
a.btn { text-decoration: none; }
.btn-danger { color: #fff; background: var(--bad); box-shadow: 0 4px 14px rgba(179, 38, 30, 0.28); }
.btn-danger:hover:not(:disabled) { background: #9C1F18; }

.field-label { display: block; margin-bottom: var(--s1); }
.input, .select {
  width: 100%;
  min-height: 40px;
  padding: var(--s2) var(--s3);
  background: #fff;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  transition: border-color var(--t-ui), box-shadow var(--t-ui);
}
.select {
  appearance: none;
  padding-right: var(--s8);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23415364' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  font-weight: 560;
  cursor: pointer;
}
.input:focus, .select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(5, 130, 190, 0.18); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--well-2); border-radius: var(--r-md); }
.segmented button {
  min-height: 32px;
  padding: 0 var(--s3);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font-size: var(--fs-small);
  font-weight: 620;
  cursor: pointer;
  transition: background var(--t-ui), color var(--t-ui), box-shadow var(--t-ui), transform var(--t-press);
}
.segmented button:active { transform: scale(0.96); }
.segmented button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 20, 50, 0.16); }
.seg-count { margin-left: 6px; padding: 0 6px; border-radius: var(--r-pill); background: rgba(0, 38, 82, 0.08); font-size: var(--fs-micro); font-variant-numeric: tabular-nums; }

.switch { display: inline-flex; align-items: center; gap: var(--s2); font-size: var(--fs-small); font-weight: 620; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { position: relative; width: 38px; height: 22px; border-radius: 11px; background: var(--gray-light); transition: background var(--t-ui); }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform var(--t-ui) var(--ease); }
.switch input:checked + .switch-track { background: var(--blue); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 3px solid rgba(5, 130, 190, 0.55); outline-offset: 2px; }

/* ---- chips and state ---- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  font-size: var(--fs-small);
  font-weight: 620;
  line-height: 1.5;
  white-space: nowrap;
}
.chip svg { width: 12px; height: 12px; flex: none; }
.chip-good { color: var(--good); background: var(--good-bg); }
.chip-warn { color: var(--warn); background: var(--warn-bg); }
.chip-bad { color: var(--bad); background: var(--bad-bg); }
.chip-info { color: var(--info); background: var(--info-bg); }
.chip-idle { color: var(--idle); background: var(--idle-bg); }
.chip-sample { color: var(--navy); background: var(--orange); text-shadow: none; }
.code-chip { font-family: var(--mono); font-size: var(--fs-small); font-weight: 600; padding: 2px 8px; border-radius: var(--r-sm); background: var(--well-2); color: var(--navy); }

/* ---- stat tile ---- */
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-label { font-size: var(--fs-small); font-weight: 600; color: var(--ink-2); }
.stat-value { font-size: 2rem; line-height: 1.1; font-weight: 680; letter-spacing: -0.025em; color: var(--ink); }
.stat-value small { font-size: 0.55em; font-weight: 600; letter-spacing: 0; color: var(--ink-2); margin-left: 2px; }
.stat-note { font-size: var(--fs-small); color: var(--ink-3); }

/* ---- tooltip ---- */
.tip {
  position: fixed;
  z-index: 50;
  max-width: 260px;
  padding: 6px 11px;
  border-radius: 8px;
  background: rgba(12, 20, 32, 0.9);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  color: #fff;
  font-size: var(--fs-small);
  line-height: 1.4;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 10px));
}
.tip::before { content: ""; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; background: inherit; transform: translateX(-50%) rotate(45deg); border-radius: 2px; }

/* ---- motion ---- */
@keyframes materialize {
  from { opacity: 0; transform: translateY(8px) scale(0.995); }
  to { opacity: 1; transform: none; }
}
.enter { animation: materialize var(--t-enter) var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }

@media (prefers-reduced-motion: reduce) {
  @keyframes materialize { from { opacity: 0; } to { opacity: 1; } }
  *, *::before, *::after { transition-duration: 1ms !important; }
  .btn:active, .segmented button:active { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .card { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .topbar { background: #00203F; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  .card { background: #fff; border-color: var(--ink); }
  .muted, .eyebrow, .stat-note { color: var(--ink-2); }
}

/* ---- phone ---- */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: var(--s3); padding-bottom: 0; }
  .brand-name { display: none; }
  .who { margin-left: auto; }
  .who-name { display: none; }
  .nav { order: 3; width: calc(100% + 2 * var(--s4)); margin: 0 calc(-1 * var(--s4)); padding: 0 var(--s2); border-top: 1px solid rgba(255, 255, 255, 0.08); overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: 1 0 auto; text-align: center; padding: var(--s3) var(--s2); white-space: nowrap; }
  .ops-btn { width: 34px; padding: 0; }
  .ops-label { display: none; }
  .nav a[aria-current="page"]::after { bottom: 0; }
  .page { padding-top: var(--s6); }
  .card { padding: var(--s4); border-radius: 14px; }
  .page-head .head-actions { width: 100%; }
}

/* page-head buttons and chips on the right */
.head-actions { display: flex; align-items: center; gap: var(--s3); }

/* a known share, with its words: a validation's lines scored (shell.js meter) */
.meter { display: flex; align-items: center; gap: var(--s3); width: 100%; }
.meter-track { flex: 1; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: 3px; background: var(--blue); transition: width 600ms var(--ease); }
.meter-text { flex: none; font-size: var(--fs-small); font-weight: 600; color: var(--ink-2); }
@media (prefers-reduced-motion: reduce) { .meter-fill { transition: none; } }

/* ---- uploads in progress: a small status in the top bar, for admins (uploads.js) ---- */
.upl {
  display: inline-flex; align-items: center; gap: var(--s2);
  flex: 0 1 auto; min-width: 0; min-height: 34px; max-width: 22rem;   /* gives way first when the bar is tight */
  padding: 0 var(--s3) 0 var(--s2);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font: inherit; text-align: left;
  cursor: pointer;
  transition: transform var(--t-press) ease-out, background var(--t-ui), border-color var(--t-ui);
  -webkit-tap-highlight-color: transparent;
}
.upl:hover { background: rgba(255, 255, 255, 0.16); }
.upl:active { transform: scale(0.97); }
.upl-good { background: rgba(27, 127, 71, 0.32); border-color: rgba(120, 220, 160, 0.45); }
.upl-bad { background: rgba(179, 38, 30, 0.34); border-color: rgba(255, 150, 140, 0.5); }
.upl-good:hover { background: rgba(27, 127, 71, 0.44); }
.upl-bad:hover { background: rgba(179, 38, 30, 0.46); }
.upl-in { animation: materialize var(--t-enter) var(--ease) both; transform-origin: right center; }
.upl-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.upl-stage { font-size: var(--fs-small); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upl-left { font-weight: 560; color: var(--on-bg-2); }
.upl-meta { font-size: var(--fs-micro); color: var(--on-bg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upl-more { padding: 1px 6px; border-radius: var(--r-pill); background: rgba(255, 255, 255, 0.16); font-size: var(--fs-micro); font-weight: 700; }

.upl-mark { display: grid; place-items: center; flex: none; width: 22px; height: 22px; }
.upl-ring { width: 20px; height: 20px; transform: rotate(-90deg); }
.upl-ring circle { fill: none; stroke-width: 2.6; }
.upl-track { stroke: rgba(255, 255, 255, 0.2); }
.upl-arc { stroke: var(--orange); stroke-linecap: round; transition: stroke-dashoffset 600ms var(--ease); }
.upl-ring-turning { animation: upl-turn 1.1s linear infinite; }
@keyframes upl-turn { from { transform: rotate(-90deg); } to { transform: rotate(270deg); } }
.upl-mark-good, .upl-mark-bad { border-radius: 50%; color: #fff; }
.upl-mark-good { background: var(--good); }
.upl-mark-bad { background: var(--bad); }
.upl-mark svg:not(.upl-ring) { width: 13px; height: 13px; }

/* the list, when several run at once (a sheet: dark ink on white) */
.upl-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.upl-list li + li { border-top: 1px solid var(--line); }
.upl-list a { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s3) var(--s4); color: var(--ink); text-decoration: none; transition: background var(--t-ui); }
.upl-list a:hover { background: var(--well); }
.upl-list .upl-mark { margin-top: 1px; border-radius: 50%; background: var(--navy); }
.upl-list .upl-mark-good { background: var(--good); }
.upl-list .upl-mark-bad { background: var(--bad); }
.upl-list .upl-ring { width: 18px; height: 18px; }
.upl-row { display: grid; gap: 2px; min-width: 0; flex: 1; }
.upl-row-top { display: flex; justify-content: space-between; gap: var(--s3); font-size: var(--fs-small); }
.upl-row-meta { font-size: var(--fs-small); color: var(--ink-3); overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) {
  .upl-ring-turning { animation: none; }
  .upl-arc { transition: none; }
}
@media (max-width: 720px) {   /* a row of its own between the person's corner and the nav */
  .upl { order: 2; width: 100%; max-width: none; min-height: 40px; border-radius: var(--r-md); }
  .upl-text { flex-direction: row; align-items: baseline; gap: var(--s2); flex: 1; }
  .upl-meta { flex: 1; text-align: right; }
  .upl-who { display: none; }   /* the time it has run stays; who and which piece are in the list and the label */
}

/* ---- the Operations menu: links into the AWS console ---- */
.ops-btn svg { width: 16px; height: 16px; }
.ops-intro { margin: 0 0 var(--s5); font-size: var(--fs-small); color: var(--ink-2); }
.ops-group + .ops-group { margin-top: var(--s5); }
.ops-list { list-style: none; margin: var(--s2) 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.ops-list li + li { border-top: 1px solid var(--line); }
.ops-list a { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); color: var(--ink); text-decoration: none; transition: background var(--t-ui); }
.ops-list a:hover { background: var(--well); }
.ops-list a > svg { width: 15px; height: 15px; flex: none; margin-left: auto; color: var(--link); }
.ops-row-text { display: flex; flex-direction: column; min-width: 0; }
.ops-row-title { font-weight: 650; color: var(--link); overflow-wrap: anywhere; }
.ops-row-note { font-size: var(--fs-small); color: var(--ink-3); line-height: 1.35; }
.ops-none { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s3) var(--s4); font-size: var(--fs-small); color: var(--ink-2); }
.ops-none .chip { flex: none; }

/* ---- shared marks: variants, version ids, series ---- */
.series-1 { --series: var(--series-1); background: var(--series-1); color: #fff; }
.series-2 { --series: var(--series-2); background: var(--series-2); color: var(--navy); }
.series-3 { --series: var(--series-3); background: var(--series-3); color: #fff; }
.series-4 { --series: var(--series-4); background: var(--series-4); color: #fff; }
.vmark {
  display: inline-grid; place-items: center;
  min-width: 22px; height: 22px; padding: 0 5px;
  border-radius: 6px;
  font-size: var(--fs-micro); font-weight: 800; letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.vid { font-family: var(--mono); font-size: var(--fs-small); overflow-wrap: anywhere; }
.vid-date { color: var(--ink-3); }
.vid-name { color: var(--navy); font-weight: 700; }

/* a share of traffic: one segment per variant, letters inside, 2px gaps */
.split { display: flex; gap: 2px; height: 32px; }
.split-part {
  display: flex; align-items: center; gap: 6px;
  min-width: 3px;
  padding: 0 var(--s2);
  border-radius: 5px;
  overflow: hidden;
  font-size: var(--fs-small); font-weight: 700; white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: flex-grow var(--t-enter) var(--ease), filter var(--t-ui);
}
.split-part:hover, .split-part:focus-visible { filter: brightness(1.08); }
.split-empty { flex: 1; display: grid; place-items: center; border-radius: 5px; background: var(--track); color: var(--ink-3); font-size: var(--fs-small); }

/* a feature that does not exist here, said plainly */
.not-built { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s4); border-radius: var(--r-md); background: var(--well-2); font-size: var(--fs-small); color: var(--ink-2); }
.not-built .chip { flex: none; }
.not-built p { margin: 0; max-width: 62ch; }

.stat-value.stat-sm { font-size: 1.5rem; }
.btn-small { min-height: 32px; padding: 0 var(--s3); font-size: var(--fs-small); }
.btn svg, .icon-btn svg { width: 16px; height: 16px; flex: none; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px;
  border: 0; border-radius: 50%;
  background: rgba(0, 38, 82, 0.07);
  color: var(--ink-2);
  cursor: pointer;
  transition: background var(--t-ui), transform var(--t-press);
}
.icon-btn:hover { background: rgba(0, 38, 82, 0.13); }
.icon-btn:active { transform: scale(0.94); }
.form-error { margin: var(--s3) 0 0; padding: var(--s2) var(--s3); border-radius: var(--r-sm); background: var(--bad-bg); color: var(--bad); font-size: var(--fs-small); }
.hint { margin: var(--s1) 0 0; font-size: var(--fs-small); color: var(--ink-3); }
.save-ok { color: var(--good); font-weight: 650; }
.confirm-intro { margin: 0 0 var(--s4); font-size: 1.0625rem; }
.field + .field { margin-top: var(--s4); }

/* a progress track: determinate (width set) or, with .indeterminate, a sliding sweep */
.progress { position: relative; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.progress > span { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 3px; background: var(--blue); transition: width 160ms linear; }
.progress.done > span { background: var(--good); }
.progress.indeterminate > span { width: 34%; animation: sweep 1.3s var(--ease) infinite; }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

/* ---- the modal sheet: dims the page, rises from the bottom on a phone, settles in the middle on a desk ---- */
dialog.sheet {
  width: min(560px, calc(100% - 2 * var(--s4)));
  max-height: min(88vh, 860px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--glass-edge);
  border-radius: 18px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 12, 32, 0.45), 0 4px 16px rgba(0, 12, 32, 0.2);
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: sheet-in var(--t-enter) var(--ease) both;
}
dialog.sheet:not([open]) { display: none; }
dialog.sheet::backdrop { background: rgba(0, 14, 34, 0.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade-in var(--t-enter) var(--ease) both; }
dialog.sheet.closing { animation: sheet-out 200ms var(--ease) both; }
dialog.sheet.closing::backdrop { animation: fade-in 200ms var(--ease) reverse both; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: var(--fs-title); font-weight: 700; letter-spacing: -0.014em; }
.sheet-body { padding: var(--s5); overflow-y: auto; overscroll-behavior: contain; }
.sheet-actions { display: flex; justify-content: flex-end; gap: var(--s3); margin-top: var(--s6); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes sheet-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(14px) scale(0.98); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 720px) {
  dialog.sheet { width: 100%; max-width: none; max-height: 92vh; margin: auto 0 0; border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  @keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
  @keyframes sheet-out { from { transform: none; } to { transform: translateY(100%); } }
  .sheet-actions { position: sticky; bottom: calc(-1 * var(--s5)); margin: var(--s5) calc(-1 * var(--s5)) calc(-1 * var(--s5)); padding: var(--s3) var(--s5); background: #fff; border-top: 1px solid var(--line); }
  .sheet-actions .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  @keyframes sheet-in { from { opacity: 0; } to { opacity: 1; } }
  @keyframes sheet-out { from { opacity: 1; } to { opacity: 0; } }
  .progress.indeterminate > span { animation: none; width: 100%; opacity: 0.4; }
}

/* a small label beside a name (routing.css, versions.css) */
.tag { padding: 0 7px; border-radius: var(--r-pill); background: var(--well-2); font-size: var(--fs-micro); font-weight: 700; color: var(--ink-2); }
.tag-warn { background: var(--warn-bg); color: var(--warn); white-space: nowrap; }

/* ---- shadow testing (admin/static/js/shadow.js): the versions page panel, the routing page list ---- */
.shadow-panel {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3) var(--s4);
  margin-top: var(--s5); padding: var(--s4);
  border: 1px dashed var(--line-strong); border-radius: var(--r-md); background: var(--well);
}
.shadow-panel.on { border-style: solid; border-color: transparent; background: var(--info-bg); box-shadow: inset 3px 0 0 var(--blue); }
.shadow-panel-text { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; flex: 1 1 260px; }
.shadow-panel-text b { font-weight: 680; }
.shadow-panel-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.shadow-msg:empty, #shadow-msg:empty { display: none; }
.shadow-msg { flex-basis: 100%; margin: 0; }
.vrow-tags { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.shadow-list { list-style: none; margin: 0; padding: 0; display: grid; }
.shadow-row {
  display: grid; grid-template-columns: 110px minmax(0, 1fr) 56px auto auto; align-items: center; gap: var(--s3);
  padding: var(--s3) 0; border-top: 1px solid var(--line);
}
.shadow-row:first-child { border-top: 0; padding-top: 0; }
.shadow-kind { margin: 0; }
.shadow-share { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.shadow-share-field { display: block; margin: var(--s4) 0; }
.shadow-share-input { display: inline-flex; align-items: center; gap: 6px; }
.shadow-share-input .pct-input { width: 84px; min-height: 40px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .shadow-row { grid-template-columns: minmax(0, 1fr) auto; }
  .shadow-kind, .shadow-who { grid-column: 1; }
  .shadow-version { grid-column: 1; }
  .shadow-share { grid-column: 2; grid-row: 1; }
  .shadow-row .btn { grid-column: 2; grid-row: 2 / span 2; align-self: center; }
}

/* ---- a results table with each row's answer mix as one bar (Bulk test, Compare) ---- */
.sum-wrap { overflow-x: auto; }
.sum { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.sum th, .sum td { padding: var(--s2) var(--s3); border-top: 1px solid var(--line); text-align: left; white-space: nowrap; vertical-align: middle; }
.sum thead th { border-top: 0; padding-top: 0; }
.sum .num { text-align: right; font-variant-numeric: tabular-nums; }
.sum td small { display: block; color: var(--ink-3); font-size: var(--fs-micro); }
.sum td .sum-count small { display: inline; }
.sum tbody th { width: 1%; }
.sum-lines { min-width: 140px; }
.sum-count { display: block; margin-bottom: 5px; font-variant-numeric: tabular-nums; font-weight: 650; }
.outcome-bar { display: flex; gap: 2px; height: 10px; }
.outcome { min-width: 3px; border-radius: 2px; outline-offset: 2px; }
.outcome-exact, .outcome-right { background: var(--good); }
.outcome-wrong { background: var(--bad); }
.outcome-unchecked { background: var(--gray-light); }
.outcome-alternates { background: var(--blue); }
.outcome-ask, .outcome-asked { background: var(--orange); }
.outcome-none { background: var(--well-2); box-shadow: inset 0 0 0 1px var(--line-strong); }
.legend { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); margin: var(--s3) 0 0; padding: 0; list-style: none; font-size: var(--fs-small); color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 10px; border-radius: 2px; }
@media (max-width: 720px) {   /* a .stack table: one block per row on a phone */
  .sum.stack thead { display: none; }
  .sum.stack, .sum.stack tbody, .sum.stack tr { display: block; }
  .sum.stack tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--line); }
  .sum.stack tr:first-child { border-top: 0; }
  .sum.stack th, .sum.stack td { display: block; padding: 0; border: 0; white-space: normal; }
  .sum.stack tbody th, .sum.stack .sum-lines { grid-column: 1 / -1; width: auto; }
  .sum.stack .num { text-align: left; }
  .sum.stack td[data-label]::before { content: attr(data-label); display: block; font-size: var(--fs-micro); font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
}

/* a button that reads as a link */
.link-btn { padding: 0; border: 0; background: none; color: var(--link); font: inherit; font-weight: 620; cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
