:root {
  --page-top: #edf5ff;
  --page-bottom: #d5e6fb;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --ink: #192438;
  --muted: #617089;
  --line: rgba(74, 105, 149, 0.16);
  --segment-selected: var(--category-selected-bg);
  --segment-hover: var(--category-hover-bg);
  --radius-large: 28px;
  --radius-medium: 18px;
  --radius-pill: 999px;
  --shadow: 0 20px 55px rgba(53, 88, 137, 0.13);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page-bottom);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.94), transparent 42%),
    linear-gradient(180deg, var(--page-top), var(--page-bottom));
}

button {
  color: inherit;
  font: inherit;
}

.portal-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 72px;
}

.portal-topbar {
  position: sticky;
  top: 16px;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(62, 93, 139, 0.09);
  backdrop-filter: blur(14px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* Live graph and model connection status replaces the static brand lockup. */
.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 260px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-solid);
  font-size: 0.74rem;
  font-weight: 750;
  line-height: 1.2;
}

.status-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9fb0c6;
}

.status-label {
  overflow: hidden;
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-chip[data-state="healthy"] {
  border-color: rgba(54, 166, 115, 0.38);
  background: rgba(54, 166, 115, 0.1);
}

.status-chip[data-state="healthy"] .status-dot {
  background: #2f9c69;
}

.status-chip[data-state="healthy"] .status-label {
  color: #1f6f49;
}

.status-chip[data-state="unhealthy"],
.status-chip[data-state="unconfigured"] {
  border-color: rgba(207, 91, 98, 0.4);
  background: rgba(207, 91, 98, 0.1);
}

.status-chip[data-state="unhealthy"] .status-dot,
.status-chip[data-state="unconfigured"] .status-dot {
  background: #cf5b62;
}

.status-chip[data-state="unhealthy"] .status-label,
.status-chip[data-state="unconfigured"] .status-label {
  color: #a8393f;
}

/* More than one connection/model: the chip label becomes a native selector. */
.status-chip.is-switchable {
  position: relative;
  padding-right: 8px;
  cursor: pointer;
}

.status-chip.is-switchable:hover,
.status-chip.is-switchable:focus-within {
  border-color: rgba(37, 116, 216, 0.45);
  box-shadow: 0 0 0 3px rgba(37, 116, 216, 0.12);
}

.status-chip .status-switch {
  width: auto;
  min-width: 0;
  max-width: 200px;
  margin: 0;
  padding: 0 18px 0 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23617089' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat right 2px center;
  box-shadow: none;
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  resize: none;
  appearance: none;
  -webkit-appearance: none;
}

.status-chip .status-switch:focus-visible {
  outline: 2px solid #155fb8;
  outline-offset: 3px;
}

.status-chip .status-switch:disabled {
  cursor: progress;
  opacity: 0.7;
}

.status-chip[data-state="healthy"] .status-switch {
  color: #1f6f49;
}

.status-chip[data-state="unhealthy"] .status-switch,
.status-chip[data-state="unconfigured"] .status-switch {
  color: #a8393f;
}

.status-switch-message {
  overflow: hidden;
  max-width: 280px;
  color: #a8393f;
  font-size: 0.72rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-switch-message[hidden] {
  display: none;
}

.brand-lockup div {
  display: grid;
  min-width: 0;
}

.brand-link {
  color: inherit;
  text-decoration: none;
}

.brand-copy {
  display: grid;
  min-width: 0;
}

.brand-lockup strong,
.brand-lockup span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-lockup strong {
  font-size: 0.9rem;
}

.brand-lockup span {
  color: var(--muted);
  font-size: 0.72rem;
}

.topbar-actions {
  display: flex;
  gap: 4px;
}

.topbar-user-area {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 8px;
  min-width: 0;
}

.topbar-action,
.principal-chip {
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.topbar-action {
  padding: 9px 12px;
  text-decoration: none;
  transition: background-color 140ms ease, color 140ms ease;
}

.topbar-action:hover,
.topbar-action.is-active {
  background: var(--segment-selected);
  color: var(--ink);
}

.topbar-action:focus-visible,
.brand-link:focus-visible {
  outline: 3px solid #155fb8;
  outline-offset: 3px;
}

.principal-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  overflow: hidden;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}

.principal-chip:hover {
  border-color: rgba(37, 116, 216, 0.34);
}

.principal-avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(140deg, #2574d8, #4d98ed);
  color: white;
  font-size: 0.74rem;
  font-weight: 900;
}

.principal-avatar-image {
  object-fit: cover;
  background: #dbeeff;
  box-shadow: 0 0 0 1px rgba(37, 116, 216, 0.18);
}

.principal-name {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
}

.principal-caret {
  flex: none;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
}

.principal-menu[open] .principal-caret {
  transform: rotate(225deg) translateY(-2px);
}

.principal-chip::-webkit-details-marker {
  display: none;
}

.principal-menu {
  position: relative;
}

.principal-menu-popover {
  position: absolute;
  z-index: 20;
  top: calc(100% + 10px);
  right: 0;
  display: grid;
  gap: 2px;
  min-width: 208px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-lg);
}

.principal-menu-heading {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 8px 12px 10px;
  border-bottom: 1px solid var(--line);
}

.principal-menu-heading strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.82rem;
  text-overflow: ellipsis;
}

.principal-menu-heading span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.principal-menu-action.is-logout {
  margin-top: 2px;
  color: #a8393f;
}

.principal-menu-action.is-logout:hover,
.principal-menu-action.is-logout:focus-visible {
  background: rgba(207, 91, 98, 0.12);
}

.principal-menu-action {
  width: 100%;
  min-width: 150px;
  padding: 9px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 750;
  text-align: left;
  white-space: nowrap;
}

.principal-menu-action:hover,
.principal-menu-action:focus-visible {
  background: var(--segment-hover);
  outline: none;
}

.principal-menu:not([open]) .principal-menu-popover {
  display: none;
}

.topbar-login,
.auth-submit,
.auth-oidc {
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 800;
}

.topbar-login {
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid rgba(36, 107, 206, 0.2);
  background: var(--category-selected-bg);
  color: var(--category-selected-text);
  cursor: pointer;
}

.topbar-login:hover {
  background: var(--category-hover-bg);
  color: #74570f;
}

.topbar-login:focus-visible,
.auth-submit:focus-visible,
.auth-oidc:focus-visible,
.auth-dialog-close:focus-visible {
  outline: 3px solid #155fb8;
  outline-offset: 3px;
}

.auth-dialog {
  width: min(440px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 26px;
  background: transparent;
  color: var(--ink);
  box-shadow:
    0 32px 80px rgba(20, 44, 82, 0.28),
    0 2px 6px rgba(20, 44, 82, 0.08);
}

.auth-dialog[open] {
  animation: auth-dialog-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes auth-dialog-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

.auth-dialog::backdrop {
  background: rgba(22, 38, 64, 0.42);
  backdrop-filter: blur(8px);
}

.auth-dialog-panel {
  position: relative;
  padding: 30px 34px 32px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 26px;
  background:
    radial-gradient(120% 70% at 0% 0%, rgba(203, 226, 255, 0.75), transparent 60%),
    radial-gradient(90% 60% at 100% 0%, rgba(255, 238, 196, 0.55), transparent 55%),
    #ffffff;
}

.auth-dialog-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(74, 105, 149, 0.14);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  transition: background 150ms ease, color 150ms ease;
}

.auth-dialog-close:hover {
  background: #eef4fc;
  color: var(--ink);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 44px 26px 0;
}

.auth-brand-logo {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 7px;
  border: 1px solid rgba(74, 105, 149, 0.14);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(37, 88, 160, 0.12);
  object-fit: contain;
}

.auth-brand-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.auth-brand-copy strong {
  overflow: hidden;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-brand-copy .eyebrow {
  margin: 0;
  font-size: 0.64rem;
  letter-spacing: 0.14em;
}

.auth-dialog h2 {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.auth-dialog-summary {
  margin: 8px 0 22px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: #3d4c63;
  font-size: 0.78rem;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid rgba(74, 105, 149, 0.22);
  border-radius: 12px;
  background: #f8fbff;
  color: var(--ink);
  font: inherit;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.auth-form input:hover {
  border-color: rgba(37, 116, 216, 0.38);
}

.auth-form input:focus {
  border-color: #2574d8;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(37, 116, 216, 0.14);
}

.auth-submit,
.auth-oidc {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.auth-submit {
  width: 100%;
  margin-top: 6px;
  background: linear-gradient(180deg, #2f80e4, #1d66c6);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(29, 102, 198, 0.28);
}

.auth-submit:hover {
  background: linear-gradient(180deg, #2a78d9, #185bb2);
  box-shadow: 0 10px 24px rgba(29, 102, 198, 0.34);
}

.auth-oidc {
  width: 100%;
  border-color: rgba(74, 105, 149, 0.22);
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(37, 88, 160, 0.1);
}

.auth-oidc:hover {
  border-color: rgba(37, 116, 216, 0.45);
  box-shadow: 0 8px 22px rgba(37, 88, 160, 0.16);
}

.auth-oidc-icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: #1d66c6;
}

.auth-submit:hover,
.auth-oidc:hover {
  transform: translateY(-1px);
}

.auth-submit:active,
.auth-oidc:active {
  transform: translateY(0);
}

.auth-error {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 16px 0 0;
  padding: 11px 13px;
  border: 1px solid rgba(207, 91, 98, 0.24);
  border-radius: 12px;
  background: #fff4f4;
  color: #a43e48;
  font-size: 0.8rem;
  font-weight: 700;
}

.auth-error[hidden] {
  display: none;
}

.auth-error::before {
  content: "!";
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #cf5b62;
  color: #ffffff;
  font-size: 0.7rem;
}

@media (max-width: 480px) {
  .auth-dialog-panel {
    padding: 24px 20px 24px;
  }

  .auth-dialog h2 {
    font-size: 1.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-dialog[open] {
    animation: none;
  }

  .auth-submit,
  .auth-oidc,
  .auth-form input {
    transition: none;
  }
}

.portal-hero {
  max-width: 850px;
  margin: 0 auto;
  padding: 92px 20px 56px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 16px;
  color: #2574d8;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.portal-hero h1 {
  margin: 0;
  font-size: clamp(2.5rem, 6vw, 4.9rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.portal-hero h1 + p {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.hero-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 150px;
  margin-top: 26px;
  padding: 13px 22px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: var(--radius-pill);
  background: var(--surface-solid);
  box-shadow: 0 10px 30px rgba(62, 93, 139, 0.1);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.hero-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(62, 93, 139, 0.15);
}

.hero-action:focus-visible {
  outline: 3px solid #155fb8;
  outline-offset: 3px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.skills-main {
  padding: 70px 0 30px;
}

.skills-heading {
  max-width: 720px;
  margin-bottom: 30px;
}

.skills-heading h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.6rem);
  letter-spacing: -0.035em;
}

.skills-heading > p:last-child,
.skill-card p {
  color: var(--muted);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.skill-card,
.skills-empty {
  border: 1px solid rgba(255, 255, 255, 0.86);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.skill-card {
  min-height: 190px;
  padding: 24px;
  border-radius: var(--radius-medium);
}

.skill-card h2 {
  margin: 20px 0 10px;
  font-size: 1.2rem;
}

.skill-card p {
  margin: 0;
  line-height: 1.55;
}

.skill-source {
  display: inline-flex;
  padding: 7px 11px;
  border-radius: var(--radius-pill);
  color: var(--category-selected-text);
  background: var(--category-selected-bg);
  font-size: 0.74rem;
  font-weight: 800;
}

.skills-empty {
  padding: clamp(24px, 5vw, 54px);
  border-radius: var(--radius-large);
}

.portal-catalog {
  padding-top: 12px;
  scroll-margin-top: 120px;
}

.portal-segments {
  display: flex;
  justify-content: center;
  width: fit-content;
  margin: 0 auto 28px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(63, 94, 138, 0.08);
}

.segment-button {
  min-width: 154px;
  padding: 11px 20px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 800;
  transition: background-color 140ms ease, transform 140ms ease;
}

.segment-button[aria-pressed="true"] {
  border: 1px solid rgba(36, 107, 206, 0.2);
  background: var(--category-selected-bg);
  color: var(--category-selected-text);
}

.segment-button:hover {
  background: var(--category-hover-bg);
  transform: translateY(-1px);
}

.segment-button:focus-visible {
  background: var(--category-hover-bg);
  outline: 3px solid #155fb8;
  outline-offset: 3px;
  transform: translateY(-1px);
}

.application-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

[data-category-panel][hidden] { display: none; }

.ontology-phase + .ontology-phase { margin-top: 32px; }
.ontology-phase-heading { display: flex; align-items: baseline; gap: 16px; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.ontology-phase-heading h2 { margin: 0; font-size: 1.2rem; font-weight: 800; }
.ontology-phase-heading p { margin: 0; color: var(--muted); font-size: 0.86rem; line-height: 1.5; }
.ontology-feedback { margin: 28px 0 0; color: var(--muted); font-size: 0.84rem; line-height: 1.6; text-align: center; }

.application-card {
  /* Every card (link or download button) stacks its content from the top the
     same way; a native <button> would otherwise centre it vertically. */
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  min-height: 250px;
  /* Room at the bottom for the action badge so it never covers the text. */
  padding: 24px 24px 56px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.application-card-link {
  color: inherit;
  text-decoration: none;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    transform 140ms ease;
}

.application-card-link:hover {
  border-color: rgba(37, 116, 216, 0.28);
  background: var(--category-selected-bg);
  color: var(--category-selected-text);
  transform: translateY(-3px);
}

.application-card-link:focus-visible {
  background: var(--category-hover-bg);
  outline: 3px solid #155fb8;
  outline-offset: 3px;
}

.application-card[hidden] {
  display: none;
}

.card-index {
  color: #91a0b5;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.card-mark {
  --mark-ink: #286dcc;
  --mark-from: #eef5ff;
  --mark-to: #dbe9ff;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 28px 0 18px;
  border: 1px solid rgba(40, 109, 204, 0.12);
  border-radius: 17px;
  background: linear-gradient(145deg, var(--mark-from), var(--mark-to));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 6px 14px rgba(40, 109, 204, 0.1);
  color: var(--mark-ink);
  transition: transform 160ms ease;
}

.card-icon {
  display: block;
  width: 28px;
  height: 28px;
}

.application-card:hover .card-mark,
.application-card:focus-visible .card-mark {
  transform: translateY(-2px);
}

/* A distinct, restrained tint per entry keeps the grid easy to scan. */
[data-portal-entry="askgraph"] .card-mark { --mark-ink: #1f6fd1; --mark-from: #eef5ff; --mark-to: #d9e8ff; }
[data-portal-entry="any2gql"] .card-mark { --mark-ink: #6a4bc4; --mark-from: #f4f0ff; --mark-to: #e4dcff; }
[data-portal-entry="autogfe"] .card-mark { --mark-ink: #0f8a6a; --mark-from: #ebfaf4; --mark-to: #d2f1e5; }
[data-portal-entry="scenariograph"] .card-mark { --mark-ink: #c26a12; --mark-from: #fff6ea; --mark-to: #ffe7c9; }
[data-portal-entry="openapi"] .card-mark { --mark-ink: #9a6700; --mark-from: #fff9e6; --mark-to: #fdecb8; }
[data-portal-entry="ontobuilder"] .card-mark { --mark-ink: #b3408a; --mark-from: #fdf0f8; --mark-to: #f7d9ec; }
[data-portal-entry="ontocompute"] .card-mark { --mark-ink: #0e7c86; --mark-from: #e9f8f8; --mark-to: #cdeef0; }
[data-portal-entry="nebula-gql-skills"] .card-mark { --mark-ink: #1b7f9c; --mark-from: #ebf8fc; --mark-to: #d3eef7; }
[data-portal-entry="nebula-mcp"] .card-mark { --mark-ink: #3d5a80; --mark-from: #f0f4fa; --mark-to: #dde6f2; }

@media (prefers-reduced-motion: reduce) {
  .card-mark { transition: none; }
  .application-card:hover .card-mark,
  .application-card:focus-visible .card-mark { transform: none; }
}

.card-title,
.card-description {
  align-self: stretch;
}

.card-title {
  display: block;
  margin: 0;
  font-size: 1.28rem;
  font-weight: 800;
}

.card-description {
  display: block;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.card-product { margin-top: 5px; color: var(--muted); font-size: 0.82rem; font-weight: 700; }

.application-card-button {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
}

.disabled-badge {
  position: absolute;
  right: 18px;
  bottom: 18px;
  padding: 6px 9px;
  border-radius: var(--radius-pill);
  background: #edf1f7;
  color: #77859b;
  font-size: 0.68rem;
  font-weight: 800;
}

.enabled-badge {
  position: absolute;
  right: 18px;
  bottom: 18px;
  padding: 6px 9px;
  border-radius: var(--radius-pill);
  background: var(--segment-selected);
  color: #155fb8;
  font-size: 0.68rem;
  font-weight: 800;
}

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

.settings-workspace {
  padding: 64px 0 24px;
}

.settings-back {
  display: inline-flex;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
}

.settings-back:hover {
  color: var(--ink);
}

.settings-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 34px;
  padding: 0 6px;
}

.settings-heading h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.25rem, 5vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.settings-heading .eyebrow {
  margin-bottom: 13px;
}

.settings-heading h1 + p {
  max-width: 680px;
  margin: 16px 0 0;
  color: var(--muted);
}

.workspace-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.workspace-status > span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #36a673;
  box-shadow: 0 0 0 4px rgba(54, 166, 115, 0.12);
}

.workspace-status[data-state="busy"] > span {
  background: #db9f2c;
}

.workspace-status[data-state="error"] > span {
  background: #cf5b62;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.settings-grid-aside {
  grid-template-columns: minmax(0, 1.55fr) minmax(310px, 0.75fr);
}

.settings-panel {
  min-width: 0;
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.settings-panel-soft {
  background: rgba(242, 248, 255, 0.9);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.panel-heading > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 11px;
  min-width: 0;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.025em;
}

.panel-kicker {
  color: #82a8d4;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.count-chip {
  min-width: 34px;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  background: var(--segment-selected);
  color: #245f9f;
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
}

.count-chip.warning {
  background: var(--segment-hover);
  color: #86640f;
}

.panel-metrics {
  display: flex;
  gap: 7px;
}

.panel-copy {
  margin: -8px 0 20px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

.settings-form {
  display: grid;
  gap: 15px;
}

.settings-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.settings-form input,
.settings-form select,
.search-row input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(74, 105, 149, 0.22);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font: inherit;
  outline: none;
}

.settings-form input:focus,
.settings-form select:focus,
.search-row input:focus {
  border-color: #4e8ed8;
  box-shadow: 0 0 0 3px rgba(78, 142, 216, 0.14);
}

.settings-form input[type="file"]::file-selector-button {
  margin: -5px 10px -5px -7px;
  padding: 8px 11px;
  border: 0;
  border-radius: 10px;
  background: var(--segment-selected);
  color: #174f8c;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.form-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 10px;
}

.primary-button,
.secondary-button,
.quiet-button {
  min-height: 42px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 850;
}

.primary-button {
  border: 1px solid #76a9df;
  background: #dbeeff;
  color: #174f8c;
}

.secondary-button {
  border: 1px solid rgba(74, 105, 149, 0.2);
  background: var(--surface-solid);
  color: var(--ink);
}

.quiet-button {
  border: 1px solid rgba(188, 136, 31, 0.2);
  background: var(--segment-hover);
  color: #74570f;
}

.primary-button:hover,
.secondary-button:hover,
.quiet-button:hover {
  transform: translateY(-1px);
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.quiet-button:focus-visible {
  outline: 3px solid #155fb8;
  outline-offset: 2px;
}

/* "Back to applications" link shared by every application page: a pill with
   a comfortable hit area instead of bare text. */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 14px 7px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(74, 105, 149, 0.18);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.back-link:hover {
  background: #fff4c2;
  color: var(--ink);
}

.back-link:focus-visible {
  outline: 3px solid #155fb8;
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.5);
  opacity: 0.58;
  transform: none;
}

.record-list {
  display: grid;
  gap: 10px;
  min-height: 120px;
}

.record-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  background: rgba(255, 255, 255, 0.78);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.record-card:hover {
  border-color: rgba(37, 116, 216, 0.28);
  box-shadow: 0 6px 16px rgba(53, 88, 137, 0.08);
}

.record-card.is-active {
  border-color: rgba(37, 116, 216, 0.38);
  background: linear-gradient(90deg, rgba(219, 238, 255, 0.72), rgba(255, 255, 255, 0.86) 55%);
  box-shadow: inset 3px 0 0 #2574d8;
}

.record-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, #eef5ff, #dbe9ff);
  color: #286dcc;
}

.record-card.is-active .record-icon {
  background: #2574d8;
  color: #fff;
}

.record-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.record-card-header,
.record-card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.record-card-header h3 {
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-card-actions {
  justify-content: flex-end;
  gap: 6px;
}

.record-card-actions button {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 0.78rem;
}

.record-card h3 {
  margin: 0;
  font-size: 0.96rem;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.record-fact {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.record-fact dt {
  color: #8a98ad;
  font-weight: 700;
}

.record-fact dd {
  overflow: hidden;
  margin: 0;
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .record-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .record-card-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

.state-pill {
  padding: 5px 8px;
  border-radius: var(--radius-pill);
  background: #edf2f8;
  color: #5d6e85;
  font-size: 0.66rem;
  font-weight: 850;
}

.state-pill.active,
.state-pill.validated,
.state-pill.passed,
.state-pill.normal,
.state-pill.published {
  background: #dcf3e8;
  color: #247351;
}

.state-pill.quarantined,
.state-pill.unvalidated,
.state-pill.untested {
  background: var(--segment-hover);
  color: #7a5d13;
}

.empty-state,
.transfer-report {
  padding: 18px;
  border: 1px dashed rgba(74, 105, 149, 0.25);
  border-radius: var(--radius-medium);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 16px;
}

.review-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.76rem;
}

.review-bar > span {
  margin-right: auto;
}

.transfer-grid {
  margin-top: 18px;
}

.memory-heading-actions,
.memory-card-header,
.memory-card-footer,
.memory-identity {
  display: flex;
  align-items: center;
}

.memory-heading-actions {
  gap: 8px;
}

.memory-filter-bar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(160px, 0.34fr) auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 22px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  background: rgba(244, 249, 255, 0.74);
}

.memory-filter-bar label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}

.memory-filter-bar input,
.memory-filter-bar select {
  width: 100%;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-solid);
  color: var(--ink);
  font: inherit;
}

.memory-list {
  display: grid;
  gap: 10px;
  min-height: 140px;
  max-height: 62vh;
  padding-right: 4px;
  overflow-y: auto;
}

.memory-card > .memory-card-header {
  cursor: pointer;
  list-style: none;
}

.memory-card > .memory-card-header::-webkit-details-marker {
  display: none;
}

.memory-preview {
  overflow: hidden;
  max-width: 420px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.memory-card[open] > .memory-card-header {
  border-bottom-color: rgba(99, 138, 187, 0.22);
}

.memory-card .memory-card-body {
  max-height: 46vh;
  overflow-y: auto;
}

.memory-card {
  overflow: hidden;
  border: 1px solid rgba(99, 138, 187, 0.2);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 28px rgba(52, 88, 137, 0.07);
}

.memory-card-header,
.memory-card-footer {
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
}

.memory-card-header {
  border-bottom: 1px solid rgba(99, 138, 187, 0.13);
  background: rgba(238, 246, 255, 0.68);
}

.memory-identity {
  gap: 10px;
}

.memory-identity strong {
  color: #175f9f;
  font-size: 0.84rem;
}

.memory-identity span,
.memory-card-footer {
  color: var(--muted);
  font-size: 0.72rem;
}

.memory-card-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.memory-field {
  min-width: 0;
  padding: 16px 18px;
  border-right: 1px solid rgba(99, 138, 187, 0.1);
  border-bottom: 1px solid rgba(99, 138, 187, 0.1);
}

.memory-field-wide {
  grid-column: 1 / -1;
}

.memory-field h4 {
  margin: 0 0 8px;
  color: #8193ab;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.memory-field-value {
  color: #33475f;
  font-size: 0.84rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.memory-output {
  background: rgba(246, 251, 255, 0.66);
}

.memory-correction {
  border-left: 3px solid #e3b84d;
  background: #fffbef;
}

.memory-field-payload .memory-field-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
}

.settings-form progress,
.account-transfer-form progress {
  width: 100%;
  height: 9px;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-pill);
  background: #e9eff7;
}

.settings-form progress::-webkit-progress-bar,
.account-transfer-form progress::-webkit-progress-bar {
  background: #e9eff7;
}

.settings-form progress::-webkit-progress-value,
.account-transfer-form progress::-webkit-progress-value {
  background: #72a8df;
}

.settings-form progress::-moz-progress-bar,
.account-transfer-form progress::-moz-progress-bar {
  background: #72a8df;
}

@media (max-width: 880px) {
  .portal-topbar {
    grid-template-columns: 1fr auto;
    border-radius: var(--radius-medium);
  }

  .topbar-actions {
    flex-wrap: wrap;
  }

  .topbar-user-area {
    justify-content: flex-end;
  }

  .application-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .skills-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-grid,
  .settings-grid-aside {
    grid-template-columns: 1fr;
  }

  .settings-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 760px) {
  .memory-heading,
  .memory-card-header,
  .memory-card-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .memory-filter-bar,
  .memory-card-body {
    grid-template-columns: 1fr;
  }

  .memory-field-wide {
    grid-column: auto;
  }
}

@media (max-width: 540px) {
  .ontology-phase-heading { flex-wrap: wrap; gap: 4px 12px; }
  .ontology-feedback { text-align: left; }
  .portal-shell {
    width: min(100% - 20px, 1180px);
  }

  .portal-hero {
    padding-top: 64px;
  }

  .portal-topbar {
    grid-template-columns: 1fr;
  }

  .topbar-user-area {
    justify-self: stretch;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .portal-segments {
    width: 100%;
  }

  .segment-button {
    flex: 1;
    min-width: 0;
    padding-inline: 10px;
  }

  .application-grid {
    grid-template-columns: 1fr;
  }

  .skills-grid {
    grid-template-columns: 1fr;
  }

  .settings-workspace {
    padding-top: 44px;
  }

  .settings-heading h1 {
    font-size: 2.55rem;
  }

  .settings-panel {
    padding: 20px;
    border-radius: 22px;
  }

  .form-pair,
  .search-row {
    grid-template-columns: 1fr;
  }

  .review-bar {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Shared OIX shell accents used by the portal and every settings/workbench page. */
.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 24px;
  color: #7a8ca6;
  font-size: 0.72rem;
  letter-spacing: 0.01em;
  text-align: center;
}

.portal-hero .hero-summary,
.portal-hero .hero-subtitle {
  max-width: 720px;
  margin-right: auto;
  margin-left: auto;
}

.portal-hero .hero-subtitle {
  margin-top: 8px;
  color: #73839b;
  font-size: 0.92rem;
}

/* Compact the homepage without changing shared settings/workbench spacing.
   Content can still grow and scroll on small screens or with enlarged text. */
.portal-home {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.portal-home .portal-shell {
  flex: 1 0 auto;
  padding: 16px 0 12px;
}

.portal-home .portal-hero {
  padding: 24px 16px 20px;
}

.portal-home .eyebrow {
  margin-bottom: 8px;
}

.portal-home .portal-hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.12;
}

.portal-home .portal-hero .hero-summary {
  margin-top: 12px;
  line-height: 1.5;
}

.portal-home .portal-catalog {
  padding-top: 0;
}

.portal-home .portal-segments {
  margin-bottom: 16px;
}

.portal-home .segment-button {
  padding-block: 8px;
}

.portal-home .application-grid {
  gap: 14px;
}

.portal-home .ontology-phase + .ontology-phase {
  margin-top: 16px;
}

.portal-home .ontology-phase-heading {
  margin-bottom: 8px;
  padding-bottom: 6px;
}

.portal-home .application-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: 16px;
  row-gap: 5px;
  align-content: start;
  min-height: 140px;
  padding: 18px 20px 40px;
}

.portal-home .card-index {
  grid-column: 1;
  grid-row: 1;
  text-align: center;
}

.portal-home .card-mark {
  grid-column: 1;
  grid-row: 2 / 5;
  width: 44px;
  height: 44px;
  margin: 0;
}

.portal-home .card-title {
  grid-column: 2;
  grid-row: 1 / 3;
  font-size: 1.2rem;
  line-height: 1.25;
}

.portal-home .card-product {
  grid-column: 2;
  grid-row: 3;
  margin: 0;
  line-height: 1.3;
}

.portal-home .card-description {
  grid-column: 2;
  grid-row: 4;
  margin: 0;
  line-height: 1.5;
}

.portal-home .enabled-badge {
  bottom: 12px;
  padding: 4px 8px;
}

.portal-home .ontology-feedback {
  margin-top: 12px;
}

.portal-home .site-footer {
  flex: none;
  padding-bottom: 14px;
}

@media (min-width: 881px) and (max-height: 800px) {
  .portal-home .portal-hero {
    padding-block: 8px;
  }

  .portal-home .portal-hero h1 {
    font-size: 2.25rem;
  }

  .portal-home .eyebrow {
    margin-bottom: 4px;
  }

  .portal-home .portal-hero .hero-summary {
    margin-top: 4px;
  }
}

.logout-button {
  white-space: nowrap;
}

.directory-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.directory-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 20px;
}

.summary-card {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid rgba(89, 128, 177, 0.14);
  border-radius: var(--radius-medium);
  background: rgba(239, 247, 255, 0.8);
}

.summary-card span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.summary-card strong {
  color: #246bce;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.user-directory-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(89, 128, 177, 0.14);
  border-radius: var(--radius-medium);
  background: rgba(255, 255, 255, 0.65);
}

.user-directory-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.user-directory-table th,
.user-directory-table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(89, 128, 177, 0.11);
  text-align: left;
  vertical-align: middle;
}

.user-directory-table th {
  color: #7486a0;
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.user-directory-table tbody tr:last-child td {
  border-bottom: 0;
}

.user-directory-table tbody tr:hover {
  background: rgba(234, 243, 255, 0.58);
}

.user-account {
  min-width: 150px;
}

.user-account strong {
  display: block;
  margin: 0 0 4px;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.user-account .user-account-id {
  display: block;
  margin: 0 0 4px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.68rem;
  overflow-wrap: anywhere;
}

.user-account .state-pill {
  display: inline-block;
  margin: 2px 4px 0 0;
  white-space: nowrap;
}

.user-actions .secondary-button,
.user-actions .quiet-button {
  min-height: 32px;
  padding: 5px 12px;
  font-size: 0.74rem;
}

.user-role,
.user-status,
.user-date,
.user-number {
  color: var(--muted);
  white-space: nowrap;
}

.user-date {
  min-width: 84px;
  white-space: normal !important;
}

.user-actions {
  text-align: right;
  white-space: nowrap;
}

.user-actions > * + * {
  margin-left: 6px;
}

.user-protected-note {
  display: inline-flex;
  white-space: normal;
  max-width: 180px;
  text-align: right;
  align-items: center;
  min-height: 34px;
  color: #8a98ad;
  font-size: 0.74rem;
  font-weight: 700;
}

.state-pill.shared {
  background: #efe8ff;
  color: #5b3fb3;
}

.record-group-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 6px 2px 2px;
  color: var(--muted);
  font-size: 0.8rem;
}

.record-group-heading:not(:first-child) {
  margin-top: 14px;
}

.record-group-heading strong {
  color: var(--ink, #1c2a3e);
  font-size: 0.86rem;
}

.state-pill.protected {
  background: #e3eeff;
  color: #1f5fae;
}

.user-directory-table .empty-row td {
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
}

.ui-modal {
  width: min(480px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: var(--radius-large);
  background: transparent;
  box-shadow: 0 24px 80px rgba(36, 74, 125, 0.25);
}

.ui-modal::backdrop {
  background: rgba(25, 44, 72, 0.28);
  backdrop-filter: blur(4px);
}

.ui-modal-panel {
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.94);
  border-radius: var(--radius-large);
  background: #f8fbff;
}

.account-transfer-dialog {
  width: min(680px, calc(100% - 28px));
}

.account-transfer-form,
.account-transfer-fields,
.account-transfer-fields label {
  display: grid;
}

.account-transfer-form {
  gap: 16px;
}

.account-transfer-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.account-transfer-fields label {
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.account-transfer-fields select,
.account-transfer-fields input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-solid);
  color: var(--ink);
  font: inherit;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-solid);
  color: var(--muted);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.icon-button:hover {
  background: var(--segment-hover);
  color: var(--ink);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.debug-console {
  margin: 32px clamp(16px, 4vw, 64px) 20px;
  border: 1px solid #253754;
  border-radius: 18px;
  background: #0f1b2d;
  color: #dce8fb;
  box-shadow: 0 18px 42px rgb(15 27 45 / 18%);
}

.debug-console summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  cursor: pointer;
  font-weight: 700;
}

.debug-console-status {
  color: #8fb9ff;
  font-size: 0.82rem;
  font-weight: 600;
}

.debug-console-status[data-state="connected"] {
  color: #74d7a4;
}

.debug-console-status[data-state="error"] {
  color: #ff9b9b;
}

.debug-console-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.debug-console-actions button {
  min-height: 32px;
  padding: 5px 13px;
  border: 1px solid #5476a7;
  border-radius: 999px;
  background: linear-gradient(180deg, #1b3151, #152741);
  color: #dce8fb;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1;
  letter-spacing: 0.01em;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 8%);
}

.debug-console-actions button:hover,
.debug-console-actions button:focus-visible {
  border-color: #8fb9ff;
  background: #20395e;
}

.debug-console-actions button:focus-visible {
  outline: 2px solid #8fb9ff;
  outline-offset: 2px;
}

.debug-console pre {
  max-height: 420px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  border-top: 1px solid #253754;
  color: #cbd8ec;
  font: 0.78rem/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Download preparation: explains a slow "fetch latest release" wait. */
.download-dialog-panel {
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
}

.download-dialog h2 {
  padding-right: 0;
  font-size: 1.3rem;
}

.download-dialog .auth-dialog-summary {
  margin: 8px 0 4px;
}

.download-spinner {
  width: 38px;
  height: 38px;
  margin-bottom: 12px;
  border: 4px solid var(--category-selected-bg, #e5efff);
  border-top-color: #2574d8;
  border-radius: 50%;
  animation: download-spin 0.9s linear infinite;
}

.download-spinner[hidden] {
  display: none;
}

.download-dialog-close {
  margin-top: 12px;
}

@keyframes download-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .download-spinner {
    animation-duration: 2.4s;
  }
}

/* One select style for every page: a quiet field with a slim chevron. The
   selector is deliberately specific so it wins over each app's field rules
   (which only set size, radius, and padding), while the compact header
   switcher keeps its own inline style. */
select:not([multiple]):not([size]):not(.status-switch) {
  padding-right: 38px;
  border: 1px solid rgba(74, 105, 149, 0.24);
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.75 6 6.25l4.5-4.5' fill='none' stroke='%235b6f8c' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 14px center;
  background-repeat: no-repeat;
  background-size: 12px 8px;
  box-shadow: 0 1px 2px rgba(25, 36, 56, 0.04);
  color: var(--ink, #192438);
  text-overflow: ellipsis;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

select:not([multiple]):not([size]):not(.status-switch):hover:not(:disabled) {
  border-color: rgba(37, 116, 216, 0.45);
  background-color: #fbfdff;
}

select:not([multiple]):not([size]):not(.status-switch):focus,
select:not([multiple]):not([size]):not(.status-switch):focus-visible {
  border-color: #2574d8;
  box-shadow: 0 0 0 3px rgba(37, 116, 216, 0.16);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.75 6 6.25l4.5-4.5' fill='none' stroke='%232574d8' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

select:not([multiple]):not([size]):not(.status-switch):disabled {
  background-color: #f3f6fa;
  color: #8a98ad;
  cursor: not-allowed;
  opacity: 1;
}

select:not([multiple]):not([size]):not(.status-switch)::-ms-expand {
  display: none;
}

select option {
  color: var(--ink, #192438);
  background: #fff;
}

/* System settings (root only): two tabs, each a form plus an overview card. */
.sys-tabs {
  display: inline-flex;
  gap: 4px;
  margin: 0 0 20px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(63, 94, 138, 0.08);
}

.sys-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 800;
  transition: background-color 140ms ease, color 140ms ease;
}

.sys-tab:hover {
  background: rgba(234, 243, 255, 0.7);
  color: var(--ink);
}

.sys-tab[aria-selected="true"] {
  border-color: rgba(36, 107, 206, 0.2);
  background: var(--category-selected-bg);
  color: var(--category-selected-text);
}

.sys-tab:focus-visible {
  outline: 3px solid #155fb8;
  outline-offset: 3px;
}

.sys-tab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c3cddb;
}

.sys-tab-dot[data-state="on"] {
  background: #2f9e6b;
  box-shadow: 0 0 0 3px rgba(47, 158, 107, 0.16);
}

.sys-tab-dot[data-state="off"] {
  background: #d7a53a;
}

.sys-panel[hidden] {
  display: none;
}

.sys-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}

.sys-main {
  display: grid;
  gap: 16px;
  min-width: 0;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sys-layout[aria-busy="true"] .sys-main {
  opacity: 0.75;
}

.sys-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.sys-hero h2 {
  margin: 0 0 4px;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.sys-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.sys-hero-icon,
.sys-event-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  border-radius: 14px;
  background: linear-gradient(145deg, #e3efff, #cfe3fb);
  color: #245f9f;
}

.sys-hero-icon {
  width: 48px;
  height: 48px;
}

.sys-hero-icon .sys-icon {
  width: 24px;
  height: 24px;
}

.sys-hero-icon.is-notify {
  background: linear-gradient(145deg, #fff6d9, #ffe9b0);
  color: #8a6310;
}

.sys-switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.sys-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.sys-switch-track {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: var(--radius-pill);
  background: #cdd6e3;
  transition: background-color 160ms ease;
}

.sys-switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(25, 36, 56, 0.25);
  content: "";
  transition: transform 160ms ease;
}

.sys-switch input:checked + .sys-switch-track {
  background: #2f7fd6;
}

.sys-switch input:checked + .sys-switch-track::after {
  transform: translateX(18px);
}

.sys-switch input:focus-visible + .sys-switch-track {
  outline: 3px solid #155fb8;
  outline-offset: 2px;
}

.sys-section {
  display: grid;
  gap: 14px;
  min-width: 0;
  margin: 0;
  padding: 18px 20px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  background: rgba(247, 251, 255, 0.75);
}

.sys-section[hidden] {
  display: none;
}

.sys-section legend {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 850;
}

.sys-section legend .sys-icon {
  width: 17px;
  height: 17px;
  color: #3a78c2;
}

.sys-section legend small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.sys-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.sys-field {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
}

.sys-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.sys-label em {
  margin-left: 3px;
  color: #cf5b62;
  font-style: normal;
}

.sys-field input {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid rgba(74, 105, 149, 0.22);
  border-radius: 12px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.sys-field input:focus {
  border-color: #4e8ed8;
  box-shadow: 0 0 0 3px rgba(78, 142, 216, 0.16);
}

.sys-main .field-hint,
.settings-form .field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
}

.sys-main .check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
}

.sys-main .check-row[hidden] {
  display: none;
}

.sys-main .check-row input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: #2f6fb8;
}

.sys-option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 14px;
  border: 1px dashed rgba(74, 105, 149, 0.28);
  border-radius: 12px;
  background: #ffffff;
  cursor: pointer;
}

.sys-option:has(input:checked) {
  border-style: solid;
  border-color: #d7a53a;
  background: #fffaec;
}

.sys-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.sys-option-box {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border: 1.5px solid #b9c5d6;
  border-radius: 5px;
  background: #ffffff;
}

.sys-option input:checked + .sys-option-box {
  border-color: #b8860b;
  background: #b8860b url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5 10.5 3.2 3L15 6.5' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}

.sys-option input:focus-visible + .sys-option-box {
  outline: 3px solid #155fb8;
  outline-offset: 2px;
}

.sys-option-text {
  display: grid;
  gap: 3px;
}

.sys-option-text strong {
  font-size: 0.84rem;
}

.sys-option-text small {
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.5;
}

.sys-event-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.sys-event {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid rgba(74, 105, 149, 0.18);
  border-radius: 14px;
  background: #ffffff;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.sys-event:hover {
  border-color: rgba(47, 127, 214, 0.45);
}

.sys-event-wide {
  grid-column: 1 / -1;
}

.sys-event input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.sys-event-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
}

.sys-event-text {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.sys-event-text strong {
  font-size: 0.86rem;
}

.sys-event-text small {
  color: var(--muted);
  font-size: 0.72rem;
}

.sys-event-check {
  width: 20px;
  height: 20px;
  flex: none;
  border: 1.5px solid #b9c5d6;
  border-radius: 6px;
  background: #ffffff;
}

.sys-event:has(input:checked) {
  border-color: #6ea3dd;
  background: #f1f7ff;
  box-shadow: 0 0 0 3px rgba(78, 142, 216, 0.1);
}

.sys-event input:checked ~ .sys-event-check {
  border-color: #2f7fd6;
  background: #2f7fd6 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5 10.5 3.2 3L15 6.5' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
}

.sys-event input:focus-visible ~ .sys-event-check {
  outline: 3px solid #155fb8;
  outline-offset: 2px;
}

.sys-event-check.is-radio {
  border-radius: 50%;
}

.sys-event input:checked ~ .sys-event-check.is-radio {
  background: #ffffff;
  box-shadow: inset 0 0 0 5px #2f7fd6;
}

.sys-main .form-message {
  margin: 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--segment-selected);
  color: #245f9f;
  font-size: 0.8rem;
  font-weight: 700;
}

.sys-main .form-message[hidden] {
  display: none;
}

.sys-main .form-message[data-state="success"] {
  background: #dcf3e8;
  color: #247351;
}

.sys-main .form-message[data-state="error"] {
  background: rgba(207, 91, 98, 0.12);
  color: #a2343c;
}

.sys-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.sys-actions-spacer {
  flex: 1;
}

.sys-actions .primary-button {
  min-width: 112px;
  border-color: #2f7fd6;
  background: #2f7fd6;
  color: #ffffff;
}

.sys-aside {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 14px;
}

.sys-summary,
.sys-tip {
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-medium);
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(53, 88, 137, 0.09);
}

.sys-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  font-size: 0.86rem;
  font-weight: 850;
}

.sys-facts {
  display: grid;
  gap: 11px;
  margin: 0;
}

.sys-fact {
  display: grid;
  gap: 3px;
}

.sys-fact dt {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}

.sys-fact dd {
  margin: 0;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.sys-fact dd.is-empty {
  color: #9aa6b8;
  font-weight: 500;
}

.sys-tip {
  background: rgba(242, 248, 255, 0.9);
}

.sys-tip strong {
  font-size: 0.82rem;
}

.sys-tip ul {
  display: grid;
  gap: 7px;
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.55;
}

@media (max-width: 960px) {
  .sys-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sys-aside {
    position: static;
    grid-row: 1;
  }
}

@media (max-width: 640px) {
  .sys-tabs {
    display: flex;
  }

  .sys-tab {
    flex: 1;
    justify-content: center;
    padding: 10px 12px;
  }

  .sys-main {
    padding: 20px;
  }

  .sys-hero {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .sys-hero .sys-switch {
    grid-column: 1 / -1;
  }

  .sys-row,
  .sys-event-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Sign-in dialog: OAuth first when configured, local accounts collapsible. */
.auth-oidc.is-primary {
  margin-top: 4px;
  font-weight: 800;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 6px;
  color: #8a97ab;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
}

.auth-divider::before,
.auth-divider::after {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(74, 105, 149, 0.22), transparent);
  content: "";
}

.auth-local > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 6px auto 4px;
  padding: 8px 14px;
  width: fit-content;
  border-radius: 999px;
  color: #245f9f;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
  list-style: none;
  transition: background 150ms ease;
}

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

.auth-local > summary::after {
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: "";
  transform: translateY(-2px) rotate(45deg);
  transition: transform 150ms ease;
}

.auth-local[open] > summary::after {
  transform: translateY(1px) rotate(225deg);
}

.auth-local > summary:hover,
.auth-local > summary:focus-visible {
  background: #eef4fc;
  outline: none;
}

.auth-local[open] > .auth-form {
  margin-top: 10px;
  padding: 18px;
  border: 1px solid rgba(74, 105, 149, 0.14);
  border-radius: 16px;
  background: rgba(248, 251, 255, 0.85);
}
/* Compact field explanations shared by the application workbenches. */
.ui-help { display: inline-flex; align-items: center; vertical-align: middle; margin-left: 4px; }
.ui-help-trigger { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--muted); font-family: inherit; font-size: 0.75rem; font-weight: 700; line-height: 1; cursor: help; }
.ui-help-trigger:hover,
.ui-help-trigger[aria-expanded="true"] { background: var(--selected); color: var(--blue-strong); border-color: var(--blue); }
.ui-help-trigger:focus-visible { outline: 3px solid var(--blue-strong); outline-offset: 3px; }
.ui-help-content { position: fixed; z-index: 100; width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 8px 24px rgba(62, 93, 139, 0.16); color: var(--ink); font-size: 0.8rem; font-weight: 500; line-height: 1.65; white-space: normal; text-align: left; }
.ui-help-content[hidden] { display: none; }
.ui-help-content > span { display: block; }
.ui-help-content > span + span { margin-top: 10px; }

[data-portal-entry="doc2skill"] .card-mark { --mark-ink: #5c57a2; --mark-from: #f4f1ff; --mark-to: #e5defa; }
