/* Kampsyn: calm, analytical, readable. System fonts only (strict CSP, no external files). */
:root {
  color-scheme: light dark;
  --bg: light-dark(#f3f5f8, #0f141a);
  --card: light-dark(#ffffff, #171e26);
  --card-2: light-dark(#f7f9fb, #1c242e);
  --text: light-dark(#121c27, #e5ebf1);
  --muted: light-dark(#566375, #9eabb9);
  --line: light-dark(#dfe4ea, #2a3440);
  --line-strong: light-dark(#c7d0da, #3a4654);
  --accent: light-dark(#1d5ca8, #7db7ff);
  --accent-soft: light-dark(#e8f0fa, #1a2a3d);
  --on-accent: light-dark(#ffffff, #0c1724);
  --hit: light-dark(#e3f4e8, #15301e);
  --hit-text: light-dark(#13612f, #86dca0);
  --miss: light-dark(#fce8e8, #3a1a1c);
  --miss-text: light-dark(#a1161d, #ff9d9d);
  --mark: light-dark(#fff5d4, #332b12);
  --warn: light-dark(#fff3dd, #33260f);
  --warn-text: light-dark(#844700, #ffc56e);
  --warn-line: light-dark(#eec27c, #6a4914);
  --info: light-dark(#e9f1fb, #172739);
  --info-text: light-dark(#1b4f8f, #9cc8ff);
  --purple: light-dark(#f1ebfb, #2a2140);
  --purple-text: light-dark(#5a3596, #c8b2f5);
  --nav-bg: light-dark(#0f1b2b, #0b121b);
  --nav-text: #c8d2de;
  --nav-muted: #8e9db1;
  --nav-active: rgb(255 255 255 / 0.09);
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgb(16 24 40 / 0.05);
  --shadow-lg: 0 10px 30px rgb(16 24 40 / 0.18);
  --sidebar: 248px;
  --font:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3,
h4,
p {
  margin: 0;
}
h1 {
  font-size: 1.5rem;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.01em;
}
h2 {
  font-size: 1.05rem;
  font-weight: 620;
}
h3 {
  font-size: 0.95rem;
  font-weight: 620;
}
h4 {
  font-size: 0.85rem;
  font-weight: 620;
}
small {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}
a {
  color: var(--accent);
}
code {
  font-family: var(--mono);
  font-size: 0.84em;
  /* Long package and file names wrap instead of widening the page on a phone. */
  overflow-wrap: break-word;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.86rem;
}
.error {
  color: var(--miss-text);
}
.ok {
  color: var(--hit-text);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
svg.icon {
  width: 18px;
  height: 18px;
  flex: none;
}
svg.icon.lg {
  width: 26px;
  height: 26px;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- Shell */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--nav-bg);
  color: var(--nav-text);
  overflow-y: auto;
  z-index: 40;
}
.sidebar-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1.1rem 1rem 0.9rem 1.15rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.brand-tag {
  padding: 0.05rem 0.45rem;
  border: 1px solid rgb(255 255 255 / 0.22);
  border-radius: 999px;
  color: var(--nav-muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
#nav {
  flex: 1;
  padding: 0.25rem 0.6rem 1rem;
}
.nav-group + .nav-group {
  margin-top: 1rem;
}
.nav-heading {
  padding: 0 0.6rem 0.3rem;
  color: var(--nav-muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
#nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 40px;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--nav-text);
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.nav-link .icon {
  color: var(--nav-muted);
}
.nav-link:hover {
  background: var(--nav-active);
  color: #fff;
}
.nav-link[aria-current='page'] {
  background: rgb(255 255 255 / 0.12);
  color: #fff;
  font-weight: 600;
}
.nav-link[aria-current='page']::before {
  content: '';
  position: absolute;
  left: -0.6rem;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #7db7ff;
}
.nav-link[aria-current='page'] .icon {
  color: #a9cfff;
}
.sidebar :focus-visible {
  outline-color: #a9cfff;
}
.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 0.9rem;
  border-top: 1px solid rgb(255 255 255 / 0.1);
}
.me {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  flex: 1;
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  color: var(--nav-text);
  text-decoration: none;
}
.me:hover {
  background: var(--nav-active);
}
.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: #24476f;
  color: #fff;
  font-weight: 700;
}
.me-text {
  min-width: 0;
  display: grid;
}
#me-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
}
#me-role {
  color: var(--nav-muted);
}
.sidebar-foot #logout {
  border-color: rgb(255 255 255 / 0.24);
  background: transparent;
  color: var(--nav-text);
}
.sidebar-foot #logout:hover {
  background: var(--nav-active);
}
.main-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 56px;
  padding: 0.5rem 1.5rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.crumbs {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
}
.crumb-group {
  color: var(--muted);
  font-size: 0.86rem;
}
.crumb-group::after {
  content: '/';
  margin-left: 0.45rem;
  color: var(--line-strong);
}
.crumb-page {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-pill {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 30px;
  padding: 0.2rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
}
.status-pill:empty {
  visibility: hidden;
}
.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.status-pill.good .dot {
  background: #2e9a55;
}
.status-pill.bad {
  border-color: var(--miss-text);
  color: var(--miss-text);
}
.status-pill.bad .dot {
  background: var(--miss-text);
}
#content {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
}
#content:focus {
  outline: none;
}
.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-bottom: 0.25rem;
}
.page-head > div:first-child {
  min-width: 0;
  max-width: 72ch;
}
.lede {
  margin-top: 0.3rem;
  color: var(--muted);
}
.section-title {
  margin: 0.35rem 0 0.6rem;
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
}
.icon-button .icon {
  width: 22px;
  height: 22px;
}
.mobile-only,
.drawer-only,
.bottom-nav,
.scrim {
  display: none;
}
.skip {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  z-index: 100;
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
}
.skip:focus {
  top: 0.5rem;
}

/* ---------------------------------------------------------------- Sign-in */

#login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem 1rem;
  background: radial-gradient(1200px 500px at 10% -10%, var(--accent-soft), transparent 60%), var(--bg);
}
.login-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
  align-items: center;
  gap: 3rem;
  width: min(900px, 100%);
}
.login-intro {
  display: grid;
  gap: 0.8rem;
  max-width: 42ch;
}
.login-intro h1 {
  font-size: 2rem;
}
.login-intro p {
  color: var(--muted);
  font-size: 1.02rem;
}
.login-points {
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
}
.login-points li::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 0.6rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}
.login-card {
  display: grid;
  gap: 1rem;
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
}
.login-card input {
  width: 100%;
}

/* ---------------------------------------------------------------- Surfaces */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel {
  padding: 1.1rem 1.2rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  align-content: start;
}
.panel > h2 {
  margin-bottom: 0.1rem;
}
.panel details summary {
  cursor: pointer;
  padding: 0.3rem 0;
  color: var(--accent);
}
.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}
.stack {
  display: grid;
  gap: 0.85rem;
  max-width: 380px;
}
.stack-wide {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.notice {
  color: var(--muted);
  padding: 0.6rem 0.9rem;
  border-left: 3px solid var(--accent);
  background: var(--card);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.notice strong {
  color: var(--text);
}
.banner {
  display: block;
  padding: 0.7rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card);
}
.banner.warn {
  background: var(--warn);
  border-color: var(--warn-line);
}
.banner.bad {
  background: var(--miss);
  border-color: var(--miss-text);
}
.banner.good {
  background: var(--hit);
  border-color: light-dark(#a9dcb8, #2c5a3a);
}
.banner.info {
  background: var(--info);
  border-color: light-dark(#bcd3ef, #2b4566);
}

/* Stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}
.stat-grid.five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.stat-grid.six {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.mini-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.6rem;
}
.mini-stats .stat {
  box-shadow: none;
  background: var(--card-2);
}
.stat {
  display: grid;
  align-content: start;
  gap: 0.1rem;
  min-height: 92px;
  padding: 0.75rem 0.95rem;
}
.stat-label {
  color: var(--muted);
  font-size: 0.84rem;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
.stat small {
  font-size: 0.76rem;
}
.stat.hit .stat-value {
  color: var(--hit-text);
}
.stat.miss .stat-value {
  color: var(--miss-text);
}
.stat.warn {
  border-color: var(--warn-line);
}
.stat.warn .stat-value {
  color: var(--warn-text);
}

/* Pills, badges, evidence */
.pill,
.evidence {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.08rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  vertical-align: middle;
}
.pill.neutral {
  background: var(--card-2);
  border-color: var(--line);
  color: var(--muted);
}
.pill.good {
  background: var(--hit);
  color: var(--hit-text);
}
.pill.warn {
  background: var(--warn);
  color: var(--warn-text);
  white-space: normal;
}
.pill.info {
  background: var(--info);
  color: var(--info-text);
}
.pill.bad {
  background: var(--miss);
  color: var(--miss-text);
}
.evidence {
  border-color: currentColor;
  background: transparent;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}
.evidence.real-prospective {
  color: var(--hit-text);
}
.evidence.historical {
  color: var(--muted);
}
.evidence.synthetic {
  color: var(--warn-text);
  border-style: dashed;
}
.evidence.replay {
  color: var(--purple-text);
  background: var(--purple);
}
.evidence.production-verified {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
}
.evidence.unknown {
  color: var(--muted);
  border-style: dotted;
}
.badge.green {
  color: var(--hit-text);
  font-weight: 700;
}
.badge.red {
  color: var(--miss-text);
  font-weight: 700;
}
.badge.neutral {
  color: var(--muted);
}
.badge.warn {
  color: var(--warn-text);
  font-weight: 700;
}
.badge.outcome {
  display: inline-block;
  padding: 0.05rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 650;
  font-size: 0.84rem;
  color: var(--text);
  white-space: nowrap;
}
.badge.outcome.green {
  color: var(--hit-text);
  background: var(--hit);
  border-color: transparent;
}
.badge.outcome.red {
  color: var(--miss-text);
  background: var(--miss);
  border-color: transparent;
}
.tag {
  justify-self: start;
  padding: 0.15rem 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}
.tag.warn {
  background: var(--warn);
  color: var(--warn-text);
}

/* States */
.empty-state {
  display: grid;
  justify-items: center;
  gap: 0.6rem;
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--muted);
}
.empty-state h2 {
  color: var(--text);
}
.empty-state p {
  max-width: 60ch;
}
.unavailable-state {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1.1rem 1.2rem;
  border-style: dashed;
  border-color: var(--line-strong);
  background: var(--card-2);
}
.unavailable-state .icon {
  color: var(--info-text);
}
.unavailable-state p {
  margin-top: 0.2rem;
}
.error-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  padding: 1rem 1.2rem;
  border-color: var(--miss-text);
  color: var(--miss-text);
}
.error-state strong {
  color: var(--miss-text);
}
.all-clear {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--hit-text);
}

/* Loading skeletons: fixed sizes, so content does not jump when it arrives. */
.skeleton-page {
  display: grid;
  gap: 1rem;
}
.sk {
  display: block;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--line) 0%, var(--card-2) 50%, var(--line) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.sk-title {
  width: 240px;
  max-width: 60%;
  height: 30px;
}
.sk-line {
  height: 14px;
  width: 100%;
}
.sk-line.short {
  width: 40%;
}
.sk-num {
  height: 28px;
  width: 50%;
  margin-top: 0.4rem;
}
.sk-row {
  height: 38px;
  width: 100%;
}
@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

/* ---------------------------------------------------------------- Controls */

button,
a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font: inherit;
  font-weight: 550;
  min-height: 40px;
  padding: 0.35rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  touch-action: manipulation;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}
button:hover,
a.button:hover {
  border-color: var(--accent);
}
button.primary,
a.button.primary,
#login-form button[type='submit'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
button.primary:hover,
a.button.primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, #000);
}
button.danger {
  background: var(--miss-text);
  border-color: var(--miss-text);
  color: light-dark(#fff, #1a0b0c);
}
button.danger-text {
  color: var(--miss-text);
}
button.quiet,
a.button.quiet {
  background: var(--card);
}
button.small,
a.button.small {
  min-height: 34px;
  padding: 0.2rem 0.65rem;
  font-size: 0.86rem;
}
a.button .icon {
  width: 16px;
  height: 16px;
}
button.square {
  width: 40px;
  padding: 0;
  font-size: 1.2rem;
}
button.link {
  display: inline;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: 600;
  text-align: left;
}
button.link:hover {
  text-decoration: underline;
}
button.icon {
  position: relative;
  min-height: 0;
  padding: 0.1rem 0.4rem;
  border: 0;
  background: none;
  color: var(--accent);
}
/* Small text buttons (watch star, Copy) get a larger touch area without changing the layout. */
button.icon::after {
  content: '';
  position: absolute;
  inset: -6px;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
button:disabled:hover {
  border-color: var(--line-strong);
}
input:not([type='checkbox']),
select,
textarea {
  font: inherit;
  min-height: 40px;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--text);
}
textarea {
  width: 100%;
  resize: vertical;
  min-height: 80px;
}
input[readonly] {
  background: var(--card-2);
  color: var(--muted);
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}
.field {
  display: grid;
  gap: 0.25rem;
  align-content: start;
}
.field > span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 550;
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 40px;
}
.segmented {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--card);
}
.segmented button {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
}
.segmented button + button {
  border-left: 1px solid var(--line);
}
.segmented button[aria-pressed='true'] {
  background: var(--accent);
  color: var(--on-accent);
}
.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}
.inline-form .field {
  min-width: 180px;
  flex: 1 1 180px;
}
.inline-form .field input,
.inline-form .field select {
  width: 100%;
}
.filters.inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0;
}
.once {
  display: grid;
  gap: 0.4rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--warn-line);
  border-radius: var(--radius-sm);
  background: var(--warn);
}
.once-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.secret {
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
  user-select: all;
}

/* ---------------------------------------------------------------- Tables */

.scroll {
  overflow-x: auto;
}
.scroll:focus-visible {
  outline-offset: -2px;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  padding: 0.6rem 0.9rem;
  text-align: left;
  border-top: 1px solid var(--line);
  vertical-align: top;
}
thead th {
  border-top: 0;
  background: var(--card-2);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.panel .scroll {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
tbody tr:hover {
  background: color-mix(in srgb, var(--card-2) 70%, transparent);
}
.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.strong {
  font-weight: 700;
}
.nowrap {
  white-space: nowrap;
}
.na {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.85rem;
  white-space: normal;
}
.na-block {
  padding: 0.8rem 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
}
tr.highlight,
tr.highlight:hover {
  background: var(--mark);
  font-weight: 700;
}
tr.green,
tr.green:hover {
  background: var(--hit);
}
tr.red,
tr.red:hover {
  background: var(--miss);
}
.mark-label {
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.mark-en {
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}
.wide td:last-child {
  min-width: 200px;
}
.kind.live {
  color: var(--hit-text);
  font-weight: 600;
}
.kind.missing {
  color: var(--muted);
}
.plain {
  margin: 0.3rem 0 0;
  padding-left: 1.1rem;
}
.hash {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}
button.copy {
  font-size: 0.8rem;
  text-decoration: underline;
}
.hash-list {
  display: grid;
  gap: 0.2rem;
}
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.6rem 1.25rem;
  margin: 0;
}
.facts dt {
  color: var(--muted);
  font-size: 0.78rem;
}
.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.unavailable {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.3rem 1rem;
  margin: 0.4rem 0 0;
}
.unavailable dt {
  font-weight: 600;
}
.unavailable dd {
  margin: 0;
  color: var(--muted);
}
.unavailable dd strong {
  color: var(--text);
}

/* ---------------------------------------------------------------- Game Center */

.toolbar-card {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
}
.toolbar,
.days {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.toolbar {
  justify-content: space-between;
}
.days h2 {
  min-width: 12ch;
  text-align: center;
  font-size: 1.05rem;
}
.days .field {
  min-width: 160px;
}
.period,
.find,
.checks {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.6rem;
}
.find input {
  width: 240px;
}
.filter-card summary {
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-weight: 600;
  min-height: 44px;
}
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.8rem;
  padding: 0.2rem 1rem 1rem;
}
.filters select,
.filters input:not([type='checkbox']),
.filters .field button {
  width: 100%;
}
.checks,
.filters .actions,
.span {
  grid-column: 1 / -1;
}
#problem:not(:empty) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--miss-text);
  border-radius: var(--radius-sm);
  background: var(--miss);
}
.bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.bulk > span {
  margin-right: auto;
}
#game-list {
  display: grid;
  gap: 1rem;
}
.group {
  overflow: hidden;
}
.group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--line);
}
.group h2 small {
  display: inline;
  font-weight: 400;
}
.group-head button {
  flex: none;
  white-space: nowrap;
}
.marks {
  white-space: nowrap;
}
.marks input {
  width: 18px;
  height: 18px;
  margin: 0 0.3rem 0 0;
  vertical-align: middle;
  accent-color: var(--accent);
}
small.same-model {
  color: var(--warn-text);
  font-weight: 600;
}
small.verify {
  margin-top: 0.15rem;
  font-weight: 400;
}
small.verify.conflict {
  color: var(--text);
  font-weight: 600;
}
th button.sort {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 650;
  letter-spacing: inherit;
  text-transform: inherit;
}
th button.sort:hover {
  color: var(--text);
}
.slip {
  position: sticky;
  bottom: 0.75rem;
  display: grid;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-lg);
  max-height: 45vh;
  overflow-y: auto;
}
.slip-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem 1rem;
}
.candidates {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.25rem;
}
.candidates li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.8rem;
  padding: 0.35rem 0;
  border-top: 1px solid var(--line);
}
.candidates li > :nth-child(2) {
  margin-right: auto;
}

/* ---------------------------------------------------------------- Dashboard */

.day-bars {
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.day-bars li {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.86rem;
}
.day-bars .day {
  color: var(--muted);
  white-space: nowrap;
}
.day-bars .bar {
  display: flex;
  height: 12px;
  border-radius: 999px;
  background: var(--card-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.day-bars .seg {
  width: calc(var(--share, 0) * 1%);
}
.day-bars .seg.hit {
  background: light-dark(#2e8b50, #5cc47e);
}
.day-bars .seg.miss {
  background: light-dark(#c2363d, #ef7c7c);
}
.day-bars .seg.pending {
  background: repeating-linear-gradient(45deg, var(--line-strong) 0 3px, transparent 3px 6px);
}
.day-bars .nums {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}
.compact-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.compact-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0;
  border-top: 1px solid var(--line);
}
.compact-list li.highlighted {
  font-weight: 700;
}
.lane-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}
.lane {
  display: grid;
  gap: 0.35rem;
  justify-items: start;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-2);
}
.lane.identical {
  border-style: dashed;
}
.lane-slot {
  font-weight: 700;
}
.alerts {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}
.alert {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.alert.bad {
  background: var(--miss);
  border-color: var(--miss-text);
}
.alert.bad .icon {
  color: var(--miss-text);
}
.alert.warn {
  background: var(--warn);
  border-color: var(--warn-line);
}
.alert.warn .icon {
  color: var(--warn-text);
}
.alert.info {
  background: var(--info);
}
.alert.info .icon {
  color: var(--info-text);
}

/* ---------------------------------------------------------------- Selections, research, models */

.lock-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
}
.lock-line > span {
  margin-right: auto;
}
.lock-line .icon {
  color: var(--muted);
}
.coupon-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}
.coupon {
  display: grid;
  gap: 0.35rem;
  justify-items: start;
  padding: 0.85rem 0.95rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  color: var(--muted);
}
.coupon-target {
  color: var(--text);
  font-weight: 650;
}
td.downloads {
  white-space: nowrap;
}
td.downloads a + a {
  margin-left: 0.4rem;
}
.miss-card {
  gap: 0.9rem;
}
.miss-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}
.notes {
  display: grid;
  gap: 0.6rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}
.note-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}
.note-list li {
  padding: 0.55rem 0.8rem;
  border-left: 3px solid var(--line-strong);
  background: var(--card-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.note-form {
  display: grid;
  gap: 0.5rem;
  max-width: 640px;
}
.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}
details.more {
  border-top: 1px solid var(--line);
  padding-top: 0.4rem;
}
details.more > summary,
details.reviewed > summary,
details.intake > summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
}
details.more[open] > summary {
  margin-bottom: 0.5rem;
}
pre.json {
  margin: 0;
  max-height: 22rem;
  overflow: auto;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  font: 0.8rem/1.45 var(--mono);
  white-space: pre;
}
details.reviewed {
  padding: 0.9rem 1rem;
}
details.reviewed[open] > summary {
  margin-bottom: 0.9rem;
}
details.intake {
  padding: 0.6rem 0;
  border-top: 1px solid var(--line);
}
details.intake > summary small {
  display: inline;
  color: var(--muted);
  font-weight: 400;
}
details.intake[open] > summary {
  margin-bottom: 0.6rem;
}
.lock-line small.ok {
  display: block;
}
.readiness {
  display: grid;
  justify-items: start;
  gap: 0.2rem;
}
td.next-step {
  min-width: 14rem;
  max-width: 24rem;
}
.status-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
}
.status-counts > span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}
.status-counts small {
  color: var(--muted);
}
.wide td:first-child {
  min-width: 10rem;
}
.wide .kind {
  display: inline-block;
  min-width: 7.5rem;
}
.status-hero .hero-row,
.hero-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.status-hero .hero-row > div {
  display: grid;
  gap: 0.3rem;
  justify-items: start;
}

/* ---------------------------------------------------------------- History, readiness, health */

.history-filters {
  padding: 0;
}
.history-filters .actions {
  grid-column: auto;
  align-self: end;
}
.history-results {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}
table.history td {
  min-width: 5.5rem;
}
table.history td.match {
  min-width: 13rem;
}
table.selections td.match {
  min-width: 12rem;
}
table.history tr.opened td {
  border-bottom: 0;
  background: var(--card-2);
}
table.history tr.expand > td {
  border-top: 0;
  background: var(--card-2);
  padding-top: 0;
}
.revisions {
  display: grid;
  gap: 0.6rem;
  max-width: 1000px;
}
.revisions .scroll {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--line);
}
.pager span {
  margin-right: auto;
}
.gaps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.5rem;
}
.gap h3 .count {
  color: var(--muted);
  font-weight: 400;
}
.gap-list li {
  margin-bottom: 0.3rem;
}
.gates th,
.gates td {
  padding: 0.55rem 0.45rem;
}
.gate {
  display: inline-block;
  min-width: 3.8rem;
  padding: 0.05rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  font-size: 0.85rem;
  text-align: center;
}
.gate.yes {
  color: var(--hit-text);
  font-weight: 600;
}
.gate.no {
  color: var(--miss-text);
  font-weight: 600;
}
.gate.partial {
  color: var(--warn-text);
  font-weight: 600;
}
.gate.unknown {
  color: var(--muted);
  border-style: dashed;
}
.gates td.blockers {
  min-width: 190px;
}
.synthetic-card {
  border: 2px dashed var(--warn-line);
}
.synthetic {
  display: grid;
  gap: 0.6rem;
  padding: 0.9rem 1rem;
  border: 2px dashed var(--warn-line);
  border-radius: var(--radius);
  background: var(--warn);
}
.synthetic-label {
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--warn-text);
}
.synthetic .scroll {
  background: var(--card);
  border-radius: var(--radius-sm);
}
[aria-busy='true'] {
  opacity: 0.7;
  transition: opacity 0.2s;
}

/* ---------------------------------------------------------------- Dialogs */

dialog {
  width: min(920px, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
dialog[open] {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.9rem;
}
#preset-dialog,
#confirm-dialog {
  width: min(420px, calc(100vw - 2rem));
}
dialog th,
dialog td {
  padding: 0.45rem 0.6rem;
}
dialog::backdrop {
  background: rgb(8 14 22 / 0.55);
}
dialog section {
  display: grid;
  gap: 0.4rem;
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  position: sticky;
  top: -1.25rem;
  margin: -1.25rem -1.4rem 0;
  padding: 1rem 1.4rem 0.75rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  z-index: 1;
}
.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.form {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.9rem;
}
.form .W {
  color: var(--hit-text);
}
.form .L {
  color: var(--miss-text);
}

/* ---------------------------------------------------------------- Narrower screens */

@media (max-width: 1180px) {
  .stat-grid.six {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .stat-grid.five {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .shell {
    display: block;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 86vw);
    transform: translateX(-102%);
    transition: transform 0.22s ease-out;
    box-shadow: var(--shadow-lg);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .drawer-open .sidebar {
    transform: none;
  }
  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgb(8 14 22 / 0.5);
  }
  .scrim[hidden] {
    display: none;
  }
  .drawer-only,
  .mobile-only {
    display: inline-grid;
  }
  .drawer-only {
    margin-left: auto;
    background: transparent;
    border-color: rgb(255 255 255 / 0.2);
    color: #fff;
  }
  .topbar {
    padding: 0.45rem 1rem;
    padding-top: max(0.45rem, env(safe-area-inset-top));
  }
  #content {
    padding: 1.1rem 1rem calc(88px + env(safe-area-inset-bottom));
  }
  .bottom-nav {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 0.25rem 0.25rem calc(0.25rem + env(safe-area-inset-bottom));
    background: var(--card);
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 16px rgb(16 24 40 / 0.06);
  }
  .bottom-nav a,
  .bottom-nav button {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 0.1rem;
    min-height: 54px;
    padding: 0.2rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 550;
    text-decoration: none;
  }
  .bottom-nav .icon {
    width: 22px;
    height: 22px;
  }
  .bottom-nav [aria-current='page'] {
    color: var(--accent);
    background: var(--accent-soft);
  }
  .two-col,
  .lane-grid,
  .coupon-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .slip {
    bottom: calc(76px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 760px) {
  body {
    font-size: 15px;
  }
  input:not([type='checkbox']),
  select,
  textarea {
    font-size: 16px; /* no zoom on focus in iOS */
  }
  h1 {
    font-size: 1.3rem;
  }
  .login-wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
  }
  .login-intro h1 {
    font-size: 1.6rem;
  }
  .login-points {
    display: none;
  }
  .crumb-group {
    display: none;
  }
  .status-pill {
    font-size: 0.78rem;
    padding: 0.15rem 0.55rem;
  }
  .stat-grid,
  .stat-grid.five,
  .stat-grid.six {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }
  .stat {
    min-height: 84px;
    padding: 0.6rem 0.7rem;
  }
  .stat-value {
    font-size: 1.3rem;
  }
  .panel {
    padding: 0.9rem;
  }
  .page-head {
    align-items: stretch;
  }
  .page-head .segmented {
    width: 100%;
  }
  .page-head .segmented button {
    flex: 1;
    padding: 0.35rem 0.4rem;
  }
  .find {
    width: 100%;
  }
  .find input {
    flex: 1;
    min-width: 0;
  }
  .days {
    width: 100%;
  }
  .days h2 {
    flex: 1;
    min-width: 0;
  }
  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .gaps {
    grid-template-columns: minmax(0, 1fr);
  }
  .pager {
    justify-content: flex-start;
  }
  th,
  td {
    padding: 0.5rem 0.6rem;
  }
  /* Wide tables scroll inside their box instead of squeezing every column. */
  .panel .scroll td,
  .history-results .scroll td,
  .group .scroll:not(:has(.games)) td {
    min-width: 6.5rem;
  }
  .scroll table.selections td.match {
    min-width: 12rem;
  }
  .revisions .facts,
  .facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .day-bars li {
    grid-template-columns: 5.5rem minmax(0, 1fr);
  }
  .day-bars .nums {
    grid-column: 2;
    font-size: 0.8rem;
  }
  dialog {
    width: calc(100vw - 1rem);
    max-height: calc(100dvh - 1rem);
    padding: 1rem;
  }
  .dialog-head {
    top: -1rem;
    margin: -1rem -1rem 0;
    padding: 0.85rem 1rem 0.6rem;
  }
  dialog th,
  dialog td {
    padding: 0.4rem 0.3rem;
  }
  dialog .nowrap {
    white-space: normal;
  }
  /* The game table becomes one card per row. */
  .games,
  .games tbody {
    display: block;
  }
  .games thead,
  .games .previous {
    display: none;
  }
  .games tr {
    display: grid;
    grid-template:
      'marks match percent'
      'marks pick state'
      'marks when form' / auto minmax(0, 1fr) auto;
    gap: 0.15rem 0.8rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--line);
  }
  .games td {
    padding: 0;
    border: 0;
  }
  .games .marks {
    grid-area: marks;
    display: grid;
    gap: 0.4rem;
    justify-items: center;
    align-content: start;
  }
  .games .marks input {
    margin: 0.2rem 0 0;
  }
  .games .when {
    grid-area: when;
    color: var(--muted);
  }
  .games .match {
    grid-area: match;
  }
  .games .pick {
    grid-area: pick;
  }
  .games .pick::before {
    content: 'Pick: ';
    color: var(--muted);
  }
  .games .percent,
  .games .form-score,
  .games .state {
    text-align: right;
  }
  .games .percent {
    grid-area: percent;
  }
  .games .state {
    grid-area: state;
    max-width: 150px;
  }
  .games .form-score {
    grid-area: form;
    color: var(--muted);
  }
  .games .form-score::before {
    content: 'Form ';
  }
}

@media (max-width: 420px) {
  .facts,
  .revisions .facts {
    grid-template-columns: minmax(0, 1fr);
  }
  /* Miss facts are short numbers and form strings: two columns keep the card readable. */
  .miss-card .facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .filters {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .sk {
    background: var(--line);
  }
}
