:root {
  --black: #0b0b0d;
  --white: #ffffff;
  --off-white: #f6f9fc;
  --light-blue: #aedcf5;
  --light-blue-soft: #dff1fb;
  --light-blue-strong: #6cc2ee;
  --border: #e3edf3;
  --shadow: 0 10px 30px rgba(11, 11, 13, 0.08);
  --app-theme: #4d6885;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: #ffffff;
}

html {
  color-scheme: only light;
  height: 100%;
  min-height: 100%;
  min-height: -webkit-fill-available;
  overscroll-behavior-y: none;
  position: relative;
  isolation: isolate;
  scroll-padding-top: calc(12px + env(safe-area-inset-top, 0px));
}

/*
 * Second underlay on the root element — iOS often rubber-bands the <html> layer,
 * not the body layer.
 */
html::before {
  content: "";
  position: fixed;
  top: -100vh;
  left: 0;
  right: 0;
  width: 100%;
  height: 300vh;
  min-height: 300%;
  z-index: -1;
  background-color: #ffffff;
  pointer-events: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  color: var(--black);
  line-height: 1.5;
  min-height: 100%;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overscroll-behavior-y: none;
  /* Anchor iOS stacking so ::before stays behind content */
  position: relative;
  isolation: isolate;
}

/*
 * iOS / WebKit PWA: elastic scroll exposes area outside the layout viewport.
 * A tall fixed white layer prevents the old blue / gray “chrome” from showing.
 */
body::before {
  content: "";
  position: fixed;
  top: -100vh;
  left: 0;
  right: 0;
  width: 100%;
  height: 300vh;
  min-height: 300%;
  z-index: -1;
  background-color: #ffffff;
  pointer-events: none;
}

.checklist-page,
.location-page,
.log-page {
  background-color: #ffffff;
}

main {
  background-color: #ffffff;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- Touch / mobile baseline ---------- */
button,
a,
input[type="checkbox"],
label,
textarea {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button,
a {
  -webkit-user-select: none;
  user-select: none;
}

/* ---------- Hero ---------- */
.hero {
  max-width: 980px;
  margin: 0 auto;
  padding: calc(56px + env(safe-area-inset-top, 0px)) 24px 28px;
  text-align: center;
}

.home-main.home-dashboard .home-dashboard-top + .hero {
  padding-top: 24px;
}

.home-dashboard-top .work-session-card {
  position: absolute;
  top: calc(46px + env(safe-area-inset-top, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  width: 210px;
  margin: 0;
  padding: 8px 9px;
  border: 2px solid var(--light-blue);
  border-radius: 12px;
  box-shadow: var(--shadow);
  background: var(--white);
  z-index: 2;
}

.work-session-card.is-active {
  border-color: #dc2626;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.2), 0 12px 30px rgba(220, 38, 38, 0.25);
  animation: workSessionGlow 1.8s ease-in-out infinite;
}

@keyframes workSessionGlow {
  0%, 100% {
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.18), 0 12px 30px rgba(220, 38, 38, 0.18);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(220, 38, 38, 0.1), 0 16px 34px rgba(220, 38, 38, 0.3);
  }
}

.work-session-title {
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.2;
}

.work-session-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.work-session-stat {
  margin: 0;
  padding: 6px 7px;
  background: var(--off-white);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.work-session-stat span {
  display: block;
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7785;
  font-weight: 700;
}

.work-session-stat strong {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-family: "SF Mono", Menlo, Monaco, Consolas, "Courier New", monospace;
  font-variant-numeric: tabular-nums;
}

.work-session-status {
  margin: 6px 0;
  font-size: 10px;
  line-height: 1.25;
  color: #4a5560;
  font-weight: 600;
}

.work-session-actions {
  display: flex;
  gap: 6px;
}

.work-session-actions .work-session-toggle-btn {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 28px;
  padding: 5px 8px;
  font-size: 11px;
  letter-spacing: 0;
  border-radius: 8px;
}

.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.hero .accent {
  color: var(--light-blue-strong);
}

/* ---------- Home layout (backup bar at bottom) ---------- */
.home-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.home-main.home-dashboard {
  position: relative;
}

/* Cleaning log link + compact sounds control (top-right) */
.home-dashboard-top {
  flex-shrink: 0;
  position: relative;
  width: 100%;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-left, 12px)) 6px;
  padding-right: calc(280px + max(16px, env(safe-area-inset-right, 12px)));
  box-sizing: border-box;
}

.home-sounds-toggle {
  position: static;
  z-index: 1;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 9px;
  min-height: 0;
  line-height: 1.2;
  border-radius: 8px;
  letter-spacing: 0.02em;
  flex: 0 0 auto;
}

.backup-bar .home-sounds-toggle {
  flex: 0 0 auto;
  display: inline-block;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 700;
  color: #2d3e4f;
  background: var(--white);
  border: 2px solid rgba(77, 104, 133, 0.35);
  border-radius: 999px;
  box-shadow: var(--shadow);
  line-height: 1.2;
  min-height: 0;
}

.backup-bar .home-sounds-toggle:hover {
  background: var(--light-blue-soft);
  border-color: var(--light-blue-strong);
  transform: translateY(-1px);
}

.backup-bar .home-sounds-toggle:active {
  transform: translateY(0);
}

.home-dashboard-log-link {
  position: static;
  max-width: 100%;
}

/* Home: label above log / calendar links */
.home-nav-eyebrow {
  margin: 0 0 8px;
  width: fit-content;
  max-width: 100%;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6b7785;
}

/* Home: log + calendar — vertical stack; gap matches .location-list row gap */
.home-dashboard-nav-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}

.home-dashboard-nav-stack .home-dashboard-log-link {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}

/* Calendar (and other solo screens): no sounds toggle — don’t reserve extra right padding */
.home-dashboard-top.home-dashboard-top--solo {
  padding-right: max(16px, env(safe-area-inset-right, 12px));
}

.home-dashboard-top.home-dashboard-top--solo .back-link.home-dashboard-log-link {
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}

/* ---------- Location Buttons ---------- */
.locations {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 24px 40px;
  flex: 1 0 auto;
  width: 100%;
}

.location-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.location-btn {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 12px 12px;
  background: var(--white);
  color: var(--black);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  line-height: 1.25;
  border: 2px solid var(--light-blue);
  border-radius: 12px;
  box-shadow: var(--shadow);
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease,
    border-color 0.2s ease, box-shadow 0.2s ease;
}

.location-list > a.location-btn[data-storage-key] {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-align: center;
}

.location-btn__title {
  display: block;
  max-width: 100%;
  line-height: 1.25;
}

.location-btn__last {
  display: block;
  max-width: 100%;
  font-size: 11px;
  font-weight: 500;
  color: #8a94a3;
  line-height: 1.2;
}

.location-btn:hover .location-btn__last {
  color: #6b7685;
}

.location-btn.in-progress .location-btn__last {
  color: #9f7373;
}

.location-btn.in-progress:hover .location-btn__last {
  color: #8f6363;
}

.location-btn:hover {
  background: var(--light-blue);
  color: var(--black);
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(108, 194, 238, 0.35);
}

.location-btn:active {
  transform: translateY(0);
  background: var(--light-blue-strong);
}

.location-btn:focus-visible {
  outline: 3px solid var(--light-blue-strong);
  outline-offset: 3px;
}

/* Janitorial (J) / Window (W) — home location grid only */
.location-list > a.location-btn[data-loc-tag] {
  position: relative;
  padding: 12px 12px 24px;
}

.location-list > a.location-btn[data-loc-tag]::after {
  content: "(" attr(data-loc-tag) ")";
  position: absolute;
  right: 10px;
  bottom: 5px;
  font-size: 10px;
  font-weight: 800;
  font-family: inherit;
  color: #5c6d7d;
  letter-spacing: 0.04em;
  line-height: 1;
  pointer-events: none;
}

.location-btn.in-progress[data-loc-tag]::after {
  color: #7f1d1d;
}

/* Active cleaning hint above the list */
.active-cleaning-hint {
  margin: 0 0 16px;
  padding: 12px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid #dc2626;
  border-radius: 12px;
  color: #991b1b;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

/* In-progress location: subtle red border so user can spot it on the home page */
.location-btn.in-progress {
  border-color: #dc2626;
  background: #fff5f5;
  color: #991b1b;
}

.location-btn.in-progress:hover,
.location-btn.in-progress:active {
  background: #fee2e2;
  color: #991b1b;
  border-color: #dc2626;
}

/* ---------- Cleaning Calendar ---------- */
.calendar-page {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 0 calc(24px + env(safe-area-inset-bottom, 0px));
}

.calendar-shell {
  max-width: 1260px;
  margin: 0 auto;
  min-height: calc(100vh - 48px);
  min-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
  padding: 0 max(16px, env(safe-area-inset-left, 12px));
  padding-right: max(16px, env(safe-area-inset-right, 12px));
  box-sizing: border-box;
}

.calendar-header {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  gap: 12px;
  margin: 6px 0 14px;
}

.calendar-header h1 {
  margin: 0;
  text-align: center;
  font-size: clamp(24px, 4.8vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.4px;
}

.calendar-nav-btn {
  height: 52px;
  width: 52px;
  border-radius: 12px;
  border: 2px solid var(--light-blue);
  background: var(--white);
  color: var(--black);
  font-size: 22px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.calendar-nav-btn:hover {
  background: var(--light-blue-soft);
}

.calendar-grid-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-weekdays span {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b7785;
}

.calendar-grid {
  grid-auto-rows: minmax(104px, 136px);
}

.calendar-add-panel {
  max-width: 1180px;
  width: 100%;
  margin: 10px auto 0;
  padding: 10px 12px;
  border: 2px solid var(--light-blue);
  border-radius: 12px;
  background: #f8fbff;
  box-shadow: var(--shadow);
}

.calendar-add-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #4f5f70;
}

.calendar-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, 180px) auto;
  gap: 8px;
  align-items: center;
}

.calendar-add-select {
  width: 100%;
  min-height: 44px;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 15px;
  font-family: inherit;
  background: var(--white);
}

.calendar-add-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: #5e6f80;
}

.calendar-add-hint--secondary {
  margin-top: 6px;
  font-size: 11px;
  color: #6b7785;
}

.calendar-mode-controls {
  max-width: 1180px;
  margin: 0 auto 0;
  padding: 8px 16px 0;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.calendar-mode-btn {
  min-width: 0;
  min-height: 48px;
  font-weight: 700;
}

.calendar-mode-btn.is-active {
  border-color: var(--light-blue-strong);
  background: var(--light-blue-soft);
}

#calendarDoneEditBtn {
  display: none;
}

.calendar-mode-controls.is-editing-any #calendarDoneEditBtn {
  display: block;
}

.calendar-delete-actions {
  max-width: 1180px;
  margin: 8px auto 0;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
}

.calendar-delete-count {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #6b7785;
}

.calendar-day-schedule-row--selected-delete {
  background: #fef3c7 !important;
  border-left-color: #d97706 !important;
  box-shadow: inset 0 0 0 3px #92400e, 0 0 0 2px rgba(146, 64, 14, 0.28);
  transform: scale(1.01);
}

.calendar-day-schedule-row--delete-locked {
  opacity: 0.72;
  cursor: not-allowed;
}

.calendar-add-confirm {
  min-height: 44px;
  white-space: nowrap;
}

.calendar-day {
  border-radius: 12px;
  border: 2px solid var(--light-blue);
  background: var(--white);
  box-shadow: var(--shadow);
  font-size: clamp(16px, 2.8vw, 24px);
  font-weight: 700;
  color: var(--black);
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  padding: 7px 12px 8px;
  position: relative;
  overflow: hidden;
}

.calendar-day-num {
  display: block;
  position: absolute;
  top: 8px;
  right: 12px;
  z-index: 2;
  line-height: 1;
  pointer-events: none;
}

.calendar-day-count {
  position: absolute;
  left: 8px;
  top: 8px;
  min-width: 22px;
  min-height: 20px;
  border-radius: 999px;
  padding: 0 6px;
  border: 1px solid #8db7d8;
  background: #e9f5ff;
  color: #24567f;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.calendar-day-schedule {
  margin-top: 36px;
  width: 100%;
  padding-right: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: calc(100% - 28px);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 82%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 82%, transparent 100%);
}

a.calendar-day-schedule-row {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border-radius: 8px;
  margin-left: -2px;
  margin-right: -2px;
  padding: 4px 6px 4px 8px;
  border-left: 5px solid transparent;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

a.calendar-day-schedule-row:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

.calendar-day-schedule-row--pending {
  border-left-color: #b91c1c;
  background: linear-gradient(90deg, rgba(254, 226, 226, 0.95) 0%, rgba(254, 226, 226, 0.55) 100%);
  box-shadow: inset 0 0 0 1px rgba(185, 28, 28, 0.45);
}

.calendar-day-schedule-row--done {
  border-left-color: #15803d;
  background: linear-gradient(90deg, rgba(220, 252, 231, 0.95) 0%, rgba(220, 252, 231, 0.55) 100%);
  box-shadow: inset 0 0 0 1px rgba(21, 128, 61, 0.45);
}

.calendar-day-schedule-row-wrap {
  display: flex;
  align-items: stretch;
  gap: 4px;
  width: 100%;
  min-width: 0;
}

.calendar-day-schedule-row-wrap > a.calendar-day-schedule-row {
  flex: 1 1 auto;
  min-width: 0;
}

.calendar-schedule-edit-btn {
  flex: 0 0 auto;
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  margin: 0;
  padding: 0;
  border: 2px solid var(--light-blue);
  border-radius: 8px;
  background: var(--white);
  color: #374151;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--shadow);
  align-self: center;
}

.calendar-schedule-edit-btn:hover {
  background: var(--light-blue-soft);
}

.calendar-schedule-edit-btn:active {
  transform: translateY(1px);
}

.calendar-day-schedule-row {
  display: flex;
  align-items: baseline;
  gap: 0;
  width: 100%;
  min-width: 0;
  font-size: 11px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--black);
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.calendar-day-schedule-time {
  flex: 0 0 auto;
  font-weight: inherit;
  color: inherit;
  white-space: nowrap;
  padding-right: 4px;
}

.calendar-day-schedule-location {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: inherit;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  -webkit-mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 0.4em), transparent 100%);
  mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 0.4em), transparent 100%);
}

.calendar-day.has-cleaning-for-location {
  border-color: #2563eb;
  background: #eff6ff;
}

.calendar-day.is-staged-for-add {
  border-color: #0f766e;
  background: #ecfdf5;
}

.calendar-day.is-muted {
  color: #9aa6b2;
  border-color: var(--border);
  background: var(--off-white);
}

/* Match active location highlight treatment for today's date */
.calendar-day.is-today {
  border-color: #dc2626;
  background: #fff5f5;
  color: #991b1b;
}

.calendar-edit-modal {
  text-align: left;
  max-width: 420px;
}

.calendar-edit-modal h2 {
  text-align: center;
}

.calendar-edit-sub {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 700;
  color: var(--black);
  text-align: center;
  line-height: 1.3;
}

.calendar-edit-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.calendar-edit-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #4f5f70;
}

.calendar-edit-input {
  width: 100%;
  min-height: 44px;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 16px;
  font-family: inherit;
  box-sizing: border-box;
  background: var(--white);
}

.calendar-edit-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.calendar-edit-actions .btn-primary,
.calendar-edit-actions .btn-secondary,
.calendar-edit-actions .btn-backup-danger {
  width: 100%;
  margin: 0;
  min-height: 46px;
  padding: 12px 16px;
  border-radius: 12px;
  box-sizing: border-box;
}

.calendar-edit-delete-btn {
  border-color: #b91c1c;
  color: #991b1b;
  background: #fff5f5;
}

.calendar-edit-delete-btn:hover {
  background: #fee2e2;
  border-color: #991b1b;
  color: #7f1d1d;
}

/* Secondary CTA on home (e.g. link to another app — see config.js) */
.home-more-tools {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 24px 32px;
  width: 100%;
}

.home-more-tools-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b7785;
  text-align: center;
}

.home-more-tools-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: #6b7785;
  text-align: center;
  line-height: 1.4;
}

.home-more-tools-hint code {
  font-size: 12px;
  background: #f0f4f8;
  padding: 2px 6px;
  border-radius: 6px;
}

.location-btn-secondary {
  border-style: dashed;
  border-color: var(--light-blue-strong);
  background: var(--light-blue-soft);
  color: #0a4f72;
  font-weight: 700;
}

.location-btn-secondary:hover {
  background: var(--light-blue);
  border-style: solid;
  color: var(--black);
}

.location-btn-secondary:active {
  background: var(--light-blue-strong);
}

/* ---------- Home: Update App (opens sheet) ---------- */
.backup-bar {
  flex-shrink: 0;
  margin-top: auto;
  padding: 12px 20px calc(22px + env(safe-area-inset-bottom, 0px));
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 10px;
  background: transparent;
  border: none;
}

.btn-update-app {
  display: inline-block;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  color: #2d3e4f;
  background: var(--white);
  border: 2px solid rgba(77, 104, 133, 0.35);
  border-radius: 999px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease,
    box-shadow 0.2s ease;
}

.btn-update-app:hover {
  background: var(--light-blue-soft);
  border-color: var(--light-blue-strong);
  transform: translateY(-1px);
}

.btn-update-app:active {
  transform: translateY(0);
}

.app-update-layer {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}

.app-update-layer[hidden] {
  display: none !important;
}

.app-update-backdrop {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: rgba(20, 28, 36, 0.42);
  cursor: pointer;
}

.app-update-sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(440px, 100vw);
  max-height: calc(90vh - env(safe-area-inset-top, 0px));
  background: #f4f7fa;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -12px 40px rgba(11, 11, 13, 0.14);
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.app-update-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 12px;
  border-bottom: 1px solid rgba(77, 104, 133, 0.12);
  background: var(--white);
  border-radius: 20px 20px 0 0;
}

.app-update-menu-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--black);
}

.app-update-close {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: rgba(77, 104, 133, 0.1);
  color: #4a5568;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
}

.app-update-close:hover {
  background: rgba(77, 104, 133, 0.18);
  color: var(--black);
}

.app-update-sheet-body {
  position: relative;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 20px 24px;
}

.backup-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: stretch;
  width: 100%;
}

.btn-backup {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 48px;
  padding: 12px 10px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  border-radius: 12px;
  border: 2px solid var(--light-blue-strong);
  background: var(--white);
  color: #0a4f72;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  box-sizing: border-box;
  width: 100%;
}

.btn-backup:hover:not(:disabled) {
  background: var(--light-blue);
  transform: translateY(-1px);
}

.btn-backup:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-backup-danger {
  border-color: #b91c1c;
  color: #991b1b;
  background: #fff5f5;
}

.btn-backup-danger:hover:not(:disabled) {
  background: #fee2e2;
  border-color: #991b1b;
}

.btn-refresh-app {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 12px;
  min-height: 44px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  line-height: 1.25;
  text-align: center;
  border-radius: 12px;
  border: 2px dashed rgba(77, 104, 133, 0.4);
  background: rgba(255, 255, 255, 0.75);
  color: #3d5266;
  cursor: pointer;
  box-sizing: border-box;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-refresh-app:hover:not(:disabled) {
  background: var(--white);
  border-color: var(--light-blue-strong);
  border-style: solid;
  color: #0a4f72;
}

.btn-refresh-app:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.backup-hint-placement {
  margin-top: 16px;
  padding: 14px 18px 16px;
  text-align: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(77, 104, 133, 0.14);
  border-radius: 16px;
  box-shadow: 0 4px 18px rgba(77, 104, 133, 0.07);
  position: relative;
}

.backup-hint-placement::before {
  content: "";
  display: block;
  width: 40px;
  height: 3px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(108, 194, 238, 0.35) 20%,
    var(--light-blue-strong) 50%,
    rgba(108, 194, 238, 0.35) 80%,
    transparent
  );
  opacity: 0.85;
}

.backup-bar-hint {
  margin: 0;
  font-size: 11px;
  line-height: 1.55;
  letter-spacing: 0.02em;
  color: #7d8896;
  font-weight: 500;
  max-width: 34em;
  margin-left: auto;
  margin-right: auto;
}

.backup-bar-status {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: #5c6778;
  font-weight: 600;
  text-align: center;
}

.backup-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Locked location button (other locations while one is in progress) */
.location-btn.locked {
  opacity: 0.45;
  filter: grayscale(0.6);
  cursor: not-allowed;
}

.location-btn.locked:hover {
  background: var(--white);
  transform: none;
  box-shadow: var(--shadow);
  border-color: var(--light-blue);
}

.location-btn.shake,
.block-notice.shake {
  animation: shakeHorizontal 0.42s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shakeHorizontal {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}

/* ---------- Location Page ---------- */
.location-page {
  max-width: 820px;
  margin: 0 auto;
  padding: calc(40px + env(safe-area-inset-top, 0px)) 24px 60px;
}

.back-link {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--black);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--white);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.back-link:hover {
  background: var(--light-blue-soft);
  border-color: var(--light-blue);
}

/* Wins cascade over `.back-link` margin — top bars use gap/parent padding instead */
.back-link.home-dashboard-log-link {
  margin-bottom: 0;
}

.loc-header {
  text-align: center;
  margin-bottom: 36px;
}

.loc-eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--light-blue-strong);
}

.loc-header h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 4.5vw, 44px);
  font-weight: 800;
  letter-spacing: -0.5px;
}

.loc-sub {
  margin: 0;
  color: #5a6470;
  font-size: 16px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.info-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--light-blue);
  border-radius: 12px;
  padding: 18px 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-card.placeholder {
  border-left-color: var(--border);
}

.info-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #6b7785;
}

.info-value {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--black);
}

.info-value.muted {
  color: #b9c4cf;
  font-weight: 500;
  font-style: italic;
}

.info-link {
  margin-top: 8px;
  align-self: flex-start;
  color: var(--light-blue-strong);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.info-link:hover {
  text-decoration: underline;
}

/* Alarm code: gated behind PIN on location pages */
.alarm-code-card .btn-alarm-reveal {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  text-align: center;
  color: #0a4f72;
  background: var(--light-blue-soft);
  border: 2px solid var(--light-blue-strong);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.alarm-code-card .btn-alarm-reveal:hover {
  background: var(--light-blue);
  transform: translateY(-1px);
}

.alarm-code-card .alarm-code-value {
  margin: 8px 0 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.alarm-code-card .alarm-instruction {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
}

.alarm-pin-modal .alarm-pin-hint {
  margin: 0 0 12px;
  font-size: 15px;
  color: #4a5560;
}

.alarm-pin-modal .alarm-pin-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #6b7785;
  margin: 0 0 6px;
  text-align: left;
}

.alarm-pin-modal .alarm-pin-input {
  width: 100%;
  box-sizing: border-box;
  padding: 14px 16px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: 12px;
  margin-bottom: 0;
  font-family: inherit;
}

.alarm-pin-modal .alarm-pin-input:focus {
  outline: none;
  border-color: var(--light-blue-strong);
  box-shadow: 0 0 0 3px rgba(108, 194, 238, 0.35);
}

.alarm-pin-modal .alarm-pin-input.is-invalid {
  border-color: #b91c1c;
  background-color: #fef2f2;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.2);
}

.alarm-pin-modal .alarm-pin-input.is-invalid:focus {
  border-color: #b91c1c;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.25);
}

.start-btn {
  display: block;
  width: 100%;
  padding: 20px;
  background: var(--black);
  color: var(--white);
  text-align: center;
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-radius: 14px;
  border: 2px solid var(--black);
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.start-btn:hover {
  background: var(--light-blue);
  color: var(--black);
  border-color: var(--light-blue);
  transform: translateY(-2px);
}

/* In-progress: red, slowly pulsing */
.start-btn.in-progress,
.start-btn.in-progress:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
  transform: none;
  animation: startPulse 2.4s ease-in-out infinite;
}

.start-btn.in-progress:active {
  background: #b91c1c;
  border-color: #b91c1c;
  transform: translateY(1px);
  animation: none;
}

@keyframes startPulse {
  0%, 100% {
    background: #dc2626;
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.55),
                0 10px 24px rgba(220, 38, 38, 0.30);
  }
  50% {
    background: #ef4444;
    box-shadow: 0 0 0 14px rgba(220, 38, 38, 0),
                0 6px 14px rgba(220, 38, 38, 0.10);
  }
}

/* Blocked: another location has an active cleaning */
.start-btn.blocked,
.start-btn.blocked:hover,
.start-btn.blocked:active {
  background: #e5e7eb;
  color: #6b7280;
  border-color: #d1d5db;
  cursor: not-allowed;
  transform: none;
  animation: none;
  opacity: 0.95;
  box-shadow: none;
}

.block-notice {
  margin: 24px 0 12px;
  padding: 14px 16px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
}

.log-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 16px 20px;
  background: var(--white);
  color: var(--black);
  text-align: center;
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.3px;
  border-radius: 14px;
  border: 2px solid var(--light-blue);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.log-btn:hover {
  background: var(--light-blue-soft);
  transform: translateY(-2px);
}

/* ---------- Log Page ---------- */
.log-page {
  max-width: 920px;
  margin: 0 auto;
  padding: calc(32px + env(safe-area-inset-top, 0px)) 24px 60px;
}

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

.summary-tile {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--light-blue);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-num {
  font-size: 22px;
  font-weight: 800;
  font-family: "SF Mono", Menlo, Monaco, Consolas, "Courier New", monospace;
  font-variant-numeric: tabular-nums;
  color: var(--black);
}

.summary-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #6b7785;
}

section.log-page[data-work-log="true"] .log-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.log-table-wrap {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.log-table {
  width: 100%;
  border-collapse: collapse;
}

.log-table thead {
  background: var(--black);
  color: var(--white);
}

.log-table th {
  text-align: left;
  padding: 14px 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.log-table td {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  font-size: 15px;
  color: var(--black);
}

.log-table tbody tr.log-row:hover {
  background: var(--light-blue-soft);
}

.duration-pill {
  display: inline-block;
  padding: 4px 12px;
  background: var(--light-blue-soft);
  color: #0a4f72;
  border: 1px solid var(--light-blue);
  border-radius: 999px;
  font-family: "SF Mono", Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.duration-pill.small {
  padding: 2px 10px;
  font-size: 12px;
}

.duration-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.expand-arrow {
  font-size: 12px;
  color: #6b7785;
  transition: transform 0.2s ease;
}

.log-row.expanded .expand-arrow {
  transform: rotate(90deg);
  color: var(--light-blue-strong);
}

.duration-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
}

.log-media-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  font-size: 13px;
}

.log-media-inline-detail {
  padding: 4px 18px 12px;
}

.log-details .log-gallery-btn {
  margin-left: 4px;
}

.log-media-label {
  font-weight: 700;
  color: #6b7785;
  letter-spacing: 0.02em;
}

.log-media-count {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--black);
}

.log-gallery-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  border: 2px solid var(--light-blue);
  background: var(--light-blue-soft);
  color: #0a4f72;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.log-gallery-btn:hover {
  background: var(--light-blue);
  border-color: var(--light-blue-strong);
}

.log-notes-btn {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  border: 2px solid var(--light-blue-strong);
  background: var(--white);
  color: #0a4f72;
  white-space: nowrap;
}

.log-notes-btn:hover {
  background: var(--light-blue-soft);
}

.log-notes-none {
  color: #9ca3af;
  font-size: 14px;
}

.td-log-notes {
  vertical-align: middle;
}

.log-notes-modal-title {
  margin: 0 0 12px;
  font-size: 1.15rem;
}

.log-notes-modal-body {
  max-height: min(60vh, 420px);
  overflow-y: auto;
  margin: 0 0 8px;
  text-align: left;
}

.log-notes-modal-body .log-notes-wrap {
  padding: 0;
}

.log-notes-modal-empty {
  margin: 0;
  color: #6b7785;
  font-size: 15px;
}

.log-table td.td-duration-stack {
  vertical-align: top;
}

.edit-media-block {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.edit-media-block .edit-media-input {
  margin-top: 8px;
  font-size: 14px;
  max-width: 100%;
}

.edit-media-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.edit-media-thumb {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #e8eef2;
}

.edit-media-thumb img,
.edit-media-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.edit-media-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: rgba(11, 11, 13, 0.72);
  color: var(--white);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-backdrop {
  z-index: 220;
}

.gallery-backdrop .gallery-panel {
  position: relative;
  background: var(--black);
  border-radius: 16px;
  border: 2px solid #2d3748;
  padding: 48px 16px 56px;
  max-width: min(960px, calc(100vw - 32px));
  width: 100%;
  max-height: min(90vh, 860px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.gallery-close {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}

.gallery-stage {
  flex: 1;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.gallery-stage img,
.gallery-stage video {
  max-width: 100%;
  max-height: min(70vh, 720px);
  border-radius: 8px;
}

.gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 14px;
}

.gallery-nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}

.gallery-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.gallery-counter {
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 4em;
  text-align: center;
}

.log-details td {
  background: var(--off-white);
  padding: 0 !important;
  border-top: none !important;
  display: block !important;
}

.log-details td::before {
  display: none !important;
}

.log-notes-wrap {
  padding: 14px 18px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.log-notes-block {
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.log-notes-title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7785;
}

.log-notes-body {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--black);
  white-space: normal;
  word-break: break-word;
}

.task-breakdown {
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
}

.task-breakdown.empty {
  text-align: center;
  color: #6b7785;
  font-style: italic;
  font-size: 14px;
}

.task-breakdown-head {
  display: grid;
  grid-template-columns: 1fr 110px 90px;
  gap: 12px;
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #6b7785;
  border-bottom: 1px solid var(--border);
}

.task-breakdown-head .col-dur,
.task-breakdown-head .col-cum {
  text-align: right;
}

.task-row {
  display: grid;
  grid-template-columns: 1fr 110px 90px;
  gap: 12px;
  padding: 10px 4px;
  align-items: center;
  font-size: 14px;
  border-bottom: 1px dashed var(--border);
}

.task-row:last-child {
  border-bottom: none;
}

.task-row .task-name {
  color: var(--black);
  font-weight: 500;
}

.task-row.optional .task-name {
  color: #6b7785;
}

.task-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  background: var(--light-blue-soft);
  color: #0a4f72;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  vertical-align: middle;
}

.task-row .col-dur,
.task-row .col-cum {
  text-align: right;
  font-family: "SF Mono", Menlo, Monaco, Consolas, "Courier New", monospace;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.task-row .col-cum {
  color: #6b7785;
}

/* Edit / Delete action buttons inside the expanded view */
.entry-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px 0;
}

.entry-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--black);
  transition: background 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, transform 0.1s ease;
}

.entry-btn:hover {
  background: var(--off-white);
  border-color: var(--light-blue);
}

.entry-btn:active {
  transform: scale(0.96);
}

.entry-btn.delete-btn {
  border-color: #fecaca;
  color: #b91c1c;
}

.entry-btn.delete-btn:hover {
  background: #fef2f2;
  border-color: #dc2626;
  color: #991b1b;
}

/* Edit form */
.edit-form {
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.edit-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.edit-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #6b7785;
}

.edit-field input {
  font-family: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  color: var(--black);
  letter-spacing: 0;
  text-transform: none;
  font-weight: 500;
  width: 100%;
}

.edit-field input:focus {
  outline: none;
  border-color: var(--light-blue-strong);
  box-shadow: 0 0 0 3px rgba(108, 194, 238, 0.18);
}

.edit-tasks {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.edit-tasks-title {
  margin: 4px 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #6b7785;
}

.edit-tasks-title .hint {
  margin-left: 8px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: none;
  color: #9aa6b2;
  font-size: 11px;
}

.edit-task-row {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 12px;
  align-items: center;
  padding: 8px 4px;
  border-bottom: 1px dashed var(--border);
}

.edit-task-row:last-child {
  border-bottom: none;
}

.edit-task-row .task-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--black);
}

.edit-task-row.optional .task-name {
  color: #6b7785;
}

.duration-input {
  font-family: "SF Mono", Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  color: var(--black);
  width: 100%;
  font-weight: 600;
}

.duration-input:focus {
  outline: none;
  border-color: var(--light-blue-strong);
  box-shadow: 0 0 0 3px rgba(108, 194, 238, 0.18);
}

.edit-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.edit-actions .btn-primary,
.edit-actions .btn-secondary {
  flex: 1;
  padding: 12px 18px;
  font-size: 15px;
  border-radius: 12px;
}

.edit-empty {
  margin: 0;
  padding: 12px;
  background: var(--off-white);
  border-radius: 8px;
  text-align: center;
  font-size: 13px;
  color: #6b7785;
  font-style: italic;
}

@media (max-width: 600px) {
  .edit-fields {
    grid-template-columns: 1fr;
  }
  .edit-task-row {
    grid-template-columns: 1fr 100px;
    gap: 10px;
  }
  .edit-task-row .task-name {
    font-size: 13px;
  }
  .entry-actions {
    padding: 12px 14px 0;
  }
  .edit-form {
    padding: 12px 14px 16px;
  }
}

@media (max-width: 600px) {
  .task-breakdown-head {
    grid-template-columns: 1fr 80px 80px;
    gap: 8px;
    font-size: 10px;
  }
  .task-row {
    grid-template-columns: 1fr 80px 80px;
    gap: 8px;
    font-size: 13px;
    padding: 12px 4px;
  }
  .task-row .col-dur,
  .task-row .col-cum {
    font-size: 12px;
  }
  .task-breakdown {
    padding: 12px 14px 14px;
  }
}

.log-empty {
  background: var(--white);
  border: 2px dashed var(--light-blue);
  border-radius: 14px;
  padding: 40px 24px;
  text-align: center;
}

.log-empty p {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.log-empty .muted-text {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 400;
  color: #6b7785;
}

.log-actions {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.log-actions .btn-secondary {
  flex: 0;
  min-width: 160px;
}

.work-log-section {
  margin-top: 24px;
}

.work-log-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.work-log-head h2 {
  margin: 0;
  font-size: 20px;
}

.work-log-detail-body {
  padding: 0 18px 14px;
}

.work-log-detail-line {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--black);
}

.work-log-detail-line:last-child {
  margin-bottom: 0;
}

.work-log-detail-miles {
  color: #0a4f72;
  font-weight: 600;
}

.work-log-detail-body .work-log-notes-in-detail {
  margin-top: 12px;
}

.work-mileage-modal {
  max-width: 420px;
}

.work-mileage-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  font-size: 18px;
  font-family: inherit;
  border: 2px solid var(--border);
  border-radius: 12px;
  margin: 0 0 16px;
}

.work-mileage-input:focus {
  outline: none;
  border-color: var(--light-blue-strong);
  box-shadow: 0 0 0 3px rgba(108, 194, 238, 0.3);
}

.work-session-notes-modal {
  max-width: 420px;
  text-align: left;
}

.work-session-notes-modal h2 {
  text-align: center;
}

.work-session-notes-hint {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.4;
  color: #4a5560;
}

.work-session-notes-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 100px;
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  line-height: 1.45;
  border: 2px solid var(--border);
  border-radius: 12px;
  margin: 0 0 16px;
  resize: vertical;
  background: var(--white);
  color: var(--black);
}

.work-session-notes-input:focus {
  outline: none;
  border-color: var(--light-blue-strong);
  box-shadow: 0 0 0 3px rgba(108, 194, 238, 0.22);
}

.edit-form .edit-field-work-notes {
  margin-top: 4px;
}

.work-log-edit-notes {
  min-height: 88px;
}

/* Mobile log table — switch to card layout */
@media (max-width: 600px) {
  .log-table thead {
    display: none;
  }
  .log-table,
  .log-table tbody,
  .log-table tr,
  .log-table td {
    display: block;
    width: 100%;
  }
  .log-table tr {
    border-top: 1px solid var(--border);
    padding: 8px 4px;
  }
  .log-table td {
    border: none;
    padding: 6px 14px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
  }
  .log-table td.td-duration-stack .duration-stack {
    align-items: flex-start;
    width: 100%;
  }
  .log-table td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #6b7785;
  }

  /* Combined (all locations) log: shorter summary rows on phone — full edit/detail unchanged */
  section.log-page[data-master-log="true"] .log-summary {
    gap: 8px;
    margin-bottom: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  section.log-page[data-master-log="true"] .summary-tile-master-cleanings {
    grid-column: 1 / -1;
  }
  section.log-page[data-master-log="true"] .summary-tile-master-avg {
    display: none !important;
  }
  section.log-page[data-master-log="true"] .summary-tile {
    padding: 10px 12px;
    border-radius: 10px;
  }
  section.log-page[data-master-log="true"] .summary-num {
    font-size: 18px;
  }
  section.log-page[data-master-log="true"] .summary-label {
    font-size: 10px;
    letter-spacing: 1.2px;
  }
  /* Master cleaning log + work log: same compact card rows on phone */
  section.log-page[data-master-log="true"] .log-table tr.log-row,
  section.log-page[data-work-log="true"] .log-table tr.work-log-row {
    padding: 3px 2px;
  }
  section.log-page[data-master-log="true"] .log-table tr.log-row > td,
  section.log-page[data-work-log="true"] .log-table tr.work-log-row > td {
    padding: 3px 12px;
    font-size: 14px;
    line-height: 1.3;
  }
  section.log-page[data-master-log="true"] .log-table tr.log-row > td::before,
  section.log-page[data-work-log="true"] .log-table tr.work-log-row > td::before {
    font-size: 10px;
    letter-spacing: 1px;
    padding-right: 8px;
  }
  section.log-page[data-master-log="true"] .log-table tr.log-row > td.td-log-notes {
    display: none !important;
  }
  section.log-page[data-master-log="true"] .log-table tr.log-row .duration-pill,
  section.log-page[data-work-log="true"] .log-table tr.work-log-row .duration-pill {
    font-size: 12px;
    padding: 3px 10px;
  }
  section.log-page[data-work-log="true"] .log-table tr.work-log-row > td.td-duration-stack .duration-stack {
    align-items: flex-start;
    width: 100%;
  }

  /* Work log: four tiles in a 2×2 grid (month/week miles + month/week time); week = Mon–Sun local */
  section.log-page[data-work-log="true"] .log-summary {
    gap: 8px;
    margin-bottom: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  section.log-page[data-work-log="true"] .summary-tile-work {
    padding: 10px 12px;
    border-radius: 10px;
  }
  section.log-page[data-work-log="true"] .summary-num {
    font-size: 18px;
  }
  section.log-page[data-work-log="true"] .summary-label {
    font-size: 10px;
    letter-spacing: 1.2px;
  }
  section.log-page[data-work-log="true"] .work-log-col-odo-start,
  section.log-page[data-work-log="true"] .work-log-col-odo-end {
    display: none !important;
  }
  section.log-page[data-work-log="true"] .work-log-detail-body {
    padding: 0 14px 12px;
  }
  section.log-page[data-work-log="true"] .work-log-detail-line {
    font-size: 14px;
  }
}

/* ---------- Checklist Page ---------- */
.checklist-page {
  max-width: 820px;
  margin: 0 auto;
  padding: calc(32px + env(safe-area-inset-top, 0px)) 24px 60px;
}

.checklist-header {
  text-align: center;
  margin-bottom: 24px;
}

.checklist-header h1 {
  margin: 0 0 6px;
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 800;
  letter-spacing: -0.5px;
}

.checklist-date {
  margin: 0;
  color: #6b7785;
  font-size: 14px;
  font-weight: 500;
}

/* Progress + cleaning timer stick together (same width as task cards) */
.checklist-sticky-top {
  position: sticky;
  top: calc(12px + env(safe-area-inset-top, 0px));
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.progress-wrap {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 0;
  box-shadow: var(--shadow);
}

.progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #4a5560;
}

.progress-count {
  color: var(--black);
  font-size: 15px;
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--light-blue-soft);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--light-blue), var(--light-blue-strong));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.next-task-hint {
  margin: 12px 0 0;
  padding: 0;
  font-size: 15px;
  font-weight: 600;
  color: #0a4f72;
  line-height: 1.35;
}

.next-task-hint:empty {
  display: none;
}

.task-group-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 8px;
}

.task-group-title-row h2 {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.section-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #0a4f72;
  background: var(--light-blue-soft);
  border: 1px solid var(--light-blue);
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.section-chip[hidden] {
  display: none !important;
}

.section-title-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 100%;
}

.section-timing-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 0;
}

.section-timing-wrap[hidden] {
  display: none !important;
}

.section-timing-wrap .section-duration-prev {
  animation: markerPop 0.25s ease-out;
}

.section-timing-wrap .section-duration-current {
  animation: markerPop 0.25s ease-out;
}

.checklist {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.task-group {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 22px;
  box-shadow: var(--shadow);
}

.task-group h2 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #0a4f72;
}

.cleaner-badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 10px;
  background: var(--light-blue-soft);
  color: #0a4f72;
  border: 1px solid var(--light-blue);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.process-note {
  margin: 0 0 10px;
  padding: 10px 12px;
  background: var(--off-white);
  border-left: 3px solid var(--light-blue-strong);
  border-radius: 6px;
  font-size: 13px;
  color: #4a5560;
}

.process-note strong {
  color: var(--black);
}

.task-group h2 + .cleaner-badge,
.task-group h2 + .process-note,
.task-group-title-row + .cleaner-badge,
.task-group-title-row + .process-note {
  margin-top: 0;
}

.cleaner-badge + .process-note {
  margin-top: 4px;
}

.cleaner-badge + .task-list,
.process-note + .task-list {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 2px solid var(--light-blue-soft);
}

.task-group > .task-group-title-row + .task-list {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 2px solid var(--light-blue-soft);
}

.task-group > h2 + .task-list {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 2px solid var(--light-blue-soft);
}

.task-list span em {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  font-style: italic;
  color: #6b7785;
  font-weight: 500;
}

.task-list span em.warn {
  color: #b8401b;
  font-weight: 600;
}

/* Optional / Add-Ons section */
.task-group.optional {
  background: linear-gradient(180deg, var(--off-white) 0%, var(--white) 100%);
  border-style: dashed;
  border-color: var(--light-blue);
}

.task-group.optional h2 {
  color: var(--black);
  margin-bottom: 4px;
}

.optional-subtitle {
  margin: 0 0 10px;
  font-size: 13px;
  font-style: italic;
  color: #6b7785;
  font-weight: 500;
}

.optional-subtitle + .task-list {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 2px solid var(--light-blue-soft);
}

/* ---------- After photos upload ---------- */
.photo-upload-group {
  border-color: var(--light-blue-strong);
}

.photo-upload-group > h2 {
  margin-bottom: 6px;
}

.photo-upload-subtitle {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: #0a4f72;
}

.photo-upload-body {
  margin-top: 2px;
}

.photo-upload-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.btn-photo-add {
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  border-radius: 12px;
  cursor: pointer;
  border: 2px solid var(--light-blue-strong);
  background: var(--light-blue-soft);
  color: #0a4f72;
  transition: background 0.2s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

label.btn-photo-add {
  display: inline-block;
}

.btn-photo-add:hover {
  background: var(--light-blue);
}

.btn-photo-add:active {
  transform: translateY(1px);
}

#photoInput:disabled + .btn-photo-add {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

#photoInput:disabled + .btn-photo-add:hover {
  background: var(--light-blue-soft);
}

.photo-upload-hint {
  margin: 0 0 14px;
  font-size: 12px;
  color: #6b7785;
}

.photo-upload-status {
  margin: -6px 0 14px;
  min-height: 1.35em;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.photo-upload-status--info {
  color: #0a4f72;
}

.photo-upload-status--success {
  color: #15803d;
}

.photo-upload-status--error {
  color: #b91c1c;
}

.photo-upload-group.is-adding .photo-upload-actions {
  opacity: 0.72;
  pointer-events: none;
}

.photo-count {
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--black);
}

.photo-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
}

.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--off-white);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(11, 11, 13, 0.72);
  color: var(--white);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.photo-thumb-remove:hover {
  background: #dc2626;
}

.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.task-list li {
  border-bottom: 1px solid var(--border);
}

.task-list li:last-child {
  border-bottom: none;
}

.task-list label {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 4px;
  cursor: pointer;
  font-size: 16px;
  user-select: none;
}

.task-list input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: 2px solid var(--light-blue);
  border-radius: 6px;
  background: var(--white);
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.task-list input[type="checkbox"]:hover {
  border-color: var(--light-blue-strong);
}

.task-list input[type="checkbox"]:checked {
  background: var(--light-blue-strong);
  border-color: var(--light-blue-strong);
}

.task-list input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid var(--white);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

.task-list li.checked > label > span:not(.task-timing-cluster) {
  text-decoration: line-through;
  color: #9aa6b2;
}

.task-timing-cluster {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.task-duration-prev {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  animation: markerPop 0.25s ease-out;
}

.task-duration-prev-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #64748b;
}

.task-duration-prev-time {
  font-family: "SF Mono", Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}

.task-duration-marker {
  margin-left: 0;
  align-self: center;
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  background: var(--light-blue-soft);
  color: #0a4f72;
  border: 1px solid var(--light-blue);
  border-radius: 999px;
  font-family: "SF Mono", Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
  white-space: nowrap;
  flex-shrink: 0;
  animation: markerPop 0.25s ease-out;
}

.task-list li.checked .task-timing-cluster,
.task-list li.checked .task-timing-cluster * {
  text-decoration: none;
}

@keyframes markerPop {
  0%   { transform: scale(0.6); opacity: 0; }
  60%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.task-list li.checked .task-duration-marker {
  opacity: 1;
}

.notes-group textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-family: inherit;
  font-size: 15px;
  resize: vertical;
  background: var(--off-white);
  color: var(--black);
}

.notes-group textarea:focus {
  outline: none;
  border-color: var(--light-blue-strong);
  background: var(--white);
}

.cancel-cleaning-bar {
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--white);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.cancel-cleaning-hint {
  margin: 0;
  font-size: 14px;
  color: #4a5560;
  line-height: 1.45;
}

.btn-cancel-session {
  flex: 0 0 auto !important;
  align-self: flex-start;
  min-height: 48px;
}

.checklist-actions {
  display: flex;
  gap: 12px;
}

.btn-primary,
.btn-secondary {
  flex: 1;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.btn-primary {
  background: var(--black);
  color: var(--white);
  border: 2px solid var(--black);
}

.btn-primary:hover {
  background: var(--light-blue-strong);
  border-color: var(--light-blue-strong);
  color: var(--white);
  transform: translateY(-2px);
}

/* Checklist only: all required tasks checked — green pulse on Mark Complete */
#completeBtn.is-complete-ready {
  background: #16a34a;
  color: #ffffff;
  border-color: #166534;
  animation: completeGlow 2s ease-in-out infinite;
}

#completeBtn.is-complete-ready:hover {
  background: #22c55e;
  border-color: #15803d;
  color: #ffffff;
  transform: translateY(-2px);
}

#completeBtn.is-complete-ready:active {
  background: #15803d;
  border-color: #14532d;
  transform: translateY(1px);
  animation: none;
}

@keyframes completeGlow {
  0%, 100% {
    box-shadow:
      0 0 0 0 rgba(34, 197, 94, 0.55),
      0 8px 24px rgba(22, 163, 74, 0.35);
  }
  50% {
    box-shadow:
      0 0 0 14px rgba(34, 197, 94, 0),
      0 12px 28px rgba(22, 163, 74, 0.45);
  }
}

.btn-secondary {
  background: var(--white);
  color: var(--black);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--light-blue);
  background: var(--light-blue-soft);
}

.complete-banner {
  margin-top: 18px;
  padding: 16px 20px;
  background: var(--light-blue-soft);
  border: 1px solid var(--light-blue);
  border-radius: 12px;
  text-align: center;
  font-weight: 700;
  color: #0a4f72;
}

/* ---------- Cleaning Timer (full width like task groups; sticky via .checklist-sticky-top) ---------- */
.cleaning-timer {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 12px 16px;
  margin: 0;
  width: 100%;
  max-width: none;
  background: var(--black);
  border: 2px solid var(--light-blue);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.timer-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--light-blue);
  align-self: flex-start;
}

.timer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.timer-display {
  font-family: "SF Mono", Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--white);
  font-variant-numeric: tabular-nums;
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}

.timer-toggle {
  flex-shrink: 0;
  background: var(--light-blue);
  color: var(--black);
  border: none;
  border-radius: 999px;
  min-width: 128px;
  width: 128px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 10px;
  line-height: 1;
  transition: background 0.15s ease, transform 0.1s ease;
}

.timer-toggle:hover {
  background: var(--light-blue-strong);
  color: var(--white);
}

.timer-toggle:active {
  transform: scale(0.92);
}

.timer-icon {
  display: inline-block;
  line-height: 1;
}

.timer-avg-line {
  margin: 2px 0 0;
  padding: 0;
  max-width: none;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  color: #93c5fd;
  text-align: left;
}

.timer-avg-line[hidden] {
  display: none !important;
}

.cleaning-timer.paused .timer-avg-line {
  opacity: 0.85;
}

.cleaning-timer.paused {
  border-color: #f4b740;
}

.cleaning-timer.paused .timer-label {
  color: #f4b740;
}

.cleaning-timer.paused .timer-display {
  opacity: 0.7;
}

.cleaning-timer.completed {
  border-color: #4ade80;
}

.cleaning-timer.completed .timer-label {
  color: #4ade80;
}

/* ---------- Milestone Banner (progress celebrations) ---------- */
.milestone-banner {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
  pointer-events: none;
  padding: calc(24px + env(safe-area-inset-top, 0px))
    calc(24px + env(safe-area-inset-right, 0px))
    calc(24px + env(safe-area-inset-bottom, 0px))
    calc(24px + env(safe-area-inset-left, 0px));
  background: rgba(11, 11, 13, 0.18);
  animation: fadeIn 0.18s ease-out;
  transition: background 0.4s ease;
}

/* Full-screen green glow for the 100% celebration */
.milestone-banner.lvl-100 {
  background:
    radial-gradient(circle at center,
      rgba(34, 197, 94, 0.55) 0%,
      rgba(22, 163, 74, 0.35) 40%,
      rgba(11, 11, 13, 0.20) 80%);
  animation: fadeIn 0.18s ease-out, screenGlow 1.9s ease-out forwards;
}

.milestone-card {
  font-size: clamp(28px, 7.5vw, 64px);
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 28px 40px;
  border-radius: 24px;
  text-align: center;
  color: var(--black);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  transform: scale(0.5);
  opacity: 0;
  animation: milestonePop 1.9s cubic-bezier(.34, 1.56, .64, 1) forwards;
  max-width: 90vw;
}

/* Color gradient: blue (25%) -> green (100%) */
.milestone-card.lvl-25 {
  background: #7dd3fc;
  color: #0b1f3d;
  box-shadow: 0 24px 60px rgba(125, 211, 252, 0.45);
}

.milestone-card.lvl-50 {
  background: #5eead4;
  color: #0b1f1d;
  box-shadow: 0 24px 60px rgba(94, 234, 212, 0.45);
}

.milestone-card.lvl-75 {
  background: #86efac;
  color: #052e16;
  box-shadow: 0 24px 60px rgba(134, 239, 172, 0.55);
}

.milestone-card.lvl-100 {
  background: #22c55e;
  color: #ffffff;
  font-size: clamp(30px, 8vw, 72px);
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.35) inset,
    0 0 60px 10px rgba(34, 197, 94, 0.65),
    0 24px 80px rgba(22, 163, 74, 0.55);
}

@keyframes milestonePop {
  0%   { transform: scale(0.5); opacity: 0; }
  18%  { transform: scale(1.18); opacity: 1; }
  35%  { transform: scale(0.95); }
  55%  { transform: scale(1.04); }
  82%  { transform: scale(1); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

@keyframes screenGlow {
  0%   { background:
           radial-gradient(circle at center,
             rgba(34, 197, 94, 0.0) 0%,
             rgba(22, 163, 74, 0.0) 40%,
             rgba(11, 11, 13, 0.18) 80%); }
  20%  { background:
           radial-gradient(circle at center,
             rgba(34, 197, 94, 0.65) 0%,
             rgba(22, 163, 74, 0.45) 40%,
             rgba(11, 11, 13, 0.25) 80%); }
  60%  { background:
           radial-gradient(circle at center,
             rgba(34, 197, 94, 0.55) 0%,
             rgba(22, 163, 74, 0.35) 40%,
             rgba(11, 11, 13, 0.22) 80%); }
  100% { background:
           radial-gradient(circle at center,
             rgba(34, 197, 94, 0.0) 0%,
             rgba(22, 163, 74, 0.0) 40%,
             rgba(11, 11, 13, 0.0) 80%); }
}

/* ---------- Modal (Incomplete Tasks Confirmation) ---------- */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 11, 13, 0.55);
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: calc(20px + env(safe-area-inset-top, 0px))
    calc(20px + env(safe-area-inset-right, 0px))
    calc(20px + env(safe-area-inset-bottom, 0px))
    calc(20px + env(safe-area-inset-left, 0px));
}

.modal-backdrop.is-open {
  display: flex;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--white);
  border-radius: 18px;
  border: 2px solid var(--light-blue);
  padding: 28px 28px 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  text-align: center;
  animation: popIn 0.2s ease-out;
}

@keyframes popIn {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal h2 {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 800;
  color: var(--black);
  letter-spacing: -0.3px;
}

.modal p {
  margin: 0 0 22px;
  color: #4a5560;
  font-size: 16px;
  line-height: 1.45;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-btn {
  width: 100%;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  border: 2px solid;
  transition: background 0.15s ease, color 0.15s ease,
    border-color 0.15s ease, transform 0.1s ease;
}

.modal-btn:active {
  transform: translateY(1px);
}

.modal-no {
  background: var(--light-blue);
  color: var(--black);
  border-color: var(--light-blue);
}

.modal-no:hover {
  background: var(--light-blue-strong);
  border-color: var(--light-blue-strong);
  color: var(--white);
}

.modal-yes {
  background: var(--white);
  color: var(--black);
  border-color: var(--border);
}

.modal-yes:hover {
  background: var(--off-white);
  border-color: #b8401b;
  color: #b8401b;
}

.modal-btn.modal-danger {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

.modal-btn.modal-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #ffffff;
}

.modal-btn.modal-danger:active {
  background: #991b1b;
  border-color: #991b1b;
  color: #ffffff;
}

.modal-summary .summary-title {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.modal-summary .summary-message {
  margin: 0 0 20px;
  font-size: 1.05rem;
  line-height: 1.5;
  color: #374151;
  font-weight: 600;
}

.modal-actions-single {
  display: flex;
  justify-content: stretch;
}

.modal-actions-single .modal-btn {
  flex: 1;
}

.modal-btn.modal-primary-solid {
  background: #16a34a;
  color: #ffffff;
  border-color: #15803d;
}

.modal-btn.modal-primary-solid:hover {
  background: #22c55e;
  border-color: #166534;
  color: #ffffff;
}

/* Home dashboard: force two columns (overrides stale cache / extensions) */
.home-main.home-dashboard section.locations > .location-list {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px 12px;
  width: 100%;
  align-items: stretch;
}

/* Very narrow phones: one column so titles and “Last cleaned” stay readable */
@media (max-width: 480px) {
  .home-main.home-dashboard section.locations > .location-list {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px;
  }
}

.home-main.home-dashboard section.locations > .location-list > .location-btn {
  box-sizing: border-box;
}

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
  /* Hero */
  .hero {
    padding: calc(44px + env(safe-area-inset-top, 0px)) 20px 24px;
  }
  .home-main.home-dashboard .home-dashboard-top + .hero {
    padding-top: 18px;
  }
  .hero h1 {
    font-size: 30px;
  }

  .home-sounds-toggle {
    font-size: 10px;
    padding: 4px 9px;
  }

  /* Home page locations */
  .locations {
    padding: 12px 16px 32px;
  }

  /*
   * Stack work session under log links so the nav column is not squeezed
   * against a fixed right padding reserved for the floating card.
   */
  .home-main.home-dashboard .home-dashboard-top {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding-right: max(16px, env(safe-area-inset-right, 12px));
  }
  .home-main.home-dashboard .home-nav-eyebrow {
    margin-bottom: 6px;
  }
  .home-main.home-dashboard .home-dashboard-nav-stack {
    width: 100%;
    max-width: none;
  }
  .home-main.home-dashboard .home-dashboard-top .work-session-card {
    position: static;
    top: auto;
    right: auto;
    width: 100%;
    max-width: none;
    margin-top: 12px;
    padding: 12px 14px;
    align-self: stretch;
    box-sizing: border-box;
  }
  .home-main.home-dashboard .work-session-title {
    font-size: 14px;
  }
  .home-main.home-dashboard .work-session-stat span {
    font-size: 10px;
  }
  .home-main.home-dashboard .work-session-stat strong {
    font-size: 12px;
  }
  .home-main.home-dashboard .work-session-status {
    font-size: 12px;
  }
  .home-main.home-dashboard .work-session-actions .work-session-toggle-btn {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 14px;
  }
  .backup-bar {
    padding: 10px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  }
  .btn-update-app {
    padding: 11px 24px;
    font-size: 14px;
  }
  .app-update-sheet-body {
    padding: 16px 16px 22px;
  }
  .location-btn {
    padding: 10px 8px;
    font-size: 14px;
    border-radius: 12px;
    line-height: 1.25;
  }
  .location-list > a.location-btn[data-loc-tag] {
    padding: 10px 8px 20px;
  }
  .location-list > a.location-btn[data-loc-tag]::after {
    right: 8px;
    bottom: 4px;
    font-size: 9px;
  }
  .location-btn__last {
    font-size: 10px;
    line-height: 1.2;
  }

  .location-list {
    gap: 10px 12px;
  }

  .calendar-page {
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  }
  .calendar-shell {
    min-height: calc(100vh - 36px);
    min-height: calc(100dvh - 36px);
    padding-left: 10px;
    padding-right: 10px;
  }
  .calendar-header {
    grid-template-columns: 46px 1fr 46px;
    gap: 8px;
    margin-bottom: 10px;
  }
  .calendar-nav-btn {
    width: 46px;
    height: 46px;
    font-size: 20px;
  }
  .calendar-weekdays,
  .calendar-grid {
    gap: 6px;
  }
  .calendar-grid {
    grid-auto-rows: minmax(92px, 120px);
  }
  .calendar-add-panel {
    margin-bottom: 10px;
    padding: 8px 10px;
  }
  .calendar-add-hint {
    font-size: 11px;
  }
  .calendar-add-hint--secondary {
    font-size: 10px;
  }
  .calendar-mode-controls {
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 6px;
    padding-bottom: 0;
    gap: 6px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .calendar-delete-actions {
    padding-left: 10px;
    padding-right: 10px;
    flex-direction: column;
    align-items: stretch;
  }
  .calendar-delete-count {
    font-size: 12px;
  }
  .calendar-schedule-edit-btn {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    font-size: 20px;
  }
  .calendar-day-count {
    left: 8px;
    top: 6px;
    min-width: 20px;
    min-height: 18px;
    font-size: 10px;
    line-height: 18px;
  }

  .calendar-add-row {
    grid-template-columns: 1fr;
  }
  .calendar-add-confirm {
    width: 100%;
  }
  .calendar-day {
    padding: 5px 10px;
    border-radius: 10px;
    font-size: clamp(14px, 4.2vw, 20px);
  }
  .calendar-day-num {
    top: 6px;
    right: 10px;
    line-height: 1;
  }
  .calendar-day-schedule {
    margin-top: 28px;
    gap: 1px;
    max-height: calc(100% - 28px);
    padding-right: 0;
    -webkit-mask-image: linear-gradient(to bottom, #000 80%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 80%, transparent 100%);
  }
  .calendar-day-schedule-row {
    font-size: 10px;
    line-height: 1.2;
  }
  .calendar-day-schedule-location {
    -webkit-mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 0.38em), transparent 100%);
    mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 0.38em), transparent 100%);
  }
  .calendar-day-schedule-time {
    padding-right: 3px;
  }

  .home-main.home-dashboard section.locations > .location-list {
    gap: 10px 12px;
  }

  /* Page wrappers */
  .location-page,
  .checklist-page,
  .log-page {
    padding: 20px 16px 56px;
    padding-top: calc(24px + env(safe-area-inset-top, 0px));
  }
  /* Back link */
  .back-link {
    padding: 12px 18px;
    font-size: 15px;
    margin-bottom: 20px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .back-link.home-dashboard-log-link {
    margin-bottom: 0;
  }

  /* Location info cards */
  .info-grid {
    gap: 12px;
  }
  .info-card {
    padding: 18px 20px;
  }
  .info-link {
    margin-top: 10px;
    padding: 10px 0;
    font-size: 15px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* Start Cleaning + View Cleaning Log */
  .start-btn {
    padding: 22px;
    font-size: 18px;
    min-height: 64px;
  }
  .log-btn {
    padding: 20px;
    font-size: 17px;
    margin-top: 14px;
    min-height: 60px;
  }

  /* Checklist tasks (bigger tap targets) */
  .task-list label {
    font-size: 16px;
    padding: 16px 4px;
    gap: 16px;
    min-height: 56px;
  }
  .task-list input[type="checkbox"] {
    width: 28px;
    height: 28px;
    border-width: 2px;
    border-radius: 7px;
  }
  .task-list input[type="checkbox"]:checked::after {
    left: 8px;
    top: 3px;
    width: 8px;
    height: 14px;
    border-width: 0 3px 3px 0;
  }
  .task-list span em {
    font-size: 13px;
    margin-top: 6px;
    line-height: 1.4;
  }
  .task-timing-cluster {
    flex-wrap: wrap;
    justify-content: flex-end;
    row-gap: 6px;
    max-width: 100%;
  }
  .task-duration-prev {
    font-size: 12px;
    padding: 5px 12px;
  }
  .task-duration-prev-time,
  .task-duration-marker {
    font-size: 13px;
  }
  .task-group {
    padding: 18px 18px 8px;
  }
  .task-group h2 {
    font-size: 15px;
  }

  .btn-photo-add {
    padding: 16px 20px;
    min-height: 52px;
    font-size: 16px;
    width: 100%;
  }
  .photo-upload-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .photo-count {
    font-size: 15px;
  }

  /* Cleaner badges + process notes */
  .cleaner-badge {
    font-size: 12px;
    padding: 5px 12px;
  }
  .process-note {
    font-size: 13px;
    padding: 12px 14px;
  }

  /* Notes textareas (16px font prevents iOS auto-zoom) */
  .notes-group textarea {
    font-size: 16px;
    padding: 14px;
    border-radius: 12px;
  }

  /* Action buttons */
  .checklist-actions {
    flex-direction: column;
    gap: 12px;
  }
  .btn-primary,
  .btn-secondary {
    padding: 20px;
    font-size: 17px;
    min-height: 60px;
    border-radius: 14px;
  }

  /* Modal */
  .modal-backdrop {
    padding: calc(16px + env(safe-area-inset-top, 0px))
      calc(16px + env(safe-area-inset-right, 0px))
      calc(16px + env(safe-area-inset-bottom, 0px))
      calc(16px + env(safe-area-inset-left, 0px));
  }
  .modal {
    padding: 24px 22px 22px;
    border-radius: 20px;
  }
  .modal h2 {
    font-size: 20px;
  }
  .modal p {
    font-size: 15px;
    margin-bottom: 18px;
  }
  .modal-btn {
    padding: 18px 16px;
    font-size: 16px;
    min-height: 56px;
    border-radius: 14px;
  }
  .modal-actions {
    gap: 12px;
  }

  /* Cleaning timer — full width under progress inside sticky stack */
  .cleaning-timer {
    padding: 12px 14px;
    gap: 6px;
    border-radius: 14px;
  }
  .checklist-sticky-top {
    gap: 10px;
    margin-bottom: 20px;
  }
  .timer-label {
    font-size: 9px;
  }
  .timer-display {
    font-size: 18px;
  }
  .timer-toggle {
    min-width: 152px;
    width: 152px;
    height: 52px;
    font-size: 17px;
    padding: 0 14px;
  }
  .timer-avg-line {
    font-size: 10px;
  }
  .next-task-hint {
    font-size: 14px;
  }
  .section-chip {
    min-width: 40px;
    padding: 5px 11px;
    font-size: 12px;
  }
  .section-title-meta {
    gap: 6px;
    max-width: min(100%, 280px);
    justify-content: flex-end;
  }
  .section-timing-wrap .task-duration-prev,
  .section-timing-wrap .task-duration-marker {
    font-size: 10px;
    padding: 3px 8px;
  }

  /* Log page summary tiles */
  .summary-tile {
    padding: 14px 16px;
  }
  .summary-num {
    font-size: 20px;
  }
  .log-actions {
    margin-top: 20px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .log-actions .btn-secondary {
    width: 100%;
    min-width: 0;
    flex: 1;
    min-height: 56px;
  }

  .work-log-head {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Touch press feedback for buttons that don't already have :active styling */
.location-btn:active,
.start-btn:active,
.log-btn:active,
.back-link:active,
.btn-primary:active,
.btn-secondary:active,
.info-link:active {
  transform: scale(0.98);
  transition-duration: 0.05s;
}
