:root {
  --primary: #0B5C3B;
  --secondary: #F6B519;
  --background: #EEF1EA;
  --surface: #FFFFFF;
  --ink: #101C16;
  --muted: #55645B;
  --line: #D3DBD0;
  --outline: #B9C4BB;
  --dark: #0E1A14;
  --radius: 16px;
  --shadow: 0 12px 32px rgba(16, 28, 22, .10);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: var(--dark);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; letter-spacing: .2px; }
.brand img { width: 40px; height: 40px; object-fit: contain; border-radius: 10px; background: #fff; padding: 3px; }
.brand-mark {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--secondary); color: var(--dark); font-size: 20px;
}
.brand img + .brand-mark { display: none; }

.nav-user { color: rgba(255, 255, 255, .75); font-size: 14px; padding: 0 4px; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 10px; color: var(--secondary); font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; font-size: 13px; }

.nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nav a, .nav button {
  border: 1px solid rgba(255, 255, 255, .22);
  background: transparent; color: #fff; border-radius: 999px;
  padding: 8px 14px; font: inherit; font-size: 14px; cursor: pointer;
}
.nav a:hover, .nav button:hover { background: rgba(255, 255, 255, .12); }
.nav .primary { background: var(--secondary); color: var(--dark); border-color: var(--secondary); font-weight: 700; }

.page { flex: 1; width: min(1180px, 100%); margin: 0 auto; padding: clamp(18px, 4vw, 48px); }

.hero {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(20px, 4vw, 48px);
  align-items: center; padding: clamp(24px, 5vw, 56px);
  background: linear-gradient(135deg, var(--dark), var(--primary));
  color: #fff; border-radius: calc(var(--radius) + 8px); box-shadow: var(--shadow);
}
.hero h1 { margin: 0 0 12px; font-size: clamp(34px, 6vw, 64px); line-height: .95; letter-spacing: -1px; }
.hero p { margin: 0 0 22px; font-size: clamp(16px, 2vw, 19px); color: rgba(255, 255, 255, .82); max-width: 46ch; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-card {
  display: grid; place-items: center; min-height: 240px; border-radius: var(--radius);
  background: rgba(255, 255, 255, .10); border: 1px solid rgba(255, 255, 255, .18); padding: 24px;
}
.hero-card img { width: min(220px, 60%); max-height: 220px; object-fit: contain; }
.hero-card .brand-mark { width: 120px; height: 120px; font-size: 56px; border-radius: 32px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 12px; padding: 12px 18px;
  font: inherit; font-weight: 700; cursor: pointer; background: var(--primary); color: #fff;
}
.btn:hover { filter: brightness(1.06); }
.btn.secondary { background: var(--secondary); color: var(--dark); }
.btn.ghost { background: transparent; border-color: currentColor; color: inherit; }
.btn.danger { background: #C23B2B; }
.btn.small { padding: 7px 11px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 20px 0; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.card .label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .6px; }
.card .value { font-size: 30px; font-weight: 800; margin-top: 6px; }
.card .value.small { font-size: 20px; }

.panel { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.side {
  display: flex; flex-direction: column; gap: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; position: sticky; top: 86px;
}
.side button {
  border: 0; background: transparent; color: var(--ink); text-align: left; padding: 11px 12px;
  border-radius: 10px; font: inherit; cursor: pointer;
}
.side button:hover { background: color-mix(in srgb, var(--primary) 9%, transparent); }
.side button.active { background: var(--primary); color: #fff; font-weight: 700; }

.content { display: grid; gap: 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 24px; }

.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--outline); border-radius: 10px; padding: 10px 12px;
  font: inherit; background: var(--surface); color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.form-actions { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
th { background: color-mix(in srgb, var(--primary) 6%, var(--surface)); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: color-mix(in srgb, var(--primary) 3%, var(--surface)); }

.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 700; }
.badge.ok { background: color-mix(in srgb, var(--primary) 14%, #fff); color: var(--primary); }
.badge.warn { background: #FBEBC7; color: #7A5200; }
.badge.bad { background: #F7DDD8; color: #A3281A; }

.login { width: min(460px, 100%); margin: 6vh auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(22px, 4vw, 34px); box-shadow: var(--shadow); }
.login h1 { margin: 0 0 6px; font-size: 28px; }
.login p { margin: 0 0 20px; color: var(--muted); }
.login .field { margin-bottom: 14px; }

.players { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.player-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.player-card h3 { margin: 0; font-size: 20px; }
.player-card .cat { color: var(--muted); font-size: 13px; margin: 3px 0 14px; }
.player-card .row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px dashed var(--line); font-size: 14px; }

.receipt { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.receipt:last-child { border-bottom: 0; }

.empty { color: var(--muted); text-align: center; padding: 34px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px 34px; }

.toast {
  position: fixed; right: 18px; bottom: 18px; max-width: min(420px, calc(100vw - 36px));
  background: var(--dark); color: #fff; padding: 13px 16px; border-radius: 12px;
  box-shadow: var(--shadow); z-index: 50; font-size: 14px;
}
.toast.error { background: #A3281A; }

.modal-back { position: fixed; inset: 0; background: rgba(8, 16, 12, .55); display: grid; place-items: center; padding: 16px; z-index: 60; }
.modal { width: min(520px, 100%); background: var(--surface); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 14px; font-size: 22px; }
.modal .checks { display: grid; gap: 8px; max-height: 280px; overflow: auto; margin: 10px 0 18px; }
.modal .checks label { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; }
  .hero-card { order: -1; min-height: 170px; }
  .panel { grid-template-columns: 1fr; }
  .side { position: static; flex-direction: row; overflow-x: auto; }
  .side button { white-space: nowrap; }
}
