/* =========================================================================
   Sign in / request access.

   Loaded AFTER styles.css so it inherits the token palette and the dark-theme
   block — one definition of what this product looks like, and the sign-in page
   cannot drift from the dashboard it leads to.

   Two surfaces: a fixed dark brand panel on the left, which is a brand asset and
   so keeps its own colours in both themes, and a form panel on the right that
   follows the viewer's theme like the rest of the app.
   ====================================================================== */

:root {
  --aside-ink:   #070d1c;
  --aside-ink-2: #122343;
  --aside-text:  #e8eefc;
  --aside-muted: #93a6c9;
  --aside-line:  rgba(255, 255, 255, .10);
  --auth-max:    420px;
}

.auth-body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

/* ============================================================== brand side */

.auth-aside {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 44px 56px;
  color: var(--aside-text);
  background:
    radial-gradient(120% 90% at 12% 0%, var(--aside-ink-2) 0%, transparent 58%),
    radial-gradient(90% 80% at 100% 100%, rgba(37, 99, 235, .30) 0%, transparent 60%),
    var(--aside-ink);
}

.aside-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.brand-mark {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 700; font-size: 14px; letter-spacing: .02em;
  box-shadow: 0 6px 20px rgba(37, 99, 235, .40);
}

.brand-name {
  display: flex; flex-direction: column;
  font-size: 15px; font-weight: 650; letter-spacing: -.01em;
  line-height: 1.25;
}

.brand-name small {
  font-size: 12px; font-weight: 450;
  color: var(--aside-muted);
}

.aside-body {
  position: relative;
  z-index: 1;
  margin: auto 0;
  padding: 48px 0;
  max-width: 30rem;
}

.auth-aside h1 {
  margin: 0 0 18px;
  font-size: clamp(28px, 2.6vw, 40px);
  line-height: 1.14;
  letter-spacing: -.028em;
  font-weight: 680;
}

.aside-lede {
  margin: 0 0 40px;
  font-size: 15px;
  line-height: 1.62;
  color: var(--aside-muted);
  max-width: 27rem;
}

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

.aside-points li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 14px;
  align-items: start;
}

.aside-points svg {
  width: 34px; height: 34px;
  padding: 8px;
  box-sizing: border-box;
  border-radius: 9px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--aside-line);
  fill: none;
  stroke: #9dc0ff;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.aside-points div {
  font-size: 13px;
  line-height: 1.55;
  color: var(--aside-muted);
}

.aside-points b {
  display: block;
  margin-bottom: 2px;
  font-size: 13.5px;
  font-weight: 620;
  color: var(--aside-text);
}

/* The coverage-grid motif, bled off the bottom-right corner. */
.aside-motif {
  position: absolute;
  right: -40px;
  bottom: -34px;
  z-index: 0;
  display: grid;
  grid-template-columns: repeat(8, 30px);
  gap: 9px;
  transform: rotate(-12deg);
  opacity: .5;
  pointer-events: none;
}

.aside-motif i {
  width: 30px; height: 30px;
  border-radius: 7px;
  border: 1.5px solid rgba(255, 255, 255, .13);
}

.aside-motif i.on {
  background: rgba(96, 150, 255, .22);
  border-color: rgba(120, 170, 255, .34);
}

.aside-foot {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 12px;
  color: var(--aside-muted);
  opacity: .8;
}

/* =============================================================== form side */

.auth-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 32px;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: var(--auth-max);
}

/* One card, three panels; `data-panel` on <body> decides which is on screen —
   the same single-switch idea as the dashboard's data-stage. */
.auth-form { display: none; }
body[data-panel="login"]  #loginForm,
body[data-panel="signup"] #signupForm,
body[data-panel="done"]   #donePanel { display: block; }

.form-head { margin-bottom: 26px; }

.form-head h2 {
  margin: 0 0 6px;
  font-size: 25px;
  font-weight: 660;
  letter-spacing: -.022em;
}

.form-head p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-muted);
}

/* ------------------------------------------------------------------ fields */

.field {
  display: block;
  margin-bottom: 18px;
}

.field-label {
  display: block;
  margin-bottom: 7px;
  font-size: 12.5px;
  font-weight: 620;
  letter-spacing: -.005em;
}

.field-input {
  display: block;
  position: relative;
}

.field input {
  width: 100%;
  box-sizing: border-box;
  height: 44px;
  padding: 0 14px;
  font: inherit;
  font-size: 14.5px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color .12s, box-shadow .12s;
}

.field-input input { padding-right: 62px; }

.field input::placeholder { color: var(--text-dim); }

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Both states restate background and border: styles.css has a generic
   `button:hover { background: var(--panel-2) }` that would otherwise repaint
   these, which is how the primary button once turned white-on-white. */
.reveal,
.reveal:hover {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  padding: 6px 9px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.reveal:hover { color: var(--accent); background: var(--accent-soft); }

.field-hint {
  display: block;
  margin-top: 7px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-dim);
}

/* ------------------------------------------------------------------- scope */

.scope {
  margin: 24px 0 4px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
}

.scope-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.scope-head .field-label { margin-bottom: 0; }

.scope-count {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
}

.scope-count.ok { color: var(--good); }

.scope .field-hint { margin-top: 4px; }

.scope-step { margin-top: 14px; }

.scope-step-label {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* Categories are pointless until a marketplace is picked — scope is the pair. */
#scopeCatStep { display: none; }
body.has-market #scopeCatStep { display: block; }

/* No max-height: there are 16 marketplaces and ~15 categories, which is two and
   five rows. Capping it scrolled the set and clipped a row of chips in half the
   moment a selection scrolled into view — worse than a slightly taller form. */
.chip-set {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pick {
  padding: 6px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 550;
  color: var(--text-muted);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
}

.pick:hover { border-color: var(--accent-line); background: var(--panel); }

.pick.on,
.pick.on:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 620;
}

.scope-loading { font-size: 12px; color: var(--text-dim); }

/* Categories: a dropdown rather than a chip set — the list can run past what
   comfortably wraps as pills, and closed-by-default keeps the form the same
   height whether it offers three categories or thirty. */
.cat-select { position: relative; }

.cat-select-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 9px 12px;
  font: inherit; font-size: 13px; color: var(--text);
  background: var(--panel); border: 1px solid var(--border); border-radius: 9px;
  cursor: pointer; text-align: left;
}
.cat-select-btn:hover { border-color: var(--accent-line); }
.cat-select-btn[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cat-select-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-select-chevron {
  flex: none; width: 16px; height: 16px; stroke: var(--text-dim); fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .12s;
}
.cat-select-btn[aria-expanded="true"] .cat-select-chevron { transform: rotate(180deg); }

.cat-select-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 5;
  max-height: 220px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 9px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .12);
  padding: 6px;
}
.cat-select-menu.hide { display: none; }

.cat-option {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 8px; border-radius: 6px; font-size: 12.5px; color: var(--text);
  cursor: pointer;
}
.cat-option:hover { background: var(--panel-2); }
.cat-option input { accent-color: var(--accent); }

/* ----------------------------------------------------------------- actions */

.btn-primary {
  display: block;
  width: 100%;
  margin-top: 22px;
  height: 46px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 620;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(37, 99, 235, .18);
  transition: filter .12s;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  filter: brightness(1.07);
}

/* Muted but still white-on-blue. Fading the whole button with opacity drops the
   label to roughly 2.5:1 against the card, and "Signing in…" is the one moment
   the user most wants to read it. */
.btn-primary:disabled {
  background: color-mix(in srgb, var(--accent) 58%, var(--panel));
  border-color: transparent;
  opacity: 1;
  cursor: progress;
}

.form-switch {
  margin: 18px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.linkish,
.linkish:hover {
  padding: 0;
  font: inherit;
  font-weight: 620;
  color: var(--accent);
  background: none;
  border: 0;
  cursor: pointer;
}

.linkish:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------------------------------------------------------------- messages */

/* `display: flex` would otherwise beat the UA stylesheet's `[hidden]{display:none}`,
   leaving an empty red box on a form nobody has submitted yet. */
.msg[hidden] { display: none; }

.msg {
  display: flex;
  gap: 9px;
  margin: 16px 0 0;
  padding: 11px 13px;
  font-size: 13px;
  line-height: 1.5;
  border-radius: 10px;
  border: 1px solid rgba(220, 47, 67, .28);
  background: var(--high-soft);
  color: var(--high);
}

.msg::before {
  content: "!";
  flex: 0 0 17px;
  height: 17px;
  margin-top: 1px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--high);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

/* --------------------------------------------------------------- submitted */

.done-mark {
  width: 46px; height: 46px;
  margin-bottom: 20px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--good-soft);
}

.done-mark svg {
  width: 22px; height: 22px;
  fill: none;
  stroke: var(--good);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.done-facts {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.done-facts > div {
  display: flex;
  gap: 14px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-soft);
}

.done-facts > div:last-child { border-bottom: 0; }

.done-facts dt {
  flex: 0 0 108px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.done-facts dd {
  margin: 0;
  font-size: 12.5px;
  font-weight: 560;
  word-break: break-word;
}

.auth-legal {
  margin: 26px 0 0;
  max-width: var(--auth-max);
  text-align: center;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-dim);
}

/* --------------------------------------------------------------- responsive */

/* The brand panel is a pitch for someone deciding whether to request access; on a
   narrow screen the person is almost always signing in, so it collapses to a
   header band and the form takes the room. */
@media (max-width: 940px) {
  .auth-shell { grid-template-columns: 1fr; min-height: 0; }

  .auth-aside {
    padding: 20px 24px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }

  .aside-body, .aside-motif { display: none; }
  .aside-foot { font-size: 11.5px; text-align: right; }
  .auth-main { padding: 40px 24px 32px; min-height: calc(100vh - 78px); }
}

@media (max-width: 420px) {
  .auth-aside { padding: 16px; }
  .brand-name small { display: none; }
  .aside-foot { display: none; }
  .auth-main { padding: 30px 18px 24px; }
  .form-head h2 { font-size: 22px; }
}
