/* ── Brand typeface — used in the header to render the company name
   in the official Edwardian Script logotype instead of a low-res image. */
@font-face {
  font-family: 'Edwardian Script ITC';
  src: url('../assets/fonts/EdwardianScriptITC.ttf') format('truetype');
  /* This TTF ships a Regular weight ONLY (OS/2 usWeightClass 400, no bold
     bit set, subfamily "Regular") and there is no separate bold TTF in
     assets. Do NOT apply font-weight:bold to the logotype — the browser
     would synthesize a faux-bold, which looks bad on a thin script face.
     Declared normal explicitly so the logo always renders the real glyphs. */
  font-weight: normal;
  font-display: swap;
}
/* ── Brand variables (from docs/DESIGN_SPEC.md) ───────────────────────── */
:root {
  --crimson:      #8C0930;
  --crimson-dark: #6B0724;
  --navy:         #1E3A5F;
  --info-blue:    #1D4ED8;
  --off-white:    #F9F7F5;
  --light-gray:   #F3F4F6;
  --mid-gray:     #9CA3AF;
  --dark-gray:    #374151;
  --border:       #E5E7EB;
  --success:      #15803D;
  --error:        #DC2626;
  --warning-bg:   #FEFCE8;
  --warning-bd:   #CA8A04;
}

/* ── Reset / base ─────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: Arial, sans-serif;
  background: var(--off-white);
  color: var(--dark-gray);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}
body { min-height: 100vh; padding-bottom: 40px; }

/* ── Header ───────────────────────────────────────────────────────────── */
header {
  background: var(--crimson);
  color: white;
  padding: 18px 20px;
}
.header-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
/* Brand + console-label lockup: [hamburger] Preferred Services | Driver Console */
.header-lockup {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}
.header-divider {
  width: 1px;
  height: 30px;
  background: rgba(255, 255, 255, 0.45);
  margin: 0 16px;
  flex: 0 0 auto;
}
.header-title {
  font-size: 14px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: white;
  opacity: 0.92;
  white-space: nowrap;
  flex: 0 0 auto;
}
/* Option B: account circle + Call # on a single top-right row, Call # to the
   left of the circle. */
.header-right {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  margin-left: 12px;
}
/* Re-anchor the shared PSAuth account control once relocated into the header:
   position:relative so its dropdown menu anchors to the avatar (and drop the
   injected fixed offsets). Higher specificity than `#psauth-userbar{fixed}`. */
.header-right #psauth-userbar {
  position: relative;
  top: auto;
  right: auto;
}
.header-right .call-badge { margin-left: 0; }
.header-brand {
  font-family: 'Edwardian Script ITC', 'Apple Chancery', cursive;
  font-size: 40px;  /* +10% from 36px */
  line-height: 1;
  color: white;
  /* Edwardian Script has very thin strokes — a small text-shadow gives
     the strokes enough weight to read against the crimson background
     without darkening the letterforms themselves. */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Edwardian Script's final "s" flourish overhangs the text box; with
     overflow:hidden it clips. Right padding gives the glyph room (and nudges
     the divider/console label over). */
  padding-right: 12px;
  flex: 0 1 auto;
  min-width: 0;
}
.call-badge {
  font-size: 13px;
  color: white;
  white-space: nowrap;
  flex: 0 0 auto;
  margin-left: 12px;
}
@media (max-width: 600px) {
  .header-brand { font-size: 29px; }  /* +10% from 26px */
  /* Tight phone widths: drop the divider + console label so the wordmark and
     account circle don't collide. */
  .header-divider, .header-title { display: none; }
}

/* ── Main container ───────────────────────────────────────────────────── */
main {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 0;
  will-change: scroll-position;
  transform: translateZ(0);
}

/* ── States: loading / error / confirmation ───────────────────────────── */
.state-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 32px 20px;
  margin-top: 16px;
  text-align: center;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--light-gray);
  border-top-color: var(--crimson);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.state-text { font-size: 15px; color: var(--dark-gray); margin: 0; }
.state-error-headline {
  color: var(--error);
  font-weight: bold;
  font-size: 16px;
  margin: 0 0 6px;
}
/* Closed-call card: btn-secondary is a flex-row button elsewhere; as an
   inline anchor on a state-card it needs its own box model. */
#closedCallView .state-text { margin-top: 8px; }
#closedCallView .btn-secondary {
  display: inline-block;
  flex: none;
  padding: 0 24px;
  margin-top: 8px;
}

/* ── Section card ─────────────────────────────────────────────────────── */
.section {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.section-label {
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--mid-gray);
  margin: 0 0 8px;
}

/* ── Dispatch summary (read-only) ─────────────────────────────────────── */
.summary-name {
  font-size: 18px;
  font-weight: bold;
  color: var(--dark-gray);
  margin: 4px 0;
}
/* ── Inline decedent-name edit ────────────────────────────────────────
   Display state: name + a quiet self-labeling "Edit" pill (matches the
   app's pill idiom — draft indicator, pickup badge). Edit state: bold
   input with a filled green Save and an outlined Cancel that tints red
   on hover; Save swaps its checkmark for a spinner while in flight. */
.summary-name-row { display: flex; align-items: center; gap: 10px; }
.summary-name-row .summary-name { min-width: 0; overflow-wrap: anywhere; }
.name-edit-trigger {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 5px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--navy);
  font-family: inherit;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease, border-color 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.name-edit-trigger:hover  { border-color: var(--navy); background: #F4F7FB; }
.name-edit-trigger:active { background: #E8EEF6; }

.name-edit-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.name-edit-row:not([hidden]) { animation: name-edit-in 0.16s ease-out; }
@keyframes name-edit-in {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: none; }
}
.name-edit-input { flex: 1 1 auto; min-width: 0; font-weight: bold; font-size: 16px; }
.name-edit-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 44px;                /* matches the input's touch-target height */
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.name-edit-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.name-edit-btn--save {
  background: var(--success);
  border: 1px solid var(--success);
  color: #fff;
}
.name-edit-btn--save:hover:not(:disabled)  { background: #116A33; border-color: #116A33; }
.name-edit-btn--save:active:not(:disabled) { background: #0E5A2B; }
.name-edit-btn--cancel {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--dark-gray);
}
.name-edit-btn--cancel:hover:not(:disabled)  { border-color: var(--error); color: var(--error); background: #FEF2F2; }
.name-edit-btn--cancel:active:not(:disabled) { background: #FEE2E2; }
.name-edit-trigger:focus-visible,
.name-edit-btn:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
/* Saving: the checkmark yields to a spinner (is-busy set by setNameEditBusy) */
.name-edit-btn__spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.name-edit-btn--save.is-busy .name-edit-btn__icon    { display: none; }
.name-edit-btn--save.is-busy .name-edit-btn__spinner { display: block; }
.summary-row {
  font-size: 13px;
  color: var(--dark-gray);
  margin: 4px 0;
}
.summary-row-secondary {
  font-size: 13px;
  color: var(--mid-gray);
  margin: 2px 0;
}
.summary-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}
.pickup-type-badge {
  display: inline-block;
  background: var(--navy);
  color: white;
  font-size: 11px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}
.pickup-location {
  font-size: 16px;
  font-weight: bold;
  color: var(--dark-gray);
  margin: 6px 0 4px;
}
.pickup-detail {
  font-size: 13px;
  color: #6B7280;
  font-style: italic;
  margin: 0 0 6px;
  display: none;
}
.maps-link {
  color: var(--navy);
  text-decoration: underline;
  font-size: 13px;
}
.summary-meta-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  font-size: 13px;
}
.summary-meta-grid dt {
  color: var(--mid-gray);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1px;
  padding-top: 2px;
}
.summary-meta-grid dd {
  color: var(--dark-gray);
  margin: 0;
}

/* ── Form fields ──────────────────────────────────────────────────────── */
.field {
  margin-bottom: 12px;
}
.field:last-child { margin-bottom: 0; }
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
/* 3-column row used for Decedent Age/Race/Gender. Falls back to a
   single column on viewports too narrow for a 3-wide layout. */
.field-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}
@media (max-width: 520px) {
  .field-row-3 { grid-template-columns: 1fr; }
}
/* Conditional field — smooth fade/slide for Reason for Hold reveal. */
.field-conditional {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease, margin-bottom 0.25s ease;
}
.field-conditional.is-visible {
  max-height: 200px;
  opacity: 1;
  margin-bottom: 12px;
}
label {
  display: block;
  font-size: 12px;
  font-weight: bold;
  color: var(--dark-gray);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
/* Required-field marker. Deliberately UNSCOPED (not `label .req`): the
   signature labels carry inline styles and the marker also has to work
   outside a plain <label>. The dispatcher app scopes this to `label .req`
   and its Transporter 1 asterisk silently renders grey as a result. */
.req { color: var(--error); margin-left: 2px; }
input[type="text"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: Arial, sans-serif;
  color: var(--dark-gray);
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  -webkit-appearance: none;
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%239CA3AF' d='M0 0l6 8 6-8z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  touch-action: manipulation;
}
textarea {
  min-height: 80px;
  resize: vertical;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}
/* Failed-validation state, applied by validateForFinalSubmit alongside the
   inline <p class="signature-error"> message and removed by the live-clear
   listeners. A red border is far easier to spot on an iPad than the small
   red message, and it survives scrolling past the message. */
input.error,
select.error,
textarea.error { border-color: var(--error); }

/* ── Release / signature section ──────────────────────────────────────── */
.release-text {
  font-size: 13px;
  color: var(--dark-gray);
  line-height: 1.5;
  margin: 0 0 14px;
}
/* The signature-pad rules (.signature-wrap / .signature-overlay /
   .signature-actions / .signature-error) moved to shared-web/signature-pad.css
   in Aug 2026 — the Time Off view needs the same pad in the dispatcher app,
   which has no report form. That file is loaded BEFORE this one, so anything
   here still overrides it. */


.field-note {
  font-size: 12px;
  color: var(--mid-gray);
  margin: 4px 0 6px;
}

/* ── Submit button ────────────────────────────────────────────────────── */
.submit-btn {
  display: block;
  width: 100%;
  height: 52px;
  background: var(--crimson);
  color: white;
  font-size: 16px;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 8px;
  -webkit-appearance: none;
  appearance: none;
}
.submit-btn:active { background: var(--crimson-dark); }
.submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Confirmation card ────────────────────────────────────────────────── */
/* ── Save toast (fixed banner) ────────────────────────────────────────── */
/* Anchored to the viewport (position: fixed) so the driver sees it even
   when scrolled deep in the form. Success auto-dismisses after 4s; error
   stays until the driver dismisses it manually so they can retry. */
.toast {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 14px 56px 14px 20px;
  color: white;
  font-size: 14px;
  font-weight: bold;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  /* High z-index so the toast covers any modal/dropdown/sticky element
     already on the page. Sits as a direct child of <body> (see HTML
     comment) so it anchors to the viewport, not <main>. */
  z-index: 9999;
  display: none;
}
.toast.is-visible { display: block; }
.toast--success { background: var(--success); }
.toast--error   { background: var(--error); }
.toast__close {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  line-height: 1;
  background: transparent;
  border: none;
  color: white;
  font-size: 22px;
  cursor: pointer;
  padding: 0;
}

/* ── Draft-saved-locally indicator ────────────────────────────────────── */
/* Deliberately quiet and distinct from the green "Save successful" toast:
   a small faint pill, top-right, that fades out after ~2s. It marks a
   localStorage auto-save (not a server save), so it must not distract the
   driver mid-form. z-index sits just under the toast. Fixed-position, so
   (like the toast) it lives OUTSIDE <main> to avoid <main>'s translateZ
   containing block. */
.draft-indicator {
  position: fixed;
  top: 10px;
  right: 12px;
  z-index: 9998;
  font-size: 12px;
  color: var(--mid-gray);
  background: rgba(249, 247, 245, 0.94);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.draft-indicator.is-visible { opacity: 1; }

/* ── Required-fields progress chip ────────────────────────────────────── */
/* Live "n of N required" counter for the case report, anchored bottom-right
   so it stays visible through a long form — the sticky <header> auto-hides
   on scroll-DOWN, which is exactly when the driver is working. Tapping it
   jumps to the next incomplete requirement. Fixed-position, so (like the
   toast and the draft indicator) it lives OUTSIDE <main> to avoid <main>'s
   translateZ containing block. z-index sits ABOVE page content but BELOW
   the toast (9999), the PSAuth userbar (9998) / warn bar (9997) and the
   consent gate (9500) — it must never cover any of them. */
.req-progress {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;              /* iPad tap target */
  padding: 8px 16px;
  font-family: Arial, sans-serif;
  font-size: 13px;
  font-weight: bold;
  color: var(--dark-gray);
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--warning-bd);
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
  cursor: pointer;
  touch-action: manipulation;    /* fast repeat taps must not zoom (iPad) */
  -webkit-appearance: none;
  appearance: none;
}
.req-progress[hidden] { display: none; }
.req-progress__chevron { color: var(--warning-bd); font-size: 15px; }
/* All requirements met — the chip stops nagging and becomes a shortcut to
   the Submit Final button. */
.req-progress.is-complete {
  border-color: var(--success);
  color: var(--success);
}
.req-progress.is-complete .req-progress__chevron { color: var(--success); }

/* ── Submit Final Report (generates the case report PDF) ──────────────── */
.submit-final-btn {
  display: block;
  width: 100%;
  height: 52px;
  background: var(--navy);
  color: white;
  font-size: 16px;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 10px;
  -webkit-appearance: none;
  appearance: none;
}
.submit-final-btn:active { background: #16314f; }
.submit-final-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── PDF preview view ─────────────────────────────────────────────────── */
.preview-heading {
  font-size: 18px;
  font-weight: bold;
  color: var(--dark-gray);
  margin: 0 0 4px;
}
.preview-recipient {
  font-size: 14px;
  color: var(--dark-gray);
  margin: 12px 0;
  line-height: 1.5;
}
.preview-recipient strong { color: var(--navy); }
.preview-warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-bd);
  border-radius: 8px;
  color: #854d0e;
  font-size: 13px;
  padding: 12px 14px;
  margin: 12px 0;
  line-height: 1.5;
}
/* ── PDF.js canvas preview ────────────────────────────────────────────── */
/* The viewport clips the canvas; the canvas is positioned (left/top = pan)
   and scaled by PDF.js (re-rendered crisply on zoom). touch-action:none so
   our pinch/pan handlers own the gestures inside the preview. */
.pdf-viewport {
  position: relative;
  width: 100%;
  height: 68vh;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #525659;            /* neutral reader gray behind the page */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.pdf-canvas {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  display: none;                  /* revealed only once page 1 has rendered */
  box-shadow: 0 1px 6px rgba(0,0,0,0.35);
}
.pdf-canvas.is-ready { display: block; }

/* Loader overlay (spinner + progress bar) — covers the viewport until the
   first render resolves, so the driver never sees a blank/half-painted canvas. */
.pdf-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #525659;
  color: white;
  padding: 0 24px;
  text-align: center;
}
.pdf-loader[hidden] { display: none; }
.pdf-progress {
  width: 70%;
  max-width: 260px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.25);
  overflow: hidden;
}
.pdf-progress__bar {
  height: 100%;
  width: 0%;
  background: white;
  border-radius: 999px;
  transition: width 0.2s ease;
}
.pdf-loader__text { font-size: 13px; margin: 0; color: rgba(255,255,255,0.92); }

/* Friendly error fallback (Download PDF below still works). */
.pdf-error {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 28px;
  background: var(--off-white);
  color: var(--dark-gray);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}
.pdf-error[hidden] { display: none; }

/* Zoom controls — secondary to pinch; small floating cluster, bottom-right. */
.pdf-zoom-controls {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 6px;
  background: rgba(255,255,255,0.94);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.pdf-zoom-controls[hidden] { display: none; }
.pdf-zoom-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--navy);
  font-size: 20px;
  font-weight: bold;
  line-height: 1;
  border-radius: 999px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.pdf-zoom-btn:active { background: var(--light-gray); }
.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.btn-secondary {
  flex: 1 1 calc(50% - 5px);
  min-height: 48px;
  background: white;
  color: var(--navy);
  font-size: 15px;
  font-weight: bold;
  border: 1px solid var(--navy);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  line-height: 46px;
  text-decoration: none;
  -webkit-appearance: none;
  appearance: none;
}
.btn-send {
  flex: 1 1 100%;
  min-height: 52px;
  background: var(--crimson);
  color: white;
  font-size: 16px;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.btn-send:active { background: var(--crimson-dark); }
.btn-send:disabled { opacity: 0.6; cursor: not-allowed; }
/* "Submit & Send" uses Preferred Services blue to set it apart from the
   plain crimson Submit. */
.btn-send--blue { background: var(--navy); }
.btn-send--blue:active { background: #15293F; }

/* ── Confirmation view ────────────────────────────────────────────────── */
.confirm-check {
  font-size: 40px;
  color: var(--success);
  margin: 0 0 8px;
}
.confirm-headline {
  font-size: 17px;
  font-weight: bold;
  color: var(--dark-gray);
  margin: 0 0 8px;
}
.confirm-detail {
  font-size: 14px;
  color: var(--dark-gray);
  line-height: 1.5;
  margin: 0 0 14px;
}
.confirm-link {
  display: inline-block;
  color: var(--navy);
  text-decoration: underline;
  font-size: 14px;
  font-weight: bold;
}

/* ── Additional documents (preview picker + confirm upload status) ────── */
.attachments-block {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 14px;
}
.attachments-label {
  font-size: 15px;
  font-weight: bold;
  color: var(--dark-gray);
  margin: 0 0 2px;
}
.attachments-optional {
  font-weight: normal;
  color: #6B7280;
}
.attachments-hint {
  font-size: 13px;
  color: #6B7280;
  margin: 0 0 10px;
  line-height: 1.4;
}
.attachments-add-btn {
  display: block;
  width: 100%;
  flex: none;
}
.attachment-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}
.attachment-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--light-gray);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--dark-gray);
}
.attachment-list .att-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-list .att-size {
  flex: none;
  color: #6B7280;
  font-size: 13px;
}
.att-remove {
  flex: none;
  min-width: 40px;
  min-height: 40px;
  background: none;
  border: none;
  color: var(--error);
  font-size: 20px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.att-status {
  flex: none;
  font-size: 13px;
  font-weight: bold;
}
.att-status--done   { color: var(--success); }
.att-status--failed { color: var(--error); }
.att-spinner {
  flex: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--light-gray);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.att-retry {
  flex: none;
  min-height: 36px;
  padding: 0 12px;
  background: white;
  color: var(--navy);
  font-size: 13px;
  font-weight: bold;
  border: 1px solid var(--navy);
  border-radius: 6px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.confirm-attachments {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 14px;
  text-align: left;
}
.confirm-attachments-headline {
  font-size: 14px;
  font-weight: bold;
  color: var(--dark-gray);
  margin: 0 0 8px;
}
/* Confirm-view rows sit on the white state-card, so give them a border
   instead of relying on the gray fill alone. */
.confirm-attachments .attachment-list li {
  background: white;
  border: 1px solid var(--border);
}

/* ── Footer ──────────────────────────────────────────────────────────── */
footer {
  max-width: 640px;
  margin: 32px auto 0;
  padding: 16px 16px 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: #6B7280;
  font-size: 12px;
  line-height: 1.6;
}
.footer-tagline {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #6B7280;
  margin-bottom: 6px;
}
.footer-line { display: block; }

/* ── Hamburger nav ────────────────────────────────────────────────────── */
/* Sticky header that auto-hides on scroll-DOWN and re-reveals on scroll-UP,
   so the hamburger is always reachable without scrolling back to the top. */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  transition: transform 0.25s ease;
}
header.nav-hidden { transform: translateY(-100%); }
/* header-inner is the positioning context for the dropdown menu so the menu
   anchors under the hamburger icon (header-inner's left edge) and extends
   to the right, rather than to the left of the icon. */
.header-inner { position: relative; }
.nav-toggle {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  margin: -4px 6px -4px -8px;
  padding: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  -webkit-appearance: none;
  appearance: none;
}
.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: white;
  border-radius: 2px;
}
.nav-menu {
  position: absolute;
  top: calc(100% + 8px);   /* drop just below the hamburger icon */
  left: 0;                 /* anchored to header-inner left = the icon */
  min-width: 230px;
  background: white;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
  z-index: 9997;
  display: none;
  overflow: hidden;
}
.nav-menu.is-open { display: block; }
.nav-menu__item {
  display: block;
  padding: 15px 20px;
  font-size: 15px;
  font-weight: bold;
  color: var(--dark-gray);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.nav-menu__item:last-child { border-bottom: none; }
.nav-menu__item:active { background: var(--light-gray); }

/* ── My Dispatches list ───────────────────────────────────────────────── */
.dispatch-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  background: white;
}
.dispatch-card:last-child { margin-bottom: 0; }
.dispatch-card__head {
  display: flex;
  flex-wrap: wrap;          /* date drops below the call # on very narrow phones instead of clipping */
  justify-content: space-between;
  align-items: baseline;
  gap: 2px 10px;
  margin-bottom: 4px;
}
.dispatch-card__call {
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: bold;
  color: var(--crimson);
  white-space: nowrap;
}
.dispatch-card__time {
  font-size: 12px;
  color: var(--mid-gray);
  text-align: right;
}
/* Time Dispatched, stacked under the date. display:block is all the layout
   work needed — the head is already flex-wrap with baseline alignment. */
.dispatch-card__clock {
  display: block;
  font-size: 11px;
  color: var(--mid-gray);
}
.dispatch-card__name {
  font-size: 16px;
  font-weight: bold;
  color: var(--dark-gray);
  margin: 8px 0 6px;
}
.dispatch-card__meta {
  font-size: 13px;
  color: var(--dark-gray);
  margin: 3px 0;
}
.dispatch-card__meta .dc-label {
  display: inline-block;
  min-width: 90px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--mid-gray);
}
.dispatch-card__actions { margin-top: 12px; }
.btn-accept,
.btn-view {
  display: block;
  width: 100%;
  height: 48px;
  font-size: 15px;
  font-weight: bold;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.btn-accept { background: var(--success); }
.btn-accept:active { background: #126B33; }
.btn-view { background: var(--navy); }
.btn-view:active { background: #16314F; }
.btn-accept:disabled,
.btn-view:disabled { opacity: 0.6; cursor: not-allowed; }

.md-empty {
  font-size: 14px;
  color: var(--mid-gray);
  text-align: center;
  padding: 12px 0;
  margin: 0;
}
/* ── Help view ────────────────────────────────────────────────────────── */
.help-view h2 {
  font-size: 16px;
  color: var(--dark-gray);
  margin: 0 0 8px;
}
.help-view p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--dark-gray);
  margin: 0 0 12px;
}
.help-view a { color: var(--navy); }

/* ── Access Codes view ────────────────────────────────────────────────────
   Static door/alarm reference (data/ALARM & DOOR CODES.docx) rendered as a
   searchable list. Reuses the :root tokens — no new colors. */
.codes-view h2 {
  font-size: 16px;
  color: var(--dark-gray);
  margin: 0 0 8px;
}
.codes-legend {
  font-size: 12px;
  line-height: 1.7;
  color: var(--mid-gray);
  margin: 0 0 12px;
}
.codes-legend b { color: var(--dark-gray); }
/* Sticky so the box stays reachable while scrolling ~70 rows. The offset is
   the HEADER's height, not 0: the header is itself sticky at top:0 with
   z-index 100, so a top:0 search box would be completely covered whenever
   the header is revealed — i.e. exactly when the driver scrolls up to reach
   it. --codes-sticky-top is measured from the live header by
   initCodesStickyOffset (it changes with viewport width). When the header
   auto-hides on scroll-down, rows simply scroll through the band above the
   box, which reads as a normal floating filter bar. */
.codes-search {
  position: sticky;
  top: var(--codes-sticky-top, 76px);
  z-index: 90;
  display: block;
  width: 100%;
  /* 16px minimum: anything smaller makes iOS Safari zoom the page on focus,
     and this is an iPad app. */
  font-size: 16px;
  font-family: inherit;
  padding: 11px 12px;
  margin: 0 0 4px;
  color: var(--dark-gray);
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  -webkit-appearance: none;
  appearance: none;
}
.codes-search:focus {
  outline: none;
  border-color: var(--navy);
}
.codes-group { margin-top: 18px; }
.codes-row {
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.codes-row:last-child { border-bottom: none; }
.codes-name {
  font-size: 15px;
  font-weight: bold;
  color: var(--dark-gray);
  margin-bottom: 5px;
}
.codes-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  line-height: 1.5;
}
.codes-key {
  flex: 0 0 48px;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--mid-gray);
}
/* Selectable so a driver can copy a code; monospace + wide tracking so
   0/O and 1/l can't be misread at a dark loading dock. */
.codes-code {
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 16px;
  letter-spacing: 0.5px;
  color: var(--navy);
  -webkit-user-select: text;
  user-select: text;
  /* pre-wrap, not normal: several cells separate two DISTINCT codes with a
     double space (CASE = "5153  1902"). HTML would collapse that to a single
     space and the pair would read as one 9-digit code. Still wraps at
     whitespace, so long cells break cleanly on a narrow screen. */
  white-space: pre-wrap;
  word-break: break-word;
}
.codes-code.is-empty {
  color: var(--mid-gray);
  letter-spacing: 0;
}
.codes-empty {
  font-size: 14px;
  color: var(--mid-gray);
  text-align: center;
  padding: 22px 0;
  margin: 0;
}

/* ── SMS consent gate (full-screen overlay, shown post-auth) ──────────────
   Modeled on the PSAuth gate card so the two chrome layers read as one
   system. z-index sits BELOW #psauth-userbar (9998) so the avatar/sign-out
   stays reachable while the gate is up (wrong-account escape hatch). */
#smsConsentGate {
  position: fixed; inset: 0; z-index: 9500;
  display: flex; align-items: flex-start; justify-content: center;
  background: #F4F5F7; padding: 24px; overflow: auto;
}
.consent-card {
  background: white; border-radius: 12px;
  border-top: 4px solid var(--crimson);
  padding: 30px 26px 24px; max-width: 480px; width: 100%;
  box-shadow: 0 10px 30px rgba(30, 58, 95, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  margin: 6vh 0 24px; position: relative;
}
.consent-brand {
  font-family: 'Edwardian Script ITC', 'Apple Chancery', cursive;
  font-size: 36px; line-height: 1.05; color: var(--crimson);
  text-align: center; margin: 0 0 2px;
}
.consent-title {
  font-size: 16px; color: var(--navy); text-align: center; margin: 0 0 14px;
}
.consent-intro {
  font-size: 14px; line-height: 1.55; color: var(--dark-gray); margin: 0 0 16px;
}
.consent-field-label {
  display: block; font-size: 12px; font-weight: bold; color: var(--dark-gray);
  margin: 14px 0 4px; text-transform: uppercase; letter-spacing: 0.5px;
}
.consent-clause {
  font-size: 13px; line-height: 1.6; color: var(--dark-gray);
  background: var(--light-gray); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px; margin: 16px 0 0;
}
.consent-check {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 14px; line-height: 1.5; color: var(--dark-gray);
  margin: 14px 0 0; cursor: pointer;
  /* neutralize the app's global label styling (bold + uppercase) */
  font-weight: normal; text-transform: none; letter-spacing: normal;
}
.consent-check input[type="checkbox"] {
  width: 22px; height: 22px; margin: 1px 0 0; flex: 0 0 auto;
  accent-color: var(--crimson);
}
.consent-error {
  font-size: 13px; color: var(--error); background: #FEF2F2;
  border: 1px solid #FECACA; border-radius: 8px;
  padding: 10px 12px; margin: 14px 0 0;
}
.consent-agree-btn {
  display: block; width: 100%; min-height: 48px; margin: 18px 0 0;
  font-size: 16px; font-weight: bold; color: white;
  background: var(--crimson); border: 0; border-radius: 8px; cursor: pointer;
}
.consent-agree-btn:active { background: var(--crimson-dark); }
.consent-agree-btn:disabled { background: var(--mid-gray); cursor: default; }
.consent-decline-btn {
  display: block; width: 100%; min-height: 44px; margin: 10px 0 0;
  font-size: 14px; color: var(--dark-gray);
  background: white; border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer;
}
.consent-skip-btn {
  display: block; margin: 12px auto 0; font-size: 13px; color: var(--navy);
  background: none; border: 0; text-decoration: underline; cursor: pointer;
}
.consent-foot {
  font-size: 12px; line-height: 1.5; color: var(--mid-gray);
  margin: 14px 0 0; text-align: center;
}
.consent-close {
  position: absolute; top: 8px; right: 8px; width: 36px; height: 36px;
  font-size: 22px; line-height: 1; color: var(--mid-gray);
  background: none; border: 0; cursor: pointer;
}
/* Help-page SMS preference block */
.help-sms-status { font-weight: bold; }
#smsPrefChange {
  min-height: 44px; font-size: 14px; color: var(--navy);
  background: white; border: 1px solid var(--border); border-radius: 8px;
  padding: 0 16px; cursor: pointer;
}

/* ── Hidden helper ─────────────────────────────────────────────────────── */
[hidden] { display: none !important; }
