:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #657084;
  --line: #d9dee7;
  --paper: #eef7ef;
  --panel: #ffffff;
  --accent: #0f7a6b;
  --accent-dark: #095b50;
  --warn: #b64b21;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  background: var(--paper);
  color: var(--ink);
}

body.page-pending {
  visibility: hidden;
}

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

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24, 33, 47, 0.34);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 30;
}

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 16px 18px;
  background: #f7fbf7;
  border-right: 1px solid var(--line);
  overflow-x: hidden;
  transition: width 0.18s ease, padding 0.18s ease, box-shadow 0.18s ease;
  z-index: 40;
}

.app-brand {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-decoration: none;
  color: var(--ink);
  padding: 4px 38px 12px 2px;
}

.app-brand-kicker {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.app-brand-title {
  font-size: 1.32rem;
  font-weight: 800;
  color: var(--accent-dark);
}

.app-brand.active-nav .app-brand-title {
  color: var(--accent);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}

.sidebar-action-button {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.sidebar-action-button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.sidebar-link:hover {
  background: #edf5ed;
}

.sidebar-link.active-nav {
  background: var(--accent);
  color: #fff;
}

.sidebar-divider {
  height: 1px;
  margin: 8px 4px;
  background: var(--line);
}

.app-main {
  margin-left: 248px;
  min-height: 100vh;
  transition: margin-left 0.18s ease;
}

.app-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 28px 10px;
}

.app-page-headline {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  min-width: 0;
}

.app-page-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}

.app-page-actions .nav-session-label {
  min-height: 42px;
  padding: 0 14px;
  font-size: 0.96rem;
  max-width: min(100%, 640px);
  white-space: normal;
  line-height: 1.3;
}

.app-page-actions .button-link {
  min-height: 42px;
}

.app-content {
  max-width: none;
  margin: 0;
  padding: 0 28px 24px;
}

.sidebar-toggle {
  display: none;
  flex: 0 0 auto;
  min-width: 72px;
  min-height: 38px;
}

.sidebar-collapse-toggle {
  display: none;
  position: absolute;
  top: 14px;
  right: 12px;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--accent-dark);
  font: inherit;
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}

.sidebar-collapse-toggle:hover,
.sidebar-collapse-toggle:focus-visible {
  background: #edf5ed;
  outline: none;
}

h1, h2, p {
  margin: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 20px;
}

p, .muted {
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 14px;
}

.admin-subpanel {
  margin-bottom: 14px;
  padding: 14px;
}

.admin-subtext {
  margin-bottom: 12px;
}

.identity, .final-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.subleague-heading-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.section-note {
  margin-left: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.account-danger-actions {
  display: flex;
  justify-content: flex-end;
  margin-left: auto;
}

.account-delete-button {
  min-height: 0;
  min-width: 0;
  padding: 6px 10px;
  background: #b64b21;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.account-delete-button:hover {
  background: #9f3f1b;
}

.detail-section-heading {
  align-items: center;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 650;
}

input, select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

.invalid-field {
  border-color: var(--warn) !important;
  background: #fff1ec !important;
  box-shadow: 0 0 0 2px rgba(182, 75, 33, 0.12);
}

.invalid-row td {
  background: #fff6f2;
}

.invalid-row td:first-child {
  border-left: 4px solid var(--warn);
}

.invalid-section {
  border: 1px solid var(--warn);
  border-radius: 8px;
  padding: 8px;
  background: #fff8f5;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 6px;
  padding: 9px 14px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  text-decoration: none;
}

.text-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.auth-inline-link {
  margin-top: 8px;
}

.button-link.active-nav {
  background: var(--accent-dark);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.app-brand.active-nav {
  background: transparent;
  box-shadow: none;
}

.nav-session-label {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 0.9rem;
  white-space: nowrap;
}

.nav-session-label.admin-session {
  border-color: #f2c792;
  background: #fff1dc;
  color: #8a5205;
}

.stats-meta .scoreboard-meta {
  margin: 0;
}

.stats-grid {
  display: grid;
  gap: 16px;
}

.stats-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stats-grid.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stats-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.stats-chart-card {
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(240, 247, 249, 0.96), rgba(255, 255, 255, 0.96)),
    #fff;
}

.chart-head {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.chart-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.chart-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
  max-width: 62ch;
}

.chart-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
}

.chart-actions .button-link {
  min-height: 34px;
  padding: 0 12px;
}

.progress-chart-mode-controls,
.progress-chart-selection-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.progress-chart-mode-controls {
  padding: 2px;
  border: 1px solid #dbe3ec;
  border-radius: 8px;
  background: #f3f7fa;
}

.progress-chart-mode-button {
  background: transparent;
  color: var(--accent-dark);
}

.progress-chart-mode-button:hover,
.progress-chart-mode-button.is-active {
  background: var(--accent);
  color: #fff;
}

.chart-plot-wrap {
  border: 1px solid #dbe3ec;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f8fbfd);
  padding: 10px;
  overflow: hidden;
}

.progress-chart-svg {
  display: block;
  width: 100%;
  height: 420px;
}

.progress-chart-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 4px 12px;
  margin-top: 14px;
  max-height: 300px;
  overflow: auto;
  padding-right: 2px;
}

.progress-chart-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  user-select: none;
  font-size: 0.94rem;
  font-weight: 400;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
  color: var(--text);
}

.progress-chart-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.progress-chart-legend-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
  color: var(--text);
}

.progress-chart-legend-total {
  color: var(--muted);
  font-size: 0.86rem;
  white-space: nowrap;
  font-weight: 400;
}

.progress-chart-legend-item.is-hidden {
  opacity: 0.58;
  color: var(--muted);
}

.progress-chart-legend-item.is-hovered {
  opacity: 1;
  color: var(--text);
  text-shadow: 0 0 0 currentColor;
}

.progress-chart-legend-item.is-hovered .progress-chart-legend-name,
.progress-chart-legend-item.is-hovered .progress-chart-legend-total {
  color: var(--text);
}

.progress-chart-legend-item.is-muted {
  opacity: 0.72;
}

.progress-chart-empty {
  display: grid;
  place-items: center;
  min-height: 320px;
  color: var(--muted);
  font-size: 0.98rem;
}

.progress-chart-empty-label {
  fill: var(--muted);
  font-size: 16px;
}

.progress-chart-axis-label {
  fill: var(--muted);
  font-size: 12px;
}

.progress-chart-title {
  fill: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.progress-chart-grid {
  stroke: #dbe3ec;
  stroke-width: 1;
}

.progress-chart-band {
  pointer-events: none;
}

.progress-chart-boundary {
  stroke: rgba(47, 64, 83, 0.6);
  stroke-width: 1.5;
  stroke-dasharray: 4 6;
  pointer-events: none;
  vector-effect: non-scaling-stroke;
  shape-rendering: crispEdges;
}

.progress-chart-section-label {
  fill: #516579;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.progress-chart-axis {
  stroke: #8ea0b4;
  stroke-width: 1.2;
}

.progress-chart-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 120ms ease, stroke-width 120ms ease, filter 120ms ease;
}

.progress-chart-line.is-muted {
  opacity: 0.14;
}

.progress-chart-line.is-hovered {
  stroke-width: 3.2;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.16));
}

.progress-chart-point {
  stroke: #fff;
  stroke-width: 1.5;
  transition: opacity 120ms ease, r 120ms ease, filter 120ms ease;
}

.progress-chart-point.is-muted {
  opacity: 0.16;
}

.progress-chart-point.is-hovered {
  r: 5;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.22));
}

.admin-hidden-part {
  position: relative;
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(201, 213, 189, 0.16) 0,
      rgba(201, 213, 189, 0.16) 10px,
      rgba(255, 255, 255, 0) 10px,
      rgba(255, 255, 255, 0) 20px
    ),
    var(--panel);
  border-color: #c7d5c7;
}

.flag-emoji {
  display: inline-block;
  min-width: 18px;
  margin-right: 6px;
  line-height: 1;
  vertical-align: -1px;
}

.stats-card h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.stats-table th,
.stats-table td {
  vertical-align: top;
}

.stats-table th.num,
.stats-table td.num {
  text-align: right;
}

.stats-table th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.stats-table th.sortable::after {
  content: "";
  display: inline-block;
  width: 10px;
  margin-left: 6px;
}

.stats-table th.sortable.sorted-asc::after {
  content: "\25B2";
  font-size: 10px;
}

.stats-table th.sortable.sorted-desc::after {
  content: "\25BC";
  font-size: 10px;
}

.stats-matchwide-table {
  table-layout: fixed;
}

.stats-matchwide-table .matchwide-col,
.stats-matchwide-table th:first-child,
.stats-matchwide-table td:first-child {
  width: var(--matchwide-width, 30ch);
  white-space: nowrap;
}

.stats-part1-wide-table {
  table-layout: fixed;
}

.stats-part1-wide-table th:first-child,
.stats-part1-wide-table td:first-child {
  width: var(--matchwide-width, 30ch);
  white-space: nowrap;
}

.stats-part1-wide-table th:nth-child(2),
.stats-part1-wide-table td:nth-child(2) {
  width: 5.5rem;
  white-space: nowrap;
}

.stats-part1-wide-table th:nth-child(3),
.stats-part1-wide-table td:nth-child(3) {
  width: auto;
}

.top-country-row td {
  background: #e7f7e8;
}

.top-country-row td:first-child {
  border-left: 4px solid #6dbb78;
}

.stats-detail-row {
  margin-bottom: 6px;
}

.stats-detail-row:last-child {
  margin-bottom: 0;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.secondary-button {
  background: #f7e3c6;
  color: #8a5205;
  border: 1px solid #f2c792;
}

.secondary-button:hover {
  background: #f3d7af;
}

.secondary-button.active-toggle {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.auth-mode-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.auth-form {
  margin-bottom: 12px;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 8px;
  margin: -8px -8px 18px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.header-tabs {
  padding: 0;
  margin: 0;
  border-bottom: 0;
}

.dashboard-subnav {
  margin: 0 0 18px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--line);
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.compact-quick-links {
  margin-top: 0;
}

.compact-panel {
  padding-top: 12px;
  padding-bottom: 12px;
}

.admin-tabs {
  margin: -4px -4px 18px;
}

.admin-view {
  display: none;
}

.admin-view.active {
  display: block;
}

.admin-view .admin-block {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.admin-view .admin-block:first-of-type {
  padding-top: 6px;
}

.admin-view .admin-block:last-of-type {
  border-bottom: 0;
}

.compact-player-table-wrap {
  max-height: 68vh;
  border: 1px solid var(--line);
}

.compact-player-table {
  font-size: 0.8rem;
}

.compact-player-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.compact-player-table th,
.compact-player-table td {
  padding: 4px 6px;
  vertical-align: middle;
}

.sort-header-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

.sort-header-button:hover {
  background: transparent;
}

.sort-header-button.active-sort {
  color: var(--accent-dark);
}

.sort-indicator {
  display: inline-block;
  width: 10px;
  text-align: center;
  font-size: 0.72rem;
}

.header-filter-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-filter-input {
  width: 18ch;
  min-height: 26px;
  padding: 3px 6px;
  font-size: 0.76rem;
}

.compact-player-table .center-col {
  width: 78px;
  text-align: center;
}

.compact-player-table input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  height: 16px;
  margin: 0;
}

.small-button {
  padding: 4px 8px;
  min-height: 26px;
  font-size: 0.78rem;
}

.player-selection-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.danger-button {
  background: var(--warn);
}

.danger-button:hover {
  background: #9f3f1b;
}

.stats-highlight-grid,
.stats-highlight-card {
  margin-bottom: 18px;
}

.stats-highlight-card {
  background: linear-gradient(180deg, #ffffff 0%, #f7fcf7 100%);
  border-color: #cfe3d1;
}

.maximum-score-summary {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.maximum-score-summary strong {
  color: var(--accent);
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  line-height: 1;
}

.maximum-score-breakdown {
  display: grid;
  gap: 8px;
}

.maximum-score-breakdown div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #d8ead9;
  border-radius: 8px;
  background: #f3fbf4;
}

.maximum-score-breakdown span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.maximum-score-breakdown strong {
  color: var(--accent-dark);
  font-size: 1.18rem;
}

.manual-prediction-row {
  background: #fff2a8;
}

.admin-edit-cell {
  white-space: nowrap;
}

.icon-button {
  min-width: 30px;
  margin-left: 4px;
  padding: 5px 8px;
}

.confirm-prediction-edit {
  background: #18864b;
}

.cancel-prediction-edit {
  background: #b43b32;
}

.revert-prediction-change {
  background: #6a7280;
}

.prediction-part-heading {
  margin-top: 24px;
}

.prediction-part2-edit-head {
  align-items: flex-start;
  gap: 14px;
  margin: 0 0 12px;
}

.prediction-part2-edit-head .team-counter {
  margin-bottom: 0;
}

.prediction-part2-edit-head p {
  margin: 0;
  color: var(--muted);
  text-align: right;
}

.admin-team-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}

.prediction-part3-edit {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.prediction-part3-edit label > div {
  display: grid;
  gap: 5px;
  margin-top: 5px;
}

.detail-close-button {
  margin-left: auto;
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
  line-height: 1;
}

.detail-close-button:hover {
  background: #f3f6fa;
  color: var(--ink);
}

.delete-player-button {
  width: 26px;
  min-width: 26px;
  min-height: 26px;
  padding: 0;
  background: #fff;
  color: var(--warn);
  border: 1px solid #e1b8a7;
  font-size: 0.78rem;
  line-height: 1;
}

.delete-player-button:hover {
  background: #fff6f2;
  color: var(--warn);
}

.backup-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border-radius: 6px;
  padding: 9px 14px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.file-button:hover {
  background: var(--accent-dark);
}

.compact-checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.compact-checkbox-grid label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.88rem;
  font-weight: 400;
}

.compact-checkbox-grid input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  height: 16px;
  margin: 0;
}

.compact-form-grid {
  display: grid;
  grid-template-columns: minmax(180px, max-content) minmax(88px, 120px);
  align-items: center;
  gap: 8px 12px;
  max-width: 520px;
}

.compact-form-grid label {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
}

.compact-form-grid input[type="number"] {
  width: 100%;
  min-height: 34px;
  padding: 6px 9px;
}

.admin-credentials {
  display: grid;
  gap: 8px;
  max-width: 360px;
}

.compact-text-input {
  width: 12ch;
  max-width: 100%;
}

.compact-password-input {
  width: 24ch;
  max-width: 100%;
}

.player-account-tools {
  display: flex;
  align-items: end;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.admin-account-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.admin-account-filter {
  width: 28ch;
}

.admin-account-scroll {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-account-section {
  margin-top: 18px;
}

.admin-account-list {
  display: grid;
  gap: 0;
}

.admin-account-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.admin-account-card:last-child {
  border-bottom: 0;
}

.admin-account-card.active-admin {
  background: #fff9ef;
}

.admin-account-main {
  min-width: 0;
}

.admin-account-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-account-email {
  font-weight: 400;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.player-account-tools > div {
  min-width: 260px;
}

.player-email-input {
  min-height: 28px;
  padding: 4px 6px;
  font-size: 0.8rem;
  width: 100%;
}

.player-email-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.player-email-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex: 0 0 auto;
}

.table-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.table-pagination-left,
.table-pagination-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.table-pagination select {
  min-height: 34px;
  padding: 4px 8px;
}

.admin-credentials > div {
  display: grid;
  grid-template-columns: 150px auto;
  align-items: center;
  gap: 10px;
}

.admin-credentials label {
  margin: 0;
}

.admin-login-fields {
  display: grid;
  gap: 10px;
  max-width: 430px;
}

.admin-login-fields > div {
  display: grid;
  grid-template-columns: 150px 24ch;
  align-items: center;
  gap: 10px;
}

.admin-login-fields label {
  margin: 0;
}

.admin-login-fields input {
  width: 24ch;
}

.secondary-button {
  background: #fff;
  color: var(--accent-dark);
  border: 1px solid var(--line);
}

.secondary-button:hover {
  background: #f3f6fa;
}

.admin-import-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.admin-import-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
}

.admin-import-list-wrap {
  align-self: start;
}

.admin-import-list {
  display: grid;
  gap: 8px;
}

.admin-import-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  font-weight: 600;
}

.admin-import-item:hover {
  background: #f7fafc;
}

.admin-import-item.active {
  border-color: #42a991;
  background: #e8f8f4;
  color: var(--accent-dark);
}

.admin-import-item.saved {
  border-color: #a8d4c8;
}

.admin-import-select {
  width: 100%;
  text-align: left;
  background: transparent;
  color: inherit;
  padding: 0;
}

.admin-import-select:hover {
  background: transparent;
}

.admin-import-item .meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.admin-import-review.hidden {
  display: none;
}

.import-review-heading {
  margin-bottom: 12px;
}

.import-identity {
  margin-bottom: 14px;
}

.import-review-panel {
  margin-bottom: 14px;
}

.import-uncertain-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  background: #fff1ec;
  color: var(--warn);
  font-size: 0.76rem;
  font-weight: 700;
}

.player-tabs-row {
  margin: 0 0 14px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--line);
}

.player-tabs-row.hidden {
  display: none;
}

.tab {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 14px;
  background: #fff8d7;
  color: #654f07;
  white-space: nowrap;
}

.tab:nth-child(n+2) {
  background: #ffe8cf;
  color: #704013;
}

.tab.player-tab {
  background: #eaf5f3;
  color: var(--accent-dark);
}

.player-tabs-row .player-tab {
  min-height: 34px;
  padding: 7px 12px;
}

.player-back-tab {
  background: transparent;
  border: 0;
  color: var(--accent-dark);
  padding: 4px 0;
  min-height: 0;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.player-back-tab:hover,
.player-back-tab.active {
  background: transparent;
  color: var(--accent);
}

.tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.table-wrap {
  overflow: auto;
}

#statsPart1Section .table-wrap,
#statsPart2Section .table-wrap,
#statsPart3Section .table-wrap {
  max-height: min(42vh, 420px);
  overflow: auto;
  scrollbar-gutter: stable;
}

#statsPart1Section .table-wrap table,
#statsPart2Section .table-wrap table,
#statsPart3Section .table-wrap table {
  margin-bottom: 0;
}

#statsPart3Section .stats-grid.three-col + .stats-grid.two-col {
  margin-top: 6px;
}

#statsPart3Section .stats-grid.three-col + .stats-grid.two-col > .stats-card {
  grid-column: 1 / -1;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th, td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f0f3f7;
  color: #4b5567;
  font-size: 12px;
  text-transform: uppercase;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(24, 33, 47, 0.42);
}

.modal-card {
  position: relative;
  width: min(980px, 100%);
  max-height: min(780px, calc(100vh - 48px));
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 55px rgba(24, 33, 47, 0.22);
}

.modal-close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 999px;
  font-size: 1.2rem;
  line-height: 1;
}

.subleague-ranking-modal-card {
  display: grid;
  gap: 12px;
}

.team-detail-modal-card {
  display: grid;
  gap: 12px;
  width: min(1080px, 100%);
}

.team-detail-table {
  min-width: 820px;
  font-size: 0.82rem;
}

.team-detail-table tfoot th {
  border-top: 2px solid var(--line);
  background: #f8fbfd;
}

.team-detail-grand-total-row th {
  color: var(--accent-dark);
}

.strong {
  font-weight: 800;
}

.score-hover {
  cursor: help;
  text-decoration: underline dotted #9aa6b8;
  text-underline-offset: 3px;
}

.link-button {
  min-height: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent-dark);
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
}

.link-button:hover {
  background: transparent;
  color: var(--accent);
}

.stats-country-link {
  font-weight: 400;
  text-align: left;
}

.inline-link-button {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
}

.inline-link-button:hover {
  background: transparent;
  color: var(--accent);
}

.player-subleague-suffix {
  color: var(--muted);
  font-size: 0.88em;
  font-weight: 600;
}

.player-subleague-suffix .inline-link-button {
  color: var(--accent-dark);
}

.sort-header {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  text-transform: inherit;
}

.sort-header:hover,
.sort-header.active {
  background: transparent;
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sort-arrow {
  display: inline-block;
  min-width: 0.8em;
  text-align: center;
  font-size: 0.72em;
  line-height: 1;
  transform: translateY(-1px);
}

.scoreboard-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
}

.scoreboard-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.ranking-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.ranking-section + .ranking-section {
  margin-top: 14px;
}

.ranking-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.ranking-section-header h2 {
  margin: 0;
  font-size: 1.08rem;
}

.ranking-section-body {
  padding: 0;
}

.ranking-table {
  table-layout: fixed;
}

.ranking-table .ranking-col-rank {
  width: 3.5rem;
}

.ranking-table .ranking-col-members {
  width: 4.75rem;
}

.ranking-table .ranking-col-score {
  width: 6.5rem;
}

.ranking-table th,
.ranking-table td {
  white-space: nowrap;
}

.ranking-table .link-button {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scoreboard-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hidden-column {
  display: none !important;
}

.own-team-row td {
  background: #fff7cc;
}

.own-team-row .link-button {
  color: #775300;
}

.own-team-row:hover td {
  background: #fff1b0;
}

.scoreboard-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
}

.scoreboard-meta .refresh-active {
  border-color: #42a991;
  color: var(--accent-dark);
  background: #e8f8f4;
}

.scoreboard-meta .refresh-error {
  border-color: #e1b8a7;
  color: var(--warn);
  background: #fff6f2;
}

.matches {
  display: grid;
  gap: 14px;
  padding: 8px;
}

#matchList.matches {
  display: block;
  padding: 0;
}

.match-row {
  font-size: 0.82rem;
}

.match-row input {
  min-height: 30px;
  padding: 4px;
  text-align: center;
}

.prediction-input-table {
  font-size: 0.78rem;
}

.prediction-input-table th,
.prediction-input-table td {
  padding: 6px 7px;
  vertical-align: middle;
}

.score-input-cell {
  white-space: nowrap;
}

.prediction-input-table th.score-header {
  text-align: center;
}

.prediction-input-table th.score-column-header,
.prediction-input-table td.score-input-cell {
  width: 92px;
  min-width: 92px;
}

.prediction-input-table th.winner-column-header,
.admin-bracket-table .winner-select-cell {
  width: 120px;
  min-width: 120px;
}

.prediction-input-table th.action-column-header,
.prediction-input-table td.admin-action-cell {
  width: 64px;
  min-width: 64px;
}

.score-input-cell input {
  width: 38px;
}

.manual-bracket-editor {
  display: grid;
  gap: 12px;
}

.manual-bracket-stage {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.manual-bracket-stage:first-child {
  padding-top: 0;
  border-top: 0;
}

.manual-bracket-stage h4 {
  margin: 0;
  color: var(--ink);
  font-size: 0.88rem;
  text-transform: uppercase;
}

.admin-bracket-table select {
  min-width: 0;
  min-height: 30px;
  padding: 4px 6px;
  font-size: 0.78rem;
}

.admin-bracket-table [data-bracket-winner] {
  min-height: 30px;
  padding: 4px 6px;
}

.manual-best-third-editor {
  display: grid;
  gap: 10px;
}

.manual-best-third-table {
  max-width: 420px;
}

.manual-best-third-table th:first-child,
.manual-best-third-table td:first-child {
  width: 52px;
}

.manual-best-third-table select {
  width: 100%;
  min-height: 30px;
  padding: 4px 6px;
  font-size: 0.78rem;
}

.manual-best-third-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pending-save-editor td {
  background: #fff1ec !important;
  box-shadow: inset 0 -2px 0 rgba(182, 75, 33, 0.35);
}

.admin-team-select {
  display: block;
}

.admin-team-preview {
  min-height: 18px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.revert-manual-score {
  min-height: 28px;
  padding: 4px 7px;
  white-space: nowrap;
  font-size: 0.72rem;
  background: #fff;
  color: var(--warn);
  border: 1px solid #e1b8a7;
}

.revert-manual-score:hover {
  background: #fff6f2;
  color: var(--warn);
}

.admin-action-cell {
  width: 58px;
  min-width: 58px;
  padding-left: 6px !important;
  white-space: nowrap;
}

.pending-save-row td {
  background: #fff1ec !important;
  box-shadow: inset 0 -2px 0 rgba(182, 75, 33, 0.35);
}

.date, .group {
  color: var(--muted);
  font-size: 0.78rem;
}

.teams {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.deel2-table-wrap {
  overflow-x: auto;
}

.deel2-table {
  min-width: 880px;
  table-layout: fixed;
  border: 1px solid var(--line);
  font-size: 0.78rem;
}

.deel2-table th,
.deel2-table td {
  padding: 4px 5px;
  border: 1px solid var(--line);
  vertical-align: middle;
}

.deel2-table thead th {
  background: #e8f8f4;
  color: #255d54;
  text-align: center;
}

.deel2-table tbody th {
  width: 116px;
  background: #f7f9fb;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.deel2-team {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  margin: 0;
  padding: 4px 5px;
  border-radius: 5px;
  font-weight: 400;
  line-height: 1.1;
  cursor: pointer;
}

.deel2-team input {
  width: 14px;
  min-height: 14px;
  margin: 0;
  flex: 0 0 auto;
}

.deel2-team span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.deel2-team.selected {
  background: #d9f4e3;
  color: #0f6b3d;
  box-shadow: inset 0 -2px 0 #42a991;
}

.setup-tier-heading {
  margin-top: 14px;
}

.setup-tier-table select {
  width: 100%;
  min-height: 32px;
  padding: 5px 7px;
  font-size: 0.78rem;
}

.setup-tier-table select.invalid-select {
  border-color: var(--warn);
  background: #fff6f2;
  color: var(--warn);
}

.pill {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  background: #eef1f5;
  color: #465265;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 2px 7px;
  background: #d9f4e3;
  color: #0f6b3d;
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.25;
  box-shadow: inset 0 -2px 0 #42a991;
}

.match-status,
.score-with-status {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.team-counter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.counter-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
}

.counter-badge.bad {
  border-color: var(--warn);
  color: var(--warn);
}

.bonus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.pick-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pick-list.small {
  grid-template-columns: 1fr;
}

.final-grid {
  margin-top: 18px;
}

.top-scorer-field {
  position: relative;
}

.top-scorer-suggestions {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 280px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(20, 30, 45, 0.18);
  list-style: none;
}

.top-scorer-suggestions.open-upward {
  top: auto;
  bottom: calc(100% + 6px);
}

.top-scorer-suggestion {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 52px;
  padding: 9px 11px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.top-scorer-suggestion:hover,
.top-scorer-suggestion.is-active,
.top-scorer-suggestion:focus-visible {
  background: #e8f8f4;
}

.top-scorer-suggestion:focus-visible {
  outline: 3px solid rgba(15, 122, 107, 0.2);
  outline-offset: -3px;
}

.top-scorer-suggestion strong {
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.top-scorer-suggestion span {
  color: var(--muted);
  font-size: 0.82rem;
}

.actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 22px 0;
}

#status {
  color: var(--muted);
  font-weight: 650;
}

#status.error {
  color: var(--warn);
}

.prediction-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.score {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent-dark);
}

.match-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  margin: -8px -8px 0;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.match-filter {
  border: 1px solid var(--line);
  min-height: 32px;
  padding: 6px 10px;
  background: #fff;
  color: var(--muted);
}

.match-filter.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.match-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
}

.match {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px;
  background: #fff;
  font-size: 0.84rem;
}

.match-scoreline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 3px;
  margin: 7px 0 5px;
  text-align: center;
}

.match-team {
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  padding: 3px 5px;
  border-radius: 6px;
  font-weight: 700;
  line-height: 1.18;
  text-align: center;
  overflow-wrap: break-word;
  word-break: normal;
}

.home-team {
  justify-self: end;
}

.away-team {
  justify-self: start;
}

.winner-team {
  background: #d9f4e3;
  color: #0f6b3d;
  font-weight: 900;
  box-shadow: inset 0 -2px 0 #42a991;
}

.loser-team {
  color: #7a8394;
}

.draw-team {
  background: #fff2ad;
  color: #7a5700;
}

.match-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 3px 6px;
  border-radius: 999px;
  background: #f0f4f8;
  color: var(--ink);
  font-weight: 900;
  line-height: 1;
}

.draw-match .match-score {
  background: #fff2ad;
  color: #7a5700;
}

.matchday-section {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.matchday-section:first-child {
  padding-top: 0;
  border-top: 0;
}

.matchday-section h3 {
  margin: 0;
  padding: 7px 9px;
  background: #f0f3f7;
  color: #4b5567;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.knockout-stage-section h3 {
  background: #edf7f3;
  color: var(--accent-dark);
  border-color: #c8e3d8;
}

.knockout-match {
  border-color: #c8e3d8;
  background: #fbfffd;
}

.match-time {
  min-height: 18px;
  font-size: 0.78rem;
  text-align: center;
}

.matchday-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.manual-override-card,
.manual-override-row td {
  background: #fff2ad !important;
}

.manual-override-card {
  border-color: #d8a900;
  box-shadow: inset 0 0 0 1px rgba(216, 169, 0, 0.35);
}

.match-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 20px;
}

.match-header strong {
  font-weight: 400;
  white-space: nowrap;
}

.match-status {
  min-width: 0;
}

.match-group-letter {
  position: absolute;
  left: 9px;
  bottom: 7px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1;
}

.wc-tables {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.wc-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.wc-group h3 {
  margin: 0;
  padding: 8px 10px;
  background: #e8f8f4;
  border-bottom: 1px solid var(--line);
  color: #255d54;
  font-size: 0.88rem;
  text-transform: uppercase;
}

.wc-group table {
  font-size: 0.82rem;
}

.wc-group th,
.wc-group td {
  padding: 6px 7px;
}

.qualified-row td:first-child {
  border-left: 4px solid var(--accent);
}

.qualified-row td {
  background: #e5f6d2;
  font-weight: 800;
}

.wc-team-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.flag-img {
  display: inline-block;
  width: 18px;
  height: 13px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(23, 32, 51, 0.14);
  vertical-align: -1px;
}

.wc-bracket-section {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.wc-bracket-section h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
}

.wc-bracket {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 4px;
}

.turnstile-slot {
  min-height: 72px;
}

.prediction-list {
  display: grid;
  gap: 12px;
}

.my-predictions-table th,
.my-predictions-table td {
  vertical-align: middle;
}

.prediction-row {
  cursor: pointer;
}

.prediction-row:hover td {
  background: #f8fbfd;
}

.prediction-detail-row td {
  background: #fcfdff;
  padding: 0;
}

.accordion-card {
  padding: 0;
  overflow: hidden;
}

.prediction-toggle {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.prediction-toggle:hover {
  background: #f8fbfd;
}

.prediction-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  justify-content: end;
  color: var(--muted);
  font-size: 0.9rem;
}

.prediction-detail {
  border-top: 1px solid var(--line);
  padding: 16px;
}

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

.compact-detail-table {
  font-size: 0.82rem;
}

.compact-detail-table th,
.compact-detail-table td {
  padding: 6px 8px;
}

.subleague-form {
  display: grid;
  gap: 14px;
  max-width: 720px;
  padding: 14px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.admin-subleague-create-form {
  max-width: none;
  padding: 0;
  margin-bottom: 0;
  border: 0;
  background: transparent;
}

.subleague-form label,
.subleague-manage label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.subleague-form input[type="text"],
.subleague-search-row input {
  width: 100%;
  min-height: 38px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.subleague-own-player-list,
.subleague-member-list,
.subleague-selected-players {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.subleague-player-option {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 650;
}

.subleague-player-option input {
  width: 16px;
  height: 16px;
  min-height: 16px;
}

.subleague-list {
  display: grid;
  gap: 12px;
}

.subleague-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.tournament-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.8fr) minmax(220px, 1.4fr) auto;
  align-items: center;
  gap: 12px 18px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.tournament-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.subleague-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.subleague-card-head h3,
.subleague-card-body h4,
.subleague-manage h4 {
  margin: 0;
}

.subleague-card-head p {
  margin: 4px 0 0;
}

.subleague-toggle-button {
  padding: 0;
  font-size: 1.08rem;
  font-weight: 800;
  text-align: left;
}

.subleague-card-body {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.subleague-ranking-panel {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  margin-top: 4px;
  border-top: 1px solid var(--line);
}

.subleague-ranking-table th,
.subleague-ranking-table td {
  white-space: nowrap;
}

.subleague-manage {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  margin-top: 4px;
  border-top: 1px solid var(--line);
}

.admin-subleague-owner-row {
  display: grid;
  grid-template-columns: minmax(90px, max-content) minmax(220px, 360px);
  align-items: center;
  gap: 8px 12px;
}

.admin-subleague-owner-row label {
  font-weight: 800;
}

.admin-subleague-owner-row select {
  min-height: 34px;
}

.subleague-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.subleague-result-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px;
}

.subleague-result-button {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
  font-weight: 650;
}

.subleague-result-button:hover {
  border-color: var(--accent);
  background: #e8f8f4;
  color: var(--accent-dark);
}

.subleague-member-chip,
.subleague-selected-player {
  gap: 6px;
}

.subleague-member-chip button,
.subleague-selected-player button {
  min-height: 0;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  line-height: 1;
}

.subleague-member-chip button:hover,
.subleague-selected-player button:hover {
  background: transparent;
  color: var(--warn);
}

.bracket-table {
  min-width: 1130px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.72rem;
}

.bracket-table td {
  position: relative;
  height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  vertical-align: middle;
}

.bracket-table .bracket-sheet-header {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #e8f8f4;
  color: #255d54;
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.bracket-table .bracket-gap {
  border: 0;
  background: transparent;
}

.bracket-table .bracket-match-cell,
.bracket-table .bracket-final-cell {
  min-width: 0;
}

.bracket-join {
  position: relative;
  width: 20px;
}

.bracket-join::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  border-right: 2px solid #111820;
}

.bracket-join::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -20px;
  width: 20px;
  border-top: 2px solid #111820;
  transform: translateY(-50%);
}

.bracket-join .bracket-cap {
  position: absolute;
  right: 0;
  width: 10px;
  border-top: 2px solid #111820;
}

.bracket-join .bracket-cap.top {
  top: 0;
}

.bracket-join .bracket-cap.bottom {
  bottom: 0;
}

.bracket-match {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  overflow: hidden;
  font-size: 0.72rem;
}

.bracket-match-title {
  display: none;
}

.bracket-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  padding: 4px 6px;
  border-bottom: 1px solid var(--line);
}

.bracket-row:last-child {
  border-bottom: 0;
}

.bracket-team {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 3px;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.15;
  text-align: left;
}

.bracket-score {
  min-width: 28px;
  text-align: right;
  font-weight: 400;
}

.bracket-winner .bracket-team,
.bracket-winner .bracket-score {
  font-weight: 900;
}

.winner-method {
  color: var(--muted);
  font-size: 0.78em;
  font-weight: 900;
  white-space: nowrap;
}

.player-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.prediction-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.prediction-summary article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.prediction-summary span {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  font-weight: 850;
  color: var(--accent-dark);
}

.selected-tier-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 18px;
}

.selected-tier-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  align-items: start;
  gap: 10px;
}

.selected-tier-row > strong {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding-top: 6px;
  white-space: nowrap;
}

.selected-tier-total {
  align-items: center;
  padding-top: 8px;
}

.selected-tier-knockout {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
  align-items: start;
  margin-top: 4px;
}

.selected-tier-knockout table {
  font-size: 0.78rem;
}

.team-points-total {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 2px 7px;
  background: #e8f8f4;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 850;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.chip {
  border-radius: 999px;
  padding: 6px 10px;
  background: #eef1f5;
}

.selected-team-chip {
  cursor: help;
}

.selected-team-detail-button {
  min-height: 0;
  border: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

button.selected-team-chip {
  background: #eef1f5;
}

button.selected-team-chip:hover {
  background: #e8f8f4;
  color: var(--accent-dark);
}

.bonus-readout {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  margin-bottom: 18px;
}

.bonus-points-badge {
  display: inline-flex;
  align-items: center;
  min-width: 46px;
  margin: 0 6px;
  border-radius: 999px;
  padding: 2px 7px;
  background: #e8f8f4;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 850;
}

.bonus-points-badge.total {
  margin-left: 6px;
  background: var(--accent);
  color: #fff;
}

.part3-pick {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 4px 4px 0;
  border-radius: 999px;
  padding: 3px 8px;
  background: #eef1f5;
}

.part3-pick.correct {
  background: #d9f4e3;
  color: #0f6b3d;
  font-weight: 900;
  box-shadow: inset 0 -2px 0 #42a991;
}

.part3-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 260px;
}

.part3-choice-col {
  display: grid;
  gap: 4px;
  align-content: start;
}

.player-score-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.player-score-columns > .table-wrap + .table-wrap {
  border-left: 2px solid var(--line);
  padding-left: 18px;
}

.player-score-columns table {
  font-size: 0.78rem;
}

.random-player-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}

.random-player-tools input[type="range"] {
  width: min(260px, 100%);
}

.random-player-tools output {
  min-width: 3ch;
  font-weight: 700;
}

.tournament-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
}

.tournament-switcher.hidden {
  display: none;
}

.tournament-switcher label {
  font-weight: 700;
}

.tournament-switcher select {
  max-width: 320px;
}

.player-score-columns th,
.player-score-columns td {
  padding: 6px 7px;
}

.selected-match-team {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  cursor: pointer;
}

button.selected-match-team {
  display: inline;
  padding: 0;
  background: transparent;
}

button.selected-match-team:hover {
  background: transparent;
  color: var(--accent-dark);
}

@media (max-width: 720px) {
  .app-page-header {
    flex-direction: column;
    align-items: stretch;
    padding: 18px 14px 10px;
  }

  .app-content {
    padding: 0 14px 18px;
  }

  .app-page-headline {
    gap: 12px;
  }

  .app-page-actions {
    justify-content: flex-start;
  }

  .match-row {
    font-size: 0.78rem;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 1320px) {
  .matches,
  .matchday-grid,
  .match-list,
  .wc-tables {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #matchList.matches {
    display: block;
  }
}

@media (min-width: 961px) {
  .sidebar-collapse-toggle {
    display: inline-flex;
  }

  body.sidebar-collapsed .app-sidebar {
    width: 44px;
    gap: 0;
    padding: 12px 6px;
  }

  body.sidebar-collapsed .app-main {
    margin-left: 44px;
  }

  body.sidebar-collapsed .app-sidebar > :not(.sidebar-collapse-toggle) {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  body.sidebar-collapsed .sidebar-collapse-toggle {
    top: 12px;
    right: 6px;
  }
}

@media (max-width: 960px) {
  .app-sidebar {
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    box-shadow: 0 18px 36px rgba(24, 33, 47, 0.18);
  }

  .app-main {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  body.sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .matches,
  .matchday-grid,
  .match-list,
  .wc-tables {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #matchList.matches {
    display: block;
  }

  .player-score-columns {
    grid-template-columns: 1fr;
  }

  .player-score-columns > .table-wrap + .table-wrap {
    border-left: 0;
    padding-left: 0;
    border-top: 2px solid var(--line);
    padding-top: 12px;
  }

  .selected-tier-row,
  .selected-tier-knockout {
    grid-template-columns: 1fr;
  }

  .selected-tier-knockout > div:first-child {
    display: none;
  }

  .admin-import-layout {
    grid-template-columns: 1fr;
  }

  .tournament-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .tournament-row-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .matches,
  .matchday-grid,
  .match-list,
  .wc-tables {
    grid-template-columns: 1fr;
  }

  #matchList.matches {
    display: block;
  }
}

