:root {
  color-scheme: light;
  --bg: #f9f9f7;
  --surface: #ffffff;
  --surface-muted: #f0efeb;
  --surface-hover: #e9e8e3;
  --text: #1f1f1d;
  --muted: #71716b;
  --border: #deddd7;
  --border-strong: #c8c7c0;
  --brand: #1f1f1d;
  --brand-hover: #363633;
  --danger: #1f1f1d;
  --danger-hover: #363633;
  --success-bg: #ecebe7;
  --success-text: #1f1f1d;
  --accent-fill: #1f1f1d;
  --accent-contrast: #f9f9f7;
  --focus: rgb(31 31 29 / 30%);
  --header-bg: rgb(249 249 247 / 90%);
  --shadow: 0 1px 2px rgb(31 31 29 / 4%), 0 16px 46px rgb(31 31 29 / 6%);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #131313;
    --surface: #1b1b1a;
    --surface-muted: #242422;
    --surface-hover: #2c2c29;
    --text: #f3f3ef;
    --muted: #a5a59e;
    --border: #383835;
    --border-strong: #4a4a46;
    --brand: #f3f3ef;
    --brand-hover: #ffffff;
    --danger: #f3f3ef;
    --danger-hover: #ffffff;
    --success-bg: #292927;
    --success-text: #f3f3ef;
    --accent-fill: #f3f3ef;
    --accent-contrast: #131313;
    --focus: rgb(243 243 239 / 30%);
    --header-bg: rgb(19 19 19 / 90%);
    --shadow: 0 1px 2px rgb(0 0 0 / 20%), 0 20px 52px rgb(0 0 0 / 26%);
  }
}

html,
body {
  background: var(--bg);
}

body {
  color: var(--text);
  background:
    radial-gradient(circle at 50% 0, color-mix(in srgb, var(--surface) 58%, transparent) 0, transparent 38rem),
    var(--bg);
}

h1,
h2,
h3,
label,
dt,
dd,
td {
  color: var(--text);
}

.topbar {
  min-height: 72px;
  padding: 7px 28px;
  border-color: var(--border);
  background: var(--header-bg);
  box-shadow: 0 1px 0 rgb(31 31 29 / 2%);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.brand {
  width: 54px;
  height: 54px;
  border-radius: 12px;
}

.brand-logo {
  width: 54px;
  height: 54px;
  transition: filter 180ms ease, opacity 140ms ease;
}

@media (prefers-color-scheme: dark) {
  .brand-logo,
  .authentication-logo,
  .application-directory-brand img {
    filter: invert(1);
  }

  .passkey-key-icon {
    filter: none;
  }
}

.desktop-nav a,
.mobile-nav a {
  border-radius: 9px;
  color: var(--muted);
}

.desktop-nav a:hover,
.mobile-nav a:hover {
  color: var(--text);
  background: var(--surface-muted);
}

.desktop-nav a[aria-current="page"],
.mobile-nav a[aria-current="page"] {
  color: var(--accent-contrast);
  background: var(--accent-fill);
}

.mobile-nav {
  border-color: var(--border);
  background: var(--surface);
}

.shell {
  padding-top: 40px;
}

.page-heading h1,
.section-heading h2,
.credential-heading h3 {
  letter-spacing: -0.015em;
}

.section {
  border-color: var(--border);
}

.button {
  min-height: 40px;
  border-radius: 9px;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.button:active:not(:disabled) {
  transform: translateY(1px);
}

.button-primary,
.button-danger {
  color: var(--accent-contrast);
  background: var(--accent-fill);
}

.button-primary:hover:not(:disabled),
.button-danger:hover:not(:disabled) {
  color: var(--accent-contrast);
  background: color-mix(in srgb, var(--accent-fill) 86%, var(--bg));
}

.button-secondary {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--surface);
}

.button-secondary:hover:not(:disabled),
.button-quiet:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-muted);
}

.button-quiet {
  color: var(--muted);
}

.button:focus-visible,
.brand:focus-visible,
.desktop-nav a:focus-visible,
.mobile-nav a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.stat-grid article,
.table-wrap,
.credential,
.application-directory-card,
.auth-panel,
.empty-state {
  border-color: var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat-grid article {
  min-height: 126px;
  padding: 19px;
}

.stat-grid span,
.stat-grid small,
.summary-band span,
td small,
.entity-link small,
.lede,
.requesting-app p,
.application-directory-copy small,
.application-directory-copy > span {
  color: var(--muted);
}

.summary-band {
  border-color: var(--border);
  border-radius: 14px;
  background: var(--border);
}

.summary-band div {
  background: var(--surface);
}

.status-text-success {
  color: var(--text);
}

.table-wrap {
  overflow: hidden;
  overflow-x: auto;
}

th,
td {
  border-color: var(--border);
}

th {
  color: var(--muted);
  background: var(--surface-muted);
}

tbody tr:hover td {
  background: color-mix(in srgb, var(--surface-muted) 58%, transparent);
}

.entity-link {
  color: var(--text);
}

.app-icon {
  border-color: var(--border-strong);
  border-radius: 11px;
  color: var(--text);
  background: var(--surface-muted);
}

.badge {
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface-muted);
}

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

.detail-strip,
.key-values,
.credential-meta,
.key-values > div,
.credential-meta > div {
  border-color: var(--border);
}

.control-status {
  color: var(--text);
}

label {
  color: var(--text);
}

input,
select,
textarea {
  border-color: var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
}

input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 72%, transparent);
}

dt {
  color: var(--muted);
}

.filter-bar {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.empty-state {
  border-style: dashed;
  box-shadow: none;
}

.public-body {
  background: var(--bg);
}

.public-header {
  min-height: 82px;
  padding: 10px 24px;
}

.public-shell {
  margin-top: clamp(32px, 6vh, 72px);
}

.public-shell-centered {
  margin: 0;
  padding: clamp(24px, 6vw, 64px);
}

.authentication-mark {
  gap: 28px;
}

.authentication-logo {
  width: min(300px, 68vw);
  transition: filter 180ms ease;
}

.application-directory {
  padding: 22px 0 54px;
}

.application-directory-heading {
  gap: 22px;
  margin-bottom: 32px;
}

.application-directory-heading h1 {
  letter-spacing: -0.02em;
}

.application-directory-card {
  min-height: 132px;
  padding: 20px;
  transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.application-directory-card:hover {
  border-color: var(--border-strong);
  background: color-mix(in srgb, var(--surface) 76%, var(--surface-muted));
  transform: translateY(-1px);
}

.application-directory-arrow {
  color: var(--muted);
}

.auth-panel {
  padding: clamp(24px, 5vw, 38px);
}

.eyebrow {
  color: var(--text);
  letter-spacing: 0.1em;
}

pre {
  border-color: var(--border-strong);
  border-radius: 12px;
  color: #f3f3ef;
  background: #131313;
}

@media (max-width: 860px) {
  .topbar {
    padding: 7px 18px;
  }

  .public-header {
    padding: 10px 18px;
  }
}

@media (max-width: 600px) {
  .shell {
    width: min(100% - 24px, 1180px);
  }

  .auth-panel,
  .credential,
  .application-directory-card,
  .stat-grid article,
  .table-wrap {
    border-radius: 12px;
  }

  .application-directory-heading {
    align-items: center;
  }
}

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