:root {
  --charcoal: #2b2e33;
  --ink: #1c1e22;
  --steel: #6e747c;
  --red: #d22b2b;
  --red-deep: #b72222;
  --green: #178b4e;
  --amber: #a96e00;
  --bg: #f7f7f8;
  --bg-alt: #eaebed;
  --line: #d9dce0;
  --white: #fff;
  --maxw: 1180px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--charcoal);
  font-family: "Space Grotesk", system-ui, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .brand { font-family: "Syne", sans-serif; letter-spacing: 0; line-height: 1.05; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(43, 46, 51, .98);
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.nav {
  max-width: var(--maxw);
  min-height: 68px;
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  padding: 0 12px;
  font-weight: 800;
  letter-spacing: .04em;
}
.brand::before, .brand::after {
  content: "";
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 3px;
  background: var(--red);
}
.brand::before { left: 0; }
.brand::after { right: 0; }
.brand small {
  font-family: "Space Grotesk";
  color: #a8aeb5;
  font-size: .55rem;
  letter-spacing: .42em;
}
.nav a:not(.brand) {
  color: #d7dade;
  font-weight: 700;
  font-size: .9rem;
}
.nav a:not(.brand):hover { color: #fff; }
main { max-width: var(--maxw); margin: 0 auto; padding: 34px 22px 72px; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 22px;
  margin-bottom: 24px;
}
.eyebrow {
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: .24em;
  font-weight: 800;
  font-size: .72rem;
  margin-bottom: 10px;
}
h1 { font-size: clamp(2.1rem, 5vw, 4rem); max-width: 12ch; }
.lead { color: var(--steel); max-width: 68ch; margin-top: 12px; }
.admin-login {
  width: min(360px, 100%);
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 14px;
}
.login-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 6px;
}
.login-row input { min-width: 0; }
.grid {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(360px, .75fr);
  gap: 22px;
  align-items: start;
}
.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: start;
}
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.panel-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.panel-head h2 { font-size: 1.08rem; }
.panel-body { padding: 20px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
label {
  color: var(--steel);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .73rem;
  font-weight: 800;
}
label.required::after {
  content: " *";
  color: var(--red);
}
input, select, textarea {
  min-height: 46px;
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink);
  padding: 11px 12px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--red);
  background: #fff;
}
.phone-input {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  overflow: hidden;
}
.phone-input:focus-within {
  border-color: var(--red);
  background: #fff;
}
.phone-input span {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-right: 1px solid var(--line);
  color: var(--ink);
  font-weight: 800;
}
.phone-input input {
  border: 0;
  border-radius: 0;
  background: transparent;
}
.court-map {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
}
textarea { min-height: 86px; resize: vertical; }
.hint { color: var(--steel); font-size: .84rem; margin-top: 8px; }
.slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.slot {
  min-height: 72px;
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 5px;
  padding: 12px;
  text-align: left;
}
.slot b { display: block; color: var(--ink); }
.slot span { color: var(--steel); font-size: .83rem; }
.slot.selected { border-color: var(--red); box-shadow: 0 0 0 3px rgba(210,43,43,.12); }
.slot:disabled { opacity: .45; cursor: not-allowed; background: #f0f1f2; }
.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  color: var(--steel);
  font-size: .78rem;
  font-weight: 800;
}
.calendar-legend span { display: inline-flex; align-items: center; gap: 5px; }
.calendar-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}
.legend-free { background: var(--green); }
.legend-booked { background: #c3c8cf; }
.legend-selected { background: var(--red); }
.availability-calendar {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-top: 10px;
}
.calendar-grid {
  min-width: calc(92px + var(--court-count) * 150px);
  display: grid;
  grid-template-columns: 92px repeat(var(--court-count), minmax(150px, 1fr));
}
.calendar-cell {
  min-height: 52px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}
.calendar-cell:nth-child(n) { border-radius: 0; }
.calendar-head-cell {
  min-height: 42px;
  background: var(--charcoal);
  color: #fff;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .76rem;
}
.calendar-time {
  background: var(--bg);
  color: var(--steel);
  font-weight: 800;
}
.calendar-slot {
  display: grid;
  align-content: center;
  gap: 2px;
}
.calendar-slot b {
  font-size: .86rem;
  color: inherit;
}
.calendar-slot span {
  color: inherit;
  font-size: .74rem;
  opacity: .78;
}
.calendar-slot.open {
  background: #eefaf3;
  color: var(--green);
}
.calendar-slot.open:hover {
  background: #ddf0e5;
}
.calendar-slot.booked {
  background: #f0f1f2;
  color: #7a8088;
  cursor: not-allowed;
}
.calendar-slot.selected {
  background: var(--red);
  color: #fff;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.38);
}
.summary {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 6px;
  padding: 16px;
}
.qr-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qr-card {
  min-width: 0;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 5px;
  display: grid;
  gap: 8px;
  padding: 10px;
}
.qr-card img {
  width: 100%;
  aspect-ratio: 1 / 1.28;
  object-fit: contain;
  display: block;
}
.qr-card figcaption {
  color: var(--steel);
  font-size: .78rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.summary-list { list-style: none; display: grid; gap: 10px; }
.summary-list li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
.summary-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.summary-list span { color: var(--steel); }
.summary-list b { text-align: right; }
.btn {
  min-height: 48px;
  border: 0;
  border-radius: 4px;
  padding: 12px 18px;
  font-weight: 800;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-deep); }
.btn-dark { background: var(--charcoal); color: #fff; }
.btn-ghost { background: transparent; border: 1.5px solid var(--charcoal); color: var(--charcoal); }
.btn-ok { background: #ddf0e5; color: var(--green); }
.btn-danger { background: #f8dddd; color: #8c1515; }
.btn-small { min-height: 38px; padding: 8px 12px; font-size: .84rem; }
.notice, .success {
  display: none;
  border-radius: 5px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.notice { border: 1px solid #f2c6c6; background: #fff5f5; color: #7b1f1f; }
.success { border: 1px solid #b9dfc9; background: #f0fbf4; color: var(--green); }
.notice.show, .success.show { display: block; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 800;
}
.pill.pending { background: #fff1d6; color: var(--amber); }
.pill.approved { background: #ddf0e5; color: var(--green); }
.pill.rejected { background: #f8dddd; color: #8c1515; }
.pill.cancelled { background: #e5e7eb; color: #5b6068; }
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0;
}
.metric {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 16px;
}
.metric span { color: var(--steel); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.metric b { display: block; font-family: "Syne"; font-size: 1.65rem; margin-top: 4px; }
.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.list { display: grid; gap: 12px; }
.booking {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
}
.booking h3 { font-size: 1rem; margin-bottom: 6px; }
.booking-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--steel); font-size: .86rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.proof {
  width: 92px;
  height: 92px;
  border: 1px solid var(--line);
  border-radius: 5px;
  object-fit: cover;
  background: var(--bg-alt);
}
.schedule {
  display: grid;
  grid-template-columns: 74px repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.schedule div {
  min-height: 44px;
  padding: 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
  font-size: .8rem;
}
.schedule div:nth-child(4n) { border-right: 0; }
.schedule .head { background: var(--charcoal); color: #fff; font-weight: 800; }
.schedule .time { background: var(--bg); color: var(--steel); font-weight: 800; }
.schedule .busy { background: #fff1f1; color: #8c1515; font-weight: 800; }
.empty {
  color: var(--steel);
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: #fff;
}
.schedule-empty { grid-column: 1 / -1; }
@media (max-width: 980px) {
  .grid, .admin-grid, .hero { grid-template-columns: 1fr; }
  .metrics, .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  main { padding: 24px 14px 54px; }
  .nav { padding: 0 14px; }
  .form-grid, .slots, .qr-row, .metrics, .filters { grid-template-columns: 1fr; }
  .login-row { grid-template-columns: 1fr; }
  .booking { grid-template-columns: 1fr; }
  .admin-grid { display: block; }
  .admin-grid > * + * { margin-top: 18px; }
  .schedule { grid-template-columns: 64px repeat(3, minmax(84px, 1fr)); overflow-x: auto; }
}
