/* Expanding textareas for specific fields */
#site-notes,
#contractor-instructions-detail,
#conditions-of-pass,
#followup-notes,
#hse-discussion,
#notes-for-engineer,
.ncr-description {
  field-sizing: content;
  min-height: 60px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 0;
}
/* NCR cards */
.ncr-item {
  margin-bottom: 16px;
}
.ncr-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 4px;
}
.ncr-label {
  display: block;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0;
}
.ncr-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  line-height: 1;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.ncr-icon-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  color: var(--subtext);
}
.ncr-icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.ncr-delete-btn {
  color: var(--primary);
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
  background: transparent;
  border-color: transparent;
}
.ncr-delete-btn:hover:not(:disabled) {
  background: transparent;
  color: var(--primary-dark);
}
.ncr-add-btn {
  width: 100%;
  height: 44px;
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  font-family: var(--font);
  font-weight: 500;
  margin-top: 4px;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.ncr-add-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 4%, transparent);
}
.ncr-add-btn svg {
  stroke: currentColor;
  flex-shrink: 0;
}
.ncr-content-unit {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--white);
}
.ncr-photo-slot {
  position: relative;
  border-bottom: 1px solid var(--border);
}
.ncr-photo-slot-placeholder {
  height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  background: var(--panel);
  transition: background 0.15s ease;
}
.ncr-photo-slot-placeholder:active {
  background: color-mix(in srgb, var(--primary) 8%, var(--white));
}
.ncr-photo-slot-placeholder svg {
  stroke: var(--border);
  width: 28px;
  height: 28px;
}
.ncr-photo-slot-placeholder--compact {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.15s ease;
}
.ncr-photo-slot-placeholder--compact svg {
  width: 18px;
  height: 18px;
  stroke: var(--border);
}
.ncr-photo-slot-preview--compact {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
  cursor: pointer;
}
.ncr-photo-slot--compact {
  position: relative;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.compact-photo-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.compact-photo-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.photo-stack-container {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-stack-card {
  position: absolute;
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid var(--white);
}
.photo-stack-card--back {
  transform: rotate(-6deg) translate(-4px, 2px);
  z-index: 1;
  filter: brightness(0.8);
}
.photo-stack-card--mid {
  transform: rotate(-3deg) translate(-2px, 1px);
  z-index: 2;
  filter: brightness(0.9);
}
.photo-stack-card--front {
  transform: none;
  z-index: 3;
}
.photo-stack-count {
  font-size: 12px;
  color: var(--subtext);
  white-space: nowrap;
}
.ncr-photo-slot-preview {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
  cursor: pointer;
}
.ncr-photo-slot-replace {
  position: absolute;
  bottom: 8px;
  right: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.5);
  background: rgba(0,0,0,0.4);
  color: white;
  font-size: 11px;
  font-family: var(--font);
  cursor: pointer;
}
.ncr-description {
  width: 100%;
  border: none;
  border-radius: 0;
  padding: 10px 12px;
  font-size: 16px;
  font-family: var(--font);
  background: var(--white);
  resize: none;
  box-sizing: border-box;
}
.ncr-description:focus {
  outline: none;
  box-shadow: none;
}
/* Secondary button style for test PDF buttons */
.btn-secondary {
  width: 100%;
  background: var(--primary);
  color: var(--white);
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  margin-top: 8px;
  cursor: pointer;
}
.btn-secondary:hover {
  background: var(--primary-hover);
}
:root {
  --primary: #17394C;
  --primary-hover: #22546F;
  --primary-dark: #0E2733;
  --panel: #EEF2F5;
  --white: #FFFFFF;
  --text: #282828;
  --subtext: #505050;
  --muted: #969696;
  --border: #D2D2D2;
  --pill-border: 1.5px solid var(--border);
  --pill-border-active: 1.5px solid var(--primary);
  --error: #C00000;
  --font: 'Segoe UI', sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  background: var(--white);
  overscroll-behavior-y: none;
}

body {
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  background: var(--white);
  font-family: var(--font);
  font-size: 16px;
  color: var(--text);
  overflow: hidden;
  overscroll-behavior-y: none;
  touch-action: pan-x pan-y;
}

main {
  display: block;
  margin: 0;
  padding: 0;
}

@supports (padding: max(0px)) {
  #app {
    padding-top: max(0px, env(safe-area-inset-top));
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }
}

#app {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 100%;
  min-height: 100%;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  background: var(--white);
  padding: 0;
  margin: 0;
}

#app:has(#btn-login:not([style*="display:none"])) {
  display: flex;
  align-items: stretch;
  min-height: 100dvh;
  background: #0E2733;
  padding: 0;
}

#app:has(#btn-login[style*="display:none"]) .login-landing {
  display: none;
}

@keyframes hce-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.login-landing {
  width: 100%;
  min-height: 100dvh;
  background: #0E2733;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  opacity: 0;
  animation: hce-fade 0.9s ease forwards;
}

.login-logo-wrap {
  padding-top: 20px;
  padding-bottom: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  opacity: 0;
  animation: hce-fade 0.7s ease 0.3s forwards;
}

.login-logo-img {
  width: 200px;
  display: block;
}

.login-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  padding: 0 32px;
  margin-top: -40px;
  opacity: 0;
  animation: hce-fade 0.6s ease 0.55s forwards;
}

.login-title {
  font-family: 'Segoe UI', sans-serif;
  font-size: 32px;
  font-weight: 300;
  color: #ffffff;
  letter-spacing: -0.5px;
  margin: 0;
}

.login-footer-rule {
  width: 32px;
  height: 1px;
  background: rgba(255, 255, 255, 0.4);
  margin-bottom: 36px;
  opacity: 0;
  animation: hce-fade 0.6s ease 0.85s forwards;
}

#btn-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 24px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-family: 'Segoe UI', sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.3px;
  cursor: pointer;
  width: auto;
  margin: 0;
}

#btn-login:hover {
  background: rgba(255, 255, 255, 0.08);
}

@keyframes hce-spin {
  to { transform: rotate(360deg); }
}

@keyframes hce-spinner-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes hce-landing-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes hce-app-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#btn-login.is-loading {
  width: 44px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  pointer-events: none;
  overflow: hidden;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1), padding 0.4s ease;
}

#btn-login.is-loading::after {
  content: '';
  display: block;
  width: 12px;
  height: 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-top-color: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  animation: hce-spin 0.7s linear infinite;
  margin: auto;
}

#btn-login.is-spinner-out {
  animation: hce-spinner-out 0.3s ease forwards;
  pointer-events: none;
}

.login-landing.is-exiting {
  position: fixed;
  inset: 0;
  z-index: 9999;
  animation: hce-landing-out 1000ms ease forwards;
  pointer-events: none;
}

#app-tab-bar.is-entering,
#records-panel.is-entering {
  animation: hce-app-in 800ms ease forwards;
}

#inspection-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  padding: 0;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
  min-height: 0;
  background: #ffffff;
}

#step-indicator {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  background: var(--white);
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.step-pip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
}

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  transition: all 0.3s ease;
}

.step-number {
  font-size: 13px;
  font-weight: 600;
  color: #aaa;
  transition: color 0.3s ease;
}

.step-check {
  display: none;
}

.step-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #aaa;
  transition: color 0.3s ease;
}

.step-line {
  flex: 1;
  height: 2px;
  background: #e0e0e0;
  margin: 0 4px;
  margin-bottom: 20px;
  transition: background 0.3s ease;
}

/* Active state */
.step-pip.active .step-circle {
  background: var(--white);
  border: 2px solid var(--primary);
}
.step-pip.active .step-number {
  color: var(--primary);
  font-weight: 700;
}
.step-pip.active .step-label {
  color: var(--primary);
  font-weight: 700;
}

/* Completed state */
.step-pip.completed .step-circle {
  background: color-mix(in srgb, var(--primary) 55%, white);
  border: none;
}
.step-pip.completed .step-number {
  display: none;
}
.step-pip.completed .step-check {
  display: block;
}
.step-pip.completed .step-label {
  color: color-mix(in srgb, var(--primary) 55%, white);
}

/* Completed step line */
.step-line.completed {
  background: color-mix(in srgb, var(--primary) 55%, white);
}

.step-panel {
  display: none;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 3px;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  background: #ffffff;
}

.step-panel.active {
  display: flex;
  flex-direction: column;
}

#content-1 > div,
#content-2 > div,
#content-3 > div {
  margin-bottom: 16px;
}

#inspection-body-group {
  display: block;
  margin-bottom: 0;
}

#inspection-body-group > div {
  margin-bottom: 16px;
}

#booking-fields-group {
  margin-top: 4px;
}

#booking-fields-group > div {
  margin-bottom: 16px;
}

#app-tab-bar {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 6px 16px 8px;
  background: var(--white);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  font-family: var(--font);
  font-weight: 500;
  padding: 4px 16px;
  transition: color 0.15s ease;
  flex: 1;
}

.tab-btn.active {
  color: var(--primary);
}

.tab-btn svg {
  transition: stroke 0.15s ease;
}

#records-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  background: var(--white);
  --pass-color: #2E7D32;
  --pass-bg: #e8f5e9;
  --fail-color: #C00000;
  --fail-bg: #ffebee;
  --conditional-color: #D97706;
  --conditional-bg: #FFF8E1;
  --draft-color: #534AB7;
  --draft-bg: #EEEDFE;
  --sync-pending: #D97706;
  --sync-failed: #C00000;
  --sync-synced: #2E7D32;
}

#records-header {
  flex-shrink: 0;
  background: var(--white);
}

#records-search-row {
  padding: 0 16px 8px;
  flex-shrink: 0;
  background: var(--white);
}

#records-segmented-row {
  padding: 0 16px 8px;
  flex-shrink: 0;
  background: var(--white);
}

#bookings-segmented-row {
  padding: 0 16px 8px;
  flex-shrink: 0;
  background: var(--white);
}

#bookings-header {
  flex-shrink: 0;
  background: var(--white);
}

#bookings-search-row {
  padding: 0 16px 8px;
  flex-shrink: 0;
  background: var(--white);
}

#bookings-search {
  width: 100%;
  height: 40px;
  border: 0.5px solid var(--border);
  border-radius: 20px;
  padding: 0 16px 0 36px;
  font-size: 16px;
  font-family: var(--font);
  background: var(--white);
  color: var(--text);
}

.panel-segmented {
  position: relative;
  display: flex;
  background: var(--border);
  border-radius: 999px;
  padding: 2px;
  margin-bottom: 10px;
}

.panel-segmented-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(50% - 2px);
  height: calc(100% - 4px);
  background: var(--white);
  border-radius: 999px;
  transition: transform 0.25s ease;
  pointer-events: none;
}

#bookings-refresh-btn {
  background: var(--white);
  border: 0.5px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--primary);
  transition: background 0.15s ease;
}

#bookings-refresh-btn:active {
  background: var(--panel);
}

#bookings-refresh-btn.is-spinning svg {
  animation: spin-refresh 0.6s linear;
}

#bookings-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 12px;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
}

#bookings-list > * + * {
  margin-top: 8px;
}

#bookings-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  width: 100%;
  background: var(--white);
  --pass-color: #2E7D32;
  --pass-bg: #e8f5e9;
  --fail-color: #C00000;
  --fail-bg: #ffebee;
  --conditional-color: #D97706;
  --conditional-bg: #FFF8E1;
  --draft-color: #534AB7;
  --draft-bg: #EEEDFE;
  --sync-pending: #D97706;
  --sync-failed: #C00000;
  --sync-synced: #2E7D32;
}

#records-refresh-btn {
  background: var(--white);
  border: 0.5px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--primary);
  transition: background 0.15s ease;
}

#records-refresh-btn:active {
  background: var(--panel);
}

@keyframes spin-refresh {
  to { transform: rotate(360deg); }
}

#records-refresh-btn.is-spinning svg {
  animation: spin-refresh 0.6s linear;
}

.segment-btn {
  position: relative;
  flex: 1;
  padding: 5px 0;
  border: none;
  background: transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--subtext);
  cursor: pointer;
  z-index: 1;
  font-family: var(--font);
  transition: color 0.2s ease;
}

.segment-btn.active {
  color: var(--primary);
  font-weight: 600;
}

#records-search {
  width: 100%;
  height: 40px;
  border: 0.5px solid var(--border);
  border-radius: 20px;
  padding: 0 16px;
  font-size: 16px;
  font-family: var(--font);
  background: var(--white);
  color: var(--text);
}

#records-filter-row {
  display: flex;
  gap: 6px;
  padding: 0 16px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
  background: var(--white);
}

#records-filter-row::-webkit-scrollbar {
  display: none;
}

#bookings-filter-row {
  display: flex;
  gap: 6px;
  padding: 0 16px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
  background: var(--white);
}

#bookings-filter-row::-webkit-scrollbar {
  display: none;
}

.records-filter-pill {
  padding: 5px 14px;
  border-radius: 999px;
  border: var(--pill-border);
  background: var(--white);
  color: var(--subtext);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.records-filter-pill.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

#records-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 12px;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
}

#records-list > * + * {
  margin-top: 8px;
}

.records-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.record-card {
  background: var(--white);
  border-radius: 12px;
  border: 0.5px solid var(--border);
  border-left: 3.5px solid var(--border);
  padding: 12px 14px;
  display: block;
  cursor: pointer;
  transition: background 0.15s ease;
}

.record-card:active {
  background: var(--panel);
}

.record-card.outcome-pass        { border-left-color: var(--pass-color); }
.record-card.outcome-fail        { border-left-color: var(--fail-color); }
.record-card.outcome-conditional { border-left-color: var(--conditional-color); }
.record-card.outcome-draft       { border-left-color: var(--draft-color); }
.record-card.outcome-assigned    { border-left-color: #805ad5; }
.record-card.outcome-in-progress { border-left-color: var(--conditional-color); }

.record-card-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  margin-bottom: 4px;
}

.record-card-job {
  font-size: 17px;
  font-weight: 500;
  color: var(--primary);
  flex-shrink: 0;
}

.record-card-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.record-card-badge.pass        { background: #EAF3DE; color: #3B6D11; }
.record-card-badge.fail        { background: #FCEBEB; color: #A32D2D; }
.record-card-badge.conditional { background: #FAEEDA; color: #854F0B; }
.record-card-badge.draft       { background: var(--draft-bg); color: var(--draft-color); }
.record-card-badge.assigned    { background: #EEEDFE; color: #3C3489; }
.record-card-badge.in-progress { background: #E6F1FB; color: #185FA5; }

.record-card-row2 {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-card-row3 {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-card-divider {
  border-top: 1px solid var(--border);
  margin-bottom: 6px;
}

.record-card-row4 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.bookings-section-header {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 4px 4px;
  margin-top: 4px;
}

.bookings-section-header--overdue {
  color: #A32D2D;
}

.record-swipe-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  flex-shrink: 0;
}

.record-swipe-delete {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: #DC2626;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 24px;
  opacity: 0;
  pointer-events: none;
}

.record-swipe-delete svg {
  transition: transform 0.15s ease;
}

.record-swipe-delete.past-threshold {
  background: #B91C1C;
}

.record-swipe-delete.past-threshold svg {
  transform: scale(1.3);
}

@keyframes delete-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.record-swipe-delete.delete-pulse svg {
  animation: delete-pulse 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.record-swipe-content {
  position: relative;
  z-index: 1;
  background: var(--white);
  will-change: transform;
}

.review-summary {
  background: var(--white);
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 12px 12px 0;
}

.review-summary-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.review-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.review-summary-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.review-summary-label {
  font-size: 12px;
  color: var(--muted);
}

.review-summary-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

.review-outcome-badge {
  display: block;
  width: fit-content;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 14px;
}

.review-outcome-pass {
  background: #e8f5e9;
  color: #2E7D32;
}

.review-outcome-fail {
  background: #ffebee;
  color: #C00000;
}

.review-outcome-conditional {
  background: #FFF8E1;
  color: #D97706;
}

.review-actions {
  padding: 0 12px;
}

#content-4 {
  padding-bottom: 16px;
}

.review-action-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s ease;
}

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

.review-action-row:hover {
  background: var(--panel);
}

.review-action-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.review-action-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.review-icon-blue {
  background: var(--panel);
}

.review-icon-amber {
  background: #FFF8E1;
}

.review-icon-green {
  background: #e8f5e9;
}

.review-icon-teal {
  background: #E0F2F1;
}

.review-action-text {
  flex: 1;
}

.review-action-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.review-action-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}

.review-coming-soon {
  font-size: 10px;
  background: var(--panel);
  color: var(--muted);
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 500;
  margin-right: 8px;
}

.pdf-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  flex-direction: column;
  z-index: 10003;
}

.pdf-lightbox-header {
  display: flex;
  justify-content: flex-end;
  padding: 12px;
}

.pdf-lightbox-close {
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: var(--white);
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
}

.pdf-lightbox-frame {
  width: calc(100% - 24px);
  height: calc(100% - 68px);
  margin: 0 auto 12px;
  border: none;
  border-radius: 8px;
  background: var(--white);
}

@keyframes slide-out-left {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(-40px); opacity: 0; }
}

@keyframes slide-in-right {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slide-out-right {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(40px); opacity: 0; }
}

@keyframes slide-in-left {
  from { transform: translateX(-40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.step-panel.slide-out-left {
  animation: slide-out-left 0.22s ease forwards;
}

.step-panel.slide-in-right {
  display: flex;
  flex-direction: column;
  animation: slide-in-right 0.22s ease forwards;
}

.step-panel.slide-out-right {
  animation: slide-out-right 0.22s ease forwards;
}

.step-panel.slide-in-left {
  display: flex;
  flex-direction: column;
  animation: slide-in-left 0.22s ease forwards;
}

@media (max-width: 640px) {
  #inspection-form {
    padding-left: 12px;
    padding-right: 12px;
  }

  .weather-fetch-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .weather-manual-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .weather-inline-error {
    white-space: normal;
  }
}

label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--subtext);
  margin-bottom: 6px;
  text-transform: capitalize;
  letter-spacing: 0.4px;
}

label.required-label::after,
label.required-conditional.is-required::after {
  content: ' *';
}

input[type="text"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 16px;
  font-family: var(--font);
  background: var(--white);
  color: var(--text);
  box-sizing: border-box;
}

input[type="text"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select {
  height: 48px;
  line-height: 24px;
  vertical-align: middle;
}

/* iOS-specific date input fixes */
@supports (-webkit-touch-callout: none) {
  input[type="tel"],
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"] {
    -webkit-appearance: none;
    -webkit-box-sizing: border-box;
    height: 48px;
    min-height: 48px;
    line-height: 24px;
    padding: 12px;
  }
}

/* Fallback for other browsers that may need webkit properties */
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
  -webkit-appearance: none;
  -webkit-box-sizing: border-box;
}

input[readonly] {
  background: var(--panel);
  color: var(--muted);
}

input.invalid {
  border-color: var(--error);
}

.field-error {
  display: block;
  color: var(--error);
  font-size: 13px;
  margin-top: 4px;
}

.field-error:empty {
  display: none;
}

.autofill-notice {
  display: block;
  color: var(--text-muted, #6b7280);
  font-size: 12px;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.autofill-notice.is-visible {
  opacity: 1;
}

.autofill-notice:empty {
  display: none;
}

/* #site-address is a styled div that swaps to a real <input> on interaction */
.site-address-display {
  display: block;
  width: 100%;
  height: 48px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 16px;
  font-family: var(--font);
  background: var(--white);
  color: var(--text);
  box-sizing: border-box;
  line-height: 24px;
  cursor: text;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.site-address-display:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(23, 57, 76, 0.15);
}

#inspection-form #site-address-active-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(23, 57, 76, 0.15);
}

#discipline-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#discipline-pills button {
  padding: 8px 14px;
  border: var(--pill-border);
  border-radius: 20px;
  font-size: 14px;
  font-weight: 400;
  font-family: var(--font);
  cursor: pointer;
  background: var(--white);
  color: var(--subtext);
  text-align: center;
}

#discipline-pills button.is-active {
  background: color-mix(in srgb, var(--primary) 8%, var(--white));
  color: var(--primary);
  border: var(--pill-border-active);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%2317394C' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

[id^="content-"] > div:has(input[type="radio"]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

[id^="content-"] > div:has(input[type="radio"]) > label:first-of-type {
  width: 100%;
  margin-bottom: 6px;
}

[id^="content-"] > div:has(input[type="radio"]) label:has(input[type="radio"]) {
  display: inline-flex;
  padding: 8px 14px;
  border: var(--pill-border);
  border-radius: 20px;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  background: var(--white);
  color: var(--subtext);
  text-align: center;
  justify-content: center;
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 0;
}

[id^="content-"] > div:has(input[type="radio"]) label:has(input[type="radio"]:checked) {
  background: color-mix(in srgb, var(--primary) 8%, var(--white));
  color: var(--primary);
  border: var(--pill-border-active);
}

#inspection-body-group > div:has(input[type="radio"]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

#inspection-body-group > div:has(input[type="radio"]) > label:first-of-type {
  width: 100%;
  margin-bottom: 6px;
}

#inspection-body-group > div:has(input[type="radio"]) label:has(input[type="radio"]) {
  display: inline-flex;
  padding: 8px 14px;
  border: var(--pill-border);
  border-radius: 20px;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  background: var(--white);
  color: var(--subtext);
  text-align: center;
  justify-content: center;
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 0;
}

#inspection-body-group > div:has(input[type="radio"]) label:has(input[type="radio"]:checked) {
  background: color-mix(in srgb, var(--primary) 8%, var(--white));
  color: var(--primary);
  border: var(--pill-border-active);
}

/* H&S category Yes/No rows: label left, pills pinned right */
.hs-category {
  display: block;
}

.hs-category h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--primary);
  text-transform: none;
  letter-spacing: 0;
  background: none;
  margin: 20px 0 6px;
  padding: 0;
  border-bottom: none;
}

.hs-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 14px 0 2px;
}

.hs-section-header h3 {
  margin: 0;
}

.hs-category > div:has(input[type="radio"]) {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  padding: 6px 0;
}

.hs-category > div:has(input[type="radio"]) > label:first-of-type {
  flex: 1;
  min-width: 0;
  width: auto;
  margin-bottom: 0;
}

.hs-category > div:has(input[type="radio"]) label:has(input[type="radio"]) {
  flex-shrink: 0;
  min-width: 48px;
  padding: 8px 20px;
}

input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

[id^="content-"] > div:has(> label + label input[type="checkbox"]),
[id^="content-"] > div:has(input[type="checkbox"]) {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

[id^="content-"] > div:has(input[type="checkbox"]) > label:first-child {
  width: 100%;
  margin-bottom: 6px;
}

[id^="content-"] > div:has(input[type="checkbox"]) label:has(input[type="checkbox"]) {
  display: inline-flex;
  padding: 8px 14px;
  margin: 0;
  border: var(--pill-border);
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  background: var(--white);
  color: var(--subtext);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  margin-bottom: 0;
}

[id^="content-"] > div:has(input[type="checkbox"]) label:has(input[type="checkbox"]:checked) {
  background: color-mix(in srgb, var(--primary) 8%, var(--white));
  color: var(--primary);
  border: var(--pill-border-active);
}

#inspection-body-group > div:has(input[type="checkbox"]) {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

#inspection-body-group > div:has(input[type="checkbox"]) > label:first-child {
  width: 100%;
  margin-bottom: 6px;
}

#inspection-body-group > div:has(input[type="checkbox"]) label:has(input[type="checkbox"]) {
  display: inline-flex;
  padding: 8px 14px;
  margin: 0;
  border: var(--pill-border);
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  background: var(--white);
  color: var(--subtext);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  margin-bottom: 0;
}

#inspection-body-group > div:has(input[type="checkbox"]) label:has(input[type="checkbox"]:checked) {
  background: color-mix(in srgb, var(--primary) 8%, var(--white));
  color: var(--primary);
  border: var(--pill-border-active);
}

.hs-pill-group.hs-pill-group-scroll {
  display: block;
}

.hs-pill-group.hs-pill-group-scroll > label:first-child {
  width: 100%;
  margin-bottom: 6px;
}

.hs-pill-scroll-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 4px;
}

.hs-pill-scroll-row::-webkit-scrollbar {
  display: none;
}

.hs-pill-scroll-row > label,
.hs-pill-scroll-row > button {
  scroll-snap-align: start;
}

.hs-pill-scroll-row label:has(input[type="checkbox"]) {
  flex: 0 0 auto;
}

.hs-pill-scroll-row.is-hidden {
  display: none;
}

.weather-fetch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.btn-action {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--white);
  color: var(--subtext);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.btn-action:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-action:disabled {
  opacity: 0.5;
  cursor: wait;
}

.weather-summary-line {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--subtext);
  min-height: 1.2em;
}

.weather-manual-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.weather-manual-row .hs-pill-scroll-row {
  flex: 1 1 auto;
}

.weather-inline-error {
  color: var(--error);
  font-size: 13px;
  min-height: 1.2em;
  white-space: nowrap;
}

.warning-callout {
  border-left: 3px solid #D97706;
  padding-left: 10px;
  color: #92400E;
  background: #FFFBEB;
  font-size: 13px;
  line-height: 1.5;
  margin-top: 8px;
  margin-bottom: 0;
}

.declare-row {
  margin-top: 16px;
}

.declare-section-header {
  margin-top: 0;
  margin-bottom: 0;
}
.declare-section-header label {
  font-size: 17px;
  font-weight: 600;
  color: var(--primary);
  text-transform: none;
  letter-spacing: 0;
  margin-top: 20px;
  margin-bottom: 6px;
}

.declare-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  font-size: 15px;
  color: var(--text);
}

.declare-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.declare-checkmark {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.declare-label:has(input:checked) .declare-checkmark {
  background: var(--primary);
  border-color: var(--primary);
}

.declare-label:has(input:checked) .declare-checkmark::after {
  content: '';
  width: 4px;
  height: 9px;
  border: 2px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translateY(-1px);
  display: block;
}

.declare-text {
  flex: 1;
  line-height: 1.5;
  color: var(--subtext);
}

.declare-row.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Subtle focus treatment across inspection + H&S form fields */
#inspection-form input[type="text"]:focus,
#inspection-form input[type="tel"]:focus,
#inspection-form textarea:focus,
#inspection-form select:focus,
#inspection-form input[type="date"]:focus,
#inspection-form input[type="time"]:focus,
#inspection-form input[type="datetime-local"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(23, 57, 76, 0.15);
}

#addressable-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  z-index: 1000;
  max-height: 220px;
  overflow-y: auto;
}

#addressable-dropdown li {
  padding: 12px;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

#addressable-dropdown li:last-child {
  border-bottom: none;
}

#addressable-dropdown li:hover {
  background: color-mix(in srgb, var(--primary) 15%, var(--white));
  color: var(--primary);
}

/* Confirm Modal Dialog Styles */
.confirm-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

.confirm-modal-overlay.show {
  display: block;
  opacity: 1;
}

.confirm-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: var(--white);
  border-radius: 12px;
  border-top: 4px solid var(--primary);
  box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
  padding: 0;
  min-width: 320px;
  max-width: 450px;
  z-index: 9999;
  display: none;
  opacity: 0;
  transition: all 0.3s ease-out;
  overflow: hidden;
}

.confirm-modal.show {
  display: block;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.confirm-modal-content {
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.confirm-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.3;
}

.confirm-modal-message {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.5;
}

.confirm-modal-buttons {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: center;
}

.confirm-modal-btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.confirm-modal-btn-cancel {
  background: transparent;
  color: var(--muted);
}

.confirm-modal-btn-cancel:hover {
  color: var(--text);
}

.confirm-modal-btn-confirm {
  background: var(--primary);
  color: var(--white);
}

.confirm-modal-btn-confirm:hover {
  background: var(--primary-hover);
}

.confirm-modal-btn-confirm.is-destructive {
  background: #C00000;
  color: var(--white);
}

.confirm-modal-btn-confirm.is-destructive:hover {
  background: #a00000;
}

.confirm-modal-btn-cancel.is-primary {
  background: var(--primary);
  color: var(--white);
  border-radius: 6px;
  padding: 10px 20px;
}

.confirm-modal-btn-cancel.is-primary:hover {
  background: var(--primary-hover);
}

.confirm-modal-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(23, 57, 76, 0.15);
}

#booking-fields-group {
  display: block;
}

#booking-fields-group.is-hidden {
  display: none;
}

/* ── Upload overlay ─────────────────────────────────────────────────────── */

#upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 200ms ease;
}

#upload-overlay-card {
  background: var(--white);
  border-radius: 14px;
  box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
  border-top: 4px solid var(--primary);
  padding: 32px 28px;
  max-width: 320px;
  width: calc(100% - 48px);
  text-align: center;
  transform: translateY(20px);
  transition: transform 250ms ease;
}

#upload-overlay[style*="flex"] #upload-overlay-card {
  transform: translateY(0);
}

#upload-spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid var(--panel);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#upload-overlay-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 6px;
}

#upload-status-message {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 20px;
  min-height: 1.4em;
}

#upload-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.upload-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--subtext);
}

.upload-step-icon {
  font-size: 16px;
  width: 20px;
  flex-shrink: 0;
  text-align: center;
}

.upload-step.is-progress .upload-step-icon {
  color: var(--primary);
  animation: pulse 1s ease-in-out infinite;
}

.upload-step.is-complete .upload-step-icon {
  color: #2E7D32;
}

.upload-step.is-failed .upload-step-icon {
  color: var(--error);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.timeframe-pill-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

#timeframe-pills button {
  width: 100%;
  padding: 8px 14px;
  border: var(--pill-border);
  border-radius: 20px;
  font-size: 14px;
  font-weight: 400;
  font-family: var(--font);
  cursor: pointer;
  background: var(--white);
  color: var(--subtext);
  text-align: center;
}

#timeframe-pills button.is-active {
  background: color-mix(in srgb, var(--primary) 8%, var(--white));
  color: var(--primary);
  border: var(--pill-border-active);
}

.input-with-action {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-action input {
  width: 100%;
  padding-right: 48px;
}

/* ── Record preview bottom sheet ────────────────────────────────────────── */

.record-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 10001;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.record-preview-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.record-preview-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  background: var(--white);
  border-radius: 16px 16px 0 0;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 10002;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
}

.record-preview-sheet.is-open {
  transform: translateY(0);
}

.record-preview-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 8px;
  flex-shrink: 0;
}

.record-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 12px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.record-preview-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.record-preview-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--panel);
  border-radius: 50%;
  cursor: pointer;
  color: var(--subtext);
  flex-shrink: 0;
}

.record-preview-close:hover {
  background: var(--border);
}

.record-preview-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  overflow-y: auto;
}

.record-preview-actions {
  position: sticky;
  bottom: 0;
  padding: 16px;
  border-top: 1px solid #eee;
  background: var(--white);
  flex-shrink: 0;
  display: flex;
  gap: 10px;
}

.preview-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 16px;
}

#record-preview-body .preview-field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #888;
  margin-bottom: 0;
}

#record-preview-body .preview-field-value {
  display: block;
  font-size: 15px;
  font-weight: 400;
  color: #1a1a1a;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: 0;
}

#record-preview-body .preview-field-subtext {
  color: #888;
  font-size: 14px;
  line-height: 1.5;
}

.preview-ncr-card {
  background: #f5f5f5;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

#record-preview-body .preview-ncr-title {
  font-size: 12px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 4px;
  text-transform: none;
  letter-spacing: 0;
}

#record-preview-body .preview-ncr-text {
  font-size: 14px;
  font-weight: 400;
  color: #444;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: 0;
}

.record-preview-outcome {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.record-preview-outcome.pass         { background: var(--pass-bg);        color: var(--pass-color); }
.record-preview-outcome.fail         { background: var(--fail-bg);        color: var(--fail-color); }
.record-preview-outcome.conditional  { background: var(--conditional-bg); color: var(--conditional-color); }

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: var(--white);
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font);
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.input-action-btn {
  position: absolute;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
  border: none;
  background: color-mix(in srgb, var(--primary) 12%, var(--white));
  color: var(--primary);
  cursor: pointer;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.input-action-btn:hover {
  background: color-mix(in srgb, var(--primary) 20%, var(--white));
}

.weather-fetched-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.weather-fetched-row .weather-summary-line {
  flex: 1;
  margin: 0;
  min-height: unset;
}

.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.85);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.lightbox-img {
  max-width: 92vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 6px;
  display: block;
}
.lightbox-counter {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  font-family: var(--font);
}
.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100000;
}
.lightbox-nav--prev { left: 16px; }
.lightbox-nav--next { right: 16px; }
.lightbox-delete {
  position: fixed;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(180,0,0,0.5);
  color: white;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  z-index: 100000;
  white-space: nowrap;
}
.lightbox-delete:hover {
  background: rgba(180,0,0,0.75);
}
.lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: white;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100000;
}

/* ── Step navigation buttons ────────────────────────────────────────────── */

.step-nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 16px 32px;
  gap: 12px;
  width: 100%;
}

.step-nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 13px 24px;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.step-nav-prev {
  background: #f0f0f0;
  color: #555;
  flex: 1;
  justify-content: center;
}

.step-nav-prev:active {
  background: #e0e0e0;
}

.step-nav-next {
  background: var(--primary);
  color: #fff;
  flex: 2;
  justify-content: center;
}

.step-nav-next:hover {
  opacity: 0.92;
}

.step-nav-next:active {
  opacity: 0.85;
}

.step-nav-next.disabled {
  background: #e0e0e0;
  color: #aaa;
  cursor: not-allowed;
  pointer-events: none;
}

.step-nav-next.ready {
  background: var(--primary);
  box-shadow: 0 4px 12px rgba(3, 131, 135, 0.3);
}

.step-nav-btn.step-nav-equal {
  flex: 1 !important;
}

@keyframes reassign-confirm {
  0%   { transform: scale(1); opacity: 1; }
  40%  { transform: scale(0.97); opacity: 0.85; }
  100% { transform: scale(1); opacity: 1; }
}

/* ── Desktop sidebar layout ─────────────────────────────────────────────── */

#app-sidebar {
  display: none;
}

@media (min-width: 768px) {
  body {
    overflow: hidden;
    background: #F5F7F9;
  }

  #app {
    flex-direction: row;
    height: 100dvh;
    overflow: hidden;
    background: #F5F7F9;
  }

  #app:has(.login-landing.visible) #app-sidebar {
    display: none;
  }

  #app:has(.login-landing.visible) {
    flex-direction: column;
  }

  #app-sidebar {
    display: flex;
    flex-direction: column;
    width: 220px;
    min-width: 220px;
    height: 100%;
    background: #0E2733;
    padding: 24px 0 32px;
    flex-shrink: 0;
    z-index: 20;
    order: -1;
  }

  .sidebar-logo {
    padding: 0 20px 28px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 16px;
  }

  .sidebar-logo-img {
    width: 140px;
    display: block;
  }

  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 12px;
    flex: 1;
  }

  .sidebar-nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.45);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background 0.15s ease, color 0.15s ease;
  }

  .sidebar-nav-btn:hover {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.8);
  }

  .sidebar-nav-btn.active {
    background: rgba(255,255,255,0.1);
    color: #ffffff;
    font-weight: 500;
  }

  .sidebar-nav-btn svg {
    flex-shrink: 0;
    opacity: 0.7;
  }

  .sidebar-nav-btn.active svg {
    opacity: 1;
  }

  #app-tab-bar {
    display: none !important;
  }

  #inspection-form {
    flex: 1;
    min-width: 0;
    height: 100%;
    overflow: hidden;
  }

  #inspection-form {
    max-width: 100%;
    margin: 0;
    background: #F5F7F9;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
    flex: 1;
  }

  #step-indicator {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    padding: 16px calc(50% - 340px);
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .step-panel {
    display: none;
  }

  .step-panel.active {
    display: block;
    background: #F5F7F9;
    padding: 32px 24px;
    width: 100%;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
  }

  .step-panel.active > div[id^="content-"] {
    background: #ffffff;
    border-radius: 12px;
    border: 0.5px solid var(--border);
    padding: 32px;
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
    display: block;
  }

  .step-panel.active .step-nav-row {
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
    padding: 16px 0 24px;
  }

  .step-panel > div[id^="content-"] > div {
    margin-bottom: 16px;
  }

  #records-panel,
  #bookings-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    height: 100%;
    overflow: hidden;
    background: #F5F7F9;
  }

  #records-header,
  #bookings-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    width: 100%;
  }

  #records-header > div,
  #bookings-header > div {
    padding: 20px 32px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    box-sizing: border-box;
    background: #ffffff;
    max-width: 100%;
    margin: 0;
  }

  #records-segmented-row,
  #bookings-segmented-row {
    padding: 12px 32px 0;
    background: #ffffff;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    max-width: 100%;
    margin: 0;
  }

  #engineer-filter-segmented,
  #bookings-filter-segmented {
    max-width: 280px;
    min-width: 200px;
  }

  #records-search-row,
  #bookings-search-row {
    padding: 10px 32px 0;
    background: #ffffff;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    max-width: 100%;
    margin: 0;
  }

  #records-search,
  #bookings-search {
    max-width: 360px;
    height: 36px;
    font-size: 14px;
  }

  #records-filter-row,
  #bookings-filter-row {
    padding: 10px 32px 14px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    max-width: 100%;
    margin: 0;
  }

  #records-list,
  #bookings-list {
    padding: 20px 32px 32px;
    background: #F5F7F9;
    flex: 1;
    overflow-y: auto;
  }

  .record-card {
    background: #ffffff;
    border-radius: 10px;
    max-width: 860px;
  }

  .records-empty {
    max-width: 860px;
  }
}

/* ── Booking PIN modal ──────────────────────────────────────────────────── */

.booking-pin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  display: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.booking-pin-overlay.show {
  display: block;
  opacity: 1;
}

.booking-pin-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: var(--white);
  border-radius: 16px;
  padding: 24px;
  width: calc(100% - 48px);
  max-width: 320px;
  z-index: 9999;
  display: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-sizing: border-box;
}

.booking-pin-modal.show {
  display: block;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.booking-pin-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  color: var(--primary);
}

.booking-pin-subtitle {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

.booking-pin-input {
  display: block;
  width: 100%;
  font-size: 28px;
  text-align: center;
  border: none;
  border-bottom: 2px solid var(--border);
  outline: none;
  padding: 8px 0;
  background: transparent;
  letter-spacing: 10px;
  margin: 0 auto 6px;
  box-sizing: border-box;
  font-family: var(--font);
}

.booking-pin-input:focus {
  border-bottom-color: var(--primary);
}

.booking-pin-error {
  min-height: 18px;
  font-size: 13px;
  color: #FF3B30;
  text-align: center;
  margin: 0 0 8px;
}

.booking-pin-buttons {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.booking-pin-buttons .confirm-modal-btn {
  flex: 1;
}

@keyframes booking-pin-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

.booking-pin-input.shake {
  animation: booking-pin-shake 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
