* {
  box-sizing: border-box;
}

:root {
  --iron: #03286a;
  --gate: #0d82d8;
  --wave: #1db8f5;
  --text: #17304f;
  --muted: #5c6373;
  --surface: #f7fafe;
  --card: #ffffff;
  --line: #e6edf5;
  --danger: #e53935;
  --danger-soft: #fff3f3;
  --shadow: rgba(3, 40, 106, 0.14);
  --white: #ffffff;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background:
    radial-gradient(circle at 50% 0%, rgba(29, 184, 245, 0.14), transparent 32%),
    linear-gradient(180deg, #eaf5fc 0%, #f8fbff 100%);
  color: var(--text);
}

.app-shell {
  width: 100%;
  max-width: 720px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--surface);
  overflow: hidden;
}

.hero {
  position: relative;
  padding: 28px 22px 38px;
  background:
    radial-gradient(circle at 86% 14%, rgba(29, 184, 245, 0.18), transparent 32%),
    linear-gradient(180deg, #f3f9ff 0%, #eaf5fc 100%);
  overflow: hidden;
}
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.hero::before {
  left: -24%;
  bottom: -72px;
  width: 150%;
  height: 128px;
  background: rgba(29, 184, 245, 0.1);
  transform: rotate(-3deg);
}

.hero::after {
  left: -28%;
  bottom: -92px;
  width: 160%;
  height: 128px;
  background: rgba(13, 130, 216, 0.08);
  transform: rotate(-7deg);
}

.brand {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 18px;
}

.main-logo {
  width: 132px;
  min-width: 132px;
  display: block;
}

.brand-text h1 {
  margin: 0;
  font-size: clamp(2.45rem, 10vw, 4rem);
  line-height: 0.9;
  font-weight: 850;
  letter-spacing: -2.5px;
}

.iron { color: var(--iron); }
.gate { color: var(--gate); }

.brand-mark {
  border-radius: 30px;
  background:
    radial-gradient(circle at 70% 20%, rgba(29, 184, 245, 0.36), transparent 42%),
    linear-gradient(135deg, var(--iron) 0%, var(--gate) 100%);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 950;
  letter-spacing: -0.06em;
  box-shadow: 0 14px 34px rgba(3, 40, 106, 0.2);
}

.brand-text p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 800;
}

.tab-bar {
  position: relative;
  z-index: 5;
  margin-top: -18px;
  padding: 16px 10px 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
  border-radius: 28px 28px 0 0;
  box-shadow:
    0 -12px 30px rgba(3, 40, 106, 0.12),
    0 4px 14px rgba(15, 23, 42, 0.05);
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.tab {
  min-height: 88px;
  padding: 8px 4px 15px;
  border: 0;
  background: transparent;
  color: #56627a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 750;
  position: relative;
  cursor: pointer;
}

.tab img {
  width: 31px;
  height: 31px;
  object-fit: contain;
  display: block;
  opacity: 0.74;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.tab.locked {
  opacity: 0.38;
  cursor: not-allowed;
}

.tab.locked img {
  opacity: 0.42;
  filter: grayscale(1);
}

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

.tab.active img {
  opacity: 1;
  transform: translateY(-2px) scale(1.04);
}

.tab.active::after {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 0;
  height: 4px;
  border-radius: 99px 99px 0 0;
  background: linear-gradient(90deg, var(--gate), var(--wave));
}

.content {
  padding: 22px 20px 34px;
}

.page {
  display: none;
  animation: pageIn 0.24s ease;
}

.page.active-page {
  display: block;
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.home-page.active-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.inspection-card {
  width: 100%;
  border: none;
  border-radius: 30px;
  padding: 24px;
  color: white;
  background:
    radial-gradient(circle at 92% 0%, rgba(29, 184, 245, 0.42), transparent 34%),
    linear-gradient(135deg, var(--iron) 0%, var(--gate) 100%);
  display: flex;
  align-items: center;
  gap: 18px;
  cursor: pointer;
  box-shadow:
    0 18px 42px rgba(3, 40, 106, 0.25),
    0 6px 18px rgba(13, 130, 216, 0.18);
}

.inspection-icon {
  width: 68px;
  height: 68px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  flex-shrink: 0;
}

.inspection-content {
  flex: 1;
  text-align: left;
}

.inspection-content h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
}

.inspection-content p {
  margin: 6px 0 0;
  opacity: 0.9;
  font-size: 0.9rem;
}

.inspection-arrow {
  font-size: 1.8rem;
  opacity: 0.86;
}

.home-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 4px 0;
}

.home-list-header h2 {
  margin: 0;
  color: var(--iron);
  font-size: 1.25rem;
}

.home-list-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.small-action {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--gate);
  background: #edf7ff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 850;
  cursor: pointer;
}

.inspection-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.inspection-list-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inspection-list-title {
  margin: 4px 4px 0;
  color: var(--iron);
  font-size: 1.05rem;
  font-weight: 900;
}

.inspection-list-empty {
  margin: 0;
  padding: 14px 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
  border: 1px dashed rgba(3, 40, 106, 0.14);
  border-radius: 18px;
  font-size: 0.88rem;
}

.saved-inspection-card {
  position: relative;
  width: 100%;
  border: 1px solid rgba(13, 130, 216, 0.16);
  border-radius: 22px;
  padding: 16px;
  background: white;
  box-shadow: 0 10px 24px rgba(3, 40, 106, 0.07);
  text-align: left;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
}

.saved-inspection-main {
  min-width: 0;
  cursor: pointer;
}

.saved-inspection-card strong {
  color: var(--iron);
  display: block;
  font-size: 1rem;
}

.saved-inspection-card .meta {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.35;
  font-size: 0.88rem;
}

.saved-inspection-status,
.saved-inspection-progress {
  margin-top: 8px;
  font-size: 0.82rem;
  font-weight: 850;
}

.saved-inspection-progress {
  color: var(--muted);
}

.saved-inspection-status.not-started,
.saved-inspection-status.in-progress {
  color: var(--gate);
}

.saved-inspection-status.ready {
  color: #137333;
}

.saved-inspection-status.needs-attention {
  color: var(--danger);
}

.saved-inspection-actions {
  align-self: start;
  padding-top: 30px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.saved-inspection-btn {
  border: 0;
  border-radius: 999px;
  padding: 9px 12px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 850;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}

.saved-inspection-btn.open {
  background: #edf7ff;
  color: var(--gate);
}

.saved-inspection-btn.download {
  color: white;
  background: linear-gradient(135deg, var(--iron), var(--gate));
  box-shadow: 0 8px 18px rgba(3, 40, 106, 0.12);
}

.saved-inspection-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  color: var(--danger);
  background: #fff3f3;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(229, 57, 53, 0.12);
}

.saved-inspection-delete:hover,
.saved-inspection-delete:focus-visible {
  color: #ffffff;
  background: var(--danger);
  outline: none;
}

.empty-state {
  text-align: center;
  padding: 42px 20px 62px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px dashed rgba(3, 40, 106, 0.16);
  border-radius: 28px;
}

.empty-icon {
  width: 68px;
  height: 68px;
  object-fit: contain;
  opacity: 0.72;
  margin-bottom: 14px;
}

.empty-state h3 {
  margin: 0;
  color: var(--iron);
  font-size: 1.3rem;
}

.empty-state p {
  max-width: 300px;
  margin: 10px auto 0;
  color: var(--muted);
  line-height: 1.5;
}

.section-card {
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 14px 34px rgba(3, 40, 106, 0.08);
}

.section-card.defect-active,
.section-card.fail-highlight,
.fence-card.defect-active,
.fence-card.fail-highlight {
  border-left: 6px solid var(--danger);
  background: linear-gradient(180deg, #ffffff 0%, var(--danger-soft) 100%);
}

.summary-card {
  margin-top: 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.section-heading img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  flex-shrink: 0;
}

.section-heading.small-heading img {
  width: 44px;
  height: 44px;
}

.section-heading h2 {
  margin: 0;
  color: var(--iron);
  font-size: 1.35rem;
  font-weight: 850;
}

.section-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.35;
  font-size: 0.94rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.field {
  display: block;
}

.field.full {
  grid-column: 1 / -1;
}

.field span,
.check-field span {
  display: block;
  margin-bottom: 8px;
  color: var(--iron);
  font-size: 0.9rem;
  font-weight: 800;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 15px 16px;
  background: #fbfdff;
  color: var(--text);
  font: inherit;
  outline: none;
}

.field input[readonly] {
  background: #eef8ff;
  color: var(--iron);
  font-weight: 850;
}

.field textarea {
  min-height: 128px;
  resize: vertical;
}

.check-field {
  width: 100%;
  margin: 6px 0 18px;
  padding: 15px 16px;
  border: 1px solid rgba(13, 130, 216, 0.18);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f5fbff 100%);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.check-field input {
  width: 22px;
  height: 22px;
  accent-color: var(--gate);
  flex-shrink: 0;
}

.check-field span {
  margin: 0;
}

.fence-sections {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.fence-card {
  padding: 18px;
  border: 1px solid rgba(13, 130, 216, 0.16);
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fcff 100%);
  box-shadow: 0 10px 24px rgba(3, 40, 106, 0.06);
}

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

.fence-card-head h3 {
  margin: 0;
  color: var(--iron);
  font-size: 1.05rem;
  font-weight: 850;
}

.remove-section-btn {
  border: 0;
  border-radius: 999px;
  padding: 9px 12px;
  color: var(--danger);
  background: #fff3f3;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 850;
  cursor: pointer;
}

.add-section-btn {
  width: 100%;
  margin-top: 18px;
  border: 0;
  border-radius: 20px;
  padding: 18px 16px;
  color: white;
  background: linear-gradient(135deg, var(--iron), var(--gate));
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(3, 40, 106, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.add-section-btn span {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}

.details-group {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid rgba(13, 130, 216, 0.14);
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fcff 100%);
}

.details-group:first-of-type {
  margin-top: 0;
}

.group-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.group-title-row h3 {
  margin: 0;
  color: var(--iron);
}

.group-number {
  width: 34px;
  height: 34px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, var(--iron), var(--gate));
  font-weight: 900;
  flex-shrink: 0;
}

.toggle-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toggle-field {
  min-height: 58px;
  padding: 14px 14px 14px 16px;
  border: 1px solid rgba(13, 130, 216, 0.14);
  border-radius: 20px;
  background: #fbfdff;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.toggle-field span {
  flex: 1;
  color: var(--iron);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.25;
}

.toggle-field input {
  width: 22px;
  height: 22px;
  accent-color: var(--gate);
}

.toggle-field i {
  display: none;
}

.notes-field {
  margin-top: 16px;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
}

.small-btn,
.camera-btn {
  border: 0;
  border-radius: 16px;
  padding: 14px 16px;
  color: white;
  background: linear-gradient(135deg, var(--iron), var(--gate));
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(3, 40, 106, 0.14);
}

.small-btn.secondary {
  color: var(--iron);
  background: #edf7ff;
}

.small-btn.danger {
  background: #fff3f3;
  color: var(--danger);
}

.photo-widget {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.camera-btn {
  width: auto;
  min-width: 150px;
  padding: 12px 14px;
  color: var(--gate);
  background: #ffffff;
  border: 1px solid rgba(13, 130, 216, 0.22);
  box-shadow: 0 8px 18px rgba(3, 40, 106, 0.08);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.photo-box {
  position: relative;
  min-height: 150px;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #edf5fc;
}

.photo-box img {
  width: 100%;
  height: 100%;
  min-height: 150px;
  object-fit: cover;
  display: block;
}

.timestamp {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(3, 40, 106, 0.78);
  color: white;
  font-size: 0.68rem;
  line-height: 1.25;
}

.remove-photo {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--danger);
  font-weight: 900;
  cursor: pointer;
}

.failure-summary {
  margin: 0;
  padding-left: 22px;
  color: var(--text);
  line-height: 1.55;
}

.failure-summary li + li {
  margin-top: 8px;
}

@media (max-width: 560px) {
  .app-shell { max-width: none; }
  .hero { padding: 24px 16px 36px; }
  .main-logo { width: 98px; min-width: 98px; }
  .brand { gap: 14px; }
  .brand-text h1 { font-size: 2.45rem; }
  .brand-text p { font-size: 0.72rem; letter-spacing: 1.6px; }
  .tab-bar {
    overflow-x: auto;
    grid-template-columns: repeat(7, minmax(78px, 1fr));
    scrollbar-width: none;
  }
  .tab-bar::-webkit-scrollbar { display: none; }
  .tab img { width: 30px; height: 30px; }
  .tab { font-size: 0.72rem; }
  .content { padding: 20px 16px 32px; }
  .inspection-card { padding: 22px; }
  .inspection-icon { width: 60px; height: 60px; border-radius: 20px; }
  .section-card { padding: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .button-row { grid-template-columns: 1fr; }
  .fence-card { padding: 16px; }
  .fence-card-head { align-items: flex-start; }
  .saved-inspection-card {
    grid-template-columns: 1fr;
  }
  .saved-inspection-actions {
    width: 100%;
    flex-direction: row;
  }
  .saved-inspection-btn {
    flex: 1;
  }
}
.helper-text {
  margin: -4px 0 16px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}





.climbability-section-group {
  border: 1px solid rgba(13, 130, 216, 0.16);
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fcff 100%);
  box-shadow: 0 10px 24px rgba(3, 40, 106, 0.06);
  overflow: hidden;
}

.climbability-section-summary {
  padding: 18px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.climbability-section-summary::-webkit-details-marker {
  display: none;
}

.climbability-section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.climbability-section-title h3 {
  margin: 0;
  color: var(--iron);
  font-size: 1.05rem;
  font-weight: 850;
}

.climbability-section-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.3;
}

.climbability-section-body {
  padding: 0 18px 18px;
}

.climbability-section-body .details-group {
  margin-top: 18px;
}

.modern-collapse-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: #edf7ff;
  border: 1px solid rgba(13, 130, 216, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--gate);
  box-shadow: 0 8px 18px rgba(3, 40, 106, 0.08);
  flex-shrink: 0;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.modern-chevron {
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1;
  transition: transform 0.22s ease;
}

.climbability-section-group[open] .modern-chevron {
  transform: rotate(180deg);
}

.climbability-section-summary:hover .modern-collapse-btn {
  background: #e4f4ff;
  box-shadow: 0 10px 22px rgba(3, 40, 106, 0.12);
}

@media (max-width: 560px) {
  .climbability-section-summary {
    align-items: flex-start;
  }

  .modern-collapse-btn {
    width: 36px;
    height: 36px;
  }
}

.gate-section-group {
  border: 1px solid rgba(13, 130, 216, 0.16);
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fcff 100%);
  box-shadow: 0 10px 24px rgba(3, 40, 106, 0.06);
  overflow: hidden;
}

.gate-section-summary {
  padding: 18px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.gate-section-summary::-webkit-details-marker {
  display: none;
}

.gate-section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.gate-section-title h3 {
  margin: 0;
  color: var(--iron);
  font-size: 1.05rem;
  font-weight: 850;
}

.gate-section-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.3;
}

.gate-section-body {
  padding: 0 18px 18px;
}

.gate-section-body .details-group {
  margin-top: 18px;
}

.gate-section-group[open] .modern-chevron {
  transform: rotate(180deg);
}

.gate-section-summary:hover .modern-collapse-btn {
  background: #e4f4ff;
  box-shadow: 0 10px 22px rgba(3, 40, 106, 0.12);
}

@media (max-width: 560px) {
  .gate-section-summary {
    align-items: flex-start;
  }
}


.safety-section-group {
  border: 1px solid rgba(13, 130, 216, 0.16);
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fcff 100%);
  box-shadow: 0 10px 24px rgba(3, 40, 106, 0.06);
  overflow: hidden;
}

.safety-section-summary {
  padding: 18px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.safety-section-summary::-webkit-details-marker {
  display: none;
}

.safety-section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.safety-section-title h3 {
  margin: 0;
  color: var(--iron);
  font-size: 1.05rem;
  font-weight: 850;
}

.safety-section-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.3;
}

.safety-section-body {
  padding: 0 18px 18px;
}

.safety-section-body .details-group {
  margin-top: 18px;
}

.safety-section-group[open] .modern-chevron {
  transform: rotate(180deg);
}

.safety-section-summary:hover .modern-collapse-btn {
  background: #e4f4ff;
  box-shadow: 0 10px 22px rgba(3, 40, 106, 0.12);
}

@media (max-width: 560px) {
  .safety-section-summary {
    align-items: flex-start;
  }
}


.safety-check-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.safety-check-group {
  border: 1px solid rgba(13, 130, 216, 0.16);
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fcff 100%);
  box-shadow: 0 10px 24px rgba(3, 40, 106, 0.06);
  overflow: hidden;
}

.safety-check-summary {
  padding: 18px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.safety-check-summary::-webkit-details-marker {
  display: none;
}

.safety-check-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.safety-check-title h3 {
  margin: 0;
  color: var(--iron);
  font-size: 1.05rem;
  font-weight: 850;
}

.safety-check-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.3;
}

.safety-check-body {
  padding: 0 18px 18px;
}

.safety-check-group[open] .modern-chevron {
  transform: rotate(180deg);
}

.safety-check-summary:hover .modern-collapse-btn {
  background: #e4f4ff;
  box-shadow: 0 10px 22px rgba(3, 40, 106, 0.12);
}

@media (max-width: 560px) {
  .safety-check-summary {
    align-items: flex-start;
  }
}


.details-check-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.details-check-group {
  border: 1px solid rgba(13, 130, 216, 0.16);
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fcff 100%);
  box-shadow: 0 10px 24px rgba(3, 40, 106, 0.06);
  overflow: hidden;
}

.details-check-summary {
  padding: 18px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.details-check-summary::-webkit-details-marker {
  display: none;
}

.details-check-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.details-check-title h3 {
  margin: 0;
  color: var(--iron);
  font-size: 1.05rem;
  font-weight: 850;
}

.details-check-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.3;
}

.details-check-body {
  padding: 0 18px 18px;
}

.details-check-group[open] .modern-chevron {
  transform: rotate(180deg);
}

.details-check-summary:hover .modern-collapse-btn {
  background: #e4f4ff;
  box-shadow: 0 10px 22px rgba(3, 40, 106, 0.12);
}

@media (max-width: 560px) {
  .details-check-summary {
    align-items: flex-start;
  }
}

.barrier-check-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.barrier-check-group {
  border: 1px solid rgba(13, 130, 216, 0.16);
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fcff 100%);
  box-shadow: 0 10px 24px rgba(3, 40, 106, 0.06);
  overflow: hidden;
}

.barrier-check-summary {
  padding: 18px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.barrier-check-summary::-webkit-details-marker {
  display: none;
}

.barrier-check-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.barrier-check-title h3 {
  margin: 0;
  color: var(--iron);
  font-size: 1.05rem;
  font-weight: 850;
}

.barrier-check-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.3;
}

.barrier-check-body {
  padding: 0 18px 18px;
}

.barrier-check-group[open] .modern-chevron {
  transform: rotate(180deg);
}

.barrier-check-summary:hover .modern-collapse-btn {
  background: #e4f4ff;
  box-shadow: 0 10px 22px rgba(3, 40, 106, 0.12);
}

@media (max-width: 560px) {
  .barrier-check-summary {
    align-items: flex-start;
  }
}

/* Firebase authentication / cloud save status */
.auth-panel {
  position: relative;
  z-index: 10;
  margin: 14px 14px 0;
  padding: 14px;
  border: 1px solid rgba(13, 130, 216, 0.16);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 24px rgba(3, 40, 106, 0.08);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.auth-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--iron);
  font-size: 0.86rem;
}

.auth-copy strong {
  font-size: 0.95rem;
}

#firebaseStatus {
  color: var(--muted);
  line-height: 1.3;
}

#firebaseStatus.error {
  color: var(--danger);
  font-weight: 800;
}

.auth-form,
.signed-in-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.auth-form[hidden],
.signed-in-panel[hidden] {
  display: none !important;
}

.auth-form input {
  width: 150px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 12px;
  background: #fbfdff;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  outline: none;
}

.auth-form button,
.signed-in-panel button {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  padding: 9px 14px;
  color: white;
  background: linear-gradient(135deg, var(--iron), var(--gate));
  font: inherit;
  font-size: 0.82rem;
  font-weight: 850;
  cursor: pointer;
}

.signed-in-panel span {
  color: var(--iron);
  font-size: 0.84rem;
  font-weight: 800;
}

body.firebase-signed-out .tab:not([data-tab="home"]) {
  opacity: 0.38;
  cursor: not-allowed;
}

body.firebase-signed-out .inspection-card {
  opacity: 0.58;
  cursor: not-allowed;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 560px) {
  .auth-panel {
    grid-template-columns: 1fr;
    margin: 10px 10px 0;
  }

  .auth-form,
  .signed-in-panel {
    justify-content: stretch;
  }

  .auth-form input,
  .auth-form button,
  .signed-in-panel button {
    width: 100%;
  }
}

/* Client-branded report masthead */
.report-brand-header {
  display: none;
  margin: 0 auto;
  padding: 0 20px 18px;
  max-width: 720px;
  background: #ffffff;
}

.report-brand-topline {
  height: 8px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(90deg, var(--iron), var(--gate), var(--wave));
}

.report-brand-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 22px 0 12px;
  border-bottom: 1px solid var(--line);
}

.report-logo-box {
  width: 86px;
  height: 86px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 70% 18%, rgba(29, 184, 245, 0.34), transparent 42%),
    linear-gradient(135deg, var(--iron), var(--gate));
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 1.65rem;
  font-weight: 950;
  letter-spacing: -0.06em;
  overflow: hidden;
}

.report-logo-box.has-logo {
  background: #ffffff;
  border: 1px solid var(--line);
}

.report-logo-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.report-kicker {
  margin: 0 0 6px;
  color: var(--gate);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
  font-weight: 900;
}

.report-brand-copy h1 {
  margin: 0;
  color: var(--iron);
  font-size: clamp(1.8rem, 6vw, 2.8rem);
  line-height: 1;
  letter-spacing: -0.045em;
}

.report-business-meta,
.report-inspection-meta,
.report-footer-text {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.88rem;
  font-weight: 700;
}

.report-inspection-meta {
  padding-top: 10px;
  color: var(--text);
}

.report-footer-text:empty {
  display: none;
}

body.download-mode .report-brand-header {
  display: block;
}

body.download-mode .hero {
  display: none;
}

/* Download / print-to-PDF mode */
.download-close-btn {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 9999;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  color: white;
  background: linear-gradient(135deg, var(--iron), var(--gate));
  box-shadow: 0 14px 30px rgba(3, 40, 106, 0.25);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 900;
  cursor: pointer;
}

.download-close-btn[hidden] {
  display: none;
}

body.download-mode .tab-bar {
  pointer-events: none;
}

body.download-mode #home {
  display: none !important;
}

body.download-mode .page:not(#home) {
  display: block !important;
  animation: none;
  margin-bottom: 20px;
}

body.download-mode .content::before {
  content: "Client-branded printable inspection view — choose Save as PDF in the print dialog.";
  display: block;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid rgba(13, 130, 216, 0.18);
  border-radius: 18px;
  color: var(--iron);
  background: #edf7ff;
  font-weight: 850;
  line-height: 1.35;
}

body.download-mode .auth-panel,
body.download-mode .button-row,
body.download-mode .add-section-btn,
body.download-mode .remove-section-btn,
body.download-mode .remove-photo,
body.download-mode .camera-btn {
  display: none !important;
}

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  html,
  body {
    width: auto;
    min-height: auto;
    background: #ffffff !important;
  }

  body.download-mode .download-close-btn,
  body.download-mode .settings-overlay,
  body.download-mode .bottom-sheet-overlay,
  body.download-mode .auth-panel,
  body.download-mode .tab-bar,
  body.download-mode #home,
  body.download-mode .button-row,
  body.download-mode .add-section-btn,
  body.download-mode .remove-section-btn,
  body.download-mode .remove-photo,
  body.download-mode .camera-btn,
  body.download-mode .content::before {
    display: none !important;
  }

  body.download-mode .report-brand-header {
    display: block !important;
    max-width: none;
    padding: 0 0 8mm;
    margin: 0;
    break-after: avoid;
  }

  body.download-mode .hero {
    display: none !important;
  }

  body.download-mode .app-shell {
    width: 100%;
    max-width: none;
    min-height: auto;
    margin: 0;
    background: #ffffff;
    overflow: visible;
  }

  body.download-mode .hero {
    padding: 0 0 14px;
    background: #ffffff !important;
    border-bottom: 2px solid var(--line);
    overflow: visible;
  }

  body.download-mode .hero::before,
  body.download-mode .hero::after {
    display: none !important;
  }

  body.download-mode .brand {
    gap: 12px;
  }

  body.download-mode .main-logo {
    width: 82px;
    min-width: 82px;
  }

  body.download-mode .brand-text h1 {
    font-size: 2rem;
    letter-spacing: -1.4px;
  }

  body.download-mode .brand-text p {
    font-size: 0.68rem;
    letter-spacing: 1.4px;
  }

  body.download-mode .content {
    padding: 14px 0 0;
  }

  body.download-mode .page,
  body.download-mode .page:not(#home) {
    display: block !important;
    animation: none !important;
    margin: 0 0 10mm;
    break-after: auto;
  }

  body.download-mode .section-card,
  body.download-mode .details-group,
  body.download-mode .fence-card,
  body.download-mode .details-check-group,
  body.download-mode .barrier-check-group,
  body.download-mode .climbability-section-group,
  body.download-mode .gate-section-group,
  body.download-mode .safety-section-group,
  body.download-mode .safety-check-group {
    box-shadow: none !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.download-mode .section-card {
    padding: 14px;
    border-radius: 18px;
  }

  body.download-mode .section-heading {
    margin-bottom: 14px;
  }

  body.download-mode .section-heading img {
    width: 38px;
    height: 38px;
  }

  body.download-mode .section-heading h2 {
    font-size: 1.15rem;
  }

  body.download-mode .section-heading p,
  body.download-mode .helper-text,
  body.download-mode .details-check-title p,
  body.download-mode .barrier-check-title p,
  body.download-mode .climbability-section-title p,
  body.download-mode .gate-section-title p,
  body.download-mode .safety-section-title p,
  body.download-mode .safety-check-title p {
    font-size: 0.78rem;
  }

  body.download-mode details {
    display: block !important;
  }

  body.download-mode summary {
    break-after: avoid;
  }

  body.download-mode .modern-collapse-btn {
    display: none !important;
  }

  body.download-mode .form-grid {
    gap: 10px;
  }

  body.download-mode .field span,
  body.download-mode .check-field span {
    font-size: 0.78rem;
    margin-bottom: 5px;
  }

  body.download-mode .field input,
  body.download-mode .field textarea,
  body.download-mode .field select {
    min-height: 38px;
    padding: 9px 10px;
    border-radius: 10px;
    background: #ffffff !important;
    font-size: 0.82rem;
  }

  body.download-mode .field textarea {
    min-height: 72px;
  }

  body.download-mode .check-field,
  body.download-mode .toggle-field {
    padding: 9px 10px;
    border-radius: 12px;
    min-height: 42px;
  }

  body.download-mode .photo-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  body.download-mode .photo-box,
  body.download-mode .photo-box img {
    min-height: 110px;
  }

  body.download-mode .timestamp {
    font-size: 0.58rem;
  }
}

/* Protected app auth guard */
body.auth-checking .app-shell {
  opacity: 0;
  pointer-events: none;
}

.app-auth-panel {
  grid-template-columns: 1fr auto;
}

/* Separate login page */
.login-page-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 50% 0%, rgba(29, 184, 245, 0.18), transparent 34%),
    linear-gradient(180deg, #eaf5fc 0%, #f8fbff 100%);
}

.login-shell {
  width: 100%;
  max-width: 460px;
}

.login-card {
  width: 100%;
  border: 1px solid rgba(13, 130, 216, 0.16);
  border-radius: 30px;
  padding: 28px;
  background:
    radial-gradient(circle at 92% 0%, rgba(29, 184, 245, 0.12), transparent 34%),
    #ffffff;
  box-shadow: 0 22px 54px rgba(3, 40, 106, 0.16);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.login-logo {
  width: 92px;
  min-width: 92px;
  display: block;
}

.login-brand h1 {
  margin: 0;
  font-size: clamp(2rem, 9vw, 3rem);
  line-height: 0.92;
  font-weight: 850;
  letter-spacing: -2px;
}

.login-brand p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  font-weight: 800;
}

.login-intro h2 {
  margin: 0;
  color: var(--iron);
  font-size: 1.55rem;
}

.login-intro p {
  margin: 8px 0 22px;
  color: var(--muted);
  line-height: 1.45;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-field span {
  display: block;
  margin-bottom: 8px;
  color: var(--iron);
  font-weight: 850;
  font-size: 0.9rem;
}

.login-field input {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: #fbfdff;
  color: var(--text);
  font: inherit;
  outline: none;
}

.login-primary-btn,
.login-google-btn {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 18px;
  padding: 14px 16px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.login-primary-btn {
  color: white;
  background: linear-gradient(135deg, var(--iron), var(--gate));
  box-shadow: 0 14px 28px rgba(3, 40, 106, 0.16);
}

.login-google-btn {
  color: var(--iron);
  background: #edf7ff;
  border: 1px solid rgba(13, 130, 216, 0.16);
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.login-divider::before,
.login-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.login-status {
  min-height: 20px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.login-status.error {
  color: var(--danger);
  font-weight: 800;
}

.login-note {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f5fbff;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

@media (max-width: 560px) {
  .login-page-body {
    padding: 14px;
  }

  .login-card {
    padding: 22px;
    border-radius: 26px;
  }

  .login-logo {
    width: 76px;
    min-width: 76px;
  }
}

/* Pending approval / public sign-up login controls */
.login-secondary-btn {
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(13, 130, 216, 0.2);
  border-radius: 18px;
  padding: 14px 16px;
  color: var(--iron);
  background: #ffffff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.login-secondary-btn:hover,
.login-google-btn:hover {
  background: #f5fbff;
}

.login-pending-box {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid rgba(229, 57, 53, 0.18);
  border-radius: 18px;
  background: #fff8f8;
  color: var(--text);
}

.login-pending-box[hidden] {
  display: none !important;
}

.login-pending-box strong {
  display: block;
  color: var(--danger);
  font-size: 1rem;
  margin-bottom: 6px;
}

.login-pending-box p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.9rem;
}


.camera-btn:disabled,
.login-primary-btn:disabled,
.login-secondary-btn:disabled,
.login-google-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Required-field guidance: required labels stay red with * until completed */
.field.required-missing > span,
.check-field.required-missing > span,
.toggle-field.required-missing > span {
  color: var(--danger) !important;
}

.field.required-missing > span::after,
.check-field.required-missing > span::after,
.toggle-field.required-missing > span::after {
  content: " *";
  color: var(--danger);
  font-weight: 900;
}


/* Phase 1 rebuild: repeatable/special-case cards */
.helper-text {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.fence-card .details-group {
  margin-top: 14px;
}

.fence-card .details-group:first-of-type {
  margin-top: 0;
}

.gate-section-body .fence-sections,
.barrier-check-body .fence-sections,
.safety-check-body .fence-sections {
  margin-top: 12px;
}


/* Phase 2: rule-bank compliance highlighting */
.field.compliance-pass,
.check-field.compliance-pass,
.toggle-field.compliance-pass {
  border-color: rgba(19, 115, 51, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(19, 115, 51, 0.08);
}
.field.compliance-fail,
.check-field.compliance-fail,
.toggle-field.compliance-fail {
  border-color: rgba(229, 57, 53, 0.72) !important;
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.09);
  background: linear-gradient(180deg, #ffffff 0%, #fff8f8 100%);
}
.field.compliance-na,
.check-field.compliance-na,
.toggle-field.compliance-na {
  border-color: rgba(92, 99, 115, 0.28) !important;
  opacity: 0.88;
}
.field.required-missing,
.check-field.required-missing,
.toggle-field.required-missing {
  border-color: rgba(245, 158, 11, 0.75) !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.11);
}
.findings-panel {
  margin-top: 22px;
  padding: 22px;
  border: 1px solid rgba(229, 57, 53, 0.18);
  border-radius: 28px;
  background: linear-gradient(180deg, #ffffff 0%, #fffafa 100%);
  box-shadow: 0 14px 34px rgba(3, 40, 106, 0.06);
}
.findings-empty {
  margin: 0;
  padding: 14px 16px;
  color: var(--muted);
  background: #f8fcff;
  border: 1px dashed rgba(3, 40, 106, 0.14);
  border-radius: 18px;
  font-size: 0.9rem;
}
.findings-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.finding-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(229, 57, 53, 0.18);
  border-radius: 20px;
  background: #ffffff;
}
.finding-number {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--danger);
  font-weight: 900;
}
.finding-content h3 {
  margin: 0 0 8px;
  color: var(--iron);
  font-size: 1rem;
}
.finding-content p {
  margin: 7px 0;
  color: var(--text);
  line-height: 1.45;
  font-size: 0.9rem;
}
.finding-source {
  color: var(--muted) !important;
  font-size: 0.82rem !important;
}
body.download-mode .findings-panel {
  break-inside: avoid;
  page-break-inside: avoid;
}


/* Summary tab */
.summary-dashboard {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.summary-overview-card {
  padding: 18px;
  border: 1px solid rgba(13, 130, 216, 0.14);
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fcff 100%);
  box-shadow: 0 10px 24px rgba(3, 40, 106, 0.05);
}
.summary-overview-card h3 {
  margin: 0 0 14px;
  color: var(--iron);
  font-size: 1.05rem;
  font-weight: 900;
}
.summary-outcome-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--muted);
  font-weight: 800;
}
.summary-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--gate);
  background: #edf7ff;
  font-size: 0.84rem;
}
.summary-status-pill.ready {
  color: #137333;
  background: #eaf7ee;
}
.summary-status-pill.in-progress,
.summary-status-pill.not-started {
  color: var(--gate);
  background: #edf7ff;
}
.summary-status-pill.needs-attention {
  color: var(--danger);
  background: #fff3f3;
}
.summary-details-grid {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.summary-details-grid div {
  padding: 12px;
  border: 1px solid rgba(13, 130, 216, 0.10);
  border-radius: 16px;
  background: #ffffff;
}
.summary-details-grid dt {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.summary-details-grid dd {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 750;
  line-height: 1.35;
  white-space: pre-wrap;
}
.summary-completion-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.summary-completion-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(13, 130, 216, 0.12);
  background: #ffffff;
  font-weight: 850;
}
.summary-completion-row.complete strong {
  color: #137333;
}
.summary-completion-row.incomplete strong {
  color: #f59e0b;
}
.summary-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.summary-stat {
  padding: 16px;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid rgba(13, 130, 216, 0.12);
  text-align: center;
}
.summary-stat span {
  display: block;
  color: var(--iron);
  font-size: 1.6rem;
  font-weight: 950;
}
.summary-stat small {
  color: var(--muted);
  font-weight: 850;
}
.summary-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}
.summary-final-notes {
  margin-top: 20px;
}
.summary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}
.summary-actions .saved-inspection-btn {
  width: 100%;
  padding: 14px 16px;
  font-size: 0.9rem;
}
@media (max-width: 520px) {
  .summary-details-grid,
  .summary-stat-grid,
  .summary-actions {
    grid-template-columns: 1fr;
  }
}
body.download-mode .summary-actions {
  display: none !important;
}


/* --------------------------------------------------------------------------
   Bottom navigation redesign for iPhone portrait workflow
   Home and Summary are no longer crowded into the section nav.
   Inspection sections use a fixed 5-item nav; Summary is a primary action.
---------------------------------------------------------------------------- */

body.on-home .home-pill,
body.on-home .inspection-bottom-nav,
body.on-home .review-summary-btn,
body.auth-checking .home-pill,
body.auth-checking .inspection-bottom-nav,
body.auth-checking .review-summary-btn,
body.firebase-signed-out .home-pill,
body.firebase-signed-out .inspection-bottom-nav,
body.firebase-signed-out .review-summary-btn {
  display: none !important;
}

body.on-summary .review-summary-btn {
  display: none !important;
}

body.inspection-active .content {
  padding-bottom: calc(190px + env(safe-area-inset-bottom));
}

.home-pill {
  position: absolute;
  left: 16px;
  top: calc(14px + env(safe-area-inset-top));
  z-index: 20;
  min-height: 44px;
  border: 1px solid rgba(13, 130, 216, 0.18);
  border-radius: 18px;
  padding: 9px 13px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--iron);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 850;
  box-shadow: 0 8px 20px rgba(3, 40, 106, 0.08);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.home-pill img {
  width: 23px;
  height: 23px;
  object-fit: contain;
}

.inspection-bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 24px), 680px);
  z-index: 1000;
  margin: 0;
  padding: 8px 8px 10px;
  border: 1px solid rgba(13, 130, 216, 0.12);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 14px 34px rgba(3, 40, 106, 0.18);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  overflow: visible;
}

.inspection-bottom-nav .tab {
  min-width: 0;
  min-height: 68px;
  padding: 6px 2px 8px;
  gap: 5px;
  font-size: 0.72rem;
}

.inspection-bottom-nav .tab img {
  width: 27px;
  height: 27px;
}

.inspection-bottom-nav .tab.active::after {
  left: 24%;
  right: 24%;
  bottom: 0;
  height: 4px;
}

.review-summary-btn {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 40px), 640px);
  z-index: 999;
  border: 0;
  border-radius: 18px;
  padding: 16px 18px;
  color: white;
  background:
    radial-gradient(circle at 100% 0%, rgba(29, 184, 245, 0.32), transparent 42%),
    linear-gradient(135deg, var(--gate), var(--iron));
  box-shadow: 0 16px 34px rgba(3, 40, 106, 0.24);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.review-summary-btn img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.review-summary-btn strong {
  font-size: 1.8rem;
  line-height: 1;
}

body.download-mode .home-pill,
body.download-mode .inspection-bottom-nav,
body.download-mode .review-summary-btn {
  display: none !important;
}

@media (max-width: 560px) {
  .hero {
    padding-top: calc(72px + env(safe-area-inset-top));
  }

  .brand {
    justify-content: center;
    text-align: center;
  }

  .main-logo {
    width: 96px;
    min-width: 96px;
  }

  .brand-text h1 {
    font-size: 2.15rem;
  }

  .brand-text p {
    font-size: 0.66rem;
    letter-spacing: 1.3px;
  }

  .inspection-bottom-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    overflow: visible !important;
  }

  .inspection-bottom-nav .tab {
    font-size: 0.7rem;
  }

  .inspection-bottom-nav .tab img {
    width: 26px;
    height: 26px;
  }

  .review-summary-btn {
    width: min(calc(100% - 32px), 640px);
    padding: 15px 16px;
    font-size: 0.9rem;
  }
}

/* --------------------------------------------------------------------------
   Settings, mandatory inspector profile, and custom delete sheet
---------------------------------------------------------------------------- */

.settings-pill {
  position: absolute;
  right: 16px;
  top: calc(14px + env(safe-area-inset-top));
  z-index: 20;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(13, 130, 216, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--iron);
  display: grid;
  place-items: center;
  font: inherit;
  font-size: 1.28rem;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(3, 40, 106, 0.08);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

body.auth-checking .settings-pill,
body.firebase-signed-out .settings-pill,
body.download-mode .settings-pill {
  display: none !important;
}

.modal-overlay,
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(3, 40, 106, 0.36);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-overlay[hidden],
.bottom-sheet-overlay[hidden] {
  display: none !important;
}

.settings-overlay {
  display: grid;
  place-items: center;
  padding: 18px;
}

.settings-card {
  position: relative;
  width: min(100%, 460px);
  max-height: min(88vh, 780px);
  overflow: auto;
  border: 1px solid rgba(13, 130, 216, 0.16);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 28px 70px rgba(3, 40, 106, 0.28);
  padding: 22px;
}

.overlay-close {
  position: absolute;
  right: 16px;
  top: 16px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  color: var(--iron);
  background: #edf7ff;
  font: inherit;
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}

body.profile-required .overlay-close,
body.profile-required #profileBackBtn {
  display: none !important;
}

.settings-header,
.profile-avatar-preview-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  padding-right: 44px;
}

.settings-header h2,
.profile-form-head h2,
.delete-sheet h2 {
  margin: 0;
  color: var(--iron);
  font-size: 1.35rem;
  letter-spacing: -0.5px;
}

.settings-header p,
.profile-form-head p,
.profile-avatar-preview-row small,
.settings-option small,
.settings-cloud-card p,
.settings-cloud-card span,
.delete-sheet p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.settings-avatar,
.avatar-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--iron), var(--gate));
  color: white;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  font-weight: 950;
  box-shadow: 0 12px 24px rgba(3, 40, 106, 0.16);
}

.settings-avatar.large {
  width: 66px;
  height: 66px;
  border-radius: 24px;
  font-size: 1.05rem;
}

.settings-avatar img,
.avatar-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.settings-main-panel,
.profile-form-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.settings-main-panel[hidden],
.profile-form-panel[hidden] {
  display: none !important;
}

.settings-option {
  width: 100%;
  border: 1px solid rgba(13, 130, 216, 0.14);
  border-radius: 22px;
  padding: 16px;
  background: #f7fbff;
  color: var(--text);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.settings-option-icon {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  background: #e9f6ff;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}

.settings-option strong,
.settings-cloud-card strong,
.profile-avatar-preview-row strong {
  color: var(--iron);
  display: block;
  font-size: 1rem;
  font-weight: 900;
}

.settings-option b {
  color: var(--gate);
  font-size: 1.7rem;
  line-height: 1;
}

.settings-cloud-card {
  border: 1px solid rgba(13, 130, 216, 0.14);
  border-radius: 22px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.88);
}

.settings-signout-btn {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(229, 57, 53, 0.2);
  border-radius: 999px;
  color: var(--danger);
  background: var(--danger-soft);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.profile-form-head {
  display: grid;
  gap: 10px;
  padding-right: 44px;
}

.profile-back-btn {
  justify-self: start;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--gate);
  background: #edf7ff;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 900;
  cursor: pointer;
}

.avatar-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.avatar-choice {
  border: 1px solid rgba(13, 130, 216, 0.14);
  border-radius: 18px;
  padding: 10px 8px;
  background: #fbfdff;
  color: var(--muted);
  display: grid;
  place-items: center;
  gap: 7px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 850;
  cursor: pointer;
}

.avatar-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.avatar-choice.selected {
  border-color: rgba(13, 130, 216, 0.55);
  background: #edf7ff;
  color: var(--iron);
  box-shadow: 0 8px 18px rgba(3, 40, 106, 0.1);
}

.avatar-choice[hidden] {
  display: none !important;
}

.avatar-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  font-size: 0.76rem;
  box-shadow: none;
}

.avatar-two { background: linear-gradient(135deg, #0d82d8, #1db8f5); }
.avatar-three { background: linear-gradient(135deg, #17304f, #5c6373); }
.avatar-four { background: linear-gradient(135deg, #137333, #0d82d8); }

.profile-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.profile-form-grid .full {
  grid-column: 1 / -1;
}

.profile-status {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.profile-status.error {
  color: var(--danger);
}

.profile-actions {
  display: grid;
  gap: 10px;
}

body.profile-required .settings-overlay {
  display: grid;
}

body.profile-required .settings-card {
  border-color: rgba(13, 130, 216, 0.28);
}

.bottom-sheet-overlay {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

.delete-sheet {
  width: min(100%, 520px);
  border-radius: 30px 30px 24px 24px;
  background: white;
  padding: 12px 20px 20px;
  box-shadow: 0 -18px 60px rgba(3, 40, 106, 0.24);
}

.sheet-handle {
  width: 48px;
  height: 5px;
  border-radius: 999px;
  background: #d8e5f2;
  margin: 0 auto 16px;
}

.delete-sheet-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.sheet-secondary-btn,
.sheet-danger-btn {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.sheet-secondary-btn {
  color: var(--gate);
  background: #edf7ff;
}

.sheet-danger-btn {
  color: white;
  background: linear-gradient(135deg, #b42318, var(--danger));
}

@media (max-width: 560px) {
  .settings-pill {
    right: 14px;
  }

  .settings-card {
    max-height: 90vh;
    border-radius: 26px;
    padding: 20px;
  }

  .profile-form-grid {
    grid-template-columns: 1fr;
  }

  .avatar-choice-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}


.login-field textarea {
  width: 100%;
  border: 1px solid rgba(13, 130, 216, 0.18);
  border-radius: 16px;
  padding: 12px 14px;
  background: #f8fcff;
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.login-field textarea:focus {
  outline: 2px solid rgba(13, 130, 216, 0.22);
  border-color: var(--gate);
}

.brand-mark.main-logo,
.brand-mark.login-logo {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
}

.brand-mark.main-logo {
  font-size: clamp(2rem, 8vw, 3rem);
}

.brand-mark.login-logo {
  font-size: 2rem;
}


/* Compliance/account safety build additions */
.legal-check-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.legal-check-row.optional {
  margin-top: -2px;
}

.legal-check-row input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--gate);
}

.legal-check-row a,
.legal-link-row a,
.settings-legal-links a {
  color: var(--gate);
  font-weight: 850;
  text-decoration: none;
}

.legal-check-row a:hover,
.legal-link-row a:hover,
.settings-legal-links a:hover {
  text-decoration: underline;
}

.legal-link-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 14px;
  margin-top: 16px;
  font-size: 0.82rem;
}

.settings-legal-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin-top: 10px;
  font-size: 0.86rem;
}

.subscription-card,
.legal-card,
.danger-zone-card {
  display: grid;
  gap: 8px;
}

.settings-secondary-btn,
.settings-danger-btn {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.settings-secondary-btn {
  color: var(--gate);
  background: #edf7ff;
}

.settings-secondary-btn:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.danger-zone-card {
  border-color: rgba(229, 57, 53, 0.22);
  background: #fffafa;
}

.settings-danger-btn {
  color: white;
  background: linear-gradient(135deg, #b42318, var(--danger));
}

.delete-confirm-field {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: var(--iron);
  font-size: 0.84rem;
  font-weight: 900;
}

.delete-confirm-field input {
  width: 100%;
  border: 1px solid rgba(229, 57, 53, 0.26);
  border-radius: 16px;
  padding: 12px 14px;
  background: #fffafa;
  color: var(--text);
  font: inherit;
  font-weight: 850;
}

.delete-confirm-field input:focus {
  outline: 2px solid rgba(229, 57, 53, 0.18);
  border-color: var(--danger);
}

.account-delete-sheet .profile-status {
  margin-top: 10px;
}

@media (max-width: 560px) {
  .settings-legal-links {
    grid-template-columns: 1fr;
  }
}


/* Phase 3: billing gate and admin console */
.billing-gate-card {
  border: 1px solid rgba(229, 57, 53, 0.18);
  border-radius: 22px;
  padding: 16px;
  background: #fff7f7;
  color: var(--text);
  box-shadow: 0 10px 24px rgba(229, 57, 53, 0.08);
}

.billing-gate-card strong {
  display: block;
  color: var(--danger);
  font-size: 1rem;
  font-weight: 900;
}

.billing-gate-card p {
  margin: 6px 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.billing-gate-card a,
.admin-page a {
  color: var(--gate);
  font-weight: 850;
}

.admin-console-link {
  text-decoration: none;
}

.admin-page-body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: linear-gradient(180deg, #eaf5fc 0%, #f8fbff 100%);
  color: var(--text);
}

.admin-shell {
  width: min(1040px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-brand h1 {
  margin: 0;
  color: var(--iron);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1;
}

.admin-brand p,
.admin-muted {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.admin-card {
  background: white;
  border: 1px solid rgba(13, 130, 216, 0.16);
  border-radius: 26px;
  box-shadow: 0 14px 34px rgba(3, 40, 106, 0.10);
  padding: 20px;
  margin: 16px 0;
}

.admin-card h2 {
  margin: 0 0 8px;
  color: var(--iron);
  font-size: 1.25rem;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.admin-primary-btn,
.admin-secondary-btn,
.admin-danger-btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 900;
  cursor: pointer;
}

.admin-primary-btn {
  color: white;
  background: linear-gradient(135deg, var(--iron), var(--gate));
}

.admin-secondary-btn {
  color: var(--gate);
  background: #edf7ff;
}

.admin-danger-btn {
  color: var(--danger);
  background: #fff3f3;
}

.admin-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.admin-status.error {
  color: var(--danger);
  font-weight: 850;
}

.pending-user-list {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.pending-user-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  background: #fbfdff;
}

.pending-user-card h3 {
  margin: 0;
  color: var(--iron);
  font-size: 1.05rem;
}

.pending-user-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.pending-user-grid strong {
  color: var(--text);
}

.admin-empty {
  margin: 12px 0 0;
  padding: 14px;
  border: 1px dashed rgba(3, 40, 106, 0.18);
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.66);
}

.admin-note {
  padding: 12px 14px;
  border-radius: 16px;
  background: #edf7ff;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
}

.admin-note code {
  font-size: 0.86rem;
}

@media (max-width: 720px) {
  .admin-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .pending-user-grid {
    grid-template-columns: 1fr;
  }
}
