/* ============================================================
   RinkDesk app theme
   Cohesive dark theme layered on top of Pico CSS.
   ============================================================ */

:root {
  --rk-bg: #0b1016;
  --rk-bg-raise: #111923;
  --rk-surface: #17202c;
  --rk-surface-2: #1e2a39;
  --rk-surface-3: #26364a;
  --rk-line: #27374a;
  --rk-line-strong: #3a4f66;
  --rk-text: #e9eff6;
  --rk-muted: #a6b4c3;
  --rk-faint: #74869a;

  --rk-primary: #3b9df0;
  --rk-primary-hover: #5fb2f7;
  --rk-primary-ink: #062033;
  --rk-ice: #46c7ef;
  --rk-roller: #f0a93e;
  --rk-ok: #35c98a;
  --rk-ok-ink: #062016;
  --rk-warn: #e6bd4f;
  --rk-danger: #f06a6a;
  --rk-danger-hover: #ff7f7f;
  --rk-violet: #a78bfa;
  --rk-live: #ff5d6c;
  --rk-slate: #8a94a3;
  --rk-blue-soft: #7fa3e0;
  --rk-blue-strong: #4a7de0;

  --rk-glow: rgba(59, 157, 240, 0.09);
  --rk-nav-bg: rgba(13, 19, 28, 0.95);
  --rk-frost: rgba(255, 255, 255, 0.06);
  --rk-frost-faint: rgba(255, 255, 255, 0.04);
  --rk-scrim: rgba(23, 32, 44, 0.6);

  --rk-on-solid: #fff;
  --rk-button-ink: #eef7ff;
  --rk-badge-base: #111923;
  --rk-gold: #e6c35c;
  --rk-silver: #8a93a3;
  --rk-bronze: #b87333;

  --rk-radius: 0.6rem;
  --rk-radius-sm: 0.4rem;
  --rk-ctl: 2.35rem;

  --pico-primary: var(--rk-primary);
  --pico-primary-hover: var(--rk-primary-hover);
  --pico-background-color: var(--rk-bg);
  --pico-card-background-color: var(--rk-surface);
  --pico-muted-border-color: var(--rk-line);
}

[data-theme="light"] {
  --rk-bg: #eef2f7;
  --rk-bg-raise: #ffffff;
  --rk-surface: #ffffff;
  --rk-surface-2: #e8edf3;
  --rk-surface-3: #d9e1ea;
  --rk-line: #d3dce6;
  --rk-line-strong: #b3c1d1;
  --rk-text: #101923;
  --rk-muted: #4d5b6b;
  --rk-faint: #7b8899;

  --rk-primary: #1f74c9;
  --rk-primary-hover: #155aa3;
  --rk-primary-ink: #ffffff;
  --rk-ice: #1a86b5;
  --rk-roller: #c67a1f;
  --rk-ok: #1f9d63;
  --rk-ok-ink: #ffffff;
  --rk-warn: #b28a1f;
  --rk-danger: #d0313f;
  --rk-danger-hover: #b5242f;
  --rk-violet: #7c5cd0;
  --rk-live: #e0313f;
  --rk-slate: #6b7686;
  --rk-blue-soft: #5b7fc9;
  --rk-blue-strong: #3a63b0;

  --rk-glow: rgba(31, 116, 201, 0.06);
  --rk-nav-bg: rgba(255, 255, 255, 0.94);
  --rk-frost: rgba(10, 20, 35, 0.06);
  --rk-frost-faint: rgba(10, 20, 35, 0.04);
  --rk-scrim: rgba(255, 255, 255, 0.7);

  --pico-primary: var(--rk-primary);
  --pico-primary-hover: var(--rk-primary-hover);
  --pico-background-color: var(--rk-bg);
  --pico-card-background-color: var(--rk-surface);
  --pico-muted-border-color: var(--rk-line);
}

[data-theme="warm"] {
  --rk-bg: #f6efe8;
  --rk-bg-raise: #fbf6f0;
  --rk-surface: #fffdfa;
  --rk-surface-2: #f3e8dc;
  --rk-surface-3: #e8d9c8;
  --rk-line: #e2d3c2;
  --rk-line-strong: #cdbbab;
  --rk-text: #2e2118;
  --rk-muted: #6f5c4b;
  --rk-faint: #9a8571;

  --rk-primary: #b45356;
  --rk-primary-hover: #8f3d40;
  --rk-primary-ink: #ffffff;
  --rk-ice: #3f8f86;
  --rk-roller: #ef7f3d;
  --rk-ok: #3c8a5f;
  --rk-ok-ink: #ffffff;
  --rk-warn: #b07a1f;
  --rk-danger: #c0392b;
  --rk-danger-hover: #9d2c20;
  --rk-violet: #8a5fb0;
  --rk-live: #d23b3b;
  --rk-slate: #8a7b6d;
  --rk-blue-soft: #c98a86;
  --rk-blue-strong: #b45356;

  --rk-glow: rgba(180, 83, 86, 0.08);
  --rk-nav-bg: rgba(251, 246, 240, 0.94);
  --rk-frost: rgba(90, 60, 40, 0.07);
  --rk-frost-faint: rgba(90, 60, 40, 0.05);
  --rk-scrim: rgba(246, 239, 232, 0.7);

  --pico-primary: var(--rk-primary);
  --pico-primary-hover: var(--rk-primary-hover);
  --pico-background-color: var(--rk-bg);
  --pico-card-background-color: var(--rk-surface);
  --pico-muted-border-color: var(--rk-line);
}

html {
  background: var(--rk-bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--rk-text);
  background:
    radial-gradient(1100px 420px at 75% -8%, var(--rk-glow), transparent 60%),
    linear-gradient(180deg, var(--rk-bg-raise) 0%, var(--rk-bg) 340px);
  font-family: ui-sans-serif, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15.5px;
  line-height: 1.5;
}

h1, h2, h3, h4, h5 {
  margin: 0 0 0.35rem;
  line-height: 1.2;
  color: var(--rk-text);
}
h1 { font-size: 1.7rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.08rem; }
h3 .badge { margin-left: 0.4rem; vertical-align: 0.12em; }
h4 { font-size: 0.98rem; }

p { margin: 0 0 0.6rem; }
a { color: var(--rk-primary); text-decoration: none; }
a:hover { color: var(--rk-primary-hover); text-decoration: underline; }

hr {
  border: none;
  border-top: 1px solid var(--rk-line);
  margin: 0.8rem 0;
}

/* ------------------------------------------------------------
   Layout & top navigation
   ------------------------------------------------------------ */
.app-shell {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

/* Global copyright line at the bottom of every page. */
.app-footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.9rem 1rem 1.4rem;
  text-align: center;
  font-size: 0.72rem;
  color: var(--rk-faint);
  opacity: 0.8;
}

/* Top navigation — two equal-height rows */
.app-nav {
  --nav-row: 2.5rem;
  display: block;
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--rk-nav-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rk-line);
  margin-bottom: 1.1rem;
}

.topbar {
  display: flex;
  flex-direction: column;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  box-sizing: border-box;
}

.topbar-meta,
.topbar .links {
  display: flex;
  align-items: center;
  height: var(--nav-row);
  min-height: var(--nav-row);
  max-height: var(--nav-row);
  box-sizing: border-box;
}

.topbar-meta {
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid var(--rk-line);
}

.topbar .identity {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.45rem 0.65rem;
  min-width: 0;
  overflow: hidden;
}

.topbar .brand {
  flex: none;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--rk-text);
  text-decoration: none;
}

.topbar .brand:hover {
  color: var(--rk-primary-hover);
  text-decoration: none;
}

.topbar .brand-ver {
  flex: none;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--rk-faint);
}

.build-stamp {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.55rem;
  color: var(--rk-faint);
  font-size: 0.78rem;
  line-height: 1.25;
}

.build-stamp.compact {
  display: inline-flex;
  flex: none;
  flex-wrap: nowrap;
  margin: 0;
  font-size: 0.68rem;
  font-weight: 500;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0;
  line-height: 1;
}

.build-stamp-name {
  font-weight: 600;
  color: var(--rk-muted);
}

.langs {
  display: inline-flex;
  align-items: center;
  flex: none;
  height: 1.55rem;
  padding: 0.12rem;
  gap: 0.08rem;
  border: 1px solid var(--rk-line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--rk-bg) 70%, var(--rk-surface));
  vertical-align: middle;
}

.langs a,
.app-nav .langs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  min-width: 1.85rem;
  height: 1.3rem;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: none;
  box-shadow: none;
  color: var(--rk-faint);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.langs a:hover,
.app-nav .langs a:hover {
  color: var(--rk-text);
  background: var(--rk-frost);
  text-decoration: none;
}

.langs a.on,
.app-nav .langs a.on {
  color: var(--rk-text);
  background: color-mix(in srgb, var(--rk-primary) 38%, transparent);
}

.langs a.on:hover,
.app-nav .langs a.on:hover {
  color: var(--rk-text);
  background: color-mix(in srgb, var(--rk-primary) 48%, transparent);
}

/* Global season picker in the top bar, next to the language switch.
   The real <select> is invisible on top so the visuals stay fully controlled. */
.topbar .season-global {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: none;
  min-width: 0;
  max-width: 13rem;
  height: 1.55rem;
  padding: 0 0.65rem;
  border: 1px solid var(--rk-line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--rk-bg) 70%, var(--rk-surface));
}

.topbar .season-global:hover {
  border-color: var(--rk-line-strong);
}

.topbar .season-global:focus-within {
  border-color: var(--rk-primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--rk-primary) 45%, transparent);
}

.topbar .season-global-value {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--rk-text);
}

.topbar .season-global-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar .season-global-chevron {
  flex: none;
  width: 0.3rem;
  height: 0.3rem;
  margin-top: -0.12rem;
  border-right: 1.5px solid var(--rk-faint);
  border-bottom: 1.5px solid var(--rk-faint);
  transform: rotate(45deg);
}

.topbar .season-global-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.topbar .links {
  width: 100%;
  gap: 0.15rem;
  min-width: 0;
}

/* Global competition scope: league -> season -> round -> group. */
.topbar .scope-global {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  width: 100%;
  padding: 0.25rem 0.2rem 0;
}

.topbar .scope-field,
.results-bar .scope-field {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rk-faint);
}

.topbar .scope-field select,
.results-bar .scope-field select {
  min-height: 0;
  margin: 0;
  padding: 0.15rem 0.35rem;
  border: 1px solid var(--rk-line);
  border-radius: 0.35rem;
  background: color-mix(in srgb, var(--rk-bg) 70%, var(--rk-surface));
  color: var(--rk-text);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: none;
}

.topbar .links a {
  flex: 1 1 0;
  display: block;
  min-width: 0;
  height: 100%;
  min-height: 0;
  padding: 0 0.35rem;
  border-radius: 0.4rem;
  color: var(--rk-muted);
  font-size: clamp(0.68rem, 1.35vw, 0.88rem);
  font-weight: 500;
  line-height: var(--nav-row);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar .links a:hover {
  color: var(--rk-text);
  background: var(--rk-frost);
  text-decoration: none;
}

.topbar .links a.active {
  color: var(--rk-text);
  background: color-mix(in srgb, var(--rk-primary) 34%, transparent);
}

.topbar .tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.15rem;
  flex: none;
  min-width: 0;
  max-width: 50%;
}

.topbar .acct {
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--rk-faint);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0 0.35rem;
}

.topbar .signout {
  color: var(--rk-muted);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.25rem 0.45rem;
  border-radius: 0.4rem;
  white-space: nowrap;
}

.topbar .signout:hover {
  color: var(--rk-danger);
  background: rgba(240, 106, 106, 0.1);
  text-decoration: none;
}

.topbar .tools .theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  min-width: 2rem;
  height: 1.9rem;
  min-height: 1.9rem;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 1px solid var(--rk-line);
  border-radius: 0.4rem;
  color: var(--rk-muted);
  font-size: 0.95rem;
  line-height: 1;
  box-shadow: none;
  cursor: pointer;
}

.topbar .tools .theme-btn:hover {
  color: var(--rk-text);
  background: var(--rk-frost);
  border-color: var(--rk-line-strong);
}

.topbar .tools .theme-btn.exp {
  font-size: 0.82rem;
}

.topbar .tools .theme-btn.exp.on {
  color: var(--rk-primary-ink);
  background: var(--rk-primary);
  border-color: var(--rk-primary);
}

.topbar .tools .theme-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 860px) {
  .topbar .acct {
    max-width: 6.5rem;
  }
}

@media (max-width: 560px) {
  .topbar .acct {
    display: none;
  }
}

/* ------------------------------------------------------------
   Buttons — one consistent family
   ------------------------------------------------------------ */
button,
[type='button'],
[type='submit'],
[type='reset'],
[role='button'],
input[type='file']::file-selector-button {
  min-height: var(--rk-ctl);
  width: auto;
  padding: 0.4rem 0.95rem;
  border: 1px solid transparent;
  border-radius: var(--rk-radius-sm);
  background: var(--rk-primary);
  color: var(--rk-button-ink);
  font-size: 0.93rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
}

button:hover,
[type='submit']:hover,
[type='reset']:hover {
  background: var(--rk-primary-hover);
  color: var(--rk-on-solid);
}

button:active {
  transform: translateY(1px);
}

button:disabled,
button[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
}

button.secondary,
[role='button'].secondary {
  background: var(--rk-surface-2);
  border-color: var(--rk-line);
  color: var(--rk-text);
}
button.secondary:hover {
  background: var(--rk-surface-3);
  border-color: var(--rk-line-strong);
  color: var(--rk-text);
}

button.danger,
[role='button'].danger {
  background: var(--rk-danger);
  border-color: transparent;
  color: var(--rk-on-solid);
}
button.danger:hover {
  background: var(--rk-danger-hover);
}

button.outline,
[role='button'].outline {
  background: transparent;
  border-color: var(--rk-line-strong);
  color: var(--rk-muted);
}
button.outline:hover {
  color: var(--rk-text);
  border-color: var(--rk-primary);
  background: transparent;
}

/* ------------------------------------------------------------
   Forms
   ------------------------------------------------------------ */
label {
  color: var(--rk-text);
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--rk-ctl);
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius-sm);
  background: var(--rk-surface);
  color: var(--rk-text);
  font-size: 0.95rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--rk-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rk-primary) 22%, transparent);
}

input[type='checkbox'],
input[type='radio'] {
  width: 1.1rem;
  height: 1.1rem;
  min-height: 0;
  accent-color: var(--rk-primary);
}

input[type='color'] {
  padding: 0.15rem;
  height: 2.5rem;
  cursor: pointer;
}

input[type='file'] {
  color: var(--rk-muted);
}

select {
  appearance: auto;
}

textarea {
  min-height: 3.4rem;
  resize: vertical;
}

.compact-form label {
  display: block;
  margin: 0;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--rk-muted);
  line-height: 1.25;
}

.compact-form label > input,
.compact-form label > select,
.compact-form label > textarea {
  margin-top: 0.25rem;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}

.compact-form input,
.compact-form select,
.compact-form textarea {
  margin-bottom: 0;
}

/* Pico gives inputs a computed height but leaves selects to their content, so
   a text input next to a select is a few pixels taller. Pin both to one size. */
.compact-form input:not([type='checkbox']):not([type='radio']):not([type='range']):not([type='file']),
.compact-form select {
  height: var(--rk-ctl);
}

.compact-form button {
  margin-top: 0.35rem;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0;
  padding: 0.15rem 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--rk-text);
  text-transform: none;
  letter-spacing: normal;
}

.check-row input[type='checkbox'] {
  margin-top: 0.2rem;
  flex: none;
}

.check-row small,
.check-row .muted {
  display: block;
  font-weight: 400;
  font-size: 0.82rem;
}

.check-row span {
  display: block;
}

.compact-form label.check-row {
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--rk-text);
  padding-top: 0.3rem;
}

.protocol-check {
  margin: 0.25rem 0 0.6rem;
  padding: 0.6rem 0.75rem;
  border: 1px dashed var(--rk-line-strong);
  border-radius: var(--rk-radius);
  background: color-mix(in srgb, var(--rk-warn) 7%, transparent);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.7rem 0.9rem;
  margin-bottom: 0.5rem;
  align-items: end;
}

.color-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem;
}

.search {
  max-width: 24rem;
}

.login-form > button {
  width: 100%;
  margin-top: 0.6rem;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.inline-actions button {
  margin: 0;
  width: auto;
}

.ref-pair {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.ref-pair > select {
  flex: 1 1 auto;
  min-width: 0;
}

.ref-pair > input,
.ref-pair > select {
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  margin-top: 0;
}

.ref-pair .num-input {
  width: 3.4rem;
  flex: none;
}

.save-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
}

.save-actions-main,
.save-actions-alt {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.save-actions-alt {
  margin-left: auto;
}

.roster-fix-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0;
  padding: 0.6rem 0.85rem;
  border: 1px solid rgba(230, 170, 60, 0.5);
  background: rgba(230, 170, 60, 0.12);
  border-radius: var(--rk-radius);
}

.roster-fix-banner strong {
  color: var(--rk-warn);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.8rem;
}

@media (max-width: 560px) {
  .save-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .save-actions-main,
  .save-actions-alt {
    width: 100%;
  }
  .save-actions-alt {
    margin-left: 0;
  }
}

/* ------------------------------------------------------------
   Tables
   ------------------------------------------------------------ */
table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
}

table th {
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--rk-faint);
  font-weight: 600;
  text-align: left;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--rk-line);
}

table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid color-mix(in srgb, var(--rk-line) 60%, transparent);
  vertical-align: middle;
}

tbody tr:hover {
  background: var(--rk-frost-faint);
}

table.compact th,
table.compact td {
  padding: 0.32rem 0.45rem;
}

table.compact button {
  width: auto;
  min-height: 1.7rem;
  padding: 0.1rem 0.55rem;
  font-size: 0.8rem;
  margin: 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius);
  background: var(--rk-scrim);
}

.table-wrap table {
  width: 100%;
}

/* ------------------------------------------------------------
   Cards, blocks, sections
   ------------------------------------------------------------ */
.block,
article.login-card,
.leader-card {
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius);
  background: var(--rk-surface);
}

.block {
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.block h3 {
  margin-bottom: 0.5rem;
}

.danger-zone {
  border-color: color-mix(in srgb, var(--rk-danger) 40%, var(--rk-line));
  background: color-mix(in srgb, var(--rk-danger) 6%, var(--rk-surface));
}

.danger-zone-head h3 {
  color: var(--rk-danger);
  margin-bottom: 0.25rem;
}

.danger-zone-steps {
  margin: 0.6rem 0 0.9rem 1.1rem;
  color: var(--rk-muted);
  font-size: 0.86rem;
  display: grid;
  gap: 0.3rem;
}

/* Settings: current-season picker and the read-only facts table. */
.settings-pick {
  display: grid;
  gap: 0.3rem;
  max-width: 22rem;
}

.settings-pick > span {
  font-size: 0.78rem;
  color: var(--rk-muted);
}

.settings-facts {
  max-width: 22rem;
  margin-top: 0.5rem;
}

.settings-facts td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* Settings → Statistics: live viewer count and the hourly bar list. */
.stat-now {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.stat-now strong {
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
}

.stat-dot {
  align-self: center;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--rk-ok);
  animation: stat-pulse 1.6s ease-in-out infinite;
}

@keyframes stat-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.stat-sub {
  margin-top: 1rem;
}

.stat-bars {
  width: 100%;
  max-width: 32rem;
}

.stat-bars th,
.stat-bars td {
  padding: 0.15rem 0.35rem;
}

.stat-bars th {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--rk-muted);
}

.stat-hour,
.stat-num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat-num {
  text-align: right;
}

.stat-bar-cell {
  width: 100%;
}

.stat-bar {
  display: block;
  height: 0.6rem;
  min-width: 4rem;
  border-radius: 999px;
  background: var(--rk-line);
  overflow: hidden;
}

.stat-bar > span {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: 999px;
  background: var(--rk-primary);
  transition: width 0.3s ease;
}

/* Settings → Statistics: block header with a right-aligned action. */
.block-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
}

.block-head .muted {
  margin-bottom: 0;
}

/* Current viewer count, large and calm. */
.stat-hero {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.6rem 0 0.9rem;
}

.stat-hero-value {
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-hero-label {
  color: var(--rk-muted);
}

/* Summary cards for the headline viewer metrics. */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.6rem;
  margin: 0.4rem 0 1rem;
}

.stat-card {
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius-sm);
  background: var(--rk-scrim);
  padding: 0.6rem 0.75rem;
  display: grid;
  gap: 0.15rem;
}

.stat-card-value {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-card-label {
  font-size: 0.72rem;
  color: var(--rk-faint);
}

.stat-tracked {
  font-size: 0.78rem;
  margin: 0.2rem 0 0;
}

/* System diagnostics: count chips and a two-column fact list. */
.diag-counts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
  gap: 0.5rem;
  margin: 0.6rem 0 1rem;
}

.diag-count {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius-sm);
  background: var(--rk-scrim);
  padding: 0.5rem 0.7rem;
}

.diag-count strong {
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}

.diag-count span {
  font-size: 0.74rem;
  color: var(--rk-faint);
}

.diag-section {
  margin: 1rem 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rk-faint);
}

.diag-facts {
  display: grid;
  gap: 0.15rem;
  margin: 0;
}

.diag-facts > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: baseline;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--rk-frost-faint);
}

.diag-facts > div:last-child {
  border-bottom: 0;
}

.diag-facts dt {
  color: var(--rk-muted);
  font-size: 0.84rem;
}

.diag-facts dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.diag-facts code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Season & tournament setup panel (opened from Settings → Game). */
.field-readonly {
  display: grid;
  gap: 0.3rem;
  align-content: start;
}

.field-readonly strong {
  font-size: 0.95rem;
}

.setup-grid {
  display: grid;
  grid-template-columns: minmax(16rem, 20rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.setup-season-list {
  list-style: none;
  margin: 0.6rem 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.setup-season-list li {
  display: grid;
  gap: 0.15rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius);
  background: var(--rk-surface-2);
  cursor: pointer;
}

.setup-season-list li:hover:not(.sel) {
  border-color: var(--rk-line-strong);
}

.setup-season-list li.sel {
  border-color: color-mix(in srgb, var(--rk-primary) 55%, var(--rk-line-strong));
  background: color-mix(in srgb, var(--rk-primary) 12%, var(--rk-surface-2));
}

.setup-seasons .compact-form,
.setup-add {
  margin-top: 0.85rem;
}

.setup-seasons h4,
.setup-add h4 {
  margin: 0 0 0.45rem;
  font-size: 0.85rem;
}

@media (max-width: 860px) {
  .setup-grid {
    grid-template-columns: 1fr;
  }
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.8rem 1.2rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.page-head h2 {
  margin: 0 0 0.15rem;
}

.card {
  position: relative;
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius);
  padding: 0.9rem 1rem;
  cursor: pointer;
  background: var(--rk-surface);
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.card:hover {
  border-color: var(--rk-primary);
  transform: translateY(-1px);
}

.card h3 {
  margin-bottom: 0.2rem;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.9rem;
}

.team-stat-card .score-line {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0.2rem 0;
}

.recent-block {
  margin-top: 1.5rem;
}

.upcoming-block h3 {
  margin-bottom: 0.7rem;
}

.upcoming-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.upcoming-list > li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.upcoming-item {
  display: grid;
  grid-template-columns: minmax(9.5rem, 12rem) minmax(12rem, 1fr) auto auto;
  gap: 0.55rem 1rem;
  align-items: center;
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius);
  background: var(--rk-surface);
  box-shadow: none;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.upcoming-item:hover {
  border-color: var(--rk-primary);
  transform: translateY(-1px);
}

.upcoming-meta {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.upcoming-when {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.upcoming-item .match-pair {
  min-width: 0;
}

.upcoming-item .match-tags {
  justify-content: flex-end;
}

@media (max-width: 860px) {
  .upcoming-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .upcoming-item .match-pair {
    grid-column: 1 / -1;
  }

  .upcoming-item .match-tags {
    justify-content: flex-start;
  }
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.stat {
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius-sm);
  padding: 0.7rem 0.85rem;
  background: var(--rk-surface);
}

.stat b {
  display: block;
  font-size: 1.35rem;
}

/* ------------------------------------------------------------
   Badges & pills
   ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--rk-surface-2);
  color: var(--rk-muted);
  border: 1px solid var(--rk-line);
  white-space: nowrap;
}

.badge.ice,
.badge.ice-note { color: var(--rk-ice); background: rgba(70, 199, 239, 0.12); border-color: rgba(70, 199, 239, 0.35); }
.badge.roller { color: var(--rk-roller); background: rgba(240, 169, 62, 0.13); border-color: rgba(240, 169, 62, 0.35); }
.badge.scheduled { color: var(--rk-slate); background: rgba(138, 148, 163, 0.14); border-color: rgba(138, 148, 163, 0.4); }
.badge.partial { color: var(--rk-warn); background: rgba(230, 189, 79, 0.12); border-color: rgba(230, 189, 79, 0.38); }
.badge.submitted { color: var(--rk-blue-soft); background: rgba(127, 163, 224, 0.14); border-color: rgba(127, 163, 224, 0.4); }
.badge.approved { color: var(--rk-blue-strong); background: rgba(74, 125, 224, 0.16); border-color: rgba(74, 125, 224, 0.5); }
.badge.ready { color: var(--rk-violet); background: rgba(167, 139, 250, 0.16); border-color: rgba(167, 139, 250, 0.45); }
.badge.in_progress { color: var(--rk-live); background: rgba(255, 93, 108, 0.16); border-color: rgba(255, 93, 108, 0.5); animation: rk-pulse 2s ease-in-out infinite; }
@keyframes rk-pulse {
  0%, 100% { background: rgba(255, 93, 108, 0.14); border-color: rgba(255, 93, 108, 0.4); }
  50% { background: rgba(255, 93, 108, 0.3); border-color: rgba(255, 93, 108, 0.7); }
}
@media (prefers-reduced-motion: reduce) {
  .badge.in_progress { animation: none; }
}
.badge.played { color: var(--rk-ok); background: rgba(53, 201, 138, 0.13); border-color: rgba(53, 201, 138, 0.4); }
.badge.friendly { color: var(--rk-warn); background: rgba(230, 189, 79, 0.1); border-color: rgba(230, 189, 79, 0.4); font-style: italic; }
.badge.walkover { color: var(--rk-danger); background: rgba(240, 106, 106, 0.12); border-color: rgba(240, 106, 106, 0.45); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.badge.exception { color: var(--rk-warn); background: rgba(230, 189, 79, 0.14); border-color: rgba(230, 189, 79, 0.45); }
.badge.sm {
  padding: 0.02rem 0.35rem;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 0.08em;
}
.badge.active { color: var(--rk-ok); background: rgba(53, 201, 138, 0.12); border-color: rgba(53, 201, 138, 0.35); }
.badge.suspended { color: var(--rk-danger); background: rgba(240, 106, 106, 0.12); border-color: rgba(240, 106, 106, 0.35); }

.badge.admin { color: var(--rk-on-solid); background: color-mix(in srgb, var(--rk-ok) 24%, var(--rk-badge-base)); border-color: rgba(53, 201, 138, 0.5); }
.badge.ref { color: var(--rk-on-solid); background: color-mix(in srgb, var(--rk-ice) 22%, var(--rk-badge-base)); border-color: rgba(70, 199, 239, 0.5); }
.badge.team { color: var(--rk-on-solid); background: color-mix(in srgb, var(--rk-roller) 24%, var(--rk-badge-base)); border-color: rgba(240, 169, 62, 0.5); }

.desk-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0.45rem 0 0.65rem;
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius);
  overflow: hidden;
  background: var(--rk-bg-raise);
}

.desk-flow-step {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0.75rem 0.8rem 0.8rem;
  border: none;
  border-right: 1px solid var(--rk-line);
  border-radius: 0;
  background: transparent;
  color: var(--rk-text);
  text-align: left;
  font-weight: 400;
  box-shadow: none;
  transform: none;
}

.desk-flow-step:last-child {
  border-right: none;
}

.desk-flow-step:hover {
  background: var(--rk-frost-faint);
  color: var(--rk-text);
}

.desk-flow-step:active {
  transform: none;
}

.desk-flow-step.is-current {
  background: color-mix(in srgb, var(--rk-primary) 12%, transparent);
  box-shadow: inset 0 -3px 0 var(--rk-primary);
}

.desk-flow-step.is-current:hover {
  background: color-mix(in srgb, var(--rk-primary) 16%, transparent);
  color: var(--rk-text);
}

.desk-flow-step.is-done {
  background: rgba(53, 201, 138, 0.08);
}

.desk-flow-step.is-done:hover {
  background: rgba(53, 201, 138, 0.12);
  color: var(--rk-text);
}

.desk-flow-step.is-locked {
  color: var(--rk-muted);
}

.desk-flow-index {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  margin-top: 0.1rem;
  border: 1px solid var(--rk-line-strong);
  border-radius: 999px;
  background: var(--rk-surface);
  color: var(--rk-faint);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
}

.desk-flow-step.is-current .desk-flow-index {
  background: var(--rk-primary);
  border-color: var(--rk-primary);
  color: var(--rk-primary-ink);
}

.desk-flow-step.is-done .desk-flow-index {
  background: var(--rk-ok);
  border-color: var(--rk-ok);
  color: var(--rk-ok-ink);
}

.desk-flow-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
}

.desk-flow-tag {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rk-faint);
}

.desk-flow-step.is-current .desk-flow-tag,
.desk-stage.is-current .desk-flow-tag {
  color: var(--rk-primary);
}

.desk-flow-step.is-done .desk-flow-tag,
.desk-stage.is-done .desk-flow-tag {
  color: var(--rk-ok);
}

.desk-flow-step.is-locked .desk-flow-tag,
.desk-stage.is-locked .desk-flow-tag {
  color: var(--rk-warn);
}

.desk-flow-label {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.2;
}

.desk-flow-detail {
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--rk-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.desk-flow-hint {
  margin: 0 0 0.9rem;
  padding: 0.65rem 0.8rem;
  border-left: 3px solid var(--rk-primary);
  border-radius: 0 var(--rk-radius-sm) var(--rk-radius-sm) 0;
  background: color-mix(in srgb, var(--rk-primary) 10%, transparent);
  color: var(--rk-text);
  font-size: 0.9rem;
}

.desk-flow-hint.done {
  border-left-color: var(--rk-ok);
  background: rgba(53, 201, 138, 0.1);
}

/* ------------------------------------------------------------
   Dashboard tabs & standings
   ------------------------------------------------------------ */
.dash-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--rk-line);
  flex-wrap: wrap;
}

.dash-tabs button {
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0.45rem 0.85rem;
  border-bottom: 2px solid transparent;
  color: var(--rk-muted);
  box-shadow: none;
  min-height: 0;
}

.dash-tabs button.on {
  color: var(--rk-text);
  border-bottom-color: var(--rk-primary);
  background: transparent;
}

.standings-table {
  width: 100%;
}

.tiebreak-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.tiebreak-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.tiebreak-block h4 {
  margin: 0;
}

.tiebreak-used {
  grid-column: 1 / -1;
}

@media (max-width: 900px) {
  .tiebreak-stats {
    grid-template-columns: minmax(0, 1fr);
  }
}

.standings-table th,
.standings-table td {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.standings-table thead th[data-tip] {
  position: relative;
  cursor: help;
}

.standings-table thead th[data-tip]:hover,
.standings-table thead th[data-tip]:focus-visible {
  color: var(--rk-text);
}

.standings-table thead th[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 0.28rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  box-sizing: border-box;
  width: max-content;
  max-width: min(16rem, 70vw);
  padding: 0.28rem 0.5rem;
  border: 1px solid var(--rk-line-strong);
  border-radius: var(--rk-radius-sm);
  background: var(--rk-bg-raise);
  color: var(--rk-text);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.35;
  text-align: left;
  text-transform: none;
  white-space: normal;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.standings-table thead th[data-tip]:hover::after,
.standings-table thead th[data-tip]:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

.standings-table thead th[data-tip]:nth-last-child(-n+3)::after {
  left: auto;
  right: 0;
  transform: none;
}

.standings-table th:nth-child(1),
.standings-table td:nth-child(1),
.standings-table th:nth-child(2),
.standings-table td:nth-child(2),
.standings-table th.name,
.standings-table td.name {
  text-align: left;
}

.standings-table .rank {
  color: var(--rk-faint);
  width: 2rem;
}

.standings-table tr.leader td {
  background: color-mix(in srgb, var(--rk-primary) 12%, transparent);
}

.gd-pos { color: var(--rk-ok); font-weight: 600; }
.gd-neg { color: var(--rk-danger); font-weight: 600; }

.jersey {
  display: inline-flex;
  min-width: 1.6rem;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.05rem 0.32rem;
  border-radius: var(--rk-radius-sm);
  background: var(--rk-surface-2);
  border: 1px solid var(--rk-line);
  margin-right: 0.3rem;
}

.legend {
  font-size: 0.8rem;
  color: var(--rk-muted);
  margin: 0.55rem 0 0;
  max-width: 52rem;
  line-height: 1.45;
}

.podium {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1.15rem;
  align-items: stretch;
}

.podium-1,
.podium-2 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.podium-3 { grid-template-columns: 1fr 1.18fr 1fr; }
.podium-3 .place-1 { order: 2; }
.podium-3 .place-2 { order: 1; }
.podium-3 .place-3 { order: 3; }

.leader-card {
  padding: 0.85rem 1rem 1rem;
  text-align: center;
}

.leader-card .place {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rk-faint);
}

.leader-card h3 {
  font-size: 1.05rem;
  margin: 0.35rem 0 0.1rem;
}

.leader-card .big {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0.15rem 0 0;
}

.leader-card .big span {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--rk-muted);
}

.leader-card .detail {
  font-size: 0.78rem;
  margin: 0.25rem 0 0;
}

.leader-card.place-1 {
  border-color: rgba(201, 162, 39, 0.7);
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.25);
}
.leader-card.place-1 .place { color: var(--rk-gold); }
.leader-card.place-2 { border-color: var(--rk-silver); }
.leader-card.place-3 { border-color: var(--rk-bronze); }

/* ------------------------------------------------------------
   Match desk
   ------------------------------------------------------------ */
.desk-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: stretch;
}

.lineup-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.lineup-foot {
  display: grid;
  grid-template-rows: auto 1.45rem auto 1.45rem;
  gap: 0.15rem;
  margin-top: auto;
  padding-top: 0.7rem;
}

.lineup-why {
  min-height: 1.3rem;
  margin-top: 0;
}

.lineup-head-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.desk-block,
.desk-stage {
  scroll-margin-top: 4.6rem;
}

.desk-block.is-current {
  border-color: var(--rk-primary);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--rk-primary) 28%, transparent);
}

.desk-stage {
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius);
  padding: 0.85rem 1rem 1rem;
  margin: 0.85rem 0 0;
  background: var(--rk-bg-raise);
}

.desk-stage.is-current {
  border-color: var(--rk-primary);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--rk-primary) 32%, transparent);
}

.desk-stage.is-done {
  border-color: rgba(53, 201, 138, 0.45);
}

.desk-stage-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.55rem;
}

.desk-stage-head h4 {
  margin: 0;
}

.desk-stage-lock {
  margin: 0 0 0.7rem;
  padding: 0.55rem 0.7rem;
  border-left: 3px solid var(--rk-warn);
  border-radius: 0 var(--rk-radius-sm) var(--rk-radius-sm) 0;
  background: rgba(230, 189, 79, 0.1);
  color: var(--rk-text);
  font-size: 0.9rem;
}

.desk-stage.is-locked .desk-stage-body {
  opacity: 0.48;
  pointer-events: none;
}

.desk-stage.is-done .desk-stage-body {
  opacity: 1;
}

.phase-panel {
  margin-top: 0.9rem;
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius-sm);
  overflow: hidden;
  background: var(--rk-bg);
}

.phase-panel-title {
  margin: 0;
  padding: 0.45rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rk-muted);
  background: var(--rk-bg-raise);
  border-bottom: 1px solid var(--rk-line);
}

.phase-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.75rem;
  border-top: 1px solid var(--rk-line);
}

.phase-item:first-of-type {
  border-top: none;
}

.phase-item.is-active {
  background: color-mix(in srgb, var(--rk-primary) 8%, transparent);
  box-shadow: inset 3px 0 0 var(--rk-primary);
}

.phase-item.is-locked {
  opacity: 0.6;
}

.phase-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--rk-line);
}

.phase-item.is-active .phase-dot {
  background: var(--rk-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rk-primary) 18%, transparent);
}

.phase-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.phase-info strong {
  font-size: 0.9rem;
}

.phase-item .phase-hint {
  margin: 0;
  min-height: 0;
  font-size: 0.78rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.phase-item button {
  min-width: 5.5rem;
}

.start-time-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.6rem;
  margin-top: 0.7rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius-sm);
  background: var(--rk-bg);
}

.start-time-label {
  font-weight: 600;
  font-size: 0.9rem;
}

.start-time-row input[type='time'] {
  width: auto;
}

.start-time-row button {
  margin: 0;
}

.start-time-hint {
  flex: 1 1 100%;
  font-size: 0.8rem;
}

.score {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--rk-text);
}

.lineup-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.select-bulk {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.select-bulk button {
  min-height: 1.7rem;
  padding: 0.1rem 0.5rem;
  font-size: 0.78rem;
  margin: 0;
}

.player-list {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 0.05rem;
  margin-bottom: 0;
}

.player-list .player-row {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  margin: 0;
  padding: 0.18rem 0.3rem;
  border-radius: var(--rk-radius-sm);
  min-height: 1.7rem;
}

.player-list .player-row:hover {
  background: var(--rk-frost-faint);
}

.player-list .player-row.exception {
  background: rgba(230, 189, 79, 0.1);
  box-shadow: inset 3px 0 0 var(--rk-warn);
}

.player-list .player-row.exception:hover {
  background: rgba(230, 189, 79, 0.16);
}

.player-list .badge {
  flex: none;
}

.player-list input[type='checkbox'] {
  margin: 0;
  flex: none;
}

.player-list .player-name {
  display: block;
  margin: 0;
  flex: 1;
  min-width: 0;
  width: auto;
  font-weight: 400;
  font-size: inherit;
  letter-spacing: normal;
  text-transform: none;
  color: inherit;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.player-list .num-input {
  flex: none;
}

.player-list-head {
  min-height: 1.2rem;
  padding-top: 0;
  padding-bottom: 0;
}

.player-list .player-list-head:hover {
  background: transparent;
}

.player-list-head .check-cell {
  flex: none;
  width: 1rem;
  min-width: 1rem;
}

.player-list .num-col-head {
  flex: none;
  box-sizing: border-box;
  width: 2.6rem;
  min-width: 2.6rem;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rk-muted);
  transition: color 0.15s ease;
}

.player-list .num-col-head.active {
  color: var(--rk-primary);
}

.player-list .player-name-head {
  flex: 1;
}

.player-list .num-input.is-active-kit {
  background: color-mix(in srgb, var(--rk-primary) 12%, var(--rk-bg));
  border-color: var(--rk-primary);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rk-primary) 25%, transparent);
}

.kit-picker {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
}

.kit-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.7rem;
  padding: 0.1rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius-sm);
  background: var(--rk-bg);
  color: var(--rk-text);
  cursor: pointer;
  margin: 0;
}

.kit-option.active {
  border-color: var(--rk-primary);
  background: color-mix(in srgb, var(--rk-primary) 12%, var(--rk-bg));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rk-primary) 25%, transparent);
}

.kit-option:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.goalie-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.goalie-col {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.goalie-changes {
  margin-top: 0.6rem;
}

.goalie-change-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  border-top: 1px solid var(--rk-line);
}

.goalie-change-row .badge {
  flex: none;
}

.penalty-end {
  box-sizing: border-box;
  width: 3.4rem;
  min-width: 3.4rem;
  max-width: 3.4rem;
  min-height: 1.45rem;
  height: 1.45rem;
  margin: 0;
  padding: 0 0.15rem;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.penalty-end-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.penalty-end-cell .sm {
  margin: 0;
  padding: 0.1rem 0.45rem;
  font-size: 0.78rem;
}

td.center {
  text-align: center;
}

.num-input {
  width: 2.6rem;
  text-align: center;
}

/* Jersey numbers share one compact size. The roster number input in game
   details is the reference; the team-detail roster and the add-player field
   match it so numbers line up everywhere. */
.player-list .num-input,
.roster-table .num-input,
.license-list td.license-add-cell .num-input {
  box-sizing: border-box;
  width: 2.6rem;
  min-width: 2.6rem;
  max-width: 2.6rem;
  min-height: 1.45rem;
  height: 1.45rem;
  margin: 0;
  padding: 0 0.15rem;
  text-align: center;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.license-list td.license-add-cell .num-input {
  margin: 0 0.2rem 0 0;
}

/* Team detail roster: inline editors matching the game-detail number input and
   the scope pickers, so they sit neatly inside the row instead of stretching. */
.roster-table th.num,
.roster-table td.num,
.roster-table th.pos,
.roster-table td.pos,
.roster-table th.letter,
.roster-table td.letter {
  text-align: center;
  white-space: nowrap;
}

.roster-table select {
  width: auto;
  min-width: 3.2rem;
  min-height: 0;
  margin: 0;
  padding: 0.15rem 0.3rem;
  border-radius: 0.35rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.roster-table .roster-static {
  display: inline-block;
  min-width: 1.6rem;
}

.roster-table td.roster-remove {
  text-align: right;
  white-space: nowrap;
}

.roster-table td.roster-remove .sm {
  padding: 0.2rem 0.45rem;
  font-size: 0.78rem;
}

.license-list td.license-add-cell {
  text-align: right;
  white-space: nowrap;
}

.license-list td.license-add-cell select {
  width: auto;
  min-width: 2.6rem;
  margin: 0 0.2rem 0 0;
  padding: 0.15rem 0.3rem;
  font-size: 0.85rem;
}

.license-list td.license-add-cell .sm {
  padding: 0.2rem 0.45rem;
  font-size: 0.78rem;
}

.roster-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.roster-head h3 {
  margin-top: 0;
}

.roster-head-tools {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.save-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius);
  background: var(--rk-surface);
}

.save-bar-hint {
  margin-right: auto;
  font-size: 0.82rem;
}

.unknown-panel {
  margin-top: 1rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius-sm);
  background: rgba(230, 189, 79, 0.07);
}

.unknown-panel h4 {
  margin: 0 0 0.3rem;
}

.unknown-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-top: 1px solid var(--rk-line);
}

.unknown-row:first-of-type {
  border-top: 0;
}

.unknown-tag {
  font-weight: 600;
  align-self: center;
}

.unknown-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0;
  font-size: 0.75rem;
}

.unknown-field input,
.unknown-field select {
  min-height: 1.7rem;
  margin: 0;
}

.unknown-row .num-input {
  width: 3rem;
}

/* ------------------------------------------------------------
   Misc helpers
   ------------------------------------------------------------ */
.swatch {
  display: inline-block;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 0.3rem;
  border: 1px solid var(--rk-line-strong);
  vertical-align: middle;
  flex: none;
}

.swatch-lg {
  width: 1.6rem;
  height: 1.6rem;
}

.kit-row {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
}

.team-logo {
  display: inline-block;
  width: 1.7rem;
  height: 1.7rem;
  object-fit: contain;
  object-position: center;
  border-radius: 0.3rem;
  vertical-align: middle;
  flex: none;
  background: var(--rk-frost);
}

.team-logo.placeholder {
  border: 1px dashed var(--rk-line-strong);
  background: var(--rk-frost-faint);
}

.team-logo-sm {
  width: 1.5rem;
  height: 1.5rem;
}

.team-logo-lg {
  width: 2.8rem;
  height: 2.8rem;
}

.team-logo-xl {
  width: 4rem;
  height: 4rem;
}

.team-card-logo {
  justify-content: center;
  padding: 0.2rem 0 0.4rem;
}

.team-card-menu {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 2;
}

.logo-preview {
  align-self: end;
  padding-bottom: 0.15rem;
}

.logo-info {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.muted {
  color: var(--rk-muted);
}

.why {
  display: block;
  color: var(--rk-faint);
  font-size: 0.84rem;
  margin-top: 0.3rem;
  line-height: 1.35;
}

.why.error {
  color: var(--rk-danger);
  font-size: 0.9rem;
  font-weight: 600;
  background: rgba(240, 106, 106, 0.12);
  border-left: 3px solid var(--rk-danger);
  border-radius: 0.25rem;
  padding: 0.4rem 0.6rem;
}

.empty {
  border: 1px dashed var(--rk-line-strong);
  border-radius: var(--rk-radius);
  padding: 1.3rem;
  color: var(--rk-muted);
}

.attention-strip {
  font-size: 0.92rem;
  margin: 0 0 1rem;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid var(--rk-warn);
  background: rgba(230, 189, 79, 0.08);
  border-radius: 0 var(--rk-radius-sm) var(--rk-radius-sm) 0;
}

.attention-strip a { margin-left: 0.35rem; }

.disabled-panel {
  opacity: 0.5;
  pointer-events: none;
}

.page-head .muted,
.block > .muted {
  font-size: 0.9rem;
  line-height: 1.4;
  max-width: 44rem;
}

.login-wrap {
  max-width: 480px;
  margin: 3rem auto 0;
  display: grid;
  gap: 1rem;
}

article.login-card {
  padding: 1.4rem 1.5rem;
  background: linear-gradient(180deg, var(--rk-surface) 0%, var(--rk-bg-raise) 100%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.season-dash .page-head { align-items: flex-end; }

.season-pick-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.season-pick {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0;
  min-width: 12rem;
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--rk-muted);
}

.season-pick input,
.season-pick select {
  margin: 0;
  text-transform: none;
  font-weight: 400;
  font-size: 0.92rem;
}

/* ------------------------------------------------------------
   Toast & dialog
   ------------------------------------------------------------ */
.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 60;
  min-width: 240px;
  max-width: 420px;
  padding: 0.8rem 1rem;
  border-radius: var(--rk-radius);
  background: var(--rk-surface-2);
  border: 1px solid var(--rk-line-strong);
  color: var(--rk-text);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.toast.error {
  background: color-mix(in srgb, var(--rk-danger) 18%, var(--rk-bg-raise));
  border-color: var(--rk-danger);
}

dialog {
  border: none;
  padding: 0;
  background: transparent;
  max-width: min(92vw, 30rem);
  border-radius: var(--rk-radius);
}

dialog.snapshot-dialog {
  max-width: min(92vw, 36rem);
}

dialog.editor-dialog {
  max-width: min(92vw, 40rem);
}

dialog.editor-dialog article {
  max-height: min(88vh, 46rem);
  overflow-y: auto;
}

dialog::backdrop {
  background: rgba(4, 8, 13, 0.62);
  backdrop-filter: blur(2px);
}

dialog article {
  margin: 0;
  padding: 1.1rem 1.3rem;
  background: var(--rk-surface);
  border: 1px solid var(--rk-line-strong);
  border-radius: var(--rk-radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

dialog article header { margin-bottom: 0.5rem; }
dialog article header h3 { margin: 0; }
dialog article footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

dialog article footer button { width: auto; }

.walkover-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid rgba(240, 106, 106, 0.45);
  background: rgba(240, 106, 106, 0.1);
  border-radius: var(--rk-radius);
}
.walkover-banner strong {
  color: var(--rk-danger);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.8rem;
}
.walkover-dialog {
  max-width: min(92vw, 32rem);
}
.walkover-sides {
  display: grid;
  gap: 0.4rem;
  margin: 0.75rem 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--rk-line-strong);
  border-radius: var(--rk-radius);
}
.walkover-sides legend {
  padding: 0 0.4rem;
  font-weight: 700;
}

.confirm-files {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.confirm-file {
  display: grid;
  gap: 0.2rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius);
  background: var(--rk-surface-2);
}

.confirm-file.pickable {
  cursor: pointer;
}

.confirm-file.pickable:hover:not(.chosen),
.confirm-file.pickable:focus-visible:not(.chosen) {
  border-color: var(--rk-line-strong);
}

.confirm-file.pickable:focus-visible {
  outline: 2px solid var(--rk-primary);
  outline-offset: 2px;
}

.confirm-file.chosen {
  border-color: color-mix(in srgb, var(--rk-ok) 55%, var(--rk-line-strong));
  background: color-mix(in srgb, var(--rk-ok) 10%, var(--rk-surface-2));
}

.confirm-file-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.confirm-file code {
  display: block;
  word-break: break-all;
  font-size: 0.78rem;
  color: var(--rk-text);
}

.confirm-file p,
.confirm-file small {
  margin: 0;
}

.import-seasons {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.9rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--rk-line);
}

.import-seasons-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.import-seasons .form-grid {
  max-height: 40vh;
  overflow-y: auto;
}

.import-seasons .check-row {
  margin: 0;
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */
@media (max-width: 860px) {
  .desk-grid { grid-template-columns: 1fr; }
  .desk-flow { grid-template-columns: 1fr; }
  .desk-flow-step {
    border-right: none;
    border-bottom: 1px solid var(--rk-line);
  }
  .desk-flow-step:last-child { border-bottom: none; }
  .desk-flow-step.is-current { box-shadow: inset 3px 0 0 var(--rk-primary); }
  .podium-3 { grid-template-columns: 1fr; }
  .podium-3 .place-1,
  .podium-3 .place-2,
  .podium-3 .place-3 { order: 0; }
  .page-head { align-items: flex-start; }
  .season-pick { min-width: 100%; }
}

/* ------------------------------------------------------------
   Print — hockey match protocol
   ------------------------------------------------------------ */
.print-only { display: none; }

.scoresheet {
  color: #122033;
  font-family: "Segoe UI", "Liberation Sans", Arial, sans-serif;
}

.sheet-head,
.sheet-facts,
.sheet-scoreboard,
.sheet-lineups {
  break-inside: avoid;
  page-break-inside: avoid;
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.25rem;
}

.sheet-rule {
  height: 3px;
  background: #0e2a47;
  border-bottom: 2px solid #c8102e;
  margin: 0 0 0.4rem;
}

.sheet-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.sheet-rink {
  width: 3.4rem;
  height: 2.05rem;
  color: #0e2a47;
  flex: none;
}

.sheet-kicker {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #2f6fad;
}

.scoresheet h1 {
  margin: 0.05rem 0 0;
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #0e2a47;
  line-height: 1.15;
  white-space: nowrap;
}

.sheet-head-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.28rem;
}

.sheet-chip {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border: 1px solid #0e2a47;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0e2a47;
  background: #eef4f9;
}

.sheet-chip-ok {
  border-color: #1f7a4d;
  color: #1f7a4d;
  background: #e8f6ee;
}

.sheet-chip-warn {
  border-color: #8a6d12;
  color: #8a6d12;
  background: #f8f1d8;
}

.sheet-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1rem;
  margin: 0 0 0.4rem;
}
.sheet-facts > div {
  min-width: 0;
  flex: 1 1 5.6rem;
}
.sheet-facts .lbl,
.sheet-off-grid .lbl {
  display: block;
  margin: 0;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5a6b7d;
}
.sheet-facts .val,
.sheet-off-grid .val {
  display: block;
  margin: 0.04rem 0 0;
  font-size: 0.8rem;
  font-weight: 650;
  color: #122033;
}

.sheet-scoreboard {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  padding: 0.4rem 0.55rem 0.4rem;
  margin-bottom: 0.45rem;
  background: #eaf3f9;
  border: 1px solid #c5d6e4;
}

.sheet-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.sheet-team {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  flex: 1 1 0;
}
.sheet-team.is-away {
  justify-content: flex-end;
  text-align: right;
}
.sheet-kit {
  width: 0.85rem;
  height: 2.1rem;
  border-radius: 2px;
  border: 1px solid rgba(18, 32, 51, 0.35);
  flex: none;
}
.sheet-side {
  margin: 0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #2f6fad;
}
.sheet-team-name {
  margin: 0.05rem 0 0;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.15;
  color: #0e2a47;
}
.sheet-team-short {
  margin: 0.08rem 0 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: #4a5a6c;
}
.sheet-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex: 0 0 auto;
  gap: 0.12rem;
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: #0e2a47;
  line-height: 1;
}
.sheet-score-sep { color: #c8102e; padding: 0 0.05em; }

.sheet-periods-wrap {
  display: flex;
  justify-content: center;
}

.scoresheet table.sheet-periods {
  width: auto !important;
  margin: 0;
  border-collapse: collapse;
  background: #fff;
}
.scoresheet table.sheet-periods th,
.scoresheet table.sheet-periods td {
  border: 1px solid #b7c9d8;
  padding: 0.14rem 0.7rem;
  text-align: center;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  min-width: 2.1rem;
}
.scoresheet table.sheet-periods thead th {
  background: #0e2a47;
  color: #fff;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid #0e2a47;
}
.scoresheet table.sheet-periods tbody th {
  text-align: left;
  font-weight: 700;
  background: #f4f8fb;
  padding-right: 0.7rem;
}
.scoresheet table.sheet-periods tbody tr:nth-child(even) td {
  background: #fff;
}
.scoresheet table.sheet-periods tbody td:last-child,
.scoresheet table.sheet-periods thead th:last-child {
  font-weight: 800;
  background: #fdecee;
}

.sheet-friendly {
  margin: -0.15rem 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 650;
  color: #8a6d12;
}

.sheet-lineups {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-bottom: 0.45rem;
  align-items: stretch;
}

.sheet-lineup {
  border: 1px solid #c5d6e4;
  overflow: hidden;
}

.sheet-lineup-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.45rem;
  background: #0e2a47;
  color: #fff;
}
.sheet-lineup-head .sheet-kit {
  width: 0.7rem;
  height: 0.7rem;
  border-color: rgba(255, 255, 255, 0.55);
}
.sheet-lineup-head strong {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
}
.sheet-lineup-tag {
  margin-left: auto;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.8;
}

.scoresheet table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}
.scoresheet table th,
.scoresheet table td {
  padding: 0.09rem 0.32rem;
  border-bottom: 1px solid #d5e0ea;
  font-size: 0.74rem;
  color: #122033;
  vertical-align: middle;
}
.scoresheet table thead th {
  background: #eef4f9;
  color: #0e2a47;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-bottom: 2px solid #0e2a47;
}
.scoresheet tbody tr:nth-child(even) td { background: #f7fafc; }
.scoresheet tbody tr.goalie td { background: #eaf3f9; font-weight: 650; }
.scoresheet tbody tr.pad td { background: #fff; height: 0.95rem; }
.scoresheet td.num,
.scoresheet th.num,
.scoresheet td.per,
.scoresheet th.per,
.scoresheet td.clk,
.scoresheet th.clk,
.scoresheet td.min,
.scoresheet th.min,
.scoresheet td.pos,
.scoresheet th.pos,
.scoresheet td.run,
.scoresheet th.run,
.scoresheet td.typ,
.scoresheet th.typ {
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.scoresheet td.num { font-weight: 800; width: 2.1rem; }
.scoresheet td.pos,
.scoresheet th.pos { width: 2.2rem; }
.scoresheet td.let,
.scoresheet th.let { width: 1.5rem; text-align: center; padding-left: 0; padding-right: 0.2rem; }
.scoresheet td.empty {
  text-align: center;
  color: #5a6b7d;
  font-style: italic;
  background: #fff !important;
}
.scoresheet td.run { font-weight: 800; color: #0e2a47; }

.sheet-letter {
  display: inline-flex;
  width: 1.05rem;
  height: 1.05rem;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #0e2a47;
  color: #fff;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1;
}
.sheet-letter.C { background: #c8102e; }

.sheet-pill {
  display: inline-block;
  min-width: 1.7rem;
  padding: 0.02rem 0.22rem;
  border-radius: 2px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: #eef4f9;
  color: #0e2a47;
}
.sheet-pill.PP { background: #fdecee; color: #9b1b2e; }
.sheet-pill.SH { background: #e7f0fa; color: #1d4e89; }
.sheet-pill.EN { background: #eceff2; color: #5a6570; }
.sheet-pill.PS { background: #f8f1d8; color: #8a6d12; }

.sheet-section { margin-bottom: 0.4rem; }
.scoresheet h2 {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #0e2a47;
  border-left: 3px solid #c8102e;
  padding-left: 0.4rem;
}
.scoresheet h3 {
  margin: 0 0 0.15rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #2f6fad;
}

.sheet-officials {
  border: 1px solid #c5d6e4;
  padding: 0.35rem 0.5rem 0.4rem;
  margin-bottom: 0.4rem;
  background: #f7fafc;
  break-inside: avoid;
  page-break-inside: avoid;
}
.sheet-off-grid {
  display: flex;
  gap: 0.4rem 1.2rem;
  margin: 0.1rem 0 0;
}
.sheet-off-grid > div { flex: 1 1 0; }
.sheet-off-grid .val { font-size: 0.84rem; }
.sheet-notes {
  margin: 0 0 0.4rem;
  padding: 0.3rem 0.5rem 0.35rem;
  border: 1px solid #c5d6e4;
  background: #f7fafc;
}
.sheet-notes p {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #3a4a5c;
  white-space: pre-wrap;
}

.sheet-signs h2 { margin-bottom: 0.2rem; }
.sheet-sign-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 0.7rem;
}
.sheet-sign-grid .line {
  display: block;
  height: 1.05rem;
  border-bottom: 1px solid #122033;
}
.sheet-sign-grid span:last-child {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5a6b7d;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 8mm 9mm 10mm;
  }

  :root {
    color-scheme: light;
    --pico-background-color: #fff;
    --pico-color: #122033;
    --rk-bg: #fff;
    --rk-text: #122033;
    --rk-muted: #4a5a6c;
  }

  html, body {
    background: #fff !important;
    color: #122033 !important;
  }

  body {
    font-size: 10pt;
    line-height: 1.3;
    background: #fff !important;
  }

  .no-print,
  .app-nav,
  .toast,
  dialog { display: none !important; }

  .print-only { display: block !important; }

  .app-shell {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .scoresheet {
    color: #122033;
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .scoresheet table thead { display: table-header-group; }
  .scoresheet table tr { break-inside: avoid; page-break-inside: avoid; }

  a { color: inherit; text-decoration: none; }
}

@media (max-width: 860px) {
  .sheet-lineups { grid-template-columns: 1fr; }
  .sheet-sign-grid { grid-template-columns: 1fr 1fr; }
}

/* ------------------------------------------------------------
   Matches list, row menus, license highlights
   ------------------------------------------------------------ */
.filter-bar {
  display: flex;
  gap: 0.6rem 0.9rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  background: var(--rk-bg-raise);
}

.filter-bar .count-note {
  margin-left: auto;
  font-size: 0.86rem;
  white-space: nowrap;
}

table.list-fit td {
  white-space: nowrap;
}

table.results-table thead th {
  text-align: center;
}

table.results-table td {
  text-align: center;
}

table.results-table td.match-cell {
  white-space: normal;
  min-width: 16rem;
  text-align: left;
}

/* The td must stay a real table cell so its bottom border lines up with the
   other cells' row divider. The two-column layout lives on an inner wrapper. */
.match-cell .match-inner {
  display: grid;
  grid-template-columns: minmax(12.5rem, 1fr) auto;
  align-items: center;
  column-gap: 0.55rem;
}

.match-pair {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) minmax(2.9rem, auto) minmax(0, 1fr) 1.5rem;
  align-items: center;
  column-gap: 0.35rem;
  min-width: 0;
  width: 100%;
}

.match-pair .team-logo {
  justify-self: center;
}

.team-short {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.team-short.home {
  text-align: right;
}

.team-short.away {
  text-align: left;
}

.match-mid {
  text-align: center;
  white-space: nowrap;
}

.vs {
  color: var(--rk-faint);
  font-size: 0.78rem;
  font-weight: 600;
}

.score-inline {
  color: var(--rk-text);
  font-variant-numeric: tabular-nums;
}

.dec-sup {
  margin-left: 0.15rem;
  font-size: 0.62em;
  font-weight: 800;
  vertical-align: super;
  color: var(--rk-primary, inherit);
  letter-spacing: 0.02em;
}

.badge.decision {
  background: var(--rk-surface2, rgba(127, 127, 127, 0.12));
  color: var(--rk-muted, inherit);
  border: 1px solid var(--rk-line, rgba(127, 127, 127, 0.25));
}

.match-tags {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.25rem;
  min-width: 6.8rem;
  flex: none;
}

.status-col,
.when-col,
.group-col {
  white-space: nowrap;
}

.actions-col {
  width: 1%;
  text-align: center;
  white-space: nowrap;
}

.inline-actions.compact {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0.2rem;
  justify-content: center;
  align-items: center;
}

.act-link {
  display: inline-flex;
  align-items: center;
  height: 1.45rem;
  min-height: 1.45rem;
  padding: 0 0.45rem;
  border: 1px solid var(--rk-line);
  border-radius: 0.35rem;
  color: var(--rk-text);
  background: var(--rk-surface-2);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.act-link:hover {
  border-color: var(--rk-primary);
  color: var(--rk-primary);
  text-decoration: none;
}

button.act-link,
table.compact button.act-link {
  height: 1.45rem;
  min-height: 1.45rem;
  padding: 0 0.45rem;
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

button.act-download {
  padding: 0 0.4rem;
  font-size: 0.95rem;
  line-height: 1;
}

/* Results panel: the tabs and the group selector share one bar. */
.results-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--rk-line);
}

.results-bar .dash-tabs {
  margin-bottom: 0;
  border-bottom: none;
}

.results-scope {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
}

/* Results games list: keep the game column compact and centered, and leave
   room in the actions column for the open and download buttons. */
.game-results table.results-table td.match-cell {
  min-width: 0;
  text-align: center;
}

.game-results .match-inner {
  grid-template-columns: auto;
  justify-content: center;
}

.game-results .match-pair {
  width: auto;
}

.game-results .match-tags {
  min-width: 0;
  justify-content: center;
}

.game-results .actions-col {
  width: auto;
  min-width: 9rem;
}

/* Results graphics: a mode switch, a shared scope, one focused workspace. */
.graphics-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.graphics-modes {
  display: inline-flex;
  flex-wrap: wrap;
  align-self: flex-start;
  max-width: 100%;
  gap: 0.2rem;
  padding: 0.2rem;
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius);
  background: var(--rk-surface-2);
}

.graphics-modes button {
  margin: 0;
  min-height: 0;
  padding: 0.4rem 1.1rem;
  border: none;
  border-radius: calc(var(--rk-radius) - 0.2rem);
  background: transparent;
  box-shadow: none;
  color: var(--rk-muted);
  font-weight: 600;
}

.graphics-modes button.on {
  background: var(--rk-bg-raise);
  color: var(--rk-text);
}

.graphics-scope {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
}

.graphics-scope .scope-field {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rk-faint);
}

.graphics-scope .scope-field select {
  min-height: 0;
  margin: 0;
  padding: 0.15rem 0.35rem;
  border: 1px solid var(--rk-line);
  border-radius: 0.35rem;
  background: color-mix(in srgb, var(--rk-bg) 70%, var(--rk-surface));
  color: var(--rk-text);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: none;
}

.graphics-workspace {
  display: grid;
  grid-template-columns: minmax(15rem, 18rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.graphics-controls,
.graphics-content {
  padding: 1rem;
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius);
  background: var(--rk-bg-raise);
}

.graphics-controls {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.graphics-controls .scope-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
}

.graphics-controls .scope-field > span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rk-faint);
}

.graphics-controls select,
.graphics-controls input {
  width: 100%;
  margin: 0;
}

.graphics-generate {
  width: 100%;
  margin: 0;
}

.graphics-note {
  margin: 0;
  font-size: 0.82rem;
  color: var(--rk-muted);
}

.graphics-note.over {
  color: var(--rk-danger);
  font-weight: 600;
}

.graphics-content {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
}

.graphics-content-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.graphics-table .pick-col {
  width: 2.4rem;
  text-align: center;
}

.graphics-table .pick-col input {
  width: 1.15rem;
  height: 1.15rem;
  min-height: 0;
  margin: 0;
}

.graphics-table tr.picked td {
  background: color-mix(in srgb, var(--rk-primary) 10%, transparent);
}

.graphics-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.graphics-preview-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rk-faint);
}

.graphics-preview img {
  max-width: min(100%, 30rem);
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius-sm);
}

@media (max-width: 820px) {
  .graphics-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
}

.row-menu {
  position: relative;
  display: inline-flex;
  flex: none;
}

table.compact .row-menu-btn,
.row-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.45rem;
  height: 1.45rem;
  min-height: 0;
  margin: 0;
  padding: 0;
  background: var(--rk-surface-2);
  border: 1px solid var(--rk-line);
  border-radius: 0.35rem;
  color: var(--rk-muted);
  line-height: 1;
  font-size: 0.95rem;
}

.row-menu-btn:hover {
  color: var(--rk-text);
  border-color: var(--rk-line-strong);
}

.row-menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  min-width: 11rem;
  background: var(--rk-surface-2);
  border: 1px solid var(--rk-line-strong);
  border-radius: 0.5rem;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.45);
  padding: 0.25rem;
  display: flex;
  flex-direction: column;
}

/* Teleported to <body> so it is never clipped by a scrolling table. */
.row-menu-pop.fixed {
  position: fixed;
  right: auto;
  top: auto;
}

.row-menu-pop button {
  margin: 0;
  width: 100%;
  min-height: 0;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--rk-text);
  border-radius: 0.35rem;
  padding: 0.45rem 0.6rem;
  font-size: 0.9rem;
}

.row-menu-pop button:hover {
  background: var(--rk-frost);
}

.row-menu-pop button.danger {
  color: var(--rk-danger);
}

.row-menu-pop button.danger:hover {
  background: rgba(240, 106, 106, 0.12);
}

table tr.suspended td {
  background: rgba(240, 106, 106, 0.09);
  color: var(--rk-danger);
}

table tr.suspended td:first-child {
  box-shadow: inset 3px 0 0 var(--rk-danger);
}

table tr.exception td {
  background: rgba(230, 189, 79, 0.08);
}

table tr.exception td:first-child {
  box-shadow: inset 3px 0 0 var(--rk-warn);
}

table tr.suspended.exception td:first-child {
  box-shadow: inset 3px 0 0 var(--rk-danger);
}

table tr.inactive td {
  opacity: 0.55;
}

table tr.inactive td:first-child {
  box-shadow: inset 3px 0 0 var(--rk-faint);
}

.badge.inactive {
  color: var(--rk-muted);
  background: rgba(138, 148, 163, 0.16);
  border-color: rgba(138, 148, 163, 0.45);
}

.badge.anonymous {
  color: var(--rk-violet);
  background: rgba(167, 139, 250, 0.14);
  border-color: rgba(167, 139, 250, 0.45);
}

.plan-page .page-head a,
.protest-page .page-head a {
  font-weight: 600;
}

/* ------------------------------------------------------------
   Plan match — group management panel
   ------------------------------------------------------------ */
.add-group-panel {
  margin-top: 1rem;
}

.group-manage-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.6rem 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.group-manage-head h3 {
  margin-bottom: 0.15rem;
}

.group-manage-head select {
  max-width: 16rem;
}

.group-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0 0 0.9rem;
  padding: 0;
}

.group-chips li {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--rk-line);
  border-radius: 0.55rem;
  background: var(--rk-surface);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.group-chips li:hover {
  border-color: var(--rk-line-strong);
}

.group-chips li.sel {
  border-color: var(--rk-primary);
  background: color-mix(in srgb, var(--rk-primary) 14%, transparent);
}

.group-chips li span {
  color: var(--rk-faint);
  font-size: 0.82rem;
}

.week-add-form {
  border-top: 1px solid var(--rk-line);
  padding-top: 0.8rem;
}

/* ============================================================
   Cup ladder (bracket). Same structure as the live page bracket.
   ============================================================ */
.cup-ladder-wrap { margin-top: 1rem; }
.cup-podium {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  justify-content: center;
  margin-bottom: 1.1rem;
}
.cup-medal {
  min-width: 9rem;
  padding: 0.6rem 0.9rem;
  text-align: center;
  background: var(--rk-surface);
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius);
}
.cup-medal .place {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--rk-muted);
}
.cup-medal h3 { margin: 0.25rem 0 0; font-size: 0.98rem; }
.cup-medal.place-1 { border-color: var(--rk-warn); }
.cup-medal.place-2 { border-color: var(--rk-slate); }
.cup-medal.place-3 { border-color: var(--rk-bronze); }
.cup-ladder {
  display: flex;
  gap: 2.1rem;
  align-items: flex-start;
  overflow-x: auto;
  padding: 0.4rem 0.2rem 1rem;
}
.cup-round {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
  min-width: 14.5rem;
}
.cup-round h4 {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rk-muted);
}
.cup-round-SF { padding-top: 3rem; }
.cup-round-F { padding-top: 6rem; }
.cup-tie {
  position: relative;
  padding: 0.35rem;
  background: var(--rk-surface);
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius);
}
.cup-tie.decided { border-color: var(--rk-line-strong); }
.cup-tie.live {
  border-color: var(--rk-live);
  box-shadow: 0 0 0 1px rgba(255, 93, 108, 0.35);
}
.cup-tie.bye { opacity: 0.82; }
.cup-tie::after {
  content: '';
  position: absolute;
  right: -1.05rem;
  top: 50%;
  width: 1.05rem;
  height: 1px;
  background: var(--rk-line);
}
.cup-round:last-child .cup-tie::after { display: none; }
.cup-tie-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.05rem 0.3rem 0.25rem;
}
.cup-tie-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--rk-faint);
}
.cup-tie-when { font-size: 0.72rem; }
.cup-side {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.4rem;
  border-radius: var(--rk-radius-sm);
  color: inherit;
  text-decoration: none;
}
.cup-side + .cup-side { border-top: 1px solid var(--rk-line); }
.cup-side.winner { background: rgba(53, 201, 138, 0.12); font-weight: 700; }
.cup-seed {
  flex: 0 0 auto;
  min-width: 1.2rem;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--rk-muted);
}
.cup-side-name {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cup-score { font-variant-numeric: tabular-nums; font-weight: 800; }
.cup-third { margin-top: 1.3rem; max-width: 15rem; }
.cup-third h4 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rk-muted);
}
.cup-panel {
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--rk-line);
}
.cup-panel h4 { margin: 0 0 0.25rem; }

/* Two-sided cup bracket: columns converge on the final in the middle. */
.cup-bracket {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 1.4rem;
  overflow-x: auto;
  padding: 0.5rem 0.2rem 1rem;
}
.cup-side { display: flex; gap: 1.4rem; }
.cup-side-right { flex-direction: row-reverse; }
.cup-col {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 13.5rem;
}
.cup-col h4 {
  margin: 0 0 0.6rem;
  text-align: center;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rk-muted);
}
.cup-col-ties {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 0.9rem;
}
.cup-center {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  min-width: 14.5rem;
}
.cup-center h4 {
  margin: 0;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rk-muted);
}
.cup-center .cup-third-title { margin-top: 1rem; }
.cup-tie.big {
  border-color: var(--rk-warn);
  box-shadow: 0 0 0 1px rgba(230, 189, 79, 0.35);
}
.cup-tie-meta {
  margin: 0.15rem 0 0;
  padding: 0 0.35rem;
  font-size: 0.68rem;
  color: var(--rk-faint);
  text-align: center;
}
.cup-side-left .cup-col:not(:last-child) .cup-tie::after,
.cup-side-right .cup-col:not(:last-child) .cup-tie::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 0.9rem;
  height: 1px;
  background: var(--rk-line);
}
.cup-side-left .cup-col:not(:last-child) .cup-tie::after { right: -0.9rem; }
.cup-side-right .cup-col:not(:last-child) .cup-tie::after { left: -0.9rem; }

/* Flashscore-style ladder: one round at a time, each panel on its own. */
.cup-levels {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.2rem 0 1rem;
}
/* Fixed stage so switching levels does not jump the page; each panel is
   centered vertically inside it and sized to its own number of games. */
.cup-ladder-stage {
  display: flex;
  align-items: center;
  justify-content: center;
}
.cup-ladder-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  gap: 0.6rem;
  width: 100%;
  max-width: 30rem;
  margin: 0 auto;
  padding: 0.9rem;
  background: var(--rk-bg-raise);
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius);
}
.cup-ladder-panel .ladder-tie { width: 100%; }
.cup-ladder-panel .cup-tie.is-final {
  border-color: var(--rk-warn);
  box-shadow: 0 0 0 1px rgba(230, 189, 79, 0.35);
}
.cup-ladder-panel .cup-tie.is-third { opacity: 0.92; }

/* Customize on the left, the stage tabs (Final, Quarterfinals, ...) centered
   in the row. The equal 1fr side columns keep the tabs truly centered even
   though the button sits on the left. */
.cup-ladder-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}
.cup-ladder-head .cup-levels {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  justify-content: center;
}
.cup-edit-btn {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  margin: 0;
}
/* Cup ladder editor: reuses the season-setup ladder look, plus a logo per
   side, a remove button and a time/venue so saving can create the games. */
dialog.cup-ladder-dialog { max-width: min(96vw, 76rem); }
.cup-ladder-dialog article { max-height: min(90vh, 50rem); }
.cup-ladder-dialog .form-grid { margin-bottom: 0.9rem; }
/* Two columns so the five stage panels fit without scrolling; one on narrow
   screens. */
.cup-ladder-dialog .setup-ladder {
  grid-template-columns: repeat(auto-fit, minmax(26rem, 1fr));
}
.setup-ladder-tie.editable {
  grid-template-columns: 3.4rem minmax(0, 1fr) auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
}
.setup-ladder-schedule {
  grid-column: 2 / -1;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.setup-ladder-schedule input {
  flex: 1 1 0;
  min-width: 0;
}
.setup-ladder-team {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.setup-ladder-team select { min-width: 0; flex: 1 1 auto; }
.setup-ladder-remove {
  width: 1.8rem;
  min-width: 1.8rem;
  padding: 0;
  margin: 0;
  line-height: 1;
  font-size: 1rem;
}
.setup-ladder-add { margin-top: 0.55rem; }
.setup-ladder-empty { margin: 0 0 0.55rem; }

.setup-ladder {
  display: grid;
  gap: 0.9rem;
}

.setup-ladder-panel {
  border: 1px solid var(--rk-line);
  border-radius: var(--rk-radius-sm);
  padding: 0.75rem 0.9rem 0.9rem;
  background: var(--rk-bg-raise);
}

.setup-ladder-panel h4 {
  margin: 0 0 0.6rem;
}

.setup-ladder-ties {
  display: grid;
  gap: 0.5rem;
}

.setup-ladder-tie {
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1fr) auto minmax(0, 1fr) minmax(0, 10rem) minmax(0, 8rem);
  align-items: center;
  gap: 0.5rem;
}

.setup-ladder-tie input.setup-ladder-datetime,
.setup-ladder-tie input.setup-ladder-venue {
  width: 100%;
  min-width: 0;
}

.setup-ladder-head {
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1fr) auto minmax(0, 1fr) minmax(0, 10rem) minmax(0, 8rem);
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  padding: 0 0.15rem;
}

.setup-ladder-head span {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rk-faint);
}

.setup-ladder-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rk-muted);
}

.setup-ladder-tie select {
  width: 100%;
  min-width: 0;
}

.setup-ladder-vs {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--rk-muted);
}
.cup-tie-caption {
  margin: 0.05rem 0 0.2rem;
  padding: 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rk-faint);
}
.swatch.placeholder {
  background: transparent;
  border: 1px dashed var(--rk-line-strong);
}
.cup-tie-meta { min-height: 1rem; }

/* LIVE button in the top bar: opens the public live page in a new tab. */
.topbar .live-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-right: 0.15rem;
  padding: 0.22rem 0.6rem;
  border: 1px solid rgba(255, 93, 108, 0.5);
  border-radius: 0.4rem;
  color: var(--rk-live);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}
.topbar .live-link:hover {
  color: var(--rk-live);
  background: rgba(255, 93, 108, 0.12);
  border-color: var(--rk-live);
  text-decoration: none;
}
.topbar .live-link .live-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--rk-live);
  box-shadow: 0 0 0 0 rgba(255, 93, 108, 0.55);
  animation: rk-live-dot 1.5s ease-in-out infinite;
}
@keyframes rk-live-dot {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 93, 108, 0.55); }
  50% { opacity: 0.45; transform: scale(0.72); box-shadow: 0 0 0 0.28rem rgba(255, 93, 108, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .topbar .live-link .live-dot { animation: none; }
}

/* Broadcast: pick one game and push its rosters to the overlay. */
.broadcast-grid {
  display: grid;
  grid-template-columns: minmax(15rem, 20rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.broadcast-main {
  min-width: 0;
}

@media (max-width: 860px) {
  .broadcast-grid {
    grid-template-columns: 1fr;
  }
}

.broadcast-table tbody tr {
  cursor: pointer;
}

.broadcast-table tbody tr.selected {
  background: color-mix(in srgb, var(--rk-primary) 10%, transparent);
  box-shadow: inset 3px 0 0 var(--rk-primary);
}

.broadcast-table td.pick-col,
.broadcast-table th.pick-col {
  width: 2.4rem;
  text-align: center;
}

.broadcast-table td.pick-col input[type='checkbox'] {
  margin: 0;
  vertical-align: middle;
}

.broadcast-reason {
  color: var(--rk-warn);
  font-size: 0.86rem;
}

/* Broadcast: goal-scorer / penalty rows with a per-row send button. */
.broadcast-group h4 {
  margin: 0.9rem 0 0.4rem;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.broadcast-events {
  list-style: none;
  margin: 0;
  padding: 0;
}

.broadcast-event {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.9rem;
  padding: 0.45rem 0.25rem;
  border-bottom: 1px solid var(--rk-frost-faint);
}

.broadcast-event:last-child {
  border-bottom: 0;
}

.be-person {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  min-width: 0;
}

.be-number {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--rk-muted);
  min-width: 2rem;
}

.be-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.be-meta {
  color: var(--rk-muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

button.sm {
  min-height: auto;
  padding: 0.22rem 0.6rem;
  font-size: 0.82rem;
}

/* Broadcast: per-button sent marker next to each send action. */
.broadcast-when {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--rk-primary);
  background: color-mix(in srgb, var(--rk-primary) 10%, transparent);
  border-radius: 999px;
  padding: 0.16rem 0.6rem;
  white-space: nowrap;
  margin-top: 0.1rem;
}

.broadcast-event .be-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.broadcast-mark {
  font-weight: 700;
  font-size: 0.9rem;
  width: 1.1rem;
  text-align: center;
  cursor: default;
}

.broadcast-mark.ok {
  color: var(--rk-ok);
}

.broadcast-mark.error {
  color: var(--rk-danger);
}

.inline-actions .broadcast-mark {
  width: auto;
  font-size: 1rem;
}

/* Broadcast: game results panel with score and per-goal summary. */
.broadcast-result-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.9rem;
  padding: 0.6rem 0 0.2rem;
  font-variant-numeric: tabular-nums;
}

.broadcast-result-score .brs-team {
  font-weight: 600;
  min-width: 3rem;
  text-align: center;
}

.broadcast-result-score .brs-team:first-child {
  text-align: right;
}

.broadcast-result-score .brs-score {
  font-size: 1.5rem;
  font-weight: 700;
}

.broadcast-result-list {
  list-style: none;
  margin: 0.4rem 0 0.6rem;
  padding: 0;
}

.broadcast-result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.2rem 0.8rem;
  align-items: baseline;
  padding: 0.3rem 0.25rem;
  border-bottom: 1px solid var(--rk-frost-faint);
}

.broadcast-result-row:last-child {
  border-bottom: 0;
}

.brr-side {
  grid-column: 1;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--rk-muted);
}

.brr-scorer {
  grid-column: 2;
  grid-row: 1 / span 2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brr-time {
  grid-column: 1;
  color: var(--rk-faint);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

/* Broadcast table tab: the same game detail the live page shows, split
   home/away and fed by the selected game. It breaks out of the desk's centred
   shell and fills the viewport, and its frame is fixed so only the rows inside
   change — adding a goal never moves or resizes the table. */
.app-shell:has(.broadcast-grid--table) {
  max-width: none;
}

.broadcast-grid--table {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  align-items: stretch;
  height: calc(100dvh - 15rem);
  min-height: 32rem;
}

.broadcast-table-block {
  height: 100%;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}

.broadcast-table-viewport {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 0.25rem 0.25rem;
}

/* Scoreboard header above the table: teams, score, time and status, mirroring
   the live game-list row. It sits outside the scrolling viewport so it stays
   put while only the rows below change. */
.broadcast-matchhead {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 0.25rem;
  border-bottom: 1px solid var(--rk-line);
}

.bm-when {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.bm-date {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bm-actual {
  color: var(--rk-live);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.bm-teams {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
}

.bm-team {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.bm-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bm-score {
  font-size: 2.4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bm-dec {
  margin-left: 0.3rem;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--rk-muted);
}

@media (max-width: 860px) {
  .broadcast-grid--table {
    grid-template-columns: 1fr;
    height: auto;
  }

  .broadcast-table-block {
    height: auto;
  }

  .broadcast-table-viewport {
    height: calc(100dvh - 24rem);
    min-height: 28rem;
  }
}

.broadcast-walkover {
  margin: 0.1rem 0 0.45rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--rk-live);
}

.broadcast-events-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
}

.broadcast-events-side {
  min-width: 0;
}

.broadcast-events-team {
  margin: 0 0 0.25rem;
  padding-bottom: 0.15rem;
  border-bottom: 2px solid var(--rk-line);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--rk-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.broadcast-events-side.home .broadcast-events-team {
  border-bottom-color: var(--rk-primary);
  color: var(--rk-primary);
}

.broadcast-events-side.away .broadcast-events-team {
  border-bottom-color: var(--rk-live);
  color: var(--rk-live);
}

.broadcast-goals-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.8rem;
}

.broadcast-goals-table th {
  padding: 0.25rem 0.4rem;
  text-align: left;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--rk-muted);
  border-bottom: 1px solid var(--rk-line);
}

.broadcast-goals-table td {
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid var(--rk-line);
  vertical-align: top;
}

.broadcast-goals-table tr:last-child td {
  border-bottom: none;
}

.broadcast-goals-table th:first-child,
.broadcast-goals-table td:first-child {
  width: 6rem;
}

.broadcast-shootout-table th:first-child,
.broadcast-shootout-table td:first-child {
  width: 4.5rem;
}

.broadcast-shootout-table th:last-child,
.broadcast-shootout-table td:last-child {
  width: 7rem;
}

.bt-time {
  color: var(--rk-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bt-player {
  min-width: 0;
}

.bt-jersey {
  display: inline-block;
  min-width: 1.3rem;
  margin-right: 0.25rem;
  text-align: right;
  font-weight: 700;
  color: var(--rk-muted);
  font-variant-numeric: tabular-nums;
}

.bt-empty {
  color: var(--rk-faint);
}

.bt-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.02rem 0.3rem;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: 800;
  background: var(--rk-surface-3);
  color: var(--rk-primary);
  border: 1px solid var(--rk-line);
}

.bt-penalty {
  color: var(--rk-muted);
  white-space: nowrap;
}

.broadcast-shootout,
.broadcast-penalties {
  margin-top: 0.6rem;
}

.broadcast-rule-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.2rem;
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rk-muted);
}

.broadcast-rule-label::before,
.broadcast-rule-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rk-line);
}

.broadcast-shootout-table .bt-result {
  text-align: right;
  white-space: nowrap;
  font-weight: 700;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.broadcast-shootout-table .bt-result.is-scored {
  color: var(--rk-ok);
}

.broadcast-shootout-table .bt-result.is-missed {
  color: var(--rk-live);
}



