:root {
  --purple: #2b0b47;
  --purple-hover: #3d1566;
  --ink: #1c1530;
  --ink-dim: #7a6f8c;
  --ink-faint: #9a90aa;
  --border: #e7e2ef;
  --border-strong: #d9d3e3;
  --bg: #f6f4f9;
  --surface: #ffffff;
  --accent: #3edc9b;
  --accent-ink: #0b5e3a;
  --accent-bg: #ddf7ea;
  --awaiting-bg: #f1edf6;
  --awaiting-ink: #6b5f7e;
  --error: #c62828;
  font-family: 'Source Sans 3', Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

/* Login */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--purple);
}

.login-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 40px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 12px 40px rgba(28, 21, 48, 0.35);
}

.login-card h1 {
  margin: 0;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 24px;
  color: var(--purple);
}

.subtitle {
  margin: 0 0 12px;
  color: var(--ink-dim);
  font-size: 14px;
}

.login-card label {
  font-size: 13px;
  color: var(--ink-dim);
}

.login-card input {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--ink);
  padding: 10px 12px;
  font-size: 14px;
}

.login-card button {
  margin-top: 8px;
  background: var(--accent);
  color: var(--purple);
  border: none;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.login-card button:hover { background: #2fcb8a; }

.error {
  color: var(--error);
  font-size: 13px;
  margin: 0;
}

/* Shell */

.topbar {
  height: 56px;
  background: var(--purple);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand-logo {
  height: 30px;
  display: block;
}

.topbar-sep {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.25);
}

.topbar-title {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

.topbar-season {
  margin-left: auto;
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
}

.link-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  border-radius: 6px;
  padding: 6px 12px;
}

.link-btn:hover { background: rgba(255, 255, 255, 0.12); }

.layout {
  display: flex;
  min-height: calc(100vh - 56px);
}

/* Sidebar */

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

.sidebar-heading {
  padding: 18px 16px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.club-list { display: flex; flex-direction: column; }

.club-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  text-align: left;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 400;
}

.club-btn:hover { background: var(--bg); }

.club-btn.active {
  background: var(--purple);
  color: #fff;
  font-weight: 700;
}

.club-btn.active .club-count { color: var(--accent); }

.club-count {
  font-size: 12px;
  color: var(--ink-faint);
}

.crest {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
}

.club-btn.all-clubs .crest {
  background: var(--accent);
  color: var(--purple);
  font-size: 10px;
  font-weight: 700;
  border: none;
}

.crest img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 1px;
}

.club-name { flex: 1; }

/* Content */

.content {
  flex: 1;
  min-width: 0;
  padding: 22px 24px 48px;
}

.status {
  color: var(--ink-dim);
  font-size: 13px;
  margin-bottom: 16px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
  color: var(--ink);
}

.segmented {
  display: flex;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  overflow: hidden;
  height: 36px;
}

.segmented-btn {
  border: 0;
  border-left: 1px solid var(--border-strong);
  padding: 0 14px;
  font-size: 13px;
  cursor: pointer;
  background: #fff;
  color: var(--ink-dim);
  font-weight: 600;
}

.segmented-btn:first-child { border-left: 0; }

.segmented-btn.active {
  background: var(--purple);
  color: #fff;
}

.match-count {
  margin-left: auto;
  font-size: 13px;
  color: var(--ink-dim);
}

.content-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--purple);
}

.content-subtitle {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--ink-dim);
}

/* Match grid + card */

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

.match-card {
  text-align: left;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: inherit;
  min-width: 0;
  font-family: inherit;
}

.match-card:hover {
  border-color: var(--purple);
  box-shadow: 0 6px 18px rgba(43, 11, 71, 0.1);
}

.match-card-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-dim);
}

.match-card-round { font-weight: 600; color: #4e4360; }

.match-card-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.match-card-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.crest-md { width: 44px; height: 44px; }

.match-card-team-name {
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}

.match-card-v {
  font-size: 12px;
  color: var(--ink-faint);
  font-weight: 600;
}

.match-card-officials {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: #4e4360;
}

.match-card-officials b {
  font-weight: 700;
  font-size: 11px;
  color: var(--ink-faint);
  margin-right: 6px;
}

.match-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.pill {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}

.pill-ready { background: var(--accent-bg); color: var(--accent-ink); }
.pill-awaiting { background: var(--awaiting-bg); color: var(--awaiting-ink); }

.match-card-note { font-size: 12px; color: var(--ink-dim); }

.empty-state {
  color: var(--ink-dim);
  font-size: 14px;
  padding: 24px 0;
}

/* Slide-over panel */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(28, 21, 48, 0.4);
  z-index: 30;
}

.match-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(500px, 100vw);
  background: #fff;
  z-index: 31;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(28, 21, 48, 0.2);
}

.match-panel[hidden] { display: none; }

.match-panel-header {
  background: var(--purple);
  color: #fff;
  padding: 20px 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.match-panel-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
}

.match-panel-round { font-weight: 700; color: var(--accent); }

.panel-close {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  display: grid;
  place-items: center;
}

.panel-close:hover { background: rgba(255, 255, 255, 0.12); }

.match-panel-teams {
  display: flex;
  align-items: center;
  gap: 12px;
}

.crest-lg { width: 40px; height: 40px; }

.match-panel-teams h2 {
  margin: 0;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  flex: 1;
  line-height: 1.2;
}

.match-panel-officials {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 13px;
}

.match-panel-officials b {
  font-weight: 700;
  font-size: 11px;
  color: var(--accent);
  margin-right: 6px;
}

.match-panel-body {
  flex: 1;
  overflow: auto;
  padding: 16px 24px;
}

.panel-tabs {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 16px;
}

.panel-tab {
  flex: 1;
  border: 0;
  border-left: 1px solid var(--border-strong);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--ink-dim);
}

.panel-tab:first-child { border-left: 0; }

.panel-tab.active {
  background: var(--purple);
  color: #fff;
}

.panel-section-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.channel-group {
  border-bottom: 1px solid #efebf4;
  padding: 11px 0;
}

.channel-group-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.channel-chip {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 5px;
  text-align: center;
  background: var(--purple);
  color: #fff;
  flex-shrink: 0;
}

.channel-label { font-size: 14px; font-weight: 600; }

.channel-files {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.channel-file-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

.channel-file-meta {
  font-size: 12px;
  color: var(--ink-dim);
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 6px;
  background: var(--purple);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.download-btn:hover { background: var(--purple-hover); color: #fff; }

.panel-empty {
  font-size: 13px;
  color: var(--ink-dim);
  padding: 8px 0;
}

.match-panel-footer {
  border-top: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--ink-dim);
}
