:root {
  --bg: #f4f7f2;
  --tournament-bg: #f4f7f2;
  --tournament-bg-2: #eef5ef;
  --tournament-topbar: #ffffff;
  --tournament-tabs: #eef2f6;
  --tournament-panel: #ffffff;
  --tournament-panel-2: #f4f7f2;
  --tournament-accent: #1e3a8a;
  --panel: #ffffff;
  --line: #d1d8ce;
  --text: #202a20;
  --muted: #5f6d60;
  --blue: #1d4ed8;
  --green: #1e3a8a;
  --red: #7f1d3f;
  --btn-shadow: 0 10px 22px rgba(15, 23, 42, 0.15), 0 2px 6px rgba(15, 23, 42, 0.1);
  --btn-shadow-hover: 0 14px 26px rgba(15, 23, 42, 0.2), 0 4px 10px rgba(15, 23, 42, 0.12);
  --btn-focus: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

* { box-sizing: border-box; }
.splashscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 18% 14%, rgba(59, 130, 246, 0.45), transparent 42%),
    radial-gradient(circle at 82% 20%, rgba(30, 64, 175, 0.35), transparent 40%),
    linear-gradient(145deg, #0a2a75 0%, #0f3ea2 42%, #0b1f57 100%);
  transition: opacity 300ms ease, visibility 300ms ease;
}
.splashscreen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.splash-card {
  width: min(420px, 92vw);
  text-align: center;
  background: linear-gradient(160deg, rgba(13, 43, 122, 0.94), rgba(16, 62, 162, 0.9));
  border: 1px solid rgba(147, 197, 253, 0.5);
  border-radius: 18px;
  padding: 28px 20px;
  box-shadow: 0 24px 52px rgba(2, 6, 23, 0.45);
}
.splash-card img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  margin-bottom: 8px;
}
.splash-card h1 {
  margin: 4px 0 6px;
  letter-spacing: 0.08em;
  font-size: 34px;
  color: #dbeafe;
}
.splash-card p {
  margin: 0;
  color: #bfdbfe;
  font-weight: 600;
}

.splash-card.hidden {
  display: none;
}
.splash-iframe {
  width: min(1120px, 96vw);
  height: min(760px, 92vh);
  border: 0;
  border-radius: 24px;
  background: transparent;
  box-shadow: 0 24px 52px rgba(2, 6, 23, 0.45);
}
.splash-iframe.hidden {
  display: none;
}
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 255, 255, 0.45), transparent 45%),
    radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.36), transparent 40%),
    linear-gradient(180deg, var(--tournament-bg) 0%, var(--tournament-bg-2) 100%);
  color: var(--text);
  transition: background 220ms ease;
  min-height: 100vh;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px 14px;
  border-bottom: 1px solid #bfd1ee;
  background:
    radial-gradient(circle at 8% -20%, rgba(14, 165, 233, 0.25), transparent 45%),
    radial-gradient(circle at 92% -30%, rgba(37, 99, 235, 0.2), transparent 42%),
    linear-gradient(180deg, #f6fbff 0%, #ecf4ff 52%, #eaf2ff 100%);
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-logo {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #dbe4f3;
  padding: 4px;
}
.topbar h1 { margin: 0; font-size: 30px; }
.topbar p { margin: 4px 0 0; color: var(--muted); }
.brand-title {
  margin: 0;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 0.01em;
  line-height: 1.05;
  background: linear-gradient(120deg, #0ea5e9 0%, #2563eb 28%, #8b5cf6 54%, #be123c 76%, #f97316 100%);
  background-size: 220% auto;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: 0 2px 18px rgba(37, 99, 235, 0.22);
  animation: brandShine 4.2s linear infinite;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid rgba(59, 130, 246, 0.4);
  background:
    linear-gradient(130deg, rgba(255, 255, 255, 0.82), rgba(219, 234, 254, 0.7)),
    rgba(255, 255, 255, 0.35);
  box-shadow:
    0 14px 28px rgba(37, 99, 235, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(6px);
}
.quick-select-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: min(580px, 54vw);
}
@keyframes brandShine {
  0% { background-position: 0% 50%; filter: brightness(1); }
  50% { background-position: 100% 50%; filter: brightness(1.12); }
  100% { background-position: 0% 50%; filter: brightness(1); }
}
.topbar-actions select {
  min-width: 420px;
  border-radius: 14px;
  border: 2px solid #7eb8ff;
  padding: 12px 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  color: #0f172a;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.01em;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 8px 20px rgba(37, 99, 235, 0.16);
}
.quick-select-hint {
  font-size: 13px;
  font-weight: 700;
  color: #1e3a8a;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(239, 246, 255, 0.85));
  border: 1px solid rgba(59, 130, 246, 0.32);
  border-radius: 999px;
  padding: 5px 11px;
  width: fit-content;
  box-shadow: 0 5px 14px rgba(37, 99, 235, 0.12);
}
.pill {
  background: linear-gradient(140deg, #dbeafe 0%, #bfdbfe 55%, #93c5fd 100%);
  color: #163a8f;
  border: 1px solid #60a5fa;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.2);
}
.viewport-presets {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
  padding: 8px 10px;
  border-radius: 16px;
  border: 1px solid rgba(96, 165, 250, 0.28);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(219, 234, 254, 0.24));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(6px);
}
.viewport-preset-btn {
  min-width: 68px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.top-debug-toggle {
  min-width: 94px;
  padding: 10px 14px;
}
.topbar-actions .btn {
  min-height: 42px;
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.2);
}
.topbar-actions .btn.green {
  border-color: #166534;
  background: linear-gradient(150deg, #22c55e 0%, #16a34a 55%, #166534 100%);
}
.topbar-actions .btn.blue {
  border-color: #1d4ed8;
  background: linear-gradient(150deg, #3b82f6 0%, #2563eb 55%, #1d4ed8 100%);
}
.top-debug-toggle.is-on {
  border-color: #1e3a8a;
  background: linear-gradient(135deg, #60a5fa, #2563eb 58%, #1e3a8a);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.3);
}
.topbar-workflow {
  width: 100%;
  margin-top: 10px;
}
@media (max-width: 1180px) {
  .viewport-presets {
    width: 100%;
  }
}
@media (max-width: 1366px) {
  .topbar {
    align-items: flex-start;
    gap: 12px;
  }
  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
  }
  .quick-select-wrap {
    min-width: 0;
    width: 100%;
    flex: 1 1 100%;
  }
  .topbar-actions > .viewport-presets {
    order: 10;
    flex: 1 1 100%;
    width: 100%;
    justify-content: flex-start;
    margin-top: 2px;
  }
  .topbar-actions select {
    min-width: 0;
    width: 100%;
    font-size: 16px;
    padding: 10px 12px;
  }
  .quick-select-hint {
    max-width: 100%;
  }
  .topbar-actions .btn,
  .pill,
  .top-debug-toggle {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 13px;
  }
  .viewport-presets {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
    padding: 7px 8px;
    gap: 6px;
  }
  .viewport-preset-btn {
    min-width: 60px;
    padding: 8px 10px;
    font-size: 12px;
  }
  .tabs {
    gap: 8px;
    align-items: stretch;
    padding: 8px 14px;
  }
  .tab-group {
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px;
    border-radius: 12px;
  }
  .tab-group-primary,
  .tab-group-secondary {
    flex: 1 1 100%;
    margin-left: 0;
  }
  .tab-highlight-tournaments {
    margin-right: 0;
    padding: 10px 18px;
    font-size: 14px;
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.26);
  }
  .tab-group-primary .tab,
  .tab-group-secondary .tab,
  .tab-group-secondary .tab-shortcut {
    flex: 1 1 calc(25% - 6px);
    justify-content: center;
    min-height: 44px;
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 11px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  }
  .tab-group-primary .tab.active,
  .tab-group-secondary .tab.active {
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.24);
  }
}
.topbar-workflow-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1e3a8a;
  margin: 0 0 6px;
}
.topbar-workflow .workflow-track {
  margin: 0;
}

.tabs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px 24px;
  background: linear-gradient(180deg, var(--tournament-tabs) 0%, var(--tournament-panel-2) 100%);
  border-bottom: 1px solid var(--line);
}
.tab-group {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(248, 250, 252, 0.72);
}
.tab-group-primary {
  border-color: rgba(59, 130, 246, 0.45);
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.9), rgba(224, 242, 254, 0.65));
  padding: 8px 10px;
}
.tab-group-primary .tab {
  padding: 12px 18px;
  font-size: 15px;
  border-radius: 13px;
}
.tab-group-secondary {
  margin-left: auto;
  border-color: rgba(59, 130, 246, 0.45);
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.9), rgba(224, 242, 254, 0.65));
  padding: 8px 10px;
}
.tab-group-secondary .tab {
  padding: 12px 18px;
  font-size: 15px;
  border-radius: 13px;
}
.tab-group-secondary .tab-shortcut {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text);
  border: 1px solid #cbd5e1;
  background: linear-gradient(180deg, #ffffff 0%, #f6f9ff 100%);
  padding: 12px 18px;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  transition: transform 120ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.tab-group-secondary .tab-shortcut:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.14);
}
.tab-group-secondary .tab-shortcut:focus-visible {
  outline: none;
  box-shadow: var(--btn-focus);
}
.tab {
  border: 1px solid #cbd5e1;
  background: linear-gradient(180deg, #ffffff 0%, #f6f9ff 100%);
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 180ms ease, border-color 180ms ease;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}
.tab:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.14);
}
.tab:focus-visible {
  outline: none;
  box-shadow: var(--btn-focus);
}
.tab.active {
  color: #fff;
  border-color: #2b66cc;
  background: linear-gradient(150deg, #3b82f6 0%, #2563eb 45%, #1d4ed8 100%);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.38);
}
.tab.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.tab-highlight-tournaments {
  margin-right: 14px;
  color: #ffffff;
  border-color: #14532d;
  background: linear-gradient(150deg, #dc2626 0%, #2563eb 52%, #16a34a 100%);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.42);
  padding: 14px 22px;
  font-size: 16px;
  border-radius: 14px;
}
.tab-highlight-tournaments:hover {
  box-shadow: 0 16px 32px rgba(37, 99, 235, 0.58);
}
.tab-highlight-tournaments.active {
  color: #ffffff;
  border-color: #166534;
  background: linear-gradient(150deg, #ef4444 0%, #1d4ed8 50%, #22c55e 100%);
  box-shadow: 0 18px 34px rgba(29, 78, 216, 0.62);
}

.tab-highlight-settings {
  color: #ffffff;
  border-color: #7e22ce;
  background: linear-gradient(150deg, #d946ef 0%, #a855f7 45%, #7e22ce 100%);
  box-shadow: 0 10px 24px rgba(168, 85, 247, 0.4);
}
.tab-highlight-settings:hover {
  box-shadow: 0 14px 28px rgba(168, 85, 247, 0.52);
}
.tab-highlight-settings.active {
  color: #ffffff;
  border-color: #6b21a8;
  background: linear-gradient(150deg, #e879f9 0%, #c026d3 45%, #6b21a8 100%);
  box-shadow: 0 14px 30px rgba(192, 38, 211, 0.58);
}

.admin-layout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
}
.side-nav {
  position: sticky;
  top: 12px;
  z-index: 20;
  width: 214px;
  min-height: calc(100vh - 168px);
  padding: 14px 12px;
  border-right: 1px solid rgba(148, 163, 184, 0.45);
  background:
    linear-gradient(180deg, rgba(239, 246, 255, 0.92), rgba(224, 242, 254, 0.66)),
    var(--tournament-tabs);
  box-shadow: 10px 0 28px rgba(15, 23, 42, 0.07);
  transition: width 180ms ease, padding 180ms ease;
}
.side-nav-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #eef6ff 100%);
  color: #1e3a8a;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.12);
}
.side-nav-toggle:focus-visible {
  outline: none;
  box-shadow: var(--btn-focus);
}
.side-nav-toggle-icon {
  font-size: 20px;
  line-height: 1;
  transition: transform 180ms ease;
}
.side-nav .side-tab-group {
  width: 100%;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
}
.side-nav .side-tab-group .tab {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 14px;
  text-align: left;
  white-space: nowrap;
}
.side-nav.is-collapsed {
  width: 72px;
  padding-inline: 10px;
}
.side-nav.is-collapsed .side-nav-toggle {
  justify-content: center;
  padding-inline: 8px;
}
.side-nav.is-collapsed .side-nav-toggle-icon {
  transform: rotate(180deg);
}
.side-nav.is-collapsed .side-nav-toggle-label {
  display: none;
}
.side-nav.is-collapsed .side-tab-group .tab {
  position: relative;
  justify-content: center;
  min-width: 0;
  padding: 12px 8px;
  overflow: hidden;
  color: transparent;
}
.side-nav.is-collapsed .side-tab-group .tab::after {
  content: attr(data-short);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text);
  font-weight: 900;
}
.side-nav.is-collapsed .side-tab-group .tab.active::after,
.side-nav.is-collapsed .side-tab-group .tab-highlight-settings::after {
  color: #ffffff;
}

main { padding: 20px 24px 28px; min-width: 0; }
.panel {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.72) 0%, rgba(255,255,255,0.92) 28%, rgba(255,255,255,0.96) 100%),
    var(--tournament-panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}
.hidden { display: none; }

#tab-groups .panel-fill-iframe {
  height: calc(100vh - 220px);
  min-height: 760px;
}

#tab-settings {
  max-width: 1280px;
  margin: 0 auto;
  position: relative;
  background:
    linear-gradient(165deg, rgba(19, 157, 145, 0.06), rgba(251, 146, 60, 0.07) 45%, rgba(255, 255, 255, 0.95)),
    #ffffff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  position: relative;
  z-index: 3;
}
.actions-row-bottom {
  margin-top: 14px;
  margin-bottom: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.phase-layer {
  margin-top: 12px;
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow-x: auto;
  overflow-y: visible;
  padding-top: 14px;
  padding-bottom: 8px;
}
.phase-card {
  flex: 1 1 0;
  min-width: 170px;
  border: 1px solid #b9c7dc;
  border-radius: 14px;
  padding: 12px;
  padding-top: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.78) 0%, rgba(255,255,255,0.62) 100%),
    #f8fafc;
  transition: flex-grow 220ms ease, flex-basis 220ms ease, filter 180ms ease, opacity 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  position: relative;
}
.phase-card::before {
  content: attr(data-phase-card);
  position: absolute;
  top: -12px;
  left: 14px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  border: 1px solid rgba(30, 58, 138, 0.28);
  background: linear-gradient(180deg, #ffffff 0%, #e2e8f0 100%);
  box-shadow:
    0 10px 20px rgba(15, 23, 42, 0.22),
    0 0 0 3px rgba(255, 255, 255, 0.85);
  z-index: 4;
}
.phase-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.phase-inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  margin-top: 10px;
}
.phase-inline-fields label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
}
.phase-inline-fields input,
.phase-inline-fields select {
  min-height: 34px;
}
.phase-inline-fields input[type="color"] {
  height: 34px;
  padding: 2px;
}
.phase-inline-note {
  margin-top: 8px;
}
.phase-card.is-current {
  flex-grow: 2.2;
  flex-basis: 0;
  box-shadow:
    0 0 0 3px rgba(59, 130, 246, 0.24),
    0 16px 34px rgba(15, 23, 42, 0.22);
  border-color: #1d4ed8;
  z-index: 1;
}
.phase-card.is-current::before {
  color: #ffffff;
  border-color: #1d4ed8;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 60%, #1e3a8a 100%);
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.35);
}
.phase-card.is-current .phase-chip {
  font-size: 16px;
  letter-spacing: 0.01em;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.45);
}
.phase-card.is-current .phase-actions .btn {
  box-shadow:
    0 0 0 2px rgba(255,255,255,0.22),
    0 10px 18px rgba(15, 23, 42, 0.24);
}
.phase-card.is-future {
  flex-grow: 0.9;
  flex-basis: 0;
  filter: saturate(0.8);
  opacity: 0.82;
}
.phase-card.is-done {
  flex-grow: 0.75;
  flex-basis: 0;
  filter: grayscale(0.8) saturate(0.5);
  opacity: 0.62;
}
.phase-chip {
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 16px;
  font-weight: 800;
  color: #0b2c6b;
  text-shadow:
    0 0 10px rgba(125, 211, 252, 0.42),
    0 1px 0 rgba(255, 255, 255, 0.72);
}
.phase-card .small-note {
  margin-top: 8px;
  margin-bottom: 0;
  padding: 8px 9px;
  border-radius: 10px;
  border: 1px dashed rgba(30, 58, 138, 0.35);
  background: rgba(255, 255, 255, 0.5);
  color: #0f3b82;
  line-height: 1.35;
}
.phase-card .phase-btn {
  padding: 11px 15px;
  font-size: 15px;
  border-radius: 12px;
}
.phase-progress-wrap {
  margin-top: 8px;
  padding: 8px 2px 2px;
}
.phase-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
  color: #334155;
  font-weight: 700;
}
.phase-progress-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  border: 1px solid #bfd3cb;
  background: linear-gradient(180deg, #e8edf5 0%, #dbe4f1 100%);
  overflow: hidden;
}
.phase-progress-fill {
  height: 100%;
  width: 20%;
  border-radius: 999px;
  background: linear-gradient(90deg, #14b8a6 0%, #2563eb 55%, #7f1d3f 100%);
  transition: width 220ms ease;
}

.btn {
  border: 1px solid transparent;
  color: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: var(--btn-shadow);
  transform: translateY(0);
  transition:
    transform 130ms ease,
    box-shadow 180ms ease,
    filter 180ms ease,
    border-color 180ms ease;
}
.actions-row .btn,
.sub-actions .btn {
  pointer-events: auto;
}
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255,255,255,0.25), rgba(255,255,255,0));
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--btn-shadow-hover);
}
.btn:hover::after { opacity: 1; }
.btn:active {
  transform: translateY(0);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.16);
}
.btn:focus-visible {
  outline: none;
  box-shadow: var(--btn-focus), var(--btn-shadow);
}
.btn:disabled {
  filter: grayscale(0.25);
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.btn.green {
  border-color: #14532d;
  background: linear-gradient(150deg, #4ade80 0%, #16a34a 60%, #14532d 100%);
}
.btn.blue {
  border-color: #1e3a8a;
  background: linear-gradient(150deg, #60a5fa 0%, #2563eb 45%, #1e3a8a 100%);
}
.btn.btn-next {
  border-color: #1e3a8a;
  transform: translateY(-1px) scale(1.015);
  filter: saturate(1.12);
  animation: phaseNextPulse 1.5s ease-in-out infinite;
  box-shadow:
    0 0 0 3px rgba(59, 130, 246, 0.24),
    0 0 0 8px rgba(59, 130, 246, 0.13),
    0 16px 30px rgba(37, 99, 235, 0.35),
    0 6px 12px rgba(15, 23, 42, 0.18);
}
.btn.btn-next::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(115deg, transparent 0%, rgba(255, 255, 255, 0.26) 40%, transparent 75%);
  transform: translateX(-130%);
  animation: phaseNextSweep 1.7s ease-in-out infinite;
  pointer-events: none;
}
@keyframes phaseNextPulse {
  0%, 100% {
    box-shadow:
      0 0 0 3px rgba(59, 130, 246, 0.24),
      0 0 0 8px rgba(59, 130, 246, 0.13),
      0 16px 30px rgba(37, 99, 235, 0.35),
      0 6px 12px rgba(15, 23, 42, 0.18);
  }
  50% {
    box-shadow:
      0 0 0 3px rgba(59, 130, 246, 0.34),
      0 0 0 12px rgba(59, 130, 246, 0.18),
      0 20px 34px rgba(37, 99, 235, 0.42),
      0 8px 14px rgba(15, 23, 42, 0.2);
  }
}
@keyframes phaseNextSweep {
  0% { transform: translateX(-130%); }
  100% { transform: translateX(130%); }
}
.btn.red {
  border-color: #7f1d1d;
  background: linear-gradient(150deg, #f87171 0%, #dc2626 60%, #7f1d1d 100%);
}
.phase-btn {
  border-width: 2px;
}
.phase-1 {
  border-color: #14532d;
  background: linear-gradient(150deg, #22c55e 0%, #16a34a 45%, #14532d 100%);
}
.phase-2 {
  border-color: #0f766e;
  background: linear-gradient(150deg, #2dd4bf 0%, #14b8a6 45%, #0f766e 100%);
}
.phase-3 {
  border-color: #1e3a8a;
  background: linear-gradient(150deg, #60a5fa 0%, #2563eb 45%, #1e3a8a 100%);
}
.phase-4 {
  border-color: #7c2d12;
  background: linear-gradient(150deg, #fb923c 0%, #ea580c 45%, #7c2d12 100%);
}
.phase-5 {
  border-color: #7f1d3f;
  background: linear-gradient(150deg, #be185d 0%, #9d174d 45%, #7f1d3f 100%);
}
.phase-chip.phase-1 { background: linear-gradient(150deg, #22c55e 0%, #16a34a 45%, #14532d 100%); }
.phase-chip.phase-2 { background: linear-gradient(150deg, #2dd4bf 0%, #14b8a6 45%, #0f766e 100%); }
.phase-chip.phase-3 { background: linear-gradient(150deg, #60a5fa 0%, #2563eb 45%, #1e3a8a 100%); }
.phase-chip.phase-4 { background: linear-gradient(150deg, #fb923c 0%, #ea580c 45%, #7c2d12 100%); }
.phase-chip.phase-5 { background: linear-gradient(150deg, #be185d 0%, #9d174d 45%, #7f1d3f 100%); }
.phase-chip.phase-utility { background: linear-gradient(150deg, #64748b 0%, #475569 45%, #334155 100%); }

h2 { margin: 12px 0 8px; font-size: 31px; font-weight: 300; }
h3 { margin: 12px 0 8px; }
.grid {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}
.cols-2 { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(170px, 1fr)); }
label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-weight: 600;
  color: #334155;
}
input, select, textarea {
  border: 1px solid #c8d0db;
  border-radius: 4px;
  padding: 8px;
  font-size: 14px;
  background: #fff;
}

#tab-settings h2 {
  margin: 14px 0 8px;
  font-size: 20px;
  font-weight: 600;
  color: #1e3a8a;
}
#tab-settings h2:first-of-type {
  margin-top: 6px;
}
.settings-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.settings-col {
  border: 1px solid #c9d6eb;
  border-radius: 12px;
  padding: 8px 10px 6px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
}
.settings-col h2 {
  margin-top: 4px !important;
}
.settings-combined {
  margin-bottom: 10px;
}

.advanced-box {
  margin-top: 18px;
  padding: 10px 12px;
  border: 1px solid #c7d7ea;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
}

@media (max-width: 980px) {
  .settings-two-col {
    grid-template-columns: 1fr;
  }
  .phase-inline-fields {
    grid-template-columns: 1fr;
  }
}
.advanced-summary {
  cursor: pointer;
  list-style: none;
  font-size: 18px;
  font-weight: 700;
  color: #1e3a8a;
  margin: 0 0 6px;
}
.advanced-summary::-webkit-details-marker {
  display: none;
}
.advanced-summary::before {
  content: "▸";
  margin-right: 8px;
}
.advanced-box[open] .advanced-summary::before {
  content: "▾";
}

#tab-settings .grid {
  gap: 8px;
  margin-bottom: 8px;
}

.span-2 {
  grid-column: 1 / -1;
}

#tab-settings .cols-4 {
  grid-template-columns: repeat(2, minmax(170px, 1fr));
}

#tab-settings label {
  gap: 3px;
  font-size: 12px;
  align-items: flex-start;
}

#tab-settings input,
#tab-settings select {
  padding: 6px 7px;
  font-size: 12px;
  border-radius: 7px;
  border-color: #bfcfbc;
  background: #ffffffdd;
  width: min(100%, 150px);
}

#tab-settings .meta-grid {
  gap: 6px;
  padding: 8px;
  background: #f3faf2;
}

#tab-settings .actions-row-bottom {
  margin-top: 8px;
  padding-top: 8px;
}
.legs-row {
  grid-template-columns: repeat(4, minmax(170px, 1fr)) !important;
  gap: 10px;
}
.legs-row label {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 4px;
  white-space: normal;
}
.legs-row input {
  width: 72px !important;
}
.workflow-track {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin: 10px 0 14px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid #c7d7ea;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
  overflow-x: auto;
  scrollbar-width: thin;
}
.workflow-step {
  position: relative;
  flex: 1 1 0;
  min-width: 126px;
  border: 1px solid #cbd5e1;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: #475569;
  padding: 10px 18px 10px 16px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  white-space: normal;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%, 10px 50%);
  transition: filter 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.workflow-step:first-child {
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%);
}
.workflow-step:last-child {
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 10px 50%);
  padding-right: 14px;
}
.workflow-step.is-current {
  border-color: #1d4ed8;
  background: linear-gradient(150deg, #60a5fa 0%, #2563eb 45%, #1d4ed8 100%);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.34);
}
.workflow-step.is-current::before {
  content: "▶";
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: #dbeafe;
  font-size: 13px;
  font-weight: 900;
}
.workflow-step.is-done {
  border-color: #0f766e;
  background: linear-gradient(150deg, #ccfbf1 0%, #99f6e4 55%, #5eead4 100%);
  color: #0f766e;
}
.workflow-step.is-future {
  opacity: 0.85;
  filter: saturate(0.75);
}
.center-y { display: flex; align-items: flex-end; }
.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px dashed var(--line);
  background: #fafbfd;
}

.sub-actions { margin: 10px 0; }
.grouped-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.groups-ko-combo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid #b9c7d9;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(30, 58, 138, 0.08)),
    linear-gradient(160deg, rgba(127, 29, 63, 0.08), rgba(96, 165, 250, 0.1));
}
.groups-ko-pane {
  border: 1px solid #c9d6eb;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  overflow: hidden;
}
.groups-ko-pane h3 {
  margin: 0;
  padding: 10px 12px;
  font-size: 15px;
  color: #1e3a8a;
  border-bottom: 1px solid #dbe4f3;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
}
.seeding-slot {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 6px;
  border-bottom: 1px dashed #cbd5e1;
  border-radius: 10px;
  transition: background 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}
.seeding-slot.is-drop-target {
  background: #eef2ff;
  border-color: #6366f1;
  box-shadow: inset 0 0 0 2px #818cf8;
}
.seeding-slot label {
  font-weight: 700;
  color: #334155;
}
.seeding-slot select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #bfd3cb;
  padding: 8px 9px;
  background: #fff;
}
.seeding-participant-item {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 6px 10px;
  margin: 4px 6px 4px 0;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
}
.seeding-participant-item.is-draggable {
  cursor: grab;
}
.seeding-participant-item.is-draggable:active {
  cursor: grabbing;
}
.seeding-participant-item.dragging {
  opacity: 0.55;
  transform: scale(0.98);
}
.small-note {
  font-size: 12px;
  color: #475569;
  margin: 6px 0 10px;
}
.participant-highlight {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #16a34a;
  background: #dcfce7;
  color: #166534;
  font-weight: 800;
}
.format-hint-card {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #c9d6eb;
  border-radius: 14px;
  background: linear-gradient(180deg, #f9fbff 0%, #f3f8ff 100%);
}
.format-hint-card h3 {
  margin: 0 0 6px;
  color: #1e3a8a;
}
.format-hint-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 13px;
}
.format-hint-table th,
.format-hint-table td {
  border: 1px solid #d4deef;
  padding: 7px 8px;
  text-align: left;
}
.format-hint-table th {
  background: #edf3ff;
  color: #1e3a8a;
  font-weight: 700;
}
.format-hint-table tr.is-recommended td:first-child {
  font-weight: 800;
  color: #166534;
}
.format-hint-table tr.is-recommended td {
  background: linear-gradient(180deg, #ecfdf3 0%, #dcfce7 100%);
  border-top-color: #86efac;
  border-bottom-color: #86efac;
}
.format-hint-table tr.is-recommended td:first-child {
  border-left: 4px solid #16a34a;
}
.format-hint-table tr.is-also-recommended td {
  background: linear-gradient(180deg, #f0fdf4 0%, #ecfdf3 100%);
  border-top-color: #bbf7d0;
  border-bottom-color: #bbf7d0;
}
.format-hint-table tr.is-also-recommended td:first-child {
  font-weight: 700;
  color: #15803d;
  border-left: 4px solid #4ade80;
}
.advanced-inner {
  margin-top: 10px;
  border-style: dashed;
}
.standard-cross-grid {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
  background: #fff;
}
.standard-cross-grid th,
.standard-cross-grid td {
  border: 1px solid #d4deef;
  padding: 6px 8px;
  text-align: left;
}
.standard-cross-grid th {
  background: #edf3ff;
  color: #1e3a8a;
  font-weight: 700;
}
.standard-cross-grid input {
  width: 92px;
  border: 1px solid #bfd3cb;
  border-radius: 8px;
  padding: 6px 8px;
  background: #fff;
}
.finish-summary-box {
  margin-top: 12px;
}
.finish-summary-block {
  border: 1px solid #c9d6eb;
  border-radius: 10px;
  background: #ffffff;
  padding: 10px 12px;
  margin: 8px 0;
  font-size: 13px;
  color: #1f2937;
}
.finish-summary-empty {
  color: #64748b;
  padding: 4px 0;
  font-weight: 600;
}
.finish-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.finish-kpi-card {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid #dbe4f3;
  border-radius: 12px;
  padding: 8px 10px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
}
.finish-kpi-card .icon {
  font-size: 18px;
  line-height: 1;
}
.finish-kpi-card strong {
  display: block;
  color: #1e3a8a;
  font-size: 12px;
  margin-bottom: 2px;
}
.finish-kpi-card p {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}
.finish-section {
  margin: 8px 0 10px;
  padding: 8px 10px;
  border: 1px solid #dbe4f3;
  border-radius: 12px;
  background: #fff;
}
.finish-section h3 {
  margin: 0 0 6px;
  font-size: 15px;
  color: #1e3a8a;
}
.finish-ko-round {
  margin-top: 8px;
}
.finish-ko-round h4 {
  margin: 0 0 4px;
  color: #334155;
}
.finish-list {
  margin: 0;
  padding-left: 18px;
}
.finish-list li {
  margin: 3px 0;
  line-height: 1.35;
}
.ko-cross-row {
  display: grid;
  grid-template-columns: 130px 1fr 44px 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 6px;
  border-bottom: 1px dashed #cbd5e1;
}
.ko-cross-row label {
  font-weight: 700;
  color: #334155;
}
.ko-cross-row select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #bfd3cb;
  padding: 8px 9px;
  background: #fff;
}
.ko-cross-vs {
  text-align: center;
  font-weight: 800;
  color: #1e3a8a;
}
.groups-ko-frame {
  width: 100%;
  min-height: 760px;
  border: 0;
  display: block;
  background: #fff;
}
.bulk-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fbfdf9;
  margin-bottom: 10px;
}
.bulk-box textarea {
  width: 100%;
  border: 1px solid #c8d0db;
  border-radius: 8px;
  padding: 8px;
  font-size: 13px;
  font-family: Consolas, "Courier New", monospace;
  resize: vertical;
}
.debug-seed-box {
  margin: 10px 0 12px;
  padding: 12px;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(59, 130, 246, 0.16), rgba(139, 92, 246, 0.18) 52%, rgba(236, 72, 153, 0.14)),
    #ffffff;
}
.debug-seed-title {
  font-size: 13px;
  font-weight: 800;
  color: #1e3a8a;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.debug-seed-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.print-card {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}
.rr-group-block + .rr-group-block {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed #d8e3d3;
}
.rr-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.rr-title {
  font-size: 20px;
  font-weight: 700;
}
.rr-meta {
  font-size: 12px;
  color: var(--muted);
}
.rr-table-wrap {
  overflow-x: auto;
}
.rr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.rr-table th,
.rr-table td {
  border: 1px solid #dbe4d7;
  padding: 6px;
  text-align: center;
}
.rr-table th:first-child,
.rr-table td:first-child {
  text-align: left;
  min-width: 160px;
}
.rr-diag {
  background: #000;
  color: #000;
}
.rr-result {
  background: #eef9ee;
  font-weight: 700;
}
.rr-empty {
  color: #9aa59a;
  background: #fafafa;
}
.rr-pending {
  color: #7c8a82;
  background: #f4f7f3;
}
.rr-list {
  margin-top: 10px;
}
.rr-list h4 {
  margin: 0 0 6px;
  font-size: 14px;
}
.rr-list-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 6px 10px;
  font-size: 13px;
}
.rr-sheet .rr-table th {
  background: #f3f6f2;
}
.format-apply-btn {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.1;
  min-width: 90px;
}
.rr-schedule {
  margin-top: 12px;
}
.rr-schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.rr-schedule-table th,
.rr-schedule-table td {
  border: 1px solid #dbe4d7;
  padding: 6px;
}
.rr-schedule-table th {
  background: #f8faf7;
  text-align: left;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  border: 1px solid #dde3ec;
  padding: 7px;
  text-align: left;
}
th { background: #f2f6fb; }
.color-chip {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.2);
  vertical-align: -2px;
  margin-right: 6px;
}
.row-locked {
  opacity: 0.45;
  background: #f2f4f1;
}
.row-locked td {
  color: #7b8680;
}
.row-live-submitted {
  background: linear-gradient(180deg, #0f2f67 0%, #0b2450 100%);
}
.row-live-submitted td {
  color: #e7f0ff;
  border-color: rgba(148, 180, 234, 0.35);
}
.tournament-row-active {
  position: relative;
  outline: 2px solid #2f7dff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45), 0 0 0 2px rgba(47, 125, 255, 0.18);
}
.tournament-row-active td {
  font-weight: 700;
}
.tournament-active-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(135deg, #2f7dff 0%, #1d4ed8 100%);
  vertical-align: middle;
}
.row-delete-mark {
  position: relative;
  background: linear-gradient(180deg, #faf7f8 0%, #f6f2f3 100%);
  outline: 1px solid #e5d7dc;
  opacity: 0.72;
  transition: opacity 180ms ease, background 180ms ease, outline-color 180ms ease;
}
.row-delete-mark td {
  color: #6b7280;
  border-color: #e6dfe2;
}
.row-delete-mark::before {
  content: "";
}
.lock-overlay {
  border: 1px dashed #c8d2c4;
  border-radius: 10px;
  background: #f5f8f3;
  color: #5c6b60;
  padding: 8px 10px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
}

.live-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  gap: 8px;
}
.kpi {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faff;
  padding: 10px;
}
.kpi span { display: block; font-size: 12px; color: var(--muted); }
.kpi strong { font-size: 24px; }

.board-add {
  display: grid;
  grid-template-columns: 1fr 1fr 90px auto;
  gap: 8px;
  margin-bottom: 10px;
}

.inline-danger {
  background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
  color: #9f1239;
  border: 1px solid #fda4af;
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 180ms ease, background 180ms ease;
}
.inline-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(190, 24, 93, 0.18);
  background: linear-gradient(135deg, #ffe4e6 0%, #fecdd3 100%);
}
.inline-danger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.22);
}
.players-bulk-bar {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #c8d8ef;
  border-radius: 12px;
  background:
    linear-gradient(160deg, rgba(59, 130, 246, 0.08), rgba(16, 185, 129, 0.06)),
    linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.players-bulk-count {
  font-size: 13px;
  color: #0f2f67;
  font-weight: 700;
}
#players-select-all,
.players-select-one {
  width: 18px;
  height: 18px;
  accent-color: #2563eb;
}
.crown-pool-radios {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.crown-pool-radios label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid #c7d2e3;
  border-radius: 999px;
  background: #f8fbff;
  font-size: 12px;
  font-weight: 700;
  color: #1e3a5f;
}
.crown-pool-radio {
  accent-color: #2563eb;
}
.crown-pool-radio[value="seated"] {
  accent-color: #15803d;
}
.crown-pool-radio[value="unseated"] {
  accent-color: #ea580c;
}
.crown-pool-radio[value="private"] {
  accent-color: #7c3aed;
}
.crown-private-pair-row td {
  background: linear-gradient(180deg, #f8f5ff 0%, #f3eeff 100%);
}
.crown-private-pair-start td {
  border-top: 2px solid #8b5cf6;
}
.crown-private-pair-end td {
  border-bottom: 2px solid #8b5cf6;
}
.crown-private-pair-solo td {
  border-top: 2px dashed #8b5cf6;
  border-bottom: 2px dashed #8b5cf6;
}
.crown-private-pair-note {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #5b21b6;
}
.crown-participants-table td:nth-child(3) {
  font-size: 18px;
  font-weight: 700;
}
.crowns-cup-summary {
  border: 1px solid #c7d2e3;
  border-radius: 8px;
  padding: 12px;
  background: #f8fbff;
}
.crowns-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.crowns-summary-stat {
  border: 1px solid #d8e2ef;
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}
.crowns-summary-stat span {
  display: block;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}
.crowns-summary-stat strong {
  color: #0f2f67;
  font-size: 16px;
}
.crowns-summary-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 12px;
}
.crowns-summary-columns h3 {
  margin: 0 0 8px;
  color: #0f2f67;
}
.crowns-points-table,
.crowns-leaderboard-table {
  margin: 0;
}
.crowns-leaderboard-table td:last-child {
  max-width: 360px;
  white-space: normal;
  font-size: 12px;
  color: #475569;
}
.error-note {
  color: #7f1d1d;
  font-weight: 700;
}

.toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: #13283f;
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}

@media (max-width: 1000px) {
  .cols-4 { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  .live-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(90px, 1fr)); }
  .meta-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  #tab-settings::before {
    width: 220px;
    height: 220px;
    right: -30px;
    top: 60px;
    opacity: 0.05;
  }
  #tab-settings .cols-4 { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .workflow-step {
    min-width: 118px;
    font-size: 11px;
  }
  .crowns-summary-grid,
  .crowns-summary-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .admin-layout {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .side-nav {
    top: 0;
    width: 76px;
    min-height: calc(100vh - 132px);
    padding: 10px 8px;
  }
  .side-nav:not(.is-collapsed) {
    width: 184px;
  }
  .side-nav .side-tab-group {
    width: 100%;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 8px;
  }
  .side-nav .side-tab-group .tab {
    min-height: 42px;
    padding: 10px 12px;
    font-size: 13px;
  }
  main { padding: 14px; }
  .tabs { padding: 10px 14px; }
  .tab-group { width: 100%; flex-wrap: wrap; }
  .tab-group-secondary { margin-left: 0; }
  .tab-group-secondary .tab-shortcut {
    flex: 1 1 auto;
  }
  .topbar {
    padding: 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
  .topbar-workflow {
    margin-top: 8px;
  }
  .quick-select-wrap {
    width: 100%;
  }
  .topbar-actions select {
    min-width: 0;
    width: 100%;
    flex: 1;
    font-size: 20px;
  }
  .cols-4 { grid-template-columns: 1fr; }
  .board-add { grid-template-columns: 1fr; }
  .actions-row { flex-direction: column; align-items: stretch; }
  .rr-list-grid { grid-template-columns: 1fr; }
  .workflow-track {
    gap: 6px;
    padding: 6px;
  }
  .workflow-step {
    min-width: 108px;
    padding: 8px 14px 8px 12px;
    font-size: 11px;
  }
  .groups-ko-combo { grid-template-columns: 1fr; }
}

/* 2026 workspace refresh: dense, calm, operations-first UI. */
body {
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.96) 0%, rgba(226, 232, 240, 0.8) 100%),
    var(--tournament-bg);
}
.topbar {
  background: rgba(248, 250, 252, 0.92);
  border-bottom: 1px solid rgba(148, 163, 184, 0.36);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(14px);
}
.brand-title {
  color: #0f172a;
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  text-shadow: none;
  animation: none;
  letter-spacing: 0;
}
.topbar-actions,
.tabs,
.side-nav,
.panel,
.advanced-box,
.settings-combined,
.format-hint-card {
  border-color: rgba(148, 163, 184, 0.34);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(16px);
}
.tabs {
  padding-block: 10px;
  position: sticky;
  top: 0;
  z-index: 25;
}
.side-nav {
  top: 76px;
  background: rgba(248, 250, 252, 0.9);
}
.tab,
.tab-group-secondary .tab-shortcut,
.side-nav-toggle,
.btn {
  border-radius: 10px;
  letter-spacing: 0;
}
.tab.active,
.btn.blue,
.topbar-actions .btn.blue {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
}
.btn.green,
.topbar-actions .btn.green {
  background: linear-gradient(180deg, #059669 0%, #047857 100%);
}
.btn.red {
  background: linear-gradient(180deg, #be123c 0%, #9f1239 100%);
}
.panel {
  border-radius: 14px;
}
#tab-settings {
  max-width: 1440px;
  background: rgba(255, 255, 255, 0.86);
}
.phase-layer {
  gap: 12px;
}
.phase-card {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 18px 34px rgba(15, 23, 42, 0.12);
}
.phase-chip {
  border-radius: 10px;
}
input,
select,
textarea {
  border-radius: 9px;
  border: 1px solid rgba(100, 116, 139, 0.42);
  background: rgba(255, 255, 255, 0.94);
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}
.kpi,
.meta-grid > div {
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.28);
}
table {
  border-collapse: separate;
  border-spacing: 0;
}
th {
  background: #eef4ff;
  color: #1e3a8a;
}

@media print {
  body {
    background: #fff;
  }
  .topbar,
  .tabs,
  .side-nav,
  .actions-row,
  .sub-actions,
  #toast {
    display: none !important;
  }
  main {
    padding: 0 !important;
  }
  .panel {
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
  }
  .rr-group-block {
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 16px;
  }
  .rr-group-block + .rr-group-block {
    page-break-before: auto;
  }
  #tab-settings,
  #tab-players,
  #tab-assigned,
  #tab-groups,
  #tab-live {
    display: none !important;
  }
  #tab-print {
    display: block !important;
  }
}
