/* Sign-in modal (Phase A). Shown only in SaaS mode when no valid session
   is cached. Visually heavier than the regular modals because it's gating
   access to the whole AI surface. */

.auth-modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 16, 0.78);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}
.auth-modal-bg.hidden {
  display: none;
}

.auth-modal {
  width: min(440px, calc(100vw - 32px));
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  padding: 28px;
}

.auth-modal-hd {
  margin-bottom: 18px;
}

.auth-brand {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.auth-modal h2 {
  font-size: 18px;
  margin: 0 0 6px 0;
  color: var(--text);
}

.auth-modal-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.auth-modal-sub code {
  background: var(--s2);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-form input {
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text);
  outline: none;
}
.auth-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.auth-trust-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--text);
  margin: 2px 0 4px;
  cursor: pointer;
  user-select: none;
}
.auth-trust-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.auth-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
}

.auth-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.auth-actions .btn {
  padding: 10px 20px;
  font-weight: 600;
}

.auth-footer {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin: 14px 0 0 0;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

/* ── Known-license picker ── */

.auth-known-section {
  margin-bottom: 16px;
}

.auth-known-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}

.auth-known-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 6px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.auth-known-card:hover:not(:disabled) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--s2));
}
.auth-known-card:disabled,
.auth-known-card.loading {
  opacity: 0.6;
  cursor: wait;
}

.auth-known-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.auth-known-meta {
  font-size: 12px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  margin-top: 2px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 14px;
  color: var(--muted);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-key-hint {
  font-size: 13px;
  color: var(--muted);
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
}

/* ── Two-step sign-in ── */

.auth-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: #fff;
  color: #1f1f1f;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.auth-google-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.auth-error {
  margin-bottom: 12px;
}

.auth-user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  margin-bottom: 16px;
  width: fit-content;
  max-width: 100%;
}
.auth-user-chip #authUserEmail {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
}
.auth-link-btn:hover {
  text-decoration: underline;
}
