/* Standalone styles for the login page. Self-contained so it can be restyled
   without touching the signed-in app's stylesheet. */

:root {
  --bg: #eef1f6;
  --glow-a: rgba(37, 99, 235, 0.18);
  --glow-b: rgba(129, 140, 248, 0.14);
  --surface: #ffffff;
  --border: #e4e8ef;
  --text: #10151c;
  --muted: #6d7684;
  --field: #f7f9fc;
  --field-border: #dfe4ec;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --ring: rgba(37, 99, 235, 0.16);
  --danger-bg: #fef2f2;
  --danger-border: #fbd5d5;
  --danger-text: #a8232b;
  --shadow: 0 1px 2px rgba(16, 21, 28, .05), 0 12px 32px -8px rgba(16, 21, 28, .12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0d12;
    --glow-a: rgba(37, 99, 235, 0.22);
    --glow-b: rgba(129, 140, 248, 0.13);
    --surface: #141920;
    --border: #232a34;
    --text: #eef1f5;
    --muted: #8d97a5;
    --field: #0e1319;
    --field-border: #2a323d;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --ring: rgba(59, 130, 246, 0.25);
    --danger-bg: #2a1517;
    --danger-border: #4d2226;
    --danger-text: #f7a9ad;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 16px 40px -12px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Soft light sources behind the card, fixed so they don't shift on scroll. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(52rem 32rem at 18% -8%, var(--glow-a), transparent 62%),
    radial-gradient(44rem 30rem at 88% 108%, var(--glow-b), transparent 60%);
}

.shell { width: 100%; max-width: 408px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px 36px;
  box-shadow: var(--shadow);
}

.mark {
  width: 46px;
  height: 46px;
  margin-bottom: 22px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), #6366f1);
  box-shadow: 0 6px 16px -6px var(--accent);
}
.mark svg { width: 25px; height: 25px; }

h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 640;
  letter-spacing: -0.022em;
}

.sub {
  margin: 7px 0 28px;
  color: var(--muted);
  font-size: 14.5px;
}

/* Fields */
.field { margin-bottom: 18px; }

label {
  display: block;
  margin-bottom: 7px;
  font-size: 13.5px;
  font-weight: 540;
  letter-spacing: -0.005em;
}

input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--field-border);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder { color: var(--muted); opacity: .62; }
input:hover { border-color: color-mix(in srgb, var(--field-border) 60%, var(--muted)); }
input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--ring);
}

/* Chrome paints autofilled fields a fixed yellow; the inset shadow trick is the
   only reliable way to keep them on-theme, including in dark mode. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 40px var(--field) inset;
  caret-color: var(--text);
}

.password-wrap { position: relative; }
.password-wrap input { padding-right: 66px; }

.toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  padding: 6px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 540;
  cursor: pointer;
}
.toggle:hover { color: var(--text); background: color-mix(in srgb, var(--muted) 13%, transparent); }
.toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Submit */
.submit {
  position: relative;
  width: 100%;
  height: 46px;
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 560;
  cursor: pointer;
  transition: background .15s, transform .12s, box-shadow .15s;
  box-shadow: 0 4px 14px -6px var(--accent);
}
.submit:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-1px); }
.submit:active:not(:disabled) { transform: translateY(0); }
.submit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.submit:disabled { opacity: .72; cursor: default; box-shadow: none; }

/* Spinner is laid out only while the button is busy, so the label stays centred. */
.spinner { display: none; width: 15px; height: 15px; }
.submit.busy .spinner {
  display: block;
  border: 2px solid rgba(255, 255, 255, .38);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Alerts */
.alert {
  margin-bottom: 20px;
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
  font-size: 13.5px;
}
.alert[hidden] { display: none; }

.foot {
  margin: 22px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .submit:hover:not(:disabled) { transform: none; }
}

@media (max-width: 420px) {
  .card { padding: 32px 24px 28px; border-radius: 14px; }
  h1 { font-size: 23px; }
}
