/* DriveM8 — theme-aware styling
   Palette ported from the LogicM8 design-system conventions
   (brand red as a sparing accent, neutral slate seed, Segoe UI stack). */

:root {
  --brand-red: #E30613;
  --brand-red-hover: #c8050f;
  --neutral-seed: #3A3D42;

  --dark-bg: #0C0C0E;
  --dark-panel: #1A1A1D;
  --light-bg: #EDEDEF;
  --light-surface: #E2E2E6;

  color-scheme: light dark;
  --bg: var(--light-bg);
  --surface: var(--light-surface);
  --panel: #FFFFFF;
  --text-primary: #1A1A1D;
  --text-secondary: #55585E;
  --text-faint: #8A8D93;
  --divider: rgba(0, 0, 0, 0.08);
  --cell-border: rgba(0, 0, 0, 0.06);
  --badge-neutral: #E4E4E7;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05);
  --off-shift-text: #B4B6BB;
}

[data-theme="dark"] {
  --bg: var(--dark-bg);
  --surface: var(--dark-panel);
  --panel: #1F1F23;
  --text-primary: #F2F2F3;
  --text-secondary: #B7B9BD;
  --text-faint: #7A7C81;
  --divider: rgba(255, 255, 255, 0.08);
  --cell-border: rgba(255, 255, 255, 0.06);
  --badge-neutral: #2A2A2E;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  --off-shift-text: #55585E;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--dark-bg);
    --surface: var(--dark-panel);
    --panel: #1F1F23;
    --text-primary: #F2F2F3;
    --text-secondary: #B7B9BD;
    --text-faint: #7A7C81;
    --divider: rgba(255, 255, 255, 0.08);
    --cell-border: rgba(255, 255, 255, 0.06);
    --badge-neutral: #2A2A2E;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --off-shift-text: #55585E;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, "Roboto", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ---------- Header ---------- */

header.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.2px;
}

.brand .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-red);
  flex: none;
}

/* "M8" picked out in red across every "DriveM8" wordmark (topbar .brand +
   the login/loading/unlock .login-brand instances) — a small brand touch
   requested 2026-08-16. */
.brand-m8 {
  color: var(--brand-red);
}

.theme-toggle {
  border: none;
  background: var(--badge-neutral);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.15s ease;
}
.theme-toggle:active { transform: scale(0.96); }

/* Wraps the edit-duty pencil + settings gear icon buttons together at the
   right of the topbar (added 2026-08-17 alongside the manual duty-edit
   feature — see editDutyOverlay in index.html) — was just the single
   settings button before, so this replaces that bare button with a small
   group. */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.week-label {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ---------- Login screen ---------- */

.login-app {
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-wrap {
  width: 100%;
  max-width: 360px;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  font-size: 22px;
  margin-bottom: 8px;
}

.login-sub {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13.5px;
  margin-bottom: 26px;
  line-height: 1.5;
}

.login-error {
  display: none;
  background: rgba(227, 6, 19, 0.12);
  border: 1px solid rgba(227, 6, 19, 0.35);
  color: var(--brand-red);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}
.login-error.visible { display: block; }

.field-group { margin-bottom: 16px; }

.field-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.duty-zero-hint { color: var(--text-faint); font-size: 11px; font-weight: 600; }

.field-group input,
.field-group select {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--divider);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text-primary);
  font-family: inherit;
}
.field-group input:focus,
.field-group select:focus { outline: none; border-color: var(--brand-red); }

/* The primary choices in the duty-edit sheet are deliberately easy to spot. */
#editDutyDaySelect,
#editDutyNumberInput { border-color: var(--brand-red); }

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 22px;
}
.remember-row input { width: 16px; height: 16px; flex: none; }

.btn-primary {
  background: var(--brand-red);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 13px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary.full { width: 100%; }
.btn-primary:active { transform: scale(0.98); }

.login-note {
  margin-top: 22px;
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.6;
}

.login-note a {
  color: var(--brand-red);
  font-weight: 600;
  text-decoration: none;
}
.login-note a:active { opacity: 0.7; }

.link-btn {
  display: block;
  width: 100%;
  margin-top: 20px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- Settings panel ---------- */

.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.settings-overlay.visible { opacity: 1; pointer-events: auto; }

.settings-panel {
  width: 100%;
  max-width: 480px;
  background: var(--panel);
  border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow);
  transform: translateY(100%);
  transition: transform 0.2s ease;
}
.settings-overlay.visible .settings-panel { transform: translateY(0); }

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
}

.settings-close {
  border: none;
  background: var(--badge-neutral);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
}

.settings-section { margin-bottom: 22px; }
.settings-section:last-child { margin-bottom: 4px; }

.settings-label {
  font-size: 12px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 10px;
}

.theme-options { display: flex; gap: 8px; }

.theme-option {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--divider);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.theme-option.active {
  background: var(--brand-red);
  border-color: var(--brand-red);
  color: #fff;
}

.btn-logout {
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  border: 1px solid var(--divider);
  background: transparent;
  color: var(--brand-red);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
}

/* ---------- Summary card ---------- */

.summary-card {
  margin: 8px 16px 4px;
  padding: 9px 14px;
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  border: 1px solid var(--divider);
}

.summary-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.summary-top .avatar-lg {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--neutral-seed);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.summary-name { font-size: 16px; font-weight: 600; }
.summary-role { font-size: 13px; color: var(--text-secondary); }

/* Compact variant (2026-08-16): identity + stats in one row instead of a
   stacked block with a divider, so the summary card takes up much less
   vertical space and more of the week list fits on screen at once. */
.summary-top.compact .avatar-lg {
  width: 24px;
  height: 24px;
  font-size: 10px;
}

.summary-id { flex: 1; min-width: 0; }
.summary-top.compact .summary-name {
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.summary-top.compact .summary-num {
  font-weight: 400;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Days/hours as its own row under the identity row (2026-08-16, replacing
   the earlier side-by-side layout). */
.summary-stats-row {
  margin-top: 6px;
  padding-left: 34px; /* lines up under the name, past the 24px avatar */
  font-size: 11.5px;
  color: var(--text-secondary);
}
.summary-stats-row .stat-num {
  font-weight: 700;
  color: var(--brand-red);
  font-size: 12.5px;
}

.summary-stats {
  display: flex;
  gap: 20px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--divider);
}

.stat .stat-value { font-size: 18px; font-weight: 700; color: var(--brand-red); }
.stat .stat-label { font-size: 11px; color: var(--text-faint); margin-top: 2px; }

/* ---------- Day list ---------- */

.day-list {
  padding: 6px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.day-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--cell-border);
}

.day-row.today {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 1px var(--brand-red);
}

.day-row.off {
  opacity: 0.72;
}

/* Manual duty-override highlight (added 2026-08-17) — a driver-entered
   change to their own duty, not yet reviewed by admin (see
   dutyOverrides.js / the "Edited" badge below). A soft amber wash rather
   than a border, deliberately, so it composes cleanly with .day-row.today
   (a red border) if a day happens to be both — Darren specifically asked
   for this to be an obvious highlight, not just a small badge easy to
   miss on a quick glance. */
.day-row.overridden {
  background: rgba(217, 119, 6, 0.12);
}

/* Once an admin has concurred a driver edit, keep it easy to spot without
   leaving it looking like an unresolved warning: amber outline only. */
.day-row.overridden.override-concurred {
  background: var(--panel);
  border-color: #D97706;
  box-shadow: 0 0 0 1px #D97706;
}

/* Unresolved-duty highlight (added 2026-08-25, generalising the
   bank-holiday notice) — the roster assigns this driver a real duty for
   the day but the app couldn't find its details; a genuine data gap the
   office needs to confirm, not a day off. A soft red wash (distinct from
   the amber "Edited" wash above) so it reads as needing attention. */
.day-row.duty-unresolved {
  background: rgba(220, 38, 38, 0.1);
}

.day-marker {
  width: 36px;
  flex: none;
  text-align: center;
}

.day-marker .dow {
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.day-marker .dnum {
  font-size: 15px;
  font-weight: 700;
  margin-top: 1px;
}

.day-row.today .dnum { color: var(--brand-red); }

.day-body { flex: 1; min-width: 0; }

.day-body .shift-time {
  font-size: 13.5px;
  font-weight: 600;
}

.day-body .shift-note {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-body .shift-duty {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 1px;
}

.day-body .off-label {
  font-size: 12.5px;
  color: var(--off-shift-text);
}

/* Holds badge-today and/or badge-edited (added 2026-08-17) at the right
   of a day-row — was a single bare badge span before, now a small stack
   so both can show together (an edited day can also be today). */
.day-row-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex: none;
}

.badge-today {
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  background: var(--brand-red);
  padding: 2px 7px;
  border-radius: 999px;
  flex: none;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Manual duty-override badge — same shape as badge-today, amber instead
   of red so it reads as "flagged for review" rather than reusing the
   brand-red accent, which is already spoken for elsewhere (errors, the
   Today badge, active states). Matches .day-row.overridden's wash. */
.badge-edited {
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  background: #D97706;
  padding: 2px 7px;
  border-radius: 999px;
  flex: none;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  position: relative;
}

.badge-approved-tick,
.edit-duty-approved-tick {
  align-items: center;
  background: #16A34A;
  border: 2px solid var(--panel);
  border-radius: 999px;
  box-sizing: border-box;
  color: #fff;
  display: inline-flex;
  font-size: 10px;
  font-weight: 900;
  height: 17px;
  justify-content: center;
  line-height: 1;
  min-width: 17px;
}

.badge-approved-tick {
  position: absolute;
  right: -8px;
  top: -8px;
}

.edit-duty-approved-tick {
  margin-left: 5px;
  vertical-align: middle;
}

/* Bank holiday badge (added 2026-08-25) — a slate/blue tone, distinct
   from the red "Today" badge and the amber "Edited" one, since this
   isn't flagging a problem, just a known public holiday. Shown on both
   a rostered-off bank holiday ("BH" row text) and a rostered-to-work one
   (the "confirm with the office" notice) — see app.js's dayRowSubtitle. */
.badge-bank-holiday {
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  background: #475569;
  padding: 2px 7px;
  border-radius: 999px;
  flex: none;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Unresolved-duty badge (added 2026-08-25) — a red tone (distinct from
   brand-red so it doesn't get lost against the "Today" badge if a day
   happens to be both), since this genuinely does need the driver/office
   to sort it out, unlike the neutral bank-holiday badge above. Matches
   .day-row.duty-unresolved's wash. */
.badge-unresolved {
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  background: #DC2626;
  padding: 2px 7px;
  border-radius: 999px;
  flex: none;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ---------- My notes floating button ---------- */
/* Added 2026-08-17, redesigned the same day per Darren's request — a
   fixed icon button in the bottom-right corner, opening the
   notesOverlay panel below. Deliberately matches the same look as the
   topbar's .theme-toggle icon buttons (settings gear / edit-duty
   pencil) — badge-neutral background, rounded-square shape — just
   larger and elevated with a shadow since it floats over page content
   rather than sitting inline in the topbar. Fixed positioning (not
   sticky-in-flow) so it's reachable from anywhere in the day list
   without scrolling back down to a footer row. */
.notes-fab {
  position: fixed;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  z-index: 20;
  border: none;
  background: var(--badge-neutral);
  color: var(--text-secondary);
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 0.15s ease, transform 0.1s ease;
}
.notes-fab:active { transform: scale(0.96); }

/* ---------- My notes panel ---------- */
/* Bottom-sheet, same pattern as settings-panel/edit-duty-panel. Taller
   than those two (this is meant for actually writing in) — see
   .notes-panel below overriding the shared .settings-panel sizing. */
.notes-panel {
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.notes-intro {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 12px;
}

.notes-textarea {
  width: 100%;
  min-height: 40vh;
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 12px;
  padding: 14px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text-primary);
  font-family: inherit;
  resize: vertical;
}
.notes-textarea:focus { outline: none; border-color: var(--brand-red); }

.notes-save-status {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--text-faint);
  text-align: right;
  min-height: 14px;
}

/* ---------- Footer / install hint ---------- */

.footer-note {
  margin: 4px 16px 20px;
  font-size: 11.5px;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.5;
}

.app-footer {
  display: block;
  margin: 10px 16px 20px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.app-footer:active { opacity: 0.7; }

.footer-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: block;
  margin: 0 auto;
}

.footer-by {
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-faint);
}

.install-banner {
  margin: 4px 16px 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--divider);
  font-size: 12.5px;
  color: var(--text-secondary);
  display: none;
  align-items: center;
  gap: 10px;
}

.install-banner.visible { display: flex; }

.install-banner .icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--brand-red);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
}

/* ---------- Loading splash ---------- */

#loadingScreen .login-brand { opacity: 0.8; }

/* ---------- Week nav ---------- */

.week-nav {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.week-nav-btn {
  border: 1.5px solid rgba(227, 6, 19, 0.35);
  background: rgba(227, 6, 19, 0.10);
  color: var(--brand-red);
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  flex: none;
  transition: background 0.15s ease, transform 0.1s ease;
}
.week-nav-btn:active {
  transform: scale(0.92);
  background: rgba(227, 6, 19, 0.2);
}

.week-nav .week-label {
  margin-top: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  flex: 1;
  white-space: normal;
}

/* The "[ Week N ]" ref — a separate styled badge rather than plain text
   tacked on to the date range, so it's actually noticeable at a glance
   instead of blending into the surrounding date text. */
.week-number-badge {
  display: inline-block;
  margin-left: 2px;
  padding: 2px 6px;
  border: 1px solid rgba(227, 6, 19, 0.42);
  border-radius: 5px;
  background: transparent;
  color: var(--brand-red);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}
.week-number-badge:active { transform: scale(0.97); }
.week-number-badge:hover { background: rgba(227, 6, 19, 0.07); }

/* ---------- Empty / status note (day list, day detail) ---------- */

.empty-note {
  font-size: 13px;
  color: var(--text-faint);
  padding: 14px 4px;
  text-align: center;
}

.summary-card.loading { opacity: 0.6; }

/* ---------- Pending week (swiped to a week with no roster uploaded yet) ---------- */
/* Shown in place of the normal 7 day rows when every day in the week comes
   back from getDutyForDate with the "No roster covers this date" error —
   i.e. the roster file for that week genuinely hasn't been uploaded at all
   yet, as opposed to this driver simply having no entry in a roster that
   does exist (see weekIsPending in app.js). Dashed border deliberately
   distinguishes this from the solid-bordered cards used elsewhere, to read
   as "nothing here yet" rather than an error state. */
.pending-week-banner {
  margin: 4px 4px 0;
  padding: 26px 18px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px dashed var(--divider);
  text-align: center;
}

.pending-week-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* Used for the "roster exists but you're not linked into it" case — a data
   gap the driver should flag, so the heading is red rather than the
   neutral grey used for "nothing uploaded yet". */
.pending-week-title.alert {
  color: var(--brand-red);
}

.pending-week-sub {
  font-size: 12.5px;
  color: var(--text-faint);
  line-height: 1.5;
  max-width: 46ch;
  margin: 0 auto;
}

/* ---------- Manual duty-override notice (day detail panel) ---------- */
/* Shown inside openDayDetail (app.js) when a day carries a driver-entered
   override (added 2026-08-17) — same amber tone as .day-row.overridden/
   .badge-edited above, for a consistent "this needs review" signal
   wherever it shows up. */
.edit-duty-notice {
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(217, 119, 6, 0.12);
  border: 1px solid rgba(217, 119, 6, 0.35);
  color: #B45F04;
  font-size: 12.5px;
  line-height: 1.5;
}
.edit-duty-notice.concurred {
  background: transparent;
  border-color: #D97706;
  color: #A65B08;
}
[data-theme="dark"] .edit-duty-notice { color: #F0A94E; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .edit-duty-notice { color: #F0A94E; }
}

/* ---------- Edit duty panel (manual override) ---------- */
/* Bottom-sheet panel opened from the topbar pencil icon — see
   editDutyOverlay in index.html and the "Edit duty" section of app.js.
   Reuses .settings-panel/.settings-header/.field-group/.btn-primary/
   .link-btn from elsewhere in this file; these are just the pieces
   specific to this panel. */

.edit-duty-intro {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 18px;
}

.edit-duty-error {
  display: none;
  background: rgba(227, 6, 19, 0.12);
  border: 1px solid rgba(227, 6, 19, 0.35);
  color: var(--brand-red);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}
.edit-duty-error.visible { display: block; }

.edit-duty-preview {
  margin: -6px 0 18px;
  min-height: 0;
}

.edit-duty-preview-loading {
  font-size: 12.5px;
  color: var(--text-faint);
  padding: 4px 2px;
}

.edit-duty-preview-card {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--divider);
}

.edit-duty-preview-head {
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 4px;
}

.edit-duty-preview-times {
  font-size: 13px;
  color: var(--text-secondary);
}

.edit-duty-preview-route {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 4px;
}

.edit-duty-clear {
  color: var(--brand-red);
}

/* The less-common day options and split-duty flow share one calm action row. */
.duty-edit-options { align-items: center; display: flex; justify-content: space-between; margin: -6px 0 15px; }
.split-duty-toggle { margin: 0; }
.split-duty-builder { background: var(--surface); border: 1px solid var(--divider); border-radius: 10px; margin: -2px 0 16px; padding: 12px; }
.split-duty-copy { color: var(--text-secondary); font-size: 12px; line-height: 1.4; margin: 0 0 10px; }
.split-duty-source { display: grid; gap: 7px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); margin-top: 9px; }
.split-duty-source-title { align-self: center; color: var(--text-primary); font-size: 12px; font-weight: 700; grid-column: 1 / -1; }
.split-duty-source input, .split-duty-source select { box-sizing: border-box; min-width: 0; width: 100%; }

.manual-day-menu-overlay { align-items: center; padding: 16px; z-index: 70; }
.manual-day-menu-panel { border-radius: 14px; max-width: 340px; transform: scale(.96); }
.settings-overlay.visible .manual-day-menu-panel { transform: scale(1); }
.manual-day-options { display: grid; gap: 8px; padding: 4px 0 2px; }
.manual-day-option { align-items: center; background: var(--surface); border: 1px solid var(--divider); border-radius: 10px; color: var(--text-primary); cursor: pointer; display: flex; font: inherit; gap: 11px; padding: 13px; text-align: left; }
.manual-day-option:hover { border-color: var(--brand-red); }
.manual-day-option strong { color: var(--brand-red); font-size: 14px; min-width: 24px; }
.manual-day-option span { font-size: 13px; font-weight: 650; }
.manual-day-trigger { background: transparent; border: 1px solid var(--brand-red); border-radius: 7px; color: var(--brand-red); cursor: pointer; display: block; font: 600 12px inherit; margin: 0; padding: 7px 10px; }
.manual-day-trigger:hover, .manual-day-trigger.selected { background: rgba(227, 6, 19, 0.06); }

/* ---------- Toast (new week uploaded) ---------- */
/* Small, self-dismissing pop-up shown by app.js's showToast() — used for
   the "[ Week N ] now uploaded" notice (see noteWeekAvailable). Fixed near
   the top of the viewport (moved up from the bottom 2026-08-17 — easy to
   miss down there) so it works the same regardless of which screen/overlay
   is on top; positioned below header.topbar (sticky, ~48px + safe-area-
   inset-top tall) rather than flush at the very top, so it doesn't overlap
   the logo/settings gear; z-index above every overlay in this file. */
.toast {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top) + 64px);
  transform: translate(-50%, -12px);
  background: var(--surface);
  border: 1px solid var(--divider);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 80;
  max-width: 86vw;
  text-align: center;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Day detail panel ---------- */

.day-detail-panel { max-height: 82vh; overflow-y: auto; }

.day-detail-duty-head {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.part-card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.part-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--divider);
}

.part-card-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.part-card-board {
  font-weight: 700;
  font-size: 14px;
  color: var(--brand-red);
}

.part-card-route {
  font-size: 12.5px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-label {
  font-size: 0.75em;
  color: var(--text-faint);
}

/* Back to the original 2x2 grid (2026-08-16 — tried a single vertical
   sequence for the stop_on/stop_off locations, reverted: the grid is
   faster to scan at a glance). The stop location now nests inside its
   related cell instead (.stop-inline, below) — stop_on under Sign on,
   stop_off under Time off — rather than being its own row. */
.part-card-times {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  font-size: 13.5px;
  font-weight: 600;
}

.part-card-times .part-label {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}

/* The stop_on/stop_off location, nested under its Sign on / Time off
   value — solid grey, no bold/caps, so it doesn't compete with the time
   itself but is still clearly readable. */
.stop-inline {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 2px;
}

.part-card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

/* Deliberately understated (2026-08-16, per Darren's request) — an
   outlined pill in the bottom-right corner rather than a full-width solid
   button, so it reads as a secondary action rather than competing with
   the duty times for attention. */
.board-view-btn {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--brand-red);
  background: transparent;
  color: var(--brand-red);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.board-view-btn:active { background: rgba(227, 6, 19, 0.1); }

/* ---------- Break row (between a duty's parts) ---------- */

.break-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 4px 2px;
}

.break-line {
  flex: 1;
  height: 2px;
  border-radius: 999px;
  background: rgba(227, 6, 19, 0.25);
}

/* A small pill badge (2026-08-16, up from plain faint text) so this reads
   clearly as its own row at a glance instead of blending in between the
   two bolder part-cards on either side of it — bumped up further
   (shaded flanking lines, larger label) per Darren's follow-up. */
.break-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--badge-neutral);
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
  flex: none;
}

/* ---------- Board view ---------- */

.board-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 60;
  display: none;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.board-overlay.visible { display: flex; opacity: 1; }

.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 14px) 16px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
}

.board-title {
  font-size: 15px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Shown (2026-08-25) when the board viewer can't find an archived PDF for
   the exact schedule version being viewed and had to fall back to the
   most-recently-uploaded boards file instead -- see app.js's openBoardView.
   A silent fallback here previously left a driver looking at a completely
   different schedule's board with no indication anything was off (found
   in live testing 2026-08-25). */
.board-warning {
  background: #4A3300;
  color: #FFD780;
  font-size: 12px;
  line-height: 1.4;
  padding: 8px 16px;
  border-bottom: 1px solid var(--divider);
}

.board-canvas-wrap {
  flex: 1;
  position: relative;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: #0C0C0E;
  padding: 12px;
}

.board-status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #B7B9BD;
  font-size: 13px;
}

.board-canvas-wrap canvas {
  display: none;
  max-width: 100%;
  border-radius: 4px;
}

#boardBaseCanvas {
  position: relative;
}

#boardOverlayCanvas {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.board-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--divider);
}

.board-nav-btn {
  border: 1px solid var(--divider);
  background: var(--panel);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.board-nav-btn:disabled { opacity: 0.4; cursor: default; }

.board-page-indicator {
  font-size: 12.5px;
  color: var(--text-secondary);
}
