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

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

body {
  font-family: Arial, sans-serif;
  margin: 16px auto;
  padding: 0;
  max-width: min(900px, 100%);
  width: 100%;
  line-height: 1.45;
  overflow-x: hidden;
}

h1 {
  margin-bottom: 8px;
}

label {
  display: block;
  margin: 8px 0 4px;
}

input,
select,
textarea,
button {
  padding: 12px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 8px;
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.35;
}

button {
  margin-top: 12px;
  cursor: pointer;
  min-height: 44px;
  background: #0b5fff;
  color: #fff;
  border: none;
  font-weight: 600;
}

.card {
  border: 1px solid #ddd;
  padding: 16px;
  margin-bottom: 16px;
  border-radius: 8px;
}

pre {
  background: #f6f8fa;
  padding: 12px;
  overflow: auto;
}

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

.page-subtitle {
  margin: 0 0 16px;
  color: #4b5563;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 16px;
}

.step {
  border: 1px solid #dbe4ff;
  background: #f8faff;
  color: #274690;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  text-align: center;
}

.step.active {
  background: #0b5fff;
  color: #fff;
  border-color: #0b5fff;
}

.step.done {
  background: #eaf9f0;
  border-color: #9dd9b8;
  color: #0f5132;
}

.muted {
  color: #6b7280;
  font-size: 13px;
}

.inline-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  cursor: pointer;
  min-height: auto;
  width: auto;
  color: #1f2937;
}

.pill.active {
  background: #e8f0ff;
  border-color: #0b5fff;
  color: #0b5fff;
}

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

.btn-secondary {
  background: #eef2f7;
  color: #1f2937;
}

.hint {
  background: #f8faff;
  border: 1px solid #dbe4ff;
  border-radius: 8px;
  padding: 10px;
}

.price-box {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
}

.price-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.price-row.total {
  font-weight: 700;
  border-top: 1px dashed #cbd5e1;
  padding-top: 8px;
  margin-top: 8px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.photo-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  overflow: hidden;
}

.photo-item img {
  width: 100%;
  height: 74px;
  object-fit: cover;
}

.screen {
  animation: fadeSlide 240ms ease;
}

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

.qr-wrap {
  margin-top: 10px;
  display: flex;
  justify-content: center;
}

.qr-wrap img {
  width: min(220px, 92vw);
  height: auto;
  max-width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid #dbe4ff;
  background: #fff;
  padding: 8px;
}

@media (max-width: 768px) {
  body {
    margin: 12px;
    padding-left: max(0px, env(safe-area-inset-left, 0px));
    padding-right: max(0px, env(safe-area-inset-right, 0px));
    padding-bottom: max(0px, env(safe-area-inset-bottom, 0px));
  }

  h1 {
    font-size: 1.35rem;
    line-height: 1.25;
    word-wrap: break-word;
  }

  .card {
    padding: 12px;
    border-radius: 10px;
  }

  .row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .stepper {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .actions button,
  .actions .btn-secondary {
    width: 100%;
    margin-top: 8px;
  }

  .actions button:first-child {
    margin-top: 0;
  }

  .inline-options {
    flex-direction: column;
    align-items: stretch;
  }

  .pill {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  body {
    margin: 10px;
  }

  .stepper {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .step {
    font-size: 12px;
    padding: 10px 8px;
  }

  .photo-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .page-subtitle {
    font-size: 0.95rem;
  }
}

/* --- Mobile-safe layout (all Parking web pages) --- */
body.page-portal,
body.page-fullbleed,
body.org-reg {
  margin: 0 !important;
  max-width: none !important;
  width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

body.page-portal,
body.page-fullbleed {
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

body.page-fullbleed .page-shell {
  max-width: min(900px, 100%);
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
    max(24px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  box-sizing: border-box;
}

@media (max-width: 639px) {
  body.page-portal .shell {
    padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px))
      max(20px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  }

  body.page-fullbleed .page-shell {
    padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px))
      max(20px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  }

  body:not(.page-portal):not(.org-reg):not(.page-fullbleed) {
    margin: 10px !important;
    max-width: none !important;
    width: 100%;
    padding-left: max(0px, env(safe-area-inset-left, 0px));
    padding-right: max(0px, env(safe-area-inset-right, 0px));
    padding-bottom: max(0px, env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
  }
}
