@import url('https://fonts.googleapis.com/css2?family=Big+Shoulders+Display:wght@600;700;800&family=Public+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

/* ---- Theming: "Alpenglow" ----
   Grounded in the one moment every campsite looks unmistakably like itself: dusk light
   over the treeline. Spruce/Ember are the same roles the old pine/amber filled (and are
   still what a site's own branding colours override in Settings — see applyBranding in
   booking.js), just recoloured off the cream/serif look that reads as a generic
   AI-design default. Dusk is new: the palette's old pine+amber pairing never had a
   second, cooler hue to lean on for secondary accents and chart states. */
:root, [data-theme="light"] {
  --pine: #123524;           /* Spruce — headings, brand */
  --pine-light: #1F5738;
  --dusk: #33407A;           /* new: secondary accent, links, "awaiting" states */
  --dusk-soft: #5762A0;
  --bark: #4B5142;
  --canvas: #EFF2EA;
  --canvas-light: #FAFBF6;
  --amber: #FF6B35;          /* Ember — the one accent: buttons, highlights */
  --ember: #B23A55;          /* berry — overdue/cancelled/errors, kept apart from the accent */
  --ink: #171B12;
  --line: #D7DCCC;
  --radius: 4px;

  --muted: #5B6154;          /* secondary text */
  --surface: #FAFBF6;        /* cards */
  --surface-alt: #E4E8DC;    /* hover, table stripes */
  --surface-sunken: #EFF2EA;
  --tint-good: #DCEEE2;      /* soft green background */
  --tint-warn: #F5E7CC;      /* soft amber background */
  --tint-bad: #F6DEE4;       /* soft berry background */
  --on-accent: #23140A;      /* text on the (light) amber accent */
  --shadow: rgba(23,27,18,0.14);

  /* Site map illustration */
  --map-grass: #86AD68;
  --map-grass-edge: #9EC080;
  --map-path: #F7F4EC;
  --map-building: #C79E6B;
  --map-roof: #B08652;
  --map-tree-dark: #123524;
  --map-tree-mid: #1F5738;
  --map-tree-light: #4B7A54;
  --map-label: #171B12;
  --map-label-halo: #ffffff;

  /* The header is one fixed moment (dusk over the treeline), not a themed surface — it
     keeps its own colours in light and dark, the way a photograph wouldn't recolour
     itself for dark mode. See header.topbar below. */
  --hero-top: #123524;
  --hero-mid: #33407A;
  --hero-bottom: #FF6B35;
  --hero-ridge: #0B2115;
  --hero-on: #FBF6EC;

  --field-bg: #ffffff;       /* form fields — brighter than the card so they read as inputs */

  /* Chart bar colours — must stay clearly distinct from each other in both themes */
  --chart-paid: #1F5738;
  --chart-owing: #C9861A;
  --chart-overdue: #B23A55;
  /* Deeper, more saturated versions of the two above — a confirmed booking with
     literally nothing paid toward it is a different situation from one that's just
     waiting on the final balance, so it earns a visually heavier colour, not the same
     amber/berry as everything else that owes something. */
  --chart-owing-all: #A8460A;
  --chart-overdue-all: #7A1F3A;
  --chart-unconfirmed: #7A8B99;
  --chart-pending: #5762A0;
  --chart-external: #33407A;
  --chart-blocked-a: #D6D2C4;
  --chart-blocked-b: #C4BFAF;
  --chart-text: #ffffff;
}

/* Dark theme. Deliberately warm charcoal rather than pure black — this gets used at a
   reception desk at night, and pure black on a bright screen is harsh to read for long. */
[data-theme="dark"] {
  --pine: #85DEAB;           /* headings/accents must be light in dark mode to stay legible */
  --pine-light: #61BC8D;
  --dusk: #8D97DA;
  --dusk-soft: #6B76B8;
  --bark: #A6AC9A;
  --canvas: #11150D;
  --canvas-light: #1A2016;
  --amber: #FF9B62;
  --ember: #D9557E;          /* balances two jobs: legible as text on dark canvas, and
                                 dark enough to still hold white text as a button fill */
  --ink: #EAEEE3;
  --line: #2B3226;

  --muted: #A6AC9A;
  --surface: #1A2016;
  --surface-alt: #242B1E;
  --surface-sunken: #161B11;
  --tint-good: #1D3527;
  --tint-warn: #3A2E14;
  --tint-bad: #3A1F26;
  --on-accent: #1A0D06;
  --shadow: rgba(0,0,0,0.5);

  --map-grass: #2F4033;
  --map-grass-edge: #364A38;
  --map-path: #4A4639;
  --map-building: #6E5940;
  --map-roof: #5A4733;
  --map-tree-dark: #14261C;
  --map-tree-mid: #1B3527;
  --map-tree-light: #295038;
  --map-label: #EAEEE3;
  --map-label-halo: #10140D;

  /* Fixed, same as light — the dusk moment doesn't invert for dark mode. */
  --hero-top: #123524;
  --hero-mid: #33407A;
  --hero-bottom: #FF6B35;
  --hero-ridge: #0B2115;
  --hero-on: #FBF6EC;

  --field-bg: #242B1E;       /* lighter than the card, same "stands out" affordance as light mode */

  /* Lighter, less saturated versions — full-strength colours glow uncomfortably on dark */
  --chart-paid: #3E8F65;
  --chart-owing: #D99A2E;
  --chart-overdue: #C4527A;
  --chart-owing-all: #E06A1A;
  --chart-overdue-all: #B0446E;
  --chart-unconfirmed: #8FA0AD;
  --chart-pending: #6F79B8;
  --chart-external: #4A5590;
  --chart-blocked-a: #2B3226;
  --chart-blocked-b: #242B1E;
  --chart-text: #F5F1E6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: 'Public Sans', -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

/* Big Shoulders Display is a condensed, signage-like face — bold and unmistakable at
   page-title size, but shouting in caps at every small section header throughout a
   dense admin screen would fatigue fast. So h1 (one per page) gets the full treatment;
   h2/h3 keep the same face's structure without going uppercase. */
h1, h2, h3 { font-family: 'Big Shoulders Display', 'Arial Narrow', sans-serif; font-weight: 700; letter-spacing: 0.01em; margin: 0 0 0.4em; color: var(--pine); }
h1 { font-size: 2.2rem; font-weight: 800; text-transform: uppercase; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

.mono { font-family: 'IBM Plex Mono', monospace; }

a { color: var(--pine); }

/* The header is the one signature moment: dusk light over a treeline, the thing every
   campsite actually looks like at the hour most guests arrive. It's a fixed image, not a
   themed surface (--hero-* vars are the same in light and dark — see above), and it's
   spent nowhere else in the interface. A site's own branding colours (Settings) still
   override --pine/--amber everywhere else; the hero deliberately sits outside that so
   one guest-uploaded colour can't turn dusk into daylight. */
header.topbar {
  background: linear-gradient(165deg, var(--hero-top) 0%, var(--hero-mid) 65%, var(--hero-bottom) 130%);
  color: var(--hero-on);
  padding: 1.5rem 1.5rem 2.6rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 14px var(--shadow);
}
header.topbar h1 {
  color: var(--hero-on);
  font-size: 1.7rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0;
}
header.topbar .subtitle { color: var(--hero-on); opacity: 0.82; font-size: 0.9rem; margin-top: 0.2rem; }
/* A low ridgeline silhouette, not a decorative rule — the horizon the gradient is lit
   against. */
header.topbar::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 20px;
  background: var(--hero-ridge);
  clip-path: polygon(
    0% 100%, 0% 62%, 5% 35%, 11% 58%, 17% 20%, 24% 52%, 31% 28%, 38% 56%,
    45% 18%, 53% 48%, 61% 10%, 69% 44%, 77% 24%, 85% 54%, 93% 22%, 100% 40%, 100% 100%
  );
}

.wrap { max-width: 960px; margin: 0 auto; padding: 1.5rem; }

/* A coloured left-border on a rounded card is a generic default nearly every AI-styled
   dashboard reaches for. A dashed inset line reads as a stitched seam instead — which is
   where this app's canvas motif actually came from, applied on purpose here rather than
   out of habit. */
.card {
  background: var(--canvas-light);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 4px var(--shadow);
  position: relative;
}
.card::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px dashed color-mix(in srgb, var(--pine) 35%, transparent);
  border-radius: 2px;
  pointer-events: none;
}

/* Compact by design — this grid is for picking a pitch, not comparing prices (the
   total is shown once in the price summary, not repeated on every card). Keeping
   cards small means more of them fit on screen at once. */
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 0.6rem; }
.site-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
  background: var(--canvas-light);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.site-card:hover { border-color: var(--amber); }
.site-card.selected { border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber) inset; }
.site-card h3 { margin: 0.3rem 0 0.15rem; font-size: 0.95rem; }
.site-card .site-meta { font-size: 0.78rem; color: var(--muted); margin: 0; }
.site-card .type-tag {
  display: inline-block;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pine);
  background: var(--surface-alt);
  padding: 0.12rem 0.4rem;
  border-radius: 100px;
  margin: 0 0.25rem 0.25rem 0;
}

label { display: block; font-size: 0.85rem; font-weight: 500; margin: 0.75rem 0 0.3rem; color: var(--bark); }
input, select, textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: 'Public Sans', -apple-system, sans-serif;
  font-size: 0.95rem;
  background: var(--field-bg);
  color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--amber); outline-offset: 1px; }

button.btn {
  background: var(--amber);
  /* Fixed dark text, not var(--ink): the button is amber in BOTH themes, so flipping the
     text colour with the theme made it light-on-amber and unreadable in dark mode. */
  color: #201C16;
  border: none;
  padding: 0.7rem 1.3rem;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
}
button.btn:hover { background: var(--amber); }
button.btn:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }
button.btn.secondary { background: transparent; border: 1px solid var(--pine); color: var(--pine); }
button.btn.danger { background: var(--ember); color: #fff; }

.price-summary { border-top: 1px dashed var(--line); margin-top: 1rem; padding-top: 0.75rem; }
.price-summary .row { display: flex; justify-content: space-between; font-family: 'IBM Plex Mono', monospace; font-size: 0.9rem; margin-bottom: 0.3rem; }
.price-summary .row.total { font-weight: 600; font-size: 1.05rem; color: var(--pine); }

.status-tag { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.2rem 0.55rem; border-radius: 100px; font-weight: 600; }
.status-confirmed { background: var(--tint-good); color: var(--pine-light); }
.status-pending_payment { background: var(--tint-warn); color: var(--amber); }
.status-cancelled { background: var(--tint-bad); color: var(--ember); }
.status-completed { background: var(--surface-alt); color: var(--bark); }

.error-msg { color: var(--ember); font-size: 0.9rem; margin-top: 0.5rem; }
.success-msg { color: var(--pine-light); font-size: 0.9rem; margin-top: 0.5rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table th, table td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--line); }
table th { font-family: 'IBM Plex Mono', monospace; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--bark); }

/* ---- Admin navigation ----
   24 sections is far too many for a row of pills across the top — it wrapped onto three
   lines and pushed the real content down the page. A grouped sidebar instead, which also
   makes it obvious which section you're in. */
/* The guest booking form wants a narrow, readable column; the dashboard needs room for
   a sidebar plus wide tables, so it gets more width. */
body.admin-page .wrap { max-width: 1500px; }
.admin-shell { display: flex; gap: 1.25rem; align-items: flex-start; }

nav.tabs {
  flex: 0 0 190px;
  position: sticky; top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  background: var(--canvas-light);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.6rem;
  box-shadow: 0 1px 4px var(--shadow);
}
.nav-group {
  margin-bottom: 0.9rem;
  padding-left: 0.5rem;
  border-left: 3px solid var(--line);
}
.nav-group:last-child { margin-bottom: 0; }
/* Each section gets its own colour, cycling through the brand palette, so the sidebar
   reads as distinct areas rather than one long flat list. */
.nav-group:nth-child(1) { border-left-color: var(--pine); }
.nav-group:nth-child(2) { border-left-color: var(--amber); }
.nav-group:nth-child(3) { border-left-color: var(--ember); }
.nav-group:nth-child(4) { border-left-color: var(--pine-light); }
.nav-group:nth-child(5) { border-left-color: var(--bark); }
.nav-group:nth-child(6) { border-left-color: var(--dusk); }
.nav-group-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--bark); opacity: 0.7;
  padding: 0 0.4rem 0.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.3rem;
}
nav.tabs button {
  display: block; width: 100%; text-align: left;
  background: transparent; border: 0;
  padding: 0.4rem 0.5rem; margin-bottom: 1px;
  border-radius: 5px; cursor: pointer;
  font-size: 0.83rem; color: var(--ink);
  font-family: inherit;
}
nav.tabs button:hover { background: var(--surface-alt); }
nav.tabs button.active { background: var(--pine); color: var(--canvas-light); font-weight: 600; }

/* min-width:0 stops the wide booking tables from squeezing the sidebar off screen */
.admin-content { flex: 1; min-width: 0; }

.nav-toggle { display: none; }

@media (max-width: 900px) {
  .admin-shell { display: block; }
  /* Slide-out drawer on small screens — a permanent column costs too much width */
  nav.tabs {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 230px; z-index: 200;
    border-radius: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 2px 0 12px rgba(0,0,0,0.2);
    max-height: 100vh;
  }
  nav.tabs.open { transform: translateX(0); }
  .nav-toggle {
    display: block;
    position: fixed; top: 0.6rem; left: 0.6rem; z-index: 201;
    width: auto;
    background: var(--pine); color: var(--canvas-light);
    border-radius: 6px; padding: 0.5rem 0.8rem;
    font-size: 0.85rem; min-height: 40px;
  }
  .admin-content { padding-top: 3.2rem; }
  .nav-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 199; }
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } }

/* Theme switch on the public booking page — sits on the dark banner, so it needs its
   own contrast rather than the button styles meant for the light card background. */
.theme-toggle-btn {
  position: absolute;
  top: 1.1rem; right: 1.2rem;
  background: rgba(255,255,255,0.12);
  color: var(--hero-on);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 100px;
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  font-family: 'Public Sans', -apple-system, sans-serif;
  cursor: pointer;
}
.theme-toggle-btn:hover { background: rgba(255,255,255,0.22); }
@media (max-width: 480px) {
  .theme-toggle-btn { top: 0.6rem; right: 0.6rem; padding: 0.3rem 0.65rem; font-size: 0.72rem; }
}

/* Electric hookup — a plain checkbox got lost next to the pitch-type dropdown, and it's
   one of the questions most likely to change which pitches are even offered, so it gets
   a full-width, unmissable toggle of its own instead. */
.electric-toggle {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface-alt);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'Public Sans', -apple-system, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.electric-toggle:hover { border-color: var(--amber); }
.electric-toggle-icon { font-size: 1.3rem; line-height: 1; }
.electric-toggle-text { flex: 1; }
.electric-toggle-state {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 100px;
  background: var(--surface);
  color: var(--muted);
}
.electric-toggle[aria-pressed="true"] { background: var(--tint-warn); border-color: var(--amber); }
.electric-toggle[aria-pressed="true"] .electric-toggle-state { background: var(--amber); color: #201C16; }

/* Booking steps — one screen at a time so a first-time guest isn't faced with the whole
   form (pitch, extras, questions, payment) all at once. */
.stepper { display: flex; gap: 0.4rem; margin-bottom: 1.25rem; }
.step-dot {
  flex: 1;
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--line);
}
.step-dot .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--bark);
  margin-right: 0.35rem;
  font-weight: 700;
}
.step-dot.active { color: var(--pine); border-bottom-color: var(--amber); }
.step-dot.active .num { background: var(--amber); color: #201C16; }
.step-dot.done { color: var(--pine-light); border-bottom-color: var(--pine-light); }
.step-dot.done .num { background: var(--pine-light); color: #fff; }
@media (max-width: 640px) {
  .step-dot .label { display: none; }
  .step-dot { padding-bottom: 0.4rem; }
}

.step-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 1.5rem; gap: 0.75rem; }

/* Calendar grid */
table.cal-table { border-collapse: collapse; font-size: 0.78rem; }
table.cal-table th, table.cal-table td { border: 1px solid var(--line); padding: 0.25rem 0.4rem; text-align: center; white-space: nowrap; }
table.cal-table th.cal-pitch-col, table.cal-table td.cal-pitch-col {
  position: sticky; left: 0; background: var(--canvas-light); text-align: left; z-index: 1; min-width: 110px;
}
table.cal-table td.cal-booked { background: var(--tint-good); color: var(--pine-light); font-weight: 500; cursor: grab; }
table.cal-table td.cal-booked:active { cursor: grabbing; }
table.cal-table td.cal-booked.cal-pending { background: var(--tint-warn); color: var(--amber); }
table.cal-table td.cal-free { background: var(--canvas-light); color: var(--line); }
table.cal-table th.cal-weekend { background: var(--surface-alt); }

/* Dashboard stat cards — headline figure plus tomorrow/weekend/week breakdown,
   mirroring the four-across layout of a commercial system's main dashboard. */
.dash-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.dash-stat {
  background: var(--canvas-light);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.dash-stat .label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--bark);
}
.dash-stat .headline {
  font-family: 'Big Shoulders Display', 'Arial Narrow', sans-serif;
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--pine);
  line-height: 1.1;
  margin: 0.2rem 0 0.5rem;
}
.dash-stat .breakdown {
  display: flex;
  gap: 0.9rem;
  border-top: 1px dashed var(--line);
  padding-top: 0.5rem;
}
.dash-stat .breakdown div { font-size: 0.72rem; color: var(--bark); }
.dash-stat .breakdown strong {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.95rem;
  color: var(--ink);
  font-weight: 600;
}
.dash-stat.occupancy .headline { color: var(--amber); }

/* Occupancy bar used in the coming-days strip */
.occ-bar {
  height: 6px;
  background: var(--surface-alt);
  border-radius: 100px;
  overflow: hidden;
  margin-top: 3px;
}
.occ-bar span { display: block; height: 100%; background: var(--pine-light); border-radius: 100px; }
.occ-bar span.high { background: var(--ember); }
.occ-bar span.mid { background: var(--amber); }

/* Blocked pitches — deliberately taken out of use by staff (maintenance, owner use, etc).
   Visually distinct from "booked" so it's obvious at a glance which is which. */
table.cal-table td.cal-blocked {
  background: repeating-linear-gradient(45deg, var(--surface-alt), var(--surface-alt) 4px, var(--line) 4px, var(--line) 8px);
  color: var(--bark);
  font-weight: 700;
  cursor: pointer;
}
/* ---- Mobile / tablet ----
   The dashboard is used on a phone at the gate as much as on a desktop in the office,
   so tables scroll horizontally rather than squashing, tap targets grow, and the
   multi-column layouts collapse to single column. */
@media (max-width: 820px) {
  body { font-size: 15px; }
  .wrap { padding: 0.75rem; }
  .card { padding: 0.9rem; }
  .two-col { grid-template-columns: 1fr !important; }
  .dash-stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .dash-stat .headline { font-size: 1.7rem; }

  /* Tables scroll sideways instead of crushing columns to unreadable widths */
  .card table { display: block; overflow-x: auto; white-space: nowrap; }

  /* Bigger tap targets — 44px is the usual minimum for reliable finger taps */
  button.btn { padding: 0.75rem 1.1rem; min-height: 44px; }
  input, select, textarea { padding: 0.7rem; font-size: 16px; } /* 16px stops iOS zooming on focus */
  nav.tabs { gap: 0.4rem; }
  nav.tabs button { padding: 0.55rem 0.85rem; min-height: 40px; }

  header.topbar { padding: 1rem 0.9rem 1.8rem; }
  header.topbar h1 { font-size: 1.2rem; }
  /* Left padding clears the fixed hamburger button (nav-toggle, top:0.6rem;left:0.6rem)
     on the admin dashboard only — the customer booking page has no such button. */
  body.admin-page header.topbar { padding-left: 6.2rem; }

  .site-grid { grid-template-columns: 1fr; }

  /* Charts on a phone: the pitch column shrinks further so more days fit without
     scrolling, while day cells stay close to their desktop size — they're what's
     actually being tapped and read. */
  .chart-pitch { width: 42px; max-width: 42px; padding: 0 0.25rem; }
  .chart-day { width: 30px; min-width: 30px; height: 28px; }
  .chart-bar { font-size: 0.64rem; line-height: 24px; }
}

@media (max-width: 480px) {
  .dash-stat-grid { grid-template-columns: 1fr 1fr; }
  .dash-stat { padding: 0.75rem; }
  .dash-stat .headline { font-size: 1.5rem; }
  .dash-stat .breakdown { gap: 0.5rem; }
  .dash-stat .breakdown div { font-size: 0.66rem; }
}

/* Autocomplete dropdown for finding existing customers when taking a booking */
.autocomplete-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--canvas-light);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  max-height: 260px;
  overflow-y: auto;
}
.autocomplete-results .ac-item {
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.autocomplete-results .ac-item:last-child { border-bottom: none; }
.autocomplete-results .ac-item:hover,
.autocomplete-results .ac-item.active { background: var(--surface-alt); }
.autocomplete-results .ac-name { font-weight: 600; }
.autocomplete-results .ac-meta { font-size: 0.78rem; color: var(--bark); }
.linked-customer {
  background: var(--tint-good);
  border: 1px solid var(--pine-light);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

table.cal-table td.cal-owing {
  background: var(--tint-warn);
  color: var(--amber);
  font-weight: 700;
}
table.cal-table td.cal-overdue {
  background: var(--tint-bad);
  color: var(--ember);
  font-weight: 700;
}
/* Solid fill rather than a soft tint — nothing paid at all reads as visually heavier
   than "just the balance left", the same escalation the charts use. */
table.cal-table td.cal-owing-all {
  background: var(--chart-owing-all);
  color: var(--chart-text);
  font-weight: 700;
}
table.cal-table td.cal-overdue-all {
  background: var(--chart-overdue-all);
  color: var(--chart-text);
  font-weight: 700;
}


/* ---- Charts: whole-site booking grid ----
   A wide scrolling grid: pitch rows down the side, days across the top, booking bars
   spanning their dates. Sticky headers so the pitch name and date stay visible while
   scrolling a full year. */
.chart-table { border-collapse: separate; border-spacing: 0; font-size: 0.72rem; }
.chart-table th, .chart-table td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.chart-table thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--canvas-light);
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600; font-size: 0.66rem;
  padding: 2px 0; text-align: center; white-space: nowrap;
}
.chart-table thead tr:first-child th { top: 0; }
.chart-table thead tr:nth-child(2) th { top: 20px; }

/* Pitch name column stays put when scrolling sideways. Fixed narrow width (rather than
   sizing to the longest name) so the booking bars — the thing actually being read — get
   the space instead; long names still reach the reader via the title tooltip. */
.chart-pitch {
  position: sticky; left: 0; z-index: 2;
  background: var(--canvas-light);
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  padding: 0 0.35rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-right: 2px solid var(--line);
  width: 56px; max-width: 56px;
}
.chart-table thead .chart-pitch { z-index: 4; }

.chart-category-row td {
  background: var(--pine); color: var(--canvas-light);
  font-family: 'Big Shoulders Display', 'Arial Narrow', sans-serif; font-weight: 700;
  padding: 0.25rem 0.5rem; position: sticky; left: 0;
}

.chart-day { width: 34px; min-width: 34px; height: 26px; padding: 0; position: relative; }
.chart-day.chart-weekend { background: rgba(44, 85, 64, 0.06); }
.chart-day.chart-today { box-shadow: inset 2px 0 0 var(--ember); }
.chart-day:hover { background: rgba(198, 142, 23, 0.15); cursor: crosshair; }

/* Booking bars sit on top of the day cells */
.chart-bar {
  position: absolute; top: 2px; bottom: 2px; left: 1px;
  border-radius: 3px; padding: 0 4px;
  font-size: 0.7rem; line-height: 22px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: grab; z-index: 1; color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.chart-bar:hover { filter: brightness(1.1); z-index: 5; }
.chart-bar:active { cursor: grabbing; }
.chart-bar.dragging { opacity: 0.45; }

.chart-paid       { background: var(--chart-paid); color: var(--chart-text); }
.chart-owing      { background: var(--chart-owing); color: #201C16; }
.chart-owing-all  { background: var(--chart-owing-all); color: var(--chart-text); }
.chart-overdue    { background: var(--chart-overdue); color: var(--chart-text); }
.chart-overdue-all{ background: var(--chart-overdue-all); color: var(--chart-text); }
.chart-unconfirmed{ background: var(--chart-unconfirmed); color: var(--chart-text); }
.chart-pending    { background: var(--chart-pending); color: var(--chart-text); }
.chart-blocked    { background: repeating-linear-gradient(45deg,var(--chart-blocked-a),var(--chart-blocked-a) 4px,var(--chart-blocked-b) 4px,var(--chart-blocked-b) 8px); color: var(--ink); }
.chart-external   { background: var(--chart-external); color: var(--chart-text); }

.chart-key {
  display: inline-block; width: 14px; height: 14px;
  border-radius: 3px; vertical-align: middle; margin-right: 3px;
}

/* Where a booking can be dropped */
.chart-day.drop-ok { background: rgba(44, 85, 64, 0.3); }
.chart-day.drop-bad { background: rgba(181, 72, 44, 0.3); }

/* Charts on a large monitor: there's room to spare, so give it to the booking bars —
   wider, taller cells make guest names and date boundaries easier to read at a glance
   instead of squinting at a grid sized for a laptop. */
@media (min-width: 1400px) {
  .chart-pitch { width: 76px; max-width: 76px; }
  .chart-day { width: 46px; min-width: 46px; height: 32px; }
  .chart-bar { font-size: 0.78rem; line-height: 28px; padding: 0 6px; }
  .chart-table { font-size: 0.78rem; }
  .chart-table thead th { font-size: 0.7rem; }
}
