body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

a,
button,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

.app-background {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at top left, rgb(224 231 255 / 0.85), transparent 34%),
    radial-gradient(circle at bottom right, rgb(243 244 246 / 0.9), transparent 30%),
    linear-gradient(135deg, rgb(238 242 255) 0%, rgb(255 255 255) 42%, rgb(249 250 251) 100%);
  z-index: 0;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fadeIn {
  animation: fadeIn 0.6s ease-out forwards;
  opacity: 0;
}

.page {
  width: 100%;
  max-width: 24rem;
}

.page-wide {
  max-width: 32rem;
}

.page-scenarios {
  max-width: 42rem;
}

.field {
  width: 100%;
  border-radius: 0.75rem;
  border: 1px solid rgb(209 213 219);
  background: rgb(255 255 255 / 0.92);
  padding: 0.75rem 0.95rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: rgb(17 24 39);
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.06);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.field::placeholder {
  color: rgb(156 163 175);
}

.field:focus {
  border-color: rgb(156 163 175);
  box-shadow: 0 0 0 3px rgb(229 231 235 / 0.9);
  background: white;
}

.field-with-icon {
  padding-left: 2.7rem;
}

.field-icon {
  position: absolute;
  inset: 0 auto 0 0.95rem;
  display: inline-flex;
  align-items: center;
  color: rgb(156 163 175);
}

.primary-button,
.secondary-button,
.cta-button {
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.75rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.primary-button:hover,
.secondary-button:hover,
.cta-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: rgb(17 24 39);
  color: white;
  box-shadow: 0 10px 30px rgb(17 24 39 / 0.14);
}

.primary-button:hover {
  background: rgb(31 41 55);
}

.secondary-button,
.cta-button-secondary {
  border: 1px solid rgb(209 213 219);
  background: rgb(255 255 255 / 0.9);
  color: rgb(31 41 55);
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.06);
}

.secondary-button:hover,
.cta-button-secondary:hover {
  background: rgb(249 250 251);
}

.cta-button {
  width: 100%;
  max-width: 14rem;
  padding-inline: 1.75rem;
}

.cta-button-muted {
  background: rgb(229 231 235);
  color: rgb(17 24 39);
  box-shadow: 0 8px 20px rgb(148 163 184 / 0.12);
}

.cta-button-muted:hover {
  background: rgb(243 244 246);
}

.primary-button-inline,
.secondary-button-inline {
  width: auto;
}

.link-button,
.inline-link {
  color: rgb(17 24 39);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 0.25rem;
  text-decoration-color: rgb(209 213 219);
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.link-button:hover,
.inline-link:hover {
  color: rgb(55 65 81);
  text-decoration-color: rgb(107 114 128);
}

.link-button {
  border: 0;
  background: transparent;
  padding: 0;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  color: rgb(75 85 99);
  font-size: 0.875rem;
  line-height: 1.45;
}

.checkbox-row input {
  margin-top: 0.2rem;
  height: 1rem;
  width: 1rem;
  accent-color: rgb(17 24 39);
  flex: 0 0 auto;
}

.upload-card {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 1rem;
  border: 1px solid rgb(229 231 235);
  border-radius: 1rem;
  background: rgb(255 255 255 / 0.95);
  padding: 1rem;
  text-align: left;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.06);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
  cursor: pointer;
}

.upload-card:hover,
.upload-card:focus-within {
  border-color: rgb(209 213 219);
  box-shadow: 0 10px 25px rgb(15 23 42 / 0.08);
  transform: translateY(-1px);
}

.upload-card-icon {
  display: inline-flex;
  height: 2.5rem;
  width: 2.5rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  background: rgb(249 250 251);
  color: rgb(55 65 81);
  font-size: 1.25rem;
}

.upload-card-title {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgb(17 24 39);
}

.upload-card-subtitle {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.75rem;
  color: rgb(107 114 128);
}

.upload-card-arrow {
  flex: 0 0 auto;
  color: rgb(156 163 175);
  font-size: 1.125rem;
}

.panel {
  border: 1px solid rgb(229 231 235 / 0.95);
  border-radius: 1.5rem;
  background: rgb(255 255 255 / 0.9);
  padding: 1.5rem;
  text-align: left;
  box-shadow: 0 16px 40px rgb(15 23 42 / 0.08);
  backdrop-filter: blur(14px);
}

.panel-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgb(243 244 246);
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: rgb(75 85 99);
}

.result-copy {
  margin-top: 1.25rem;
  white-space: pre-wrap;
  font-size: 0.875rem;
  line-height: 1.7;
  color: rgb(75 85 99);
}

.admin-import-log {
  max-height: min(70vh, 32rem);
  overflow: auto;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: rgb(249 250 251);
  border: 1px solid rgb(229 231 235);
}

/* Полноэкранная камера */
body.camera-fs-open {
  overflow: hidden;
}

.camera-fs {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgb(0 0 0);
  display: flex;
  flex-direction: column;
  /* iOS Safari: стабильная высота под адресную строку и «чёлку» */
  min-height: 100vh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
}

.camera-fs.hidden {
  display: none;
}

.camera-fs__video {
  flex: 1;
  width: 100%;
  min-height: 0;
  object-fit: cover;
  transform: scaleX(-1);
}

.camera-fs__vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(ellipse 72% 58% at 50% 42%, transparent 25%, rgb(0 0 0 / 0.5) 100%);
}

.camera-fs__oval {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  box-shadow: inset 0 0 0 9999px rgb(0 0 0 / 0.18);
  background: radial-gradient(
    ellipse 58% 50% at 50% 40%,
    transparent 0%,
    transparent 96%,
    rgb(0 0 0 / 0.52) 100%
  );
  border: 3px solid rgb(255 255 255 / 0.3);
}

.camera-fs__hint-layer {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 4;
  padding: max(0.75rem, env(safe-area-inset-top)) 1rem 0.5rem;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.camera-fs__hint {
  max-width: min(100%, 36rem);
  margin: 0;
  text-align: center;
  font-size: clamp(1.1rem, 4.2vw, 1.65rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  text-shadow:
    0 0 1px rgb(0 0 0),
    0 2px 16px rgb(0 0 0 / 0.95),
    0 0 40px rgb(0 0 0 / 0.8);
  padding: 0.5rem 0.75rem;
}

.camera-fs__hint--neutral {
  color: rgb(243 244 246);
}

.camera-fs__hint--green {
  color: rgb(167 243 208);
}

.camera-fs__hint--yellow {
  color: rgb(253 224 71);
}

.camera-fs__hint--red {
  color: rgb(252 165 165);
}

.camera-fs__actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: 1rem max(1rem, env(safe-area-inset-right)) max(1.25rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
  background: linear-gradient(to top, rgb(0 0 0 / 0.88) 0%, rgb(0 0 0 / 0.4) 55%, transparent 100%);
}

.camera-fs__btn {
  min-width: 9rem;
  border-radius: 999px;
  padding: 0.9rem 1.35rem;
  font-size: 1.05rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.12s ease;
  touch-action: manipulation;
}

.camera-fs__btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.camera-fs__btn--ghost {
  background: rgb(255 255 255 / 0.14);
  color: rgb(255 255 255);
}

.camera-fs__btn--primary {
  background: rgb(34 197 94);
  color: rgb(17 24 39);
}

.camera-fs__btn--primary:not(:disabled):active {
  transform: scale(0.98);
}

@media (max-width: 640px) {
  .panel {
    padding: 1.15rem;
  }
}
