/* ==========================================================================
   AquaOps — shared design system
   Dark navy background, teal accent, plain CSS (no framework).
   ========================================================================== */

:root {
  /* "Slate and Seafoam" dark palette. The design-system tokens below this
     point (--teal, --blue, --danger, --amber, --success, etc.) are kept so
     every existing rule in this file (and every inline var(--x) in
     dashboard.html) still resolves — they're now aliases onto the named
     palette instead of their own hardcoded hex, so nothing else had to
     change to pick up the new colors. Verified contrast (WCAG relative
     luminance): --text/--muted/--accent/--accent-2/--ok/--warn/--bad all
     exceed 4.5:1 against both --bg and --panel (smallest margin: --muted
     on --panel at 6.3:1) — no shade needed adjusting.
     Status meaning is unchanged: --bad = expired/out-of-range,
     --warn = expiring/warning, --ok = valid/fine. */
  --bg: #15181c;
  --panel: #1e2327;
  --accent: #5eead4;
  --accent-2: #7dd3fc;
  --nav-active: #25423f;
  --on-accent: #0a2723;
  --muted: #9aa5ae;

  --ok: #86efac;
  --warn: #fcd34d;
  --bad: #fca5a5;

  --bg-elevated: var(--panel);
  --bg-raised: #242a2f;
  --bg-hover: #2a3136;

  --border: #2d343b;
  --border-strong: #363e46;

  --teal: var(--accent);
  --teal-dark: color-mix(in srgb, var(--accent) 100%, black 15%);
  --teal-soft: color-mix(in srgb, var(--accent) 14%, transparent);

  --blue: var(--accent-2);
  --blue-dark: color-mix(in srgb, var(--accent-2) 100%, black 15%);

  --text: #eceff1;
  --text-dim: var(--muted);
  --text-faint: color-mix(in srgb, var(--muted) 85%, transparent);

  --danger: var(--bad);
  --danger-bg: color-mix(in srgb, var(--bad) 12%, transparent);
  --danger-border: color-mix(in srgb, var(--bad) 25%, transparent);

  --amber: var(--warn);
  --amber-bg: color-mix(in srgb, var(--warn) 12%, transparent);
  --amber-border: color-mix(in srgb, var(--warn) 30%, transparent);

  --success: var(--ok);
  --success-bg: color-mix(in srgb, var(--ok) 12%, transparent);
  --success-border: color-mix(in srgb, var(--ok) 25%, transparent);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;

  --shadow: 0 8px 20px rgba(0, 0, 0, 0.32), 0 2px 6px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.18), 0 1px 1px rgba(0, 0, 0, 0.12);

  --sidebar-w: 240px;
  --bg-translucent: rgba(21, 24, 28, 0.85);
  --bg-glow: #1e2327;

  /* Shift Scheduling position colors (js/shared.js POSITIONS reads these
     by name, e.g. 'var(--pos-lifeguard)'). Most alias an existing,
     already contrast-verified token so Lifeguard/Instructor/Concessions/
     Front Desk/Deck-Maintenance automatically track theme changes for
     free. Head Guard's purple has no existing token, so it gets its own
     dark-mode value here (verified 5.3–6.5:1 against panel/bg-raised/bg)
     with a separate, darker light-mode value below. */
  --pos-lifeguard: var(--blue);
  --pos-head-guard: #a78bfa;
  --pos-instructor: var(--success);
  --pos-concessions: var(--amber);
  --pos-front-desk: var(--muted);
  --pos-deck-maintenance: var(--danger);

  /* Facility Calendar's Maintenance pill — distinct from --amber (used by
     Cert Expirations) so the two don't read as the same color. Verified
     6.4–7.9:1 here; separate darker light-mode value below. */
  --cal-orange: #fb923c;

  /* Gradient header fill shared by the shift grid and the calendar month
     grid ("header row styled like the shift grid header") — derived from
     --teal via color-mix, not a literal hex, so it tracks the active
     theme. Verified >6:1 contrast for white header text in both themes. */
  --grid-header-fill: linear-gradient(135deg,
    color-mix(in srgb, var(--teal) 50%, black),
    color-mix(in srgb, var(--teal) 32%, black));
}

/* Light mode — dark navy (the :root above) is the default; this overrides
   the same token names for [data-theme="light"], set by js/theme.js.
   Values adapted from the prototype's own light-mode :root (its default
   theme, with dark as an opt-in [data-theme="dark"] override — inverse of
   this app, which defaults dark per earlier explicit design direction). */
[data-theme="light"] {
  --bg: #F6F9FC;
  --bg-elevated: #EEF5FA;
  --bg-raised: #FEFEFF;
  --bg-hover: #DBEAFE;

  /* New named tokens (see :root dark palette) — set equal to this theme's
     existing colors so light mode keeps looking exactly as it does today. */
  --panel: #EEF5FA;
  --muted: #4A6080;
  --accent: #00C9A7;
  --accent-2: #0099E6;
  --ok: #00C9A7;
  --warn: #D97706;
  --bad: #DC2626;
  --nav-active: rgba(0, 201, 167, 0.12);
  --on-accent: #06231E;

  --border: #E4EDF6;
  --border-strong: #D7E6F3;

  --teal: #00C9A7;
  --teal-dark: #00A88C;
  --teal-soft: rgba(0, 201, 167, 0.12);

  --blue: #0099E6;
  --blue-dark: #0073B1;

  --text: #1A2332;
  --text-dim: #4A6080;
  --text-faint: rgba(107, 128, 153, 0.75);

  --danger: #DC2626;
  --danger-bg: #FEE2E2;
  --danger-border: #FECACA;

  --amber: #D97706;
  --amber-bg: #FEF3C7;
  --amber-border: #FCD34D;

  --success: #00C9A7;
  --success-bg: #DCFCE7;
  --success-border: #BBF7D0;

  --shadow: 0 6px 16px rgba(16, 36, 59, 0.08), 0 2px 4px rgba(16, 36, 59, 0.04);
  --shadow-sm: 0 1px 2px rgba(16, 36, 59, 0.04), 0 1px 1px rgba(16, 36, 59, 0.03);
  --bg-translucent: rgba(246, 249, 252, 0.85);
  --bg-glow: #EAF4FB;

  /* Darker purple for light backgrounds (verified 5.2–5.7:1) — every
     other --pos-* token aliases an existing per-theme color and needs no
     override here. */
  --pos-head-guard: #7c3aed;

  /* Darker orange for light backgrounds (verified 4.7–5.1:1), distinct
     from --amber's light value (#D97706). */
  --cal-orange: #c2410c;
}

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

html, body {
  height: 100%;
}

body {
  background: radial-gradient(1200px 800px at 15% -10%, var(--bg-glow, #0d2c48) 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

button { font-family: inherit; }

::selection { background: var(--teal-soft); color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-hover); background-clip: content-box; }

/* ---------------------------------------------------------------------- */
/* Typography helpers                                                     */
/* ---------------------------------------------------------------------- */

.brand-font { font-family: 'Nunito', 'Inter', sans-serif; }

h1, h2, h3 { font-family: 'Nunito', 'Inter', sans-serif; font-weight: 800; letter-spacing: -0.01em; }

.eyebrow {
  font-family: 'Nunito', sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ---------------------------------------------------------------------- */
/* Buttons                                                                */
/* ---------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 999px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 13px;
  padding: 9px 20px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 25%, transparent);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 35%, transparent); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  border: 2px solid var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--teal); }

.btn-red {
  background: transparent;
  border: 1.5px solid var(--danger-border);
  color: var(--danger);
}
.btn-red:hover:not(:disabled) { background: var(--danger-bg); }

.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 13px; }

/* ---------------------------------------------------------------------- */
/* Form controls                                                          */
/* ---------------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }

.field-label {
  font-family: 'Nunito', sans-serif;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
}

input, select, textarea {
  background: var(--bg);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder, textarea::placeholder { color: var(--text-faint); }

input:focus, select:focus, textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

textarea { resize: vertical; min-height: 72px; font-family: 'Inter', sans-serif; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2300C9A7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 32px;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

@media (max-width: 640px) {
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

.form-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
}
.form-msg.error { background: var(--danger-bg); border: 1.5px solid var(--danger-border); color: var(--danger); }
.form-msg.success { background: var(--success-bg); border: 1.5px solid var(--success-border); color: var(--success); }
.form-msg.warn { background: var(--amber-bg); border: 1.5px solid var(--amber-border); color: var(--amber); }
.form-msg[hidden] { display: none; }

/* ---------------------------------------------------------------------- */
/* Cards                                                                  */
/* ---------------------------------------------------------------------- */

.card {
  background: var(--bg-raised);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.card-title {
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 2px;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 18px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

/* ---------------------------------------------------------------------- */
/* Pills / badges                                                         */
/* ---------------------------------------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: 'Nunito', sans-serif;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.pill-teal { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.pill-muted { background: var(--bg-elevated); color: var(--text-dim); border: 1px solid var(--border); }
.pill-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }
.pill-amber { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }
.pill-blue { background: rgba(0, 153, 230, 0.14); color: var(--blue); border: 1px solid rgba(0, 153, 230, 0.35); }

/* Certification expiry status only (certStatus()'s pillCls) — solid
   saturated fills instead of the translucent tint above. The 12%-opacity
   .pill-teal/-amber/-danger read as too dull for something people need to
   scan at a glance; solid color against dark text fixes that without
   touching the shared pills everything else (Staff active/inactive, etc.)
   still uses. */
.pill-cert-ok { background: var(--ok); color: #0a2316; border: 1px solid var(--ok); }
.pill-cert-warn { background: var(--warn); color: #2b2104; border: 1px solid var(--warn); }
.pill-cert-bad { background: var(--bad); color: #330a0a; border: 1px solid var(--bad); }

.health-bar { height: 8px; border-radius: 4px; background: var(--bg-elevated); overflow: hidden; }
.health-fill { height: 100%; border-radius: 4px; transition: width 0.4s ease; }

.pill-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

.range-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.item-row {
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 13px 15px;
  margin-bottom: 8px;
}
.item-row:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------------- */
/* Tables                                                                 */
/* ---------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

thead th {
  text-align: left;
  font-family: 'Nunito', sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--panel);
  border-bottom: 2px solid var(--accent);
  padding: 12px 14px;
  white-space: nowrap;
}

tbody td {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

tbody tr:nth-child(even) { background: var(--bg-elevated); }
tbody tr:hover { background: var(--bg-hover); }

.empty-row { text-align: center; color: var(--text-faint); padding: 28px 14px; }
.error-text { color: var(--danger); }

/* Shift Scheduling weekly grid. .table-wrap above already gives this its
   horizontal scroll at phone width — min-width on .grid-table forces that
   scroll instead of squashing columns illegibly.

   border-collapse: separate + border-spacing gives every cell its own
   rounded box with a visible gap, instead of one flat grid of shared
   lines. The header fill is derived from --teal via color-mix (not a
   hardcoded hex) so it tracks whichever theme is active; it's mixed dark
   enough — verified >6:1 contrast in both dark and light mode — that
   literal white header text reads clearly either way. */
.grid-table {
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 6px;
}
.grid-table thead th {
  background: var(--grid-header-fill);
  color: #ffffff;
  border-bottom: none;
  border-radius: 10px;
  text-align: center;
}
.grid-table thead th:first-child { text-align: left; }
.grid-table th.grid-day-today { box-shadow: inset 0 -3px 0 0 #ffffff; }

.grid-table th.grid-block-col, .grid-table td.grid-block-col {
  position: sticky; left: 0; z-index: 1;
  min-width: 150px; white-space: normal;
}
.grid-table th.grid-block-col { background: var(--grid-header-fill); }
.grid-table td.grid-block-col { background: var(--bg-elevated); border-radius: 10px; }
.grid-table td.grid-block-col strong { color: var(--teal); font-family: 'Nunito', sans-serif; font-weight: 800; }
.grid-table td.grid-block-col .grid-block-hours { font-size: 11px; color: var(--text-faint); }

.grid-table td {
  vertical-align: top;
  min-width: 140px;
  min-height: 92px;
  cursor: pointer;
  padding: 8px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg-raised);
  transition: filter 0.15s ease;
}
.grid-table td.grid-day-today { box-shadow: inset 0 0 0 2px var(--teal-soft); }
.grid-table td.grid-cell-ok { background: var(--success-bg); border-color: var(--success-border); }
.grid-table td.grid-cell-bad { background: var(--danger-bg); border-color: var(--danger-border); }
.grid-table td[data-grid-cell]:hover { filter: brightness(1.12); }

.grid-no-lg {
  font-size: 11px; font-weight: 800; color: var(--danger); letter-spacing: 0.04em;
  text-align: center; text-transform: uppercase; margin-bottom: 4px;
}
.grid-cell-empty { display: block; text-align: center; color: var(--text-faint); font-size: 12px; }

/* One rounded, position-tinted row per occupied position inside a cell.
   The tint/left-bar color comes from --pos-* (see :root / [data-theme]
   below) via inline style — a per-position color token, not a hex
   literal, so it's correct in both themes automatically. */
.grid-position-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 5px;
  padding: 3px 6px; border-radius: 7px; border-left: 3px solid transparent;
  margin-bottom: 4px;
}
.grid-position-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.grid-position-label { font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; margin-right: 2px; }
.grid-avatar-row { display: flex; flex-wrap: wrap; gap: 4px; }
.avatar-chip.sm { width: 20px; height: 20px; font-size: 9px; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'Nunito', sans-serif; font-size: 12px; font-weight: 800;
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--bg-elevated); color: var(--text-dim); cursor: pointer;
}
.chip-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.chip.active { background: var(--teal-soft); color: var(--teal); border-color: var(--teal); }

.stat-value.is-danger { color: var(--danger); }
.stat-value.is-success { color: var(--success); }
.stat-value.is-purple { color: var(--pos-head-guard); }
.stat-value.is-info { color: var(--blue); }

/* #shift-grid-view is a .stack now (20px gap, within the requested
   16–24px range) — .stat-grid's own margin-bottom would stack on top of
   that gap, so it's zeroed here rather than touched globally. */
#shift-grid-view > .stat-grid { margin-bottom: 0; }

.coverage-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .coverage-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .coverage-grid { grid-template-columns: 1fr; } }

.coverage-card { background: var(--bg-raised); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; border-left: 4px solid transparent; }
.coverage-card-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 13px; }
.coverage-card-count { color: var(--text-faint); font-size: 12px; margin-top: 6px; display: block; }
.coverage-card .health-bar { border: 1px solid var(--border); }

/* Facility Calendar month grid. Same rounded-separate-cell language as
   .grid-table, and the same gradient header (--grid-header-fill) per the
   task's "styled like the shift grid header" — but only 7 equal columns
   (no sticky label column), so .table-wrap's horizontal scroll is the
   phone-width answer here too, just with a smaller min-width. */
/* table-layout: fixed + width: 100% forces all 7 columns equal regardless
   of content — a single long event label can no longer stretch one
   column wider than the rest (the explicit per-cell width below is
   belt-and-suspenders, since fixed layout already splits evenly with no
   column widths declared). min-width keeps the horizontal-scroll phone
   answer, same as the shift grid. */
.cal-table { min-width: 600px; width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 6px; }
.cal-table th, .cal-table td { width: 14.2857%; }
.cal-table thead th {
  background: var(--grid-header-fill);
  color: #ffffff;
  border-radius: 10px;
  text-align: center;
  padding: 10px 4px;
  font-family: 'Nunito', sans-serif;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.cal-table th.cal-day-today { box-shadow: inset 0 -3px 0 0 #ffffff; }
.cal-table td {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg-raised);
  vertical-align: top;
  padding: 6px;
  min-height: 96px;
  cursor: pointer;
  overflow: hidden;
  transition: filter 0.15s ease;
}
@media (max-width: 560px) { .cal-table td { min-height: 72px; } }
.cal-table td:hover { filter: brightness(1.1); }
.cal-table td.cal-day-today { box-shadow: inset 0 0 0 2px var(--teal-soft); }
.cal-table td.cal-day-outside { background: var(--bg-elevated); cursor: default; opacity: 0.55; }

.cal-day-number {
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 13px;
  color: var(--text-dim); margin-bottom: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.cal-table td.cal-day-today .cal-day-number { background: var(--teal); color: var(--on-accent); font-weight: 900; }

.cal-event-bar {
  font-size: 11.5px; font-weight: 700; padding: 3px 6px; margin-bottom: 3px;
  min-height: 20px; line-height: 14px; box-sizing: border-box;
  border-radius: 5px; border-left: 2px solid transparent;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-more { font-size: 10.5px; color: var(--text-faint); margin-top: 2px; }

.avatar-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--border-strong);
  color: var(--teal);
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 12px;
  flex-shrink: 0;
}

.name-cell { display: flex; align-items: center; gap: 10px; font-weight: 600; }

/* ==========================================================================
   Login page
   ========================================================================== */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-raised);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 34px 30px;
  box-shadow: var(--shadow);
  animation: fadeUp 0.4s ease;
}

@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes notifSlide { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes badgePop { 0% { transform: scale(0); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }
@keyframes searchHighlight { 0%, 100% { background: transparent; } 30% { background: var(--teal-soft); } }
.search-highlight { animation: searchHighlight 2s ease; }

.demo-badge {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  background: var(--bg-raised);
  border: 1.5px solid var(--teal);
  border-radius: var(--radius);
  padding: 12px 16px;
  min-width: 260px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}
.demo-badge-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--teal);
  margin-bottom: 8px;
}
.demo-badge-top .btn { margin-left: auto; }
.demo-badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); animation: pulse 1.4s infinite; }
.demo-badge-label { font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; }

.fade-up { opacity: 1; animation: fadeUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.fade-in { opacity: 1; animation: fadeIn 0.2s ease forwards; }
.scale-in { opacity: 1; animation: scaleIn 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards; }

/* Section content fades/slides up on switch — matches the prototype's stagger pattern */
.section.active { animation: fadeUp 0.3s cubic-bezier(0.4, 0, 0.2, 1); }

.stagger > * { opacity: 1; animation: fadeUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.stagger > *:nth-child(1) { animation-delay: 0.03s; }
.stagger > *:nth-child(2) { animation-delay: 0.07s; }
.stagger > *:nth-child(3) { animation-delay: 0.11s; }
.stagger > *:nth-child(4) { animation-delay: 0.15s; }
.stagger > *:nth-child(5) { animation-delay: 0.19s; }
.stagger > *:nth-child(6) { animation-delay: 0.23s; }

/* ---------------------------------------------------------------------- */
/* Modal                                                                  */
/* ---------------------------------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 17, 28, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 300;
  animation: fadeIn 0.18s ease;
}
.modal-overlay[hidden] { display: none; }

.modal {
  width: 100%;
  max-width: 440px;
  background: var(--bg-raised);
  border-radius: var(--radius-lg);
  padding: 26px 26px 24px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
  animation: fadeUp 0.22s ease;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.modal-title { font-size: 18px; }

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-faint);
  font-size: 15px;
  line-height: 1;
  padding: 4px;
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}
.modal-close:hover { color: var(--text); background: var(--bg-hover); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.login-logo-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 6px 16px rgba(0, 153, 230, 0.3);
  flex-shrink: 0;
}

.login-logo-text { font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 21px; letter-spacing: -0.02em; }
.login-logo-sub { font-size: 12px; color: var(--text-faint); margin-top: 1px; }

.login-heading { font-size: 20px; margin-bottom: 4px; }
.login-subtext { font-size: 13.5px; color: var(--text-dim); margin-bottom: 24px; }

.login-footnote {
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 20px;
}

.login-portal-link {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 10px;
}

/* Unified sign-in page (index.html) — Sign In / Guard / Parent tabs. Guard
   reuses the Sign In form/handler as-is (same auth, just different copy —
   see js/login.js); Parent is a genuinely separate form. */
.login-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 26px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 4px;
}
.login-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 10px 8px;
  min-height: 40px;
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.login-tab:hover { color: var(--text); }
.login-tab.active { background: var(--bg-raised); color: var(--teal); box-shadow: var(--shadow-sm); }

/* ==========================================================================
   Guard shell — mobile-first single-column layout
   ========================================================================== */

.guard-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.guard-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  background: var(--bg-translucent);
  backdrop-filter: blur(10px);
  border-bottom: 1.5px solid var(--border);
}

.guard-topbar-brand { display: flex; align-items: center; gap: 9px; }
.guard-topbar-brand .logo-icon { width: 30px; height: 30px; font-size: 14px; }
.guard-topbar-brand .logo-text { font-size: 15px; }

.guard-content {
  flex: 1;
  padding: 16px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.guard-hello { font-size: 20px; margin-bottom: 2px; }
.guard-sub { font-size: 13px; color: var(--text-dim); }

.station-card {
  background: linear-gradient(135deg, rgba(0, 201, 167, 0.16), rgba(0, 201, 167, 0.04));
  border: 1.5px solid var(--success-border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.station-name { font-family: 'Nunito', sans-serif; font-size: 24px; font-weight: 900; color: var(--teal); margin: 4px 0 2px; }
.station-time { font-size: 13px; color: var(--text-dim); }

.guard-btn-row { display: flex; gap: 10px; }
.guard-btn-row .btn { flex: 1; }

.pool-status-banner {
  border-radius: var(--radius);
  padding: 16px 20px;
  border: 1.5px solid var(--success-border);
  background: linear-gradient(135deg, rgba(0, 201, 167, 0.16), rgba(0, 201, 167, 0.04));
  transition: background 0.2s ease, border-color 0.2s ease;
}
.pool-status-banner.status-alert,
.pool-status-banner.status-weather-hold {
  border-color: var(--amber-border);
  background: linear-gradient(135deg, rgba(245, 166, 35, 0.18), rgba(245, 166, 35, 0.05));
}
.pool-status-banner.status-closed {
  border-color: var(--danger-border);
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.18), rgba(255, 107, 107, 0.05));
}
.pool-status-value { font-family: 'Nunito', sans-serif; font-size: 22px; font-weight: 900; margin: 4px 0 2px; }
.pool-status-message { font-size: 13px; color: var(--text-dim); }

.guard-cert-banner {
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
  border: 1.5px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}
.guard-cert-banner.is-bad { border-color: var(--danger-border); background: var(--danger-bg); color: var(--danger); }
.guard-cert-banner.is-warn { border-color: var(--amber-border); background: var(--amber-bg); color: var(--amber); }

.break-timer-display {
  font-family: 'Nunito', sans-serif;
  font-size: 38px;
  font-weight: 900;
  text-align: center;
  color: var(--teal);
  padding: 10px 0 16px;
  letter-spacing: 0.02em;
}

@media (max-width: 480px) {
  .guard-content { padding: 14px 12px 36px; }
}

/* Guard tabs — bottom nav swaps five full-screen sections */
.guard-content { padding-bottom: 100px; }

.guard-tab { display: none; flex-direction: column; gap: 16px; }
.guard-tab.active { display: flex; animation: fadeUp 0.22s ease; }

.guard-navbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: var(--surface);
  border-top: 1.5px solid var(--border);
  padding: 10px 4px calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.35);
}

.guard-navitem {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 2px;
  color: var(--text-faint);
}
.guard-navicon { font-size: 21px; line-height: 1; position: relative; }
.guard-navlabel { font-size: 10.5px; font-weight: 800; letter-spacing: 0.01em; }
.guard-navitem.active { color: var(--teal); }
.guard-navitem:hover { color: var(--text); }

/* Mobile app feel — prevent iOS auto-zoom (needs >=16px inputs), guarantee
   44px minimum touch targets, and a tactile press animation standing in
   for haptic feedback (real navigator.vibrate() is fired from JS too, on
   devices that support it — this covers the ones that don't). */
.guard-shell input, .guard-shell select, .guard-shell textarea { font-size: 16px; }
.guard-shell .btn { min-height: 44px; }
.guard-navitem { min-height: 48px; }
.guard-shell button:active, .guard-shell .facmap-pin:active { transform: scale(0.96); }
.guard-shell button { transition: transform 0.1s ease; }

.pull-refresh-indicator {
  position: fixed;
  top: 58px;
  left: 50%;
  transform: translate(-50%, -60px);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  z-index: 90;
  transition: transform 0.15s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.pull-refresh-indicator.visible { transform: translate(-50%, 6px); }
.pull-refresh-indicator.spinning { animation: spin 0.8s linear infinite; }

.a2hs-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 95;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.a2hs-banner button { width: auto; min-height: 36px; padding: 8px 14px; }

.offline-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 800;
  color: var(--amber);
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.guard-notif-dot {
  position: absolute;
  top: -4px;
  right: -8px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--danger);
  color: var(--on-accent);
  font-size: 9px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
}

/* Locked-by-plan guard bottom-nav tab / card — stays visible/tappable
   (never display:none) so it's discoverable; tapping opens the upgrade
   modal instead of switching tabs. See js/plan-features.js. */
.guard-navitem-locked { opacity: 0.45; }
.guard-lock-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--amber);
  color: var(--on-accent);
  font-size: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
}
.card-locked { opacity: 0.55; cursor: pointer; }
.card-locked .card-title::after {
  content: 'Upgrade';
  margin-left: 8px;
  font-size: 10px;
  font-weight: 800;
  color: var(--amber);
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-radius: 999px;
  padding: 2px 8px;
  vertical-align: middle;
}
.card-locked form, .card-locked > button { pointer-events: none; }

.login-toggle {
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 18px;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  margin-left: 4px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--teal);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover { color: var(--teal-dark); }

/* ==========================================================================
   App shell — sidebar + topbar
   ========================================================================== */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--bg-raised) 0%, var(--bg) 100%);
  border-right: 1.5px solid var(--border);
  box-shadow: 4px 0 24px rgba(16, 36, 59, 0.08);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 18px;
  border-bottom: 2px solid var(--border);
}

.logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 153, 230, 0.3);
}

.logo-text { font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 17px; letter-spacing: -0.02em; }

.sidebar-nav { flex: 1; padding: 14px 10px; overflow-y: auto; }

.nav-section-label {
  padding: 12px 10px 6px;
  font-family: 'Nunito', sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 16px);
  padding: 6px 10px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: 'Nunito', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
  margin: 1px 8px;
}

.nav-item:hover { background: var(--bg-hover); color: var(--text); }

/* Readability fix: inactive nav labels go pure white in dark mode only —
   :not(.active) keeps this from fighting .nav-item.active's own color
   below, and :not([data-theme="light"]) keeps light mode untouched (its
   nav labels still come from the base .nav-item rule's var(--text-dim)). */
:root:not([data-theme="light"]) .nav-item:not(.active) { color: #ffffff; }

.nav-item.active {
  background: var(--nav-active);
  color: var(--teal);
  box-shadow: inset 3px 0 0 var(--teal);
}

.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

/* Icon "tile" — 32px rounded square behind a 20px inline SVG. Used for nav
   items and the Overview attention card headings (js/icons.js). Kept to a
   comfortable size so sidebar rows don't grow tall or crowd at phone width
   — .nav-item's own padding was trimmed slightly (9px -> 6px) to match. */
.icon-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--muted);
  flex-shrink: 0;
}
/* Readability fix, dark mode only: inactive nav tile icons a shade lighter
   than --muted so icon and (now white) label read together. Scoped to
   .nav-item (not a bare .icon-tile rule) so it can't out-specificity the
   .is-bad/.is-warn status tiles on the Overview cards, which aren't nested
   in a .nav-item at all. */
:root:not([data-theme="light"]) .nav-item:not(.active) .icon-tile { color: var(--text); }
.nav-item.active .icon-tile { background: color-mix(in srgb, var(--accent) 24%, transparent); color: var(--accent); }

/* Status-colored tiles — Overview attention card headings only. */
.icon-tile.is-bad { background: var(--danger-bg); color: var(--bad); }
.icon-tile.is-warn { background: var(--amber-bg); color: var(--warn); }

.nav-more-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(100% - 16px);
  padding: 10px 14px;
  margin: 6px 8px 1px;
  border-radius: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  transition: background 0.15s ease, color 0.15s ease;
}
/* Readability fix, dark mode only — same reasoning as .nav-item above. */
:root:not([data-theme="light"]) .nav-more-toggle { color: #ffffff; }
.nav-more-toggle:hover { background: var(--bg-hover); color: var(--text-dim); }
.nav-more-chevron { display: inline-block; font-size: 10px; transition: transform 0.15s ease; }
.nav-more-toggle[aria-expanded="true"] .nav-more-chevron { transform: rotate(90deg); }

/* Locked-by-plan nav item — stays visible/discoverable (never display:none),
   just dimmed, with a small "Upgrade" tag. See js/plan-features.js. */
.nav-item-locked { opacity: 0.55; }
.nav-item-locked:hover { opacity: 0.8; }
.nav-upgrade-tag { flex-shrink: 0; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1.5px solid var(--border);
}

.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }

.user-chip-email {
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip-facility { font-size: 11px; color: var(--text-faint); }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 62px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1.5px solid var(--border);
  background: var(--bg-translucent);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 8px rgba(16, 36, 59, 0.04);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title { font-size: 16px; font-weight: 800; font-family: 'Nunito', sans-serif; }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.facility-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-dim);
}

.btn-icon {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-icon:hover { background: var(--bg-hover); border-color: var(--border-strong); }

.emergency-btn { border-color: var(--danger-border); background: var(--danger-bg); animation: pulse 2.5s ease-in-out infinite; }
.emergency-btn:hover { background: var(--danger-bg); border-color: var(--danger); animation: none; }

.topbar-logo { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }

.hamburger-btn {
  display: none;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 19px;
  cursor: pointer;
}

/* ---------------------------------------------------------------------- */
/* Notifications bell + dropdown                                         */
/* ---------------------------------------------------------------------- */

.notif-bell-wrap { position: relative; }

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #2a0a0a;
  font-family: 'Nunito', sans-serif;
  font-size: 10px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--bg-raised);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 90;
  animation: fadeUp 0.15s ease;
}
.notif-dropdown[hidden] { display: none; }

.notif-dropdown-head {
  padding: 12px 16px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 13px;
  border-bottom: 1.5px solid var(--border);
}

.notif-item {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s ease;
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: var(--teal-soft); }
.notif-item-time { font-size: 11px; color: var(--text-faint); margin-top: 3px; }

/* ---------------------------------------------------------------------- */
/* Stats bar                                                              */
/* ---------------------------------------------------------------------- */

.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  padding: 12px 28px;
  border-bottom: 1.5px solid var(--border);
  background: var(--bg-elevated);
}
/* Overview-only — JS still updates the values inside while hidden elsewhere,
   see switchSection() in js/dashboard.js. */
.stats-bar[hidden] { display: none; }
.stats-bar-item {
  flex: 1;
  min-width: 130px;
  padding: 4px 18px;
  border-right: 1px solid var(--border);
}
.stats-bar-item:last-child { border-right: none; }
.stats-bar-label { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); margin-bottom: 3px; }
.stats-bar-value { font-family: 'Nunito', sans-serif; font-size: 17px; font-weight: 900; color: var(--text); }
.stats-bar-value.is-alert { color: var(--danger); }

.sidebar-backdrop { display: none; }

/* ---------------------------------------------------------------------- */
/* Filter bar (Staff search/filter)                                       */
/* ---------------------------------------------------------------------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.filter-bar input[type="text"] { flex: 2; min-width: 180px; }
.filter-bar select { flex: 1; min-width: 140px; }
.filter-bar .filter-field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 140px; }
.filter-bar .filter-field select, .filter-bar .filter-field input { width: 100%; }

/* ---------------------------------------------------------------------- */
/* Onboarding wizard                                                      */
/* ---------------------------------------------------------------------- */

.onboarding-card { margin-bottom: 20px; border-color: var(--teal); }
.onboarding-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.onboarding-step:last-child { border-bottom: none; }
.onboarding-step-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border: 2px solid var(--border-strong);
  color: var(--text-faint);
}
.onboarding-step.done .onboarding-step-icon { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.onboarding-step-label { flex: 1; font-weight: 700; font-size: 14px; }
.onboarding-step.done .onboarding-step-label { color: var(--text-dim); text-decoration: line-through; }

.content {
  flex: 1;
  padding: 26px 28px 60px;
  max-width: 1100px;
  width: 100%;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-raised);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 14px 12px;
  text-align: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.stat-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.stat-label { font-size: 11.5px; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.stat-value { font-family: 'Nunito', sans-serif; font-size: 26px; font-weight: 900; color: var(--accent-2); }
.station-guard { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 15px; margin: 4px 0 2px; }

.section { display: none; }
.section.active { display: block; }

.section-title { font-size: 21px; margin-bottom: 4px; }
.section-subtitle { font-size: 13.5px; color: var(--text-dim); margin-bottom: 22px; }

.stack { display: flex; flex-direction: column; gap: 20px; }

/* .stack/.card/.btn/.field all set their own `display`, which — being an
   author-stylesheet rule — beats the UA default `[hidden] { display:
   none }` at equal specificity. That let #shift-list-view (a .stack)
   stay visible under the grid despite its hidden attribute. Scoped fix,
   not a global [hidden] rule or !important, so nothing else about how
   these classes render changes. */
.stack[hidden], .card[hidden], .btn[hidden], .field[hidden] { display: none; }

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(6, 35, 30, 0.35);
  border-top-color: #06231e;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
  .hamburger-btn { display: flex; align-items: center; justify-content: center; }

  .sidebar {
    position: fixed;
    inset: 0 20% 0 0;
    z-index: 210;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 16px 0 48px rgba(0, 0, 0, 0.45);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(6, 17, 28, 0.6);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }
  .sidebar-backdrop.open { opacity: 1; visibility: visible; }

  .topbar { padding: 0 14px; }
  .stats-bar { padding: 10px 14px; }
  .stats-bar-item { min-width: 44%; border-right: none; padding: 4px 8px; }
  .content { padding: 20px 16px 48px; }
  .notif-dropdown { width: min(320px, 88vw); right: -8px; }

  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; }
  .filter-bar input, .filter-bar select { width: 100%; }

  /* Tables become stacked cards. Each <td> gets a data-label attribute
     (set at runtime by enableResponsiveTables() in dashboard.js) so its
     column header can still show via ::before without repeating markup
     for every table in the app. */
  .table-wrap { border: none; overflow-x: visible; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tr {
    background: var(--bg-raised);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 10px;
  }
  .table-wrap td {
    border: none;
    padding: 7px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    text-align: right;
  }
  .table-wrap td:not(:last-child) { border-bottom: 1px solid var(--border); }
  .table-wrap td::before {
    content: attr(data-label);
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-faint);
    text-align: left;
    flex-shrink: 0;
  }
}

/* ---------------------------------------------------------------------- */
/* Weather widget                                                         */
/* ---------------------------------------------------------------------- */

.weather-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
}
.weather-item {
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-align: center;
}
.weather-item-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-faint); margin-bottom: 4px; }
.weather-item-value { font-family: 'Nunito', sans-serif; font-size: 18px; font-weight: 900; }

/* ---------------------------------------------------------------------- */
/* Water Quality Trends (Chart.js)                                        */
/* ---------------------------------------------------------------------- */

.chart-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.chart-box {
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  height: 220px;
  position: relative;
}
@media (max-width: 900px) {
  .chart-row { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------------- */
/* Compliance Calendar                                                    */
/* ---------------------------------------------------------------------- */

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 4px;
}
.calendar-daylabel { text-align: center; font-size: 10.5px; font-weight: 800; text-transform: uppercase; color: var(--text-faint); padding-bottom: 4px; }
.calendar-cell {
  min-height: 74px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  font-size: 11px;
  cursor: default;
}
.calendar-cell.empty { background: transparent; border-color: transparent; }
.calendar-cell-date { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 12px; margin-bottom: 4px; }
.calendar-event {
  display: block;
  border-radius: 5px;
  padding: 2px 5px;
  margin-bottom: 3px;
  font-size: 9.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calendar-event.ev-cert { background: var(--danger-bg); color: var(--danger); }
.calendar-event.ev-maintenance { background: var(--amber-bg); color: var(--amber); }
.calendar-event.ev-rental { background: rgba(0, 153, 230, 0.14); color: var(--blue); }
.calendar-event.ev-inspection { background: var(--success-bg); color: var(--teal); }

@media (max-width: 640px) {
  .calendar-grid { grid-template-columns: repeat(7, minmax(36px, 1fr)); }
  .calendar-cell { min-height: 54px; padding: 4px; font-size: 9px; }
  .calendar-event { font-size: 8px; }
}

/* ---------------------------------------------------------------------- */
/* Print reports                                                          */
/* ---------------------------------------------------------------------- */

#print-view { display: none; }

@media print {
  @page {
    margin: 0.6in 0.5in 0.7in;
  }
  @page {
    @bottom-center { content: "Page " counter(page) " of " counter(pages); font-size: 9px; color: #666; }
  }

  body * { visibility: hidden; }
  #print-view, #print-view * { visibility: visible; }
  .no-print { display: none !important; }
  #print-view {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: #fff;
    color: #111;
    padding: 0;
  }
  .print-header {
    border-bottom: 2px solid #111;
    padding-bottom: 12px;
    margin-bottom: 18px;
  }
  .print-header-brand { font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 20px; color: #111; }
  #print-header-facility { font-weight: 700; font-size: 14px; margin-top: 4px; }
  #print-header-title { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 16px; margin-top: 8px; }
  #print-header-date { font-size: 11px; color: #555; margin-top: 2px; }
  #print-view table { width: 100%; border-collapse: collapse; margin-top: 10px; }
  #print-view th, #print-view td { border: 1px solid #999; padding: 6px 8px; text-align: left; font-size: 11px; color: #111; }
  #print-view th { background: #eee; }
  #print-view p { color: #111; font-size: 12px; margin: 4px 0; }
  #print-view thead { display: table-header-group; } /* repeat column headers on each page */
  #print-view tr { break-inside: avoid; }

  /* Utility classes report-composing JS can apply between logical
     sections of a multi-part report (e.g. staff roster with certs,
     payroll), so a table or block never splits awkwardly across pages. */
  .print-section { break-inside: avoid; margin-bottom: 20px; }
  .print-page-break { break-before: page; }
}

/* ---------------------------------------------------------------------- */
/* Rotation Timer                                                         */
/* ---------------------------------------------------------------------- */

.timer-card {
  text-align: center;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--teal-soft), rgba(0, 153, 230, 0.06));
  border-color: var(--teal);
}
.timer-display {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  font-size: 52px;
  color: var(--blue);
  line-height: 1;
  margin: 6px 0 4px;
}
.timer-display.is-urgent { color: var(--amber); }
.timer-sub { font-size: 12.5px; color: var(--text-dim); }
.timer-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.timer-controls select { width: auto; }

/* ---------------------------------------------------------------------- */
/* Facility Map                                                           */
/* ---------------------------------------------------------------------- */

.facmap-canvas-wrap { width: 100%; }
.facmap-canvas {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  background-size: cover;
  background-position: center;
  background-color: var(--bg-elevated);
  border: 1.5px solid var(--border);
  overflow: hidden;
  touch-action: none;
}
.facmap-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.facmap-pin:active { cursor: grabbing; }
.facmap-pin-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  border: 2.5px solid #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 12px;
  color: var(--on-accent);
  flex-shrink: 0;
}
.facmap-pin-dot.unassigned { background: var(--bg-elevated); border-color: var(--border-strong); }
.facmap-pin-dot.mine { box-shadow: 0 0 0 4px rgba(0, 201, 167, 0.35), 0 3px 10px rgba(0, 0, 0, 0.4); border-color: var(--teal); }
.facmap-canvas.readonly .facmap-pin { cursor: default; }
.facmap-pin-label {
  background: var(--bg-translucent);
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
}
