:root {
  --portal-panel: rgb(255 255 255 / 78%);
  --portal-ink: #1d1d1f;
  --portal-muted: #66666b;
  --portal-line: rgb(29 29 31 / 11%);
  --portal-violet: #8d78ff;
  --portal-violet-dark: #684ee8;
  --portal-acid: #d8ff52;
  --portal-danger: #b3261e;
  --portal-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  --portal-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  --portal-shadow: 0 18px 55px rgb(20 20 24 / 9%), 0 2px 8px rgb(20 20 24 / 4%);
}

body.portal-body {
  background:
    radial-gradient(circle at 8% 0, rgb(123 98 255 / 10%), transparent 28rem),
    #f5f5f7;
  font-family: var(--portal-font);
  font-size: 16px;
  letter-spacing: -.01em;
}

.portal-body h1, .portal-body h2, .portal-body h3,
.portal-brand, .portal-button, .portal-button-secondary, .portal-tab,
.admin-kpi-value, .admin-kpi-label, .launcher-copy strong, .launcher-meta,
.admin-eyebrow, .admin-table th, .account-license h2 {
  font-family: var(--portal-display);
}

.portal-body h1, .portal-body h2, .portal-body h3 {
  letter-spacing: -.045em;
  text-wrap: balance;
}

.portal-shell {
  width: min(1480px, calc(100% - 44px));
  padding-top: 18px;
}

.portal-header {
  position: sticky;
  z-index: 20;
  top: 12px;
  min-height: 62px;
  margin-bottom: 22px;
  padding: 10px 12px;
  border: 1px solid rgb(255 255 255 / 72%);
  border-radius: 20px;
  background: rgb(250 250 252 / 76%);
  box-shadow: 0 10px 35px rgb(20 20 24 / 7%);
  backdrop-filter: saturate(180%) blur(24px);
}

.portal-brand { gap: 12px; }
.portal-brand img { width: 126px; }
.portal-brand span {
  border-color: var(--portal-line);
  color: var(--portal-muted);
  font-family: var(--portal-display);
  font-size: 12px;
  letter-spacing: .08em;
}

.portal-button, .portal-button-secondary, .portal-tab {
  min-height: 44px;
  border-radius: 999px;
  font-size: 14px;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
  touch-action: manipulation;
}

.portal-button {
  background: var(--portal-ink);
  box-shadow: 0 7px 18px rgb(0 0 0 / 12%);
}
.portal-button:hover { background: #343438; }
.portal-button-secondary { border-color: var(--portal-line); background: rgb(255 255 255 / 64%); }
.portal-button-secondary:hover { background: #fff; }
.portal-button[aria-disabled="true"]:hover { background: var(--portal-ink); transform: none; }
.portal-button-secondary[aria-disabled="true"]:hover { background: rgb(255 255 255 / 64%); transform: none; }
.portal-button:active, .portal-button-secondary:active, .portal-tab:active,
.launcher-card:active { transform: scale(.97); }

.portal-input, .portal-select, .portal-textarea {
  min-height: 48px;
  padding: 12px 14px;
  border-color: var(--portal-line);
  border-radius: 12px;
  background: rgb(255 255 255 / 86%);
  font-family: var(--portal-font);
  font-size: 16px;
  transition: border 150ms ease, box-shadow 150ms ease;
}
.portal-input:focus, .portal-select:focus, .portal-textarea:focus {
  border-color: var(--portal-violet-dark);
  /* A solid outline (not a faint halo) so the focused field is clear in every colour mode. */
  outline: 2px solid var(--portal-violet-dark);
  outline-offset: 2px;
}
@media (forced-colors: active) {
  .portal-input:focus, .portal-select:focus, .portal-textarea:focus { outline-color: Highlight; }
}
.portal-label { gap: 8px; font-family: var(--portal-display); font-size: 12px; letter-spacing: .06em; }

.portal-panel {
  border-color: rgb(255 255 255 / 76%);
  border-radius: 22px;
  background: var(--portal-panel);
  box-shadow: var(--portal-shadow);
  backdrop-filter: saturate(140%) blur(20px);
}
.portal-panel-head { padding: 20px 22px; border-color: var(--portal-line); }
.portal-panel-head h2 { font-size: 22px; }
.portal-empty { padding: 36px 24px; font-size: 15px; }
.portal-notice { border-color: rgb(104 78 232 / 24%); border-radius: 14px; background: #efebff; }
.portal-badge { padding: 6px 9px; font-family: var(--portal-display); font-size: 11px; letter-spacing: .04em; }

.auth-layout {
  position: relative;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, .72fr);
  width: min(1180px, calc(100% - 40px));
  gap: clamp(40px, 7vw, 100px);
}
.auth-layout::before {
  position: fixed;
  z-index: -1;
  inset: 10% auto auto 44%;
  width: min(48vw, 650px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #d8d0ff, rgb(131 104 255 / 22%) 45%, transparent 70%);
  filter: blur(8px);
  content: "";
}
.auth-story .portal-brand { margin-bottom: clamp(58px, 11vh, 120px); }
.auth-kicker { color: #684ee8; font-family: var(--portal-display); font-size: 12px; letter-spacing: .09em; }
.auth-story h1 { max-width: 650px; font-size: clamp(52px, 6.5vw, 84px); line-height: .93; }
.auth-story h1 em { color: #684ee8; font-family: var(--portal-display); }
.auth-story > p:last-child { max-width: 520px; color: var(--portal-muted); font-size: 19px; line-height: 1.55; }
.auth-card { padding: clamp(28px, 4vw, 44px); border-radius: 28px; }
.auth-card h2 { font-size: 34px; }
.auth-card-intro { font-size: 16px; }
.auth-form { gap: 19px; }
.auth-form .portal-button { min-height: 50px; }
.auth-back, .auth-status { font-size: 14px; }

.admin-tabs {
  position: sticky;
  z-index: 10;
  top: 96px;
  gap: 4px;
  padding: 5px;
  border-color: rgb(255 255 255 / 72%);
  border-radius: 999px;
  background: rgb(232 232 237 / 76%);
  box-shadow: 0 8px 28px rgb(20 20 24 / 6%);
  backdrop-filter: blur(20px);
}
.portal-tab { color: #5b5b60; background: transparent; }
.portal-tab.is-active { background: #fff; color: var(--portal-ink); box-shadow: 0 2px 8px rgb(0 0 0 / 8%); }
.launcher-heading :is(h1, h2) { font-size: 32px; }
.admin-eyebrow { color: #684ee8; font-size: 11px; }
.launcher-grid { gap: 14px; }
.launcher-card {
  min-height: 108px;
  padding: 14px;
  border-color: rgb(255 255 255 / 76%);
  border-radius: 22px;
  background: rgb(255 255 255 / 76%);
  box-shadow: 0 10px 35px rgb(20 20 24 / 6%);
  backdrop-filter: blur(18px);
}
.launcher-card:hover { transform: translateY(-2px); border-color: rgb(104 78 232 / 25%); box-shadow: var(--portal-shadow); }
.launcher-art { width: 80px; height: 80px; border-radius: 16px; }
.launcher-copy strong { font-size: 18px; }
.launcher-copy small, .admin-kpi-detail { font-size: 13px; }
.launcher-meta, .admin-kpi-label { font-size: 11px; }
.admin-kpi { padding: 24px; }
.admin-kpi-value { font-size: 40px; }
.admin-toolbar, .customer-create, .admin-table th, .admin-table td { border-color: var(--portal-line); }
.admin-table { font-size: 14px; }
.admin-table th { font-size: 11px; }
.admin-table td { padding-block: 14px; }
.license-option, .connection-product { border-color: var(--portal-line); border-radius: 14px; background: rgb(255 255 255 / 72%); }

@media (max-width: 800px) {
  .portal-shell { width: min(100% - 24px, 1480px); }
  .auth-layout {
    grid-template-columns: minmax(0, 1fr);
    width: min(100% - 28px, 580px);
    padding-top: 28px;
  }
  .auth-story .portal-brand { margin-bottom: 46px; }
  .auth-story h1 { font-size: clamp(48px, 14vw, 64px); }
  .portal-header { top: 8px; }
  .admin-tabs { top: 86px; border-radius: 18px; }
}

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

@media (prefers-reduced-transparency: reduce) {
  .portal-header, .portal-panel, .admin-tabs, .launcher-card { background: #fff; backdrop-filter: none; }
}

@media (prefers-contrast: more) {
  :root { --portal-line: rgb(29 29 31 / 38%); --portal-muted: #48484d; }
  .portal-panel, .portal-header, .launcher-card { border-color: var(--portal-line); }
}
