:root {
  --bg: #f4f6f0;
  --panel: #ffffff;
  --ink: #172017;
  --muted: #667261;
  --line: #d8dfd1;
  --green: #245f45;
  --green-dark: #163f2f;
  --green-soft: #e3efe7;
  --amber: #c58a22;
  --red: #b44842;
  --shadow: 0 10px 24px rgba(23, 32, 23, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  padding: 10px 14px;
  color: white;
  background: var(--green);
  font-weight: 700;
  cursor: pointer;
}

button.secondary,
button.ghost {
  color: var(--green-dark);
  background: #edf2e9;
  border: 1px solid var(--line);
}

button.danger {
  color: white;
  background: var(--red);
}

button.small {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 13px;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  background: white;
  color: var(--ink);
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  color: white;
  background: var(--green-dark);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--amber);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
}

.brand p {
  margin: 2px 0 0;
  color: #c6d7ca;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-button {
  justify-content: flex-start;
  width: 100%;
  color: #eaf2ec;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-align: left;
}

.nav-button.active {
  color: var(--green-dark);
  background: white;
}

.sidebar-actions {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.main {
  padding: 22px;
}

.topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

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

.topline h2 {
  margin: 0;
  font-size: 32px;
}

.topline p {
  margin: 4px 0 0;
  color: var(--muted);
}

.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--green-dark);
  background: white;
  font-weight: 700;
}

.edit-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--green-dark);
  background: #edf2e9;
  font-size: 14px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.score-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 16px;
}

.score-team-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.score-team-chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: white;
  box-shadow: var(--shadow);
}

.score-team-chip strong,
.score-team-chip span {
  display: block;
}

.score-team-chip strong {
  font-size: 17px;
}

.score-team-chip span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.fixture-card {
  grid-column: 1 / -1;
}

.card-title {
  margin-bottom: 12px;
  font-size: 18px;
  font-weight: 800;
}

.fixture-grid,
.highlight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
}

label span,
.eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.score-boxes {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 42px minmax(140px, 1fr);
  align-items: end;
  gap: 12px;
  margin-top: 14px;
}

.score-boxes input {
  min-height: 58px;
  font-size: 30px;
  font-weight: 800;
  text-align: center;
}

.versus {
  min-height: 58px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 24px;
  font-weight: 800;
}

.team-entry-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.team-entry h3 {
  margin: 0;
  font-size: 24px;
}

.one-eighty-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 90px 76px;
  gap: 8px;
  align-items: end;
  margin-top: 12px;
}

.chips {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border: 1px solid #ead3a5;
  border-radius: 7px;
  padding: 8px;
  background: #fff4dd;
}

.player-result-entry {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
  align-items: end;
}

.player-result-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.player-result-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  background: #f9fbf5;
}

.compact-empty {
  padding: 10px 0 0;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
}

.score-teams-panel {
  margin-top: 16px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-head h3 {
  margin: 0;
  font-size: 24px;
}

.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

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

.score-team {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.score-team h4 {
  margin: 0;
  padding: 11px 12px;
  background: var(--green-soft);
  font-size: 18px;
}

.score-team ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.score-team li {
  border-top: 1px solid #e8ece4;
  padding: 8px 12px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi,
.chart,
.team-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.kpi {
  padding: 14px;
}

.kpi span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.kpi strong {
  display: block;
  margin-top: 5px;
  font-size: 24px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

th,
td {
  border-bottom: 1px solid #e8ece4;
  padding: 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--green-soft);
  font-weight: 800;
}

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

.chart-grid,
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.player-stats-panel {
  margin-top: 18px;
}

.player-stats-panel .table-wrap {
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.chart h3,
.team-card h3 {
  margin: 0;
  padding: 13px 14px;
  background: var(--green-soft);
  font-size: 20px;
}

.bars {
  padding: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.2fr) minmax(100px, 2fr) 42px;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.bar-label strong,
.bar-label span {
  display: block;
}

.bar-label span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.bar-track {
  height: 14px;
  border-radius: 999px;
  background: #edf1e8;
  overflow: hidden;
}

.bar {
  height: 100%;
  border-radius: 999px;
  background: var(--amber);
}

.bar-value {
  text-align: right;
  font-weight: 800;
}

.team-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.team-card li {
  border-top: 1px solid #e8ece4;
  padding: 10px 14px;
  font-size: 17px;
}

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

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

.login-panel {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(12, 24, 17, 0.46);
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: white;
  box-shadow: 0 18px 54px rgba(23, 32, 23, 0.24);
}

.login-card h2 {
  margin: 0 0 8px;
  font-size: 26px;
}

.login-card p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.4;
}

.login-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.login-actions button {
  flex: 1;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .topline {
    align-items: flex-start;
    flex-direction: column;
  }

  .topline-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .nav,
  .sidebar-actions {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .score-layout,
  .fixture-grid,
  .highlight-grid,
  .player-result-entry,
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  .sidebar,
  .topline,
  .form-actions,
  #scoreView {
    display: none;
  }

  .app-shell {
    display: block;
  }

  .main {
    padding: 0;
  }

  .view {
    display: block;
    margin-bottom: 22px;
  }

  body {
    background: white;
  }
}
