/* ============ Base ============ */
:root {
  --blue: #1554d1;
  --blue-dark: #0f3f9e;
  --blue-soft: #e8effc;
  --ink: #16202e;
  --ink-soft: #5b6878;
  --line: #e3e8ef;
  --bg: #f2f4f8;
  --card: #ffffff;
  --green: #14804a;
  --green-soft: #e1f4ea;
  --amber: #9a6700;
  --amber-soft: #fff3d1;
  --gray-soft: #e9edf2;
  --danger: #c62838;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(22, 32, 46, 0.08), 0 4px 14px rgba(22, 32, 46, 0.06);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  overflow-x: hidden;
}

button { font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ============ App bar ============ */
/* Compact + translucent: the page scrolls underneath, the blur keeps the
   title legible, and the bar costs ~1/3 less height than the old blue slab. */
.appbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  /* Solid, and deliberately NO backdrop-filter: on a number of Android GPUs
     a blurred translucent layer paints as an opaque white block or smears
     white over the content beneath it. This app already dropped
     backdrop-filter from the map action bar for that reason; the app bar sits
     over every tech page, so it matters more here. Visually near-identical —
     it was 78% of this same colour. */
  background: var(--bg);
  color: var(--ink);
  padding: calc(env(safe-area-inset-top) + 4px) 10px 4px;
}
.appbar-title {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appbar-back {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  font-size: 26px; line-height: 1;
  border-radius: 10px;
  background: var(--blue-soft);
  color: var(--blue);
}
.appbar-spacer { width: 38px; height: 38px; }
.appbar-user button {
  width: 38px; height: 38px;
  border: 0; background: none;
  display: grid; place-items: center;
}
.appbar-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: grid; place-items: center;
}

/* The app bar is sticky, so anything scrolled to programmatically (a
   validation jump to the offending question, wizard step changes, a photo
   grid) would land UNDERNEATH it — the tech sees their field hidden behind a
   pale bar. scroll-padding keeps every scroll-into-view clear of it. */
html { scroll-padding-top: 64px; scroll-padding-bottom: 24px; }

/* ============ Page ============ */
.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(env(safe-area-inset-bottom) + 96px);
}

.greeting { font-size: 17px; font-weight: 600; margin-bottom: 12px; }

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.list-count { color: var(--ink-soft); font-size: 14px; }

.empty-state {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 20px;
  text-align: center;
  color: var(--ink-soft);
  display: grid;
  gap: 12px;
  justify-items: center;
  margin-bottom: 16px;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:active { background: var(--blue-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-soft { background: #fdeaec; border-color: transparent; color: var(--danger); }
.btn-danger-soft:active { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-block + .btn-block { margin-top: 10px; }
.btn-small { min-height: 40px; padding: 8px 14px; font-size: 14px; }
.btn-xl { min-height: 60px; font-size: 19px; letter-spacing: 0.4px; }

.sticky-actions {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(env(safe-area-inset-bottom) + 64px); /* clears the bottom nav */
  padding: 10px 16px calc(env(safe-area-inset-bottom) + 12px);
  background: var(--bg);
  border-top: 1px solid rgba(0, 0, 0, .08);
  box-shadow: 0 -8px 24px rgba(15, 26, 46, .08);
  max-width: 560px;
  margin: 0 auto;
  z-index: 40;
}
/* No bottom nav (technicians) — drop the actions to the bottom edge */
body.no-tabbar .sticky-actions {
  bottom: 0;
  padding-bottom: calc(env(safe-area-inset-bottom) + 12px);
}

/* ============ Status badges ============ */
.status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.status-not_started { background: var(--gray-soft); color: var(--ink-soft); }
.status-in_progress { background: var(--amber-soft); color: var(--amber); }
.status-completed   { background: var(--green-soft); color: var(--green); }

.status-big {
  font-size: 20px;
  font-weight: 800;
  padding: 16px;
  border-radius: 12px;
  text-align: center;
}

/* ============ Site cards ============ */
.card-list { display: grid; gap: 12px; }

.site-card {
  display: block;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  -webkit-tap-highlight-color: transparent;
}
.site-card:active { background: var(--blue-soft); }
.site-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.site-card-name { font-size: 17px; font-weight: 700; }
.site-card-address { color: var(--ink-soft); font-size: 14px; line-height: 1.45; margin-bottom: 10px; }
.site-card-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 600;
}

/* ============ Panels / info list ============ */
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.panel-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink-soft);
  margin-bottom: 12px;
}
.info-list { display: grid; gap: 12px; }
.info-row { display: grid; grid-template-columns: 110px 1fr; gap: 8px; }
.info-row dt { color: var(--ink-soft); font-size: 14px; }
.info-row dd { font-weight: 600; font-size: 15px; line-height: 1.4; }

/* ============ Forms ============ */
.form { display: grid; gap: 14px; }
/* Invalid state, shared by every form */
input.is-invalid, textarea.is-invalid, select.is-invalid { border-color: var(--danger); }
input.is-invalid:focus, textarea.is-invalid:focus {
  outline-color: var(--danger);
  border-color: var(--danger);
}
.page > .form { padding-bottom: 140px; } /* clear the fixed sticky-actions bar entirely */
.form-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  background: var(--card);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
}
.form-status-label { font-size: 14px; color: var(--ink-soft); font-weight: 600; }

.field { display: grid; gap: 6px; }
.field-label { font-size: 14px; font-weight: 600; color: var(--ink-soft); }
/* Forms opting in via data-required-marks flag their required fields with a
   red asterisk, driven by the required attribute so it can never drift from
   what validation actually enforces. */
[data-required-marks] .field:has([required]) .field-label::after {
  content: " *";
  color: var(--danger);
}
/* Checkboxes/radios (e.g. the technician checklist) keep their native
   compact look — the text-field skin must never land on them. */
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea {
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  font-size: 16px; /* prevents iOS zoom */
  font-family: inherit; /* textareas default to monospace otherwise */
  color: var(--ink);
  width: 100%;
}
.field textarea { resize: vertical; line-height: 1.45; }
.field input:not([type="checkbox"]):not([type="radio"]):focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
  border-color: var(--blue);
}
/* State + City share the row; minmax(0,·) lets long labels truncate
   instead of blowing the columns out. */
.field-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 12px; }

.file-input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  overflow: hidden;
}
.file-trigger {
  display: grid;
  place-items: center;
  min-height: 56px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  color: var(--blue);
  font-weight: 700;
  background: var(--blue-soft);
}

/* ============ Login ============ */
/* The login screen is chromeless: no app bar, the page is the brand surface */
body:has(.page-login) .appbar { display: none; }

.page-login {
  position: relative;
  min-height: 100dvh;
  padding-top: max(9dvh, 48px);
}
/* Soft brand glow behind the hero */
.page-login::before {
  content: "";
  position: absolute;
  top: -180px;
  left: 50%;
  transform: translateX(-50%);
  width: 640px;
  height: 520px;
  background: radial-gradient(closest-side, rgba(21, 84, 209, 0.16), transparent 72%);
  z-index: -1;
  pointer-events: none;
}

.login-hero {
  text-align: center;
  margin-bottom: 30px;
  animation: login-rise 0.45s ease both;
}
.login-logo img {
  display: block;
  margin: 0 auto;
  height: 42px;
  width: auto;
  max-width: min(260px, 70vw);
}
.login-title {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: var(--ink);
  margin-top: 22px;
}
.login-sub { color: var(--ink-soft); margin-top: 5px; font-size: 15px; }

.login-form {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(22, 32, 46, 0.05), 0 16px 40px rgba(22, 32, 46, 0.1);
  padding: 26px 20px;
  animation: login-rise 0.45s 0.08s ease both;
}
.page > .login-form { padding-bottom: 26px; } /* login submit is inline, not sticky */

.login-form .field input {
  background: #f5f7fa;
  border-color: #e8ecf2;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.login-form .field input:focus {
  outline: none;
  background: var(--card);
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(21, 84, 209, 0.14);
}
.login-form .field input.is-invalid { border-color: var(--danger); }
.login-form .field input.is-invalid:focus { box-shadow: 0 0 0 4px rgba(198, 40, 56, 0.14); }
.login-form .field input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #f5f7fa inset;
  -webkit-text-fill-color: var(--ink);
}
.login-form .field-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.login-form .btn-primary {
  background: linear-gradient(180deg, #2b6ae8 0%, var(--blue) 100%);
  border: 0;
  box-shadow: 0 8px 20px rgba(21, 84, 209, 0.32);
}
.login-form .btn-primary:active {
  background: var(--blue-dark);
  box-shadow: 0 4px 10px rgba(21, 84, 209, 0.3);
}
.login-form .btn-primary.is-loading {
  opacity: 0.75;
  pointer-events: none;
}
.page-login .alert-error {
  background: #fdeaec;
  border-left: 4px solid var(--danger);
  border-radius: 8px 12px 12px 8px;
}
.password-toggle {
  color: var(--ink-soft);
  display: grid;
  place-items: center;
}
.password-toggle svg { display: block; grid-area: 1 / 1; }
.password-toggle .eye-hide { visibility: hidden; }
.password-toggle.is-on .eye-show { visibility: hidden; }
.password-toggle.is-on .eye-hide { visibility: visible; }
.password-toggle:active { background: var(--gray-soft); }

.login-copy {
  text-align: center;
  margin-top: 26px;
  font-size: 12px;
  letter-spacing: 0.3px;
  color: #9aa4b2;
  animation: login-rise 0.45s 0.16s ease both;
}

.page-login .alert { animation: login-rise 0.3s ease both; }

@keyframes login-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert {
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
}
.alert-error { background: #fdeaec; color: var(--danger); }

.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 56px; }
.password-wrap input::-ms-reveal,
.password-wrap input::-ms-clear { display: none; }
.password-wrap input::-webkit-credentials-auto-fill-button,
.password-wrap input::-webkit-textfield-decoration-container {
  visibility: hidden;
  pointer-events: none;
}
.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  border: 0;
  background: none;
  border-radius: 10px;
}

/* ============ Bottom nav ============ */
.bottomnav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav-item {
  flex: 1;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 10px 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}
.bottomnav-item.is-active { color: var(--blue); }
.bottomnav-icon { font-size: 20px; }

/* ============ Workspace ============ */
.page-workspace { padding-bottom: calc(env(safe-area-inset-bottom) + 80px); }

.site-info-strip {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.site-info-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.site-info-main strong { font-size: 17px; }
.site-info-sub { color: var(--ink-soft); font-size: 13px; line-height: 1.5; }

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0 -16px 12px;
  padding: 0 16px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: var(--ink-soft);
  background: var(--gray-soft);
}
.tab.is-active { background: var(--ink); color: #fff; }

/* Map selector: centered "Map: <current>" pill + dropdown menu */
.map-select-wrap { position: relative; display: flex; justify-content: center; margin: 0 0 12px; }
.map-select {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 46px; padding: 0 18px; max-width: min(92vw, 420px);
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); box-shadow: var(--shadow);
  font-size: 15px; color: var(--ink);
}
.map-select:active { transform: scale(.98); }
.map-select-kicker { color: var(--ink-soft); font-size: 13px; }
.map-select strong { max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-select-caret { color: var(--ink-soft); font-size: 12px; }
.map-menu {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  z-index: 96; /* over the fullscreen map (90) and its floating chips (95) */
  width: min(92vw, 360px); padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 44px rgba(15, 26, 46, .22);
}
.map-menu-row { display: flex; align-items: center; gap: 6px; border-radius: 10px; }
.map-menu-row.is-active { background: rgba(31, 78, 140, .08); }
.map-menu-name {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 8px; color: var(--ink); text-decoration: none;
  font-weight: 600; overflow: hidden;
}
.map-menu-check { width: 18px; color: var(--blue); font-weight: 700; flex: none; }
.map-menu-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-menu-tool {
  flex: none; width: 40px; min-height: 40px; margin-right: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink-soft); text-decoration: none;
}
.map-menu-tool svg { width: 16px; height: 16px; }
.map-menu-tool.is-danger { color: var(--danger); }
.map-menu-tool:active { background: var(--ink-soft); color: #fff; }
.map-menu-tool.is-danger:active { background: var(--danger); color: #fff; }
.map-menu-add {
  width: 100%; min-height: 48px; margin-top: 4px;
  border: 1px dashed var(--line); border-radius: 10px;
  background: var(--blue-soft); color: var(--blue); font-weight: 700; font-size: 14px;
}

/* Enhancement status + variant picker (Original / Cleaned / Re-drawn) */
.map-variant-bar {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 0 0 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.map-variant-bar::-webkit-scrollbar { display: none; }
.map-variant-chip {
  flex-shrink: 0;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: inherit;
}
.map-variant-chip.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }
.map-variant-chip.is-busy { color: var(--blue); background: var(--blue-soft); border-color: transparent; }
.map-variant-chip.is-ready { color: var(--blue); background: var(--blue-soft); border-color: var(--blue); }
.map-variant-chip.is-failed { color: #b45309; background: #fef3c7; border-color: #fcd34d; }
@keyframes variant-pulse { 50% { opacity: 0.55; } }
.map-variant-chip.is-busy { animation: variant-pulse 1.6s ease-in-out infinite; }

/* Live progress chips: a filling track behind the label */
.map-progress {
  position: relative;
  flex-shrink: 0;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  overflow: hidden;
}
.map-progress-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: var(--blue-soft);
  transition: width 0.9s linear;
}
.map-progress-text { position: relative; white-space: nowrap; }

/* Map viewer */
.map-shell { position: relative; }
.map-viewport {
  position: relative;
  height: min(52dvh, 500px);
  background: #dde3ea;
  border-radius: var(--radius);
  overflow: hidden;
  touch-action: none;
  box-shadow: var(--shadow);
  /* Panning/tapping the map must never flash the OS blue tap-highlight
     rectangle or start a text selection. */
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.map-viewport * { -webkit-tap-highlight-color: transparent; }
.map-canvas {
  position: absolute;
  top: 0; left: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.map-canvas img {
  display: block;
  max-width: none;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}
.marker-layer { position: absolute; inset: 0; }

.map-marker {
  position: absolute;
  /* Long-press deletes: suppress the OS text-selection/callout gesture. */
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  transform: translate(-50%, -100%);
  display: grid;
  justify-items: center;
  gap: 0;
  border: 0;
  background: none;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.map-marker-pin {
  width: 36px; height: 36px;
  border-radius: 50% 50% 50% 4px;
  transform: rotate(-45deg);
  background: var(--blue);
  border: 3px solid #fff;
  box-shadow: 0 3px 8px rgba(0,0,0,0.35);
  display: grid;
  place-items: center;
}
.map-marker-pin span {
  transform: rotate(45deg);
  font-size: 17px;
}
/* Survey status lives on the pin border: green done, amber in progress. */
.map-marker[data-survey-status="complete"] .map-marker-pin { border-color: var(--green); }
.map-marker[data-survey-status="in_progress"] .map-marker-pin { border-color: #e9a13b; }
/* Details stored only on this device (offline queue, not yet synced) count
   as in-progress too: amber ring until the sync lands. */
.map-marker.is-pending .map-marker-pin,
.map-marker[data-queued-local] .map-marker-pin { border-color: #e9a13b; }
.map-marker-label:empty { display: none; } /* generic-type pins show the icon alone */
.map-marker-label {
  margin-top: 3px;
  background: rgba(22,32,46,0.85);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-viewport.is-placing { cursor: crosshair; }
.map-viewport.is-placing .map-canvas { outline: 3px dashed var(--blue); outline-offset: -3px; }

.placement-banner {
  position: absolute;
  top: 10px; left: 10px; right: 10px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--ink);
  color: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.placement-banner button {
  border: 0;
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-weight: 700;
  border-radius: 8px;
  padding: 8px 14px;
  min-height: 40px;
}

/* Tappable addresses (site cards, overview) — launch navigation */
.address-link {
  display: inline-block;
  color: var(--blue);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.address-link:active { opacity: 0.7; }

/* Tappable phone number on site cards */
.phone-link {
  color: var(--blue);
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.phone-link:active { opacity: 0.7; }

/* Live survey progress on office site cards (updated by office-sites.js) */
.site-progress { display: grid; gap: 4px; margin-top: 10px; }
.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--gray-soft);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--blue);
  transition: width 0.6s ease;
}
.progress-text { color: var(--ink-soft); font-size: 12px; font-weight: 600; }

/* Role chip on the Team list */
.role-chip {
  background: var(--gray-soft);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}
.role-chip.is-admin { background: var(--blue-soft); color: var(--blue); }

/* Multi-technician assignment checklist (office site form) */
.tech-checklist { display: grid; gap: 8px; }
.tech-check {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}
.tech-check:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.tech-check input { width: 20px; height: 20px; accent-color: var(--blue); }

/* Office staff in the assignment list (they work the site in tech mode) */
.tech-check-group { margin: 6px 0 0; }
.tech-check.is-office span small { font-weight: 500; color: var(--ink-soft); margin-left: 4px; }

/* ============ Tech mode (an office user working as a technician) ============ */
/* Amber ring on the appbar avatar — on every page while in tech mode. */
.appbar-avatar.is-techmode { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--amber); }
/* The notice at the top of the technician dashboard, with the way back. */
.techmode-note {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--amber-soft); border: 1px solid #f0dca4; border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 14px; color: var(--ink);
}
.techmode-note-text { flex: 1 1 200px; display: grid; gap: 2px; }
.techmode-note-text strong { color: var(--amber); }
.techmode-note-text small { color: var(--ink-soft); line-height: 1.35; }
.techmode-note form { flex: 0 0 auto; }
/* Online now: the session row of an office user in tech mode. */
.online-techmode {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  background: var(--amber-soft); color: var(--amber); font-size: 11px; font-weight: 700;
}
html.theme-dark .techmode-note { background: rgba(255, 196, 77, .12); border-color: rgba(255, 196, 77, .3); color: #e6e8ee; }
html.theme-dark .techmode-note-text strong { color: #ffd166; }
html.theme-dark .techmode-note-text small { color: #aeb6c6; }
html.theme-dark .online-techmode { background: rgba(255, 196, 77, .16); color: #ffd166; }
html.theme-dark .appbar-avatar.is-techmode { box-shadow: 0 0 0 2px #1a1e25, 0 0 0 4px #ffd166; }
html.theme-dark .tech-check.is-office span small { color: #aeb6c6; }

/* ============ Live co-editing ============ */
/* A teammate's freshly changed/placed pin pulses once */
@keyframes pin-pulse {
  0% { filter: drop-shadow(0 0 0 rgba(21, 84, 209, 0.9)); transform: translate(-50%, -100%) scale(1.25); }
  100% { filter: none; }
}
.map-marker.is-live-changed { animation: pin-pulse 1.2s ease; }

/* Both techs edited the same field */
.live-conflict {
  margin-top: 8px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  padding: 8px 10px;
}

/* Today's Changes feed */
.change-question { margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.change-values { margin-top: 2px; font-size: 14px; line-height: 1.45; word-break: break-word; }
.change-values s { color: var(--danger); opacity: 0.8; }
.change-current { display: block; margin-top: 6px; color: var(--green); font-weight: 600; }
.change-revert-form { margin-top: 8px; }

/* ============ Sync status pill ============ */
.sync-pill {
  /* A slim docked strip in the page flow — takes its own space, never
     floats over content; sticks just below the app bar while scrolling. */
  position: sticky;
  top: 50px;
  /* No `display` here on purpose: an author display rule overrides the UA's
     [hidden]{display:none}, which left the pill stuck on screen forever
     once sync.js had shown it. A div is display:block anyway. */
  margin: -6px -16px 10px;
  text-align: center;
  z-index: 60;
  font-size: 12px;
  font-weight: 700;
  border-radius: 0 0 10px 10px;
  padding: 6px 12px;
  max-width: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sync-pill.is-offline { background: var(--amber-soft); color: var(--amber); }
.sync-pill.is-pending { background: var(--blue-soft); color: var(--blue); }
.sync-pill.is-ok { background: var(--green-soft); color: var(--green); }
.sync-pill.is-stale { background: #fdeaec; color: var(--danger); }

/* ============ Live checks widget (workspace) ============ */
.checks-chip {
  position: fixed;
  left: 12px;
  bottom: calc(env(safe-area-inset-bottom) + 18px);
  z-index: 95; /* above the fullscreen map (90), below sheets/modals (100) */
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  background: var(--green-soft);
  color: var(--green);
  box-shadow: var(--shadow);
  -webkit-tap-highlight-color: transparent;
}
.checks-chip.has-open { background: var(--amber-soft); color: var(--amber); }
.checks-sheet-body { max-height: 55dvh; overflow-y: auto; margin-bottom: 12px; }
.checks-toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 80px);
  transform: translateX(-50%);
  z-index: 95;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  border-radius: 999px;
  padding: 10px 18px;
  box-shadow: var(--shadow);
  animation: checks-toast-fade 2.4s ease both;
}
@keyframes checks-toast-fade {
  0% { opacity: 0; transform: translateX(-50%) translateY(8px); }
  12%, 80% { opacity: 1; transform: translateX(-50%); }
  100% { opacity: 0; }
}

/* ============ Pre-completion checks ============ */
.check-all-clear { color: var(--green); font-weight: 600; }
.check-row {
  border-left: 4px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--bg);
}
.check-row.is-hard { border-left-color: var(--danger); background: #fdf3f4; }
.check-row.is-open { border-left-color: #e9a13b; background: var(--amber-soft); }
.check-row.is-acked { border-left-color: var(--green); background: var(--green-soft); }
.check-title { display: flex; gap: 6px; align-items: baseline; }
.check-detail { margin-top: 4px; font-size: 14px; color: var(--ink-soft); }
.check-note { margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--danger); }
.check-ack { margin-top: 8px; font-size: 14px; }
.check-ack small { color: var(--ink-soft); }
.check-ack-form { display: grid; gap: 8px; margin-top: 8px; }
.check-ack-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: var(--card);
}
.check-ack-form .btn { justify-self: start; }

/* ============ Activity (audit) log ============ */
.list-header-actions { display: flex; gap: 8px; }
.audit-filters { margin-bottom: 14px; }
.audit-filters select,
.audit-filters input[type="datetime-local"] {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  font: inherit;
  color: var(--ink);
}
.audit-filter-actions { display: flex; gap: 8px; }
.audit-filter-actions .btn { flex: 1; }
.audit-rows { display: grid; gap: 8px; }
.audit-row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
}
.audit-row.is-error { border-color: #f6d4d8; background: #fdf3f4; }
.audit-row-top { display: flex; align-items: baseline; gap: 8px; }
.audit-action {
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.audit-time { margin-left: auto; color: var(--ink-soft); white-space: nowrap; }
.audit-url {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
  word-break: break-all;
}

/* Field-level change diffs on audit rows */
.audit-changes { margin-top: 6px; }
.audit-changes summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--blue);
  -webkit-tap-highlight-color: transparent;
}
.audit-changes-list { display: grid; gap: 6px; margin-top: 8px; }
.audit-change dt { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.audit-change dd { font-size: 13px; line-height: 1.45; word-break: break-word; }
.audit-change s { color: var(--danger); opacity: 0.8; }

/* Alerts (error log) rows */
.alert-row.is-open { border-color: #f6d4d8; background: #fdf3f4; }
.alert-row.is-acked { opacity: 0.75; }
.alert-state { flex-shrink: 0; }
.alert-message { flex: 1; min-width: 0; word-break: break-word; font-size: 14px; }
.alert-stack { margin-top: 6px; }
.alert-stack summary { cursor: pointer; font-size: 12px; font-weight: 700; color: var(--danger); }
.alert-stack pre {
  margin-top: 6px;
  padding: 10px;
  background: var(--ink);
  color: #e8edf5;
  font-size: 11px;
  line-height: 1.5;
  border-radius: 8px;
  overflow-x: auto;
}
.alert-ack-note { display: block; margin-top: 6px; color: var(--green); font-weight: 600; }
.alert-ack-form { margin-top: 8px; }
.btn-alerts-open { background: #fdeaec; border-color: #f6d4d8; color: var(--danger); font-weight: 700; }

/* ============ Office live monitor ============ */
/* Header hint: explainer text left, Live Screen action right — one aligned row. */
.monitor-hint { display: flex; align-items: center; gap: 14px; margin: 6px 0 18px; }
.monitor-hint .live-screen-link { margin-left: auto; flex-shrink: 0; }
@media (max-width: 700px) { .monitor-hint { flex-direction: column; align-items: flex-start; } .monitor-hint .live-screen-link { margin-left: 0; } }
.monitor-item { border-top: 1px solid var(--line); padding: 4px 0; }
.monitor-item summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}
.monitor-item summary::-webkit-details-marker { display: none; }
.monitor-item summary .status { margin-left: auto; }
.monitor-item[open] > summary { margin-bottom: 6px; }

/* Changed-block flash: amber glow that fades out */
@keyframes live-flash {
  0% { background: var(--amber-soft); box-shadow: 0 0 0 3px rgba(154, 103, 0, 0.35); }
  100% { background: transparent; box-shadow: none; }
}
.live-flash { animation: live-flash 1.8s ease; border-radius: 8px; }

/* Distance / drive-time badge next to an address (filled by distance.js) */
.distance-badge {
  display: inline-block;
  margin-top: 6px;
  background: var(--gray-soft);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

/* ============ Item list (no floor plan — maps requirement waived) ============ */
.item-list { display: grid; gap: 10px; margin-bottom: 16px; }
.item-rows { list-style: none; display: grid; gap: 8px; }
.item-row { display: flex; gap: 8px; align-items: stretch; }
.item-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  box-shadow: var(--shadow);
}
.item-row-main:active { background: var(--blue-soft); }
.item-row-icon { font-size: 22px; }
.item-row-text { flex: 1; min-width: 0; display: grid; }
.item-row-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-row-text small { color: var(--ink-soft); }
.item-row-status { font-size: 12px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }
.item-row-delete {
  width: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--danger);
}
.item-row-delete svg { width: 18px; height: 18px; }
.item-row-delete:active { background: var(--danger); color: #fff; }

/* Waived-requirement note on a question card */
.q-waived {
  display: inline-block;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  padding: 4px 10px;
  margin-bottom: 8px;
}

/* Requirement override rows (summary, IT manager only) */
.override-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.override-label { display: grid; min-width: 0; }
.override-label small { color: var(--ink-soft); }

/* Rotate-before-upload preview in the Add Map modal. The image is capped at
   170px on both sides so every 90° step still fits the 200px stage. */
.map-rotate { display: grid; gap: 8px; justify-items: center; }
.map-rotate-stage {
  width: 100%;
  height: 200px;
  background: #dde3ea;
  border-radius: 12px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.map-rotate-stage img {
  max-width: 170px;
  max-height: 170px;
  transition: transform 0.15s ease;
}

.map-zoom {
  position: absolute;
  right: 10px;
  bottom: 78px;
  display: grid;
  gap: 6px;
  z-index: 5;
}

/* Full-screen map mode */
body.map-fullscreen-open { overflow: hidden; }

/* Full screen is map-only: hide the page chrome (app bar and the site info
   strip that carry the company name) so nothing but the map shows. */
body:has(.map-shell.is-fullscreen) .appbar,
body:has(.map-shell.is-fullscreen) .site-info-strip { display: none; }

/* Keep the floor selector floating over the fullscreen map: it shows which
   map is open, switches floors, and holds Add a floor. */
body:has(.map-shell.is-fullscreen) .map-select-wrap {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 12px);
  left: 12px;
  right: 12px;
  z-index: 95; /* above the fullscreen map (90), below modals (100) */
  margin: 0;
}

/* The map variant picker (Original / Cleaned / Re-drawn) floats just below
   the floor chips, so switching variants works in full screen too. */
body:has(.map-shell.is-fullscreen) .map-variant-bar {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 68px);
  left: 12px;
  right: 12px;
  z-index: 95;
  margin: 0;
}
/* The floating chip rows must not swallow taps in their empty space — the
   map (and the buttons at the right edge) live underneath. */
body:has(.map-shell.is-fullscreen) .map-select-wrap,
body:has(.map-shell.is-fullscreen) .map-variant-bar { pointer-events: none; }
body:has(.map-shell.is-fullscreen) .map-select-wrap > *,
body:has(.map-shell.is-fullscreen) .map-variant-bar > * { pointer-events: auto; }

/* The placement banner uses the same top strip — give it the room back. */
body:has(.map-shell.is-fullscreen .map-viewport.is-placing) .map-select-wrap,
body:has(.map-shell.is-fullscreen .map-viewport.is-placing) .map-variant-bar { display: none; }

/* Tasks / Notes stay reachable in full screen: lift the right-edge tabs above
   the map and align them with the variant row up top, clear of the plan's
   middle. Their drawer backdrop already sits at 98. */
body:has(.map-shell.is-fullscreen) .side-tabs {
  z-index: 95;
  top: calc(env(safe-area-inset-top) + 68px);
}

/* Back button under the tabs: full-screen only — everywhere else the app bar
   already has its ‹ back link. (Doubled class: outranks the later .side-tab
   display rule in the site-panel section.) */
.side-tab.side-tab-back { display: none; }
body:has(.map-shell.is-fullscreen) .side-tab-back { display: grid; }
.side-tab-back .side-tab-icon { font-size: 22px; line-height: 1; }

/* (Pins and labels are the same compact size in both views — see
   .map-marker-pin / .map-marker-label above.) */

/* Letterbox areas around the fitted image stay the same light neutral as the
   inline viewer — dark navy here read as a huge blue overlay around the map. */
.map-shell.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 90; /* above page + bottom nav (50), below sheets & modals (100) */
  background: var(--bg);
  animation: map-expand-in 0.22s ease;
}
.map-shell.is-fullscreen .map-viewport {
  height: 100%;
  border-radius: 0;
  background: #dde3ea;
  box-shadow: none;
}
/* Everything stacked above the item tray measures from --tray-top, so the
   row of controls keeps its gap if the tray's height ever changes. */
body:has(.map-shell.is-fullscreen) {
  --tray-top: calc(env(safe-area-inset-bottom) + 96px); /* tray height + 12px gap */
}
.map-shell.is-fullscreen .map-zoom {
  bottom: calc(var(--tray-top) + 68px); /* above the Summary button */
}

/* Continue-the-flow button: bottom-right above the item tray, mirroring the
   checks chip on the left */
.map-shell.is-fullscreen .map-summary-btn {
  position: absolute;
  bottom: var(--tray-top);
  right: 12px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  box-shadow: var(--shadow);
}
.map-shell.is-fullscreen .map-summary-btn:active { background: var(--blue-dark); }

/* Item tray: one tap on a type (Phone, Fax, …) starts placing it. Only shown
   in full screen — the inline view keeps the Add Item button + sheet. */
.map-item-tray { display: none; }
.map-shell.is-fullscreen .map-item-tray {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  z-index: 6;
  display: flex;
  gap: 6px;
  padding: 6px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  /* With eight item types the row can outgrow a phone screen — let it
     scroll sideways instead of crushing the buttons below tappable size. */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tray-item {
  /* Grow to share the row when there's room; keep a tappable floor and
     scroll when there isn't. */
  flex: 1 0 56px;
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 6px 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-soft);
  -webkit-tap-highlight-color: transparent;
}
.tray-item:active { background: var(--blue-soft); border-color: var(--blue); }
.tray-item-icon { font-size: 18px; }
/* Short names wrap onto a second line rather than ellipsizing — every type
   stays readable at any tray width. */
.tray-item-text {
  max-width: 100%;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}
/* While placing, the tray and Summary button get out of the way (the banner
   on top guides the tap). */
.map-shell.is-fullscreen:has(.map-viewport.is-placing) .map-item-tray,
.map-shell.is-fullscreen:has(.map-viewport.is-placing) .map-summary-btn { display: none; }
/* The live-checks chip and its toast share the bottom edge with the tray —
   lift both clear of it. */
body:has(.map-shell.is-fullscreen) .checks-chip {
  bottom: var(--tray-top);
}
body:has(.map-shell.is-fullscreen) .checks-toast {
  bottom: calc(var(--tray-top) + 56px); /* above the chip row */
}
.map-shell.is-fullscreen .placement-banner {
  top: calc(env(safe-area-inset-top) + 12px);
  right: 12px; /* the chips and Summary button hide while placing */
}

@keyframes map-expand-in {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}
.map-zoom button {
  width: 46px; height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 20px;
  font-weight: 700;
  box-shadow: var(--shadow);
}

/* Phones zoom by pinching — the ＋/－ buttons just cover map. Desktop (no
   pinch) keeps them. 820px matches the auto-fullscreen breakpoint in
   map-viewer.js. */
@media (max-width: 820px) {
  #zoom-in,
  #zoom-out { display: none; }
}

.map-empty { margin-top: 8px; }

/* ============ Modal ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(16, 24, 36, 0.55);
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 18px;
  padding: 20px;
}
.modal h2 { font-size: 19px; margin-bottom: 16px; }

/* Full-height frame dialog: the survey form embedded over the map */
.modal-frame {
  position: relative;
  padding: 0;
  overflow: hidden;
  width: 100%;
  max-width: 560px;
  height: 88dvh;
}
.modal-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
.frame-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 38px; height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}
.frame-close:active { background: var(--gray-soft); }

/* Chromeless page inside the frame: no app bar / bottom nav. The Save button
   is in-flow on question pages, so no tall clearance padding — it was just
   dead white space under the form. */
.is-embed .page { padding: 12px 12px 24px; }
/* The frame's ✕ floats over the page's top-right corner — keep the header
   text clear of it. */
.is-embed .q-context { padding-right: 52px; }
.is-embed .page > .form { padding-bottom: 24px; } /* the sheet's Save sits in-flow now */
.is-embed .sticky-actions { bottom: 0; }

/* On phones the survey sheet runs edge to edge: no backdrop margins. (Its
   height is the bottom-sheet rule further down — 92dvh, !important — so a
   phone-only height here would be dead code; the old 100dvh one was.) */
@media (max-width: 700px) {
  .frame-backdrop { padding: 0; }
}

/* Scrollable variant for content-heavy dialogs (marker answer preview) */
.modal-tall { display: flex; flex-direction: column; max-height: 82dvh; }
.modal-tall .preview-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
  box-shadow: none;
  margin-bottom: 16px;
}
.modal-tall .modal-actions { margin-bottom: 10px; }
.marker-preview-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.marker-preview-head h2 { margin-bottom: 0; }
.marker-preview-head small { color: var(--ink-soft); font-size: 13px; }
.marker-preview-icon { font-size: 28px; }
.modal-note {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: -6px 0 16px;
}
.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}

/* ============ Bottom sheet ============ */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(16, 24, 36, 0.55);
  display: flex;
  align-items: flex-end;
}
.sheet {
  width: 100%;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 10px 18px calc(env(safe-area-inset-bottom) + 18px);
  max-height: 80dvh;
  overflow-y: auto;
}
.sheet-handle {
  width: 42px; height: 4px;
  border-radius: 999px;
  background: var(--line);
  margin: 4px auto 14px;
}
.sheet-title { font-size: 18px; margin-bottom: 14px; }
.item-options { display: grid; gap: 10px; margin-bottom: 14px; }
.item-option {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  font-size: 16px;
  font-weight: 600;
  text-align: left;
}
.item-option:active { background: var(--blue-soft); }
.item-option-icon { font-size: 24px; }

/* ============ Marker survey (questions) ============ */
.page-questions { padding-bottom: calc(env(safe-area-inset-bottom) + 180px); }

.q-context {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  margin-bottom: 12px;
}
.q-context-icon { font-size: 28px; }
/* Delete row at the end of the survey form */
.marker-delete-row { margin-top: 4px; min-height: 48px; }
.btn-danger-soft.is-armed {
  background: var(--danger);
  color: #fff;
  font-size: 14px;
}
.q-context strong { display: block; font-size: 16px; }
.q-context small { color: var(--ink-soft); }

.alert-success { background: var(--green-soft); color: var(--green); }

/* Questions render as ONE grouped panel with hairline-divided rows (settings-
   screen style) instead of a stack of floating cards — far less bulk on a
   phone. The JS contracts (.q-card, .yesno, [hidden] branching) are unchanged. */
.q-form {
  gap: 0;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.page > .q-form { padding-bottom: 0; margin-bottom: 76px; } /* clears the sticky Save bar */
.q-card { padding: 14px 16px; }
.q-card + .q-card { border-top: 1px solid var(--line); }
/* Branch-hidden rows must stay gone even where a row sets display:flex */
.q-card[hidden] { display: none !important; }
.q-label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 10px;
}
.q-note {
  font-size: 13px;
  color: var(--ink-soft);
  margin: -6px 0 10px;
}
.q-required { color: var(--danger); }
.q-card input[type="text"], .q-card textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: var(--card);
}
.q-card textarea { resize: vertical; }
.q-card input:focus, .q-card textarea:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
  border-color: var(--blue);
}
.field-error {
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  margin-top: 6px;
}

/* Yes/No question: label and a compact segmented control share one row;
   notes, comments and errors wrap to their own full-width line below. */
.q-card[data-qtype="yesno"] {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 12px;
  row-gap: 8px;
}
.q-card[data-qtype="yesno"] .q-label { flex: 1 1 55%; min-width: 180px; margin-bottom: 0; }
.q-card[data-qtype="yesno"] .q-note,
.q-card[data-qtype="yesno"] .q-waived,
.q-card[data-qtype="yesno"] .q-comment,
.q-card[data-qtype="yesno"] .field-error { flex-basis: 100%; margin: 0; }

.yesno {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: var(--gray-soft);
  border-radius: 999px;
}
.yesno-opt input { position: absolute; opacity: 0; pointer-events: none; }
.yesno-opt span {
  display: grid;
  place-items: center;
  min-height: 38px;
  min-width: 64px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: var(--ink-soft);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, color 0.15s;
}
.yesno-opt input:checked + span { background: var(--green); color: #fff; }
.yesno-no input:checked + span { background: var(--danger); color: #fff; }
.yesno-opt input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.yesno.is-invalid { box-shadow: 0 0 0 2px var(--danger); }

/* Single-choice pill group (question type 'select' — e.g. phone wiring) */
.select-opts {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px;
  background: var(--gray-soft);
  border-radius: 999px;
}
.select-opt input { position: absolute; opacity: 0; pointer-events: none; }
.select-opt span {
  display: grid;
  place-items: center;
  min-height: 38px;
  min-width: 64px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: var(--ink-soft);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, color 0.15s;
}
.select-opt input:checked + span { background: var(--blue); color: #fff; }
.select-opt input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.select-opts.is-invalid { box-shadow: 0 0 0 2px var(--danger); }

.q-comment { display: grid; gap: 6px; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}
.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--gray-soft);
  border: 1px solid var(--line);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb > a { display: block; width: 100%; height: 100%; }
.photo-thumb > a:active img { opacity: 0.8; }

/* Preview affordance on image thumbs */
.photo-thumb > a:not(.photo-doc)::after {
  content: '⤢';
  position: absolute;
  left: 6px; bottom: 6px;
  width: 24px; height: 24px;
  display: grid;
  place-items: center;
  background: rgba(16, 24, 36, 0.55);
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  pointer-events: none;
}

.photo-delete {
  position: absolute;
  top: 6px; right: 6px;
  z-index: 2;
  width: 28px; height: 28px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--danger);
  font-size: 13px;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 1px 4px rgba(22, 32, 46, 0.35);
}
.photo-delete:active { background: var(--danger); color: #fff; }

.photo-add { display: grid; gap: 8px; }
/* One picker per file-type family (photos / PDFs) — side by side when both */
.photo-pickers { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.photo-picker { display: grid; }
.photo-add-count {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 5px 12px;
}
.file-trigger:active { background: #d9e6fb; }

/* Files picked but not yet uploaded — dashed ring + NEW badge mark them pending */
.photo-grid-pending { margin-top: 10px; }
.photo-grid-pending .photo-thumb {
  outline: 2px dashed var(--blue);
  outline-offset: -2px;
  border-color: transparent;
}
.photo-grid-pending .photo-thumb::before {
  content: 'NEW';
  position: absolute;
  top: 7px; left: 7px;
  z-index: 2;
  background: var(--blue);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.6px;
  padding: 3px 7px;
  border-radius: 999px;
  pointer-events: none;
}
.photo-grid-pending img { width: 100%; height: 100%; object-fit: cover; display: block; }

.q-form { gap: 12px; }

.sheet-status { color: var(--ink-soft); font-weight: 600; margin: -6px 0 12px; }
.sheet-questions-btn { margin-bottom: 12px; }

.general-q-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  margin-bottom: 12px;
  -webkit-tap-highlight-color: transparent;
}
.general-q-card:active { background: var(--blue-soft); }
/* Summary's paired preview cards share one row */
.summary-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.summary-cards .general-q-card {
  margin-bottom: 0;
  gap: 8px;
  padding: 14px 12px;
  min-width: 0;
}
.summary-cards .general-q-icon { font-size: 20px; }
.summary-cards .general-q-text strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Same card used as a button (summary's contact preview) */
button.general-q-card {
  width: 100%;
  border: 0;
  font: inherit;
  color: inherit;
  text-align: left;
}
.general-q-icon { font-size: 24px; }
.general-q-text { flex: 1; display: grid; }
.general-q-text strong { font-size: 15px; }
.general-q-text small { color: var(--ink-soft); font-weight: 600; }
.general-q-chev { font-size: 24px; color: var(--ink-soft); }

.q-maps-done { font-weight: 700; color: var(--green); margin-bottom: 10px; }

/* GC6 map thumbnails — see the uploaded floor plans without leaving the form */
.map-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.map-preview { margin: 0; }
.map-preview img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: var(--gray-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: block;
}
.map-preview figcaption {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.q-card .btn-small { justify-self: start; }

.photo-doc {
  width: 100%; height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  font-size: 28px;
  background: var(--blue-soft);
}
.photo-doc small { font-size: 11px; font-weight: 800; color: var(--blue); }

.sticky-actions-double { display: grid; gap: 8px; }
.page-questions .sticky-actions {
  position: static;
  width: 100%;
  max-width: none;
  padding: 12px 0 0;
  background: none;
}

/* ============ Answers preview ============ */
.edit-fab {
  width: 46px; height: 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--blue-soft);
  color: var(--blue);
  flex-shrink: 0;
}
.edit-fab:active { background: var(--blue); color: #fff; }
.edit-fab svg { display: block; }

/* One grouped summary sheet: question rows separated by hairlines */
.preview-list {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2px 16px;
}
.preview-card {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.preview-list > .preview-card:last-child { border-bottom: 0; }
.preview-question {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.4;
  margin-bottom: 8px;
}
.preview-answer {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  white-space: pre-wrap;
}
.preview-comment {
  margin-top: 6px;
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.4;
}
.answer-chip {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.4px;
}
.answer-chip.is-yes { background: var(--green-soft); color: var(--green); }
.answer-chip.is-no { background: #fdeaec; color: var(--danger); }
.answer-chip.is-empty { background: var(--gray-soft); color: var(--ink-soft); font-weight: 600; }

/* ============ Summary view ============ */
.next-btn { margin-top: 14px; }
.next-btn.is-disabled {
  background: var(--gray-soft);
  border-color: var(--gray-soft);
  color: var(--ink-soft);
  pointer-events: none;
  font-size: 15px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.stat-tile {
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px 6px;
  display: grid;
  justify-items: center;
  gap: 2px;
}
.stat-tile strong { font-size: 22px; font-weight: 800; color: var(--blue); }
.stat-tile small { font-size: 11px; font-weight: 700; color: var(--ink-soft); text-align: center; }

.summary-rows { display: grid; gap: 4px; }
.summary-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  -webkit-tap-highlight-color: transparent;
}
.summary-rows > .summary-row:last-child { border-bottom: 0; }
a.summary-row:active, button.summary-row:active { background: var(--blue-soft); }
/* Rows that open a preview modal are buttons */
button.summary-row {
  width: 100%;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
}
.summary-ext {
  min-width: 56px;
  text-align: center;
  font-weight: 800;
  font-size: 15px;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 8px;
  padding: 8px 6px;
}
.summary-row-icon { font-size: 22px; }
.summary-row-main { flex: 1; display: grid; }
.summary-row-main strong { font-size: 15px; }
.summary-row-main small { color: var(--ink-soft); font-size: 13px; }
.summary-number { font-variant-numeric: tabular-nums; }
.summary-empty { color: var(--ink-soft); font-size: 14px; }

/* ============ Technician cards ============ */
.tech-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  -webkit-tap-highlight-color: transparent;
}
.tech-card:active { background: var(--blue-soft); }
.tech-card-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.tech-card-main { flex: 1; display: grid; }
.tech-card-main strong { font-size: 16px; }
.tech-card-main small { color: var(--ink-soft); font-size: 13px; }
.tech-card-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  background: var(--gray-soft);
  border-radius: 999px;
  padding: 5px 10px;
  white-space: nowrap;
}

/* ============ Facility contacts ============ */
.contact-list { display: grid; gap: 10px; margin-bottom: 16px; }
.contact-card {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.contact-main { flex: 1; display: grid; gap: 2px; min-width: 0; }
.contact-main strong { font-size: 15px; }
.contact-main small { color: var(--ink-soft); font-size: 13px; overflow-wrap: anywhere; }
.contact-actions { display: flex; gap: 8px; flex-shrink: 0; }
.contact-edit, .contact-delete {
  width: 34px; height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  font-size: 13px;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.contact-edit { color: var(--blue); }
.contact-edit:active { background: var(--blue); border-color: var(--blue); color: #fff; }
.contact-delete { color: var(--danger); }
.contact-delete:active { background: var(--danger); border-color: var(--danger); color: #fff; }

.contact-editing {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px;
  padding: 8px 8px 8px 16px;
  margin-bottom: 14px;
}
.contact-editing button {
  border: 0;
  background: rgba(21, 84, 209, 0.12);
  color: var(--blue);
  font-weight: 700;
  font-size: 13px;
  border-radius: 8px;
  padding: 8px 14px;
  min-height: 38px;
}
.contact-editing button:active { background: rgba(21, 84, 209, 0.25); }

/* ============ Draft restore notice ============ */
.draft-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 14px;
  font-weight: 600;
  border-radius: 12px;
  padding: 10px 12px 10px 16px;
  margin-bottom: 14px;
}
.draft-notice button {
  flex-shrink: 0;
  border: 0;
  background: rgba(154, 103, 0, 0.12);
  color: var(--amber);
  font-weight: 700;
  font-size: 13px;
  border-radius: 8px;
  padding: 8px 14px;
  min-height: 40px;
}
.draft-notice button:active { background: rgba(154, 103, 0, 0.22); }

[hidden] { display: none !important; }

/* ============ Account sheet ============ */
.account-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.account-head > div { display: grid; min-width: 0; }
.account-head strong { font-size: 17px; }
.account-head small { color: var(--ink-soft); font-size: 13px; overflow-wrap: anywhere; }
.account-avatar {
  width: 46px; height: 46px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  font-size: 19px;
  display: grid;
  place-items: center;
}

/* Menu row inside the sheet — matches the Add Item options */
.account-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 10px 14px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.account-row-icon { font-size: 20px; }
.account-row.is-danger { color: var(--danger); border-color: #f6d4d8; }
.account-row.is-danger:active { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ============ Date picker ============ */
.field.has-datepicker { position: relative; }
input[data-datepicker] { cursor: pointer; }
input[data-datepicker]::-webkit-calendar-picker-indicator { display: none; }

.datepicker {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  width: min(330px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(22, 32, 46, 0.18), 0 2px 8px rgba(22, 32, 46, 0.08);
  padding: 14px;
}
.datepicker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-left: 6px;
}
.datepicker-head strong { font-size: 15px; }
.datepicker-navs { display: flex; gap: 6px; }
.datepicker-nav {
  width: 36px; height: 36px;
  border: 0;
  background: var(--gray-soft);
  border-radius: 10px;
  font-size: 18px;
  line-height: 1;
  color: var(--ink-soft);
  display: grid;
  place-items: center;
}
.datepicker-nav:active { background: var(--blue); color: #fff; }
.datepicker-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.datepicker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.datepicker-day {
  aspect-ratio: 1;
  border: 0;
  background: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  display: grid;
  place-items: center;
  -webkit-tap-highlight-color: transparent;
}
.datepicker-day.is-out { color: #b8c1cc; }
.datepicker-day.is-today { box-shadow: inset 0 0 0 1.5px var(--blue); color: var(--blue); }
.datepicker-day.is-selected { background: var(--blue); color: #fff; box-shadow: none; }
.datepicker-day:active { background: var(--blue-soft); }
.datepicker-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}
.datepicker-action {
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 8px;
}
.datepicker-action.is-strong { color: var(--blue); }
.datepicker-action:active { background: var(--blue-soft); color: var(--blue); }

/* ============ Searchable dropdown (combo-select.js) ============ */
.combo { position: relative; }
/* The real select stays in the form (value, validation, fallback) but is
   covered by the trigger — kept rendered, not display:none, so validation
   still sees it and focus can be redirected. */
.combo-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}
.combo-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  font-size: 16px; /* prevents iOS zoom */
  font-family: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.combo-trigger:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
  border-color: var(--blue);
}
.combo-native.is-invalid ~ .combo-trigger { border-color: var(--danger); }
.combo-trigger.is-placeholder .combo-value { color: var(--ink-soft); }
.combo-value {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.combo-caret { color: var(--ink-soft); font-size: 12px; }

.combo-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  width: max(100%, min(320px, calc(100vw - 32px)));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(22, 32, 46, 0.18), 0 2px 8px rgba(22, 32, 46, 0.08);
  padding: 8px;
}
.combo-pop.is-right { left: auto; right: 0; }
.combo-search {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font-size: 16px; /* prevents iOS zoom */
  font-family: inherit;
  color: var(--ink);
  margin-bottom: 6px;
}
.combo-search:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
  border-color: var(--blue);
}
.combo-list {
  max-height: min(264px, 40vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.combo-option {
  display: block;
  width: 100%;
  border: 0;
  background: none;
  padding: 12px;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.combo-option.is-active { background: var(--blue-soft); }
.combo-option.is-selected { color: var(--blue); font-weight: 700; }
.combo-option:active { background: var(--blue-soft); }
.combo-empty { padding: 12px; font-size: 14px; color: var(--ink-soft); }

/* ============ Site panel: right-edge Tasks / Notes tabs + drawer ============ */
.side-tabs {
  position: fixed;
  right: 0;
  top: 42%;
  z-index: 55; /* under the fullscreen map (60) and all modals (100) */
  display: grid;
  gap: 6px;
}
.side-tab {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 10px 6px 10px 8px;
  min-width: 44px;
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 12px 0 0 12px;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-soft);
  -webkit-tap-highlight-color: transparent;
}
.side-tab-icon { font-size: 17px; }
.side-tab { position: relative; }
.side-tab.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }
.side-tab-badge {
  position: absolute;
  top: -5px;
  left: -7px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.panel-queued-msg { font-size: 12px; color: var(--amber); font-weight: 600; }

/* ============ Office live monitor: desktop layout ============ */
.page-monitor { max-width: 1440px; }
.monitor-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
@media (min-width: 1000px) {
  .monitor-grid { grid-template-columns: minmax(0, 1fr) 400px; align-items: start; }
}
.monitor-rail { display: none; }
@media (min-width: 1000px) {
  .monitor-rail { display: block; }
  .monitor-rail-sticky { position: sticky; top: 70px; display: grid; gap: 10px; }
}
.monitor-rail-title { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.phone-frame {
  width: 384px;
  height: 720px;
  padding: 10px;
  border-radius: 34px;
  background: #16202e;
  box-shadow: var(--shadow);
}
.phone-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 24px;
  background: var(--bg);
}

/* Presence strip */
.presence-row { display: flex; flex-wrap: wrap; gap: 8px; }
.presence-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--gray-soft);
  font-size: 13px;
  font-weight: 700;
}
.presence-chip small { color: var(--ink-soft); font-weight: 600; }
.presence-chip.is-live { background: var(--green-soft); }
.presence-chip.is-live small { color: var(--green); }

/* Live items table */
.count-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.count-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}
.count-chip.is-zero { background: var(--gray-soft); color: var(--ink-soft); }

/* Device overview page: chips double as per-type filter buttons, and the
   grid carries one extra column (CAT5 wiring check). */
button.count-chip.is-filter { border: 0; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.count-chip.is-filter.is-active { outline: 2px solid var(--blue); outline-offset: 1px; }
.page-devices .items-grid-head,
.page-devices .items-grid-row {
  grid-template-columns: minmax(170px, 1.6fr) minmax(70px, 0.7fr) minmax(140px, 1.4fr) 44px 56px 56px 56px;
  min-width: 640px;
}
/* ⚠ in front of an unfinished item — hover/focus shows what is missing. */
.item-warn {
  display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 2px;
  border-radius: 50%; background: var(--amber-soft); color: var(--amber); font-size: 13px; font-weight: 800;
  cursor: help; flex: none; vertical-align: middle;
}
.item-detail.is-incomplete > summary .items-cell-name strong { color: var(--ink); }
.item-missing { margin: 0 0 4px; font-size: 13px; color: var(--amber); font-weight: 600; line-height: 1.4; white-space: normal; }
.items-cell-name { display: inline-flex; align-items: center; gap: 4px; }
.wiring-yes { color: var(--green); font-weight: 800; font-size: 15px; }
.wiring-no { color: var(--danger); font-weight: 800; font-size: 15px; }
.wiring-unknown { color: var(--ink-soft); font-weight: 800; }

/* ---- Survey report (printable / CSV) ---- */
.report-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.report-title { font-size: 19px; margin: 0 0 10px; }
.report-subtitle { font-size: 14px; margin: 16px 0 8px; }
.report-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.report-table th, .report-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
}
.report-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink-soft);
}
.report-num { text-align: right; }
@media print {
  /* The report prints as the deliverable: page chrome and buttons drop out. */
  .page-report .appbar, .page-report .desktop-nav, .page-report .bottomnav,
  .page-report .report-actions, .page-report .site-panel-tabs, .page-report .site-edge-tabs { display: none !important; }
  .page-report .panel { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}
/* Job timer (start of tech work → completion or now; ticks in monitor.js) */
.job-timer {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Items grid: header row + one expandable <details> per item */
.items-grid-wrap { overflow-x: auto; }
.items-grid-head,
.items-grid-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.4fr) minmax(70px, 0.7fr) minmax(120px, 1.3fr) 44px 56px 56px minmax(100px, 0.9fr);
  gap: 8px;
  align-items: center;
  min-width: 660px;
  padding: 8px 10px;
}
.items-grid-head {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
}
.items-cell-c { text-align: center; }
.item-detail { border-bottom: 1px solid var(--line); }
.item-detail:last-child { border-bottom: 0; }
.item-detail > summary { cursor: pointer; list-style: none; font-size: 14px; }
.item-detail > summary::-webkit-details-marker { display: none; }
.item-detail > summary:hover { background: var(--blue-soft); }
.item-detail[open] > summary { background: var(--blue-soft); }
.item-detail[open] > summary .items-cell-name::after { content: ' ▴'; color: var(--ink-soft); }
.item-detail > summary .items-cell-name::after { content: ' ▾'; color: var(--ink-soft); font-size: 11px; }
.items-grid-row span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-detail-body { padding: 4px 10px 12px; display: grid; gap: 8px; }

/* Yes/no indicator bubbles (paging equipment, telco lines) */
.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  vertical-align: middle;
}
.dot-yes { background: var(--green); }
.dot-no { background: var(--danger); }
.dot-unknown { background: transparent; border: 2px dashed #b9c2ce; }
.dot-na { width: auto; height: auto; border-radius: 0; background: none; color: var(--ink-soft); }

/* Site history timeline */
.timeline { position: relative; display: grid; }
.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--line);
}
.tl-entry { position: relative; padding: 6px 0 6px 24px; }
.tl-entry > summary,
.tl-entry-plain { display: flex; align-items: baseline; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.tl-entry > summary { cursor: pointer; list-style: none; }
.tl-entry > summary::-webkit-details-marker { display: none; }
/* (plain rows keep the same 24px gutter as expandable ones — an earlier
   padding-left:0 override here made them overlap the rail and dot) */
.tl-dot {
  position: absolute;
  left: 0;
  top: 12px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--card);
  box-shadow: 0 0 0 1px var(--line);
}
.tl-dot.is-tech { background: var(--blue); }
.tl-dot.is-office { background: var(--amber); }
.tl-main { min-width: 0; }
.tl-main strong { margin-right: 4px; }
.tl-badge {
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--gray-soft);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.tl-entry[open] .tl-badge { background: var(--blue-soft); color: var(--blue); }
.tl-time { margin-left: auto; color: var(--ink-soft); font-size: 12px; white-space: nowrap; }
.tl-detail { padding: 6px 0 4px; }

/* Read-only floor plan with pins */
.monitor-map { display: block; position: relative; border-radius: 12px; overflow: hidden; background: #dde3ea; }
a.monitor-map:hover { outline: 2px solid var(--blue); }

/* Links out of the monitor's items panel (device overview, report) */
.monitor-links { display: flex; flex-wrap: wrap; gap: 8px; }
.monitor-map img { display: block; width: 100%; }
.monitor-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 20px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}
.monitor-pin.is-complete::after,
.monitor-pin.is-in_progress::after {
  content: '';
  position: absolute;
  right: -3px; top: -3px;
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 1.5px solid #fff;
}
.monitor-pin.is-complete::after { background: var(--green); }
.monitor-pin.is-in_progress::after { background: var(--amber); }

.side-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 98; /* over page chrome, still under classic modals (100) */
  background: rgba(22, 32, 46, 0.4);
}
.side-drawer {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 92vw);
  background: var(--bg);
  box-shadow: -8px 0 30px rgba(22, 32, 46, 0.25);
  display: flex;
  flex-direction: column;
  animation: drawer-in 0.22s ease-out;
}
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0.4; } }
.side-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.side-drawer-switch {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: var(--gray-soft);
  border-radius: 999px;
}
.side-drawer-tab {
  min-height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: none;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  -webkit-tap-highlight-color: transparent;
}
.side-drawer-tab.is-active { background: var(--blue); color: #fff; }
.side-drawer-close {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 0; border-radius: 10px;
  background: var(--gray-soft);
  font-size: 15px;
}
.side-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px calc(env(safe-area-inset-bottom) + 20px);
  display: grid;
  gap: 12px;
  align-content: start;
}
.panel-loading, .panel-empty { color: var(--ink-soft); font-size: 14px; text-align: center; padding: 14px 0; }

/* Composers */
.panel-composer { display: flex; gap: 8px; }
.panel-composer input {
  flex: 1;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  background: var(--card);
}
.panel-composer-sub { margin-top: 8px; }
.panel-note-composer {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px;
  display: grid;
  gap: 8px;
}
.panel-note-composer textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 15px;
  resize: vertical;
}
.panel-note-actions { display: flex; align-items: center; gap: 8px; }
.panel-note-actions .btn-primary { margin-left: auto; }
.panel-attach-count { font-size: 12px; color: var(--ink-soft); font-weight: 600; }

/* Lists */
.panel-list { display: grid; gap: 10px; }

/* Tasks */
.panel-task {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-task-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 0;
  background: none;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.panel-task-text { flex: 1; display: grid; gap: 2px; min-width: 0; }
.panel-task-text strong { font-size: 14px; line-height: 1.35; }
.panel-task-text small { color: var(--ink-soft); font-size: 12px; }
.panel-task-count { font-size: 12px; color: var(--ink-soft); }
.panel-task.is-closed .panel-task-text strong { color: var(--ink-soft); text-decoration: line-through; }
.panel-closed-by { color: var(--green) !important; }
.panel-task-detail { padding: 0 12px 12px; display: grid; gap: 8px; }
.panel-comment { border-left: 3px solid var(--line); padding-left: 10px; display: grid; gap: 2px; }
.panel-comment small { color: var(--ink-soft); font-size: 11px; }
.panel-comment p { font-size: 14px; line-height: 1.4; white-space: pre-wrap; }
.panel-close-task { justify-self: start; }

/* Notes */
.panel-note {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 40px 12px 12px;
  display: grid;
  gap: 6px;
}
.panel-note-meta { color: var(--ink-soft); font-size: 12px; font-weight: 600; }
.panel-note-body { font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.panel-note-files { display: flex; flex-wrap: wrap; gap: 8px; }
.panel-note-files img {
  width: 72px; height: 72px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
}
.panel-note-doc {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  background: var(--blue-soft);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.panel-note-delete {
  position: absolute;
  top: 8px; right: 8px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 0; border-radius: 8px;
  background: none;
  font-size: 14px;
  opacity: 0.55;
}
/* Soft-deleted notes (office view only): lightened, with who/when */
.panel-note.is-deleted { opacity: 0.55; }
.panel-note.is-deleted .panel-note-body,
.panel-note.is-deleted .panel-note-meta { color: var(--ink-soft); }
.panel-note-deleted { color: var(--danger); font-size: 12px; font-weight: 600; }

/* Items/maps created offline: greyed placeholders until the sync queue posts
   them (map pins get data-pending; list rows get .is-pending). */
.map-marker.is-pending { opacity: .55; }
.map-marker.is-pending .map-marker-label::after { content: " ⏳"; }
.item-row.is-pending { opacity: .6; }
.item-row.is-pending .item-row-status { font-style: italic; }

/* Alerts page bulk actions row */
.alerts-bulk-actions { display: flex; gap: 8px; margin-bottom: 12px; }

/* ---- Planned extensions editor (office site form) ---- */
.planned-ext-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.planned-ext-row { display: grid; grid-template-columns: 72px 1.4fr 1fr 1fr 36px; gap: 8px; align-items: center; }
.planned-ext-row input { min-width: 0; }
@media (max-width: 640px) {
  .planned-ext-row { grid-template-columns: 56px 1fr 36px; grid-auto-rows: auto; }
  .planned-ext-row input[name="planned_phone"],
  .planned-ext-row input[name="planned_notes"] { grid-column: 1 / 3; }
}

/* Shared row-editor affordances (planned extensions + pre-visit tasks):
   a real hit-target for ✕, and add-buttons that read as "add a row here"
   (dashed, quiet) instead of another giant input-shaped pill. */
.planned-ext-remove, .prep-task-remove {
  width: 36px; height: 36px; flex: none; border: none; border-radius: 50%;
  background: transparent; color: var(--danger); font-size: 15px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.planned-ext-remove:hover, .prep-task-remove:hover { background: #fdeaec; }
.btn.add-row {
  width: 100%; min-height: 44px; background: transparent;
  border: 1.5px dashed var(--line); color: var(--blue); font-weight: 600;
  border-radius: 12px; box-shadow: none;
}
.btn.add-row:hover { border-color: var(--blue); background: var(--blue-soft); }
/* The prep sections are long — hairline separations keep them scannable. */
.field-section { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 8px; }
/* The form's sticky-bar clearance is huge; when a danger zone follows, IT
   clears the bar instead — no dead void between the last field and it. */
.page > .form:has(+ .danger-zone) { padding-bottom: 28px; }
html.theme-dark .planned-ext-remove:hover, html.theme-dark .prep-task-remove:hover { background: rgba(198,40,56,.18); }
html.theme-dark .btn.add-row { border-color: rgba(255,255,255,.2); color: #7fb0ff; }
html.theme-dark .field-section { border-top-color: rgba(255,255,255,.1); }

/* ---- Planned-extension suggestion chips (phone survey) ---- */
.ext-suggest { margin-top: 8px; }
.ext-suggest-label { display: block; font-size: 12px; color: var(--muted, #666); margin-bottom: 6px; }
.ext-suggest-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ext-suggest-chip {
  border: 1px solid #c9d6e8; background: #eef4fc; color: #1f4e8c;
  border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer;
}
.ext-suggest-chip:active { background: #dbe8f8; }

/* ---- Rapid-fire camera overlay ---- */
.camera-overlay {
  position: fixed; inset: 0; z-index: 300; background: #000;
  display: flex; flex-direction: column;
}
.camera-overlay video { flex: 1; width: 100%; object-fit: contain; min-height: 0; }
.camera-controls {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); background: #000;
}
.camera-count { color: #fff; font-size: 14px; }
.camera-shutter {
  width: 68px; height: 68px; border-radius: 50%; border: 5px solid #fff;
  background: #e8e8e8; justify-self: center; cursor: pointer;
}
.camera-shutter:active { background: #bbb; transform: scale(.94); }
.camera-done {
  justify-self: end; background: rgba(255,255,255,.15); color: #fff;
  border: 1px solid rgba(255,255,255,.4); border-radius: 8px; padding: 10px 18px; font-size: 15px;
}
.camera-flash { position: absolute; inset: 0; background: #fff; opacity: .7; pointer-events: none; }

/* ---- Items table on the map ---- */
.map-items-btn {
  position: absolute; left: 12px; bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 5; border: none; border-radius: 999px; padding: 10px 14px;
  background: rgba(20, 20, 20, .78); color: #fff; font-size: 13px; cursor: pointer;
}
.sheet-tall { max-height: 82vh; display: flex; flex-direction: column; }
.items-table { overflow-y: auto; flex: 1; min-height: 0; margin: 8px 0; }
.items-table-row {
  display: grid; grid-template-columns: 34px 1fr 26px 40px 40px;
  gap: 8px; align-items: center; padding: 9px 2px;
  border-bottom: 1px solid rgba(0,0,0,.08);
}
.items-table-icon { font-size: 20px; text-align: center; }
.items-table-icon svg { width: 22px; height: 22px; }
.items-table-text { min-width: 0; display: flex; flex-direction: column; }
.items-table-text strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.items-table-text small { font-size: 12px; color: var(--muted, #667); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.items-table-status { text-align: center; font-size: 14px; }
.items-table-locate, .items-table-edit {
  border: 1px solid rgba(0,0,0,.14); background: #fff; border-radius: 8px;
  font-size: 16px; padding: 6px 0; cursor: pointer;
}

/* Pin highlight after "show on the map" */
.map-marker.is-located .map-marker-pin {
  animation: locate-pulse 0.85s ease-in-out 3;
}
/* The pin's base transform is rotate(-45deg) (teardrop shape) — the pulse
   must keep it, or Android renders a warped box mid-animation. box-shadow
   instead of filter: animating filter over the transformed map layer causes
   paint artifacts on Android Chrome. */
@keyframes locate-pulse {
  0%, 100% { transform: rotate(-45deg) scale(1); box-shadow: 0 3px 8px rgba(0,0,0,0.35); }
  50% { transform: rotate(-45deg) scale(1.45); box-shadow: 0 0 14px 5px rgba(255, 170, 0, .9); }
}

/* ---- Live Screen mirror (office) ---- */
/* The page is a fixed-height flex column so .live-stage has a DEFINITE
   height. (It used to follow its content: fitFrame() read the stage height,
   sized the frame from it, which shrank the stage, which shrank the next
   fit — the mirror slowly zoomed itself out. A stable height ends the loop.) */
body main.page.page-live-screen {
  display: flex; flex-direction: column;
  height: calc(100dvh - 46px); /* under the desktop nav / appbar */
  max-width: none; overflow: hidden;
  padding: 6px 8px 8px;
}
body.in-shell main.page.page-live-screen { height: 100dvh; padding-top: 4px; }
.live-stage { min-height: 0; }
.live-screen-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 8px 12px; flex-wrap: wrap;
}
.live-screen-meta { display: flex; flex-direction: column; min-width: 0; }
.live-screen-meta small { color: var(--muted, #667); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-cast-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.live-cast-chip {
  border: 1px solid rgba(0,0,0,.18); background: #fff; border-radius: 999px;
  padding: 5px 12px; font-size: 12px; cursor: pointer;
}
.live-cast-chip.is-active { background: #1f4e8c; border-color: #1f4e8c; color: #fff; }
.live-stage {
  position: relative; flex: 1; min-height: 70vh;
  display: flex; align-items: flex-start; justify-content: center;
  background: #2b2e33; border-radius: 10px; margin: 0 8px 8px; overflow: hidden;
}
.live-frame-wrap { position: relative; overflow: hidden; margin-top: 8px; background: #fff; box-shadow: 0 4px 24px rgba(0,0,0,.4); }
#live-frame { border: 0; transform-origin: top left; display: block; background: #fff; }
.live-cast-overlay {
  position: absolute; inset: 0; z-index: 4;
  background: rgba(90, 94, 100, .72); backdrop-filter: grayscale(1) blur(1px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; text-align: center; padding: 24px; gap: 10px;
}
.live-cast-overlay[hidden] { display: none; }
.live-cast-overlay-icon { font-size: 54px; filter: grayscale(.2); }
.live-screen-link { margin-left: 10px; }

/* ---- Toast stack (window.UI) ---- */
.toast-stack {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 400; display: flex; flex-direction: column; gap: 8px;
  width: min(480px, calc(100vw - 24px)); pointer-events: none;
}
.toast {
  pointer-events: auto; cursor: pointer;
  background: rgba(28, 30, 34, .94); color: #fff;
  border-radius: 10px; padding: 12px 14px; font-size: 14px; line-height: 1.35;
  box-shadow: 0 6px 22px rgba(0,0,0,.3);
  animation: toast-in .22s ease-out;
  display: flex; flex-direction: column; gap: 2px;
}
.toast small { opacity: .65; font-size: 11px; }
.toast-ok    { border-left: 4px solid #2e9e44; }
.toast-info  { border-left: 4px solid #4a90d9; }
.toast-warn  { border-left: 4px solid #f0a500; }
.toast-error { border-left: 4px solid #d93838; }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: all .22s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---- Recovery panel (office monitor) ---- */
.deleted-panel { border-left: 4px solid #c9a227; }
.deleted-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(0,0,0,.07); }
.deleted-row:last-child { border-bottom: 0; }
.deleted-row-text { display: flex; flex-direction: column; min-width: 0; }
.deleted-row-text small { color: var(--muted, #667); font-size: 12px; }

/* ---- Sticky placement + items filter + save&next ---- */
.placement-sticky { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; white-space: nowrap; }
.items-filter-toggle { align-self: flex-start; margin-bottom: 4px; }
.items-filter-toggle.is-active { background: #1f4e8c; color: #fff; border-color: #1f4e8c; }
.save-next-btn { margin-bottom: 6px; }
.ext-suggest-next { border-style: dashed; }

/* ---- Photo annotator ---- */
.annotate-overlay { position: fixed; inset: 0; z-index: 320; background: #111; display: flex; flex-direction: column; }
.annotate-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.annotate-stage canvas { max-width: 100%; max-height: 100%; touch-action: none; }
.annotate-bar { display: flex; align-items: center; gap: 10px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); background: #000; }
.annotate-colors { display: flex; gap: 8px; margin-right: auto; }
.annotate-color { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.annotate-color.is-active { border-color: #fff; }
.photo-annotate {
  position: absolute; left: 4px; top: 4px; border: none; border-radius: 6px;
  background: rgba(0,0,0,.55); color: #fff; font-size: 13px; padding: 3px 6px; cursor: pointer;
}

/* ---- Floor chip progress badges ---- */
.chip-progress {
  margin-left: 6px; font-size: 11px; padding: 1px 6px; border-radius: 999px;
  background: rgba(0,0,0,.14);
}
.chip-progress.is-done { background: #2e9e44; color: #fff; }

/* ---- Office sites toolbar ---- */
.sites-toolbar { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 12px; }
.sites-toolbar input[type="search"] { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(0,0,0,.16); font-size: 15px; }
.sites-filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filter-chip { border: 1px solid rgba(0,0,0,.16); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.filter-chip.is-active { background: #1f4e8c; border-color: #1f4e8c; color: #fff; }
.sites-filters select { border-radius: 999px; padding: 6px 10px; font-size: 13px; }
.sites-filter-count { color: var(--muted, #667); }

/* ============================================================
   Desktop admin + modern mobile layer
   ============================================================ */

/* ---- Flow steps (General → Contacts → Map → Summary) ----
   Rendered above the page's first card on every survey-flow screen: the
   bottom margin keeps it from touching whatever panel follows. */
.flow-steps { display: flex; align-items: center; gap: 6px; padding: 10px 14px; margin-bottom: 12px; }
.flow-step { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted, #667); text-decoration: none; white-space: nowrap; }
.flow-step em { font-style: normal; width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(0,0,0,.1); font-size: 11px; }
.flow-step.is-current { color: #1f4e8c; font-weight: 600; }
.flow-step.is-current em { background: #1f4e8c; color: #fff; }
.flow-step.is-done em { background: #2e9e44; color: #fff; }
.flow-step-line { flex: 1; height: 1px; background: rgba(0,0,0,.14); min-width: 8px; }
body.in-shell .flow-steps { display: none; }

/* ---- Map bottom action bar ---- */
.map-action-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; background: rgba(18, 20, 24, .94);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  gap: 6px;
}
.map-action {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: none; border-radius: 10px; background: transparent; color: #e8eaf0;
  font-size: 12px; padding: 6px 4px; cursor: pointer; text-decoration: none;
}
.map-action-icon { font-size: 18px; }
.map-action.is-primary { background: #1f4e8c; }
.map-action:disabled, .map-action.is-disabled { opacity: .4; pointer-events: none; }
.map-action.has-open { color: #ffd27a; }
.map-action-badge { color: #ffd27a; font-weight: 700; }
.map-shell.is-fullscreen .map-item-tray { bottom: calc(70px + env(safe-area-inset-bottom)); }

/* ---- Survey modal as a bottom sheet ---- */
.frame-backdrop { align-items: flex-end !important; }
/* The "Save before closing?" prompt (ui.js confirm) must sit above the survey
   sheet it is asking about. */
.ui-confirm-backdrop { z-index: 120; }
.modal-frame {
  width: 100% !important; max-width: 720px !important;
  height: 92dvh !important; margin: 0 auto;
  border-radius: 18px 18px 0 0 !important;
  animation: sheet-up .34s cubic-bezier(.34, 1.3, .64, 1);
  transition: transform .28s cubic-bezier(.34, 1.3, .64, 1);
  display: flex; flex-direction: column;
}
.modal-frame.is-dragging { transition: none; }
/* flex-basis auto, not 0%: the iframe's height property IS its size — the
   pixel height questions-modal.js pins on every resize of the sheet, or the
   100% baseline above. A 0% basis leaves the size to percentage resolution,
   which one Android build (Edge, Sept 2026) lost after the keyboard closed:
   the sheet grew back, the iframe stayed at its 150px intrinsic default. */
.modal-frame iframe { flex: 1 1 auto; min-height: 0; }
.frame-grip { padding: 10px 0 6px; display: flex; justify-content: center; cursor: grab; touch-action: none; }
.frame-grip span { width: 44px; height: 5px; border-radius: 3px; background: rgba(0,0,0,.25); }

/* ---- Motion (respecting reduced-motion) ---- */
.sheet { animation: sheet-up .32s cubic-bezier(.34, 1.4, .64, 1); }
.modal:not(.modal-frame) { animation: modal-in .22s ease-out; }
@keyframes sheet-up { from { transform: translateY(60%); opacity: .4; } }
@keyframes modal-in { from { transform: scale(.94); opacity: 0; } }
.btn:active, .map-action:active, .tray-item:active { transform: scale(.96); }
.map-marker.pin-drop { animation: pin-drop .5s cubic-bezier(.34, 1.7, .64, 1); }
@keyframes pin-drop { 0% { translate: 0 -26px; opacity: 0; } 100% { translate: 0 0; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .sheet, .modal, .modal-frame, .map-marker.pin-drop { animation: none !important; }
}

/* ---- Skeleton loaders ---- */
.skeleton-list { display: flex; flex-direction: column; gap: 10px; padding: 6px 0; }
.skeleton {
  border-radius: 8px; min-height: 44px;
  background: linear-gradient(100deg, rgba(0,0,0,.07) 40%, rgba(0,0,0,.13) 50%, rgba(0,0,0,.07) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
.skeleton.short { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- PWA install pill ---- */
.pwa-pill {
  position: fixed; left: 12px; right: 12px; bottom: calc(70px + env(safe-area-inset-bottom));
  z-index: 350; display: flex; align-items: center; gap: 10px;
  background: #1c2430; color: #fff; border-radius: 12px; padding: 10px 12px;
  box-shadow: 0 8px 26px rgba(0,0,0,.35); font-size: 13px;
}
.pwa-pill span:first-child { flex: 1; }
.pwa-dismiss { background: none; border: none; color: rgba(255,255,255,.7); font-size: 15px; cursor: pointer; }

/* ---- Pull-to-refresh ---- */
.ptr-indicator {
  position: fixed; top: 0; left: 50%; z-index: 200;
  transform: translate(-50%, calc(var(--pull, 0px) - 46px));
  transition: transform .15s ease-out;
  width: 40px; height: 40px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 12px rgba(0,0,0,.25);
  display: flex; align-items: center; justify-content: center; font-size: 20px; color: #1f4e8c;
}
.ptr-indicator.is-armed { color: #2e9e44; }
.ptr-indicator.is-armed .ptr-spinner, .ptr-indicator.is-refreshing .ptr-spinner { animation: ptr-spin .8s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* ---- Bigger touch targets on touch devices ---- */
@media (pointer: coarse) {
  .q-form input[type="text"], .q-form textarea, .form input, .form select { min-height: 48px; }
  .yesno-opt span, .select-opt span { min-height: 46px; }
  .btn { min-height: 44px; }
}

/* ---- Wizard mode ---- */
.wizard-toggle { margin: 6px 14px; align-self: flex-start; }
.q-wizard .q-card { display: none !important; }
.q-wizard .q-card.wizard-active { display: block !important; }
.q-wizard .q-card.wizard-active .q-label { font-size: 19px; }
.wizard-bar {
  /* In flow, NOT sticky. Wizard mode shows one question at a time, so the
     bar naturally sits right under it — while a sticky bottom bar parked
     itself ON TOP of that question's own input (near-white box over the
     field), and got worse the larger the tech's text size. */
  position: static; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: rgba(255,255,255,.96); border: 1px solid rgba(0,0,0,.1);
  border-radius: 12px; padding: 8px 10px; margin: 10px 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
}
.wizard-count { font-weight: 600; color: #1f4e8c; }

/* ---- Office desktop header (≥1000px): two-tier product header ---- */
/* Row 1 = identity (brand, jump field, signed-in person); row 2 = section
   tabs with an underline indicator, split Work / Operations. Light, on the
   page surface, 98px tall: nothing about it echoes a browser bookmark bar
   (the old 34px dark strip of emoji + 13px text did, and got mistaken for one). */
.desktop-nav { display: none; }
@media (min-width: 1000px) {
  .desktop-nav {
    display: flex; flex-direction: column;
    position: sticky; top: 0; z-index: 60;
    background: var(--card); color: var(--ink);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 6px 18px rgba(22, 32, 46, .05);
  }
  .dnav-identity {
    display: flex; align-items: center; gap: 18px;
    height: 52px; padding: 0 28px; border-bottom: 1px solid var(--line);
  }
  .dnav-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
  .dnav-jump {
    display: inline-flex; align-items: center; gap: 8px; width: 300px; height: 36px;
    padding: 0 12px; border: 1px solid var(--line); border-radius: 10px;
    background: var(--bg); color: var(--ink-soft); font-size: 13px; text-align: left;
  }
  .dnav-jump:hover { border-color: #c3cad5; color: var(--ink); }
  .dnav-jump-label { flex: 1 1 auto; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  /* Tech mode button beside the jump field (desktop nav identity row). */
  .dnav-techmode-form { display: inline-flex; margin: 0; }
  .dnav-techmode {
    display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px;
    border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink-soft);
    font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
  }
  .dnav-techmode:hover { border-color: var(--amber); color: var(--amber); background: var(--amber-soft); }
  .dnav-jump kbd {
    font: inherit; font-size: 11px; font-weight: 600; border: 1px solid var(--line);
    border-radius: 5px; padding: 1px 6px; background: var(--card);
  }
  .dnav-ico { width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .dnav-tabs { display: flex; align-items: center; padding: 0 28px; }
  .dnav-group { display: flex; align-items: center; }
  .dnav-group-label {
    display: inline-flex; align-items: center; height: 20px;
    margin: 0 22px 0 8px; padding-left: 22px; border-left: 1px solid var(--line);
    font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: #9aa3b2;
  }
  .dnav-tab {
    display: inline-flex; align-items: center; gap: 7px; height: 44px; padding: 0 4px; margin-right: 22px;
    font-size: 14px; font-weight: 600; color: var(--ink-soft);
    border-bottom: 2px solid transparent; text-decoration: none;
  }
  .dnav-tab:hover { color: var(--ink); border-bottom-color: #c3cad5; }
  .dnav-tab.is-active { color: var(--ink); font-weight: 700; border-bottom-color: var(--blue); }
  .dnav-badge {
    font-size: 11px; font-weight: 700; line-height: 1.3; min-width: 18px; text-align: center;
    background: #d93838; color: #fff; border-radius: 9px; padding: 1px 6px;
  }
  /* Offices navigate laterally: hide the mobile back-chevron + bottom tabs */
  body:not(.no-tabbar) .appbar { display: none; }
  body:not(.no-tabbar) .bottomnav { display: none; }
  body:not(.no-tabbar) main.page { padding-bottom: 24px; }
  /* Denser typography/spacing for desktop offices */
  body:not(.no-tabbar) { font-size: 14.5px; }
  body:not(.no-tabbar) .panel { padding: 14px 16px; }
  body:not(.no-tabbar) .card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
  /* Use the screen: the 560px column is the MOBILE reading width — office
     desktop pages get the full workspace. Pages are tiered by what they hold:
     wide data pages (default 1320), reading/form pages (860 — inputs stay a
     scannable line length), and edge-to-edge tools (monitor, workspace). */
  body:not(.no-tabbar) main.page { max-width: 1320px; padding-left: 28px; padding-right: 28px; }
  body:not(.no-tabbar) main.page.page-questions,
  body:not(.no-tabbar) main.page.page-narrow { max-width: 860px; }
  body:not(.no-tabbar) main.page.page-enhancements { max-width: 980px; }
  /* main.page carries the selector weight of the 1320px default above —
     these page-type overrides must match it or they silently lose. */
  body:not(.no-tabbar) main.page.page-monitor { max-width: none; }
  /* Audit filters: one toolbar row across the top instead of a stacked form */
  body:not(.no-tabbar) .audit-filters {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(300px, 1.4fr) auto;
    gap: 12px;
    align-items: end;
  }
  body:not(.no-tabbar) .audit-filters .field { margin: 0; }
  body:not(.no-tabbar) .audit-filter-actions { display: flex; gap: 8px; }
  /* Fixed save bar matches the 860px reading/form column above it */
  body:not(.no-tabbar) .sticky-actions { max-width: 860px; }
}
/* Pages embedded in another page's iframe (the monitor's live rail) fill it entirely. */
body.in-shell main.page { max-width: none; }
body.in-shell .appbar, body.in-shell .desktop-nav, body.in-shell .bottomnav { display: none !important; }
body.in-shell main.page { padding-top: 4px; }

/* ---- Office dashboard ---- */
.dash-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; padding: 12px 14px 4px; }
.dash-stat {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  background: #fff; border: 1px solid rgba(0,0,0,.09); border-radius: 12px;
  padding: 14px 16px; text-decoration: none; color: inherit;
}
.dash-stat strong { font-size: 28px; line-height: 1; }
.dash-stat span { font-size: 12px; color: var(--muted, #667); }
.dash-stat.is-progress strong { color: #c07f00; }
.dash-stat.is-done strong { color: #2e9e44; }
.dash-stat.is-alert { border-color: #d93838; }
.dash-stat.is-alert strong { color: #d93838; }
.dash-grid { display: grid; gap: 12px; padding: 10px 14px; }
@media (min-width: 1000px) { .dash-grid { grid-template-columns: 1fr 1fr; } .dash-recent { grid-column: 1 / -1; } }
.dash-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(0,0,0,.07); text-decoration: none; color: inherit; }
.dash-row:last-of-type { border-bottom: 0; }
.dash-row-text { display: flex; flex-direction: column; min-width: 0; }
.dash-row-text small { color: var(--muted, #667); font-size: 12px; }
.dash-live { color: #2e9e44; font-size: 12px; font-weight: 600; white-space: nowrap; }
/* "Online now": a session with no recent request reads muted, not green */
.dash-live.is-idle { color: var(--ink-soft); }
div.dash-row { cursor: default; }

/* Office permission picker (Add/Edit User) */
.perm-mode { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; cursor: pointer; }
.perm-mode small, .perm-check small { display: block; color: var(--ink-soft); font-weight: 400; }
.perm-list {
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 8px;
}
.perm-check { display: flex; gap: 8px; align-items: baseline; cursor: pointer; }

/* "What's new": friendly release notes parsed from the enhancement log */
.dash-release { border-top: 1px solid var(--line); padding: 8px 0; }
.dash-release:first-of-type { border-top: 0; padding-top: 0; }
.dash-release summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.dash-release summary::-webkit-details-marker { display: none; }
.dash-release summary strong { font-size: 14px; }
.dash-release summary strong::after { content: ' ▾'; color: var(--ink-soft); font-size: 11px; }
.dash-release[open] summary strong::after { content: ' ▴'; }
.dash-release summary small { color: var(--ink-soft); white-space: nowrap; }
.dash-release-bullets {
  margin: 8px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-soft);
}
/* Online now: the actual last-activity clock time under the live state */
.dash-live { text-align: right; }
.dash-live-time { display: block; font-weight: 400; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* Online now: per-user groups with one row per session */
.online-user { padding: 8px 0; border-bottom: 1px solid var(--line); }
.online-user:last-child { border-bottom: 0; }
.online-user-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.online-user-head small { color: var(--ink-soft); white-space: nowrap; }
.online-session {
  margin: 4px 0 4px 6px;
  padding: 6px 0 6px 10px;
  border-left: 2px solid var(--line);
  border-bottom: 0;
}
.online-where { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13.5px; }
.online-bg-note, .online-fg-note { font-weight: 600; color: var(--ink-soft); }
.online-fg-note { color: var(--green, #2e9e44); }
.focus-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.focus-dot.is-focused { background: var(--green, #2e9e44); box-shadow: 0 0 0 3px rgba(46,158,68,.18); }
.focus-dot.is-background { background: #c9a227; opacity: .8; }

/* "What's new" sits top-right on desktop; dense flow backfills the gap when
   a permission hides the Online now panel. */
@media (min-width: 1000px) {
  .dash-grid { grid-auto-flow: dense; }
  #whats-new { grid-column: 2; grid-row: 1; }
}

/* Unread releases take over: the What's new panel becomes a centered modal
   over a dimmed page until every release is acknowledged. */
.ack-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 20, 28, 0.55);
  display: grid;
  place-items: center;
  padding: 18px;
  overflow-y: auto;
}
.ack-overlay #whats-new {
  width: min(680px, 100%);
  max-height: min(86vh, 100%);
  overflow-y: auto;
  margin: auto 0;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}
.ack-lead {
  margin: 4px 0 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--blue-soft);
  color: var(--ink);
  font-size: 13.5px;
}

#whats-new.is-attention {
  outline: 2px solid var(--blue);
  box-shadow: 0 0 0 5px var(--blue-soft);
  animation: whatsnew-pulse 1.6s ease-in-out 4;
}
@keyframes whatsnew-pulse {
  0%, 100% { box-shadow: 0 0 0 5px var(--blue-soft); }
  50% { box-shadow: 0 0 0 14px var(--blue-soft); }
}
@media (prefers-reduced-motion: reduce) {
  #whats-new.is-attention { animation: none; }
}

/* ---- Change Log history page ---- */
.changelog-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}
.changelog-filter label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.changelog-filter input[type="date"] { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.changelog-count { color: var(--ink-soft); margin-left: auto; }
.changelog-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; text-transform: none; letter-spacing: 0; font-size: 15px; }
.changelog-title small { color: var(--ink-soft); white-space: nowrap; font-weight: 600; }
.changelog-bullets { font-size: 13.5px; color: var(--ink); }
/* Screenshot slideshow inside an entry */
.release-shots { margin-top: 12px; }
.release-shot { margin: 0; }
.release-shot img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: block;
}
.release-shot figcaption { font-size: 12.5px; color: var(--ink-soft); padding: 6px 2px 0; }
.shot-nav { display: flex; align-items: center; gap: 10px; justify-content: center; margin-top: 8px; }
.shot-count { font-size: 12.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.changelog-link { margin-top: 10px; }

/* NEW-equipment tag (device overview, summary, extension lists) */
.new-chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--green, #2e9e44);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  vertical-align: 1px;
}

/* Per-admin read receipts on release notes */
.release-new {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  vertical-align: 2px;
}
.release-count {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0;
}
.release-ack-form { margin-top: 8px; }
.release-ack-all { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.dash-log-row { display: flex; gap: 10px; align-items: baseline; padding: 5px 0; font-size: 13px; }
.dash-log-action { font-family: ui-monospace, monospace; font-size: 12px; color: #1f4e8c; min-width: 150px; }
.dash-log-row small { margin-left: auto; color: var(--muted, #667); }

/* ---- Command palette ---- */
.palette-backdrop { position: fixed; inset: 0; z-index: 500; background: rgba(10,12,18,.5); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; }
.palette { width: min(560px, calc(100vw - 32px)); background: #fff; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.4); overflow: hidden; }
.palette input { width: 100%; border: none; border-bottom: 1px solid rgba(0,0,0,.1); padding: 16px 18px; font-size: 16px; outline: none; }
.palette-list { max-height: 46vh; overflow-y: auto; }
.palette-row { display: flex; align-items: center; gap: 10px; width: 100%; border: none; background: none; text-align: left; padding: 10px 16px; cursor: pointer; font-size: 14px; }
.palette-row small { margin-left: auto; color: var(--muted, #667); }
.palette-row.is-cursor, .palette-row:hover { background: rgba(31,78,140,.1); }
.palette-empty { padding: 18px; color: var(--muted, #667); text-align: center; }
.palette-hint { padding: 8px 16px; font-size: 11px; color: var(--muted, #667); border-top: 1px solid rgba(0,0,0,.07); }
.palette-hint kbd { background: rgba(0,0,0,.08); border-radius: 4px; padding: 1px 5px; }

/* ---- Sites table view ---- */
.sites-table-wrap { overflow-x: auto; padding: 0 14px 20px; }
.sites-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; font-size: 13.5px; }
.sites-table th { text-align: left; padding: 10px 12px; background: #eef1f7; cursor: pointer; user-select: none; white-space: nowrap; }
.sites-table td { padding: 10px 12px; border-top: 1px solid rgba(0,0,0,.06); vertical-align: middle; }
.sites-table a { color: inherit; text-decoration: none; }
.sites-table-progress { min-width: 140px; }
.sites-table-actions { white-space: nowrap; }
.view-toggle { margin-left: auto; display: inline-flex; gap: 4px; }

/* ---- Dark mode (html.theme-dark) ---- */
html.theme-dark body { background: #14161a; color: #e6e8ee; }
html.theme-dark .appbar { background: rgba(22,25,31,.92); color: #e6e8ee; }
html.theme-dark .appbar-title { color: #e6e8ee; }
html.theme-dark .desktop-nav { background: #1a1e25; color: #e6e8ee; border-color: rgba(255,255,255,.08); box-shadow: none; }
html.theme-dark .dnav-identity, html.theme-dark .dnav-group-label, html.theme-dark .desktop-nav-account, html.theme-dark .brand-suffix { border-color: rgba(255,255,255,.1); }
html.theme-dark .brand-uni, html.theme-dark .dnav-tab.is-active, html.theme-dark .dnav-who strong { color: #e6e8ee; }
html.theme-dark .dnav-tab, html.theme-dark .dnav-who small, html.theme-dark .brand-suffix { color: #aeb6c6; }
html.theme-dark .dnav-tab:hover { color: #e6e8ee; }
html.theme-dark .dnav-jump { background: #14171c; border-color: rgba(255,255,255,.14); color: #aeb6c6; }
html.theme-dark .dnav-jump kbd { background: #1e2229; border-color: rgba(255,255,255,.14); }
html.theme-dark .dnav-techmode { background: #14171c; border-color: rgba(255,255,255,.14); color: #aeb6c6; }
html.theme-dark .dnav-techmode:hover { border-color: #ffd166; color: #ffd166; background: rgba(255, 196, 77, .12); }
html.theme-dark .panel, html.theme-dark .site-card, html.theme-dark .modal,
html.theme-dark .sheet, html.theme-dark .dash-stat, html.theme-dark .sites-table,
html.theme-dark .palette, html.theme-dark .site-info-strip, html.theme-dark .item-list {
  background: #1e2229; border-color: rgba(255,255,255,.09); color: #e6e8ee;
}
html.theme-dark .q-form, html.theme-dark .q-card, html.theme-dark .form { background: transparent; }
html.theme-dark input, html.theme-dark textarea, html.theme-dark select {
  background: #14171c; color: #e6e8ee; border-color: rgba(255,255,255,.16);
}
html.theme-dark .bottomnav { background: #1a1e25; color: #cfd6e4; border-color: rgba(255,255,255,.08); }
html.theme-dark .bottomnav-item { color: #aeb6c6; }
html.theme-dark .filter-chip, html.theme-dark .items-table-locate,
html.theme-dark .items-table-edit, html.theme-dark .btn:not(.btn-primary):not(.btn-danger) {
  background: #262b34; color: #dfe3ea; border-color: rgba(255,255,255,.16);
}
html.theme-dark .sites-table th { background: #262b34; }
html.theme-dark .sites-table td { border-color: rgba(255,255,255,.07); }
html.theme-dark .q-note, html.theme-dark small { color: #9aa3b3; }
html.theme-dark .palette input { background: #1e2229; color: #e6e8ee; border-color: rgba(255,255,255,.1); }
html.theme-dark .wizard-bar { background: rgba(30,34,41,.97); border-color: rgba(255,255,255,.12); }
html.theme-dark .skeleton { background: linear-gradient(100deg, rgba(255,255,255,.07) 40%, rgba(255,255,255,.14) 50%, rgba(255,255,255,.07) 60%); background-size: 200% 100%; }
html.theme-dark .ext-suggest-chip { background: #1d2a3d; border-color: #2c4361; color: #9dc1ef; }
html.theme-dark .empty-state, html.theme-dark .greeting, html.theme-dark .list-count { color: #cfd6e4; }
html.theme-dark .modal-note, html.theme-dark .sheet-title, html.theme-dark .panel-title { color: #e6e8ee; }

/* ---- Enhancement requests ---- */
.enh-hint { padding: 8px 14px 0; }
.enh-form { margin: 10px 14px; }
.enh-filters { padding: 4px 14px; }
.enh-list { display: flex; flex-direction: column; gap: 10px; padding: 8px 14px 24px; }
.enh-row summary { display: flex; align-items: baseline; gap: 10px; cursor: pointer; flex-wrap: wrap; }
.enh-row summary strong { flex: 1; min-width: 200px; }
.enh-row summary small { color: var(--muted, #667); }
.enh-status { font-size: 12px; font-weight: 600; white-space: nowrap; }
.enh-status-approved { color: #2e9e44; }
.enh-status-rejected { color: #d93838; }
.enh-status-planning { color: #c07f00; }
.enh-status-planned { color: #1f4e8c; }
.enh-prompt { white-space: pre-wrap; background: rgba(0,0,0,.04); border-radius: 8px; padding: 10px 12px; margin: 10px 0; }
.enh-plan-text { white-space: pre-wrap; font: 13px/1.5 ui-monospace, Menlo, monospace; background: rgba(31,78,140,.06); border-radius: 8px; padding: 12px; overflow-x: auto; }
.enh-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.enh-reject-form { display: flex; gap: 6px; margin-left: auto; }
.enh-reject-form input { max-width: 220px; }
.enh-resubmit { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; border-top: 1px dashed rgba(0,0,0,.15); padding-top: 10px; }
html.theme-dark .enh-prompt { background: rgba(255,255,255,.06); }
html.theme-dark .enh-plan-text { background: rgba(120,170,255,.09); }

/* The install pill never covers the fullscreen map's bars */
body:has(.map-shell.is-fullscreen) .pwa-pill { display: none; }

/* ---- Text & icon size control (account sheet) ---- */
.account-scale-row { cursor: default; }
.scale-control { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.scale-slider { display: flex; align-items: center; gap: 10px; }
.scale-slider small { font-size: 11px; color: var(--muted, #667); }
.scale-slider .scale-big { font-size: 19px; }
.scale-slider input[type="range"] { flex: 1; accent-color: #1f4e8c; min-height: 28px; }
html.theme-dark .scale-slider small { color: #9aa3b3; }

/* ============================================================
   Login — state-of-the-art split hero (desktop) / full-bleed (mobile)
   ============================================================ */
.page-login { padding: 0 !important; min-height: 100dvh; max-width: none; } /* full-bleed: the base .page 560px cap would clip the split hero */
.page-login::before { display: none; } /* retire the old glow */

.login-stage {
  position: relative; min-height: 100dvh; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center;
  padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
  background:
    radial-gradient(1100px 600px at 85% -10%, #eaf1fb 0%, transparent 60%),
    linear-gradient(165deg, #f7f9fd 0%, #eef2f9 55%, #e8edf7 100%);
}

/* ---- Ambient backdrop: blueprint grid + auroras + pulsing pins ---- */
.login-bg { position: absolute; inset: -30px; pointer-events: none; transition: transform .4s ease-out; }
.login-bg-grid {
  position: absolute; inset: 0; opacity: .5;
  background:
    repeating-linear-gradient(0deg,   rgba(31,78,140,.07) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg,  rgba(31,78,140,.07) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(0deg,   rgba(31,78,140,.05) 0 1px, transparent 1px 220px),
    repeating-linear-gradient(90deg,  rgba(31,78,140,.05) 0 1px, transparent 1px 220px);
  mask-image: radial-gradient(120% 90% at 50% 45%, #000 30%, transparent 100%);
}
.login-aurora { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(70px); opacity: .5; }
.login-aurora-a { top: -25vmax; left: -18vmax; background: radial-gradient(circle, rgba(64,132,214,.35), transparent 65%); animation: aurora-a 22s ease-in-out infinite alternate; }
.login-aurora-b { bottom: -28vmax; right: -20vmax; background: radial-gradient(circle, rgba(46,158,68,.22), transparent 65%); animation: aurora-b 26s ease-in-out infinite alternate; }
@keyframes aurora-a { to { transform: translate(9vmax, 6vmax) scale(1.15); } }
@keyframes aurora-b { to { transform: translate(-7vmax, -5vmax) scale(1.1); } }

.login-pin { position: absolute; left: var(--x); top: var(--y); width: 10px; height: 10px; border-radius: 50%; background: #1f4e8c; opacity: .55; }
.login-pin::after {
  content: ""; position: absolute; inset: -9px; border-radius: 50%;
  border: 2px solid rgba(31,78,140,.5);
  animation: pin-pulse 3.6s ease-out infinite; animation-delay: var(--d);
}
@keyframes pin-pulse { 0% { transform: scale(.4); opacity: .9; } 70%, 100% { transform: scale(1.9); opacity: 0; } }

/* ---- Brand side ---- */
.login-brand { position: relative; text-align: center; margin: 0 auto 22px; max-width: 560px; animation: login-rise .5s ease both; }
.login-brand .login-logo img { display: block; margin: 0 auto 14px; height: 40px; width: auto; max-width: min(240px, 60vw); }
.login-headline { font-size: clamp(26px, 6vw, 44px); line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 10px; color: #16233a; }
.login-headline em { font-style: normal; background: linear-gradient(92deg, #1f4e8c, #3f8ae0 60%, #2e9e44); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-tagline { color: #52627c; max-width: 420px; margin: 0 auto; font-size: 15px; line-height: 1.5; }
.login-points { list-style: none; padding: 0; margin: 18px auto 0; display: none; max-width: 380px; text-align: left; }
.login-points li { display: flex; gap: 10px; align-items: center; padding: 9px 0; color: #3c4c66; font-size: 14.5px; border-bottom: 1px dashed rgba(31,78,140,.15); }
.login-points li:last-child { border-bottom: 0; }
.login-points li span { font-size: 18px; }

/* ---- Form card (glass) ---- */
.login-panel { position: relative; display: flex; justify-content: center; animation: login-rise .55s .08s ease both; }
.login-card {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 22px;
  padding: 26px 22px 18px;
  box-shadow: 0 24px 70px rgba(23, 42, 74, .16), 0 2px 8px rgba(23, 42, 74, .06);
}
@supports (backdrop-filter: blur(14px)) {
  .login-card { background: rgba(255, 255, 255, .6); backdrop-filter: blur(14px) saturate(1.3); }
}
.login-card-head { margin-bottom: 16px; }
.login-card-head h2 { margin: 0 0 2px; font-size: 22px; letter-spacing: -0.01em; }
.login-card-head p { margin: 0; color: #62708a; font-size: 14px; }

.login-form .field input {
  border-radius: 12px; border: 1.5px solid rgba(31, 78, 140, .18);
  background: rgba(255, 255, 255, .85);
  transition: border-color .15s, box-shadow .15s;
}
.login-form .field input:focus {
  outline: none; border-color: #3f8ae0;
  box-shadow: 0 0 0 4px rgba(63, 138, 224, .18);
}
.capslock-hint { display: block; margin-top: 6px; color: #b26a00; font-weight: 600; }

.login-cta {
  position: relative; margin-top: 6px; border-radius: 14px;
  background: linear-gradient(94deg, #1f4e8c 0%, #2f6cbe 55%, #3f8ae0 100%);
  box-shadow: 0 10px 26px rgba(31, 78, 140, .35);
  transition: transform .12s, box-shadow .2s, filter .2s;
}
.login-cta:hover { filter: brightness(1.06); box-shadow: 0 14px 32px rgba(31, 78, 140, .42); }
.login-cta:active { transform: translateY(1px) scale(.99); }
.login-cta-spinner { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; animation: ptr-spin .7s linear infinite; }
.login-cta.is-loading { pointer-events: none; opacity: .9; }
.login-cta.is-loading .login-cta-spinner { display: inline-block; margin-left: 10px; vertical-align: -3px; }

.login-bye { background: #eaf6ec; border-left: 4px solid #2e9e44; border-radius: 8px 12px 12px 8px; }
.login-shake { animation: login-shake .4s ease; }
@keyframes login-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.login-copy { text-align: center; color: #8a94a8; font-size: 12px; margin: 16px 0 0; }

/* ---- Desktop: split hero ---- */
@media (min-width: 900px) {
  .login-stage { flex-direction: row; align-items: center; justify-content: center; gap: clamp(40px, 7vw, 110px); padding: 40px; }
  .login-brand { text-align: left; margin: 0; flex: 0 1 480px; }
  .login-brand .login-logo img { margin: 0 0 22px; }
  .login-tagline { margin: 0; }
  .login-points { display: block; margin-left: 0; }
  .login-panel { flex: 0 0 auto; }
  .login-card { width: 420px; padding: 34px 32px 22px; }
}

/* ---- Dark theme ---- */
html.theme-dark .login-stage {
  background:
    radial-gradient(1100px 600px at 85% -10%, rgba(47, 108, 190, .18) 0%, transparent 60%),
    linear-gradient(165deg, #10141b 0%, #12171f 55%, #0e1219 100%);
}
html.theme-dark .login-bg-grid {
  background:
    repeating-linear-gradient(0deg,  rgba(120, 170, 255, .08) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg, rgba(120, 170, 255, .08) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(0deg,  rgba(120, 170, 255, .05) 0 1px, transparent 1px 220px),
    repeating-linear-gradient(90deg, rgba(120, 170, 255, .05) 0 1px, transparent 1px 220px);
}
html.theme-dark .login-headline { color: #eef2f9; }
html.theme-dark .login-tagline { color: #9aa7bd; }
html.theme-dark .login-points li { color: #b7c2d6; border-color: rgba(120,170,255,.14); }
html.theme-dark .login-card {
  background: rgba(24, 29, 38, .82); border-color: rgba(255, 255, 255, .1);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .5);
}
@supports (backdrop-filter: blur(14px)) {
  html.theme-dark .login-card { background: rgba(24, 29, 38, .62); }
}
html.theme-dark .login-card-head p { color: #93a0b6; }
html.theme-dark .login-form .field input { background: rgba(12, 15, 20, .8); border-color: rgba(120, 170, 255, .22); color: #e6e8ee; }
html.theme-dark .login-bye { background: rgba(46, 158, 68, .14); color: #cfe9d4; }
html.theme-dark .login-pin { background: #6ea8ef; }
html.theme-dark .login-copy { color: #6c7890; }

@media (prefers-reduced-motion: reduce) {
  .login-aurora, .login-pin::after, .login-brand, .login-panel { animation: none !important; }
  .login-bg { transition: none; }
}

/* ---- Pre-visit prep (site form + tech dashboard badge) ---- */
.prep-task-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.prep-task-row { display: flex; gap: 8px; align-items: center; }
.prep-task-row input { flex: 1; min-width: 0; }
/* (.prep-task-remove shares the row-editor ✕ styling with planned-ext) */
.site-card-tasks {
  margin-top: 8px; padding: 8px 10px; border-radius: 9px; font-size: 13px;
  background: rgba(31, 78, 140, .08); color: #1f4e8c; font-weight: 600;
}
html.theme-dark .site-card-tasks { background: rgba(120, 170, 255, .12); color: #9dc1ef; }

/* ============================================================
   Office desktop polish batch (Aug 27): brand wordmark, nav account,
   activity + alerts cleanup, inline site editing, deleted sites.
   ============================================================ */

/* ---- Brand wordmark (top-left of the desktop nav) ---- */
.desktop-nav-brand { display: inline-flex; align-items: baseline; gap: 8px; text-decoration: none; }
a.desktop-nav-brand:hover .brand-suffix { color: var(--ink); }
.brand-uni { color: var(--ink); font-weight: 800; font-size: 17px; letter-spacing: .02em; }
.brand-voxx {
  font-weight: 800; font-size: 17px; letter-spacing: .02em;
  background: linear-gradient(92deg, #1554d1, #3d86e6 70%, #14804a);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-uni + .brand-voxx { margin-left: -8px; } /* one word, two colors */
.brand-suffix {
  color: var(--ink-soft); font-size: 11px; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; border-left: 1px solid var(--line); padding-left: 8px;
}

/* ---- Account (preferences + logout) in the desktop nav ---- */
.desktop-nav-account {
  border: none; background: none; padding: 0 0 0 16px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 10px; border-left: 1px solid var(--line);
  color: var(--ink); text-align: left;
}
.desktop-nav-account .appbar-avatar { width: 32px; height: 32px; font-size: 14px; }
.desktop-nav-account:hover .appbar-avatar { box-shadow: 0 0 0 3px var(--blue-soft); }
.dnav-who { display: flex; flex-direction: column; line-height: 1.15; }
.dnav-who strong { font-size: 13px; font-weight: 700; }
.dnav-who small { font-size: 11.5px; color: var(--ink-soft); }

/* ---- Activity Log: calmer, denser rows ---- */
.audit-row { padding: 8px 14px; border-radius: 10px; box-shadow: none; }
.audit-row-top strong { font-size: 13.5px; }
.audit-url { font-family: 'SF Mono', ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; margin-top: 3px; }
.audit-meta { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 11.5px; }
/* Action badge tinted by family so the eye can group at a glance */
.audit-action[data-kind="view"]   { background: rgba(0,0,0,.06); color: var(--ink-soft); }
.audit-action[data-kind="auth"]   { background: #ece7fb; color: #5b3fa8; }
.audit-action[data-kind="site"]   { background: #e7f0fb; color: #1f4e8c; }
.audit-action[data-kind="survey"],
.audit-action[data-kind="marker"],
.audit-action[data-kind="map"]    { background: #e8f6ec; color: #22713a; }
.audit-action[data-kind="task"],
.audit-action[data-kind="note"]   { background: #fdf3e3; color: #8a5a00; }
.audit-action[data-kind="alert"],
.audit-action[data-kind="validation"] { background: #fdeaec; color: #a02330; }
@media (min-width: 1000px) {
  body:not(.no-tabbar) .audit-filters .field input,
  body:not(.no-tabbar) .audit-filters .field select { min-height: 42px; padding: 8px 10px; font-size: 14px; }
  body:not(.no-tabbar) .audit-filters .field-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
  body:not(.no-tabbar) .audit-filter-actions .btn { min-height: 42px; flex: none; }
}

/* ---- Alerts: content left, action right, no stacked height waste ---- */
.alert-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; }
.alert-row-main { min-width: 0; }
.alert-row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.alert-row-side .audit-time { margin-left: 0; }
.alert-ack-form { margin: 0; }
.alerts-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.alerts-toolbar .list-count { margin: 0 auto 0 0; }
.alerts-toolbar form { margin: 0; }
@media (max-width: 700px) {
  .alert-row { grid-template-columns: 1fr; }
  .alert-row-side { flex-direction: row; align-items: center; text-align: left; }
}

/* ---- Live Site View: inline-editable site information ---- */
.siteinfo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 2px 18px; }
.siteinfo-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; min-height: 38px; }
.siteinfo-row dt { flex: none; width: 108px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
.siteinfo-row dd { margin: 0; min-width: 0; flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.siteinfo-row.is-editable { cursor: pointer; }
.siteinfo-row.is-editable:hover { background: rgba(31,78,140,.07); }
.siteinfo-row.is-editable:hover::after { content: '✎'; color: var(--blue); font-size: 13px; }
.siteinfo-row input, .siteinfo-row select {
  flex: 1; min-width: 0; font: inherit; font-weight: 600;
  border: 1.5px solid var(--blue); border-radius: 7px; padding: 4px 8px; outline: none;
}
.siteinfo-empty { color: var(--ink-soft); font-weight: 400; font-style: italic; }
.siteinfo-techs summary { cursor: pointer; font-weight: 600; list-style: none; }
.siteinfo-techs summary::-webkit-details-marker { display: none; }
.siteinfo-techs-editor { margin: 8px 0 4px; display: grid; gap: 6px; }
.siteinfo-techs-editor label { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.siteinfo-techs-editor .btn { justify-self: start; }

/* ---- Live Site View: tasks & notes, integrated ---- */
.mon-tasknotes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.mon-tasknotes h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin: 0 0 8px; }
.mon-task { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px dashed rgba(0,0,0,.08); font-size: 14px; }
.mon-task:last-child { border-bottom: 0; }
.mon-task.is-done { color: var(--ink-soft); }
.mon-task.is-done .mon-task-title { text-decoration: line-through; }
.mon-task small, .mon-note small { color: var(--ink-soft); }
.mon-task-title { flex: 1; min-width: 0; }
.mon-note { padding: 6px 0; border-bottom: 1px dashed rgba(0,0,0,.08); font-size: 14px; }
.mon-note:last-child { border-bottom: 0; }
.mon-note p { margin: 0 0 2px; white-space: pre-wrap; }
.mon-tn-empty { color: var(--ink-soft); font-size: 14px; }
.mon-tn-hint { margin-top: 10px; font-size: 12.5px; color: var(--ink-soft); }

/* ---- Deleted sites (recoverable) on the Sites page ---- */
.deleted-sites { margin-top: 26px; }
.deleted-sites summary { cursor: pointer; color: var(--ink-soft); font-weight: 600; font-size: 14px; }
.deleted-site-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin-top: 8px;
  background: var(--card); border: 1px dashed var(--line); border-radius: 10px;
}
.deleted-site-row .deleted-site-main { flex: 1; min-width: 0; }
.deleted-site-row small { color: var(--ink-soft); display: block; }
.deleted-site-row form { margin: 0; }
/* Deleted users (Team page): same dashed-card rows, with a dimmed avatar */
.deleted-user-row .tech-card-avatar.is-deleted {
  filter: grayscale(1);
  opacity: 0.55;
  flex: 0 0 auto;
}
.deleted-user-row strong { display: block; }

/* Danger zone on the site edit form. The fixed Save bar floats over the
   page bottom — the large bottom margin keeps Delete clear of it. */
.danger-zone { margin: 26px 0 130px; border: 1px solid #f6d4d8; border-radius: 12px; padding: 14px 16px; background: #fdf7f8; }
.danger-zone h2 { font-size: 14px; color: var(--danger); margin: 0 0 6px; }
.danger-zone p { margin: 0 0 10px; font-size: 13.5px; color: var(--ink-soft); }
.panel-title-hint { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--ink-soft); font-size: 12px; }
.panel-title-hint a { color: var(--blue); text-decoration: none; }
/* No live tech → the rail column collapses and the monitor takes the width */
.monitor-grid.rail-hidden { grid-template-columns: minmax(0, 1fr); }
.monitor-grid.rail-hidden .monitor-rail { display: none; }

/* ---- Pixel-snapshot backup panel on the Live Screen ---- */
.live-shot {
  position: fixed; right: 14px; bottom: 14px; z-index: 97;
  width: min(420px, calc(100vw - 28px));
  background: #14181f; border: 1px solid rgba(255,255,255,.16); border-radius: 12px;
  box-shadow: 0 18px 44px rgba(0,0,0,.5); overflow: hidden;
}
.live-shot-head {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  color: #dfe5ee; font-size: 13px;
}
.live-shot-head span { color: #93a0b4; margin-right: auto; font-size: 12px; }
.live-shot img { display: block; width: 100%; height: auto; background: #000; }

/* ---- Item survey sheet: header delete + in-flow save actions ---- */
/* Delete sits in the item header row — a quiet ghost icon tied to the item */
.q-context-delete {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--danger);
}
.q-context-delete svg { width: 17px; height: 17px; }
.q-context-delete:active { background: var(--danger); color: #fff; }
/* In the survey sheet the save actions sit in the page flow at the end of
   the form — no fixed bar floating over the questions. */
body.is-embed .sticky-actions {
  position: static; margin: 18px 0 8px; padding: 0;
  background: none; max-width: none;
}
body.is-embed .page > .form { padding-bottom: 24px; } /* no fixed bar to clear */

/* ---- Pin fan-out (overlap declutter) + undefined-item star ---- */
.map-marker.is-fanned { z-index: 12; transition: transform .18s ease; }
.map-fan-line {
  position: absolute; height: 2px; border-radius: 2px;
  background: rgba(31, 78, 140, .5); transform-origin: 0 50%;
  pointer-events: none;
}
/* An item that exists on the map but has NOTHING saved yet: a soft red star
   badging the pin head itself until its first answers are saved. (On
   .map-marker, not the pin — the pin body is rotated -45° for the teardrop;
   the pin circle is 36px wide, centered, so its top-right edge sits at
   50% + ~11px.) */
.map-marker[data-survey-status="none"]::after,
.map-marker[data-survey-status="not_started"]::after {
  content: '★';
  position: absolute; top: -3px; left: calc(50% + 9px); right: auto;
  font-size: 13px; line-height: 1; color: #e4756b;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff;
  pointer-events: none;
  z-index: 2;
}

/* Wizard mode owns the navigation until the last card — hide Save until then
   so the sticky bar and the Back/Next bar never stack. */
form.q-wizard .sticky-actions { display: none; }
form.q-wizard.q-wizard-last .sticky-actions { display: block; }
/* The wizard bar hugs the sheet/page bottom now that Save is in-flow. */

/* ---- Live fax test panel (question-form, fax markers) ---- */
.fax-test {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px; margin: 0 0 14px;
}
.fax-test.is-busy { opacity: .65; pointer-events: none; }
.fax-test-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.fax-test-chip {
  font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px;
  background: var(--gray-soft); color: var(--ink-soft);
}
.fax-test-chip[data-tone="ok"] { background: var(--blue-soft); color: var(--blue); }
.fax-test-chip[data-tone="done"] { background: var(--green-soft); color: var(--green); }
.fax-test-chip[data-tone="warn"] { background: var(--amber-soft); color: var(--amber); }
.fax-test-lead { margin: 0 0 8px; font-size: 15px; }
.fax-test-done { color: var(--green); font-weight: 600; }
.fax-test-number {
  font-size: 30px; font-weight: 800; letter-spacing: 1px; margin: 4px 0 10px;
  color: var(--blue); font-variant-numeric: tabular-nums;
}
.fax-test-error { color: var(--danger); font-size: 13.5px; margin: 8px 0; }
.fax-test-proof { margin: 10px 0; }
.fax-test-fallback { margin-top: 10px; }
.fax-test-fallback summary { cursor: pointer; color: var(--ink-soft); font-size: 13.5px; }
.fax-test-code { display: flex; gap: 8px; margin-top: 8px; }
.fax-test-code input {
  flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: 2px;
  font-family: ui-monospace, Menlo, monospace;
}
.fax-test-proof-link { color: var(--blue); font-size: 13.5px; }
.btn-link {
  background: none; border: none; padding: 0; color: var(--blue);
  font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: underline;
}
.fax-test-spinner {
  display: inline-block; width: 12px; height: 12px; vertical-align: -1px;
  border: 2px solid var(--blue-soft); border-top-color: var(--blue);
  border-radius: 50%; animation: fax-spin 0.9s linear infinite;
}
@keyframes fax-spin { to { transform: rotate(360deg); } }
html.theme-dark .fax-test { background: #1a1e25; border-color: rgba(255,255,255,.08); }
html.theme-dark .fax-test-chip { background: rgba(255,255,255,.08); color: #aeb6c6; }

/* Office → Fax numbers pool */
.fax-pool-status { font-size: 13px; color: var(--ink-soft); }
.fax-pool-status.is-live { color: var(--amber); font-weight: 600; }
.fax-pool-off td { opacity: .55; }
.fax-test-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.fax-test-quick { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.fax-test-preview img {
  display: block; height: 84px; width: auto; border: 1px solid var(--line);
  border-radius: 6px; background: #fff;
}
.fax-test-quick { align-items: center; }
.fax-test-preview-wrap { position: relative; display: inline-block; }
.fax-preview-delete {
  position: absolute; top: -7px; right: -7px; width: 22px; height: 22px;
  border-radius: 50%; border: none; background: var(--danger); color: #fff;
  font-size: 12px; line-height: 22px; padding: 0; cursor: pointer;
  box-shadow: 0 1px 3px rgba(22,32,46,.25);
}
/* The attached-document chip: file name + the shared ✕ delete bubble. */
.fax-doc-chip {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  max-width: 100%; padding: 6px 26px 6px 10px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--blue-soft); color: var(--blue);
  font-size: 13.5px; font-weight: 600;
}
.fax-doc-chip .fax-doc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.fax-doc-chip .fax-preview-delete { top: -7px; right: -7px; }
.fax-doc-attach .file-trigger { font-size: 13.5px; }
html.theme-dark .fax-doc-chip { background: rgba(59,130,246,.15); border-color: rgba(255,255,255,.08); }
.fax-test-lastsent {
  position: relative; display: flex; align-items: center; gap: 10px;
  margin-top: 10px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--green-soft);
}
.fax-test-lastsent img { height: 56px; width: auto; border-radius: 4px; border: 1px solid var(--line); background: #fff; display: block; }
.fax-test-lastsent-note { font-size: 13.5px; color: var(--green); }
.fax-test-lastsent-note small { color: var(--ink-soft); }
html.theme-dark .fax-test-lastsent { background: rgba(20,128,74,.15); border-color: rgba(255,255,255,.08); }

/* ---- Office → Fax test numbers pool ---- */
.fax-pool-intro { margin: 0 0 16px; max-width: 640px; }
.fax-pool-chips { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.fax-pool-chip { font-size: 12.5px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--gray-soft); color: var(--ink-soft); }
.fax-pool-chip.is-free { background: var(--green-soft); color: var(--green); }
.fax-pool-chip.is-busy { background: var(--amber-soft); color: var(--amber); }
.fax-pool-add { margin-bottom: 18px; }
.fax-pool-add-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.fax-pool-field { flex: 1; min-width: 180px; display: grid; gap: 4px; }
.fax-pool-optional { font-weight: 400; color: var(--ink-soft); font-size: 12px; }
.fax-pool-list { display: grid; gap: 8px; }
.fax-pool-card {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 16px; box-shadow: var(--shadow);
}
.fax-pool-card.fax-pool-off { opacity: .6; box-shadow: none; border-style: dashed; }
.fax-pool-main { display: grid; min-width: 150px; }
.fax-pool-number { font-size: 17px; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.fax-pool-label { color: var(--ink-soft); }
.fax-pool-status { flex: 1; font-size: 13.5px; color: var(--ink-soft); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.fax-pool-status small { color: var(--ink-soft); font-size: 12px; }
.fax-pool-status.is-free { color: var(--green); }
.fax-pool-status.is-live { color: var(--amber); font-weight: 600; }
.fax-pool-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.fax-pool-status.is-live .fax-pool-dot { animation: fax-pool-pulse 1.4s ease-in-out infinite; }
@keyframes fax-pool-pulse { 50% { opacity: .35; } }
.fax-pool-toggle { margin-left: auto; display: flex; gap: 8px; }
.fax-pool-toggle form { margin: 0; }
html.theme-dark .fax-pool-card { background: #1a1e25; border-color: rgba(255,255,255,.08); }
html.theme-dark .fax-pool-chip { background: rgba(255,255,255,.08); color: #aeb6c6; }
/* The add-number panel lives outside .form/.q-card scopes — give its inputs
   the app's standard field look, and keep the row compact on desktop. */
.fax-pool-add { max-width: 760px; }
.fax-pool-add input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: var(--card);
}
.fax-pool-add input::placeholder { color: var(--ink-soft); opacity: .7; }
.fax-pool-add input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}
.fax-pool-add #fax-num-input {
  font-variant-numeric: tabular-nums;
  letter-spacing: .5px;
}
.fax-pool-add .btn { min-height: 48px; }
.fax-pool-field { max-width: 280px; }
html.theme-dark .flow-step { color: #aeb6c6; }
html.theme-dark .flow-step em { background: rgba(255,255,255,.14); color: #e6e8ee; }
html.theme-dark .flow-step.is-current { color: #7fb0ff; }
html.theme-dark .flow-step-line { background: rgba(255,255,255,.16); }
.fax-test-pick { display: grid; gap: 4px; margin: 8px 0 12px; max-width: 340px; }
.fax-test-numsel {
  min-height: 44px; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--card); color: var(--ink);
  font: inherit; font-variant-numeric: tabular-nums;
}
.fax-test-numsel:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
.fax-test-freecount { font-weight: 400; color: var(--ink-soft); font-size: 12px; margin-left: 6px; }
.fax-test-fromsel { max-width: 250px; min-height: 40px; padding: 6px 10px; font-size: 13.5px; }

/* ---- Video evidence (telecom closet walkthroughs) ---- */
/* In the editable survey the tile plays inline; in read-only views (summary,
   preview, monitor) the tile is a link, so the frame is a poster with a play
   badge and the click opens the clip full size. */
.photo-thumb video {
  width: 100%; height: 100%; object-fit: cover;
  display: block; border-radius: inherit; background: #0d1117;
}
.photo-thumb .photo-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 22px; color: #fff; text-shadow: 0 2px 8px rgba(0, 0, 0, .6);
  pointer-events: none;
}

/* ---- Video: optional download + processing state ---- */
/* Playback streams (poster + preload=metadata + byte-range); downloading the
   whole clip is a deliberate, separate action. */
.photo-download {
  position: absolute; left: 6px; bottom: 6px; z-index: 2;
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 50%; text-decoration: none;
  background: rgba(15, 20, 28, .82); color: #fff; font-size: 14px;
  /* No backdrop-filter: it renders as an opaque grey/white block on some
     Android GPUs (the map action bar had the same problem and dropped it). */
}
.photo-download:active { background: var(--blue); }
.video-working {
  position: absolute; inset: auto 6px 6px auto; z-index: 2;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(15, 20, 28, .72); color: #fff;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.photo-thumb video[poster] { background: #0d1117; }

/* ---- Customer Onboarding hand-off (site summary, office only) ---- */
.alert-warn { background: var(--amber-soft); color: var(--amber); }
/* Header row: title + linked-state chip, so the panel's standing is readable
   before the form is. */
.onb-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.onb-head .panel-title { margin: 0; }
.onb-link-chip {
  font-size: 11px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase;
  border-radius: 999px; padding: 3px 10px; white-space: nowrap;
  background: var(--bg); color: var(--ink-soft);
}
.onb-link-chip::before { content: '○ '; }
.onb-link-chip.is-linked { background: var(--green-soft); color: var(--green); }
.onb-link-chip.is-linked::before { content: '● '; }

.onb-form { display: grid; gap: 10px; }
/* Linked state: the stored customer ID as settled, read-only information —
   the editable field is collapsed behind "Change" so a synced site shows no
   unnecessary form controls. Layout is one hugging row: the id box wraps its
   content (never flex-fills), with copy and Change tight beside it. */
.onb-linked { display: grid; gap: 5px; justify-items: start; }
.onb-linked-label { font-weight: 500; } /* a step quieter than the form label */
.onb-linked-row { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.onb-linked-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; font-weight: 400; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  height: 34px; display: inline-flex; align-items: center; padding: 0 10px;
  white-space: nowrap; overflow: hidden;
  flex: 0 1 auto; min-width: 0; /* hugs its content; shrinks before wrapping */
}
.onb-linked-id:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.onb-icon-btn {
  flex: none; width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card);
  color: var(--ink-soft); cursor: pointer; padding: 0;
}
.onb-icon-btn:hover { background: var(--bg); color: var(--ink); }
.onb-icon-btn.is-copied { color: var(--green); border-color: var(--green); }
.onb-copied { flex: none; font-size: 12px; font-weight: 700; color: var(--green); }
.onb-change-btn {
  flex: none; height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card);
  color: var(--ink); font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.onb-change-btn:hover { background: var(--bg); }
.onb-icon-btn:focus-visible, .onb-change-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
/* Quiet reveal control on a fresh site: the ID field only appears for the
   office user who explicitly wants to link an existing customer. */
.onb-reveal {
  justify-self: start; border: 0; background: none; padding: 0;
  font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--blue);
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.onb-reveal:hover { color: var(--blue-dark); }
.onb-reveal:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
/* Status (semantic color) split from the explanation (quiet helper line). */
.onb-status { display: inline-flex; align-items: center; gap: 5px; margin: 1px 0 0; font-size: 12.5px; font-weight: 700; }
.onb-status svg { flex: none; }
.onb-status.is-synced { color: var(--green); }
.onb-status.is-linked-only { color: var(--blue); }
.onb-linked-help { margin: 0; }
.onb-linked.is-editing .onb-linked-id { opacity: .45; }
.onb-linked.is-editing .onb-status,
.onb-linked.is-editing .onb-linked-help { visibility: hidden; }
.onb-label {
  font-size: 13px; font-weight: 700; color: var(--ink-soft);
  display: inline-flex; align-items: center; gap: 6px;
}
.onb-help { font-size: 12.5px; color: var(--ink-soft); margin: 0; }
/* ⓘ tooltip — pure CSS, on hover and keyboard focus (tap focuses on mobile). */
.onb-info {
  position: relative; display: inline-grid; place-items: center;
  width: 18px; height: 18px; border-radius: 50%;
  font-size: 11px; font-weight: 700; color: var(--blue); background: var(--blue-soft);
  cursor: help;
}
.onb-info::after {
  content: attr(data-tip);
  position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 30;
  width: min(320px, 78vw); padding: 10px 12px; border-radius: 10px;
  background: var(--ink); color: #fff;
  font-size: 12.5px; font-weight: 500; line-height: 1.5; text-transform: none;
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transform: translateY(4px);
  transition: opacity .15s ease, transform .15s ease;
}
.onb-info:hover::after, .onb-info:focus-visible::after, .onb-info:focus::after { opacity: 1; transform: none; }

/* Compact primary action + the live create-vs-update line beside it. */
.onb-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.onb-send { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: auto; padding: 11px 22px; }
.onb-send svg { flex: none; }
.onb-mode { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.onb-mode::before { content: '●'; font-size: 9px; vertical-align: 1.5px; margin-right: 6px; }
.onb-mode.is-create { color: var(--green); }
.onb-mode.is-update { color: var(--blue); }

.onb-subtitle {
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  color: var(--ink-soft); margin: 18px 0 8px;
}
.onb-subtitle-count { font-weight: 600; letter-spacing: 0; }
/* Push history: quiet bordered rows, status accent on the edge, meta pushed
   right and secondary, caret signalling the row expands. */
.onb-pushes { display: grid; gap: 6px; }
.onb-push { border: 1px solid var(--line); border-radius: 10px; background: var(--card); overflow: hidden; }
.onb-push-failed  { border-left: 3px solid var(--danger); }
.onb-push-partial { border-left: 3px solid var(--amber); }
.onb-push summary { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 9px 12px; list-style: none; }
.onb-push summary::-webkit-details-marker { display: none; }
.onb-push summary:hover { background: var(--bg); }
.onb-push[open] summary { background: var(--bg); border-bottom: 1px solid var(--line); }
.onb-push-label { flex: 1; min-width: 90px; font-size: 13.5px; font-weight: 700; }
.onb-push-meta { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.onb-push-caret { color: var(--ink-soft); font-size: 11px; transition: transform .15s ease; }
.onb-push[open] .onb-push-caret { transform: rotate(90deg); }
.onb-chip {
  font-size: 10.5px; font-weight: 800; letter-spacing: .4px;
  border-radius: 999px; padding: 2.5px 9px; white-space: nowrap;
}
.onb-chip-ok      { background: var(--green-soft); color: var(--green); }
.onb-chip-partial { background: var(--amber-soft); color: var(--amber); }
.onb-chip-failed  { background: #fdeaec; color: var(--danger); }
.onb-detail { padding: 10px 12px; display: grid; gap: 4px; }
.onb-line { font-size: 13px; line-height: 1.45; word-break: break-word; }
.onb-error { color: var(--danger); font-weight: 600; }
/* Phone-width: the button earns the full row again (thumb target), history
   meta wraps under the row label instead of squeezing it. */
@media (max-width: 560px) {
  .onb-send { width: 100%; }
  .onb-push summary { flex-wrap: wrap; }
  .onb-push-meta { white-space: normal; }
}
/* Onboarding-panel shortcut on the office sites list (completed sites only).
   Pure navigation — inside the card <a>, so it needs its own hit affordance
   clear of the progress bar. */
.onb-open-btn { margin-top: 10px; }
/* Spotlight on the summary's send button after arriving via #onboarding:
   a brief glow so the deliberate next step (press Re-send) is unmistakable. */
@keyframes onb-spotlight {
  0%   { box-shadow: 0 0 0 0 rgba(37, 99, 235, .65); }
  35%  { box-shadow: 0 0 0 10px rgba(37, 99, 235, .25); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}
.onb-spotlight { animation: onb-spotlight 2.4s ease 2; }
@media (prefers-reduced-motion: reduce) {
  .onb-spotlight { animation: none; outline: 3px solid rgba(37, 99, 235, .6); outline-offset: 3px; }
}
html.theme-dark .onb-spotlight { animation-name: onb-spotlight-dark; }
@keyframes onb-spotlight-dark {
  0%   { box-shadow: 0 0 0 0 rgba(96, 165, 250, .75); }
  35%  { box-shadow: 0 0 0 10px rgba(96, 165, 250, .3); }
  100% { box-shadow: 0 0 0 0 rgba(96, 165, 250, 0); }
}
/* Dangling-link recovery under the push form (unlink & create new). */
.onb-relink { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line, rgba(0,0,0,.08)); }

/* Company autocomplete on the site form (company-suggest.js). */
.company-suggest-host { position: relative; }
.company-suggest {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 30;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); overflow: hidden;
  margin-top: 4px;
}
.company-suggest-item {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  font: inherit; padding: 10px 12px; cursor: pointer;
}
.company-suggest-item + .company-suggest-item { border-top: 1px solid var(--line); }
.company-suggest-item:hover, .company-suggest-item:focus-visible { background: var(--blue-soft); }
.company-suggest-item strong { display: block; font-size: 14px; }
.company-suggest-item small { display: block; color: var(--ink-soft); font-size: 12px; }
html.theme-dark .company-suggest { background: #1a1e25; border-color: rgba(255,255,255,.12); }
html.theme-dark .company-suggest-item + .company-suggest-item { border-top-color: rgba(255,255,255,.08); }

/* Business hours rows on the site form (business-hours.js). */
.bh-days { display: grid; gap: 6px; margin-top: 10px; }
.bh-row { display: flex; align-items: center; gap: 8px; }
.bh-day { display: flex; align-items: center; gap: 6px; width: 64px; font-weight: 600; font-size: 14px; }
.bh-day input { width: 16px; height: 16px; accent-color: var(--blue); }
.bh-dash { color: var(--ink-soft); }
.bh-closed .bh-dash { opacity: .45; }

/* 12-hour time picker (time-picker.js): display input + clock icon, and a
   three-column hour / minute / AM-PM panel with pill-highlighted picks. */
.tp { position: relative; flex: 1; min-width: 0; }
.tp-display {
  width: 100%; font: inherit; padding: 8px 32px 8px 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: inherit;
}
.tp-display:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.tp-display:disabled { opacity: .45; }
.tp-clock {
  position: absolute; right: 9px; top: 10px; width: 16px; height: 16px;
  color: var(--ink-soft); pointer-events: none;
}
.tp-menu {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 40;
  display: flex; gap: 2px; padding: 6px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow);
}
.tp-col {
  max-height: 200px; overflow-y: auto; display: flex; flex-direction: column;
  gap: 2px; padding: 2px; scrollbar-width: none;
}
.tp-col::-webkit-scrollbar { display: none; }
.tp-col + .tp-col { border-left: 1px solid var(--line); padding-left: 6px; }
.tp-opt {
  border: 0; background: none; font: inherit; font-weight: 600; color: inherit;
  min-width: 44px; padding: 8px 10px; border-radius: 10px; cursor: pointer;
  text-align: center;
}
.tp-opt:hover { background: var(--blue-soft); }
.tp-opt.is-active { background: var(--blue); color: #fff; }
html.theme-dark .tp-display { background: #1a1e25; border-color: rgba(255,255,255,.14); }
html.theme-dark .tp-menu { background: #1a1e25; border-color: rgba(255,255,255,.14); }
html.theme-dark .tp-col + .tp-col { border-left-color: rgba(255,255,255,.1); }
html.theme-dark .onb-push { background: #171b22; border-color: rgba(255,255,255,.12); }
html.theme-dark .onb-push summary:hover,
html.theme-dark .onb-push[open] summary { background: rgba(255,255,255,.05); }
html.theme-dark .onb-push[open] summary { border-bottom-color: rgba(255,255,255,.1); }
html.theme-dark .onb-chip-failed { background: rgba(198,40,56,.18); color: #ff9aa4; }
html.theme-dark .onb-label, html.theme-dark .onb-subtitle { color: #cfd6e4; }
html.theme-dark .onb-link-chip { background: rgba(255,255,255,.08); color: #cfd6e4; }
html.theme-dark .onb-linked-id { background: #171b22; border-color: rgba(255,255,255,.14); color: #e6e8ee; }
html.theme-dark .onb-icon-btn, html.theme-dark .onb-change-btn {
  background: #171b22; border-color: rgba(255,255,255,.14); color: #cfd6e4;
}
html.theme-dark .onb-icon-btn:hover, html.theme-dark .onb-change-btn:hover { background: rgba(255,255,255,.07); color: #e6e8ee; }
html.theme-dark .onb-icon-btn.is-copied { color: #7ddba3; border-color: #7ddba3; }
html.theme-dark .onb-copied { color: #7ddba3; }
html.theme-dark .onb-status.is-synced { color: #7ddba3; }
html.theme-dark .onb-status.is-linked-only { color: #9cc3ff; }
html.theme-dark .onb-reveal { color: #9cc3ff; }
html.theme-dark .onb-reveal:hover { color: #c4dbff; }
html.theme-dark .onb-link-chip.is-linked { background: rgba(20,128,74,.22); color: #7ddba3; }
html.theme-dark .onb-info { background: rgba(96,165,250,.18); color: #9cc3ff; }
html.theme-dark .onb-info::after { background: #0d1117; border: 1px solid rgba(255,255,255,.14); }
html.theme-dark .onb-mode.is-create { color: #7ddba3; }
html.theme-dark .onb-mode.is-update { color: #9cc3ff; }

/* ---- Onboarding standing badge (Sites list, Office → Onboarding) ---- */
.site-card-chips { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.onb-badge {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase;
  border-radius: 999px; padding: 3px 9px; white-space: nowrap;
  background: var(--bg); color: var(--ink-soft);
}
.onb-badge::before { content: '○'; font-size: 9px; margin-right: 4px; }
.onb-badge-synced { background: var(--green-soft); color: var(--green); }
.onb-badge-synced::before { content: '●'; }
.onb-badge-linked { background: rgba(31,78,140,.10); color: var(--blue-dark, #1f4e8c); }
.onb-badge-linked::before { content: '◐'; }
.onb-badge-failed { background: #fdeaec; color: var(--danger); }
.onb-badge-failed::before { content: '✖'; }
.onb-badge-failed.is-retrying { background: var(--amber-soft); color: var(--amber); }
.onb-badge-failed.is-retrying::before { content: '⏱'; }
.onb-badge-status { font-weight: 600; text-transform: none; letter-spacing: 0; }
.sites-table-onb { white-space: nowrap; }
.sites-onb-report { margin-left: auto; }

/* Summary panel: status read-back, retry notice, preview, attempt tag */
.onb-provision {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
}
.onb-provision-main { display: grid; gap: 2px; }
.onb-provision-value { font-size: 15px; font-weight: 800; color: var(--ink); }
.onb-provision-value.is-unknown { color: var(--ink-soft); font-weight: 600; }
.onb-provision-meta { font-size: 12px; color: var(--ink-soft); }
.onb-provision-error { font-size: 12px; color: var(--danger); font-weight: 600; }
.onb-provision-form { margin: 0; }
.onb-retry-notice { margin-bottom: 10px; }
.onb-preview-btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; }
.onb-preview { border: 1px dashed var(--line); border-radius: 10px; padding: 10px 14px; background: var(--card); }
.onb-preview .onb-subtitle { margin-top: 0; }
.onb-preview-head { margin: 0 0 8px; font-size: 13.5px; }
.onb-preview-head.is-create { color: var(--green); }
.onb-preview-head.is-update { color: var(--blue); }
.onb-preview-head.is-warn { color: var(--amber); font-weight: 600; }
.onb-preview-head code { font-size: 12px; background: var(--bg); padding: 1px 5px; border-radius: 5px; }
.onb-preview-list { margin: 0 0 8px; padding: 0; list-style: none; display: grid; gap: 5px; }
.onb-preview-list li { font-size: 13px; line-height: 1.45; word-break: break-word; }
.onb-preview-ico { display: inline-block; width: 1.2em; font-weight: 800; color: var(--ink-soft); }
.onb-push-attempt { font-weight: 600; color: var(--ink-soft); }

/* Office → Onboarding report */
.onb-report-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 14px 14px 4px; }
.onb-stat {
  display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
}
.onb-stat strong { font-size: 24px; line-height: 1.1; }
.onb-stat span { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.onb-stat.is-synced strong { color: var(--green); }
.onb-stat.is-linked strong { color: var(--blue); }
.onb-stat.is-failed strong { color: var(--danger); }
.onb-report-unconfigured { margin: 14px 14px 0; }
.onb-report-table td, .onb-history-table td { vertical-align: top; }
.onb-report-id { font-size: 11.5px; max-width: 160px; display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.onb-report-retry { color: var(--amber); font-weight: 600; }
.onb-history { margin: 6px 14px 20px; }
.onb-history > summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.onb-history .sites-table-wrap { padding: 8px 0 0; }
.onb-history-failed td:first-child { border-left: 3px solid var(--danger); }
.onb-history-partial td:first-child { border-left: 3px solid var(--amber); }
#onb-report-filter { border-radius: 999px; padding: 6px 10px; font-size: 13px; }

html.theme-dark .onb-badge { background: rgba(255,255,255,.08); color: #cfd6e4; }
html.theme-dark .onb-badge-synced { background: rgba(20,128,74,.22); color: #7ddba3; }
html.theme-dark .onb-badge-linked { background: rgba(96,165,250,.18); color: #9cc3ff; }
html.theme-dark .onb-badge-failed { background: rgba(198,40,56,.18); color: #ff9aa4; }
html.theme-dark .onb-badge-failed.is-retrying { background: rgba(217,119,6,.2); color: #ffc36b; }
html.theme-dark .onb-provision { background: #171b22; border-color: rgba(255,255,255,.12); }
html.theme-dark .onb-provision-value { color: #e6e8ee; }
html.theme-dark .onb-preview { background: #171b22; border-color: rgba(255,255,255,.16); }
html.theme-dark .onb-preview-head code { background: rgba(255,255,255,.08); }
html.theme-dark .onb-preview-head.is-create { color: #7ddba3; }
html.theme-dark .onb-preview-head.is-update { color: #9cc3ff; }
html.theme-dark .onb-preview-head.is-warn { color: #ffc36b; }
html.theme-dark .onb-stat { background: #171b22; border-color: rgba(255,255,255,.12); color: #e6e8ee; }
html.theme-dark .onb-stat.is-synced strong { color: #7ddba3; }
html.theme-dark .onb-stat.is-linked strong { color: #9cc3ff; }
html.theme-dark .onb-stat.is-failed strong { color: #ff9aa4; }
html.theme-dark .onb-report-retry { color: #ffc36b; }

/* Fire alarm roll-up (Summary, Live Site View, report) */
.fa-list { display: grid; gap: 10px; }
.fa-closet { border: 1px solid var(--line, #e6e6ea); border-radius: 12px; padding: 10px 12px; background: var(--card, transparent); }
.fa-closet-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fa-closet-head small { color: var(--ink-soft); }
.fa-lines { display: grid; gap: 6px; margin: 8px 0 0; }
.fa-line { display: grid; grid-template-columns: 130px 1fr; gap: 8px; align-items: baseline; }
.fa-line dt { color: var(--ink-soft); font-size: 14px; }
.fa-line dd { margin: 0; font-weight: 600; font-size: 15px; line-height: 1.4; }
.fa-line-type { display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 999px; background: var(--gray-soft); color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.fa-muted { color: var(--ink-soft); font-weight: 500; }
.fa-note { margin: 8px 0 0; color: var(--ink-soft); font-size: 13px; }
.fa-unanswered { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 10px 12px; border-radius: 12px; background: #fff4e5; color: #7a4a00; font-weight: 600; font-size: 14px; line-height: 1.4; }
.fa-unanswered .answer-chip.is-empty { background: #ffd8a8; color: #7a4a00; }
.fa-footnote { margin-top: 10px; }
html.theme-dark .fa-closet { border-color: rgba(255,255,255,.12); }
html.theme-dark .fa-unanswered { background: rgba(255, 170, 60, .14); color: #ffcf8a; }
html.theme-dark .fa-unanswered .answer-chip.is-empty { background: rgba(255, 170, 60, .3); color: #ffcf8a; }

/* Dashboard feed: which site a change was on */
.dash-log-site { color: var(--blue, #1f4e8c); text-decoration: none; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.dash-log-site:hover { text-decoration: underline; }
.online-hidden-note { margin-top: 8px; font-size: 12px; }
html.theme-dark .dash-log-site { color: #8ab4f8; }

/* ---- Survey sheet: loading / failed state over the embedded form ----
   The frame is never left white: a spinner while the survey loads, words +
   Retry/Close when it stalls or lands on anything that isn't our form
   (proxy 502, offline notice, region refusal). Sits below the ✕ (z 2). */
.frame-state {
  position: absolute; left: 0; right: 0; bottom: 0; top: 28px; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 24px; text-align: center; background: var(--card);
}
.frame-state-spinner {
  width: 30px; height: 30px; border: 3px solid var(--blue-soft); border-top-color: var(--blue);
  border-radius: 50%; animation: fax-spin .9s linear infinite;
}
.frame-state.is-failed .frame-state-spinner { display: none; }
.frame-state.is-failed::before { content: '⚠️'; font-size: 42px; line-height: 1; }
.frame-state-text { margin: 0; color: var(--ink-soft); font-size: 15px; line-height: 1.45; max-width: 340px; }
.frame-state-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.frame-state-actions .btn { min-width: 120px; }
.frame-state.is-loading .frame-state-actions .btn.frame-state-retry[hidden] { display: none; }
html.theme-dark .frame-state { background: #1a1e25; }
html.theme-dark .frame-state-text { color: #aeb6c2; }

/* ---- 🧠 Ideas & feedback: the technicians' edge tab + drawer content ---- */
.panel-ideas-intro { margin: 0; font-size: 14px; line-height: 1.45; color: var(--ink-soft); }
.panel-kind-toggle {
  display: inline-flex; gap: 3px; padding: 3px; border-radius: 999px; background: var(--gray-soft);
  align-self: start;
}
.panel-kind {
  min-height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: none;
  font: inherit; font-size: 14px; font-weight: 700; color: var(--ink-soft);
  -webkit-tap-highlight-color: transparent;
}
.panel-kind.is-active { background: var(--blue); color: #fff; }
.panel-ideas-composer { display: grid; gap: 10px; }
.panel-ideas-heading { margin: 6px 0 0; font-size: 13px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.panel-idea {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; display: grid; gap: 6px;
}
.panel-idea.is-acked { border-color: var(--green-soft); }
.panel-idea-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.panel-idea-kind { font-size: 12px; font-weight: 700; color: var(--blue); }
.panel-idea-when { color: var(--ink-soft); font-size: 12px; }
.panel-idea-body { margin: 0; font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.panel-idea-status { margin: 0; font-size: 13px; color: var(--ink-soft); }
.panel-idea.is-acked .panel-idea-status { color: var(--green); }
.panel-idea-note { margin: 0; font-size: 13px; padding: 8px 10px; border-radius: 10px; background: var(--green-soft); }
html.theme-dark .panel-idea { background: #1a1e25; border-color: rgba(255,255,255,.08); }
html.theme-dark .panel-kind-toggle { background: rgba(255,255,255,.08); }
html.theme-dark .panel-idea-note { background: rgba(20,128,74,.25); }

/* Office → Feedback (review & acknowledge) */
.fb-hint { padding: 8px 14px 0; }
.fb-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 14px; }
.fb-toolbar .sites-filters { padding: 0; }
a.filter-chip { display: inline-block; text-decoration: none; color: inherit; }
a.filter-chip strong { margin-left: 4px; }
.fb-toolbar form { margin-left: auto; }
.fb-list { display: flex; flex-direction: column; gap: 10px; padding: 8px 14px 24px; }
.fb-row { display: grid; gap: 8px; }
.fb-row.is-acked { opacity: .78; }
.fb-row-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.fb-kind { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); white-space: nowrap; }
.fb-kind-feedback { background: var(--amber-soft); color: var(--amber); }
.fb-meta { color: var(--ink-soft); font-size: 13px; }
.fb-meta a { color: inherit; text-decoration: underline; }
.fb-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.5; }
.fb-ack-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fb-ack-form input { flex: 1; min-width: 200px; max-width: 420px; }
.fb-acked { margin: 0; font-size: 13px; color: var(--green); }
.fb-acked small { color: var(--ink-soft); }
.fb-ack-note { margin: 0; font-size: 14px; padding: 8px 10px; border-radius: 10px; background: var(--green-soft); }
.dnav-badge.is-info { background: var(--blue); }
html.theme-dark .fb-ack-note { background: rgba(20,128,74,.25); }
html.theme-dark .fb-kind { background: rgba(120,170,255,.14); color: #9ec1ff; }
html.theme-dark .fb-kind-feedback { background: rgba(255,200,80,.14); color: #ffd27a; }

/* ---- 📝 Notes: attachments through the survey photo pipeline (camera / photos / video / PDF) ---- */
.panel-note-pickers { display: flex; flex-wrap: wrap; gap: 6px; }
.panel-note-picker { min-height: 36px; padding: 0 12px; font-size: 13px; }
.panel-note-picker .file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.panel-note-pending { margin: 0; }
.panel-note-pending .photo-thumb video { width: 100%; height: 100%; object-fit: cover; }
.panel-note-files .panel-note-video {
  position: relative; display: block; width: 108px; height: 72px;
  border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #000;
}
.panel-note-files .panel-note-video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.panel-note-files .panel-note-video .photo-play {
  position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 22px;
  text-shadow: 0 1px 4px rgba(0,0,0,.6); pointer-events: none;
}
.panel-note-files .panel-note-video .video-working {
  position: absolute; left: 4px; bottom: 4px; font-size: 10px; padding: 2px 6px; border-radius: 6px;
  background: rgba(0,0,0,.65); color: #fff;
}
html.theme-dark .panel-note-picker { background: #1a1e25; border-color: rgba(255,255,255,.12); color: #e6e9ef; }

/* ---- 📍 Moving a pin: press-and-hold drag, or tap-to-place from 📍 Move ---- */
.map-marker.is-moving { z-index: 30; filter: drop-shadow(0 8px 10px rgba(0,0,0,.35)); }
.map-marker.is-moving .map-marker-pin { transform: rotate(-45deg) scale(1.18); outline: 3px solid var(--blue); outline-offset: 2px; }
.map-marker.is-moving .map-marker-label { background: var(--blue); color: #fff; }
.map-viewport.is-moving { cursor: move; outline: 3px dashed var(--blue); outline-offset: -3px; }
.map-viewport.is-moving .map-image, .map-viewport.is-moving #map-image { filter: saturate(.7); }
.map-marker.is-pending-move { opacity: .6; }
.map-marker.is-pending-move .map-marker-label::after { content: ' ⏳'; }
.items-table-move {
  width: 36px; height: 36px; border: 0; border-radius: 10px; background: var(--gray-soft); font-size: 16px;
  display: grid; place-items: center; -webkit-tap-highlight-color: transparent;
}
html.theme-dark .items-table-move { background: rgba(255,255,255,.08); }

/* ---- 🧠 Feedback conversations: status pills, threads, replies ---- */
.fb-status-pill {
  font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--gray-soft); color: var(--ink-soft);
}
.fb-status-open .fb-status-pill { background: var(--blue-soft); color: var(--blue); }
.fb-status-needs_info .fb-status-pill { background: var(--amber-soft); color: var(--amber); }
.fb-status-acknowledged .fb-status-pill { background: var(--green-soft); color: var(--green); }
.fb-status-added .fb-status-pill { background: #fde9f3; color: #b0186b; }
.fb-thread, .panel-thread { display: grid; gap: 6px; }
.fb-msg, .panel-msg {
  padding: 8px 10px; border-radius: 12px; max-width: 92%; display: grid; gap: 2px;
  background: var(--gray-soft);
}
.fb-msg-office, .panel-msg-office { background: var(--blue-soft); }
.fb-msg-technician, .panel-msg-technician { background: var(--green-soft); justify-self: end; }
.fb-msg-meta, .panel-msg-meta { color: var(--ink-soft); font-size: 11px; }
.fb-msg-new { color: var(--amber); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.fb-msg-body, .panel-msg-body { margin: 0; font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.fb-actions { display: grid; gap: 8px; }
.fb-msg-form { display: grid; gap: 6px; }
.fb-msg-form textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 14px; resize: vertical;
}
.fb-msg-buttons { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.fb-status-forms { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.fb-added-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fb-added-form input { flex: 1; min-width: 180px; max-width: 360px; }
.btn-celebrate { background: #fde9f3; color: #b0186b; border-color: #f4b8d6; }
.btn-ghost { background: none; color: var(--ink-soft); border-color: var(--line); }
.panel-reply { display: grid; gap: 6px; }
.panel-reply textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 14px; resize: vertical;
}
.panel-reply .btn { justify-self: end; }
.panel-idea-needs_info { border-color: var(--amber); }
.panel-idea-needs_info .panel-idea-status { color: var(--amber); font-weight: 700; }
.panel-idea-added { border-color: #f4b8d6; }
.panel-idea-added .panel-idea-status { color: #b0186b; font-weight: 700; }
html.theme-dark .fb-msg, html.theme-dark .panel-msg { background: rgba(255,255,255,.08); }
html.theme-dark .fb-msg-office, html.theme-dark .panel-msg-office { background: rgba(120,170,255,.16); }
html.theme-dark .fb-msg-technician, html.theme-dark .panel-msg-technician { background: rgba(20,128,74,.25); }
html.theme-dark .fb-status-added .fb-status-pill, html.theme-dark .btn-celebrate { background: rgba(176,24,107,.25); color: #ffb3d9; }
html.theme-dark .fb-msg-form textarea, html.theme-dark .panel-reply textarea { background: #1a1e25; color: #e6e9ef; border-color: rgba(255,255,255,.12); }

/* ---- 💬 Tech dashboard: the office's question, with a reply box ---- */
.tech-questions { margin: 0 14px 12px; display: grid; gap: 10px; }
.tech-question { display: grid; gap: 8px; padding: 10px 0 0; border-top: 1px solid var(--line); }
.tech-question:first-of-type { border-top: 0; padding-top: 0; }
.tech-question-idea { margin: 0; font-size: 14px; line-height: 1.45; }
.tech-question-idea small { color: var(--ink-soft); }
.tech-question-reply { display: grid; gap: 6px; }
.tech-question-reply textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 15px; resize: vertical;
}
.tech-question-reply .btn { justify-self: end; }
.tech-question-done { margin: 0; color: var(--green); font-weight: 600; font-size: 14px; }
html.theme-dark .tech-question-reply textarea { background: #1a1e25; color: #e6e9ef; border-color: rgba(255,255,255,.12); }

/* ---- 🎉 Celebration: one of the tech's ideas shipped ---- */
.celebrate-overlay {
  position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 18px;
  background: rgba(15, 20, 28, 0.6); overflow: hidden; animation: celebrate-in .3s ease-out;
}
.celebrate-overlay.is-leaving { opacity: 0; transition: opacity .3s; }
@keyframes celebrate-in { from { opacity: 0; } }
.celebrate-card {
  position: relative; width: min(520px, 100%); background: var(--card); border-radius: 18px; padding: 22px 18px 18px;
  box-shadow: 0 18px 60px rgba(0,0,0,.35); text-align: center; display: grid; gap: 10px; animation: celebrate-pop .5s cubic-bezier(.2,1.4,.4,1);
}
@keyframes celebrate-pop { from { transform: scale(.7); opacity: 0; } }
.celebrate-emoji { margin: 0; font-size: 56px; line-height: 1; animation: celebrate-bounce 1.2s ease-in-out 3; }
@keyframes celebrate-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px) rotate(-8deg); } }
.celebrate-card h2 { margin: 0; font-size: 22px; line-height: 1.25; }
.celebrate-lead { margin: 0; color: var(--ink-soft); font-size: 14px; }
.celebrate-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; text-align: left; }
.celebrate-list li { display: flex; gap: 10px; padding: 10px 12px; border-radius: 12px; background: #fde9f3; }
.celebrate-kind { font-size: 20px; line-height: 1.2; }
.celebrate-body { margin: 0; font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.celebrate-note { margin: 4px 0 0; font-size: 13px; color: #b0186b; font-style: italic; }
.celebrate-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.celebrate-confetti i {
  position: absolute; top: -12px; left: calc(var(--i) * 2.5%); width: 9px; height: 14px; border-radius: 2px;
  background: hsl(var(--h), 85%, 60%); opacity: .95;
  animation: confetti-fall 3.2s linear infinite; animation-delay: calc(var(--i) * -0.13s);
  transform: rotate(calc(var(--i) * 37deg));
}
.celebrate-confetti i:nth-child(odd) { width: 12px; height: 8px; border-radius: 50%; animation-duration: 3.9s; }
@keyframes confetti-fall {
  0% { transform: translate3d(0, -20px, 0) rotate(0deg); }
  100% { transform: translate3d(calc((var(--i) - 20) * 3px), 110vh, 0) rotate(720deg); }
}
@media (prefers-reduced-motion: reduce) {
  .celebrate-confetti { display: none; }
  .celebrate-emoji, .celebrate-card { animation: none; }
}
html.theme-dark .celebrate-card { background: #1a1e25; }
html.theme-dark .celebrate-list li { background: rgba(176,24,107,.25); }
html.theme-dark .celebrate-note { color: #ffb3d9; }

/* ---- 🆘 Troubleshoot mode: the button, the rail tab, the report sheet ---- */
.sos-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 0; padding: 0;
  display: grid; place-items: center; font-size: 19px; line-height: 1;
  background: #fde8e8; color: #b42318; position: relative;
  -webkit-tap-highlight-color: transparent;
}
.sos-btn:active { transform: scale(.94); }
.appbar-user { display: flex; align-items: center; gap: 8px; }
.sos-btn.has-pending::after, .side-tab-sos.has-pending::after {
  content: ''; position: absolute; top: 2px; right: 2px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--amber); border: 2px solid var(--bg);
}
/* The rail copy is for the full-screen map only, where the app bar is hidden. */
.side-tab.side-tab-sos { display: none; position: relative; }
body:has(.map-shell.is-fullscreen) .side-tab-sos { display: grid; }
.sos-sheet .sheet { display: grid; gap: 10px; }
.sos-net { margin: 0; padding: 8px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.sos-net.is-online { background: var(--green-soft); color: var(--green); }
.sos-net.is-offline { background: var(--amber-soft); color: var(--amber); }
.sos-text {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 15px; resize: vertical;
}
.sos-log summary { font-size: 13px; font-weight: 700; color: var(--ink-soft); cursor: pointer; }
.sos-count { font-weight: 500; }
.sos-events { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; max-height: 32vh; overflow-y: auto; font-size: 12px; }
.sos-events li { display: grid; grid-template-columns: 62px 1fr; gap: 2px 8px; padding: 4px 8px; border-radius: 8px; background: var(--gray-soft); }
.sos-events li small { color: var(--ink-soft); }
.sos-events li b { font-weight: 700; }
.sos-events li span { grid-column: 2; overflow-wrap: anywhere; color: var(--ink-soft); }
.sos-events li.is-bad { background: #fde8e8; }
.sos-events li.is-bad span { color: #b42318; }
html.theme-dark .sos-btn { background: rgba(180,35,24,.3); color: #ff9b91; }
html.theme-dark .sos-text { background: #1a1e25; color: #e6e9ef; border-color: rgba(255,255,255,.12); }
html.theme-dark .sos-events li { background: rgba(255,255,255,.08); }
html.theme-dark .sos-events li.is-bad { background: rgba(180,35,24,.3); }

/* Office → Problem reports */
.trouble-list .trouble-row { text-decoration: none; color: inherit; display: flex; }
.trouble-head.is-acked { opacity: .85; }
.trouble-desc { margin: 4px 0 10px; font-size: 16px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; padding: 10px 12px; border-radius: 10px; background: #fde8e8; }
.trouble-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0 0 10px; font-size: 13.5px; }
.trouble-facts dt { color: var(--ink-soft); font-weight: 600; }
.trouble-facts dd { margin: 0; overflow-wrap: anywhere; }
.trouble-timeline-wrap { overflow-x: auto; }
.trouble-timeline { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.trouble-timeline th { text-align: left; color: var(--ink-soft); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.trouble-timeline td { padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.trouble-time { white-space: nowrap; color: var(--ink-soft); }
.trouble-delta { white-space: nowrap; color: var(--ink-soft); text-align: right; }
.trouble-kind { white-space: nowrap; font-weight: 600; }
.trouble-detail { overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.trouble-timeline tr.is-bad td { background: #fde8e8; }
.trouble-timeline tr.is-bad .trouble-detail { color: #b42318; }
.trouble-timeline tr.kind-tap .trouble-detail { color: var(--blue); }
.trouble-timeline tr.trouble-incident td { background: var(--amber-soft); color: var(--amber); font-weight: 700; text-align: center; }
.alert-report-link { color: #b42318; font-weight: 700; text-decoration: underline; }
html.theme-dark .trouble-desc, html.theme-dark .trouble-timeline tr.is-bad td { background: rgba(180,35,24,.25); }
html.theme-dark .trouble-timeline tr.is-bad .trouble-detail, html.theme-dark .alert-report-link { color: #ff9b91; }


/* ============ Sept 18 2026 — admin batch ============ */

/* Desktop back bar (office): the mobile app bar's ‹ is hidden ≥1000px, so
   pages with a parent say "‹ Back" under the section tabs. */
.desk-backbar { display: none; }
@media (min-width: 1000px) {
  body:not(.no-tabbar) .desk-backbar {
    display: flex; align-items: center; gap: 14px;
    max-width: 1320px; margin: 0 auto; padding: 10px 28px 0;
  }
  .desk-back {
    display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 12px 0 8px;
    border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink-soft);
    font-size: 13px; font-weight: 700; text-decoration: none;
  }
  .desk-back:hover { color: var(--blue); border-color: var(--blue); }
  .desk-back .dnav-ico { width: 16px; height: 16px; }
  .desk-back-title { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
}

/* Dashboard tiles */
.dash-stat.is-upcoming strong { color: var(--blue); }
.dash-stat.is-overdue { border-color: #e8a13a; }
.dash-stat.is-overdue strong { color: #c07f00; }
.dash-stat.is-live { border-color: var(--green); }
.dash-stat.is-live strong { color: var(--green); }
.dash-lead { margin: 10px 14px 0; font-size: 13.5px; }

/* Site card: second destination inside the card link */
.site-card-actions { display: flex; gap: 8px; margin-top: 8px; }
.site-card-actions .btn { min-height: 34px; padding: 6px 12px; font-size: 13px; }

/* Team cards: overview is the card, ✏️ is a sub-target */
.tech-card-edit { min-height: 34px; padding: 6px 10px; font-size: 13px; margin-right: 6px; }

/* Technician overview */
.tech-hero { display: grid; gap: 14px; }
.tech-hero-main { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.tech-hero-avatar { width: 56px; height: 56px; font-size: 24px; flex: none; }
.tech-hero-text { flex: 1; min-width: 220px; display: grid; gap: 4px; }
.tech-hero-text h2 { margin: 0; font-size: 20px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tech-hero-email { margin: 0; color: var(--ink-soft); font-size: 13px; }
.tech-hero-email a { color: inherit; }
.tech-standing { margin: 2px 0 0; display: grid; gap: 2px; }
.tech-standing strong { font-size: 15px; }
.tech-standing small { color: var(--ink-soft); }
.tech-hero.is-onsite .tech-standing strong { color: var(--green); }
.tech-hero.is-online .tech-standing strong { color: var(--green); }
.tech-hero.is-online-recent .tech-standing strong,
.tech-hero.is-onsite-recent .tech-standing strong { color: var(--amber); }
.tech-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.tech-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.tech-stat {
  display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line);
}
.tech-stat strong { font-size: 22px; line-height: 1; }
.tech-stat span { font-size: 12px; color: var(--ink-soft); }
.tech-stat.is-done strong { color: var(--green); }
.tech-stat.is-warn strong { color: #c07f00; }
.tech-site-row .tech-site-side { display: grid; justify-items: end; gap: 2px; text-align: right; }
.tech-site-row .tech-site-side small { color: var(--ink-soft); font-size: 12px; }
.tech-facts { margin-top: 10px; }
.panel.is-attention-soft { border-color: #f0dca4; background: #fffbf0; }
@media (min-width: 1000px) { .tech-grid { grid-template-columns: 1fr 1fr; } }

/* Monitor: count chips are links now */
a.count-chip.is-link { text-decoration: none; }
a.count-chip.is-link:hover { outline: 2px solid var(--blue); outline-offset: 1px; }

/* Site history filters + file thumbnails */
.tl-filters {
  display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center;
  padding: 8px 10px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  font-size: 13px;
}
.tl-filters select, .tl-filters input[type="date"] { min-height: 34px; padding: 4px 8px; font-size: 13px; border-radius: 8px; }
.tl-filter-date { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); }
.tl-filter-files { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); cursor: pointer; }
.tl-filter-count { color: var(--ink-soft); margin-left: auto; }
.tl-files { margin-top: 8px; }
.tl-files .photo-thumb { width: 72px; height: 72px; }
.tl-files .photo-thumb img, .tl-files .photo-thumb video { width: 100%; height: 100%; object-fit: cover; }

/* Survey form: single Save, two states when something is missing */
.save-btn.is-save-anyway { background: var(--amber); border-color: var(--amber); color: #fff; }
.save-btn.is-blocked { background: var(--danger); border-color: var(--danger); color: #fff; }

/* "Unknown" switch on extension answers */
.q-unknownable { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.q-unknownable input[type="text"] { flex: 1; min-width: 140px; }
.q-unknown-toggle {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 14px; font-weight: 600; color: var(--ink-soft);
  cursor: pointer; user-select: none;
}
.q-unknown-toggle input { width: 18px; height: 18px; margin: 0; }
.q-unknownable.is-unknown .q-unknown-toggle { background: var(--amber-soft); border-color: #f0dca4; color: var(--amber); }
.q-unknownable.is-unknown input[type="text"] { background: var(--gray-soft); color: var(--ink-soft); }

/* Sections drawer (office) */
.side-tab.side-tab-sections .side-tab-icon { font-size: 19px; }
.panel-sections-intro { margin: 0 0 10px; font-size: 13px; color: var(--ink-soft); line-height: 1.45; }
.panel-sections { display: grid; gap: 8px; }
.panel-section { border: 1px solid var(--line); border-radius: 12px; background: var(--card); overflow: hidden; }
.panel-section.is-empty { opacity: .75; }
.panel-section > summary {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; list-style: none; font-size: 14px;
}
.panel-section > summary::-webkit-details-marker { display: none; }
.panel-section[open] > summary { background: var(--blue-soft); }
.panel-section-icon { font-size: 16px; width: 22px; text-align: center; }
.panel-section-badge { color: var(--ink-soft); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.panel-section-count {
  margin-left: auto; min-width: 26px; text-align: center; padding: 2px 8px; border-radius: 999px;
  background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 800;
}
.panel-section.is-empty .panel-section-count { background: var(--gray-soft); color: var(--ink-soft); }
.panel-section-body { padding: 4px 12px 10px; display: grid; gap: 2px; }
.panel-section-row {
  display: grid; grid-template-columns: minmax(80px, auto) 1fr auto; gap: 4px 10px; align-items: baseline;
  padding: 7px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; font-size: 13.5px;
}
.panel-section-row:last-of-type { border-bottom: 0; }
a.panel-section-row:hover .panel-section-label { color: var(--blue); }
.panel-section-row.is-muted { color: var(--ink-soft); }
.panel-section-label { font-weight: 700; white-space: nowrap; }
.panel-section-value { color: var(--ink-soft); overflow-wrap: anywhere; }
.panel-section-value.is-pre { white-space: pre-wrap; grid-column: 1 / -1; }
.panel-section-when { grid-column: 1 / -1; color: var(--ink-soft); font-size: 11px; }
.panel-section-call { text-decoration: none; font-size: 15px; }
.panel-section-files { grid-column: 1 / -1; margin-top: 4px; }
.panel-section-files img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.panel-section-foot { padding-top: 8px; display: flex; justify-content: flex-end; }

/* Camera: controls row (torch / flash / zoom / flip / device camera) */
.camera-top {
  display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; background: #000;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.camera-tool {
  flex: none; min-height: 38px; padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.12); color: #fff; font-size: 14px; font-weight: 600; white-space: nowrap;
}
.camera-tool.is-on { background: #ffd166; border-color: #ffd166; color: #222; }
.camera-native { margin-left: auto; }
.camera-zoom-label { color: #fff; font-size: 13px; font-weight: 700; min-width: 34px; text-align: center; opacity: .85; }
.camera-stage { flex: 1; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; touch-action: none; }
.camera-overlay .camera-stage video { flex: none; width: 100%; height: 100%; object-fit: contain; transform-origin: center center; transition: transform .05s linear; }
.camera-zoom-row { display: flex; align-items: center; gap: 10px; padding: 6px 18px; background: #000; color: #fff; font-size: 12px; }
.camera-zoom-row input[type="range"] { flex: 1; accent-color: #ffd166; }
.camera-hint {
  position: absolute; left: 50%; bottom: calc(120px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: 88%; margin: 0; padding: 8px 12px; border-radius: 10px; background: rgba(0,0,0,.72); color: #fff; font-size: 13px; text-align: center;
}

/* What's new: an UNREAD release shows in full (every bullet by audience +
   screenshots); read releases stay compact with a "+N more" link. The review
   modal widens so a big release reads like a page, not a ticker. */
.ack-overlay #whats-new { width: min(880px, 100%); max-height: min(90vh, 100%); }
.dash-release-intro { margin: 8px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--ink); }
.dash-release-group { margin: 12px 0 0; font-size: 12px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--ink-soft); }
.dash-release-bullets.is-full { gap: 8px; color: var(--ink); line-height: 1.5; }
.dash-release-more { display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--blue); text-decoration: none; }
.dash-release-shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.dash-release-shot { display: grid; gap: 4px; text-decoration: none; color: var(--ink-soft); }
.dash-release-shot img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.dash-release-shot small { font-size: 11px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dash-release.is-unread .release-ack-form { margin-top: 12px; }

/* Dark theme for the new surfaces */
html.theme-dark .desk-back, html.theme-dark .tech-stat, html.theme-dark .panel-section, html.theme-dark .q-unknown-toggle {
  background: #1e2229; border-color: rgba(255,255,255,.09); color: #e6e8ee;
}
html.theme-dark .tl-filters { background: #14171c; border-color: rgba(255,255,255,.09); }
html.theme-dark .panel-section[open] > summary { background: rgba(90,137,196,.18); }
html.theme-dark .panel.is-attention-soft { background: #262115; border-color: #5a4a1e; }
html.theme-dark .item-warn { background: #3a2f10; color: #ffd166; }
html.theme-dark .q-unknownable.is-unknown input[type="text"] { background: #262b34; }
