:root {
  --bg: #0e1a12;
  --panel: #16251b;
  --panel2: #1d3023;
  --line: #2c4634;
  --text: #e8f2ea;
  --muted: #93ac99;
  --accent: #4ade80;
  --accent-dark: #166534;
  --gold: #fbbf24;
  --red: #f87171;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  background: linear-gradient(180deg, #14271a, var(--bg));
  border-bottom: 1px solid var(--line);
  padding: 16px 16px 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
h1 { font-size: 22px; }
h1 span { color: var(--accent); font-weight: 600; }

#user-box { display: flex; gap: 8px; align-items: center; }
#user-box select, #user-box input {
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 14px;
}
#user-box .me { color: var(--accent); font-weight: 700; }

nav { max-width: 860px; margin: 12px auto 0; display: flex; gap: 4px; }
.tab {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

main { max-width: 860px; margin: 0 auto; padding: 16px; }
.hidden { display: none !important; }

#filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}
.chip.active { background: var(--accent-dark); color: var(--text); border-color: var(--accent); }

.day-header {
  margin: 22px 0 10px;
  font-size: 14px;
  color: var(--accent);
  text-transform: capitalize;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.match {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.match-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.match-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}
.team { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.team.away { justify-content: flex-end; text-align: right; }
.team .flag { font-size: 20px; }
.team.tbd { color: var(--muted); font-weight: 400; font-style: italic; }

.score-mid { display: flex; align-items: center; gap: 6px; }
.score-mid input {
  width: 46px;
  height: 40px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
}
.score-mid input:focus { outline: none; border-color: var(--accent); }
.score-final { font-size: 22px; font-weight: 800; min-width: 70px; text-align: center; }
.dash { color: var(--muted); }

.match-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
  gap: 6px;
}
.pts { font-weight: 800; border-radius: 6px; padding: 2px 8px; }
.pts-3 { background: var(--gold); color: #000; }
.pts-1 { background: var(--accent-dark); color: var(--text); }
.pts-0 { background: #3f1d1d; color: var(--red); }

.others-btn {
  background: none; border: none; color: var(--accent);
  cursor: pointer; font-size: 13px; padding: 0;
}
.others {
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line);
  font-size: 13px; color: var(--muted);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 4px;
}

table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 12px; overflow: hidden; }
th, td { padding: 11px 12px; text-align: center; font-size: 14px; }
th { background: var(--panel2); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
td.name, th.name { text-align: left; font-weight: 600; }
tbody tr { border-top: 1px solid var(--line); }
tbody tr:first-child td { color: var(--gold); }
td.total { font-weight: 800; font-size: 16px; }
.legend { margin-top: 12px; font-size: 13px; color: var(--muted); line-height: 1.6; }

.admin-note { font-size: 14px; color: var(--muted); margin-bottom: 16px; line-height: 1.5; }
.admin-match { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.admin-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-row input[type=text] {
  flex: 1; min-width: 120px;
  background: var(--panel2); border: 1px solid var(--line);
  color: var(--text); border-radius: 8px; padding: 8px 10px; font-size: 14px;
}
.admin-row input[type=number] {
  width: 52px; height: 38px; text-align: center; font-size: 16px; font-weight: 700;
  background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 8px;
}
.btn {
  background: var(--accent-dark); border: 1px solid var(--accent);
  color: var(--text); border-radius: 8px; padding: 8px 16px;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn:hover { background: #1a7a40; }
.btn-small { padding: 6px 12px; font-size: 13px; }

#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--accent-dark); border: 1px solid var(--accent);
  color: var(--text); padding: 10px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 600; z-index: 100;
}
#toast.error { background: #4c1d1d; border-color: var(--red); }

.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 15px; }

@media (max-width: 560px) {
  .team { font-size: 13px; }
  .team .flag { font-size: 17px; }
  th, td { padding: 8px 6px; font-size: 12px; }
}
