[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #ffffff;
  font-family: 'Segoe UI', Arial, sans-serif;
}

body.modal-open {
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 1;
}

#logo-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  text-align: center;
  background: rgba(255, 255, 255, 0.98);
  z-index: 10;
  border-bottom: 1px solid #ffffff;
  box-sizing: border-box;
  padding-top: calc(env(safe-area-inset-top, 0px) + 4px);
}

#logo-container img {
  max-height: 80px;
  margin: 5px auto;
  display: block;
}

#status {
  position: absolute;
  top: 90px;
  left: 0;
  width: 100%;
  text-align: center;
  padding: 5px 10px;
  background: #f0f0f0;
  font-weight: 700;
  z-index: 10;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#test-badge {
  position: absolute;
  top: 126px;
  right: 12px;
  z-index: 12;
  background: #111111;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

#test-controls {
  position: absolute;
  top: 160px;
  right: 12px;
  z-index: 12;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#test-controls button,
#auth-gate-actions button,
.btn-save {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(17, 17, 17, 0.92);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.btn-save-primary {
  background: #111111;
}

#test-controls button:disabled,
#auth-gate-actions button:disabled,
.btn-save:disabled {
  opacity: 0.45;
}

#auth-gate {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(1px);
  box-sizing: border-box;
}

#auth-gate-card {
  width: min(100%, 420px);
  background: #ffffff;
  border: 1px solid #e7e7e7;
  border-radius: 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  padding: 20px 18px;
  box-sizing: border-box;
}

#auth-gate-title {
  margin: 0 0 10px;
  font-size: 22px;
  line-height: 1.15;
}

#auth-gate-message {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #333333;
}


#auth-gate-reason {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: #666666;
}

#auth-gate-actions {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  z-index: 30;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 31;
  box-sizing: border-box;
}

.modal-card {
  width: min(100%, 460px);
  max-height: min(88vh, 760px);
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal.modal-wide .modal-card {
  width: min(100%, 560px);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid #efefef;
}

.modal-head h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.modal-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: #111111;
  font-size: 28px;
  line-height: 1;
  padding: 0;
}

.modal-body {
  padding: 16px 18px;
  overflow: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px 18px;
  border-top: 1px solid #efefef;
}

.auth-manual-modal,
.qr-scan-modal {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-manual-help,
.qr-scan-help,
.qr-scan-status {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #333333;
}

.auth-manual-modal textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  box-sizing: border-box;
  border: 1px solid #d7d7d7;
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  line-height: 1.45;
}

.qr-scan-frame {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  background: #111111;
}

.qr-scan-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.leaflet-control-attribution {
  font-size: 11px !important;
}


.status-action {
  appearance: none;
  border: 0;
  background: rgba(17,17,17,0.92);
  color: #fff;
  border-radius: 999px;
  padding: 4px 8px;
  margin-left: 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}
