:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #171923;
  --muted: #6d7483;
  --line: #e2e5ec;
  --accent: #e52d4d;
  --accent-dark: #bf1f3b;
  --ok: #188854;
  --warn: #a66300;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 11px;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 850;
  cursor: pointer;
}

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

button:disabled,
select:disabled {
  opacity: .55;
  cursor: not-allowed;
}

input,
select {
  min-height: 44px;
  border: 1px solid #ccd2dd;
  border-radius: 11px;
  padding: 0 11px;
  background: #fff;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 750;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.hidden {
  display: none !important;
}

.admin-shell {
  width: min(1280px, calc(100% - 28px));
  margin: 30px auto 70px;
}

.eyebrow {
  color: var(--accent);
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

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

.card,
.panel,
.stats article,
.team-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .05);
}

.auth-card {
  max-width: 470px;
  margin: 80px auto;
  padding: 32px;
}

.auth-card form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

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

.secondary:hover {
  background: #f7f8fb;
}

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

.message {
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff0f0;
  color: #8c1f1f;
}

.topbar,
.section-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 24px 0;
}

.tab {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

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

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.stats article {
  padding: 20px;
}

.stats span {
  display: block;
  color: var(--muted);
  margin-bottom: 7px;
}

.stats strong {
  font-size: 2rem;
}

.panel {
  padding: 22px;
  margin-top: 18px;
}

.alert-line {
  padding: 11px 0;
  border-bottom: 1px solid #eef0f4;
}

.alert-line:last-child {
  border-bottom: 0;
}

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.meal-filters {
  grid-template-columns: repeat(2, minmax(180px, 280px));
}

.table-wrap {
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 850px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid #eef0f4;
  text-align: left;
  vertical-align: top;
}

th {
  font-size: .8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  background: #fafbfc;
}

tr:last-child td {
  border-bottom: 0;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 850;
}

.ok {
  background: #eaf7f0;
  color: var(--ok);
}

.warn {
  background: #fff4df;
  color: var(--warn);
}

.role {
  background: #eef1ff;
  color: #4254a3;
}

.captain {
  background: #f4efff;
  color: #6941c6;
}

.meal-summary {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin: 18px 0;
}

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

.meal-card span {
  display: block;
  color: var(--muted);
  font-size: .85rem;
}

.meal-card strong {
  font-size: 1.6rem;
}

.teams-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.team-card {
  padding: 18px;
}

.team-card h3 {
  margin-bottom: 14px;
}

.admin-team-roster {
  border-top: 1px solid #eef0f4;
}

.admin-team-button {
  width: 100%;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  background: transparent;
  color: var(--text);
  border: 0;
  border-radius: 0;
  text-align: left;
}

.admin-team-button:hover {
  background: #fafbfc;
}

.admin-team-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.admin-team-count {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  flex: 0 0 auto;
}

.admin-team-count strong {
  color: var(--text);
  font-size: 1.25rem;
}

.admin-chevron {
  margin-left: 5px;
  font-size: 1.25rem;
  transition: transform .2s ease;
}

.admin-team-roster.open .admin-chevron {
  transform: rotate(180deg);
}

.admin-team-roster-list {
  border-top: 1px solid #eef0f4;
}

.admin-roster-player {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: 70px minmax(170px, 1fr) minmax(150px, 1fr) 120px 130px;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid #eef0f4;
  text-align: left;
  font-weight: 400;
}

.admin-roster-player:last-child {
  border-bottom: 0;
}

.admin-roster-player:hover {
  background: #fafbfc;
}

.admin-jersey {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.admin-player-name {
  font-weight: 800;
}

.admin-origin-club {
  color: var(--muted);
}

.admin-empty-roster {
  padding: 14px 12px;
  color: var(--muted);
}

dialog {
  border: 0;
  border-radius: 18px;
  width: min(720px, calc(100% - 24px));
  padding: 0;
}

dialog::backdrop {
  background: rgba(16, 20, 28, .55);
}

.dialog-card {
  padding: 28px;
  position: relative;
}

.dialog-close {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
  background: #eee;
  color: #111;
}

.dialog-close:hover {
  background: #ddd;
}

.grid.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.player-teams-editor {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.team-editor-title h3 {
  margin-bottom: 5px;
}

.current-player-teams {
  margin-top: 14px;
}

.current-team-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid #eef0f4;
}

.current-team-row:last-child {
  border-bottom: 0;
}

.current-team-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.mini-danger {
  min-height: 34px;
  padding: 0 10px;
  background: #fff;
  color: var(--danger);
  border: 1px solid #efc8c5;
}

.mini-danger:hover {
  background: #fff2f1;
}

.add-team-panel {
  margin-top: 18px;
  padding: 16px;
  background: #f8f9fb;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.add-team-panel > button {
  margin-top: 12px;
}

.team-edit-message {
  margin: 10px 0 0;
  min-height: 20px;
}

.dialog-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

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

  .stats {
    grid-template-columns: 1fr 1fr;
  }

  .teams-grid {
    grid-template-columns: 1fr;
  }

  .meal-summary {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .admin-roster-player {
    grid-template-columns: 55px 1fr;
  }

  .admin-origin-club,
  .admin-roster-player > span:nth-child(4),
  .admin-roster-player > span:nth-child(5) {
    display: none;
  }
}

@media (max-width: 600px) {
  .filters,
  .grid.two {
    grid-template-columns: 1fr;
  }

  .meal-filters {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-head {
    align-items: center;
  }

  .admin-shell {
    margin-top: 18px;
  }

  .dialog-actions {
    flex-direction: column;
  }

  .dialog-actions button {
    width: 100%;
  }
}


/* =========================================================
   TEAMS / CLUBS - HIERARCHICAL ACCORDION
   Club -> Team -> Roster
   ========================================================= */

.clubs-accordion{
  display:grid;
  gap:12px;
}

.admin-club-accordion{
  overflow:hidden;
  background:#fff;
  border:1px solid var(--line);
  border-radius:18px;
  box-shadow:0 10px 28px rgba(17,20,28,.045);
}

.admin-club-button{
  width:100%;
  min-height:78px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding:18px 20px;
  background:#fff;
  color:var(--ink);
  border:0;
  border-radius:0;
  text-align:left;
  box-shadow:none;
}

.admin-club-button:hover{
  background:#fafaf8;
  transform:none;
}

.admin-club-button-main{
  display:flex;
  flex-direction:column;
  gap:5px;
  min-width:0;
}

.admin-club-name{
  font-size:1.08rem;
  font-weight:850;
  letter-spacing:-.015em;
}

.admin-club-meta{
  color:var(--muted);
  font-size:.8rem;
  font-weight:400;
}

.admin-club-chevron{
  flex:0 0 auto;
  color:#8e949c;
  font-size:1.45rem;
  transition:transform .2s ease;
}

.admin-club-accordion.open > .admin-club-button .admin-club-chevron{
  transform:rotate(180deg);
}

.admin-club-teams{
  padding:0 18px 16px;
  background:#fbfaf7;
  border-top:1px solid #efede8;
}

.admin-team-accordion{
  overflow:hidden;
  margin-top:10px;
  background:#fff;
  border:1px solid #e7e3dc;
  border-radius:14px;
}

.admin-team-accordion .admin-team-button{
  min-height:62px;
  padding:12px 14px;
}

.admin-team-accordion.open{
  border-color:#d8d3ca;
}

.admin-team-name{
  font-weight:750;
}

.admin-team-accordion .admin-team-roster-list{
  border-top:1px solid #efede8;
}

@media(max-width:760px){
  .admin-club-button{
    min-height:70px;
    padding:15px 16px;
  }

  .admin-club-teams{
    padding:0 10px 10px;
  }

  .admin-team-accordion .admin-team-button{
    padding:11px 12px;
  }
}


/* =========================================================
   EXCLUSIVE NAVIGATION
   Clubs -> Teams -> Roster
   ========================================================= */

.admin-club-content{
  padding:0 18px 16px;
  background:#fbfaf7;
  border-top:1px solid #efede8;
}

.admin-back-button{
  min-height:38px;
  margin:14px 0 4px;
  padding:0 12px;
  background:#fff;
  color:var(--ink);
  border:1px solid #d9d6cf;
  border-radius:10px;
  box-shadow:none;
  font-size:.84rem;
  font-weight:800;
}

.admin-back-button:hover{
  background:#f7f5f1;
  transform:none;
}

.admin-team-roster-view{
  border-top:1px solid #efede8;
  background:#fff;
}

.team-back-button{
  margin:12px 12px 4px;
}

.admin-club-accordion.focus-club{
  border-color:#d8d3ca;
}

.admin-team-accordion.focus-team{
  border-color:#cfc9bf;
}

.admin-team-accordion.focus-team > .admin-team-button{
  background:#fafaf8;
}

@media(max-width:760px){
  .admin-club-content{
    padding:0 10px 10px;
  }

  .admin-back-button{
    width:100%;
  }
}


/* LIVE / DOWNLOAD ROSTER TOOLS */

.admin-roster-tools{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  padding:12px;
  border-bottom:1px solid #efede8;
  background:#faf9f6;
}

.admin-roster-tools button{
  min-height:40px;
}

.live-roster-button{
  background:#15171b;
  color:#fff;
  box-shadow:none;
}

.live-roster-button:hover{
  background:#262932;
}

@media(max-width:600px){
  .admin-roster-tools{
    display:grid;
    grid-template-columns:1fr;
  }

  .admin-roster-tools button{
    width:100%;
  }
}
