:root {
  --color-bg: #f4f6fb;
  --color-primary: #2f4cdd;
  --color-primary-dark: #2238a8;
  --color-text: #1a1f36;
  --color-text-muted: #6b7280;
  --color-border: #e3e6ee;
  --color-card: #ffffff;
  --color-danger: #b42318;
  --color-warning-bg: #fff7e6;
  --color-warning-border: #f4c969;
  --color-warning-text: #7a5300;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 20px 45px -20px rgba(26, 31, 54, 0.25);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow-x: hidden;
}

.background {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 20%, rgba(47, 76, 221, 0.12), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(47, 76, 221, 0.10), transparent 45%),
    var(--color-bg);
}

.auth-shell {
  width: 100%;
  max-width: 420px;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.auth-card {
  width: 100%;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 36px 32px 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.brand-mark {
  color: var(--color-primary);
  display: inline-flex;
}

.brand-name {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--color-text);
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 6px;
}

.subtitle {
  margin: 0 0 28px;
  color: var(--color-text-muted);
  font-size: 0.92rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text);
}

.field input {
  font: inherit;
  padding: 11px 13px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #fbfbfd;
  color: var(--color-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(47, 76, 221, 0.15);
  background: #fff;
}

.field input[aria-invalid="true"] {
  border-color: var(--color-danger);
  background: #fff7f6;
}

.field input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.13);
}

.field-hint {
  margin: 0;
  font-size: 0.76rem;
  color: var(--color-text-muted);
}

.field-error {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-danger);
}

.field-error[hidden] {
  display: none;
}

.login-button {
  position: relative;
  margin-top: 6px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.login-button:hover {
  background: var(--color-primary-dark);
}

.login-button:disabled {
  cursor: not-allowed;
  opacity: 0.85;
}

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.login-button.is-loading .button-label {
  opacity: 0.85;
}

.login-button.is-loading .spinner {
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.status-box {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 13px 14px;
  border-radius: var(--radius-md);
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  color: var(--color-warning-text);
  font-size: 0.85rem;
  line-height: 1.45;
}

.status-box[hidden] {
  display: none;
}

.status-box .status-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.status-box strong {
  display: block;
  margin-bottom: 2px;
  font-weight: 700;
}

.auth-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: center;
}

.extension-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.extension-indicator .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c8ccd6;
  flex-shrink: 0;
}

.extension-indicator[data-state="checking"] .dot {
  background: #f4c969;
  animation: pulse 1s ease-in-out infinite;
}

.extension-indicator[data-state="missing"] .dot {
  background: var(--color-danger);
}

.extension-indicator[data-state="missing"] .extension-text {
  color: var(--color-danger);
}

.extension-indicator[data-state="found"] .dot {
  background: #1a9e6b;
}

.extension-indicator[data-state="found"] .extension-text {
  color: #1a9e6b;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.legal {
  font-size: 0.76rem;
  color: var(--color-text-muted);
  margin: 0;
}
