.atlas-login {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background: linear-gradient(145deg, #172b59, #24418c 58%, #4974c8);
}

.atlas-login[hidden] {
  display: none;
}

.atlas-login-card {
  width: min(100%, 380px);
  padding: 28px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.atlas-login-mark {
  margin-bottom: 18px;
  color: #24418c;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.atlas-login-card h1 {
  margin: 0 0 8px;
  color: #213653;
  font-size: 24px;
}

.atlas-login-card p {
  margin: 0 0 20px;
  color: #607086;
}

.atlas-login-card label {
  display: block;
  margin-bottom: 6px;
  color: #33445c;
  font-size: 13px;
  font-weight: 700;
}

.atlas-login-card input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #b9c3d0;
  border-radius: 8px;
  font-size: 16px;
}

.atlas-login-card input:focus {
  outline: 3px solid rgba(36, 65, 140, 0.2);
  border-color: #24418c;
}

.atlas-login-card button {
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  border: 0;
  border-radius: 8px;
  background: #24418c;
  color: #fff;
  font-weight: 700;
  touch-action: manipulation;
}

.atlas-login-error {
  min-height: 20px;
  margin-top: 10px;
  color: #a12323;
  font-size: 13px;
}

.atlas-launcher {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: #24418c;
  color: #fff;
  font-weight: 600;
  min-height: 48px;
  touch-action: manipulation;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);
}

.atlas-panel {
  position: fixed;
  right: 16px;
  bottom: 72px;
  z-index: 20;
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100vh - 100px);
  max-height: calc(100dvh - 100px);
  overflow-y: auto;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.28);
  color: #253650;
}

.atlas-panel[hidden] {
  display: none;
}

.atlas-header,
.atlas-body {
  padding: 14px;
}

.atlas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e6eb;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 1;
}

.atlas-header h2 {
  margin: 0;
  font-size: 18px;
}

.atlas-version {
  display: block;
  margin-top: 2px;
  color: #718096;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.atlas-close {
  border: 0;
  background: transparent;
  color: #526278;
  font-size: 24px;
  line-height: 1;
  width: 44px;
  height: 44px;
  margin: -10px -10px -10px 0;
  touch-action: manipulation;
}

.atlas-label {
  display: block;
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.atlas-model {
  width: 100%;
  margin-bottom: 12px;
  padding: 8px;
  border: 1px solid #cbd3de;
  border-radius: 6px;
  background: #fff;
  min-height: 44px;
  font-size: 16px;
}

.atlas-scope-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid #d6dce5;
  border-radius: 7px;
  background: #f7f9fc;
  font-size: 14px;
  font-weight: 600;
}

.atlas-scope-option input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
}

.atlas-scope-option small {
  display: block;
  margin-top: 3px;
  color: #607086;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
}

.atlas-capture {
  display: block;
  width: 100%;
  margin: 0;
  padding: 11px 14px;
  border-radius: 7px;
  background: #24418c;
  color: #fff;
  text-align: center;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  touch-action: manipulation;
}

.atlas-capture[hidden] {
  display: none;
}

.atlas-capture input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.atlas-follow-up-actions[hidden] {
  display: none;
}

.atlas-follow-up-actions {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.atlas-capture-follow-up {
  background: #16734a;
}

.atlas-secondary-action {
  min-height: 44px;
  border: 1px solid #24418c;
  border-radius: 7px;
  background: #fff;
  color: #24418c;
  font-weight: 600;
  touch-action: manipulation;
}

.atlas-status {
  margin: 12px 0 0;
  padding: 10px;
  border-radius: 7px;
  background: #eef3fb;
  font-size: 14px;
}

.atlas-status[data-state="error"] {
  background: #fff0f0;
  color: #8a2020;
}

.atlas-status[data-state="success"] {
  background: #ecf8ef;
  color: #1f6635;
}

.atlas-preview {
  display: none;
  width: 100%;
  max-height: 180px;
  margin-top: 12px;
  object-fit: contain;
  border-radius: 7px;
  background: #eff1f4;
}

.atlas-preview[src] {
  display: block;
}

.atlas-result {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid #d6dce5;
  border-radius: 7px;
  font-size: 14px;
}

.atlas-result:empty {
  display: none;
}

.atlas-debug {
  margin-top: 12px;
  font-size: 12px;
}

.atlas-debug summary {
  cursor: pointer;
  font-weight: 600;
}

.atlas-debug pre {
  max-height: 220px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 8px;
  background: #f5f6f8;
  white-space: pre-wrap;
}

@media (max-width: 600px) {
  .atlas-launcher {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .atlas-panel {
    right: 8px;
    bottom: calc(66px + env(safe-area-inset-bottom));
    width: calc(100vw - 16px);
    max-height: calc(100vh - 82px);
    max-height: calc(100dvh - 82px - env(safe-area-inset-bottom));
  }

  body.atlas-open .left-panel,
  body.atlas-open .atlas-launcher {
    display: none;
  }

  body.atlas-open .atlas-panel {
    bottom: max(8px, env(safe-area-inset-bottom));
    max-height: calc(100vh - 16px - env(safe-area-inset-bottom));
    max-height: calc(100dvh - 16px - env(safe-area-inset-bottom));
  }

  .atlas-preview {
    max-height: 28vh;
    max-height: 28dvh;
  }
}
