:root {
  --bg: #000000;
  --panel: #0a0a0a;
  --line: #2a2a2a;
  --text: #ffffff;
  --muted: #9a9a9a;
}

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

html, body { height: 100%; }

body {
  font-family: Outfit, system-ui, sans-serif;
  background: #000;
  color: #fff;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

main, footer { position: relative; z-index: 1; }

.logo-img {
  height: 34px;
  width: auto;
  display: block;
  object-fit: contain;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: 1px solid #3a3a3a;
  background: #000;
  color: #fff;
  border-radius: 0;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
button:hover { border-color: #fff; }
button.ghost { background: transparent; }
button.primary {
  background: #fff;
  color: #000;
  border-color: #fff;
}
button.danger {
  background: transparent;
  color: #fff;
  border-color: #555;
}
button.hidden { display: none; }
.nav-btn {
  width: 40px; height: 40px;
  font-size: 22px;
  padding: 0;
  text-transform: none;
}

main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 24px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

  .recent {
  margin-bottom: 8px;
  padding: 8px 12px;
  border: 1px solid #262626;
  border-radius: 10px;
  background: #141414;
  }
  .recent:empty {
  display: none;
  }
  .recent-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8a8a8a;
  margin-bottom: 6px;
  }
  .recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  /* Show ~5 rows, scroll for the rest (all bookings since inception). */
  max-height: 104px;
  overflow-y: auto;
  }
  .recent-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  line-height: 1.3;
  }
  .recent-name {
  font-weight: 550;
  color: #f2f2f2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  }
  .recent-time {
  flex-shrink: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: #8a8a8a;
  }

  .week-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 8px;
  }
.week-nav h2 {
  font-size: 18px;
  font-weight: 650;
  min-width: 280px;
  text-align: center;
  letter-spacing: -0.02em;
}
.week-center { text-align: center; min-width: 280px; }
.week-total {
  margin-top: 4px;
  color: #fff;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.legend {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  color: #9a9a9a;
  font-size: 13px;
  margin-bottom: 8px;
}
.legend .hours {
  margin-left: auto;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
}
.dot {
  display: inline-block;
  width: 8px; height: 8px;
  margin-right: 6px;
  vertical-align: middle;
}
.dot.free { background: transparent; box-shadow: inset 0 0 0 1px #888; }
.dot.booked { background: #fff; }
.dot.past { background: #444; }

.board {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 2px;
  overflow: hidden;
}

.day-head {
  grid-column: span 2;
  background: #0a0a0a;
  padding: 6px 4px;
  text-align: center;
  border: 1px solid #2a2a2a;
}

.court-head {
  text-align: center;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9a9a9a;
  padding: 4px 0 6px;
}
.day-head .dow {
  font-size: 11px;
  color: #9a9a9a;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.day-head .date { font-weight: 700; font-size: 16px; }
.day-rev {
  margin-top: 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: #fff;
}
.day-head.today { border-color: #fff; background: #000; }

.time-lab {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  color: #9a9a9a;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
}

.slot {
  min-height: 0;
  background: #000;
  border: 1px solid #222;
  padding: 3px 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 11px;
  line-height: 1.2;
  overflow: hidden;
}
.slot.past { opacity: 0.38; }
.slot.past.booked { opacity: 0.6; cursor: pointer; }
.slot:not(.past) { cursor: pointer; transition: background-color 0.18s ease, transform 0.12s ease, opacity 0.18s ease; }
.slot:not(.past):not(.booked):hover { background-color: rgba(255,255,255,0.06); }
.slot:not(.past):active { transform: scale(0.97); }
.slot.free { color: #7a7a7a; }
.slot.booked {
  background: #fff;
  color: #000;
  border-color: #fff;
}
.slot .who {
  font-weight: 650;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.15;
  max-width: 100%;
}
.slot.booked[draggable="true"] { cursor: grab; }
.slot.dragging { opacity: 0.5; cursor: grabbing; }
.slot.drop-target { outline: 2px dashed #6cf; outline-offset: -2px; }
  .slot.booked.event {
  background: #d4d4d4;
  color: #000;
  border-color: #d4d4d4;
  }
  .slot.booked.both {
  background: linear-gradient(135deg, #fff 0%, #d9ecff 100%);
  border-color: #6cf;
  box-shadow: inset 0 0 0 1px #6cf;
  }
  .slot.booked.event.both {
  background: linear-gradient(135deg, #d4d4d4 0%, #bcd4ef 100%);
  border-color: #9ab;
  box-shadow: inset 0 0 0 1px #9ab;
  }

.check-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.check-row input {
  width: auto;
  margin: 0;
}
.check-row span { font-weight: 500; }

dialog {
  border: 1px solid #333;
  background: #000;
  color: #fff;
  border-radius: 0;
  padding: 0;
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.75); }
#booking-form { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
#booking-form h3 { font-size: 18px; letter-spacing: -0.02em; }
.meta {
  color: #9a9a9a;
  font-size: 13px;
  font-family: "JetBrains Mono", monospace;
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #9a9a9a;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
input[type="text"],
input[type="number"] {
  background: #000;
  border: 1px solid #333;
  color: #fff;
  border-radius: 0;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  text-transform: none;
  letter-spacing: 0;
}
input[type="text"]:focus,
input[type="number"]:focus { outline: none; border-color: #fff; }

.slot .fee {
  display: block;
  font-size: 11px;
  font-family: "JetBrains Mono", monospace;
  opacity: 0.7;
}

.time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
select {
  background: #000;
  border: 1px solid #333;
  color: #fff;
  border-radius: 0;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  width: 100%;
}
select:focus { outline: none; border-color: #fff; }

.players-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #9a9a9a;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.players { display: flex; flex-direction: column; gap: 8px; }
.player-row {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.7fr auto;
  gap: 6px;
  align-items: center;
}
.player-row input { width: 100%; min-width: 0; }
.btn-remove {
  width: 36px;
  height: 36px;
  padding: 0;
  text-transform: none;
  font-size: 18px;
  line-height: 1;
}

.modal-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.spacer { flex: 1; }

footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 10px 24px;
  color: #9a9a9a;
  font-size: 12px;
  text-align: center;
  border-top: 1px solid #2a2a2a;
}

.concierge-link {
  color: #9a9a9a;
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid #2a2a2a;
  padding: 5px 10px;
}
.concierge-link:hover { color: #fff; border-color: #fff; }

@media (max-width: 700px) {
  .topbar { padding: 10px 14px; }
  .brand p { font-size: 12px; }
  .logo-img { height: 32px; }
  main { padding: 8px 12px; }
  .week-nav { gap: 10px; margin-bottom: 6px; }
  .week-nav h2 { font-size: 15px; min-width: 0; }
  #prev-week, #next-week { display: none; }
  .week-center { min-width: 0; }
  .legend { display: none; }
  footer { padding: 8px 12px; gap: 10px; }
  .logo-img { height: 26px; }

  dialog {
    width: 100vw;
    max-width: 100vw;
    height: 90dvh;
    max-height: 90dvh;
    inset: auto 0 0 0;
    margin: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }
  dialog[open] {
    display: flex;
    flex-direction: column;
  }
  #booking-form {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
  }
  .modal-actions {
    position: sticky;
    bottom: 0;
    background: #000;
    padding-top: 10px;
    margin-top: 4px;
    border-top: 1px solid #222;
  }
}
