/* auth.css — Floudb identity UI (auth.floudb.com).
   Server-rendered auth screens styled in the Floudb design system.
   Depends on tokens.css for all --ds-* variables. No Bootstrap. */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ds-text);
  background: var(--ds-sunken);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---------- modal product shell ---------- */
.auth-product-shell {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--ds-sunken);
  color: var(--ds-text);
  user-select: none;
  pointer-events: none;
}
.auth-product-topbar {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 24px;
  background: var(--ds-surface);
  border-bottom: 0.5px solid var(--ds-border);
}
.auth-product-mark {
  width: 31px;
  height: 31px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--ds-brand);
  color: var(--ds-on-brand);
  font-size: 14px;
  font-weight: 700;
}
.auth-product-name { font-size: 16px; font-weight: 650; letter-spacing: -0.02em; }
.auth-product-search {
  width: min(34vw, 430px);
  height: 34px;
  margin-left: clamp(20px, 8vw, 140px);
  border-radius: 9px;
  background: var(--ds-input-bg);
  border: 0.5px solid var(--ds-border);
}
.auth-product-action {
  width: 82px;
  height: 32px;
  margin-left: auto;
  border-radius: 8px;
  background: var(--ds-brand);
}
.auth-product-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ds-panel);
  border: 0.5px solid var(--ds-border);
}
.auth-product-body { display: flex; min-height: calc(100vh - 64px); }
.auth-product-sidebar {
  width: 220px;
  flex: 0 0 220px;
  padding: 26px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--ds-surface);
  border-right: 0.5px solid var(--ds-border);
}
.auth-product-sidebar span {
  display: block;
  width: 72%;
  height: 11px;
  border-radius: 999px;
  background: var(--ds-border);
}
.auth-product-sidebar span.active {
  width: 100%;
  height: 36px;
  margin: -8px 0 4px;
  border-radius: 9px;
  background: var(--ds-control-hover);
}
.auth-product-content { flex: 1; padding: clamp(30px, 5vw, 72px); }
.auth-product-heading { width: 220px; height: 24px; border-radius: 8px; background: var(--ds-text); opacity: .55; }
.auth-product-subheading { width: 340px; max-width: 65%; height: 11px; margin-top: 13px; border-radius: 999px; background: var(--ds-border-strong); }
.auth-product-cards { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: 18px; margin-top: 34px; }
.auth-product-cards span {
  height: 116px;
  border-radius: var(--ds-card-radius, 12px);
  background: var(--ds-surface);
  border: 0.5px solid var(--ds-border);
  box-shadow: 0 6px 18px rgba(16,32,44,.04);
}
.auth-product-table {
  margin-top: 22px;
  padding: 12px 18px;
  border-radius: var(--ds-card-radius, 12px);
  background: var(--ds-surface);
  border: 0.5px solid var(--ds-border);
}
.auth-product-table span { display: block; height: 13px; margin: 18px 0; border-radius: 999px; background: var(--ds-panel); }
.auth-modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: color-mix(in srgb, var(--ds-sunken) 42%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(.82);
  backdrop-filter: blur(12px) saturate(.82);
}
.auth-dialog-layer {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

/* ---------- card ---------- */
.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--ds-surface);
  border: 0.5px solid var(--ds-border);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(16,32,44,0.20), 0 4px 16px rgba(16,32,44,0.08);
  padding: 30px 28px;
}
[data-theme="dark"] .auth-card { box-shadow: 0 8px 32px rgba(0,0,0,0.45); }

.auth-brand {
  display: flex; align-items: center; gap: 9px; justify-content: center;
  margin-bottom: 20px; text-decoration: none;
}
.auth-brand .sq {
  width: 27px; height: 27px; border-radius: 7px;
  background: var(--ds-brand); color: var(--ds-on-brand);
  font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.auth-brand .nm { font-size: 15px; font-weight: 600; color: var(--ds-text); letter-spacing: -0.01em; }
.auth-brand-logo { height: 27px; width: auto; max-width: 140px; display: block; }

.auth-card h1 {
  font-size: 19px; font-weight: 500; color: var(--ds-text);
  margin: 0; text-align: center; letter-spacing: -0.01em; text-wrap: balance;
}
.auth-sub {
  font-size: 13px; color: var(--ds-text-muted);
  text-align: center; margin: 7px 0 0; line-height: 1.5;
}
.auth-sub b, .auth-sub strong { color: var(--ds-text); font-weight: 500; }

/* ---------- form ---------- */
.auth-form { display: flex; flex-direction: column; gap: 13px; margin-top: 22px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field > label {
  font-size: 12px; font-weight: 500; color: var(--ds-text-muted);
  display: flex; align-items: center;
}
.auth-field > label .aux { margin-left: auto; font-weight: 400; font-size: 11.5px; }

.auth-input {
  height: 38px;
  width: 100%;
  background: var(--ds-input-bg);
  border: 0.5px solid var(--ds-border);
  border-radius: var(--ds-radius);
  padding: 0 12px;
  font: inherit; font-size: 13.5px;
  color: var(--ds-text);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.auth-input::placeholder { color: var(--ds-text-faint); }
.auth-input:hover { border-color: var(--ds-border-strong); }
.auth-input:focus {
  outline: none;
  border-color: var(--ds-brand);
  background: var(--ds-surface);
  box-shadow: 0 0 0 3px var(--ds-control-hover);
}
.auth-input.input-validation-error,
.auth-input[aria-invalid="true"] {
  border-color: var(--ds-danger-border);
  background: var(--ds-danger-bg);
}

/* input with a trailing action (show password) */
.auth-input-group { position: relative; display: flex; align-items: center; }
.auth-input-group .auth-input { padding-right: 40px; }
.auth-input-group .icon-btn {
  position: absolute; right: 6px;
  width: 28px; height: 28px; border: none; background: transparent;
  color: var(--ds-text-faint); cursor: pointer; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.auth-input-group .icon-btn:hover { color: var(--ds-text-muted); background: var(--ds-panel); }

/* ---------- validation ---------- */
.field-validation-error, .text-danger {
  font-size: 11.5px; color: var(--ds-danger-fg);
  display: block; margin-top: 1px;
}
.validation-summary-errors {
  background: var(--ds-danger-bg);
  border: 0.5px solid var(--ds-danger-border);
  color: var(--ds-danger-fg);
  border-radius: var(--ds-radius);
  padding: 10px 12px; font-size: 12.5px; margin: 0 0 4px;
}
.validation-summary-errors ul { margin: 0; padding-left: 16px; }
.validation-summary-valid { display: none; }

/* ---------- buttons ---------- */
.btn {
  height: 38px; border-radius: var(--ds-radius);
  font: inherit; font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  cursor: pointer; width: 100%;
  border: 0.5px solid transparent; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, filter .15s;
}
.btn:focus-visible { outline: 2px solid var(--ds-brand); outline-offset: 2px; }
.btn-brand { background: var(--ds-brand); color: var(--ds-on-brand); }
.btn-brand:hover { filter: brightness(1.05); }
.btn-ghost {
  background: transparent; border-color: var(--ds-border-strong);
  color: var(--ds-text-muted);
}
.btn-ghost:hover { background: var(--ds-control-hover); color: var(--ds-text); }
.btn-danger {
  background: var(--ds-danger-bg); color: var(--ds-danger-fg);
  border-color: var(--ds-danger-border);
}
.btn-sm { height: 30px; width: auto; padding: 0 14px; font-size: 12px; }

/* ---------- checkbox row ---------- */
.auth-check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ds-text-muted); cursor: pointer; user-select: none; }
.auth-check input { width: 15px; height: 15px; accent-color: var(--ds-brand); margin: 0; }
.btn + .btn { margin-top: 8px; }
.mt { margin-top: 20px; }

/* ---------- divider / social ---------- */
.auth-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0; color: var(--ds-text-faint); font-size: 11.5px;
}
.auth-divider::before, .auth-divider::after {
  content: ""; height: 0.5px; background: var(--ds-border); flex: 1;
}
.auth-social { display: flex; gap: 8px; }
.auth-social .btn { gap: 8px; }
.auth-social svg { width: 16px; height: 16px; }

/* ---------- links / footer ---------- */
a.auth-link, .auth-field label .aux a, .auth-foot a {
  color: var(--ds-accent-text); font-weight: 500; text-decoration: none;
}
a.auth-link:hover, .auth-foot a:hover { text-decoration: underline; }
.auth-foot {
  text-align: center; font-size: 12.5px; color: var(--ds-text-muted); margin-top: 20px;
}
.auth-back {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--ds-text-muted); text-decoration: none; margin-bottom: 4px;
}
.auth-back:hover { color: var(--ds-text); }
.auth-back svg { width: 15px; height: 15px; }
.auth-terms { font-size: 11.5px; color: var(--ds-text-faint); text-align: center; margin: 12px 0 0; line-height: 1.5; }
.auth-terms a { color: var(--ds-text-muted); text-decoration: underline; }

/* ---------- status screens (sent / success / locked) ---------- */
.auth-status-ic {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 2px auto 0; background: var(--ds-accent-bg); color: var(--ds-accent-text);
}
.auth-status-ic.ok   { background: var(--ds-ok-bg);     color: var(--ds-ok-fg); }
.auth-status-ic.warn { background: var(--ds-danger-bg); color: var(--ds-danger-fg); }
.auth-status-ic svg { width: 24px; height: 24px; }
.auth-center { text-align: center; }

/* ---------- one-time-code inputs ---------- */
.auth-otp { display: flex; gap: 8px; justify-content: center; margin-top: 22px; }
.auth-otp input {
  width: 40px; height: 46px; text-align: center;
  font-size: 19px; font-weight: 500; color: var(--ds-text);
  background: var(--ds-input-bg);
  border: 0.5px solid var(--ds-border); border-radius: var(--ds-radius);
}
.auth-otp input:focus {
  outline: none; border-color: var(--ds-brand);
  background: var(--ds-surface); box-shadow: 0 0 0 3px var(--ds-control-hover);
}

/* ---------- consent / scopes ---------- */
.auth-appreq { display: flex; align-items: center; gap: 10px; justify-content: center; margin: 0 0 4px; }
.auth-appreq .a {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--ds-accent-bg); color: var(--ds-accent-text);
  display: flex; align-items: center; justify-content: center;
}
.auth-appreq .link { color: var(--ds-text-faint); display: flex; }
.auth-scopes {
  display: flex; flex-direction: column;
  margin-top: 18px; border: 0.5px solid var(--ds-border);
  border-radius: 10px; overflow: hidden;
}
.auth-scope {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; background: var(--ds-panel); font-size: 12.5px; color: var(--ds-text);
}
.auth-scope + .auth-scope { border-top: 0.5px solid var(--ds-border); }
.auth-scope .ic { color: var(--ds-accent-text); display: flex; flex: 0 0 auto; }
.auth-scope small { display: block; color: var(--ds-text-faint); font-size: 11px; margin-top: 1px; }

/* ---------- manage / account rows ---------- */
.auth-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--ds-accent-bg); color: var(--ds-accent-text);
  font-weight: 600; font-size: 16px;
  display: flex; align-items: center; justify-content: center; margin: 2px auto 0;
}
.auth-rows { margin-top: 16px; }
.auth-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 2px; border-top: 0.5px solid var(--ds-border);
  color: var(--ds-text); text-decoration: none;
}
.auth-row:first-child { border-top: none; }
.auth-row .ic {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--ds-panel); color: var(--ds-text-muted);
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.auth-row .t { font-size: 13px; font-weight: 500; }
.auth-row .t small { display: block; font-weight: 400; color: var(--ds-text-faint); font-size: 11.5px; margin-top: 2px; }
.auth-row .chev { margin-left: auto; color: var(--ds-text-faint); display: flex; }
.auth-pill { margin-left: auto; font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 999px; }
.auth-pill.on  { background: var(--ds-ok-bg);     color: var(--ds-ok-fg); }
.auth-pill.off { background: var(--ds-sunken);    color: var(--ds-text-muted); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media (max-width: 700px) {
  .auth-product-sidebar { display: none; }
  .auth-product-search { margin-left: auto; width: 30vw; }
  .auth-product-action { display: none; }
  .auth-product-content { padding: 28px 20px; }
  .auth-product-cards { grid-template-columns: 1fr; }
  .auth-product-cards span:nth-child(n+2) { display: none; }
  .auth-dialog-layer { padding: 20px 12px; }
}
