/* Sign-in pages (partner, advertiser, team, platform admin).
   Self-contained: does not depend on tokens.css/shell.css or Bootstrap, so the
   auth surface renders identically for every brand. Brand colours arrive as
   --brand / --brand-2 on <html> (set inline from the Brand record). */

:root {
  --brand: #6366f1;
  --brand-2: #4f46e5;
  --on-brand: #ffffff;
  --link: color-mix(in srgb, var(--brand) 68%, #000);
  --bg: #ffffff;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --field: #ffffff;
  --field-line: #cbd5e1;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-line: #fecaca;
  --warn: #b45309;
  --ring: color-mix(in srgb, var(--brand) 35%, transparent);
  --radius: 10px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b1120;
  --panel: #0b1120;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --faint: #64748b;
  --line: #1e293b;
  --field: #111827;
  --field-line: #334155;
  --danger: #f87171;
  --danger-bg: #2a1215;
  --danger-line: #7f1d1d;
  --warn: #fbbf24;
  --link: color-mix(in srgb, var(--brand) 80%, #fff);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.auth {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  min-height: 100vh;
}

/* ── Brand panel ─────────────────────────────────────────── */

.auth-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 40px 56px;
  color: #fff;
  background:
    radial-gradient(1200px 600px at -10% -20%, color-mix(in srgb, var(--brand) 55%, transparent), transparent 60%),
    radial-gradient(900px 500px at 120% 120%, color-mix(in srgb, var(--brand-2) 60%, transparent), transparent 55%),
    #0b1020;
}

.auth-hero::after {
  /* faint grid texture */
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  pointer-events: none;
}

.auth-hero > * { position: relative; z-index: 1; }

.auth-hero__body {
  margin: auto 0;
  max-width: 520px;
  padding: 48px 0;
}

.auth-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(255,255,255,.85);
}

.auth-eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52,211,153,.2);
}

.auth-hero h2 {
  margin: 20px 0 14px;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -.02em;
}

.auth-hero__lead {
  margin: 0 0 32px;
  font-size: 16px;
  color: rgba(255,255,255,.72);
}

.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }

.auth-points li { display: flex; gap: 14px; align-items: flex-start; }

.auth-points__icon {
  flex: 0 0 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
}

.auth-points__icon svg { width: 18px; height: 18px; stroke: #fff; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.auth-points strong { display: block; font-size: 15px; font-weight: 600; }
.auth-points span { display: block; font-size: 14px; color: rgba(255,255,255,.62); }

.auth-hero__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 13px;
  color: rgba(255,255,255,.55);
}

.auth-hero__foot svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 6px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ── Brand mark ──────────────────────────────────────────── */

.auth-brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.auth-brand:hover { text-decoration: none; }
.auth-brand img { height: 36px; width: auto; max-width: 200px; display: block; }
.auth-brand__tile {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
  color: var(--on-brand);
  background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 78%, #000));
  box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 40%, transparent);
}
.auth-brand__fallback { display: contents; }
.auth-brand__fallback[hidden], .auth-brand img[hidden] { display: none; }
.auth-brand__name { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }

/* ── Form panel ──────────────────────────────────────────── */

.auth-main {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  padding: 28px 40px;
  border-left: 1px solid var(--line);
}

.auth-main__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-main__top .auth-brand { visibility: hidden; }

.auth-theme {
  margin-left: auto;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.auth-theme:hover { color: var(--text); }
.auth-theme svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; }

.auth-card { width: 100%; max-width: 400px; margin: auto; padding: 32px 0; }

.auth-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 32px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--line) 35%, transparent);
}
.auth-tabs a {
  padding: 8px 10px;
  border-radius: 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.auth-tabs a:hover { color: var(--text); text-decoration: none; }
.auth-tabs a[aria-current="page"] {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15,23,42,.08), 0 0 0 1px var(--line);
}

.auth-card h1 { margin: 0 0 6px; font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.auth-card__sub { margin: 0 0 28px; color: var(--muted); }

.auth-alert {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 20px;
  border: 1px solid var(--danger-line);
  border-radius: var(--radius);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 14px;
}
.auth-alert svg { flex: 0 0 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; margin-top: 1px; }
.auth-alert--info { border-color: var(--line); background: color-mix(in srgb, var(--brand) 8%, var(--panel)); color: var(--text); }

.auth-field { margin-bottom: 18px; }
.auth-field__row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.auth-field label { font-size: 14px; font-weight: 600; }
.auth-field__row a { font-size: 13px; font-weight: 500; }

.auth-input { position: relative; }
.auth-input input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--field-line);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--text);
  font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.auth-input input::placeholder { color: var(--faint); }
.auth-input input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
.auth-input input[aria-invalid="true"] { border-color: var(--danger); }
.auth-input--pw input { padding-right: 48px; }

.auth-reveal {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.auth-reveal:hover { color: var(--text); }
.auth-reveal svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.auth-reveal:focus-visible { outline: 2px solid var(--brand); }

.auth-hint { margin-top: 6px; font-size: 13px; color: var(--warn); }
.auth-error { margin-top: 6px; font-size: 13px; color: var(--danger); }

.auth-submit {
  position: relative;
  width: 100%;
  height: 46px;
  margin-top: 6px;
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 92%, #fff), var(--brand));
  color: var(--on-brand);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 30%, transparent);
  transition: filter .15s, transform .05s;
}
.auth-submit:hover { filter: brightness(1.06); }
.auth-submit:active { transform: translateY(1px); }
.auth-submit:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.auth-submit[aria-busy="true"] { color: transparent; pointer-events: none; }
.auth-submit[aria-busy="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border: 2px solid color-mix(in srgb, var(--on-brand) 40%, transparent);
  border-top-color: var(--on-brand);
  border-radius: 50%;
  animation: auth-spin .7s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

.auth-alt { margin: 24px 0 0; text-align: center; font-size: 14px; color: var(--muted); }
.auth-alt a { font-weight: 600; }

.auth-secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 28px;
  font-size: 12px;
  color: var(--faint);
}
.auth-secure svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; }

.auth-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  font-size: 13px;
  color: var(--faint);
}
.auth-foot a { color: var(--muted); }

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-main { padding: 20px 16px; }
  .auth-main__top .auth-brand { visibility: visible; }
  .auth-card { padding: 24px 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: .01ms !important; }
}
