:root {
  color-scheme: light;
  --background: #f4f7fb;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: rgba(255, 255, 255, 0.95);
  --surface-soft: rgba(255, 255, 255, 0.58);
  --text: #12202d;
  --text-muted: #617080;
  --border: rgba(20, 35, 50, 0.11);
  --border-strong: rgba(20, 35, 50, 0.17);
  --shadow: 0 28px 80px rgba(48, 71, 94, 0.16);
  --brand-a: #0ea5e9;
  --brand-b: #8b5cf6;
  --brand-c: #10b981;
  --focus: #0284c7;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #071018;
  --surface: rgba(12, 24, 35, 0.78);
  --surface-strong: rgba(15, 29, 42, 0.94);
  --surface-soft: rgba(20, 36, 49, 0.62);
  --text: #f3f8fc;
  --text-muted: #9eb0bf;
  --border: rgba(216, 235, 247, 0.11);
  --border-strong: rgba(216, 235, 247, 0.17);
  --shadow: 0 32px 100px rgba(0, 0, 0, 0.42);
  --focus: #7dd3fc;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: #071018;
    --surface: rgba(12, 24, 35, 0.78);
    --surface-strong: rgba(15, 29, 42, 0.94);
    --surface-soft: rgba(20, 36, 49, 0.62);
    --text: #f3f8fc;
    --text-muted: #9eb0bf;
    --border: rgba(216, 235, 247, 0.11);
    --border-strong: rgba(216, 235, 247, 0.17);
    --shadow: 0 32px 100px rgba(0, 0, 0, 0.42);
    --focus: #7dd3fc;
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--background);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--background);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

::selection {
  color: white;
  background: #2563eb;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-shell {
  position: relative;
  display: grid;
  min-height: 100svh;
  place-items: center;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(18px, 4vw, 48px) 16px;
}

.site-shell::before {
  position: absolute;
  z-index: -4;
  inset: 0;
  content: "";
  background:
    radial-gradient(circle at 10% 15%, color-mix(in srgb, var(--brand-a) 18%, transparent), transparent 34%),
    radial-gradient(circle at 90% 18%, color-mix(in srgb, var(--brand-b) 18%, transparent), transparent 32%),
    radial-gradient(circle at 50% 100%, color-mix(in srgb, var(--brand-c) 13%, transparent), transparent 38%),
    var(--background);
}

.grid-overlay {
  position: absolute;
  z-index: -3;
  inset: 0;
  opacity: 0.28;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black, transparent 78%);
}

.ambient {
  position: absolute;
  z-index: -2;
  width: 330px;
  height: 330px;
  border-radius: 999px;
  filter: blur(84px);
  opacity: 0.17;
  pointer-events: none;
  animation: drift 14s ease-in-out infinite alternate;
}

.ambient--one {
  top: -110px;
  left: -70px;
  background: var(--brand-a);
}

.ambient--two {
  right: -110px;
  bottom: -120px;
  background: var(--brand-b);
  animation-delay: -6s;
}

.portal-card {
  position: relative;
  width: min(100%, 610px);
  padding: clamp(20px, 5vw, 38px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: clamp(26px, 5vw, 38px);
  background: linear-gradient(145deg, var(--surface-strong), var(--surface));
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(145%);
  -webkit-backdrop-filter: blur(24px) saturate(145%);
  animation: rise 620ms cubic-bezier(.2,.75,.25,1) both;
}

.portal-card::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,.18), transparent 26%, transparent 72%, rgba(255,255,255,.06));
}

.portal-card__topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.status-pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .055em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
}

.status-pill__dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, .12);
}

.theme-toggle {
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--text);
  cursor: pointer;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.theme-toggle:hover {
  border-color: var(--border-strong);
  background: var(--surface-strong);
  transform: translateY(-2px);
}

.theme-toggle:focus-visible,
.service-card:focus-visible,
.error-card__button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent);
  outline-offset: 3px;
}

.theme-toggle:disabled {
  opacity: .65;
  cursor: default;
}

.theme-toggle__icon {
  font-size: 20px;
  line-height: 1;
}

.profile-header {
  position: relative;
  z-index: 1;
  max-width: 500px;
  margin: 0 auto 25px;
  text-align: center;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 92px;
  height: 92px;
  margin: 0 auto 20px;
  color: white;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .44);
  border-radius: 30px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.18), rgba(255,255,255,.04)),
    linear-gradient(135deg, var(--brand-a), var(--brand-b) 55%, var(--brand-c));
  box-shadow:
    0 18px 42px rgba(45, 95, 145, .24),
    inset 0 1px 0 rgba(255,255,255,.35);
  transform: rotate(-2deg);
}

.brand-mark__halo {
  position: absolute;
  width: 108px;
  height: 108px;
  border: 1px solid color-mix(in srgb, var(--brand-a) 36%, transparent);
  border-radius: 35px;
  transform: rotate(8deg);
}

.brand-mark__letters {
  font-size: 31px;
  font-weight: 900;
  letter-spacing: -.08em;
  text-shadow: 0 6px 18px rgba(0,0,0,.18);
}

.brand-mark__dot {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 9px;
  height: 9px;
  border: 2px solid rgba(255,255,255,.86);
  border-radius: 50%;
  background: #22c55e;
}

.profile-header__kicker {
  margin: 0 0 8px;
  color: color-mix(in srgb, var(--brand-a) 70%, var(--text));
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.profile-header h1 {
  margin: 0;
  font-size: clamp(34px, 9vw, 51px);
  font-weight: 850;
  letter-spacing: -.055em;
  line-height: .98;
}

.profile-header__description {
  max-width: 470px;
  margin: 16px auto 0;
  color: var(--text-muted);
  font-size: clamp(14px, 3.3vw, 16px);
  line-height: 1.72;
}

.services {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
}

.service-card {
  --service-accent: #38bdf8;
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 36px;
  gap: 14px;
  align-items: center;
  min-height: 92px;
  padding: 15px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface-soft);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
  animation: card-in 520ms cubic-bezier(.22,.75,.3,1) var(--stagger) both;
}

.service-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  content: "";
  background: var(--service-accent);
  opacity: .72;
}

.service-card::after {
  position: absolute;
  top: -56px;
  right: -60px;
  width: 155px;
  height: 155px;
  content: "";
  border-radius: 999px;
  background: var(--service-accent);
  filter: blur(42px);
  opacity: .055;
  transition: opacity 180ms ease;
}

.service-card:hover {
  border-color: color-mix(in srgb, var(--service-accent) 42%, var(--border));
  background: var(--surface-strong);
  box-shadow: 0 16px 36px color-mix(in srgb, var(--service-accent) 10%, transparent);
  transform: translateY(-3px);
}

.service-card:hover::after {
  opacity: .12;
}

.service-card:active {
  transform: scale(.985);
}

.service-card__icon {
  display: grid;
  width: 52px;
  height: 52px;
  color: var(--service-accent);
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--service-accent) 22%, var(--border));
  border-radius: 17px;
  background: color-mix(in srgb, var(--service-accent) 10%, var(--surface-strong));
}

.service-card__content {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.service-card__eyebrow {
  margin-bottom: 3px;
  color: var(--service-accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .11em;
  line-height: 1.2;
  text-transform: uppercase;
}

.service-card strong {
  font-size: 16px;
  font-weight: 780;
  letter-spacing: -.02em;
}

.service-card__description {
  margin-top: 4px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.45;
  text-overflow: ellipsis;
}

.service-card__arrow {
  display: grid;
  width: 36px;
  height: 36px;
  color: var(--text-muted);
  place-items: center;
  border-radius: 999px;
  transition: color 180ms ease, transform 180ms ease, background 180ms ease;
}

.service-card:hover .service-card__arrow {
  color: var(--service-accent);
  background: color-mix(in srgb, var(--service-accent) 10%, transparent);
  transform: translateX(3px);
}

.security-notice {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 18px;
  padding: 14px 15px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-soft) 75%, transparent);
}

.security-notice svg {
  flex: 0 0 auto;
  color: #22c55e;
  margin-top: 1px;
}

.security-notice p {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
}

.portal-footer {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 16px;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: 22px;
  padding: 0 2px;
  color: var(--text-muted);
  font-size: 11px;
}

.portal-footer div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.portal-footer strong {
  color: var(--text);
  font-size: 12px;
}

.portal-footer p {
  margin: 0;
}

.error-card {
  display: flex;
  max-width: 520px;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.error-card h1 {
  margin: 0;
  font-size: clamp(30px, 8vw, 44px);
  letter-spacing: -.05em;
}

.error-card > p:not(.profile-header__kicker) {
  color: var(--text-muted);
  line-height: 1.7;
}

.error-card__button {
  margin-top: 12px;
  padding: 13px 18px;
  color: white;
  font-weight: 750;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand-a), var(--brand-b));
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes drift {
  from { transform: translate3d(-12px, -6px, 0) scale(.95); }
  to { transform: translate3d(22px, 18px, 0) scale(1.08); }
}

@media (max-width: 480px) {
  .site-shell {
    align-items: start;
    padding: 12px;
  }

  .portal-card {
    min-height: calc(100svh - 24px);
    padding: 20px 15px;
    border-radius: 28px;
  }

  .portal-card__topbar {
    margin-bottom: 12px;
  }

  .brand-mark {
    width: 78px;
    height: 78px;
    margin-bottom: 16px;
    border-radius: 25px;
  }

  .brand-mark__halo {
    width: 92px;
    height: 92px;
    border-radius: 30px;
  }

  .profile-header {
    margin-bottom: 20px;
  }

  .profile-header__description {
    margin-top: 13px;
    line-height: 1.62;
  }

  .service-card {
    grid-template-columns: 46px minmax(0, 1fr) 28px;
    min-height: 83px;
    gap: 11px;
    padding: 12px;
    border-radius: 19px;
  }

  .service-card__icon {
    width: 46px;
    height: 46px;
    border-radius: 15px;
  }

  .service-card__description {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .service-card__arrow {
    width: 28px;
  }

  .security-notice {
    margin-top: 14px;
  }

  .portal-footer {
    margin-top: auto;
    padding-top: 20px;
  }
}

@media (max-width: 350px) {
  .status-pill {
    font-size: 10px;
  }

  .profile-header h1 {
    font-size: 31px;
  }

  .service-card strong {
    font-size: 15px;
  }
}

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