:root {
  color-scheme: dark;
  --page-width: 900px;
  --background: #050816;
  --background-soft: #0b1020;
  --text: #f8fbff;
  --muted: rgba(214, 227, 255, .7);
  --faint: rgba(214, 227, 255, .46);
  --border: rgba(148, 163, 184, .18);
  --surface: rgba(8, 12, 26, .68);
  --surface-strong: rgba(12, 18, 34, .88);
  --blue: #60a5fa;
  --cyan: #22d3ee;
  --purple: #a78bfa;
  --pink: #f472b6;
  --green: #5ee4a3;
  --shadow: 0 32px 140px rgba(0, 0, 0, .52), 0 0 120px rgba(59, 130, 246, .1), inset 0 1px 0 rgba(255, 255, 255, .1);
  --display: "Space Grotesk", "Avenir Next", Inter, system-ui, sans-serif;
  --body: Inter, "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--background); }
body {
  min-height: 100vh; min-height: 100dvh; color: var(--text); font-family: var(--body); line-height: 1.55;
  background: radial-gradient(circle at top, rgba(96, 165, 250, .18), transparent 28%), radial-gradient(circle at 18% 20%, rgba(139, 92, 246, .2), transparent 24%), linear-gradient(180deg, #040814, #050816 52%, #0a0e1c);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); overflow-x: hidden; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.page-background { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.page-background::after { content: ""; position: absolute; inset: 0; opacity: .26; background-image: linear-gradient(rgba(96,165,250,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(167,139,250,.035) 1px, transparent 1px); background-size: 110px 110px; mask-image: radial-gradient(circle at center, #000 30%, transparent 88%); }
.ambient { position: absolute; width: 42rem; height: 42rem; border-radius: 50%; filter: blur(95px); opacity: .22; animation: drift 18s ease-in-out infinite alternate; }
.ambient-left { left: -22rem; top: -10rem; background: #2563eb; }
.ambient-right { right: -20rem; top: 5rem; background: #7c3aed; animation-delay: -9s; }
.noise { position: absolute; inset: 0; opacity: .035; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E"); }
.page { position: relative; z-index: 1; width: min(calc(100% - 2rem), var(--page-width)); min-height: 100dvh; margin: 0 auto; padding: 2rem 0 1.5rem; display: flex; flex-direction: column; }
.panel { border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(26px); -webkit-backdrop-filter: blur(26px); }
.panel.strong { background: linear-gradient(145deg, rgba(255,255,255,.055), transparent 42%), var(--surface-strong); }
.site-header { min-height: 5.5rem; border-radius: 999px; padding: .75rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .85rem; min-width: 0; text-decoration: none; }
.brand-orb { display: grid; place-items: center; width: 4rem; height: 4rem; border-radius: 50%; border: 1px solid rgba(255,255,255,.14); background: linear-gradient(140deg, rgba(255,255,255,.14), rgba(96,165,250,.14) 34%, rgba(139,92,246,.2) 72%), #0b1123; color: var(--cyan); font-family: var(--display); font-weight: 700; letter-spacing: -.06em; box-shadow: 0 18px 50px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.12); }
.brand-name { font-family: var(--display); font-size: clamp(1.12rem, 4vw, 1.45rem); font-weight: 700; background: linear-gradient(110deg, #fff, #b6d4ff 24%, var(--cyan) 50%, var(--blue) 68%, var(--purple)); background-size: 180% 180%; background-clip: text; -webkit-background-clip: text; color: transparent; animation: gradient 10s ease-in-out infinite; }
.back-link, .nav a, .nav-button { color: var(--muted); text-decoration: none; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.045); padding: .65rem .9rem; border-radius: 999px; transition: .2s ease; white-space: nowrap; }
.back-link:hover, .nav a:hover, .nav-button:hover, .nav a.active { color: #fff; border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.09); transform: translateY(-1px); }
.nav { display: flex; align-items: center; gap: .45rem; }
.nav form { margin: 0; }
.nav-button { cursor: pointer; }
.auth-shell { flex: 1; display: grid; grid-template-columns: minmax(0, .92fr) minmax(360px, 1fr); gap: clamp(2rem, 7vw, 5rem); align-items: center; padding: 5rem 1.25rem; }
.intro h1, .message-card h1 { margin: .35rem 0 1.05rem; font-family: var(--display); font-size: clamp(2.7rem, 7vw, 4.4rem); line-height: .98; letter-spacing: -.045em; }
.intro > p:last-child, .message-card > p:last-of-type { margin: 0; color: var(--muted); font-size: 1.02rem; max-width: 32rem; }
.intro.compact { padding: 4rem 1.25rem 2rem; }
.intro.compact h1 { font-size: clamp(2.6rem, 7vw, 4rem); }
.eyebrow { margin: 0; color: var(--cyan); font-size: .72rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.accent { display: inline; padding: .01em .12em; border-radius: .22em; }
.accent-blue { color: var(--blue); background: rgba(0,124,215,.12); }
.accent-purple { color: var(--purple); background: rgba(102,0,178,.12); }
.accent-pink { color: var(--pink); background: rgba(197,0,93,.12); }
.auth-card { border-radius: 1.75rem; padding: clamp(1.25rem, 4vw, 2rem); }
.form-stack { display: grid; gap: 1rem; }
.form-stack label, .add-passkey label { display: grid; gap: .42rem; color: var(--muted); font-size: .8rem; font-weight: 600; letter-spacing: .025em; }
.form-stack label > small { color: var(--faint); font-weight: 400; }
input { width: 100%; min-height: 3rem; color: #fff; border: 1px solid rgba(255,255,255,.13); border-radius: .8rem; outline: none; padding: .7rem .85rem; background: rgba(3,7,18,.62); box-shadow: inset 0 1px 0 rgba(255,255,255,.025); transition: border-color .18s, box-shadow .18s, background .18s; }
input:focus { border-color: rgba(96,165,250,.7); background: rgba(5,10,24,.85); box-shadow: 0 0 0 3px rgba(96,165,250,.12); }
.button { min-height: 3.25rem; display: inline-flex; align-items: center; justify-content: center; gap: .7rem; border-radius: .9rem; border: 1px solid rgba(255,255,255,.15); padding: .7rem 1rem; color: #fff; text-decoration: none; font-weight: 650; cursor: pointer; transition: transform .2s var(--ease), box-shadow .2s, border-color .2s, background .2s; }
.button:hover { transform: translateY(-2px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button-primary { background: linear-gradient(120deg, #2563eb, #6d4dd5 66%, #7c3aed); box-shadow: 0 12px 36px rgba(59,130,246,.18), inset 0 1px 0 rgba(255,255,255,.2); }
.button-primary:hover { box-shadow: 0 16px 44px rgba(59,130,246,.28), inset 0 1px 0 rgba(255,255,255,.23); }
.button-secondary { background: rgba(255,255,255,.06); }
.button-secondary:hover { border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.1); }
.button-passkey { width: 100%; justify-content: flex-start; text-align: left; background: linear-gradient(110deg, rgba(34,211,238,.09), rgba(96,165,250,.1) 55%, rgba(167,139,250,.11)); padding: .85rem; }
.button-passkey > span:nth-child(2) { display: grid; line-height: 1.25; flex: 1; }
.button-passkey small { color: var(--muted); font-size: .72rem; font-weight: 450; margin-top: .22rem; }
.key-icon, .device-icon { width: 2.35rem; height: 2.35rem; display: grid; place-items: center; flex: none; border-radius: .7rem; color: var(--cyan); background: rgba(34,211,238,.1); font-size: 1.25rem; }
.arrow { margin-left: auto; color: #dbeafe; }
.divider { height: 1px; margin: 1.6rem 0; background: rgba(255,255,255,.1); display: flex; justify-content: center; align-items: center; }
.divider span { padding: 0 .65rem; background: #0c1222; color: var(--faint); font-size: .7rem; }
.form-note { margin: 1.35rem 0 0; color: var(--faint); font-size: .75rem; text-align: center; }
.flash { display: flex; align-items: flex-start; gap: .65rem; padding: .85rem 1rem; margin: 0 0 1.2rem; border: 1px solid; border-radius: .85rem; font-size: .84rem; }
.flash p { margin: 0; }
.flash-error { color: #fecdd3; border-color: rgba(244,114,182,.28); background: rgba(190,24,93,.12); }
.flash-success { color: #bbf7d0; border-color: rgba(94,228,163,.25); background: rgba(22,163,74,.1); }
.single-card { flex: 1; display: grid; place-items: center; padding: 4rem 1rem; }
.message-card { width: min(100%, 580px); border-radius: 1.75rem; padding: clamp(2rem, 7vw, 4rem); text-align: center; }
.message-card h1 { font-size: clamp(2.4rem, 7vw, 3.8rem); }
.success-mark, .error-mark { width: 4.2rem; height: 4.2rem; margin: 0 auto 1.5rem; display: grid; place-items: center; border-radius: 50%; font-size: 1.65rem; }
.success-mark { color: var(--green); background: rgba(94,228,163,.1); border: 1px solid rgba(94,228,163,.2); }
.error-mark { color: var(--pink); background: rgba(244,114,182,.1); border: 1px solid rgba(244,114,182,.2); }
.message-card .button { margin-top: 1.75rem; }
.dashboard { flex: 1; }
.dashboard > .flash { margin: 0 1.25rem 1rem; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; padding: 0 1.25rem 4rem; }
.span-two { grid-column: 1 / -1; }
.settings-card { min-width: 0; border-radius: 1.4rem; padding: 1.35rem; }
.settings-card h2, .invite-result h2 { margin: .2rem 0 .45rem; font-family: var(--display); font-size: 1.45rem; letter-spacing: -.025em; }
.section-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.count { display: grid; place-items: center; min-width: 2.2rem; height: 2.2rem; padding: 0 .6rem; border-radius: 999px; color: var(--cyan); background: rgba(34,211,238,.08); border: 1px solid rgba(34,211,238,.14); }
.section-copy { margin: 0 0 1.2rem; color: var(--muted); font-size: .84rem; }
.passkey-list, .user-list, .audit-list { display: grid; }
.passkey-row, .user-row { min-width: 0; display: flex; align-items: center; gap: .8rem; padding: .9rem 0; border-top: 1px solid rgba(255,255,255,.08); }
.passkey-row:first-child, .user-row:first-child { border-top: 0; }
.passkey-row > div:nth-child(2), .user-main { display: grid; min-width: 0; flex: 1; }
.passkey-row small, .user-row small, .audit-list small { color: var(--faint); font-size: .72rem; overflow-wrap: anywhere; }
.passkey-row form, .user-row form { display: flex; gap: .35rem; }
.text-button { border: 0; background: none; color: var(--blue); padding: .35rem; cursor: pointer; font-size: .74rem; }
.text-button:hover { color: #bfdbfe; text-decoration: underline; }
.text-button.danger { color: var(--pink); }
.empty-state { display: flex; align-items: center; justify-content: center; gap: .65rem; min-height: 5rem; color: var(--faint); text-align: center; }
.empty-state p { margin: 0; }
.add-passkey { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .75rem; align-items: end; border-top: 1px solid rgba(255,255,255,.08); padding-top: 1rem; margin-top: .2rem; }
.details { margin: 1rem 0 1.3rem; }
.details div { display: flex; justify-content: space-between; padding: .65rem 0; border-top: 1px solid rgba(255,255,255,.08); }
.details dt { color: var(--faint); font-size: .76rem; }
.details dd { margin: 0; font-size: .8rem; text-align: right; }
.compact-form { margin-top: 1rem; gap: .75rem; }
.compact-form input { min-height: 2.7rem; }
.invite-result { margin: 0 1.25rem 1rem; padding: 1.35rem; border-radius: 1.4rem; display: grid; grid-template-columns: .8fr 1.2fr; gap: 1rem; align-items: center; }
.invite-result p { margin: 0; color: var(--muted); font-size: .8rem; }
.copy-field { display: flex; gap: .55rem; }
.copy-field input { font-family: ui-monospace, monospace; font-size: .72rem; }
.copy-field .button { flex: none; }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 4rem; }
.input-suffix span { position: absolute; right: .85rem; top: .77rem; color: var(--faint); font-weight: 400; }
.avatar { width: 2.3rem; height: 2.3rem; flex: none; display: grid; place-items: center; border-radius: 50%; color: var(--purple); background: rgba(167,139,250,.1); }
.audit-list > div { display: flex; align-items: flex-start; gap: .8rem; padding: .75rem 0; border-top: 1px solid rgba(255,255,255,.07); }
.audit-list > div:first-child { border-top: 0; }
.audit-list p { display: grid; margin: 0; font-size: .82rem; }
.audit-dot { width: .45rem; height: .45rem; margin-top: .45rem; flex: none; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px rgba(34,211,238,.45); }
.footer { min-height: 2rem; display: flex; justify-content: space-between; gap: 1rem; color: var(--faint); font-size: .68rem; padding: .5rem 1.25rem 0; }
.status { display: inline-flex; align-items: center; gap: .42rem; }
.status i { width: .42rem; height: .42rem; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(94,228,163,.5); }

@keyframes drift { to { transform: translate3d(3rem, 2rem, 0) scale(1.08); } }
@keyframes gradient { 50% { background-position: 100% 50%; } }

@media (max-width: 760px) {
  .page { width: min(calc(100% - 1rem), var(--page-width)); padding-top: .5rem; }
  .site-header { min-height: 4.5rem; padding: .45rem .55rem; }
  .brand-orb { width: 3.55rem; height: 3.55rem; }
  .brand-name { font-size: 1rem; }
  .back-link { padding: .55rem .7rem; font-size: .78rem; }
  .nav { gap: .25rem; }
  .nav a, .nav-button { padding: .53rem .62rem; font-size: .72rem; }
  .auth-shell { grid-template-columns: 1fr; padding: 3.2rem .5rem 3.5rem; gap: 2.2rem; }
  .intro h1 { font-size: clamp(2.8rem, 14vw, 4rem); }
  .dashboard-grid { grid-template-columns: 1fr; padding: 0 .5rem 3rem; }
  .span-two { grid-column: auto; }
  .intro.compact { padding: 3.2rem .5rem 1.7rem; }
  .dashboard > .flash, .invite-result { margin-left: .5rem; margin-right: .5rem; }
  .invite-result { grid-template-columns: 1fr; }
  .copy-field { display: grid; }
  .add-passkey { grid-template-columns: 1fr; }
  .user-row { flex-wrap: wrap; }
  .user-row form { width: 100%; justify-content: flex-end; }
  .footer { padding-left: .55rem; padding-right: .55rem; }
}

@media (max-width: 430px) {
  .brand-name { max-width: 9.3rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav a { display: none; }
  .auth-card { border-radius: 1.35rem; }
  .passkey-row { align-items: flex-start; flex-wrap: wrap; }
  .passkey-row form { width: 100%; justify-content: flex-end; }
  .footer { flex-direction: column; align-items: center; gap: .2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
