/*
 * Kingdom ID sign-in experience. Built on the Kingdom Web Builders tokens
 * (packages/brand/css/tokens.css): navy ink, electric blue, aqua and iris.
 *
 * Layout: brand story beside the card from 960px up; below that, a compact
 * brand header, the card, then the story's points. Motion is transform-only
 * and switched off entirely under prefers-reduced-motion.
 */

@font-face {
  font-family: "Inter Variable";
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader Variable";
  src: url("/fonts/newsreader-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader Variable";
  src: url("/fonts/newsreader-latin-wght-italic.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

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

html {
  font-family: var(--font-sans);
  font-feature-settings: "cv11", "ss01", "ss03";
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  line-height: 1.5;
}

a {
  color: var(--accent-text);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 10;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

.skip-link:focus {
  top: 16px;
}

.icon {
  flex: none;
  width: 20px;
  height: 20px;
}

/* ------------------------------------------------------------------ */
/* Shell                                                               */
/* ------------------------------------------------------------------ */

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

@media (min-width: 960px) {
  .auth {
    grid-template-columns: minmax(400px, 44%) minmax(0, 1fr);
  }
}

/* ------------------------------------------------------------------ */
/* Brand story: always dark, whatever the page theme                   */
/* ------------------------------------------------------------------ */

.story {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  color: #fff;
  background: #060a1a;
  padding: 24px 16px 28px;
}

@media (min-width: 960px) {
  .story {
    position: sticky;
    top: 0;
    height: 100dvh;
    padding: 56px clamp(40px, 5vw, 72px);
  }
}

.aurora {
  position: absolute;
  inset: 0;
  z-index: -1;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.75;
  will-change: transform;
}

.blob-a {
  width: 70%;
  aspect-ratio: 1;
  left: -20%;
  top: -25%;
  background: radial-gradient(circle, rgb(16 121 255 / 0.85), transparent 65%);
  animation: aurora-a 19s ease-in-out infinite;
}

.blob-b {
  width: 60%;
  aspect-ratio: 1;
  right: -25%;
  top: 15%;
  background: radial-gradient(circle, rgb(34 211 238 / 0.55), transparent 65%);
  animation: aurora-b 24s ease-in-out infinite;
}

.blob-c {
  width: 75%;
  aspect-ratio: 1;
  left: 5%;
  bottom: -45%;
  background: radial-gradient(circle, rgb(0 70 199 / 0.8), transparent 65%);
  animation: aurora-c 29s ease-in-out infinite;
}

.blob-d {
  width: 55%;
  aspect-ratio: 1;
  right: -10%;
  bottom: -15%;
  background: radial-gradient(circle, rgb(110 91 255 / 0.6), transparent 65%);
  animation: aurora-d 34s ease-in-out infinite;
}

.grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgb(255 255 255 / 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 0.05) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 70% at 30% 40%, #000 30%, transparent 75%);
}

@keyframes aurora-a {
  0%,
  100% {
    transform: translate3d(-6%, -3%, 0) scale(1);
  }
  50% {
    transform: translate3d(7%, 5%, 0) scale(1.14);
  }
}

@keyframes aurora-b {
  0%,
  100% {
    transform: translate3d(5%, 4%, 0) scale(1.08);
  }
  50% {
    transform: translate3d(-8%, -6%, 0) scale(0.94);
  }
}

@keyframes aurora-c {
  0%,
  100% {
    transform: translate3d(0, 6%, 0) scale(0.96);
  }
  50% {
    transform: translate3d(-6%, -5%, 0) scale(1.1);
  }
}

@keyframes aurora-d {
  0%,
  100% {
    transform: translate3d(4%, -2%, 0) scale(1);
  }
  33% {
    transform: translate3d(-9%, 4%, 0) scale(1.16);
  }
  66% {
    transform: translate3d(6%, 7%, 0) scale(0.92);
  }
}

.story-inner {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 34rem;
}

@media (min-width: 960px) {
  .story-inner {
    height: 100%;
    justify-content: space-between;
    gap: 40px;
  }
}

.story-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
}

.story-brand img {
  width: 54px;
  height: auto;
}

.story-brand strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.story-brand small {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-300);
}

.story-headline {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 450;
  font-size: clamp(1.9rem, 4.2vw, 3.6rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.story-headline em {
  font-style: italic;
  color: var(--aqua-400);
  background: linear-gradient(100deg, #8ff3ff 0%, #38bdf8 45%, #b9a9ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.story-points li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  font-size: 0.95rem;
  line-height: 1.5;
}

.story-points .icon {
  width: 38px;
  height: 38px;
  padding: 9px;
  border-radius: 12px;
  background: rgb(255 255 255 / 0.08);
  border: 1px solid rgb(255 255 255 / 0.12);
  color: var(--aqua-300, #67e8f9);
}

.story-points-panel span {
  color: var(--ink-300);
}

.story-points-panel strong {
  color: #fff;
}

/* Below the card on narrow screens; inside the panel on wide ones. */
.story-points-panel {
  display: none;
}

@media (min-width: 960px) {
  .story-points-panel {
    display: grid;
  }
  .story-points-stacked {
    display: none;
  }
}

.story-points-stacked {
  width: 100%;
  max-width: 28rem;
  margin-top: 28px;
  color: var(--text-muted);
}

.story-points-stacked strong {
  color: var(--text);
}

.story-points-stacked .icon {
  color: var(--accent-text);
  background: var(--surface);
  border-color: var(--border);
}

/* ------------------------------------------------------------------ */
/* Stage and card                                                      */
/* ------------------------------------------------------------------ */

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px 24px;
  background:
    radial-gradient(48rem 32rem at 100% 0%, rgb(16 121 255 / 0.08), transparent 60%),
    radial-gradient(40rem 30rem at 0% 100%, rgb(110 91 255 / 0.07), transparent 60%),
    var(--bg);
}

@media (min-width: 960px) {
  .stage {
    padding: 48px 32px 32px;
  }
}

.card {
  width: 100%;
  max-width: 28rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: clamp(24px, 5vw, 40px);
  box-shadow:
    0 1px 1px rgb(10 15 36 / 0.04),
    0 10px 24px -8px rgb(10 15 36 / 0.1),
    0 36px 72px -28px rgb(10 15 36 / 0.25);
}

.card-wide {
  max-width: 36rem;
}

.cobrand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  min-width: 0;
}

/* The Kingdom tile carries the same weight as the app's tile beside it. */
.cobrand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(140deg, var(--brand-900), var(--brand-500));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.18);
}

.cobrand-mark img {
  width: 30px;
  height: auto;
}

.cobrand-link {
  color: var(--text-muted);
  display: inline-flex;
}

.cobrand-link .icon {
  width: 16px;
  height: 16px;
}

.cobrand-app {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  object-fit: cover;
  flex: none;
}

.cobrand-initial {
  display: grid;
  place-items: center;
  font-weight: 650;
  font-size: 1.1rem;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-500), var(--iris-600));
}

.cobrand-name {
  font-weight: 600;
  margin-left: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

h1 {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(1.7rem, 4vw, 2.1rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.lede {
  margin: 0 0 24px;
  color: var(--text-muted);
}

.subhead {
  margin: 28px 0 10px;
  font-size: 0.75rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  /* Colors switch instantly: animating background under already-white text
     would briefly fail contrast. Only motion and depth ease. */
  transition:
    transform 220ms var(--ease-premium),
    box-shadow 220ms var(--ease-premium);
}

.btn-primary {
  color: #fff;
  background-color: var(--brand-500);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.18),
    0 1px 2px rgb(0 84 238 / 0.12),
    0 12px 28px -12px rgb(0 84 238 / 0.55);
}

.btn-primary:hover {
  background-color: var(--brand-600);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.2),
    0 2px 6px rgb(0 84 238 / 0.16),
    0 20px 40px -14px rgb(34 211 238 / 0.45);
}

.btn-secondary {
  color: var(--text);
  background: transparent;
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--surface-raised);
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  cursor: progress;
  opacity: 0.65;
  transform: none;
}

.btn-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.btn-icon:hover {
  color: var(--error-text);
  border-color: var(--border);
}

/* ------------------------------------------------------------------ */
/* Forms and the email fallback                                        */
/* ------------------------------------------------------------------ */

.fields {
  display: grid;
  gap: 6px;
}

label {
  margin-top: 12px;
  font-size: 0.875rem;
  font-weight: 600;
}

input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  font: inherit;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

input[aria-invalid="true"] {
  border-color: var(--error-text);
}

.fields .btn {
  margin-top: 18px;
}

.fields > .btn-primary[data-passkey] {
  margin-top: 22px;
}

.hint {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.field-error {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--error-text);
}

.fallback {
  margin-top: 20px;
}

.fallback > summary {
  display: flex;
  align-items: center;
  gap: 14px;
  list-style: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent-text);
}

.fallback > summary::-webkit-details-marker {
  display: none;
}

.fallback > summary::before,
.fallback > summary::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.fallback[open] > summary {
  color: var(--text-muted);
}

/* ------------------------------------------------------------------ */
/* Notes and messages                                                  */
/* ------------------------------------------------------------------ */

.trust,
.notice,
.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
}

.trust {
  margin: 22px 0 0;
  color: var(--text);
  background: color-mix(in srgb, var(--aqua-400) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--aqua-400) 28%, transparent);
}

.trust .icon {
  color: var(--accent-text);
}

.notice {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

.alert {
  display: block;
  color: var(--error-text);
  background: color-mix(in srgb, var(--error-text) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--error-text) 40%, transparent);
}

.switch {
  margin: 26px 0 0;
  text-align: center;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.footnote {
  margin: 18px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.message {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.message .icon {
  width: 28px;
  height: 28px;
  color: var(--accent-text);
}

.message-error .icon {
  color: var(--error-text);
}

.message h1 {
  margin: 0;
}

/* ------------------------------------------------------------------ */
/* Consent                                                             */
/* ------------------------------------------------------------------ */

.account-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 4px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
}

.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  font-weight: 650;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-500), var(--iris-600));
}

.account-chip-text {
  display: grid;
  min-width: 0;
  font-size: 0.9rem;
  line-height: 1.3;
}

.account-chip-text span {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-chip-switch {
  margin-left: auto;
  font-size: 0.85rem;
  white-space: nowrap;
}

.grants,
.passkeys {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.grants li,
.passkeys li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.grants .icon,
.passkeys .icon {
  width: 36px;
  height: 36px;
  padding: 8px;
  border-radius: 11px;
  color: var(--accent-text);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.grants li > span,
.passkey-text {
  display: grid;
  min-width: 0;
  line-height: 1.35;
}

.grants li > span > span,
.passkey-text > span {
  font-size: 0.875rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.passkeys li {
  align-items: center;
}

.passkeys form {
  margin-left: auto;
}

.passkeys + .btn,
.hint + .btn {
  margin-top: 16px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 28px;
}

.signout {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* ------------------------------------------------------------------ */
/* Footer                                                              */
/* ------------------------------------------------------------------ */

.legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  margin-top: 32px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.legal-links {
  display: inline-flex;
  gap: 16px;
}

/* ------------------------------------------------------------------ */
/* Your Kingdom dashboard                                              */
/* ------------------------------------------------------------------ */

.dash-header {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  color: #fff;
  background: #060a1a;
}

.dash-bar,
.dash-hero,
.dash-nav {
  width: 100%;
  max-width: 68rem;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

@media (min-width: 720px) {
  .dash-bar,
  .dash-hero,
  .dash-nav {
    padding-left: 32px;
    padding-right: 32px;
  }
}

.dash-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 18px;
  padding-bottom: 18px;
}

.dash-header-compact .dash-bar {
  padding-top: 20px;
  padding-bottom: 20px;
}

.dash-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
}

.dash-brand strong {
  display: block;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.dash-brand small {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-300);
}

.dash-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* Phones: the avatar and Sign out are enough; the subtitle and name come back with room. */
@media (max-width: 479px) {
  .dash-brand small {
    display: none;
  }
  .dash-bar {
    gap: 10px;
  }
  .dash-user {
    gap: 8px;
  }
  .btn-ghost {
    padding: 0 12px;
  }
}

.dash-user-text {
  display: none;
  line-height: 1.25;
  font-size: 0.875rem;
}

.dash-user-text span {
  display: block;
  color: var(--ink-300);
}

@media (min-width: 720px) {
  .dash-user-text {
    display: block;
  }
}

.dash-admin {
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
}

.btn-ghost {
  min-height: 40px;
  padding: 0 16px;
  white-space: nowrap;
  color: #fff;
  background: rgb(255 255 255 / 0.06);
  border-color: rgb(255 255 255 / 0.18);
}

.btn-ghost:hover {
  background: rgb(255 255 255 / 0.12);
}

.dash-hero {
  padding-top: 12px;
  padding-bottom: 20px;
}

.dash-greeting {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 450;
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.dash-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  color: var(--ink-300);
}

.dash-stats strong {
  color: #fff;
}

.dash-nav {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.dash-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 12px 14px 14px;
  color: var(--ink-300);
  font-weight: 550;
  font-size: 0.95rem;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.dash-nav a:hover {
  color: #fff;
}

.dash-nav a[aria-current="page"] {
  color: #fff;
  border-bottom-color: var(--aqua-400);
}

.dash-nav .icon {
  width: 18px;
  height: 18px;
}

.dash-main {
  width: 100%;
  max-width: 68rem;
  margin: 0 auto;
  padding: 32px 16px 16px;
}

@media (min-width: 720px) {
  .dash-main {
    padding: 40px 32px 24px;
  }
}

.dash-section-head {
  margin-bottom: 24px;
}

.dash-section-head .lede {
  margin-bottom: 0;
}

.dash-legal {
  padding: 8px 16px 32px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 1px 1px rgb(10 15 36 / 0.03), 0 12px 28px -18px rgb(10 15 36 / 0.25);
}

.panel + .panel {
  margin-top: 16px;
}

/* Grids space their own items. */
:is(.realms, .perks, .masks, .admin-perks) > .panel {
  margin-top: 0;
}

.panel-title {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-family: var(--font-sans);
}

.panel h2,
.panel h3 {
  font-family: var(--font-sans);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-text);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.85em;
  overflow-wrap: anywhere;
}

.btn-small {
  min-height: 38px;
  padding: 0 14px;
  font-size: 0.875rem;
}

.btn-danger {
  color: var(--error-text);
  background: transparent;
  border-color: color-mix(in srgb, var(--error-text) 45%, transparent);
}

.btn-danger:hover {
  background: color-mix(in srgb, var(--error-text) 10%, transparent);
}

.empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 48px 20px;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: 20px;
  color: var(--text-muted);
}

.empty .icon {
  width: 40px;
  height: 40px;
  color: var(--accent-text);
}

.empty h2 {
  margin: 6px 0 0;
  font-size: 1.15rem;
  color: var(--text);
  font-family: var(--font-sans);
}

.empty p {
  margin: 0;
  max-width: 32rem;
}

/* Realms */

.realms,
.perks,
.masks,
.admin-perks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}

@media (min-width: 860px) {
  .realms,
  .perks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.realm {
  display: flex;
  flex-direction: column;
}

.realm-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.realm-title {
  min-width: 0;
}

.realm-title h2 {
  margin: 0;
  font-size: 1.15rem;
}

.realm-title p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 2px 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.realm-used {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.realm-used .icon {
  width: 16px;
  height: 16px;
}

.realm .subhead {
  margin-top: 18px;
}

.claims {
  display: grid;
  gap: 8px;
  margin: 0;
}

.claims div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--surface-raised);
  font-size: 0.9rem;
}

.claims dt {
  color: var(--text-muted);
}

.claims dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.realm-actions {
  margin-top: auto;
  padding-top: 18px;
}

/* Treasury */

.perk {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.perk > .icon {
  width: 42px;
  height: 42px;
  padding: 10px;
  border-radius: 13px;
  color: var(--accent-text);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.perk-unlocked {
  border-color: color-mix(in srgb, var(--iris-600) 40%, var(--border));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--iris-600) 10%, transparent), transparent 60%),
    var(--surface);
}

.perk-unlocked > .icon {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-500), var(--iris-600));
}

.perk h2,
.perk h3 {
  margin: 0;
  font-size: 1.05rem;
}

.perk p {
  margin: 4px 0 0;
}

.perk-from {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.perks-locked .perk > .icon {
  color: var(--text-muted);
  background: var(--surface-raised);
}

/* Masks */

.panel-callout {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
  border-color: color-mix(in srgb, var(--aqua-400) 35%, var(--border));
}

.panel-callout > .icon {
  width: 28px;
  height: 28px;
  color: var(--accent-text);
}

.panel-callout h2 {
  margin: 0;
  font-size: 1.05rem;
}

.panel-callout p {
  margin: 4px 0 0;
  color: var(--text-muted);
}

.mask {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.mask-body h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.mask-body p {
  margin: 2px 0 0;
  font-size: 0.9rem;
}

.mask-label {
  color: var(--text-muted);
}

.mask-none,
.mask-placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.badge-muted {
  color: var(--text-muted);
  background: var(--surface-raised);
}

.mask-body h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mask-address {
  margin: 4px 0 0;
  font-size: 0.95rem;
}

.mask-stats {
  color: var(--text-muted);
}

.panel-warning {
  border-color: color-mix(in srgb, var(--error-text) 40%, var(--border));
}

.panel-warning > .icon {
  color: var(--error-text);
}

.mask-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (min-width: 720px) {
  .mask {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
  }
  .mask-actions {
    grid-column: auto;
  }
}

/* Watchtower */

.timeline-day + .timeline-day {
  margin-top: 8px;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.event {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.event > .icon {
  width: 36px;
  height: 36px;
  padding: 8px;
  border-radius: 11px;
  color: var(--accent-text);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.event-alert {
  border-color: color-mix(in srgb, var(--error-text) 45%, var(--border));
}

.event-alert > .icon {
  color: var(--error-text);
  background: color-mix(in srgb, var(--error-text) 10%, transparent);
}

.event-title {
  margin: 0;
  font-weight: 550;
}

.event-meta {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

/* Admin */

select {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  font: inherit;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
}

select option {
  color: var(--ink);
}

.admin-perk-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.admin-perk h2 {
  margin: 0;
  font-size: 1.05rem;
}

.admin-perk p {
  margin: 6px 0 0;
}

.admin-perk-off {
  opacity: 0.75;
}

.admin-perk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.admin-grant {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}

.inline-field {
  display: flex;
  gap: 8px;
}

.inline-field .btn {
  margin-top: 0;
}

.pipeline-health {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin: 0 0 20px;
}

.pipeline-health div {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.pipeline-health dt {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pipeline-health dd {
  margin: 2px 0 0;
  font-size: 1.5rem;
  font-weight: 650;
}

.pipeline-health .health-bad {
  border-color: color-mix(in srgb, var(--error-text) 50%, var(--border));
}

.filter-links {
  color: var(--text-muted);
}

.filter-links a[aria-current="page"] {
  font-weight: 650;
  text-decoration: none;
  color: var(--text);
}

.admin-alerts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.admin-alerts > .panel {
  margin-top: 0;
}

.admin-alert p {
  margin: 8px 0 0;
}

.admin-alert form {
  margin-top: 12px;
}

.admin-alert-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.admin-alert-head time {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.severity {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  background: var(--surface-raised);
}

.severity-high,
.severity-critical {
  color: var(--error-text);
  background: color-mix(in srgb, var(--error-text) 12%, transparent);
}

.admin-alert.severity-critical {
  border-color: color-mix(in srgb, var(--error-text) 55%, var(--border));
}

.admin-create {
  margin-top: 24px;
  max-width: 36rem;
}

/* ------------------------------------------------------------------ */
/* Button builder (/brand)                                             */
/* ------------------------------------------------------------------ */

.brand-main h1 {
  font-family: var(--font-serif);
}

.builder {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

@media (min-width: 900px) {
  .builder {
    grid-template-columns: minmax(0, 20rem) minmax(0, 1fr);
  }
}

.builder-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
}

/* The grid spaces its own panels. */
.builder-result > .panel + .panel {
  margin-top: 0;
}

.brand-main > .panel {
  margin-top: 16px;
}

.builder-group {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.builder-group legend {
  margin-bottom: 6px;
  padding: 0;
  font-weight: 650;
}

.builder-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 8px 10px;
  border-radius: 12px;
  font-weight: 400;
  cursor: pointer;
}

.builder-choice:hover {
  background: var(--surface-raised);
}

.builder-choice input {
  flex: none;
  width: 18px;
  min-height: 0;
  height: 18px;
  margin: 1px 0 0;
  padding: 0;
  accent-color: var(--accent);
}

.builder-choice input:focus {
  box-shadow: none;
}

.builder-choice input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.builder-choice strong {
  display: block;
  font-weight: 600;
}

.builder-choice small {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.preview-surfaces {
  display: grid;
  gap: 12px;
}

@media (min-width: 600px) {
  .preview-surfaces {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.preview-surface {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 9.5rem;
  padding: 28px 20px 36px;
  position: relative;
  border-radius: 16px;
  border: 1px solid var(--border);
}

.preview-caption {
  position: absolute;
  left: 14px;
  bottom: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.preview-light {
  background: #ffffff;
  color: #3a4463;
}

.preview-dark {
  background: #0a0f24;
  color: #b6bdcd;
}

.brand-gallery .preview-surface {
  padding-bottom: 28px;
}

.steps {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin: 0 0 14px;
  padding-left: 1.25rem;
}

.steps p {
  margin: 0 0 8px;
}

.code-block {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--input-bg);
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 4px 6px 4px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.code-head .btn-small {
  min-height: 34px;
}

.code-block pre {
  margin: 0;
  padding: 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
}

.brand-main code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.rules {
  display: grid;
  gap: 8px 24px;
}

@media (min-width: 720px) {
  .rules {
    grid-template-columns: 1fr 1fr;
  }
}

.rules-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rules-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.rules-list .icon {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.rules-do .icon {
  color: var(--accent-text);
}

.rules-dont .icon {
  color: var(--error-text);
}

/* ------------------------------------------------------------------ */
/* Motion preferences                                                  */
/* ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .blob {
    animation: none;
  }
  .btn,
  input {
    transition: none;
  }
  .btn:hover {
    transform: none;
  }
}
