/* ============================================================
   Admin dashboard — gold on dark forest green.
   Uses the shared palette from style.css (--gold, --green-deep, etc.)
   with safe local fallbacks so this page still looks right if loaded
   alone. Everything below reads from the --a-* aliases defined here.
   ============================================================ */

.admin-body {
  --a-green-abyss: var(--green-abyss, #071a12);
  --a-green-deep:  var(--green-deep, #0d2b1d);
  --a-green:       var(--green, #14432c);
  --a-green-soft:  var(--green-soft, #1d5c3c);
  --a-gold:        var(--gold, #d4af37);
  --a-gold-bright: var(--gold-bright, #f0d582);
  --a-gold-dim:    var(--gold-dim, #8a6f24);
  --a-cream:       var(--cream, #f5edda);
  --a-cream-soft:  var(--cream-soft, #cdc3ab);
  --a-red-seal:    var(--red-seal, #a3272a);

  /* schedule-grid states — kept distinct from --a-red-seal, which the
     brand spec flags "sparing use only" and shouldn't fill a whole grid */
  --a-free:      #163a27;
  --a-free-line: #204d33;
  --a-occupied:  #5c2318;
  --a-occupied-line: #7a3120;

  background: var(--a-green-abyss);
  color: var(--a-cream);
  min-height: 100vh;
}

.admin {
  max-width: 1180px;
  margin: 0 auto;
  padding: 8rem 1.5rem 5rem;
}

.admin .section-title { color: var(--a-gold); letter-spacing: 0.14em; }
.admin .section-sub { color: var(--a-cream-soft); }

.admin__gate {
  max-width: 420px;
  margin: 4rem auto 0;
  text-align: center;
}

.admin__gate-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.6rem;
}

.admin__gate-form input {
  background: var(--a-green);
  border: 1px solid var(--a-green-soft);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--a-cream);
  outline: none;
  text-align: center;
  letter-spacing: 0.05em;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.admin__gate-form input:focus {
  border-color: var(--a-gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
}

.admin__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin__empty {
  text-align: center;
  padding: 2rem 0 0.5rem;
  color: var(--a-cream-soft);
}

.admin__msg {
  margin-top: 1rem;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
}
.admin__msg--error {
  background: rgba(163, 39, 42, 0.18);
  border: 1px solid var(--a-red-seal);
  color: var(--a-cream);
}

/* ---- buttons ---- */
.btn-ghost {
  background: none;
  border: 1px solid var(--a-gold-dim);
  border-radius: 999px;
  color: var(--a-cream);
  padding: 5px 16px;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-block;
  transition: all 0.25s;
}
.btn-ghost:hover { border-color: var(--a-gold); color: var(--a-gold); }
.btn-ghost--danger:hover { border-color: var(--a-red-seal); color: #ff8f7a; }

.btn-solid {
  background: var(--a-gold);
  color: var(--a-green-abyss);
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s, opacity 0.2s;
}
.btn-solid:hover { background: var(--a-gold-bright); transform: translateY(-1px); }
.btn-solid:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  background: var(--a-gold-dim);
}
.btn-solid--wide { width: 100%; padding: 13px 20px; }

/* ============ date navigation ============ */
.datebar {
  margin-top: 1.6rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.datebar__arrow {
  background: var(--a-green);
  border: 1px solid var(--a-green-soft);
  color: var(--a-gold);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.datebar__arrow:hover { border-color: var(--a-gold); background: var(--a-green-soft); }

.datebar__input {
  background: var(--a-green);
  border: 1px solid var(--a-green-soft);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--a-cream);
  color-scheme: dark;
}

.datebar__today {
  background: none;
  border: 1px solid var(--a-gold-dim);
  color: var(--a-gold);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.datebar__today:hover { background: var(--a-gold); color: var(--a-green-abyss); }

.datebar__label {
  color: var(--a-cream-soft);
  font-size: 0.9rem;
  margin-left: 0.4rem;
}

/* ============ legend ============ */
.legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  margin: 1.2rem 0 0;
  padding: 0.9rem 1.1rem;
  background: var(--a-green-deep);
  border: 1px solid var(--a-green-soft);
  border-radius: 12px;
}

.legend__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--a-cream-soft);
  letter-spacing: 0.02em;
}

.legend__swatch {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  flex: none;
  border: 1px solid rgba(255,255,255,0.12);
}
.legend__swatch--free { background: var(--a-free); }
.legend__swatch--reserved { background: var(--a-gold); }
.legend__swatch--occupied { background: var(--a-occupied); }
.legend__swatch--unpaid {
  background: var(--a-gold);
  background-image: repeating-linear-gradient(
    45deg,
    rgba(7, 26, 18, 0.55) 0 4px,
    transparent 4px 8px
  );
}
.legend__swatch--past { background: var(--a-green); opacity: 0.45; }

/* ============ schedule grid ============ */
.grid-wrap {
  margin-top: 1rem;
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid var(--a-green-soft);
  border-radius: 12px;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.grid {
  border-collapse: separate;
  border-spacing: 0;
  /* Not width:100% — that stretches columns to fill the container and the
     squares stop being square on a wide monitor. Let the fixed cell widths
     decide the table's size and let .grid-wrap scroll when it overflows. */
  width: auto;
  table-layout: fixed;
  /* One knob for the square's size — the cell box and the spilled label both
     read it, so they can't drift apart at a breakpoint. */
  --cell: 62px;
}

/* Square cells. A schedule is read by counting boxes across a row, so an hour
   has to be the same size everywhere — one hour, one square, no exceptions. */
.grid th,
.grid td {
  min-width: var(--cell);
  width: var(--cell);
  height: var(--cell);
  text-align: center;
  font-size: 0.78rem;
  color: var(--a-cream-soft);
  border-right: 1px solid var(--a-green);
  border-bottom: 1px solid var(--a-green);
  white-space: nowrap;
}

.grid thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--a-green-deep);
  color: var(--a-gold);
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 10px 6px;
  border-bottom: 1px solid var(--a-gold-dim);
}

/* The label column is not an hour, so it isn't square — and with
   table-layout:fixed its width has to be stated outright, or it inherits the
   hour width and clips "Table". */
.grid__corner,
.grid tbody th {
  min-width: 84px;
  width: 84px;
}

.grid__corner {
  position: sticky;
  left: 0;
  z-index: 4;
  background: var(--a-green-deep);
}

.grid tbody th,
.grid tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--a-green-deep);
  color: var(--a-gold);
  font-weight: 700;
  border-right: 1px solid var(--a-gold-dim);
}

.grid__cell {
  cursor: pointer;
  background: var(--a-free);
  position: relative;
  transition: filter 0.15s, transform 0.1s;
}
.grid__cell:hover { filter: brightness(1.25); }
.grid__cell:active { transform: scale(0.98); }

/* Two states only, matching the legend: free or reserved. A seated customer
   used to get its own colour, but the cashier already sees who is checked in
   from the detail card — a third colour on the grid only made it harder to
   scan for the thing this view exists to answer: which squares are taken. */
.grid__cell--reserved,
.grid__cell--occupied {
  background: var(--a-gold);
  color: var(--a-green-abyss);
  font-weight: 600;
}

/* Hours belonging to one booking: drop the border between them so the block
   reads as continuous, while every boundary between separate bookings (and
   every free hour) keeps its line. */
.grid__cell--runstart,
.grid__cell--runmid {
  border-right-color: transparent;
}
.grid__cell--runstart.grid__cell--free,
.grid__cell--runmid.grid__cell--free {
  /* Free hours stay individually outlined — they are the click targets. */
  border-right-color: var(--a-green);
}

/* Being dragged over. The block has to be legible mid-gesture — this is the
   only preview of what is about to be booked. */
.grid__cell--selecting {
  background: var(--a-gold);
  opacity: 0.75;
  outline: 2px solid var(--a-gold);
  outline-offset: -2px;
}
/* Dragged across something already taken: refused, not trimmed. */
.grid__cell--selectbad {
  background: var(--a-red-seal);
  opacity: 0.6;
  outline: 2px solid var(--a-red-seal);
  outline-offset: -2px;
  cursor: not-allowed;
}

/* A drag that starts on the grid must not turn into a text selection or a
   long-press menu part-way across it. */
.grid tbody {
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.grid__cell--past {
  opacity: 0.45;
  cursor: default;
}
.grid__cell--past:hover { filter: none; }
.grid__cell--free.grid__cell--past { cursor: default; }

.grid__cell-label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  overflow: hidden;
  font-size: 0.74rem;
}

/* A dark plate behind the name. Without it the text sits on the same gold as
   its own block and has to be hunted for; the border keeps the plate from
   reading as a second, smaller booking inside the first. */
.grid__cell-label__text {
  max-width: 100%;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(7, 26, 18, 0.82);
  border: 1px solid var(--a-gold-dim);
  color: var(--a-cream);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A name doesn't fit in one hour's square, so on a multi-hour booking the
   label is written once and allowed to run across the rest of its own block.
   pointer-events:none keeps every hour underneath it individually clickable. */
.grid__cell-label--wide {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: calc(var(--run-span, 1) * var(--cell));
  pointer-events: none;
  z-index: 1;
}

/* A booking spanning several tables: one name centred over the whole block,
   sized up because it now has the room and is labelling a bigger thing. */
.grid__cell-label--block {
  top: 0;
  transform: none;
  height: calc(var(--run-rows, 1) * var(--cell));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

/* ============ overlays / detail + walk-in cards ============ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 26, 18, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1.2rem;
}
.overlay[hidden] {
  display: none;
}

.detail-card {
  position: relative;
  background: var(--a-green-deep);
  border: 1px solid var(--a-gold-dim);
  border-radius: 18px;
  padding: 2rem 1.8rem 1.8rem;
  max-width: 440px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.detail-card__close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--a-cream-soft);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}
.detail-card__close:hover { color: var(--a-gold); }

.detail-card__eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--a-gold);
  margin-bottom: 0.4rem;
}

.detail-card__title {
  font-size: 1.4rem;
  letter-spacing: 0.03em;
  color: var(--a-cream);
  margin-bottom: 1.2rem;
}

.detail-card__sub {
  color: var(--a-cream-soft);
  font-size: 0.9rem;
  margin-top: 0.3rem;
  margin-bottom: 1.2rem;
}

.detail-card__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem 1rem;
  margin-bottom: 1.2rem;
}
.detail-card__grid dt {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--a-cream-soft);
  margin-bottom: 0.2rem;
}
.detail-card__grid dd {
  font-size: 0.98rem;
  color: var(--a-cream);
  font-weight: 600;
}
.detail-card__notes {
  grid-column: 1 / -1;
}
.detail-card__notes dd { font-weight: 400; color: var(--a-cream-soft); }

.detail-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.4rem;
}
.detail-card__actions .btn-solid,
.detail-card__actions .btn-ghost { flex: 1 1 auto; text-align: center; }

.walkin-form__total {
  margin: 0;
  text-align: center;
  color: var(--a-gold);
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ---- walk-in form ---- */
.walkin-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.walkin-form__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
}
.walkin-form__field span {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--a-cream-soft);
}
.walkin-form__field input,
.walkin-form__field select {
  background: var(--a-green);
  border: 1px solid var(--a-green-soft);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--a-cream);
  outline: none;
}
.walkin-form__field input:focus,
.walkin-form__field select:focus {
  border-color: var(--a-gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
}

/* ============ compact reservations list ============ */
.reslist {
  background: var(--a-green-deep);
  border: 1px solid var(--a-green-soft);
  border-radius: 18px;
  padding: 1.6rem;
  text-align: left;
}

.reslist__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.reslist__head h3 {
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--a-gold);
}

.reslist__actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.reslist__scroll { overflow-x: auto; }

.reslist__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.reslist__table th {
  text-align: left;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--a-cream-soft);
  padding: 8px 10px;
  border-bottom: 1px solid var(--a-green-soft);
}
.reslist__table td {
  padding: 10px;
  border-bottom: 1px solid var(--a-green);
  color: var(--a-cream);
  white-space: nowrap;
}
.reslist__table tr:last-child td { border-bottom: none; }
.reslist__table tbody tr { animation: fadeUp 0.5s both; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.reslist__table .row-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--a-cream-soft);
  font-size: 0.85rem;
  transition: color 0.2s;
}
.reslist__table .row-delete:hover { color: var(--a-red-seal); }

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}
.pill--paid { background: rgba(29, 92, 60, 0.4); color: #8de3b2; }
.pill--unpaid { background: rgba(163, 39, 42, 0.25); color: #ff9d8c; }

/* The pill doubles as the button that flips payment state, so it has to look
   pressable — a bare <button> here inherits none of the row's styling. */
.pill--btn {
  border: 1px solid currentColor;
  font-family: inherit;
  cursor: pointer;
  padding: 3px 12px;
  transition: filter 0.15s, transform 0.1s;
}
.pill--btn:hover { filter: brightness(1.3); }
.pill--btn:active { transform: scale(0.96); }
.pill--btn:disabled { opacity: 0.5; cursor: wait; }

/* ============ phone layout ============ */
@media (max-width: 720px) {
  .admin { padding: 6.5rem 1rem 4rem; }
  .admin__head { align-items: flex-start; }
  /* Still square, just smaller — overriding --cell keeps the box and the
     spilled label in step without touching either rule. */
  .grid { --cell: 50px; }
  .grid th, .grid td { font-size: 0.72rem; }
  .grid__corner,
  .grid tbody th,
  .grid tbody td:first-child { min-width: 68px; width: 68px; }
  .detail-card__grid { grid-template-columns: 1fr; }
  .datebar__label { width: 100%; order: 5; }
}
