/* ============================================================
   CanIL Parkade — Styles
   ============================================================ */

:root {
  --primary:      #CE202F;
  --primary-dark: #a8192a;
  --primary-mid:  #e04c58;
  --available:    #16a34a;
  --available-bg: #dcfce7;
  --am-partial:      #a16207;
  --am-partial-bg:   #fef9c3;
  --pm-partial:      #c2410c;
  --pm-partial-bg:   #fed7aa;
  --full:         #dc2626;
  --full-bg:      #fee2e2;
  --permanent:    #7c3aed;
  --permanent-bg: #ede9fe;
  --bg:           #f1f5f9;
  --card:         #ffffff;
  --text:         #1e293b;
  --text-muted:   #64748b;
  --border:       #e2e8f0;
  --shadow:       0 1px 4px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.06);
  --radius:       12px;
  --header-h:     56px;
  --nav-h:        64px;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button { cursor: pointer; border: none; background: none; font-family: inherit; }
input  { font-family: inherit; }
a      { color: inherit; }

.hidden { display: none !important; }

/* ── App shell ────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* ── Header ───────────────────────────────────────────────── */
.app-header {
  position: fixed;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 480px;
  height: var(--header-h);
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-logo {
  height: 34px;
  width: auto;
}
.header-parkade {
  font-size: 18px;
  font-weight: 700;
  color: white;
  letter-spacing: -0.3px;
}

.header-user-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 20px;
  transition: background 0.15s;
}
.header-user-btn:hover, .header-user-btn:active {
  background: rgba(255,255,255,0.15);
  color: white;
}
.header-user-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ── Loader bar ───────────────────────────────────────────── */
.loader {
  position: fixed;
  top: var(--header-h);
  left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  height: 3px;
  z-index: 99;
  overflow: hidden;
}
.loader-bar {
  height: 100%;
  background: #60a5fa;
  animation: loader-slide 1.2s ease-in-out infinite;
}
@keyframes loader-slide {
  0%   { transform: translateX(-100%); }
  50%  { transform: translateX(0%); }
  100% { transform: translateX(100%); }
}

/* ── Main ─────────────────────────────────────────────────── */
main {
  position: fixed;
  top: var(--header-h);
  bottom: var(--nav-h);
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.view { display: none; padding-bottom: 16px; }
.view.active { display: block; }

/* ── Date navigation ──────────────────────────────────────── */
.date-nav {
  display: flex;
  flex-direction: column;
  padding: 6px 8px 6px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.date-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.date-arrow {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  color: var(--primary);
  border-radius: 50%;
  transition: background 0.15s;
  line-height: 1;
}
.date-arrow:hover, .date-arrow:active { background: var(--border); }

.date-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

#date-display {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.today-btn {
  font-size: 11px;
  color: var(--primary-mid);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--primary-mid);
  transition: background 0.15s, color 0.15s;
}
.today-btn:hover { background: var(--primary-mid); color: white; }

/* ── Stall grid ───────────────────────────────────────────── */
.stall-grid {
  display: grid;
  grid-template-columns: clamp(16px, 4.6vw, 22px) 1fr 1fr clamp(16px, 4.6vw, 22px);
  gap: clamp(3px, 1.1vw, 5px);
  padding: clamp(5px, 1.8vw, 8px);
}

.stall-card {
  border-radius: 8px;
  padding: clamp(5px, 1.5vw, 7px) clamp(5px, 2.1vw, 10px);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: clamp(4px, 1.8vw, 8px);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  box-shadow: var(--shadow);
  user-select: none;
  min-width: 0;
}
.stall-card:active { transform: scale(0.97); }

.stall-available  { background: var(--available-bg);    }
.stall-am         { background: var(--am-partial-bg);  }
.stall-pm         { background: var(--pm-partial-bg);  }
.stall-full       { background: var(--full-bg);        }
.stall-permanent  { background: var(--permanent-bg);   }

.stall-number {
  font-size: clamp(14px, 4.2vw, 18px);
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 1px;
  min-width: clamp(28px, 8.5vw, 38px);
  flex-shrink: 0;
}
.stall-p {
  font-size: clamp(8px, 2.2vw, 10px);
  font-weight: 700;
  opacity: 0.55;
  letter-spacing: 0.5px;
}
.stall-available  .stall-number { color: var(--available);   }
.stall-am         .stall-number { color: var(--am-partial); }
.stall-pm         .stall-number { color: var(--pm-partial); }
.stall-full       .stall-number { color: var(--full);       }
.stall-permanent  .stall-number { color: var(--permanent);  }

.stall-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
}

/* Permanent assignment name */
.stall-label-name {
  font-size: clamp(11px, 3.2vw, 14px);
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* One line per booking: "Larry 9a–12p" */
.stall-booking-line {
  font-size: clamp(9px, 2.4vw, 11px);  /* default: 2+ bookings */
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

/* Single booking gets a larger, easier-to-read size */
.stall-booking-line.booking-expired {
  opacity: 0.5;
  font-style: italic;
  text-decoration: line-through;
}

.label-single .stall-booking-line {
  font-size: clamp(11px, 3.2vw, 14px);
}
.stall-bk-time {
  font-weight: 400;
  opacity: 0.65;
}

/* +N expand / − collapse chip inside stall card */
.stall-expand-chip {
  display: inline-block;
  align-self: flex-start;
  font-size: 9px;
  font-weight: 700;
  color: var(--primary);
  background: var(--full-bg);
  border: 1px solid #fca5a5;
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.4;
  margin-top: 1px;
  cursor: pointer;
  transition: background 0.15s;
}
.stall-expand-chip:hover  { background: #fca5a5; }
.stall-collapse-chip      { color: var(--text-muted); background: var(--bg); border-color: var(--border); }
.stall-collapse-chip:hover { background: var(--border); }


/* ── Pillar markers ───────────────────────────────────────── */
.pillar-cell {
  display: flex;
  align-items: center;
  padding: 0 4px;
}
.pillar-cell.pillar-left  { justify-content: flex-end; }
.pillar-cell.pillar-right { justify-content: flex-start; }
.pillar-block {
  width: 16px;
  height: 14px;
  background: #b0bec5;
  border: 2px solid #78909c;
  border-radius: 3px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.15), 0 1px 2px rgba(0,0,0,0.15);
}

/* ── Door micro-columns ───────────────────────────────────── */
.door-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 0;
  overflow: hidden;
}
.door-col-icon { font-size: 11px; line-height: 1; }
.door-col-name {
  font-size: 6px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  line-height: 1;
}
.grid-empty { }

/* ── Park view — fills viewport, no vertical scroll ──────── */
#view-park.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0;
}

/* Stall grid fills remaining height after date-nav.
   Row pattern mirrors garageOrder(): S P S S P S P S S P S P S S S
   Stall rows: minmax(28px, 1fr) — fill available space, but never
   collapse below 28px. Once minimums exceed the viewport the grid
   overflows and #view-park scrolls (e.g. small phone landscape).
   Pillar rows: fixed 16px.                                         */
#view-park .stall-grid {
  flex: 1;
  min-height: 0;
  align-items: stretch;
  grid-template-rows:
    minmax(28px, 1fr) 16px
    minmax(28px, 1fr) minmax(28px, 1fr) 16px
    minmax(28px, 1fr) 16px
    minmax(28px, 1fr) minmax(28px, 1fr) 16px
    minmax(28px, 1fr) 16px
    minmax(28px, 1fr) minmax(28px, 1fr) minmax(28px, 1fr);
}

/* ── Legend (lives inside .date-nav) ─────────────────────── */
.legend {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px 8px;
  padding: 5px 8px 4px;
}

.no-stalls-btn {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 14px;
  background: var(--full);
  color: white;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(220,38,38,0.45);
  transition: opacity 0.15s, transform 0.1s, background 0.15s;
}
.no-stalls-btn:active { transform: scale(0.95); }
.no-stalls-btn:disabled { cursor: default; }
.no-stalls-btn.ns-reported {
  background: #94a3b8;
  box-shadow: none;
  font-weight: 600;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 3px;
  display: inline-block;
  border: 1.5px solid;
}
.dot-available { background: var(--available-bg);   border-color: var(--available);   }
.dot-am        { background: var(--am-partial-bg);  border-color: var(--am-partial);  }
.dot-pm        { background: var(--pm-partial-bg);  border-color: var(--pm-partial);  }
.dot-full      { background: var(--full-bg);         border-color: var(--full);        }
.dot-permanent { background: var(--permanent-bg);   border-color: var(--permanent);   }

/* ── Bottom nav ───────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 480px;
  height: var(--nav-h);
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  padding: 8px 4px;
  transition: color 0.15s;
}
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn.active { color: var(--primary); }
.nav-btn:hover  { color: var(--primary-mid); }

/* ── Overlay ──────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  animation: fade-in 0.2s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ── Bottom sheet ─────────────────────────────────────────── */
.sheet {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%; max-width: 480px;
  max-height: 93dvh;
  max-height: 93vh;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  z-index: 201;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.sheet.sheet-open { transform: translateX(-50%) translateY(0); }

.sheet-handle {
  width: 36px; height: 4px;
  flex-shrink: 0;
  background: var(--border);
  border-radius: 2px;
  margin: 10px auto 0;
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 20px 16px;
}

.sheet-footer {
  flex-shrink: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 12px 20px 28px;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0 10px;
}
.sheet-header h2 { font-size: 20px; font-weight: 700; }
.sheet-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.sheet-close:hover { background: var(--border); color: var(--text); }

/* ── Sheet — assignment banner ────────────────────────────── */
.assignment-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--permanent-bg);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
}
.assign-icon { font-size: 22px; }
.assign-sub   { font-size: 12px; color: var(--permanent); font-weight: 500; margin-top: 2px; }
.assign-notes { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Sheet — current bookings list ───────────────────────── */
.current-bookings { margin-bottom: 16px; }

.booking-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 6px;
}
.booking-item strong { font-size: 14px; }
.period-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--border);
  color: var(--text-muted);
  margin-left: 6px;
  vertical-align: middle;
}

/* ── Sheet — book section ─────────────────────────────────── */
.book-section { margin-top: 8px; }
.book-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.book-or {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin: 10px 0;
}
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

.stall-status-msg {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 14px;
}
.stall-full-msg { color: var(--full); font-weight: 500; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); opacity: 0.85; }
.btn-full   { width: 100%; margin-bottom: 8px; }

.btn-primary   { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary { background: var(--bg); color: var(--primary); border: 2px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

.btn-danger    { background: var(--full-bg); color: var(--full); }
.btn-danger:hover { background: #fca5a5; }

.btn-cancel {
  font-size: 12px;
  font-weight: 600;
  color: var(--full);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #fca5a5;
  background: var(--full-bg);
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-cancel:hover { background: #fca5a5; }

.btn-link {
  font-size: 13px;
  color: var(--primary-mid);
  font-weight: 600;
  text-decoration: underline;
  background: none;
  border: none;
  padding: 0;
}

/* ── Input ────────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  color: var(--text);
  background: var(--card);
  transition: border-color 0.15s;
  outline: none;
}
.input:focus { border-color: var(--primary-mid); }

/* ── My Bookings view ─────────────────────────────────────── */
.bookings-user-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 8px;
  font-size: 14px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--card);
  position: sticky; top: 0; z-index: 5;
}

.booking-date-group { padding: 0 12px; }
.booking-date-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 16px 4px 8px;
}
.booking-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  margin-bottom: 8px;
}
.booking-stall { font-size: 15px; font-weight: 700; }
.booking-period { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── Empty / info states ──────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { margin-bottom: 20px; font-size: 15px; line-height: 1.5; }

/* ── Admin view ───────────────────────────────────────────── */
.admin-login {
  padding: 48px 24px;
  text-align: center;
  max-width: 320px;
  margin: 0 auto;
}
.admin-lock { font-size: 48px; margin-bottom: 16px; }
.admin-login h2 { margin-bottom: 8px; }
.admin-login p { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }

.admin-section {
  padding: 16px;
}
.admin-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 12px;
}
.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.admin-row:last-child { border-bottom: none; }
.admin-row-info { flex: 1; min-width: 0; }
.admin-row-info strong { font-size: 14px; display: block; }
.admin-row-info small { font-size: 12px; color: var(--text-muted); display: block; margin-top: 2px; }

.admin-stall-badge {
  background: var(--permanent-bg);
  color: var(--permanent);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.admin-logout-btn {
  display: block;
  width: calc(100% - 32px);
  margin: 0 16px 16px;
  padding: 11px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border);
  text-align: center;
  background: var(--card);
  transition: background 0.15s;
}
.admin-logout-btn:hover { background: var(--bg); }

.app-version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 24px;
  gap: 12px;
}
.app-version-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.admin-update-btn {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-mid);
  border: 1px solid var(--border);
  background: var(--card);
  white-space: nowrap;
  transition: background 0.15s;
}
.admin-update-btn:hover { background: var(--bg); }

/* ── Add assignment form ──────────────────────────────────── */
.form-group { margin-bottom: 12px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-row { display: flex; gap: 8px; }
.form-row .form-group { flex: 1; }

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

/* ── Modal (name prompt) ──────────────────────────────────── */
.modal-wrap {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal {
  background: var(--card);
  border-radius: 20px;
  padding: 32px 24px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.modal-icon { font-size: 48px; margin-bottom: 12px; }
.modal h2   { font-size: 20px; margin-bottom: 8px; }
.modal p    { font-size: 14px; color: var(--text-muted); margin-bottom: 20px; line-height: 1.5; }

/* ── Toast ────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 12px);
  left: 50%; transform: translateX(-50%) translateY(12px);
  background: var(--text);
  color: white;
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  white-space: nowrap;
  max-width: calc(100vw - 48px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 400;
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.toast-error { background: var(--full); }
.toast.toast-warn  { background: var(--partial); }

/* ── Period selector buttons ──────────────────────────────── */
.period-btn-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }

.period-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--bg);
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
  width: 100%;
}
.period-btn:hover { border-color: var(--primary-mid); background: #f0f4ff; }
.period-btn.selected {
  border-color: var(--primary);
  background: #e8f0fa;
}
.period-btn-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.period-btn-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.period-btn-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
  padding-left: 8px;
}
.period-btn-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--full);
  margin-left: 8px;
}
.period-btn.selected .period-btn-label { color: var(--primary); }

/* ── Saved custom times ───────────────────────────────────── */
.saved-times-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.saved-times-divider {
  border-top: 1px solid var(--border);
  margin: 10px 0;
}
.saved-times-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
}
.saved-time-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.saved-time-row .period-btn {
  flex: 1;
}
.saved-time-remove {
  width: 34px;
  flex-shrink: 0;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.saved-time-remove:hover,
.saved-time-remove:active {
  background: var(--full-bg);
  color: var(--full);
  border-color: var(--full);
}

/* ── Custom time picker ───────────────────────────────────── */
.custom-time-section {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
}
.time-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.time-picker-row .time-picker-label { flex-shrink: 0; }
.time-picker-row select { flex: 1; }
.time-picker-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.input-sm {
  padding: 8px 10px;
  font-size: 14px;
  width: 100%;
}
.time-error {
  margin-top: 6px;
  font-size: 12px;
  color: var(--full);
  font-weight: 500;
}
.period-btn-hint {
  font-style: italic;
}

/* ── Recurring section ────────────────────────────────────── */
.recurring-toggle-row {
  border-top: 1px solid var(--border);
  padding: 10px 0 0;
  margin-top: 8px;
}
.recurring-toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.toggle-switch {
  width: 44px; height: 26px;
  border-radius: 13px;
  background: var(--border);
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  transition: transform 0.2s;
}
.toggle-switch.on { background: var(--primary); }
.toggle-switch.on::after { transform: translateX(18px); }

.recurring-body {
  padding: 8px 0 0;
}
.weekday-row { display: flex; gap: 5px; }
.weekday-btn {
  flex: 1;
  padding: 7px 2px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  border: 2px solid var(--border);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.weekday-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.until-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.until-chip {
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  border: 2px solid var(--border);
  color: var(--text-muted);
  background: var(--bg);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.until-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.recurring-count {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  text-align: center;
  padding: 8px;
  background: #e8f0fa;
  border-radius: 8px;
}


/* Fluid scaling via clamp() above handles all screen widths — no breakpoints needed */

/* ── Confirm dialog ───────────────────────────────────────── */
.confirm-wrap {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.confirm-modal {
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 320px;
}
.confirm-modal h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}
.confirm-modal p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}
.confirm-btns {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}
.confirm-btns .btn {
  flex: 1;
  padding: 11px 10px;
  font-size: 14px;
  white-space: normal;
  line-height: 1.3;
  text-align: center;
}

/* ── Occupancy report ─────────────────────────────────────── */
.report-chart-outer {
  display: flex;
  align-items: flex-start;
  margin: 14px 0 0;
}
.report-chart-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-width: 0;
  padding-bottom: 4px;
}
.report-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 10px;
}
.report-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}
.report-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.report-summary {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: right;
}
.report-empty,
.report-loading,
.report-error {
  text-align: center;
  font-size: 13px;
  padding: 16px 0 4px;
  color: var(--text-muted);
}
.report-error { color: var(--full); }

/* ── No-spot people breakdown ─────────────────────────────── */
.ns-total {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.ns-people-list { display: flex; flex-direction: column; gap: 8px; }
.ns-person-row {
  display: grid;
  grid-template-columns: 1fr 2fr auto auto;
  align-items: center;
  gap: 8px;
}
.ns-person-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ns-bar-wrap {
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
}
.ns-bar {
  height: 100%;
  background: var(--full);
  border-radius: 5px;
  transition: width 0.4s ease;
}
.ns-bar-anon { background: #94a3b8; }
.ns-person-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--full);
  white-space: nowrap;
  text-align: right;
}
.ns-person-last {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Desktop centering ────────────────────────────────────── */
@media (min-width: 480px) {
  .app-header, .bottom-nav, .loader { border-radius: 0; }
  #app { box-shadow: 0 0 0 1px var(--border), 0 8px 32px rgba(0,0,0,0.12); }
}
