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

.page-shell {
  max-width: 720px;
  margin: 0 auto;
}

.container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin: 1rem auto 2rem;
  max-width: 700px;
  width: min(700px, 100%);
}

.logo-wrap {
  text-align: center;
  margin-bottom: 1rem;
}

.logo-img {
  width: 50%;
  min-width: 240px;
  max-width: 100%;
  height: auto;
  display: inline-block;
  border-radius: var(--radius);
  box-shadow: 0 10px 30px -18px rgba(15, 23, 42, 0.4);
  background: var(--surface-strong);
  padding: 0.35rem;
}

h1 {
  margin: 0 0 1.5rem;
  text-align: center;
  color: var(--brand);
  font-size: 1.85rem;
  letter-spacing: -0.01em;
}

.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.95rem;
}

input, select, textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--surface-strong);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

input::placeholder, textarea::placeholder {
  color: var(--muted);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-focus);
}

.btn, .btn--icon {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 10px 25px -18px var(--brand);
}

.btn {
  display: block;
  width: 100%;
  padding: 0.85rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.btn--icon {
  padding: 0 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:hover, .btn--icon:hover { background: var(--brand-hover); }
.btn:active, .btn--icon:active { transform: translateY(1px); }
.btn-ghost {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--border);
  box-shadow: none;
}
.btn-ghost:hover {
  background: var(--brand-tint);
  color: var(--brand-hover);
}
.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--brand);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  box-shadow: none;
  transition: background 0.2s, color 0.2s, transform 0.1s, border-color 0.2s;
}
.nav-link:hover {
  background: var(--brand-tint);
  color: var(--brand-hover);
  border-color: var(--brand);
}
.nav-link:active { transform: translateY(1px); }

.error-message, .heic-warning, .file-info, #formError {
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.error-message { color: var(--error); }
.heic-warning { color: var(--error); }
.file-info { color: var(--muted); white-space: nowrap; }
.success-message { color: var(--success); font-size: 1rem; text-align: center; margin-bottom: 1rem; }

#customerPreview {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
  font-size: 1rem;
}

.upload-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.toggle-group {
  display: flex;
  gap: 0.5rem;
}

.toggle-btn {
  flex: 1;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.toggle-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-focus);
  border-color: var(--brand);
}

.toggle-btn.is-active { color: #fff; }
.toggle-btn--yes.is-active { background: var(--success); border-color: var(--success); }
.toggle-btn--no.is-active { background: var(--error); border-color: var(--error); }

.upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.upload-btn.secondary {
  background: var(--surface-strong);
  color: var(--text);
  border: 1px solid var(--border);
}

.upload-btn:hover { background: var(--brand-hover); }
.upload-btn.secondary:hover { background: rgba(0, 0, 0, 0.04); }
.upload-btn:active { transform: translateY(1px); }

.photo-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.75rem;
}

.photo-empty {
  white-space: nowrap;
}

.photo-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

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

.remove-photo {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  border: none;
  border-radius: 999px;
  width: 1.5rem;
  height: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
}

.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

.loading-card {
  background: var(--surface);
  padding: 2rem;
  border-radius: var(--radius);
  text-align: center;
  max-width: 90%;
  width: 300px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid var(--brand-spinner);
  border-radius: 50%;
  border-top-color: var(--brand);
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 1rem;
}

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

.loading-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  transition: background-color 0.3s ease;
}

.modal.show {
  display: flex;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background: var(--surface);
  padding: 2rem;
  border-radius: var(--radius);
  max-width: 90%;
  width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transform: translateY(10px);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.modal.show .modal-content {
  transform: translateY(0);
  opacity: 1;
}

.modal-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.75rem;
}

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

.modal-footer {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.75rem;
}

.modal-footer .btn {
  flex: 1;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--muted);
}

.result-modal .modal-content {
  text-align: center;
}

.preview-block {
  background: var(--surface-strong);
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.95rem;
  border: 1px solid var(--border);
}

.helper {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.required {
  color: var(--error);
  margin-left: 0.2rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
  border: 1px solid var(--border);
}

.badge.success {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}

.badge.warn {
  background: rgba(249, 115, 22, 0.12);
  color: #c2410c;
}

.helper-panel {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--surface-strong);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.helper-panel h3 {
  margin: 0 0 0.9rem;
  color: var(--text);
  font-size: 1.05rem;
}

.helper-panel ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.6;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 18px -12px rgba(15, 23, 42, 0.35);
  padding: 0.25rem 0.85rem calc(0.35rem + env(safe-area-inset-bottom));
  z-index: 1200;
}

.bottom-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
}

.bottom-nav__link {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.55rem 0.45rem;
  border-radius: 0.9rem;
  text-decoration: none;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.1;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease, transform 0.1s ease;
}

.bottom-nav__link:hover { color: var(--brand); }

.bottom-nav__link:active { transform: translateY(1px); }

.bottom-nav__link.active {
  background: var(--brand-nav-active);
  color: var(--brand);
}

.bottom-nav__icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}

.bottom-nav__icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

@media (min-width: 768px) {
  .bottom-nav {
    display: none !important;
  }
}
