/* KrazePlanet Security: sign-in, sign-up and account pages */
:root {
  --bg: #070b14;
  --panel: #0a1120;
  --field: #0b1324;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.26);
  --text: #cbd5e1;
  --heading: #f8fafc;
  --muted: #94a3b8;
  --faint: #64748b;
  --accent: #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-ink: #03111d;
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.08);
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.08);
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
[hidden] { display: none !important; }

/* ---- Layout ------------------------------------------------------------ */
/* Form first (left, wider), brand panel on the right */
.auth { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); min-height: 100vh; }

.brand-panel {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 56px 96px;
  background:
    radial-gradient(600px 400px at 15% 10%, rgba(56, 189, 248, 0.14), transparent 70%),
    radial-gradient(500px 400px at 90% 90%, rgba(99, 102, 241, 0.12), transparent 70%),
    var(--panel);
  border-left: 1px solid var(--border);
}
.brand-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%);
  pointer-events: none;
}
.brand-panel > * { position: relative; }

.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--heading); text-decoration: none; letter-spacing: -0.01em; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  color: #fff;
}
.logo-mark svg { width: 18px; height: 18px; }

.pitch { max-width: 440px; }
.pitch h2 { margin: 0 0 14px; font-size: 34px; line-height: 1.15; letter-spacing: -0.025em; color: var(--heading); font-weight: 700; }
.pitch p { margin: 0 0 32px; color: var(--muted); font-size: 16px; }
.features { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.features li { display: flex; gap: 12px; align-items: flex-start; color: var(--text); }
.features svg { flex: none; width: 20px; height: 20px; margin-top: 1px; color: var(--accent); }
.brand-foot { position: absolute; left: 56px; bottom: 40px; font-size: 13px; color: var(--faint); }

.form-side { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.form-wrap { width: 100%; max-width: 400px; }
.form-logo { margin-bottom: 40px; }

/* ---- Typography -------------------------------------------------------- */
.context {
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 24px; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 13px; color: var(--muted);
}
.context strong { color: var(--heading); font-weight: 600; }
.context .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
h1 { margin: 0 0 6px; font-size: 26px; line-height: 1.25; letter-spacing: -0.02em; color: var(--heading); font-weight: 700; }
.sub { margin: 0 0 28px; color: var(--muted); }
.sub strong { color: var(--heading); font-weight: 600; word-break: break-all; }

/* ---- Forms ------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
label { font-size: 13.5px; font-weight: 500; color: var(--text); }
.input {
  width: 100%; height: 44px; padding: 0 14px;
  background: var(--field);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--heading);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--faint); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px var(--field) inset; -webkit-text-fill-color: var(--heading); }

.pw { position: relative; }
.pw .input { padding-right: 46px; }
.pw-toggle {
  position: absolute; top: 6px; right: 6px;
  width: 32px; height: 32px; padding: 0;
  display: grid; place-items: center;
  border: 0; border-radius: 6px; background: transparent;
  color: var(--faint); cursor: pointer;
}
.pw-toggle:hover { color: var(--text); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); }
.pw-toggle svg { width: 18px; height: 18px; }

.hint { margin-top: 6px; font-size: 12.5px; color: var(--faint); }
.hint.pw-rule { margin: -8px 0 8px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 8px; }
.meter span { height: 4px; border-radius: 2px; background: rgba(148, 163, 184, 0.18); transition: background 0.2s; }
.meter[data-score="1"] span:nth-child(-n+1) { background: var(--danger); }
.meter[data-score="2"] span:nth-child(-n+2) { background: #fbbf24; }
.meter[data-score="3"] span:nth-child(-n+3) { background: var(--accent); }
.meter[data-score="4"] span { background: var(--success); }

.code { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 20px; }
.code input {
  width: 100%; height: 54px; padding: 0;
  text-align: center; font: 600 22px ui-monospace, "SFMono-Regular", Consolas, monospace;
  background: var(--field); color: var(--heading);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
}
.code input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18); }

/* ---- Buttons & links --------------------------------------------------- */
.btn {
  width: 100%; height: 44px; margin-top: 8px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink);
  font-family: inherit; font-size: 15px; font-weight: 600; line-height: 1;
  cursor: pointer; transition: background 0.15s;
  text-decoration: none;
}
.btn:hover { background: var(--accent-hover); }
.btn:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 2px; }
.btn:disabled { opacity: 0.75; cursor: progress; }
.btn.secondary { background: transparent; color: var(--heading); border: 1px solid var(--border-strong); }
.btn.secondary:hover { background: rgba(148, 163, 184, 0.08); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid rgba(248, 113, 113, 0.35); }
.btn.danger:hover { background: var(--danger-bg); }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.link, .linkbtn { color: var(--accent); text-decoration: none; font-weight: 500; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-weight: 500; cursor: pointer; }
.link:hover, .linkbtn:hover { text-decoration: underline; }
.linkbtn:disabled { color: var(--faint); cursor: default; text-decoration: none; }
.small-link { font-size: 13px; }

.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 24px; color: var(--muted); font-size: 14px; }
.back svg { width: 16px; height: 16px; }
.foot { margin-top: 24px; text-align: center; color: var(--muted); font-size: 14px; }
.legal { margin-top: 40px; text-align: center; color: var(--faint); font-size: 12px; }

.alert { display: none; gap: 10px; align-items: flex-start; margin-bottom: 18px; padding: 10px 12px; border-radius: var(--radius); font-size: 14px; }
.alert.show { display: flex; }
.alert.error { background: var(--danger-bg); border: 1px solid rgba(248, 113, 113, 0.3); color: #fecaca; }
.alert.success { background: var(--success-bg); border: 1px solid rgba(52, 211, 153, 0.3); color: #a7f3d0; }

/* ---- Account page ------------------------------------------------------ */
.page { max-width: 760px; margin: 0 auto; padding: 32px 20px 64px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32px; }
.topbar .btn { width: auto; height: 38px; margin: 0; padding: 0 16px; font-size: 14px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 24px; margin-bottom: 16px; }
.card h2 { margin: 0 0 4px; font-size: 16px; color: var(--heading); font-weight: 600; }
.card .sub { margin-bottom: 18px; font-size: 14px; }
.profile { display: flex; align-items: center; gap: 16px; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--field); border: 1px solid var(--border); }
.profile .name { font-size: 18px; font-weight: 600; color: var(--heading); }
.profile .meta { font-size: 14px; color: var(--muted); }
.sites { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.sites li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; }
.sites .when { color: var(--faint); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card .btn { width: auto; padding: 0 18px; }

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; }
  .brand-panel { display: none; }
  .form-side { align-items: flex-start; padding-top: 40px; }
}
@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .row { grid-template-columns: 1fr; gap: 0; }
  .code { gap: 6px; }
  .code input { height: 48px; font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 0.01ms !important; }
}

.card label { display: block; margin-bottom: 6px; }
