:root {
  --bg: #f4f7f5;
  --panel: #ffffff;
  --panel-soft: #eef5f1;
  --ink: #18211f;
  --muted: #64706b;
  --line: #d9e2dd;
  --brand: #106b55;
  --brand-dark: #0b4639;
  --accent: #d98b25;
  --danger: #b43f36;
  --ok: #14784f;
  --shadow: 0 14px 30px rgba(24, 33, 31, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  min-height: 92px;
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: #fcfffd;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 12px;
  font-size: 24px;
}

h3 {
  margin-bottom: 10px;
  font-size: 18px;
}

.status-pill,
.tag,
.state {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

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

.sidebar {
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: #fbfdfc;
  position: sticky;
  top: 0;
  align-self: start;
  height: calc(100vh - 92px);
}

.nav-item {
  width: 100%;
  min-height: 42px;
  margin-bottom: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 10px 12px;
  font-weight: 800;
}

.nav-item:hover,
.nav-item.active {
  background: #e9f3ee;
  border-color: #c9ded4;
  color: var(--brand-dark);
}

.workspace {
  padding: 24px;
  max-width: 1420px;
  width: 100%;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 18px;
  margin-bottom: 18px;
}

.section-head p {
  color: var(--muted);
  max-width: 760px;
  line-height: 1.55;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.metric {
  min-height: 116px;
}

.metric-value {
  font-size: 34px;
  line-height: 1;
  font-weight: 900;
  color: var(--brand-dark);
}

.metric-label {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 700;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

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

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd7d1;
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn {
  min-height: 40px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  padding: 9px 13px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
}

.btn.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--brand-dark);
}

.btn.warning {
  border-color: var(--accent);
  background: var(--accent);
}

.btn.danger {
  border-color: var(--danger);
  background: var(--danger);
}

.bracket {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 16px;
  align-items: center;
}

.round {
  display: grid;
  gap: 14px;
}

.match-card {
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfc;
}

.match-card strong {
  display: block;
  margin-bottom: 8px;
}

.versus {
  display: grid;
  gap: 6px;
}

.player-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 8px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #edf2ef;
}

.player-line.winner {
  border-color: #9bd2ba;
  background: #e9f8f0;
  color: var(--brand-dark);
  font-weight: 900;
}

.court-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.slot {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.slot.booked {
  background: #f8ead9;
  border-color: #e3bb86;
}

.state.pending,
.state.review {
  color: #7c4c10;
  background: #fff2dd;
}

.state.completed,
.state.approved,
.state.confirmed,
.state.ok {
  color: var(--ok);
  background: #e8f7ef;
}

.state.rejected,
.state.danger {
  color: var(--danger);
  background: #fae9e7;
}

.ledger {
  max-height: 440px;
  overflow: auto;
}

.toast {
  position: sticky;
  top: 12px;
  z-index: 5;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--brand-dark);
  box-shadow: var(--shadow);
}

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

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

  .sidebar {
    height: auto;
    position: static;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-item {
    margin-bottom: 0;
    text-align: center;
  }

  .grid.two,
  .grid.three,
  .grid.four,
  .court-grid,
  .bracket,
  .form-grid.two {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .workspace {
    padding: 16px;
  }

  .topbar {
    padding: 18px;
  }

  h1 {
    font-size: 24px;
  }

  .sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

