.kaspi-auth-dialog {
  width: min(1180px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  overflow: hidden;
}

.kaspi-auth-shell {
  display: grid;
  max-height: calc(100dvh - 32px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid #c9d1dc;
  border-radius: 6px;
  background: #fff;
}

.kaspi-auth-header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.kaspi-auth-header h2,
.kaspi-auth-header .eyebrow {
  margin: 0;
}

.kaspi-auth-header h2 {
  margin-top: 2px;
  font-size: 17px;
}

.kaspi-auth-content {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(220px, 1fr) auto auto;
  gap: 10px;
  overflow: auto;
  overflow-x: hidden;
  padding: 12px 16px;
}

.kaspi-auth-status {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid #cdd8e6;
  border-radius: 5px;
  background: #f5f8fc;
  color: #2b3d55;
}

.kaspi-auth-status > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.kaspi-auth-status strong {
  font-size: 13px;
}

.kaspi-auth-status span {
  font-size: 12px;
}

.kaspi-auth-status.tone-authenticated {
  border-color: #a7d6bb;
  background: #eef9f2;
  color: #1d6b3e;
}

.kaspi-auth-status.tone-expired,
.kaspi-auth-status.tone-error {
  border-color: #e1b8b8;
  background: #fff2f2;
  color: #8c2e2e;
}

.kaspi-browser-viewport {
  display: flex;
  min-width: 0;
  min-height: 220px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid #aeb9c7;
  border-radius: 5px;
  background: #edf1f5;
  cursor: default;
  outline: none;
}

.kaspi-browser-viewport:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(39 104 176 / 18%);
}

.kaspi-browser-viewport img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100dvh - 250px);
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.kaspi-browser-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.kaspi-browser-frame[hidden],
.kaspi-browser-placeholder[hidden] {
  display: none;
}

.kaspi-auth-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.kaspi-auth-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}

@media (max-width: 760px) {
  .kaspi-auth-dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    margin: 0;
  }

  .kaspi-auth-shell {
    width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
  }

  .kaspi-auth-content {
    padding: 10px;
  }

  .kaspi-browser-viewport {
    min-height: 180px;
  }

  .kaspi-browser-viewport img {
    max-width: 100%;
    max-height: calc(100dvh - 275px);
  }

  .kaspi-auth-actions {
    padding: 10px;
  }
}