/* ============================================================
   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-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-warn: #e6bd4f;
  --rk-danger: #f06a6a;
  --rk-violet: #a78bfa;
  --rk-live: #ff5d6c;
  --rk-slate: #8a94a3;
  --rk-blue-soft: #7fa3e0;
  --rk-blue-strong: #4a7de0;

  --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);
}

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--rk-text);
  background:
    radial-gradient(1100px 420px at 75% -8%, rgba(59, 157, 240, 0.09), 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: rgba(13, 19, 28, 0.95);
  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: rgba(255, 255, 255, 0.06);
  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);
}

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

.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: #fff;
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.topbar .links a.active {
  color: #fff;
  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;
}

@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: #eef7ff;
  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: #fff;
}

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: #26364a;
  border-color: var(--rk-line-strong);
  color: #fff;
}

button.contrast,
[role='button'].contrast {
  background: var(--rk-danger);
  color: #fff;
}
button.contrast:hover {
  background: #ff7f7f;
}

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 rgba(59, 157, 240, 0.22);
}

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;
}

/* ------------------------------------------------------------
   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 rgba(39, 55, 74, 0.5);
  vertical-align: middle;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

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: rgba(23, 32, 44, 0.6);
}

.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;
}

.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 {
  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: #fff; background: color-mix(in srgb, var(--rk-ok) 24%, #111923); border-color: rgba(53, 201, 138, 0.5); }
.badge.ref { color: #fff; background: color-mix(in srgb, var(--rk-ice) 22%, #111923); border-color: rgba(70, 199, 239, 0.5); }
.badge.team { color: #fff; background: color-mix(in srgb, var(--rk-roller) 24%, #111923); 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: rgba(255, 255, 255, 0.04);
  color: var(--rk-text);
}

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

.desk-flow-step.is-current {
  background: rgba(59, 157, 240, 0.12);
  box-shadow: inset 0 -3px 0 var(--rk-primary);
}

.desk-flow-step.is-current:hover {
  background: rgba(59, 157, 240, 0.16);
  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: #062016;
}

.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: rgba(59, 157, 240, 0.1);
  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: #e6c35c; }
.leader-card.place-2 { border-color: #8a93a3; }
.leader-card.place-3 { border-color: #a56a3a; }

/* ------------------------------------------------------------
   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 rgba(59, 157, 240, 0.28);
}

.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 rgba(59, 157, 240, 0.32);
}

.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-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(9.5rem, 100%), 1fr));
  align-items: start;
  gap: 0.6rem 0.75rem;
  margin-top: 0.9rem;
}

.phase-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  min-width: 0;
}

.phase-row button {
  width: 100%;
}

/* Reserved slot for the hint so a blocker appearing never shifts the buttons. */
.phase-hint {
  margin: 0;
  min-height: 2.5em;
  font-size: 0.8rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.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: rgba(255, 255, 255, 0.04);
}

.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;
  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;
}

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

/* ------------------------------------------------------------
   Misc helpers
   ------------------------------------------------------------ */
.swatch {
  display: inline-block;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 0.3rem;
  border: 1px solid rgba(255, 255, 255, 0.4);
  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.1rem;
  height: 1.1rem;
  object-fit: contain;
  object-position: center;
  border-radius: 0.25rem;
  vertical-align: middle;
  flex: none;
  background: rgba(255, 255, 255, 0.06);
}

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

.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;
}

.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 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::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;
}

/* ------------------------------------------------------------
   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.05rem minmax(0, 1fr) minmax(2.9rem, auto) minmax(0, 1fr) 1.05rem;
  align-items: center;
  column-gap: 0.35rem;
  min-width: 0;
  width: 100%;
}

.match-pair .swatch {
  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,
.weekend-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: #fff;
  text-decoration: none;
}

.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;
}

.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: rgba(255, 255, 255, 0.06);
}

.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: #ffdcdc;
}

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);
}

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

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

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

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

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

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

.weekend-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;
}

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

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

.weekend-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: #b87333; }
.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; }
.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; }
}

/* ============================================================
   Mobile — phones and small tablets
   Everything below is a phone-first layer: comfortable tap
   targets, one control per row where it helps, tables that
   scroll sideways with a pinned first column, and dialogs that
   behave like bottom sheets.
   ============================================================ */

@media (max-width: 720px) {
  :root { --rk-ctl: 2.6rem; }

  html { -webkit-text-size-adjust: 100%; }
  body { font-size: 15px; min-height: 100dvh; }

  h1 { font-size: 1.45rem; }
  h2 { font-size: 1.25rem; }

  /* ---- Shell & safe areas ---- */
  .app-shell {
    padding-left: max(0.7rem, env(safe-area-inset-left));
    padding-right: max(0.7rem, env(safe-area-inset-right));
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
  }

  .app-footer {
    padding-left: max(0.7rem, env(safe-area-inset-left));
    padding-right: max(0.7rem, env(safe-area-inset-right));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }

  /* ---- Top navigation ---- */
  .app-nav {
    --nav-row: 2.7rem;
    margin-bottom: 0.85rem;
    padding-top: env(safe-area-inset-top);
  }

  .topbar {
    padding-left: max(0.7rem, env(safe-area-inset-left));
    padding-right: max(0.7rem, env(safe-area-inset-right));
  }

  .topbar .brand { font-size: 1.02rem; }
  .topbar .brand-ver { font-size: 0.72rem; }
  .topbar .live-link { padding: 0.2rem 0.45rem; font-size: 0.7rem; }
  .topbar .signout { padding: 0.25rem 0.4rem; }

  /* Nav items scroll sideways instead of squeezing into unreadable stubs. */
  .topbar .links {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .topbar .links::-webkit-scrollbar { display: none; }
  .topbar .links a {
    flex: 0 0 auto;
    padding: 0 0.8rem;
    font-size: 0.88rem;
  }

  /* ---- Touch-friendly controls ---- */
  button,
  [type='button'],
  [type='submit'],
  [type='reset'],
  [role='button'],
  input[type='file']::file-selector-button {
    min-height: var(--rk-ctl);
    padding: 0.45rem 1rem;
    font-size: 0.95rem;
  }

  /* 16px keeps iOS from zooming the page when a field gets focus. */
  input,
  select,
  textarea {
    min-height: var(--rk-ctl);
    font-size: 16px;
  }
  input[type='color'] { height: var(--rk-ctl); }
  input[type='checkbox'],
  input[type='radio'] { width: 1.3rem; height: 1.3rem; }

  .search { max-width: none; }

  /* ---- Page headers & blocks ---- */
  .page-head { gap: 0.6rem; align-items: flex-start; }
  .page-head > button { width: 100%; }
  .page-head .season-pick-row { width: 100%; }
  .page-head .muted,
  .block > .muted { max-width: none; }

  .block { padding: 0.9rem 0.85rem; margin-bottom: 0.8rem; }

  .filter-bar { align-items: stretch; }
  .filter-bar .season-pick { min-width: 100%; }
  .filter-bar .count-note { margin-left: 0; }

  .inline-actions { gap: 0.5rem; }

  .login-wrap { margin-top: 1.5rem; }
  article.login-card { padding: 1.1rem 1.05rem; }

  /* Tabs scroll sideways rather than wrapping into many rows. */
  .dash-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .dash-tabs::-webkit-scrollbar { display: none; }
  .dash-tabs button { flex: 0 0 auto; }

  /* ---- Tables ---- */
  .table-wrap {
    -webkit-overflow-scrolling: touch;
    border-radius: var(--rk-radius-sm);
  }
  .table-wrap table { min-width: max-content; }

  table th { padding: 0.4rem 0.5rem; font-size: 0.66rem; }
  table td { padding: 0.45rem 0.5rem; font-size: 0.9rem; }
  table.compact th,
  table.compact td { padding: 0.38rem 0.45rem; }
  table.compact button { min-height: 2rem; padding: 0.2rem 0.6rem; font-size: 0.82rem; }

  /* Pin the first column so a row keeps its context while scrolling. */
  .table-wrap table th:first-child,
  .table-wrap table td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--rk-surface);
    box-shadow: inset -1px 0 0 var(--rk-line);
  }
  .table-wrap table thead th:first-child {
    z-index: 3;
    background: var(--rk-bg-raise);
  }
  .table-wrap table tr.leader td:first-child {
    background: color-mix(in srgb, var(--rk-primary) 14%, var(--rk-surface));
  }
  .table-wrap table tr.suspended td:first-child {
    background: color-mix(in srgb, var(--rk-danger) 16%, var(--rk-surface));
  }
  .table-wrap table tr.exception td:first-child {
    background: color-mix(in srgb, var(--rk-warn) 14%, var(--rk-surface));
  }

  /* ---- Match desk ---- */
  .desk-block,
  .desk-stage { scroll-margin-top: 5.7rem; }

  /* The five-step flow becomes a swipeable rail instead of a tall stack. */
  .desk-flow {
    display: flex;
    grid-template-columns: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .desk-flow::-webkit-scrollbar { display: none; }
  .desk-flow-step {
    flex: 0 0 76%;
    min-width: 76%;
    border-right: 1px solid var(--rk-line);
    border-bottom: none;
    scroll-snap-align: start;
  }
  .desk-flow-step:last-child { border-right: none; }
  .desk-flow-step.is-current { box-shadow: inset 0 -3px 0 var(--rk-primary); }
  .desk-flow-detail { -webkit-line-clamp: 4; }

  .lineup-head { gap: 0.6rem; }
  .lineup-head-tools { align-items: flex-start; }

  .player-list .player-row {
    min-height: 2.5rem;
    padding: 0.3rem 0.35rem;
    gap: 0.55rem;
  }
  .player-list .num-input {
    width: 3rem;
    min-width: 3rem;
    max-width: 3rem;
    height: 2.3rem;
    min-height: 2.3rem;
    font-size: 16px;
  }

  .lineup-foot .inline-actions button { flex: 1 1 auto; }

  .phase-actions { grid-template-columns: minmax(0, 1fr); }
  .score { font-size: 1.75rem; }

  /* ---- Dialogs become bottom sheets ---- */
  dialog,
  dialog.walkover-dialog,
  dialog.snapshot-dialog {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
    max-height: 90vh;
    border-radius: var(--rk-radius) var(--rk-radius) 0 0;
  }

  dialog article {
    max-height: 90vh;
    overflow-y: auto;
    border-radius: var(--rk-radius) var(--rk-radius) 0 0;
    padding: 1rem 1rem calc(1.3rem + env(safe-area-inset-bottom));
  }

  dialog article footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  dialog article footer button { width: 100%; }

  .walkover-sides { padding: 0.6rem 0.7rem; }

  /* Row menus open as a fixed action sheet so they never get clipped
     by a scrolling table and always sit above the content. */
  .row-menu-pop {
    position: fixed;
    top: auto;
    left: max(0.7rem, env(safe-area-inset-left));
    right: max(0.7rem, env(safe-area-inset-right));
    bottom: max(0.7rem, env(safe-area-inset-bottom));
    z-index: 70;
    min-width: 0;
    padding: 0.35rem;
    border-radius: var(--rk-radius);
  }
  .row-menu-pop button {
    padding: 0.75rem 0.85rem;
    font-size: 0.95rem;
    border-radius: var(--rk-radius-sm);
  }

  /* ---- Toast ---- */
  .toast {
    left: max(0.7rem, env(safe-area-inset-left));
    right: max(0.7rem, env(safe-area-inset-right));
    bottom: max(0.7rem, env(safe-area-inset-bottom));
    min-width: 0;
    max-width: none;
  }

  /* ---- Misc ---- */
  .weekend-manage-head { align-items: stretch; }
  .weekend-manage-head select { max-width: none; }
  .weekend-chips li { flex: 1 1 auto; }
}

/* Very small phones: stack the remaining two-column bits. */
@media (max-width: 480px) {
  .upcoming-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
    padding: 0.8rem 0.85rem;
  }
  .upcoming-item .match-pair { grid-column: auto; }
  .upcoming-item .match-tags { justify-content: flex-start; }
  .upcoming-item .act-link { justify-self: start; }

  .topbar .brand-ver { display: none; }
  .live-link span:not(.live-dot) { display: none; }
  .topbar .live-link { gap: 0; padding: 0.25rem 0.5rem; }

  .stat-row { grid-template-columns: minmax(0, 1fr); }
  .grid-cards { grid-template-columns: minmax(0, 1fr); }
  .podium-1, .podium-2, .podium-3 { grid-template-columns: minmax(0, 1fr); }

  .tiebreak-stats { gap: 0.9rem; }
}
