
:root {
  --brand-navy: #001a3f;
  --brand-navy-hover: #002855;
  --brand-lime: #d2f55e;
  --brand-lime-dim: #e8fab0;
  --bg: #ffffff;
  --fg: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --card: #f9fafb;
  --primary: var(--brand-navy);
  --danger: #b91c1c;
  --ok: #166534;
  --warn: #92400e;
}

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.container { max-width: 720px; margin: 0 auto; padding: 16px; }

/* ——— Site header & mobile nav ——— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.site-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  min-height: 52px;
}
.site-header__meta {
  text-align: right;
  min-width: 0;
  flex: 1;
}
.site-header__name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-header__code {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.site-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 0 12px 10px;
}
.site-nav--sc {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (min-width: 560px) {
  .site-nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .site-nav--sc {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
.site-nav__item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--brand-navy);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  line-height: 1.2;
}
.site-nav__item:hover {
  background: var(--brand-lime-dim);
  border-color: var(--brand-navy);
}
.site-nav__item.is-active,
.site-nav__item--primary.is-active {
  background: var(--brand-navy);
  border-color: var(--brand-navy);
  color: #fff;
}
.site-nav__item--primary {
  background: var(--brand-navy);
  border-color: var(--brand-navy);
  color: #fff;
}
.site-nav__form {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}
.site-nav__btn {
  width: 100%;
  min-height: 44px;
  padding: 8px 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.site-nav__btn:hover {
  background: var(--brand-lime-dim);
  color: var(--brand-navy);
}
.nav-label-short { display: none; }
@media (max-width: 400px) {
  .nav-label-long { display: none; }
  .nav-label-short { display: inline; }
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--brand-navy);
  text-decoration: none;
  min-width: 0;
  flex-shrink: 0;
}
.brand-logo {
  height: 32px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

/* Legacy alias */
.nav .btn.secondary.active-nav,
.site-nav__item.is-active {
  background: var(--brand-navy);
  color: #fff;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin: 12px 0;
}

.h1 { font-size: clamp(20px, 5vw, 24px); margin: 4px 0 8px; line-height: 1.25; }
.h2 { font-size: 16px; margin: 0 0 8px; color: var(--muted); font-weight: 600; }

.page-head {
  margin-bottom: 12px;
}
.page-head .h1 {
  margin-bottom: 4px;
}
.page-head__meta {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
}
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.field-list {
  margin: 0;
}
.field-list__row {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.field-list__row:first-child {
  padding-top: 0;
}
.field-list__row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.field-list__row dt {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.field-list__row dd {
  margin: 0;
  font-size: 16px;
  line-height: 1.45;
  word-break: break-word;
}

.row { display: flex; gap: 12px; flex-wrap: wrap; }

label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.pin-input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 4px;
}
.pin-input-row input {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.pin-input-row .pin-toggle {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
}
input, select, textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 10px; background: #fff; font-size: 16px;
  min-height: 48px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--brand-lime);
  outline-offset: 1px;
  border-color: var(--brand-navy);
}
textarea { min-height: 90px; }

.req { color: var(--danger); font-weight: 700; }
label.field-error { color: var(--danger); }
input:required:user-invalid,
select:required:user-invalid,
textarea:required:user-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(185, 28, 28, 0.12);
}
.form-hint { font-size: 12px; color: var(--muted); margin: 4px 0 10px; }
.form-hint.missing { color: var(--danger); font-weight: 600; }
.field-label-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.field-label-row label { margin-bottom: 0; }
.field-label-hint {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-align: right;
}

.btn {
  display: inline-flex; justify-content: center; align-items: center;
  min-height: 48px;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.btn:hover:not(:disabled) {
  background: var(--brand-navy-hover);
  box-shadow: 0 2px 8px rgba(0, 22, 61, 0.15);
}
.btn:active:not(:disabled) {
  transform: scale(0.98);
}
.btn:focus-visible {
  outline: 2px solid var(--brand-lime);
  outline-offset: 2px;
}
.btn.secondary { background: white; color: var(--primary); }
.btn.secondary:hover:not(:disabled) {
  background: var(--brand-lime-dim);
  border-color: var(--brand-navy);
}
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.danger:hover:not(:disabled) { background: #991b1b; }
.btn:disabled,
.btn.secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
  box-shadow: none;
}

.sc-seg { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.sc-seg .btn { flex: 1 1 calc(50% - 4px); min-width: 0; min-height: 48px; }
@media (max-width: 400px) {
  .sc-seg .btn { flex: 1 1 100%; }
}
.sc-callout {
  margin: 12px 0 0;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.45;
  color: #374151;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.sc-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0 4px;
}
.sc-stat {
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  text-align: center;
}
.sc-stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  color: #111827;
}
.sc-stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.35;
}

.job-date-section {
  margin-top: 24px;
}
.job-date-section:first-of-type {
  margin-top: 8px;
}
.job-date-heading {
  font-size: 17px;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 4px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
}
.job-date-sub {
  font-weight: 500;
  font-size: 14px;
  color: var(--muted);
  margin-left: 0;
}
.job-date-heading.job-date-today {
  border-bottom-color: var(--brand-lime);
  color: var(--brand-navy);
}
.job-date-past .job-date-heading {
  color: var(--muted);
}
.job-date-past .job-card {
  opacity: 0.9;
}
.job-date-tomorrow-section .job-date-heading {
  color: var(--fg);
}
.peek-nav .row {
  display: flex;
  flex-wrap: nowrap;
}
.peek-nav input[type="date"] {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
}
.job-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.job-actions form {
  margin: 0;
  width: 100%;
}
.job-actions .btn {
  width: 100%;
}
.job-actions__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.job-actions__row form,
.job-actions__row > .btn,
.job-actions__row > a.btn {
  min-width: 0;
}
.job-actions__full {
  width: 100%;
}
.job-actions .pill {
  align-self: flex-start;
}
.pill-ok {
  background: #dcfce7;
  color: var(--ok);
  border: 1px solid #bbf7d0;
}
.site-log {
  margin-top: 8px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.4;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  white-space: pre-wrap;
  color: var(--muted);
  max-height: 120px;
  overflow-y: auto;
}

.pill {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; border: 1px solid var(--border);
  background: #fff;
}

.pill.ok { color: var(--ok); border-color: #bbf7d0; background: #f0fdf4; }
.pill.warn { color: var(--warn); border-color: #fde68a; background: #fffbeb; }
.pill.critical { color: var(--danger); border-color: #fecaca; background: #fef2f2; }

.error { color: var(--danger); font-size: 14px; margin-top: 8px; }
.notice-ok {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--brand-lime-dim);
  color: var(--ok);
  font-size: 14px;
  line-height: 1.45;
}
.muted { font-size: 13px; color: var(--muted); }

.stock-line { margin: 10px 0; padding: 12px; background: #fff; }
.stock-line-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 4px;
}
.stock-line-head .btn { padding: 6px 10px; font-size: 13px; }
.stock-line .line-unit { display: block; margin-top: -6px; margin-bottom: 8px; }

details { margin: 12px 0; }
details summary { cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }

.checklist-section {
  margin: 16px 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.checklist-section:first-of-type { margin-top: 8px; }

.checklist-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 12px;
  align-items: start;
}
.checklist-item { min-width: 0; }
.checklist-code {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}
.checklist-hint {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}
.checklist-grid select {
  padding: 10px 12px;
  font-size: 16px;
  min-width: 4.5rem;
  min-height: 48px;
  margin-top: 2px;
}
@media (max-width: 520px) {
  .checklist-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .checklist-grid select {
    width: 100%;
    margin-bottom: 8px;
  }
}

.small { font-size: 12px; color: var(--muted); }
.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.actions .btn {
  width: 100%;
}
@media (min-width: 480px) {
  .actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .actions .btn {
    width: auto;
    flex: 1 1 auto;
  }
}

.action-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}
.action-bar .btn {
  width: 100%;
}

.card-section {
  margin: 12px 0;
}
.card-section .h2 {
  margin-bottom: 10px;
}

/* Customer COF sign canvas — do not rename/remove without updating signature_pad_guard.py */
.signature-pad {
  display: block;
  box-sizing: border-box;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: #fff;
  width: 100%;
  height: 220px;
  min-height: 180px;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.sc-timeline-item {
  position: relative;
  padding: 0 0 16px 28px;
  border-left: 2px solid var(--border);
  margin-left: 8px;
}
.sc-timeline-item:last-child {
  padding-bottom: 0;
  border-left-color: transparent;
}
.sc-timeline-item::before {
  content: attr(data-step);
  position: absolute;
  left: -11px;
  top: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  color: var(--muted);
}
.sc-timeline-done::before {
  border-color: var(--ok);
  background: #f0fdf4;
  color: var(--ok);
}
.sc-timeline-label {
  font-weight: 600;
  font-size: 14px;
}
.sc-timeline-when {
  font-size: 14px;
  color: var(--fg);
  margin-top: 4px;
}
.sc-timeline-done .sc-timeline-when {
  color: var(--ok);
}

.page-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 9999;
  background: linear-gradient(90deg, var(--brand-lime), var(--brand-navy));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
  pointer-events: none;
}
.page-loading.is-active {
  animation: page-load-pulse 1.2s ease-in-out infinite;
  transform: scaleX(0.35);
}
@keyframes page-load-pulse {
  0% { transform: scaleX(0.15); opacity: 0.7; }
  50% { transform: scaleX(0.85); opacity: 1; }
  100% { transform: scaleX(0.15); opacity: 0.7; }
}

.login-card .actions .btn[type="submit"] {
  width: 100%;
}
.running-late-form .actions .btn {
  width: 100%;
}
.jobs-intro {
  margin: 0 0 16px;
  line-height: 1.5;
}
.peek-nav label.peek-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-navy);
}
.job-card-today {
  border-color: var(--brand-lime);
  box-shadow: 0 0 0 1px var(--brand-lime-dim);
}
.job-card__title {
  margin: 10px 0 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--brand-navy);
}
.job-card__charger {
  margin: 6px 0 0;
  font-size: 15px;
}
.job-card__id {
  margin: 6px 0 0;
  font-size: 13px;
}
.job-card__site {
  margin: 8px 0 0;
  line-height: 1.45;
}
.job-card__time {
  margin: 6px 0 0;
}

.qr-wrap {
  text-align: center;
  margin: 12px 0;
}
.qr-wrap img {
  max-width: 100%;
  height: auto;
}
.google-review-tagline {
  margin: 12px 0 8px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--brand-navy);
}
.google-review-card .google-review-link {
  text-align: center;
  margin-bottom: 12px;
}

details summary.h2 {
  padding: 4px 0;
  list-style: none;
}
details summary.h2::before {
  content: "▸ ";
  color: var(--brand-navy);
}
details[open] summary.h2::before {
  content: "▾ ";
}

.empty-day {
  padding: 16px;
  text-align: center;
}

.landing-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-lime);
}
.landing {
  width: 100%;
  max-width: 720px;
  padding: 32px 16px 48px;
  text-align: center;
}
.landing-logo {
  width: min(360px, calc(100vw - 32px));
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 20px;
}
.landing-title {
  margin: 0 0 8px;
  font-size: clamp(24px, 6vw, 32px);
  line-height: 1.2;
  color: var(--brand-navy);
}
.landing-tagline {
  margin: 0 0 28px;
  font-size: 16px;
  color: var(--muted);
}

.portal-grid {
  display: grid;
  gap: 14px;
  max-width: 520px;
  margin: 0 auto;
}
.portal-grid-actions {
  max-width: none;
  margin-top: 8px;
}
@media (min-width: 560px) {
  .portal-grid-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.portal-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: #fff;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.portal-card-link {
  text-decoration: none;
  color: inherit;
  min-height: 120px;
  justify-content: center;
}
.portal-card-link:hover {
  border-color: var(--brand-navy);
  box-shadow: 0 8px 24px rgba(0, 22, 61, 0.08);
  transform: translateY(-1px);
}
.portal-card-link:active {
  transform: translateY(0);
}
.portal-card-link:focus-visible {
  outline: 2px solid var(--brand-lime);
  outline-offset: 2px;
}
.portal-card-accent {
  border-color: var(--brand-navy);
  background: linear-gradient(180deg, #fff 0%, var(--brand-lime-dim) 100%);
}
.portal-card-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.portal-card-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--brand-navy);
}
.portal-card-desc {
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}
.portal-card-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.portal-card-actions .btn {
  width: 100%;
}

.sc-home-header {
  margin-bottom: 4px;
}
.flash-ok {
  border-color: var(--ok);
  color: var(--ok);
  font-weight: 600;
}
