/* ===== Pit Wall design system ===== */

/* Dark is the default/base theme. --accent, --danger, --success stay the
   same vivid hue in both themes since they're only ever used as a solid
   *fill* (button/badge backgrounds) paired with --accent-ink, which works
   against either theme. The *-text variants exist because those same
   hues, used as text/border color, read fine on a dark surface but fail
   contrast on a light one — light theme gives them a darker value instead
   of just inheriting the vivid one. */
:root {
  --bg: #0a1524;
  --surface: #0f2043;
  --surface-2: #14284d;
  --surface-hover: #183258;
  --border: rgba(163, 193, 231, 0.14);
  --border-strong: rgba(163, 193, 231, 0.30);
  --text: #f4f7fb;
  --text-muted: #9db3d6;
  --text-faint: rgba(163, 193, 231, 0.68);
  --accent: #fbd708;
  --accent-ink: #14213d;
  --accent-soft: rgba(251, 215, 8, 0.10);
  --accent-border: rgba(251, 215, 8, 0.30);
  --accent-text: #fbd708;
  --link: #7db4ff;
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, 0.10);
  --danger-border: rgba(255, 107, 107, 0.32);
  --danger-text: #ff6b6b;
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.10);
  --success-text: #4ade80;
  --info: #5a96ff;
  --info-soft: rgba(90, 150, 255, 0.10);
  --info-border: rgba(90, 150, 255, 0.32);
  --info-text: #8fbaff;
  --radius-sm: 7px;
  --radius-md: 11px;
  --radius-lg: 16px;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.5);
  --font-body: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
  --sidebar-w: 236px;
}

:root[data-theme="light"] {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --surface-hover: #e2e9f4;
  --border: rgba(0, 30, 70, 0.12);
  --border-strong: rgba(0, 30, 70, 0.26);
  --text: #0a1524;
  --text-muted: #47597a;
  --text-faint: rgba(10, 21, 36, 0.62);
  --accent-soft: rgba(251, 215, 8, 0.20);
  --accent-border: rgba(158, 122, 0, 0.35);
  --accent-text: #7a5c00;
  --link: #1a56b0;
  --danger-soft: rgba(255, 107, 107, 0.16);
  --danger-border: rgba(190, 45, 45, 0.35);
  --danger-text: #c62828;
  --success-soft: rgba(74, 222, 128, 0.18);
  --success-text: #1f7a40;
  --info-soft: rgba(26, 86, 176, 0.14);
  --info-border: rgba(26, 86, 176, 0.35);
  --info-text: #1a56b0;
  --shadow-sm: 0 2px 10px rgba(20, 33, 61, 0.08);
  --shadow-md: 0 10px 28px rgba(20, 33, 61, 0.12);
  --shadow-lg: 0 24px 64px rgba(20, 33, 61, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

a { color: var(--link); }

.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.accent-text { color: var(--accent-text); }
.badge-inline { margin-left: 8px; }

/* screen-reader-only text — visually hidden but still announced */
.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 — hidden until it receives keyboard focus, so keyboard and
   screen-reader users can bypass the repeated sidebar nav on every page */
.skip-link {
  position: absolute;
  top: -100px;
  left: 12px;
  z-index: 3000;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13.5px;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }

/* consistent, visible keyboard-focus indicator across every interactive
   element — :focus-visible so mouse/touch clicks don't show it, only
   keyboard (and other non-pointer) focus does */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}

/* ===== App shell: sidebar + main ===== */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 22px;
}

.sidebar-brand .mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.sidebar-brand .name {
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: -0.2px;
}

.sidebar-brand .name small {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  font-weight: 400;
  margin-top: 1px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.14s ease, color 0.14s ease;
}

.sidebar-nav a .icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.sidebar-nav a:hover { background: var(--surface-2); color: var(--text); }

.sidebar-nav a.active {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 700;
}

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-team-chip {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 20px;
  text-align: center;
}

.sidebar-signout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.sidebar-signout:hover { border-color: var(--danger-text); color: var(--danger-text); }

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.theme-toggle:hover { border-color: var(--accent-border); color: var(--accent-text); }
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { font-size: 14px; line-height: 1; display: none; }
/* dark mode (default/no attribute): show the sun — "switch to light" */
:root:not([data-theme="light"]) .theme-toggle .icon-sun { display: inline; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: inline; }

/* mobile topbar (shown < 900px instead of sidebar) */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
}

.mobile-topbar .brand-mini {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 14.5px;
}
.mobile-topbar .brand-mini .mark {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12.5px; font-family: var(--font-mono);
}

.hamburger-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
}

.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 6, 20, 0.6);
  z-index: 299;
}

@media (max-width: 900px) {
  .mobile-topbar { display: flex; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim.open { display: block; }
}

.app-main {
  flex: 1;
  min-width: 0;
}

main.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 44px 32px 80px;
}

main.page.wide { max-width: 1080px; }
main.page.narrow { max-width: 680px; }

@media (max-width: 640px) {
  main.page { padding: 28px 18px 56px; }
}

/* ===== Page header ===== */

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.page-head h1 {
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 7px;
}

.page-head p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  max-width: 520px;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 36px 0 14px;
}
.section-label:first-of-type { margin-top: 0; }

/* ===== Loading / error states ===== */

.state-block {
  text-align: center;
  padding: 70px 20px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 14px;
}
.state-block a { color: var(--accent-text); }

.skeleton {
  background: linear-gradient(90deg, rgba(163,193,231,0.06) 25%, rgba(163,193,231,0.14) 37%, rgba(163,193,231,0.06) 63%);
  background-size: 400% 100%;
  animation: skeleton-pulse 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-pulse { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.skeleton-block { height: 14px; margin-bottom: 10px; }
.skeleton-block.w-40 { width: 40%; }
.skeleton-block.w-60 { width: 60%; }
.skeleton-block.w-80 { width: 80%; }
.skeleton-card { height: 84px; border-radius: var(--radius-md); margin-bottom: 14px; }

/* ===== Buttons ===== */

.btn {
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-body);
  border: 1px solid transparent;
  transition: filter 0.14s ease, opacity 0.14s ease, border-color 0.14s ease, color 0.14s ease, background 0.14s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  line-height: 1.2;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--accent-text); color: var(--accent-text); }
.btn-danger { background: transparent; border-color: var(--danger-border); color: var(--danger-text); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-danger.solid { background: var(--danger); color: #2b0000; border-color: transparent; }
.btn-danger.solid:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); padding: 8px 10px; }
.btn-ghost:hover { color: var(--accent-text); }
.btn-sm { padding: 7px 13px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; justify-content: center; }

/* ===== Forms ===== */

.field { margin-bottom: 18px; position: relative; }
.field:last-child { margin-bottom: 0; }

.field label {
  display: block;
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14.5px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
  resize: vertical;
}
.field textarea { min-height: 90px; }
.field select option { background: var(--surface-2); }

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent-text);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Was a hardcoded near-white at low opacity — invisible against the
   light-theme white input background. text-faint tracks the theme. */
.field input::placeholder,
.field textarea::placeholder { color: var(--text-faint); opacity: 0.85; }
.field input[readonly] { color: var(--text-muted); cursor: default; }
.field input:disabled,
.field select:disabled { opacity: 0.45; cursor: not-allowed; }

.field .hint { font-size: 13px; color: var(--text-faint); margin-top: 7px; }
.field label .optional { text-transform: none; font-weight: 400; color: var(--text-faint); letter-spacing: normal; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

.status-msg {
  margin-top: 12px;
  font-size: 13.5px;
  font-family: var(--font-mono);
  display: none;
}
/* Success used the yellow accent color (the same hue as buttons/borders
   everywhere else on the page), so a "saved" message didn't read as a
   distinct positive signal — green plus a checkmark makes it unambiguous
   and doesn't rely on color alone. */
.status-msg.success { display: block; color: var(--success-text); }
.status-msg.error { display: block; color: var(--danger-text); }
.status-msg.success::before { content: "✓ "; }
.status-msg.error::before { content: "✕ "; }

/* lookup dropdown (team search) */
.lookup-status { margin-top: 7px; font-family: var(--font-mono); font-size: 12.5px; color: var(--text-muted); min-height: 14px; }
.lookup-status.error { color: var(--danger-text); }
.lookup-status.success { color: var(--success-text); }

.results-dropdown {
  position: absolute;
  top: 100%; left: 0; right: 0;
  z-index: 40;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  margin-top: 4px;
  overflow: hidden;
  display: none;
  box-shadow: var(--shadow-md);
}
.results-dropdown.open { display: block; }
.result-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s ease;
}
.result-item:last-child { border-bottom: none; }
.result-item:hover { background: var(--accent-soft); }
.result-number { font-family: var(--font-mono); font-size: 13px; color: var(--accent-text); white-space: nowrap; }
.result-name { font-size: 13.5px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-empty { padding: 12px 14px; font-size: 13px; color: var(--text-muted); font-family: var(--font-mono); }

/* ===== Cards ===== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}

.action-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}
.action-card:hover { border-color: var(--accent-border); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.action-card .card-icon {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.action-card h3 { font-size: 16px; font-weight: 700; }
.action-card p { font-size: 13.5px; color: var(--text-muted); line-height: 1.5; }
.action-card .cta { margin-top: auto; font-family: var(--font-mono); font-size: 12.5px; color: var(--accent-text); }

.entry-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  margin-bottom: 14px;
}
.entry-card.clickable { cursor: pointer; transition: border-color 0.15s ease; }
.entry-card.clickable:hover { border-color: var(--accent-border); }
.entry-card.dimmed { opacity: 0.45; }

.entry-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.entry-title { font-size: 15px; font-weight: 700; }
.entry-title .num { color: var(--accent-text); font-family: var(--font-mono); margin-right: 8px; }
.entry-meta { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.entry-actions { display: flex; gap: 8px; flex-shrink: 0; }

.entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
/* Grid items default to min-width:auto, so a long unbroken token (a URL, a
   long word with no spaces) in .info-value below could refuse to shrink
   and force the whole page to scroll horizontally — this lets the cell
   shrink to its track width instead. */
.entry-grid > div { min-width: 0; }
.info-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
  margin-bottom: 3px;
}
.info-value { font-size: 14px; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.info-value.accent { color: var(--accent-text); }

.entries-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 34px 0;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}

/* stat / info strip */
.info-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 24px;
}
.info-item { display: flex; flex-direction: column; gap: 4px; }

/* ===== Badges / pills ===== */

.badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.badge.accent { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-border); }
.badge.danger { background: var(--danger-soft); color: var(--danger-text); border-color: var(--danger-border); }
.badge.success { background: var(--success-soft); color: var(--success-text); border-color: rgba(74,222,128,0.32); }

/* ===== AI callout block (feedback / analysis) ===== */

.ai-block {
  margin-top: 16px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}
.ai-block .ai-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent-text);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 9px;
}
.ai-block .ai-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 4px var(--accent); }
.ai-block .ai-body { font-size: 14px; line-height: 1.6; }
.ai-block.loading .ai-body { color: var(--text-muted); font-family: var(--font-mono); font-size: 13px; }
.ai-block .generated-at { margin-top: 12px; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint); }

/* markdown content shared by chat / feedback / analysis bodies */
.md p { margin: 0 0 10px; }
.md p:last-child { margin-bottom: 0; }
.md strong { color: var(--accent-text); font-weight: 700; }
.md em { font-style: italic; color: var(--text-muted); }
.md ul, .md ol { margin: 4px 0 10px 20px; }
.md li { margin-bottom: 4px; }
.md h1, .md h2, .md h3 { font-size: 15px; font-weight: 700; color: var(--accent-text); margin: 14px 0 7px; }
.md h1:first-child, .md h2:first-child, .md h3:first-child { margin-top: 0; }
.md code { font-family: var(--font-mono); background: rgba(163,193,231,0.12); padding: 2px 5px; border-radius: 4px; font-size: 0.92em; }
.md pre { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; overflow-x: auto; margin: 0 0 10px; }
.md pre code { background: none; padding: 0; font-size: 13px; line-height: 1.5; }
.md blockquote { border-left: 3px solid var(--accent); padding-left: 12px; margin: 0 0 10px; color: var(--text-muted); }
.md a { color: var(--accent-text); text-decoration: underline; }
.md table { border-collapse: collapse; margin: 0 0 10px; font-size: 13.5px; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }

/* ===== Segmented view toggle (event match schedules, past-event views) ===== */

.level-toggle { display: flex; gap: 8px; flex-wrap: wrap; }
.level-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-mono);
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.level-btn:hover { border-color: var(--accent-border); color: var(--text); }
.level-btn.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent-text); font-weight: 700; }

/* ===== Clickable list rows (matches, teams) ===== */

.list-table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s ease;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--accent-soft); }
.list-row .primary { font-size: 14px; font-weight: 600; }
.list-row .secondary { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-muted); text-align: right; }

/* ===== Generic key/value dump (raw API fields in a modal) ===== */

.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.kv-item { display: flex; flex-direction: column; gap: 2px; }
.kv-item .k { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-muted); }
.kv-item .v { font-size: 13.5px; word-break: break-word; }

.modal-subhead {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 20px 0 10px;
}
.modal-subhead:first-of-type { margin-top: 0; }

/* ===== Modal ===== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 6, 20, 0.82);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
  box-shadow: var(--shadow-lg);
}
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: rgba(163, 193, 231, 0.1);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.modal-close:hover { color: var(--accent-text); border-color: var(--accent-text); }
.modal-img { width: 100%; max-height: 42vh; object-fit: contain; border-radius: 10px; background: var(--bg); margin-bottom: 18px; }
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; padding-right: 40px; }
.modal-subtitle { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-muted); margin-bottom: 18px; }
.modal-section { margin-bottom: 16px; }
.modal-section .body { font-size: 14px; line-height: 1.6; white-space: pre-wrap; }

/* ===== Toast ===== */

#toastContainer {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--text);
  box-shadow: var(--shadow-md);
  min-width: 220px;
  max-width: 340px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: auto;
}
.toast.show { opacity: 1; transform: translateY(0); }
/* Success previously reused the yellow accent color, which reads as
   neutral/warning next to all the other yellow-accented chrome on the
   page rather than a clear "it worked" signal — green + a checkmark
   fixes that without relying on color alone. */
.toast.toast-success { border-left-color: var(--success-text); }
.toast.toast-success::before { content: "✓ "; color: var(--success-text); font-weight: 700; }
.toast.toast-error { border-left-color: var(--danger-text); }
.toast.toast-error::before { content: "✕ "; color: var(--danger-text); font-weight: 700; }

/* ===== Misc utility ===== */

.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 0.01ms !important; }
}
