/* WisfluxID — family design system (shared tokens + auth screens).
   Fixed semantics: green=ok, amber=at-risk, red=error. Brand = primary action.
   Light + dark via prefers-color-scheme. Font: Inter w/ system fallback. */

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f172a;
  --muted: #475569;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-ink: #ffffff;
  --brand-soft: #eef2ff;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(15, 23, 42, .10), 0 2px 6px rgba(15, 23, 42, .06);
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020; --surface: #131a2b; --surface-2: #0f1626; --ink: #e8edf7;
    --muted: #9fb0cc; --faint: #6b7a98; --line: #243049; --brand: #818cf8;
    --brand-2: #a78bfa; --brand-ink: #0b1020; --brand-soft: #1b2440;
    --green: #34d399; --amber: #fbbf24; --red: #f87171; --red-soft: #2a1517;
    --shadow: 0 14px 40px rgba(0, 0, 0, .45);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--ink);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}

/* ---- auth layout ---- */
body.auth {
  display: grid; place-items: center; min-height: 100dvh; padding: 24px;
  background:
    radial-gradient(1100px 600px at 12% -10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, color-mix(in srgb, var(--brand-2) 20%, transparent), transparent 55%),
    var(--bg);
}
.auth-wrap { width: 100%; max-width: 412px; }
.auth-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 30px 30px 24px; animation: rise .35s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.hidden { display: none !important; }

/* ---- brand ---- */
.brand { display: flex; align-items: center; gap: 11px; margin-bottom: 4px; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  color: var(--brand-ink); background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 40%, transparent); flex: none;
}
.brand .name { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.auth-card h1 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin: 18px 0 4px; }
.auth-card .sub { color: var(--muted); font-size: 13.5px; margin: 0 0 18px; }

/* ---- form ---- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input {
  width: 100%; padding: 11px 12px; font-size: 15px; font-family: inherit; color: var(--ink);
  background: var(--surface-2); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--faint); }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.input.invalid { border-color: var(--red); }
.input.has-toggle { padding-right: 44px; }
.toggle {
  position: absolute; right: 6px; border: 0; background: transparent; cursor: pointer;
  color: var(--faint); font-size: 12px; font-weight: 600; padding: 6px 8px; border-radius: 6px;
}
.toggle:hover { color: var(--muted); background: var(--surface); }
.field .hint { font-size: 12px; color: var(--red); margin-top: 5px; min-height: 0; }

.row { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 18px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.link { color: var(--brand); font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; background: none; border: 0; }
.link:hover { text-decoration: underline; }

/* ---- buttons ---- */
.btn {
  width: 100%; padding: 12px 16px; font-size: 15px; font-weight: 650; font-family: inherit;
  border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; transition: filter .15s, opacity .15s;
}
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: var(--brand-ink); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn-ghost { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn .spinner {
  width: 16px; height: 16px; border: 2.5px solid color-mix(in srgb, currentColor 35%, transparent);
  border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- divider + sso ---- */
.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.pill { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); letter-spacing: .02em; }

/* ---- alert ---- */
.alert {
  display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; line-height: 1.4;
  padding: 11px 13px; border-radius: var(--radius-sm); margin-bottom: 16px;
  background: var(--red-soft); color: var(--red); border: 1px solid color-mix(in srgb, var(--red) 30%, transparent);
}
.alert.ok { background: color-mix(in srgb, var(--green) 12%, transparent); color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.alert .ico { flex: none; margin-top: 1px; }

/* ---- foot ---- */
.foot { margin-top: 18px; text-align: center; color: var(--faint); font-size: 11.5px; line-height: 1.5; }
.foot .lock { color: var(--green); }

/* ---- logged-in panel ---- */
.who { display: flex; align-items: center; gap: 12px; margin: 8px 0 16px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 700; color: var(--brand-ink); background: linear-gradient(135deg, var(--brand), var(--brand-2));
}
.who .nm { font-weight: 700; font-size: 15px; }
.who .em { color: var(--muted); font-size: 13px; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); margin-top: 3px; }
.banner { font-size: 13px; padding: 10px 12px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--amber) 14%, transparent); color: var(--amber); border: 1px solid color-mix(in srgb, var(--amber) 32%, transparent); margin-bottom: 14px; }
.dash-list { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.dash-list li a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; text-decoration: none;
  padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink); font-size: 14px; font-weight: 600; transition: border-color .15s;
}
.dash-list li a:hover { border-color: var(--brand); }
.dash-list .arrow { color: var(--faint); }
.dash-list .star { color: var(--amber); font-size: 12px; font-weight: 700; }

/* ---- password requirement checklist ---- */
.req-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; }
.req-list li { font-size: 12px; color: var(--faint); transition: color .15s; }
.req-list li.ok { color: var(--green); }
