/* ==========================================================================
   Auth screens — split shell, cards, password strength, code input.
   Depends on base.css tokens.
   ========================================================================== */

@layer components {

  .auth-body { background: var(--bg-elevated); }

  .auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: 100vh;
    min-height: 100dvh;
  }
  @media (min-width: 1024px) {
    .auth-shell { grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr); }
  }

  /* ------------------------------------------------------------- left pane */

  .auth-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(1.75rem, 5vw, 3.5rem) clamp(1.25rem, 5vw, 2rem) 3rem;
  }
  .auth-main > .brand {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: var(--fs-md);
    color: var(--text);
    text-decoration: none;
  }
  .auth-main > .brand .mark {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: var(--brand-600);
    color: #fff;
  }
  .auth-main > .brand .mark svg { width: 17px; height: 17px; }
  .auth-main > .alert { width: 100%; max-width: 27rem; }

  .auth-card {
    width: 100%;
    max-width: 27rem;
    margin-block: auto;
    padding-block: clamp(1.5rem, 5vh, 3rem);
  }
  .auth-card h1 {
    font-size: clamp(1.5rem, 3.2vw, 1.9rem);
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin: 0 0 8px;
  }
  .auth-card > p.muted { margin: 0; font-size: var(--fs-base); line-height: 1.6; }

  .auth-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    margin-bottom: var(--sp-5);
    border-radius: var(--radius-md);
    background: var(--brand-50);
    color: var(--brand-600);
  }
  .auth-icon.ok  { background: var(--ok-50);  color: var(--ok-600); }
  .auth-icon.bad { background: var(--bad-50); color: var(--bad-600); }

  /* --------------------------------------------------------------- OAuth */

  .oauth-row { display: grid; gap: var(--sp-3); }
  @media (min-width: 480px) {
    .oauth-row { grid-template-columns: 1fr 1fr; }
    .oauth-row .btn { width: 100%; }
  }
  .oauth-row .btn { font-weight: 560; }

  .divider {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    color: var(--text-subtle);
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
  .divider::before,
  .divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
  }

  /* ----------------------------------------------------- form refinements */

  /* base.css indents .input-group for a leading icon; here the button trails. */
  .auth-card .input-group .input { padding-left: 12px; padding-right: 40px; }
  .auth-card .input-group .btn-icon {
    position: absolute;
    right: 3px;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: var(--text-subtle);
  }
  .auth-card .input-group .btn-icon:hover { color: var(--text); background: var(--bg-hover); }

  .code-input {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    letter-spacing: 0.32em;
    text-align: center;
    padding-block: 14px;
  }

  .strength { display: flex; align-items: center; gap: var(--sp-3); margin-top: 8px; }
  .strength .bars { display: flex; gap: 4px; flex: 1; }
  .strength .bars i {
    flex: 1;
    height: 4px;
    border-radius: var(--radius-full);
    background: var(--bg-active);
    transition: background var(--dur-fast) var(--ease);
  }
  .strength[data-score="1"] .bars i:nth-child(-n+1) { background: var(--bad-500); }
  .strength[data-score="2"] .bars i:nth-child(-n+2) { background: var(--warn-500); }
  .strength[data-score="3"] .bars i:nth-child(-n+3) { background: var(--brand-500); }
  .strength[data-score="4"] .bars i { background: var(--ok-500); }

  .auth-assure {
    display: grid;
    gap: 8px;
    padding: 0;
    margin: 0;
    list-style: none;
    font-size: var(--fs-sm);
    color: var(--text-muted);
  }
  .auth-assure li { display: flex; align-items: center; gap: 8px; }
  .auth-assure svg { color: var(--ok-600); flex: none; }

  .quote {
    margin: 0;
    padding: var(--sp-4) var(--sp-5);
    border-left: 3px solid var(--brand-500);
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--brand-50);
    color: var(--text);
    font-style: italic;
    line-height: 1.6;
  }

  /* ------------------------------------------------------------ right pane */

  .auth-aside {
    display: none;
    position: relative;
    overflow: hidden;
    background: var(--gray-950, #0b0d12);
    color: #fff;
    isolation: isolate;
  }
  @media (min-width: 1024px) { .auth-aside { display: block; } }

  .auth-aside::before {
    content: "";
    position: absolute;
    inset: -30% -20% auto;
    height: 720px;
    z-index: -1;
    background:
      radial-gradient(45% 50% at 30% 15%, rgb(99 102 241 / .55), transparent 70%),
      radial-gradient(40% 45% at 75% 10%, rgb(139 92 246 / .45), transparent 70%),
      radial-gradient(35% 40% at 55% 60%, rgb(249 115 22 / .18), transparent 70%);
  }
  .auth-aside::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image:
      linear-gradient(rgb(255 255 255 / .04) 1px, transparent 1px),
      linear-gradient(90deg, rgb(255 255 255 / .04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(70% 60% at 50% 40%, #000, transparent 75%);
  }

  .auth-aside-inner {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--sp-8);
    height: 100%;
    padding: clamp(2.5rem, 5vw, 4.5rem);
  }
  .auth-aside blockquote { margin: 0; }
  .auth-aside blockquote p {
    margin: 0;
    font-size: clamp(1.05rem, 1.6vw, 1.3rem);
    line-height: 1.55;
    font-weight: 460;
    letter-spacing: -0.01em;
  }
  .auth-aside blockquote footer {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: var(--sp-5);
    font-size: var(--fs-sm);
  }
  .auth-aside blockquote footer span { color: rgb(255 255 255 / .62); }

  .auth-points {
    display: grid;
    gap: 10px;
    padding: 0;
    margin: 0;
    list-style: none;
    font-size: var(--fs-sm);
  }
  .auth-points li { display: flex; align-items: flex-start; gap: 10px; color: rgb(255 255 255 / .82); }
  .auth-points svg { color: #86efac; flex: none; margin-top: 2px; }

  .auth-logos {
    padding-top: var(--sp-6);
    border-top: 1px solid rgb(255 255 255 / .12);
    font-size: var(--fs-xs);
    color: rgb(255 255 255 / .5);
  }

  /* ============================================================== wizard */

  .wizard-body { background: var(--bg-sunken); }

  .wizard-top {
    display: flex;
    align-items: center;
    gap: var(--sp-5);
    padding: var(--sp-4) clamp(1rem, 4vw, 2.5rem);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
  }
  .wizard-top .brand {
    display: inline-flex; align-items: center; gap: 10px;
    font-weight: 700; color: var(--text); text-decoration: none;
  }
  .wizard-top .brand .mark {
    display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px;
    background: var(--brand-600); color: #fff;
  }
  .wizard-top .brand .mark svg { width: 16px; height: 16px; }
  .wizard-top > .link { margin-left: auto; }

  .wizard-steps {
    display: flex; align-items: center; gap: var(--sp-4);
    margin: 0 auto; padding: 0; list-style: none;
    font-size: var(--fs-sm); color: var(--text-subtle);
    counter-reset: step;
  }
  .wizard-steps li { display: flex; align-items: center; gap: 8px; }
  .wizard-steps li + li::before {
    content: ""; width: 26px; height: 1px; background: var(--border-strong); margin-right: var(--sp-4);
  }
  .wizard-steps .n {
    display: grid; place-items: center; width: 22px; height: 22px; flex: none;
    border-radius: 50%; border: 1.5px solid var(--border-strong);
    font-size: 11px; font-weight: 640;
  }
  .wizard-steps .is-current { color: var(--text); font-weight: 580; }
  .wizard-steps .is-current .n { border-color: var(--brand-600); background: var(--brand-600); color: #fff; }
  .wizard-steps .is-done { color: var(--text-muted); }
  .wizard-steps .is-done .n { border-color: var(--ok-500); background: var(--ok-500); color: #fff; }
  @media (max-width: 720px) {
    .wizard-steps .l { display: none; }
    .wizard-steps li + li::before { width: 14px; margin-right: 0; }
    .wizard-steps { gap: var(--sp-2); }
  }

  .wizard-main {
    width: 100%;
    max-width: var(--wizard-w, 44rem);
    margin-inline: auto;
    padding: clamp(1.75rem, 5vw, 3.5rem) clamp(1rem, 4vw, 2rem) 5rem;
  }
  .wizard-main.wide { --wizard-w: 68rem; }
  .wizard-main h1 { font-size: clamp(1.5rem, 3.2vw, 2rem); letter-spacing: -.025em; }
  .wizard-main > header { margin-bottom: var(--sp-6); }
  .wizard-main > header p { margin-top: 8px; color: var(--text-muted); line-height: 1.6; max-width: 60ch; }

  .wizard-foot {
    display: flex; align-items: center; gap: var(--sp-3);
    margin-top: var(--sp-6); padding-top: var(--sp-5);
    border-top: 1px solid var(--border);
  }
  .wizard-foot .spacer { flex: 1; }

  /* Big radio cards used for use-case and template choices. */
  .pick { display: grid; gap: var(--sp-3); }
  .pick-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pick-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  @media (max-width: 860px) { .pick-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @media (max-width: 560px) { .pick-2, .pick-3 { grid-template-columns: 1fr; } }

  .pick label {
    position: relative; display: flex; flex-direction: column; gap: 6px;
    padding: var(--sp-4); cursor: pointer;
    background: var(--bg-elevated); border: 1.5px solid var(--border);
    border-radius: var(--radius-md); box-shadow: var(--shadow-xs);
    transition: border-color var(--dur), box-shadow var(--dur), transform var(--dur) var(--ease-out);
  }
  .pick label:hover { border-color: var(--border-strong); transform: translateY(-1px); }
  .pick input { position: absolute; opacity: 0; width: 0; height: 0; }
  .pick input:focus-visible + .pick-in { outline: 2px solid var(--brand-500); outline-offset: 3px; border-radius: var(--radius-sm); }
  .pick label:has(input:checked) {
    border-color: var(--brand-500); box-shadow: var(--shadow-glow);
    background: color-mix(in srgb, var(--brand-50) 60%, var(--bg-elevated));
  }
  .pick label:has(input:checked)::after {
    content: "✓"; position: absolute; top: 10px; right: 12px;
    color: var(--brand-600); font-weight: 700;
  }
  .pick .ic {
    display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 2px;
    border-radius: var(--radius-sm); background: var(--brand-50); color: var(--brand-600);
  }
  .pick b { font-weight: 600; }
  .pick small { color: var(--text-muted); line-height: 1.5; }
  .pick .tag {
    align-self: flex-start; margin-top: 2px; padding: 1px 7px; border-radius: var(--radius-full);
    background: var(--bg-sunken); color: var(--text-muted); font-size: 11px; font-weight: 560;
  }
  [data-theme="dark"] .pick .ic { background: rgb(99 102 241 / .16); }
}
