/* Shared universal layout + utilities extracted from assets/app.css.
   Update both files together when adjusting the layout system. */
:root {
  --layout-max-width: var(--container-max, 1280px);
  --layout-page-padding-x: var(--spacing-2xl, 2rem);
  --layout-page-padding-y: var(--spacing-xl, 1.5rem);
  --layout-section-gap: var(--spacing-2xl, 2rem);
  --layout-content-gap: var(--spacing-xl, 1.5rem);
  --layout-sidebar-width: 320px;
  --layout-page-background: var(--layout-main-background, var(--mhn-surface, #ffffff));
  --layout-page-border: 1px solid var(--mhn-border, #e2e8f0);
  --layout-page-radius: var(--card-radius, 12px);
  --layout-page-padding: var(--spacing-xl, 1.5rem);
  --layout-page-gap: var(--layout-content-gap, var(--spacing-xl, 1.5rem));
  --layout-header-background: var(--mhn-surface, #ffffff);
  --layout-header-border: var(--mhn-border, #e2e8f0);
  --layout-header-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.06));
  --layout-header-padding-y: var(--spacing-md, 1rem);
  --layout-nav-gap: var(--spacing-lg, 1.5rem);
  --layout-nav-padding-y: var(--spacing-sm, 0.75rem);
  --layout-breadcrumb-gap: var(--spacing-sm, 0.75rem);
  --layout-hero-gap: var(--spacing-lg, 1rem);
  --body-text-color: var(--mhn-fg, #0f172a);
  --body-text-muted: var(--mhn-muted, #64748b);
  --body-text-line-height: var(--line-height-normal, 1.6);
  --button-font-size: var(--font-size-sm, 0.875rem);
  --button-font-weight: var(--font-weight-semibold, 600);
  --button-letter-spacing: 0.02em;
  --button-text-transform: uppercase;
  --button-gap: var(--spacing-sm, 0.5rem);
  --flash-radius: var(--card-radius, 12px);
  --flash-padding: var(--spacing-lg, 1rem);
  --badge-border: color-mix(in srgb, var(--mhn-border, #e2e8f0) 70%, transparent);
  --badge-radius: var(--radius-pill, 999px);
  --badge-padding-y: 0.1rem;
  --badge-padding-x: 0.6rem;
  --badge-letter-spacing: 0.08em;
  --badge-font-weight: var(--font-weight-semibold, 600);
  --badge-font-size: var(--font-size-xs, 0.75rem);
}

[hidden] {
  display: none !important;
}

.mhn-body {
  font-family: var(--font-sans, system-ui, -apple-system, "Segoe UI", sans-serif);
  background: var(--mhn-surface-1, #f8fafc);
  color: var(--body-text-color);
  line-height: var(--body-text-line-height);
  margin: 0;
  min-height: 100vh;
}

.mhn-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--layout-shell-background, var(--mhn-surface, #ffffff));
}

.mhn-shell__container {
  box-sizing: border-box;
  min-width: 0;
  width: min(var(--layout-max-width), 100%);
  margin-inline: auto;
  padding-inline: var(--layout-page-padding-x);
}

.mhn-shell__container--content {
  padding-block: var(--layout-page-padding-y);
  display: flex;
  flex-direction: column;
  gap: var(--layout-section-gap);
}

html {
  scroll-padding-top: calc(var(--layout-header-scroll-offset, 0px) + var(--layout-content-gap, 1rem));
}

.mhn-header {
  background: var(--layout-header-background);
  border-bottom: 1px solid var(--layout-header-border);
  box-shadow: var(--layout-header-shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}

.mhn-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--layout-nav-gap);
  padding-block: var(--layout-header-padding-y);
}

.mhn-brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg, 1rem);
}

.mhn-app-name {
  font-size: var(--font-size-lg, 1.125rem);
  font-weight: var(--font-weight-semibold, 600);
  color: var(--mhn-accent, #741c73);
}

@media (max-width: 640px) {
  .mhn-app-name {
    display: none;
  }
}

.mhn-navigation { border-top: 1px solid var(--layout-header-border); }
.mhn-navigation .mhn-shell__container { padding-block: 0; }
.mhn-rootmenu, .mhn-submenu { list-style: none; margin: 0; padding: 0; }
.mhn-rootmenu {
  display: flex;
  flex-wrap: wrap;
  gap: var(--layout-nav-gap);
  padding-block: var(--layout-nav-padding-y);
  min-width: 0;
}
.mhn-rootmenu li { position: relative; min-width: 0; }
.mhn-rootmenu a {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs, 0.25rem);
  max-width: 100%;
  padding-block: var(--spacing-xs, 0.25rem);
  text-decoration: none;
  color: var(--body-text-muted);
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: var(--navigation-font-size, var(--font-size-base, 1rem));
  font-weight: var(--navigation-font-weight, 600);
  letter-spacing: var(--navigation-letter-spacing, 0.025em);
  text-transform: var(--navigation-text-transform, uppercase);
  line-height: var(--body-text-line-height, 1.5);
  overflow-wrap: anywhere;
}
.mhn-rootmenu a:hover, .mhn-rootmenu a:focus-visible,
.mhn-rootmenu li.mhn-active > a, .mhn-rootmenu li.mhn-active-ancestor > a {
  color: var(--mhn-accent, #741c73);
}
.mhn-rootmenu a:focus-visible {
  outline: 2px solid var(--focus-ring, var(--mhn-accent, #741c73));
  outline-offset: 2px;
}
.mhn-rootmenu > li > a { position: relative; }
.mhn-rootmenu > li > a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--mhn-accent, #741c73);
  transform: scaleX(0);
  transition: transform 120ms ease;
}
.mhn-rootmenu > li:hover > a::after, .mhn-rootmenu > li:focus-within > a::after,
.mhn-rootmenu > li.mhn-active > a::after, .mhn-rootmenu > li.mhn-active-ancestor > a::after {
  transform: scaleX(1);
}
.mhn-submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: min(18rem, calc(100vw - 2 * var(--layout-page-padding-x, 2rem)));
  max-width: calc(100vw - 2 * var(--layout-page-padding-x, 2rem));
  background: var(--layout-header-background, var(--mhn-surface, #fff));
  border: 1px solid var(--layout-header-border, var(--mhn-border, #e2e8f0));
  border-radius: var(--radius-sm, 4px);
  box-shadow: var(--shadow-md, 0 2px 6px rgba(0,0,0,.08));
  z-index: 1;
}
.mhn-rootmenu .has-children:hover > .mhn-submenu,
.mhn-rootmenu .has-children:focus-within > .mhn-submenu { display: block; }
.mhn-submenu .mhn-submenu { left: 100%; top: 0; }
.mhn-submenu li + li { border-top: 1px solid var(--layout-header-border, var(--mhn-border, #e2e8f0)); }
.mhn-submenu > li > a {
  display: block;
  padding: var(--spacing-sm, 0.5rem) var(--spacing-md, 0.75rem);
}
.mhn-submenu > li > a:hover, .mhn-submenu > li > a:focus-visible {
  background: var(--mhn-surface-1, #f8fafc);
}
.mhn-header__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--layout-nav-gap, var(--spacing-lg, 1rem));
  min-width: 0;
}
.mhn-brand, .mhn-logo-link { min-width: 0; }
.mhn-logo { max-width: 100%; height: auto; object-fit: contain; }
.mhn-profile-icon, .mhn-logout-icon {
  display: inline-flex;
  flex: 0 0 2rem;
  width: 2rem;
  height: 2rem;
}
.mhn-profile-icon img, .mhn-logout-icon img { display: block; width: 100%; height: 100%; }
.mhn-profile-icon { position: relative; }
.mhn-burger {
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--layout-header-border);
  border-radius: var(--btn-radius, 10px);
  padding: var(--spacing-xs, 0.25rem) var(--spacing-sm, 0.5rem);
  min-width: 2.5rem;
  min-height: 2.5rem;
  color: var(--mhn-accent, #741c73);
  font-size: var(--font-size-lg, 1.125rem);
  cursor: pointer;
}
.mhn-burger:focus-visible {
  outline: 2px solid var(--focus-ring, var(--mhn-accent, #741c73));
  outline-offset: 2px;
}
@media (max-width: 960px) {
  .mhn-header__bar { flex-wrap: wrap; }
  .mhn-brand, .mhn-header__actions { width: 100%; justify-content: space-between; }
  .mhn-burger { display: inline-flex; }
  .mhn-locale-switcher__label { display: none; }
  .mhn-locale-switcher__select { min-width: 5.5rem; }
  #mhn-nav { display: none; }
  #mhn-nav.is-open { display: block; }
  .mhn-rootmenu { flex-direction: column; }
  .mhn-rootmenu > li + li { border-top: 1px solid var(--layout-header-border); }
  .mhn-submenu, .mhn-submenu .mhn-submenu {
    position: static;
    min-width: 0;
    max-width: 100%;
    margin-inline-start: var(--spacing-md, 0.75rem);
    box-shadow: none;
  }
}

.mhn-shell__body {
  flex: 1 1 auto;
}

.mhn-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--layout-breadcrumb-gap);
  font-size: var(--breadcrumb-font-size, var(--font-size-sm, 0.875rem));
  color: var(--breadcrumb-color, var(--body-text-muted));
}

.mhn-breadcrumbs-row {
  justify-content: space-between;
  width: 100%;
}

.mhn-breadcrumbs__trail {
  flex: 1 1 auto;
  min-width: 0;
}

.mhn-breadcrumbs__trail nav {
  min-width: 0;
}

.mhn-breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--layout-breadcrumb-gap, var(--spacing-sm, 0.75rem));
  font-size: inherit;
  list-style: none;
  margin: 0;
  padding: 0;
}

.mhn-breadcrumbs li {
  display: flex;
  align-items: baseline;
  gap: var(--layout-breadcrumb-gap, var(--spacing-sm, 0.75rem));
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.mhn-breadcrumbs li + li::before {
  content: "›";
  flex: 0 0 auto;
  color: var(--breadcrumb-separator-color, var(--body-text-muted));
}

.mhn-breadcrumbs li > :is(a, span) {
  min-width: 0;
}

.mhn-breadcrumbs__datetime {
  flex: 0 0 auto;
  margin-left: auto;
  color: inherit;
  font-size: inherit;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  line-height: 1.4;
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .mhn-breadcrumbs__datetime {
    width: 100%;
  }
}

.mhn-shell__flash {
  display: grid;
  gap: var(--spacing-sm, 0.75rem);
}

.mhn-flash,
.mhn-alert {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  border-radius: var(--flash-radius, var(--card-radius, 12px));
  padding: var(--flash-padding, var(--spacing-lg, 1rem));
  border: var(--flash-border-width, var(--card-border-width, 1px)) solid transparent;
  background: var(--mhn-surface, #ffffff);
  color: var(--body-text-color, #0f172a);
  box-shadow: var(--flash-shadow, var(--shadow-sm, 0 1px 2px rgba(0,0,0,.06)));
}

.mhn-flash--success,
.mhn-alert--success,
.mhn-alert-success {
  border-color: var(--mhn-success, #16a34a);
  background: var(--mhn-success-bg, #dcfce7);
  color: var(--mhn-success-fg, #166534);
}

.mhn-flash--error,
.mhn-flash--danger,
.mhn-alert--error,
.mhn-alert--danger,
.mhn-alert-error,
.mhn-alert-danger {
  border-color: var(--mhn-danger, #e11d48);
  background: var(--mhn-danger-bg, #fee2e2);
  color: var(--mhn-danger-fg, #991b1b);
}

/* -------------------------------------------------------------------------- */
/* Error pages                                                                */
/* -------------------------------------------------------------------------- */

.error-page {
  display: block;
}

.error-page--standard {
  max-width: 52rem;
  margin: 0 auto;
}

.error-page__stack {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl, 1.5rem);
}

.error-page__header {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs, 0.25rem);
}

.error-page__subtitle {
  margin: 0;
  color: var(--mhn-muted, #6b7280);
}

.error-page__section {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md, 1rem);
}

.error-page__button-row,
.error-page__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm, 0.75rem);
  justify-content: center;
  align-items: center;
}

.error-page__meta {
  color: var(--mhn-muted, #6b7280);
  text-align: center;
}

.error-page__meta--row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm, 0.75rem);
  justify-content: center;
  align-items: center;
}

.error-page__message {
  margin: 0;
  padding: var(--spacing-sm, 0.75rem);
  background: color-mix(in srgb, var(--mhn-surface, #ffffff) 80%, #0f172a 5%);
  border-radius: var(--card-radius, 12px);
  border: 1px solid color-mix(in srgb, var(--mhn-border, #e2e8f0) 80%, transparent);
  overflow-x: auto;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace);
}

.error-page__heading {
  margin: 0;
  font-size: var(--font-size-lg, 1.125rem);
}

.error-page__debug {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--spacing-xs, 0.5rem);
}

.error-page__debug-item {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs, 0.5rem);
  justify-content: space-between;
  align-items: center;
}

.error-page--void .void-logo,
.error-page--server .err-logo {
  color: var(--mhn-accent, #8b5cf6);
}

/* 404 visuals */

.void-stage {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 70% 30%, rgba(139,92,246,.15), transparent 60%),
    radial-gradient(800px 400px at 20% 70%, rgba(59,130,246,.12), transparent 60%),
    linear-gradient(180deg, var(--mhn-surface-1, #0b1020), var(--mhn-surface-2, #0a0c1a));
  min-height: 340px;
  box-shadow: 0 6px 20px rgba(0,0,0,.20) inset, 0 6px 24px rgba(0,0,0,.12);
  border: 1px solid rgba(255,255,255,.06);
}

.void-sky {
  position: relative;
  width: 100%;
  height: 100%;
}

.void-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.void-hole {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 220px;
  height: 220px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(0,0,0,0) 60%, rgba(0,0,0,.8) 62%, rgba(0,0,0,1) 70%, rgba(0,0,0,1) 100%),
    conic-gradient(from 0deg, rgba(139,92,246,.25), rgba(59,130,246,.25), rgba(16,185,129,.2), rgba(139,92,246,.25));
  filter: blur(.25px);
  box-shadow:
    0 0 50px 15px rgba(139,92,246,.15),
    0 0 120px 30px rgba(59,130,246,.10);
  animation: swirl 14s linear infinite;
}

.void-ship {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: -180px -180px;
  font-size: 1.35rem;
  animation: orbit 10s linear infinite;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.6));
}

.void-toggle {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  backdrop-filter: blur(4px);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  padding-inline: var(--spacing-sm, 0.75rem);
}

.void-toggle.mhn-button--secondary {
  background: rgba(255,255,255,.12);
  color: #fff;
  border-color: rgba(255,255,255,.18);
}

.void-tip {
  text-align: center;
  color: var(--mhn-muted, #6b7280);
  font-size: var(--font-size-sm, 0.875rem);
}

.void-search {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--spacing-sm, 0.75rem);
}

.void-search .mhn-input {
  min-width: 220px;
}

.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;
}

.nebula .void-stage {
  background:
    radial-gradient(1200px 600px at 70% 30%, rgba(236,72,153,.16), transparent 60%),
    radial-gradient(900px 500px at 10% 80%, rgba(34,197,94,.12), transparent 60%),
    radial-gradient(700px 600px at 85% 20%, rgba(59,130,246,.16), transparent 60%),
    linear-gradient(180deg, #0a0917, #06050f 60%, #090a16);
}

.nebula .void-hole {
  box-shadow:
    0 0 60px 25px rgba(236,72,153,.15),
    0 0 150px 40px rgba(34,197,94,.10);
}

@keyframes swirl {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes orbit {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .void-hole,
  .void-ship {
    animation: none !important;
  }
}

/* 500 visuals */

.err-stage {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(1000px 500px at 15% 15%, rgba(255,196,0,.10), transparent 60%),
    radial-gradient(900px 600px at 85% 70%, rgba(255,99,99,.10), transparent 60%),
    linear-gradient(180deg, var(--mhn-surface-1, #0b1020), var(--mhn-surface-2, #0a0c1a));
  min-height: 320px;
  box-shadow: 0 6px 20px rgba(0,0,0,.20) inset, 0 6px 24px rgba(0,0,0,.12);
  border: 1px solid rgba(255,255,255,.06);
}

.err-sky {
  position: relative;
  width: 100%;
  height: 100%;
}

.err-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.err-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, 90vw);
  height: 180px;
  background: linear-gradient(180deg, #1a2236, #111827);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}

.err-panel::before,
.err-panel::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 10px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.04) 0 6px, transparent 6px 12px);
}

.err-panel::before {
  top: 0;
}

.err-panel::after {
  bottom: 0;
}

.err-gauge {
  position: absolute;
  left: 24px;
  top: 24px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #0e1626, #0b1020);
  border: 1px solid rgba(255,255,255,.1);
}

.err-gauge .needle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 50px;
  background: #ff6363;
  transform-origin: 50% 95%;
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(255,99,99,.7);
  animation: swing 3s ease-in-out infinite;
}

@keyframes swing {
  0%,
  100% {
    transform: translate(-50%, -95%) rotate(-40deg);
  }
  50% {
    transform: translate(-50%, -95%) rotate(40deg);
  }
}

.err-wrench {
  position: absolute;
  right: 24px;
  bottom: 24px;
  font-size: 2rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.6));
  animation: wobble 2.8s ease-in-out infinite;
}

@keyframes wobble {
  0%,
  100% {
    transform: rotate(-8deg);
  }
  50% {
    transform: rotate(8deg);
  }
}

.err-smoke {
  position: absolute;
  left: 50%;
  top: 0;
  width: 240px;
  height: 240px;
  transform: translate(-50%, -60%);
  background: radial-gradient(closest-side, rgba(200,200,200,.15), rgba(200,200,200,0));
  filter: blur(8px);
  animation: puff 5s linear infinite;
}

@keyframes puff {
  0% {
    transform: translate(-50%, -60%) scale(0.8);
    opacity: .6;
  }
  100% {
    transform: translate(-50%, -95%) scale(1.3);
    opacity: 0;
  }
}

.err-toggle {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  backdrop-filter: blur(4px);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  padding-inline: var(--spacing-sm, 0.75rem);
}

.err-toggle.mhn-button--secondary {
  background: rgba(255,255,255,.12);
  color: #fff;
  border-color: rgba(255,255,255,.18);
}

.err-health {
  text-align: center;
  min-height: 1.25rem;
  color: var(--mhn-muted, #6b7280);
}

.err-diagnostics {
  margin: 0 auto;
  max-width: 960px;
}

.diag-grid {
  display: grid;
  gap: var(--spacing-sm, 0.75rem);
  margin-top: var(--spacing-sm, 0.75rem);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.diag-wide {
  grid-column: 1 / -1;
}

.diag-grid pre {
  background: #0e1424;
  color: #e5e7eb;
  padding: var(--spacing-sm, 0.75rem);
  border-radius: 8px;
  overflow: auto;
  max-height: 220px;
  border: 1px solid rgba(255,255,255,.06);
}

.diag-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm, 0.75rem);
  margin-top: var(--spacing-sm, 0.75rem);
}

.err-tip {
  color: var(--mhn-muted, #6b7280);
  margin-top: var(--spacing-xs, 0.5rem);
  font-size: var(--font-size-sm, 0.875rem);
}

.overdrive .err-stage {
  background:
    radial-gradient(1100px 600px at 10% 20%, rgba(16,185,129,.16), transparent 60%),
    radial-gradient(1000px 600px at 90% 80%, rgba(59,130,246,.16), transparent 60%),
    linear-gradient(180deg, #0a0917, #06050f 60%, #090a16);
}

.overdrive .err-gauge .needle,
.overdrive .err-wrench {
  animation-duration: 1.2s;
}

@media (prefers-reduced-motion: reduce) {
  .err-gauge .needle,
  .err-wrench,
  .err-smoke {
    animation: none !important;
  }
}

.error-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.85);
  color: #fff;
  font-size: var(--font-size-sm, 0.875rem);
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease-in-out;
  z-index: 999;
}

.error-toast.is-visible {
  opacity: 1;
}

.mhn-flash--info,
.mhn-alert--info,
.mhn-alert-info,
.mhn-alert.mhn-info {
  border-color: var(--mhn-info, #3b82f6);
  background: var(--mhn-info-bg, #dbeafe);
  color: var(--mhn-info-fg, #1e40af);
}

.mhn-flash--warning,
.mhn-alert--warning,
.mhn-alert-warning {
  border-color: var(--mhn-warning, #f59e0b);
  background: var(--mhn-warning-bg, #fef3c7);
  color: var(--mhn-warning-fg, #92400e);
}

/* Shared process-diagram appearance; geometry and graph data belong to the renderer. */
.mhn-diagram,
.mhn-card.mhn-diagram,
.mhn-panel.mhn-diagram,
.mhn-preview-frame.mhn-diagram { background: var(--diagram-background, var(--card-subtle-background, #f8fafc)); }
.mhn-diagram-node {
  background: var(--diagram-automated-background, #1d4ed8);
  color: var(--diagram-node-color, #fff);
  border: var(--diagram-node-border-width, 0px) solid var(--diagram-node-border-color, var(--mhn-border, #e2e8f0));
  border-radius: var(--diagram-node-radius, 10px);
  font-family: var(--font-sans, sans-serif);
  font-size: var(--diagram-node-font-size, 13px);
  font-weight: var(--diagram-node-font-weight, 700);
  line-height: var(--line-height-tight, 1.25);
  text-transform: none;
  padding: var(--spacing-sm, 0.5rem);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm, 0.5rem);
  min-width: 0;
  overflow-wrap: anywhere;
  box-shadow: 0 2px var(--diagram-node-shadow-blur, 6px) color-mix(in srgb, var(--diagram-node-shadow-color, #000) calc(var(--diagram-node-shadow-opacity, 0.15) * 100%), transparent);
}
.mhn-diagram-node--manual { background: var(--diagram-manual-background, #6d28d9); }
.mhn-diagram-node--collaborative { background: var(--diagram-collaborative-background, #0e7490); }
.mhn-diagram-node--automated { background: var(--diagram-automated-background, #1d4ed8); }
.mhn-diagram-node--document { background: var(--diagram-document-background, #0f766e); }
.mhn-diagram-node--start { background: var(--diagram-start-background, #15803d); }
.mhn-diagram-node--decision { background: var(--diagram-decision-background, #b45309); }
.mhn-diagram-node--end { background: var(--diagram-end-background, #b91c1c); }
.mhn-diagram-node--compact { font-size: var(--diagram-node-compact-font-size, 11px); }
.mhn-diagram-node__detail {
  font-family: var(--font-sans, sans-serif);
  font-size: var(--diagram-node-detail-font-size, 10px);
  font-weight: var(--font-weight-normal, 400);
  color: var(--diagram-node-detail-color, #fff);
  line-height: var(--line-height-tight, 1.25);
}
.mhn-diagram-node[role=button]:focus-visible {
  outline: max(2px, var(--diagram-selection-width, 1px)) solid var(--diagram-selection-color, var(--mhn-focus, #8b5cf6));
  outline-offset: 2px;
}
.mhn-diagram-grid { border-top: var(--diagram-grid-width, 1px) solid var(--diagram-grid-color, var(--mhn-border, #e2e8f0)); }
.mhn-diagram-edge { border-top: var(--diagram-edge-width, 2px) solid var(--diagram-edge-color, var(--body-text-muted, #64748b)); }
.mhn-diagram-selection { border-top: var(--diagram-selection-width, 1px) solid var(--diagram-selection-color, var(--mhn-focus, #8b5cf6)); }
/* Shared series keys match canvas encodings; dashed lines retain source identity. */
.mhn-diagram-swatch {
  display: inline-block;
  flex: 0 0 auto;
  width: var(--diagram-legend-swatch-width, 1.2rem);
  border-top: var(--diagram-edge-width, 2px) solid var(--_diagram-series-color, var(--diagram-series-1-color, #2563eb));
}
.mhn-diagram-swatch--secondary { --_diagram-series-color: var(--diagram-series-2-color, #16a34a); }
.mhn-diagram-swatch--dashed { border-top-style: dashed; }
.mhn-diagram-swatch--reference { opacity: var(--diagram-reference-opacity, .68); }
.mhn-diagram-swatch--emphasized { border-top-width: calc(2 * var(--diagram-edge-width, 2px)); }
.mhn-diagram-area-swatch {
  height: var(--font-size-xs, 12px);
  background: color-mix(in srgb, var(--_diagram-series-color, var(--diagram-series-1-color, #2563eb)) calc(var(--diagram-area-opacity, .18) * 100%), transparent);
}
.mhn-diagram-shadow {
  color: var(--diagram-node-shadow-color, #000);
  opacity: var(--diagram-node-shadow-opacity, 0.15);
  border-top: var(--diagram-node-shadow-blur, 6px) solid transparent;
}
.mhn-diagram-probe {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}

/* Notification placement composes with shared flash surfaces, not a new palette. */
.mhn-toast-region {
  position: fixed;
  right: var(--layout-content-gap, 1.5rem);
  bottom: var(--layout-content-gap, 1.5rem);
  width: min(26rem, calc(100vw - 2 * var(--layout-content-gap, 1.5rem)));
  max-height: calc(100dvh - 2 * var(--layout-content-gap, 1.5rem));
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm, 0.5rem);
  overflow-y: auto;
  z-index: 4000;
  pointer-events: none;
}
.mhn-toast-region:empty { display: none; }
.mhn-toast-region > .mhn-toast {
  flex-shrink: 0;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 200ms ease, transform 200ms ease;
}
.mhn-toast-region > .mhn-toast.mhn-show { opacity: 1; transform: none; }
.mhn-spinner {
  display: inline-block;
  flex-shrink: 0;
  width: 1em;
  height: 1em;
  animation: mhn-spin 800ms linear infinite;
}
.mhn-spinner circle { stroke-dasharray: 60; stroke-dashoffset: 40; stroke-linecap: round; }
@keyframes mhn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .mhn-toast-region > .mhn-toast { transition: none; transform: none; }
  .mhn-spinner { animation: none; }
}
@media print {
  .mhn-toast-region, .mhn-spinner { display: none !important; }
}

.mhn-layout, .mhn-main-wrapper, .mhn-main, .mhn-sidebar {
  min-width: 0;
}

.mhn-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--layout-content-gap);
}

@media (min-width: 1024px) {
  .mhn-layout--with-sidebar {
    grid-template-columns: minmax(0, 1fr) minmax(0, var(--layout-sidebar-width));
    align-items: start;
  }
}

.mhn-main {
  background: var(--layout-page-background, var(--layout-main-background, var(--mhn-surface, #ffffff)));
  border-radius: var(--layout-page-radius, var(--card-radius, 12px));
  border: var(--layout-page-border, 1px solid var(--mhn-border, #e2e8f0));
  padding: var(--layout-page-padding, var(--spacing-xl, 1.5rem));
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.06));
}

.mhn-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--layout-page-gap, var(--layout-content-gap, var(--spacing-xl, 1.5rem)));
  min-width: 0;
}

.mhn-page__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--layout-page-gap, var(--layout-content-gap, var(--spacing-xl, 1.5rem)));
  min-width: 0;
}

@media (max-width: 768px) {
  .page-header__lead,
  .page-header__actions {
    flex-wrap: wrap;
    min-width: 0;
    max-width: 100%;
  }
}

.mhn-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg, 1rem);
}

.mhn-section {
  font-size: var(--section-heading-font-size, var(--font-size-h2, 1.5rem));
  font-weight: var(--section-heading-font-weight, var(--font-weight-semibold, 600));
  line-height: var(--section-heading-line-height, 1.3);
  letter-spacing: var(--section-heading-letter-spacing, 0);
  text-transform: var(--section-heading-text-transform, none);
  color: var(--section-heading-color, var(--mhn-fg, #0f172a));
  margin: 0 0 var(--section-heading-gap, 1rem) 0;
}

.page-title {
  font-size: var(--page-title-font-size, var(--font-size-h1, 2.25rem));
  font-weight: var(--page-title-font-weight, var(--font-weight-bold, 700));
  line-height: var(--page-title-line-height, 1.25);
  letter-spacing: var(--page-title-letter-spacing, -0.025em);
  color: var(--page-title-color, var(--mhn-fg, #0f172a));
  text-transform: var(--page-title-text-transform, none);
  margin: 0 0 var(--page-title-gap, 1.5rem) 0;
}

.page-title,
.page-description {
  overflow-wrap: anywhere;
}

/* Page header spacing is shared by all themes and native header variants. */
.page-header {
  margin: 0 0 var(--page-title-gap, 1.5rem);
}

.page-header .page-title {
  margin-bottom: 0;
}

.page-title + .page-description,
.page-header .page-description {
  margin: var(--page-description-gap, 0.5rem) 0 0;
}

/* Typed internal lengths keep unitless zero valid in button size arithmetic. */
@property --_button-size-min-width {
  syntax: "<length-percentage>";
  inherits: false;
  initial-value: 120px;
}
@property --_button-padding-x {
  syntax: "<length-percentage>";
  inherits: false;
  initial-value: 14.4px;
}
@property --_button-padding-y {
  syntax: "<length-percentage>";
  inherits: false;
  initial-value: 8.8px;
}

/* Shared buttons: consume the Style Editor tokens in every theme. */
.mhn-button, .mhn-button:link, .mhn-button:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  gap: var(--button-gap, 0.5rem);
  width: auto;
  --_button-size-min-width: var(--button-min-width, 120px);
  --_button-padding-x: var(--btn-padding-x, 0.9rem);
  --_button-padding-y: var(--btn-padding-y, 0.55rem);
  min-width: min(var(--_button-size-min-width), 100%);
  max-width: 100%;
  height: auto;
  min-height: var(--button-min-height, 40px);
  padding: var(--btn-padding-y, 0.55rem) var(--btn-padding-x, 0.9rem);
  border-radius: var(--btn-radius, 10px);
  border: var(--button-border-width, 1px) solid var(--_button-border, var(--button-primary-border, var(--mhn-accent, #741c73)));
  background: var(--_button-bg, var(--button-primary-bg, var(--mhn-accent, #741c73)));
  color: var(--_button-fg, var(--button-primary-fg, #fff));
  font-family: inherit;
  font-size: var(--button-font-size, 0.875rem);
  font-weight: var(--button-font-weight, 600);
  letter-spacing: var(--button-letter-spacing, 0.02em);
  text-transform: var(--button-text-transform, uppercase);
  line-height: var(--button-line-height, 1.25);
  white-space: var(--button-white-space, normal);
  overflow-wrap: anywhere;
  text-decoration: none;
  text-align: center;
  box-shadow: var(--button-shadow, none);
  cursor: pointer;
  transition: background-color var(--button-transition-duration, 150ms) ease-in-out, color var(--button-transition-duration, 150ms) ease-in-out, border-color var(--button-transition-duration, 150ms) ease-in-out;
}

.mhn-button--primary,
.mhn-button.mhn-primary,
.mhn-button.mhn-blue,
.mhn-button.mhn-light-purple {
  --_button-bg: var(--button-primary-bg, var(--mhn-accent));
  --_button-fg: var(--button-primary-fg, #FFFFFF);
  --_button-border: var(--button-primary-border, var(--mhn-accent));
  --_button-hover-bg: var(--button-primary-hover-bg, var(--mhn-focus));
  --_button-hover-fg: var(--button-primary-hover-fg, #FFFFFF);
  --_button-hover-border: var(--button-primary-hover-border, var(--mhn-focus));
}

.mhn-button--secondary,
.mhn-button.mhn-secondary {
  --_button-bg: var(--button-secondary-bg, #E5E7EB);
  --_button-fg: var(--button-secondary-fg, #111827);
  --_button-border: var(--button-secondary-border, #E5E7EB);
  --_button-hover-bg: var(--button-secondary-hover-bg, #D1D5DB);
  --_button-hover-fg: var(--button-secondary-hover-fg, #111827);
  --_button-hover-border: var(--button-secondary-hover-border, #D1D5DB);
}

.mhn-button--accent,
.mhn-button.mhn-accent {
  --_button-bg: var(--button-accent-bg, var(--mhn-accent));
  --_button-fg: var(--button-accent-fg, #FFFFFF);
  --_button-border: var(--button-accent-border, var(--mhn-accent));
  --_button-hover-bg: var(--button-accent-hover-bg, var(--mhn-focus));
  --_button-hover-fg: var(--button-accent-hover-fg, #FFFFFF);
  --_button-hover-border: var(--button-accent-hover-border, var(--mhn-focus));
}

.mhn-button--purple,
.mhn-button.mhn-purple {
  --_button-bg: var(--button-purple-bg, #8B5CF6);
  --_button-fg: var(--button-purple-fg, #FFFFFF);
  --_button-border: var(--button-purple-border, #8B5CF6);
  --_button-hover-bg: var(--button-purple-hover-bg, #7C3AED);
  --_button-hover-fg: var(--button-purple-hover-fg, #FFFFFF);
  --_button-hover-border: var(--button-purple-hover-border, #7C3AED);
}

.mhn-button--success,
.mhn-button.mhn-success,
.mhn-button.mhn-green {
  --_button-bg: var(--button-success-bg, #16A34A);
  --_button-fg: var(--button-success-fg, #FFFFFF);
  --_button-border: var(--button-success-border, #16A34A);
  --_button-hover-bg: var(--button-success-hover-bg, #15803D);
  --_button-hover-fg: var(--button-success-hover-fg, #FFFFFF);
  --_button-hover-border: var(--button-success-hover-border, #15803D);
}

.mhn-button--warning,
.mhn-button.mhn-warning {
  --_button-bg: var(--button-warning-bg, #F59E0B);
  --_button-fg: var(--button-warning-fg, #FFFFFF);
  --_button-border: var(--button-warning-border, #F59E0B);
  --_button-hover-bg: var(--button-warning-hover-bg, #D97706);
  --_button-hover-fg: var(--button-warning-hover-fg, #FFFFFF);
  --_button-hover-border: var(--button-warning-hover-border, #D97706);
}

.mhn-button--info,
.mhn-button.mhn-info,
.mhn-button.mhn-light-blue {
  --_button-bg: var(--button-info-bg, #3B82F6);
  --_button-fg: var(--button-info-fg, #FFFFFF);
  --_button-border: var(--button-info-border, #3B82F6);
  --_button-hover-bg: var(--button-info-hover-bg, #2563EB);
  --_button-hover-fg: var(--button-info-hover-fg, #FFFFFF);
  --_button-hover-border: var(--button-info-hover-border, #2563EB);
}

.mhn-button--danger,
.mhn-button.mhn-danger,
.mhn-button.mhn-red {
  --_button-bg: var(--button-danger-bg, #DC2626);
  --_button-fg: var(--button-danger-fg, #FFFFFF);
  --_button-border: var(--button-danger-border, #DC2626);
  --_button-hover-bg: var(--button-danger-hover-bg, #991B1B);
  --_button-hover-fg: var(--button-danger-hover-fg, #FFFFFF);
  --_button-hover-border: var(--button-danger-hover-border, #991B1B);
}

.mhn-button--grey,
.mhn-button.mhn-grey {
  --_button-bg: var(--button-grey-bg, #6B7280);
  --_button-fg: var(--button-grey-fg, #FFFFFF);
  --_button-border: var(--button-grey-border, #6B7280);
  --_button-hover-bg: var(--button-grey-hover-bg, #4B5563);
  --_button-hover-fg: var(--button-grey-hover-fg, #FFFFFF);
  --_button-hover-border: var(--button-grey-hover-border, #4B5563);
}

.mhn-button--ghost,
.mhn-button.mhn-ghost {
  --_button-bg: var(--button-ghost-bg, transparent);
  --_button-fg: var(--button-ghost-fg, #741C73);
  --_button-border: var(--button-ghost-border, transparent);
  --_button-hover-bg: var(--button-ghost-hover-bg, transparent);
  --_button-hover-fg: var(--button-ghost-hover-fg, #5A1358);
  --_button-hover-border: var(--button-ghost-hover-border, transparent);
}

.mhn-button--ghost-accent {
  --_button-bg: var(--button-ghost-accent-bg, transparent);
  --_button-fg: var(--button-ghost-accent-fg, #741C73);
  --_button-border: var(--button-ghost-accent-border, transparent);
  --_button-hover-bg: var(--button-ghost-accent-hover-bg, transparent);
  --_button-hover-fg: var(--button-ghost-accent-hover-fg, #5A1358);
  --_button-hover-border: var(--button-ghost-accent-hover-border, transparent);
}

.mhn-button--ghost-purple {
  --_button-bg: var(--button-ghost-purple-bg, transparent);
  --_button-fg: var(--button-ghost-purple-fg, #7C3AED);
  --_button-border: var(--button-ghost-purple-border, transparent);
  --_button-hover-bg: var(--button-ghost-purple-hover-bg, transparent);
  --_button-hover-fg: var(--button-ghost-purple-hover-fg, #6D28D9);
  --_button-hover-border: var(--button-ghost-purple-hover-border, transparent);
}

.mhn-button--ghost-success {
  --_button-bg: var(--button-ghost-success-bg, transparent);
  --_button-fg: var(--button-ghost-success-fg, #16A34A);
  --_button-border: var(--button-ghost-success-border, transparent);
  --_button-hover-bg: var(--button-ghost-success-hover-bg, transparent);
  --_button-hover-fg: var(--button-ghost-success-hover-fg, #15803D);
  --_button-hover-border: var(--button-ghost-success-hover-border, transparent);
}

.mhn-button--ghost-red {
  --_button-bg: var(--button-ghost-red-bg, transparent);
  --_button-fg: var(--button-ghost-red-fg, #DC2626);
  --_button-border: var(--button-ghost-red-border, transparent);
  --_button-hover-bg: var(--button-ghost-red-hover-bg, transparent);
  --_button-hover-fg: var(--button-ghost-red-hover-fg, #991B1B);
  --_button-hover-border: var(--button-ghost-red-hover-border, transparent);
}

.mhn-button--ghost-grey {
  --_button-bg: var(--button-ghost-grey-bg, transparent);
  --_button-fg: var(--button-ghost-grey-fg, #6B7280);
  --_button-border: var(--button-ghost-grey-border, transparent);
  --_button-hover-bg: var(--button-ghost-grey-hover-bg, transparent);
  --_button-hover-fg: var(--button-ghost-grey-hover-fg, #4B5563);
  --_button-hover-border: var(--button-ghost-grey-hover-border, transparent);
}

.mhn-button:hover:where(:not(:disabled):not([aria-disabled="true"]):not(.is-disabled)) {
  background: var(--_button-hover-bg, var(--button-primary-hover-bg, var(--mhn-focus, #8b5cf6)));
  color: var(--_button-hover-fg, var(--button-primary-hover-fg, #fff));
  border-color: var(--_button-hover-border, var(--button-primary-hover-border, var(--mhn-focus, #8b5cf6)));
}
.mhn-button:is(.is-active, [aria-pressed="true"]):where(:not(:disabled):not([aria-disabled="true"]):not(.is-disabled)) {
  background: var(--button-active-bg, var(--button-primary-bg, var(--mhn-accent, #741c73)));
  color: var(--button-active-fg, var(--button-primary-fg, #fff));
  border-color: var(--button-active-border, var(--button-primary-border, var(--mhn-accent, #741c73)));
}
.mhn-button:focus-visible {
  outline: 2px solid var(--mhn-focus, #8b5cf6);
  outline-offset: 2px;
}
.mhn-button:is(:disabled, [aria-disabled="true"], .is-disabled) {
  opacity: var(--button-disabled-opacity, 0.6);
  cursor: not-allowed;
}

.mhn-button.mhn-xs, .mhn-button.mhn-button--xs {
  --_button-size-min-width: var(--button-xs-min-width, 64px);
  min-height: var(--button-xs-min-height, 28px);
  font-size: var(--button-xs-font-size, var(--font-size-xs, 0.75rem));
  padding: max(0px, calc(var(--_button-padding-y) - 0.3rem)) max(0px, calc(var(--_button-padding-x) - 0.3rem));
}

.mhn-button.mhn-small, .mhn-button.mhn-button--sm {
  --_button-size-min-width: var(--button-sm-min-width, 80px);
  min-height: var(--button-sm-min-height, 32px);
  font-size: var(--button-sm-font-size, var(--font-size-sm));
  padding: max(0px, calc(var(--_button-padding-y) - 0.2rem)) max(0px, calc(var(--_button-padding-x) - 0.2rem));
}

.mhn-button.mhn-large, .mhn-button.mhn-button--lg {
  --_button-size-min-width: var(--button-lg-min-width, 160px);
  min-height: var(--button-lg-min-height, 48px);
  font-size: var(--button-lg-font-size, var(--font-size-lg));
  padding: max(0px, calc(var(--_button-padding-y) + 0.2rem)) max(0px, calc(var(--_button-padding-x) + 0.2rem));
}

.mhn-button.mhn-xl, .mhn-button.mhn-button--xl {
  --_button-size-min-width: var(--button-xl-min-width, 200px);
  min-height: var(--button-xl-min-height, 56px);
  font-size: var(--button-xl-font-size, var(--font-size-xl));
  padding: max(0px, calc(var(--_button-padding-y) + 0.2rem)) max(0px, calc(var(--_button-padding-x) + 0.2rem));
}

.mhn-button.mhn-full { width: 100%; }
.mhn-button.mhn-square {
  width: var(--button-icon-size, 40px);
  min-width: var(--button-icon-size, 40px);
  height: var(--button-icon-size, 40px);
  min-height: var(--button-icon-size, 40px);
  padding: 0;
}
.mhn-button.mhn-button--nowrap { white-space: nowrap; }
.mhn-button-group {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-sm, 0.5rem);
}

.mhn-text-muted {
  color: var(--body-text-muted);
}

.mhn-text-sm {
  font-size: var(--font-size-sm, 0.875rem);
}

/* Ordinary emphasis uses the shared weight; named components retain ownership.
 * This class also serves as a maintenance-row hook, including on Card titles. */
:where(.mhn-text-strong),
strong:where(.mhn-text-strong),
b:where(.mhn-text-strong) {
  font-weight: var(--font-weight-semibold, 600);
}

/* Metric values share typography; compact sizing is explicit, not inherited from cards. */
/* Ordinary content links opt in explicitly; specialized link components retain
   their own settings. Size/family/line height inherit the surrounding content. */
a.mhn-link:where([href]):not(:where(.mhn-button, .mhn-card, .mhn-tablist__tab, .mhn-pagination__link, .mhn-sort-link, [role="button"], [role="tab"], nav a, .mhn-rootmenu a, .mhn-submenu a, .mhn-breadcrumbs a, .mhn-card__title a)) {
  color: var(--text-link-color, var(--mhn-info-fg, #1e40af));
  font-weight: var(--text-link-font-weight, inherit);
  text-decoration-line: var(--text-link-decoration, underline);
  text-decoration-thickness: var(--text-link-decoration-thickness, auto);
  text-underline-offset: var(--text-link-underline-offset, 0.15em);
  text-decoration-skip-ink: auto;
  overflow-wrap: anywhere;
}
a.mhn-link:where([href]):not(:where(.mhn-button, .mhn-card, .mhn-tablist__tab, .mhn-pagination__link, .mhn-sort-link, [role="button"], [role="tab"], nav a, .mhn-rootmenu a, .mhn-submenu a, .mhn-breadcrumbs a, .mhn-card__title a)):visited {
  color: var(--text-link-visited-color, var(--text-link-color, var(--mhn-info-fg, #1e40af)));
}
a.mhn-link:where([href]):not(:where(.mhn-button, .mhn-card, .mhn-tablist__tab, .mhn-pagination__link, .mhn-sort-link, [role="button"], [role="tab"], nav a, .mhn-rootmenu a, .mhn-submenu a, .mhn-breadcrumbs a, .mhn-card__title a)):is(:hover, :focus-visible, :active) {
  color: var(--text-link-hover-color, var(--text-link-color, var(--mhn-info-fg, #1e40af)));
  text-decoration-line: var(--text-link-hover-decoration, underline);
}

.mhn-stat {
  margin: 0;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: var(--stat-font-size, var(--font-size-3xl, 1.875rem));
  font-weight: var(--stat-font-weight, var(--font-weight-bold, 700));
  line-height: var(--stat-line-height, 1.2);
  letter-spacing: var(--stat-letter-spacing, 0);
  color: var(--stat-color, var(--body-text-color, #0f172a));
  font-variant-numeric: tabular-nums;
}
.mhn-stat--compact {
  font-size: var(--stat-compact-font-size, var(--font-size-lg, 1.125rem));
}

.mhn-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--stat-grid-min, 110px)), 1fr));
  gap: var(--_compact-grid-gap, var(--stat-grid-gap, var(--spacing-sm, 0.5rem)));
  min-width: 0;
}

.mhn-break-word {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Opt-in reading width; ordinary page, form and table geometry stays independent. */
.mhn-text-measure {
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  max-width: var(--body-text-measure, 42rem);
  overflow-wrap: anywhere;
}

/* Bounded status/action text may wrap between words, never within a word. */
.mhn-keep-words {
  overflow-wrap: normal;
  word-break: normal;
}

/* A measured numeric value stays intact; the table wrapper owns any overflow. */
.mhn-number {
  display: inline-block;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  font-variant-numeric: tabular-nums;
}

.mhn-text-xs {
  font-size: var(--font-size-xs, 0.75rem);
}

.mhn-text-mono {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);
  font-variant-numeric: tabular-nums;
}

.mhn-flex {
  display: flex;
}

.mhn-flex-grow { flex: 1 1 auto; min-width: 0; }
/* Keep configured badge/icon dimensions intact beside flexible copy. */
.mhn-flex-none { flex: 0 0 auto; }
.mhn-inline-flex { display: inline-flex; }
.mhn-self-start { align-self: start; justify-self: start; }

.mhn-flex-wrap {
  flex-wrap: wrap;
}

.mhn-text-start {
  text-align: left;
}

/* Semantic list content without browser-provided bullets or indentation. */
.mhn-list-unstyled {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mhn-text-center {
  text-align: center;
}

.mhn-text-end {
  text-align: right;
}

.mhn-items-center {
  align-items: center;
}

.mhn-items-start {
  align-items: flex-start;
}

.mhn-items-end {
  align-items: flex-end;
}

.mhn-justify-between {
  justify-content: space-between;
}

.mhn-justify-end {
  justify-content: flex-end;
}

.mhn-gap-xs {
  gap: var(--spacing-xs, 0.25rem);
}

.mhn-gap-sm {
  gap: var(--spacing-sm, 0.5rem);
}

.mhn-gap-md {
  gap: var(--spacing-md, 1rem);
}

.mhn-gap-lg {
  gap: var(--spacing-lg, 1.5rem);
}

.mhn-inline-block {
  display: inline-block;
}

.mhn-mx-auto {
  margin-inline: auto;
}

.mhn-my-xl {
  margin-block: var(--spacing-xl, 1.5rem);
}

.mhn-max-w-xs {
  max-width: 15rem;
}

.mhn-max-w-md {
  max-width: 32rem;
}

.mhn-divider {
  border: 0;
  border-top: 1px solid var(--mhn-border, #e2e8f0);
  margin: 0;
}

.mhn-editor-canvas {
  width: 100%;
  min-height: var(--editor-canvas-min-height, 600px);
  border: 1px solid var(--mhn-border, #e2e8f0);
  border-radius: var(--radius-md, 12px);
  background: var(--mhn-surface, #ffffff);
  overflow: hidden;
}

.mhn-editor-canvas--md {
  --editor-canvas-min-height: 400px;
}

/* Calendar tracks share display bounds; dates and time-slot math stay local. */
@property --_calendar-day-min { syntax: '<length>'; inherits: true; initial-value: 140px; }
@property --_calendar-time-width { syntax: '<length>'; inherits: true; initial-value: 72px; }
.mhn-calendar-surface {
  --_calendar-day-min: var(--calendar-day-min-width, 140px);
  --_calendar-time-width: var(--calendar-time-label-width, 72px);
  min-width: calc(var(--_calendar-day-count, 7) * var(--_calendar-day-min));
}
.mhn-calendar-days {
  display: grid;
  grid-template-columns: repeat(var(--_calendar-day-count, 7), minmax(var(--_calendar-day-min), 1fr));
  min-width: calc(var(--_calendar-day-count, 7) * var(--_calendar-day-min));
}
.mhn-calendar-timed {
  min-width: calc(var(--_calendar-time-width) + var(--_calendar-day-count, 7) * var(--_calendar-day-min));
}
.mhn-calendar-time-header {
  display: grid;
  grid-template-columns: var(--_calendar-time-width) repeat(var(--_calendar-day-count, 7), minmax(var(--_calendar-day-min), 1fr));
}
.mhn-calendar-time-body { display: grid; grid-template-columns: var(--_calendar-time-width) minmax(0, 1fr); }
.mhn-calendar-time-label { min-width: 0; overflow: hidden; }
.mhn-calendar-day-cell, .mhn-panel.mhn-calendar-day-cell { min-height: var(--calendar-month-day-min-height, 148px); }

/* Timeline labels use Table metrics; task bars use Diagram typography.
 * The label pane never consumes the entire timeline, even on narrow hosts. */
.mhn-timeline-label-size { width: var(--timeline-label-preferred-width, 40rem); max-width: var(--timeline-label-max-share, 50%); flex: 0 0 auto; min-width: 0; }
.mhn-timeline-text-min { width: var(--table-text-min-width, 220px); }
.mhn-timeline-value-min { width: var(--table-value-min-width, 96px); }
.mhn-timeline-bar-label {
  display: inline-flex;
  box-sizing: border-box;
  max-width: 100%;
  overflow: hidden;
  font-family: var(--font-sans, sans-serif);
  font-size: var(--diagram-node-font-size, 13px);
  font-weight: var(--diagram-node-font-weight, 700);
  line-height: var(--line-height-tight, 1.25);
  padding: var(--spacing-sm, .5rem);
  border: var(--diagram-node-border-width, 0px) solid transparent;
  white-space: nowrap;
}
.mhn-timeline-bar-label--compact { font-size: var(--diagram-node-compact-font-size, 11px); padding: var(--spacing-xs, .25rem); }
.mhn-timeline-metrics { position: absolute; inset: 0; height: 0; overflow: hidden; visibility: hidden; pointer-events: none; }
.mhn-timeline-metrics :is(th, td) { white-space: nowrap; }

/* Dense interactive workspaces have independent bounds from compact result plots.
 * The companion scroll pane shares the effective viewport ceiling, not its height. */
/* Typed internal lengths let a saved unitless zero participate in min/max math. */
@property --_workbench-min { syntax: '<length>'; inherits: false; initial-value: 0px; }
@property --_workbench-preferred { syntax: '<length>'; inherits: false; initial-value: 0px; }
@property --_workbench-max { syntax: '<length>'; inherits: false; initial-value: 0px; }
.mhn-workbench-viewport, .mhn-card.mhn-workbench-viewport, .mhn-panel.mhn-workbench-viewport, .mhn-preview-frame.mhn-workbench-viewport {
  position: relative;
  min-width: 0;
  min-height: var(--workbench-viewport-min-height, 30rem);
  height: var(--workbench-viewport-preferred-height, 70vh);
  max-height: var(--workbench-viewport-max-height, 52rem);
  overflow: hidden;
}
.mhn-workbench-scroll-limit {
  --_workbench-min: var(--workbench-viewport-min-height, 30rem);
  --_workbench-preferred: var(--workbench-viewport-preferred-height, 70vh);
  --_workbench-max: var(--workbench-viewport-max-height, 52rem);
  max-height: max(var(--_workbench-min), min(var(--_workbench-preferred), var(--_workbench-max)));
}

/* Opt-in editing workspaces. Vendor adapters retain syntax/toolbars and behavior. */
.mhn-editor-pane, .mhn-editor-pane:is(textarea, .mhn-card) { min-width: 0; min-height: var(--editor-min-height, 22rem); }
.mhn-editor-pane.mhn-editor-pane--compact { min-height: var(--editor-compact-min-height, 11rem); }
.mhn-editor-pane.mhn-editor-pane--paired {
  position: relative;
  min-height: var(--editor-paired-min-height, 24rem);
  max-height: var(--editor-paired-max-height, 32rem);
  overflow: auto;
}
.mhn-editor-pane.mhn-editor-pane--rich { height: var(--editor-rich-height, 480px); min-height: 0; }
.mhn-editor-fill { position: absolute; inset: 0; }

/* Embedded preview chrome follows Cards; document content keeps its own styling. */
.mhn-preview-frame, .mhn-card.mhn-preview-frame {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: var(--preview-min-height, 500px);
  border: var(--card-border-width, 1px) solid var(--card-border-color, var(--mhn-border, #e2e8f0));
  border-radius: var(--card-radius, var(--radius-md, 12px));
  background: var(--card-background, var(--mhn-surface, #ffffff));
}
/* Paper exports need a neutral canvas even when the application theme is dark. */
.mhn-preview-frame--paper { background: #fff; }
.mhn-preview-frame.mhn-preview-frame--editor { min-height: var(--editor-min-height, 22rem); }
.mhn-preview-frame.mhn-preview-frame--compact { height: var(--preview-compact-height, 220px); min-height: 0; }
.mhn-preview-frame.mhn-preview-frame--image { width: auto; min-height: 0; object-fit: contain; }
.mhn-preview-frame--image.mhn-preview-frame--compact { align-self: start; height: auto; max-height: var(--preview-compact-height, 220px); }

/* Ordinary image bounds are independent of document viewers and avatars.
 * Crop aspect ratios, focal points and interaction placement remain with data. */
.mhn-image-preview, .mhn-preview-frame.mhn-image-preview {
  width: var(--_image-preview-width, var(--image-preview-width, 360px));
  max-width: 100%;
}
.mhn-image-preview--wide { --_image-preview-width: var(--image-preview-wide-width, 440px); }
.mhn-image-thumbnail, .mhn-preview-frame.mhn-image-thumbnail {
  display: inline-flex;
  width: var(--_image-thumbnail-size, var(--image-thumbnail-size, 34px));
  height: auto;
  max-width: 100%;
  aspect-ratio: 1;
  flex: 0 0 auto;
  overflow: hidden;
}
.mhn-image-thumbnail--large { --_image-thumbnail-size: var(--image-thumbnail-large-size, 44px); }
.mhn-image-preview > img, .mhn-image-thumbnail > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mhn-image-lightbox, .mhn-image-hover {
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.mhn-image-lightbox { max-height: var(--image-lightbox-max-height, 70dvh); align-self: center; }
/* Typed lengths preserve unitless zero within the viewport cap arithmetic. */
@property --_image-hover-width {
  syntax: "<length-percentage>";
  inherits: false;
  initial-value: 520px;
}
@property --_image-hover-height {
  syntax: "<length>";
  inherits: false;
  initial-value: 560px;
}
.mhn-image-hover {
  --_image-hover-width: var(--image-hover-max-width, 520px);
  --_image-hover-height: var(--image-hover-max-height, 560px);
  max-width: min(52vw, var(--_image-hover-width));
  max-height: min(62vh, var(--_image-hover-height));
}

.mhn-stack {
  display: flex;
  flex-direction: column;
  gap: var(--layout-section-gap, var(--spacing-2xl, 2rem));
  min-width: 0;
}

.mhn-hero {
  display: flex;
  flex-direction: column;
  gap: var(--layout-hero-gap, var(--spacing-lg, 1rem));
}

.mhn-stack--tight {
  gap: var(--_compact-stack-gap, var(--spacing-lg, 1.5rem));
}

.mhn-stack--loose {
  gap: var(--_compact-stack-gap, var(--spacing-3xl, 2.5rem));
}

.mhn-stack--xxs, .mhn-stack--xs { gap: var(--spacing-xs, 0.25rem); }
.mhn-stack--sm { gap: var(--_compact-stack-gap, var(--spacing-sm, 0.5rem)); }
.mhn-stack--md { gap: var(--_compact-stack-gap, var(--spacing-md, 0.75rem)); }
.mhn-stack--lg { gap: var(--_compact-stack-gap, var(--spacing-lg, 1rem)); }
.mhn-stack--xl { gap: var(--_compact-stack-gap, var(--spacing-xl, 1.5rem)); }
.mhn-stack--2xl { gap: var(--_compact-stack-gap, var(--spacing-2xl, 2rem)); }
.mhn-stack--3xl { gap: var(--_compact-stack-gap, var(--spacing-3xl, 3rem)); }

.mhn-spacing--compact, .mhn-density--compact {
  --layout-section-gap: var(--layout-compact-section-gap, 0.5rem);
  --layout-content-gap: var(--layout-compact-content-gap, 0.65rem);
  --_compact-stack-gap: var(--layout-compact-section-gap, 0.5rem);
  --_compact-grid-gap: var(--layout-compact-content-gap, 0.65rem);
}
:where(.mhn-spacing--compact, .mhn-density--compact).mhn-grid,
:where(.mhn-spacing--compact, .mhn-density--compact) .mhn-grid {
  gap: var(--_compact-grid-gap);
}

.mhn-text-pre-wrap { white-space: pre-wrap; }

/* A bounded vertical stack scrolls; its sections must not collapse to fit. */
.mhn-scroll-stack { overflow: auto; }
.mhn-scroll-stack > * { flex-shrink: 0; }
/* Reserve the shared focus outline (3px + 4px offset) inside scroll clipping. */
.mhn-scroll-stack--focus-room { padding: max(7px, var(--spacing-xs, 0.35rem)); }

.mhn-card-grid {
  display: grid;
  gap: var(--card-grid-gap, var(--spacing-lg, 1.5rem));
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--card-grid-min, 260px)), 1fr));
  min-width: 0;
}

/* Optional maximum columns; narrow hosts still honor the editor's minimum. */
/* Typed internal lengths keep unitless zero valid inside the cap calculation. */
@property --_grid-cap-min {
  syntax: "<length-percentage>";
  inherits: false;
  initial-value: 0px;
}
@property --_grid-cap-gap {
  syntax: "<length-percentage>";
  inherits: false;
  initial-value: 0px;
}
.mhn-grid-cap {
  --_grid-column-cap: 4;
}
:where(.mhn-card-grid, .mhn-stat-grid).mhn-grid-cap {
  --_grid-cap-min: var(--card-grid-min, 260px);
  --_grid-cap-gap: var(--card-grid-gap, var(--spacing-lg, 1.5rem));
  grid-template-columns: repeat(auto-fit, minmax(min(100%, max(var(--_grid-cap-min), calc((100% - (var(--_grid-column-cap) - 1) * var(--_grid-cap-gap)) / var(--_grid-column-cap)))), 1fr));
}
.mhn-stat-grid.mhn-grid-cap {
  --_grid-cap-min: var(--stat-grid-min, 110px);
  --_grid-cap-gap: var(--_compact-grid-gap, var(--stat-grid-gap, var(--spacing-sm, 0.5rem)));
}
.mhn-grid-cap--1 { --_grid-column-cap: 1; }
.mhn-grid-cap--2 { --_grid-column-cap: 2; }
.mhn-grid-cap--3 { --_grid-column-cap: 3; }
.mhn-grid-cap--4 { --_grid-column-cap: 4; }

/* Panels share surface appearance but retain their composed block/grid layout. */
.mhn-card, .mhn-panel {
  box-sizing: border-box;
  background: var(--card-background, var(--mhn-surface, #ffffff));
  border: var(--card-border-width, 1px) solid var(--card-border-color, var(--mhn-border, #e2e8f0));
  border-radius: var(--card-radius, 12px);
  padding: var(--card-padding, var(--spacing-lg, 1.5rem));
  min-height: 0;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  box-shadow: var(--card-shadow, none);
  transition: transform var(--card-transition-duration, 120ms) ease, box-shadow var(--card-transition-duration, 120ms) ease;
}
.mhn-card {
  display: flex;
  flex-direction: column;
  gap: var(--card-gap, var(--spacing-md, 1rem));
}
.mhn-card--fill {
  min-height: 100%;
}
.mhn-card--compact, .mhn-panel--compact,
:where(.mhn-surfaces--compact, .mhn-density--compact) :is(.mhn-card, .mhn-panel) {
  padding: var(--card-compact-padding, 0.75rem);
}
.mhn-card--compact,
:where(.mhn-surfaces--compact, .mhn-density--compact) .mhn-card {
  gap: var(--card-compact-gap, 0.5rem);
}
.mhn-card--subtle, .mhn-panel--subtle {
  background: var(--card-subtle-background, var(--mhn-surface-1, #f8fafc));
  border-color: var(--card-subtle-border-color, var(--card-border-color, var(--mhn-border, #e2e8f0)));
}
/* Replaced media uses a managed panel frame without an internal content inset. */
.mhn-panel.mhn-panel--media { padding: 0; }

/* Sectioned cards move shared padding into their header/content regions. */
.mhn-card.mhn-card--sectioned {
  padding: 0;
  gap: 0;
  overflow: hidden;
}
/* Scrollable sectioned surfaces must not inherit the default clipping mode. */
.mhn-card.mhn-card--sectioned.mhn-scroll-stack { overflow: auto; }
.mhn-card--sectioned > .mhn-card__section {
  padding: var(--card-padding, var(--spacing-lg, 1.5rem));
  min-width: 0;
}
.mhn-card--sectioned.mhn-card--compact > .mhn-card__section,
:where(.mhn-surfaces--compact, .mhn-density--compact) .mhn-card--sectioned > .mhn-card__section {
  padding: var(--card-compact-padding, 0.75rem);
}
.mhn-card__header--divided {
  background: var(--card-subtle-background, var(--mhn-surface-1, #f8fafc));
  border-bottom: var(--card-border-width, 1px) solid var(--card-border-color, var(--mhn-border, #e2e8f0));
}
.mhn-card--interactive:hover,
.mhn-card--interactive:focus-visible {
  transform: translateY(var(--card-hover-offset, -2px));
  box-shadow: var(--card-shadow-hover, var(--shadow-md, 0 18px 32px rgba(15, 23, 42, 0.18)));
}
.mhn-card--interactive:focus-visible,
.mhn-focus-ring:focus-visible,
a.mhn-link:where([href]):not(:where(.mhn-button, .mhn-card, .mhn-tablist__tab, .mhn-pagination__link, .mhn-sort-link, [role="button"], [role="tab"], nav a, .mhn-rootmenu a, .mhn-submenu a, .mhn-breadcrumbs a, .mhn-card__title a)):focus-visible {
  outline: 3px solid var(--mhn-focus, var(--mhn-accent, #4f46e5));
  outline-offset: 4px;
}
/* Upload targets and transiently highlighted panels reuse managed card states. */
.mhn-dropzone {
  border-style: dashed;
  text-align: center;
}
.mhn-dropzone.is-dragover,
.mhn-dropzone:focus-within,
.mhn-panel--highlighted {
  background: var(--card-subtle-background, var(--mhn-surface-1, #f8fafc));
  border-color: var(--card-subtle-border-color, var(--card-border-color, var(--mhn-border, #e2e8f0)));
  outline: 2px solid var(--mhn-focus, var(--mhn-accent, #4f46e5));
  outline-offset: 2px;
}
/* Selectable rows keep focus on their owning listbox/combobox when appropriate. */
.mhn-panel--selectable { cursor: pointer; }
.mhn-panel--selectable:hover,
.mhn-panel--selectable[aria-selected="true"],
.mhn-panel--selectable[aria-pressed="true"],
.mhn-panel--selectable:has(> input:checked) {
  background: var(--card-subtle-background, var(--mhn-surface-1, #f8fafc));
  border-color: var(--card-subtle-border-color, var(--card-border-color, var(--mhn-border, #e2e8f0)));
}
.mhn-panel--selectable:focus-visible,
.mhn-panel--selectable:has(> input:focus-visible) {
  outline: 3px solid var(--mhn-focus, var(--mhn-accent, #4f46e5));
  outline-offset: 4px;
}
/* Anchored record pickers compose shared card surfaces and native option buttons. */
.mhn-lookup { position: relative; min-width: 0; }
.mhn-lookup-list,
.mhn-lookup__results {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  max-height: min(var(--form-lookup-max-height, 13.75rem), 60vh);
  overflow: auto;
}
.mhn-lookup-list > [role="option"],
.mhn-lookup__results > [role="option"] { flex-shrink: 0; }
/* A body portal uses measured coordinates; a dialog list needs no anchoring. */
.mhn-lookup-list--portal { position: absolute; z-index: 1000; }
.mhn-lookup__results {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + var(--spacing-xs, 0.25rem));
  z-index: 20;
}
.mhn-lookup__option {
  display: block;
  width: 100%;
  flex-shrink: 0;
  text-align: start;
  font: inherit;
  color: inherit;
}
/* Native details retain their marker and keyboard behavior; compose mhn-panel. */
.mhn-disclosure > summary {
  cursor: pointer;
}
/* Inline titles keep the native disclosure marker beside wrapping text. */
.mhn-disclosure > summary .mhn-card__title {
  display: inline;
}
.mhn-disclosure > summary:focus-visible {
  outline: 3px solid var(--mhn-focus, var(--mhn-accent, #4f46e5));
  outline-offset: 4px;
}
.mhn-disclosure > .mhn-disclosure__body {
  margin-block-start: var(--card-gap, var(--spacing-md, 1rem));
}
.mhn-disclosure.mhn-panel--compact > .mhn-disclosure__body,
:where(.mhn-surfaces--compact, .mhn-density--compact) .mhn-disclosure > .mhn-disclosure__body {
  margin-block-start: var(--card-compact-gap, 0.5rem);
}
/* Connected hierarchy lists compose shared cards; deep trees scroll in their host. */
.mhn-tree,
.mhn-tree__children {
  display: grid;
  gap: var(--card-gap, var(--spacing-md, 0.75rem));
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.mhn-tree__node {
  position: relative;
  padding-inline-start: var(--spacing-md, 0.75rem);
}
.mhn-tree__node::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: calc(var(--card-compact-padding, 0.75rem) + 0.6em);
  width: var(--spacing-md, 0.75rem);
  border-top: var(--card-border-width, 1px) solid var(--mhn-accent, #741c73);
}
.mhn-tree__children {
  margin-block-start: var(--card-compact-gap, 0.5rem);
  margin-inline-start: var(--spacing-md, 0.75rem);
  padding-inline-start: var(--spacing-xs, 0.25rem);
  border-inline-start: var(--card-border-width, 1px) dashed var(--mhn-border-strong, #94a3b8);
}
.mhn-tree__card {
  min-width: var(--card-grid-min, 260px);
}
.mhn-search-match,
.mhn-card__title.mhn-search-match {
  color: var(--mhn-accent, #741c73);
  text-decoration: underline;
  text-decoration-color: currentColor;
}
/* Inline marked matches preserve prose/trace typography, using the warning palette. */
mark.mhn-search-match {
  background: var(--badge-warning-bg, #FEF3C7);
  color: var(--badge-warning-fg, #92400E);
}

.mhn-card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--card-header-gap, var(--spacing-sm, 0.5rem));
  min-width: 0;
}
/* Explicit alignment utilities take precedence over the header default. */
.mhn-card__header.mhn-items-start { align-items: flex-start; }
.mhn-card__header.mhn-items-center { align-items: center; }
.mhn-card__header.mhn-items-end { align-items: flex-end; }
.mhn-card__title {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs, 0.35rem);
  margin: 0;
  font-weight: var(--card-title-font-weight, var(--font-weight-semibold, 600));
  font-size: var(--card-title-font-size, var(--font-size-lg, 1.125rem));
  line-height: var(--card-title-line-height, 1.3);
  color: var(--card-title-color, var(--body-text-color, #0f172a));
  text-decoration: none;
  min-width: 0;
  overflow-wrap: anywhere;
}
.mhn-card__title a {
  color: inherit;
  text-decoration: none;
}
.mhn-card__title a:hover,
.mhn-card__title a:focus {
  text-decoration: underline;
}
.mhn-card__body {
  margin: 0;
  color: var(--card-body-color, var(--body-text-muted, #64748b));
  font-size: var(--card-body-font-size, var(--font-size-sm, 0.875rem));
  line-height: var(--card-body-line-height, 1.5);
  min-width: 0;
}
/* Compose semantic surfaces and stacks without overriding their own colors/gaps. */
.mhn-text-inherit { color: inherit; }
/* Card-like native controls inherit the surrounding managed text typography. */
.mhn-font-inherit { font: inherit; }
.mhn-m-0, .page-title.mhn-m-0, .mhn-section.mhn-m-0 { margin: 0; }
/* Responsive plots opt in independently of document and image previews.
 * Renderers must observe size changes and redraw in the resulting viewport. */
.mhn-chart-viewport, .mhn-preview-frame.mhn-chart-viewport {
  position: relative;
  min-width: 0;
  min-height: var(--chart-min-height, 17rem);
  height: var(--chart-preferred-height, 38vh);
  max-height: var(--chart-max-height, 23rem);
  overflow: hidden;
}
.mhn-chart-viewport > canvas { display: block; width: 100%; height: 100%; }

/* SVG charts share the canvas palette, typography and line controls.
 * Semantic modifiers retain meaning independently of ordered data series. */
.mhn-chart-svg { display: block; width: 100%; height: 100%; }
.mhn-chart-axis { fill: none; stroke: var(--diagram-grid-color, var(--mhn-border, #e2e8f0)); stroke-width: var(--diagram-grid-width, 1px); }
.mhn-chart-label {
  fill: var(--body-text-muted, #64748b);
  font-family: var(--font-sans, sans-serif);
  font-size: var(--font-size-xs, 12px);
  font-weight: var(--font-weight-normal, 400);
  font-style: inherit;
  text-transform: none;
}
.mhn-chart-mark { fill: var(--_chart-color, var(--diagram-series-1-color, #2563eb)); }
circle.mhn-chart-mark { r: var(--diagram-point-radius, 2px); }
rect.mhn-chart-mark { rx: var(--diagram-bar-radius, 2px); }
.mhn-chart-line, .mhn-chart-area {
  stroke: var(--_chart-color, var(--diagram-series-1-color, #2563eb));
  stroke-width: var(--diagram-edge-width, 2px);
}
.mhn-chart-line { fill: none; }
.mhn-chart-area { fill: var(--_chart-color, var(--diagram-series-1-color, #2563eb)); fill-opacity: var(--diagram-area-opacity, .18); }
.mhn-chart-tone--info { --_chart-color: var(--mhn-info, #3b82f6); }
.mhn-chart-tone--success { --_chart-color: var(--mhn-success, #16a34a); }
.mhn-chart-tone--warning { --_chart-color: var(--mhn-warning, #f59e0b); }
.mhn-chart-tone--danger { --_chart-color: var(--mhn-danger, #e11d48); }


/* Composite plots reserve a resizable navigator; primary canvas gets the rest.
 * Fixed heights prevent bitmap attributes from feeding back into flex sizing. */
.mhn-chart-viewport.mhn-chart-viewport--navigator {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs, .25rem);
}
.mhn-chart-viewport--navigator > .mhn-chart-plot { flex: 1 1 0; height: 0; min-height: 0; }
.mhn-chart-viewport--navigator > .mhn-chart-navigator {
  flex: 0 1 auto;
  height: var(--chart-navigator-height, 36px);
  min-height: 0;
}

/* Content images retain their aspect ratio and cannot widen their container. */
.mhn-image-fluid { display: block; max-width: 100%; height: auto; }
.mhn-image-fluid--fill { width: 100%; }

@media (prefers-reduced-motion: reduce) {
  .mhn-card, .mhn-panel {
    transition: none;
  }
  .mhn-card--interactive:hover, .mhn-card--interactive:focus-visible {
    transform: none;
  }
}

.mhn-stepper {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm, 0.75rem);
}

.mhn-stepper__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm, 0.75rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.mhn-stepper__item {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs, 0.35rem);
  padding: var(--spacing-xs, 0.25rem) var(--spacing-sm, 0.75rem);
  border-radius: var(--radius-pill, 999px);
  background: var(--mhn-surface-2, #f1f5f9);
  color: var(--body-text-muted, #64748b);
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: var(--font-weight-medium, 500);
}

.mhn-stepper__item--current {
  background: var(--mhn-accent, #4f46e5);
  color: var(--mhn-text-inverse, #ffffff);
}

.mhn-stepper__item--complete {
  background: var(--mhn-success-bg, #dcfce7);
  color: var(--mhn-success-fg, #166534);
}

.mhn-stepper__index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: color-mix(in srgb, currentColor 16%, transparent);
  font-size: var(--font-size-xs, 0.75rem);
  font-weight: var(--font-weight-semibold, 600);
}

.mhn-stepper__label {
  white-space: nowrap;
}

.mhn-avatar-card {
  width: min(100%, var(--avatar-card-max, 320px));
  text-align: center;
  background: var(--mhn-surface-1, #f8fafc);
  border: 1px solid var(--mhn-border, #e2e8f0);
  border-radius: var(--radius-lg, 16px);
  padding: var(--spacing-lg, 1.5rem);
}

.mhn-avatar-card > *:first-child {
  margin-top: 0;
}

.mhn-avatar {
  width: var(--avatar-size, 144px);
  height: var(--avatar-size, 144px);
  border-radius: var(--avatar-radius, 50%);
  border: var(--avatar-border-width, 2px) var(--avatar-border-style, dashed) var(--avatar-border-color, var(--mhn-border-strong, rgba(148, 163, 184, 0.6)));
  background: var(--avatar-background, var(--mhn-surface, #ffffff));
  display: grid;
  place-items: center;
  overflow: hidden;
}

/* Opt-in preview/profile images shrink to their container without distortion. */
.mhn-avatar--responsive {
  width: min(100%, var(--avatar-size, 144px));
  height: auto;
  aspect-ratio: 1;
}

.mhn-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mhn-password-meter {
  position: relative;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-sm, 8px);
  background: var(--mhn-surface-1, #f8fafc);
  overflow: hidden;
  margin-top: var(--spacing-xs, 0.25rem);
}

.mhn-password-meter__bar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--password-weak, #ef4444);
  transition: width 150ms ease, background 150ms ease;
}

.mhn-form {
  width: 100%;
  min-width: 0;
}

.mhn-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm, 0.75rem);
  justify-content: flex-end;
}

.mhn-grid-auto {
  display: grid;
  gap: var(--_compact-grid-gap, var(--spacing-lg, 1.5rem));
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--grid-auto-min, 260px)), 1fr));
  min-width: 0;
}

/* Shared form controls. The opt-in scope also covers unclassed native controls. */
:is(.mhn-input, .mhn-select, .mhn-textarea, :where(.mhn-form-controls) input, :where(.mhn-form-controls) select, :where(.mhn-form-controls) textarea):where(:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"])) {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: var(--input-min-height, 2.5rem);
  margin: 0;
  padding: var(--input-padding-y, 0.5rem) var(--input-padding-x, 0.5rem);
  border: var(--input-border-width, 1px) solid var(--input-border-color, var(--mhn-border, #e2e8f0));
  border-radius: var(--input-radius, 8px);
  background: var(--input-background, var(--mhn-surface, #fff));
  color: var(--input-color, var(--body-text-color, #0f172a));
  font-family: inherit;
  font-size: var(--input-font-size, var(--font-size-base, 1rem));
  font-weight: var(--input-font-weight, 400);
  line-height: var(--input-line-height, 1.5);
}
:is(.mhn-input, .mhn-select, .mhn-textarea, :where(.mhn-form-controls) input, :where(.mhn-form-controls) select, :where(.mhn-form-controls) textarea):where(:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]))::placeholder {
  color: var(--input-placeholder-color, var(--body-text-muted, #64748b));
  opacity: 1;
}
:is(.mhn-input, .mhn-select, .mhn-textarea, :where(.mhn-form-controls) input, :where(.mhn-form-controls) select, :where(.mhn-form-controls) textarea):where(:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"])):focus {
  border-color: var(--input-focus-border-color, var(--mhn-focus, #8b5cf6));
  outline: 2px solid var(--input-focus-ring-color, var(--mhn-focus, #8b5cf6));
  outline-offset: 2px;
}
:is(.mhn-input, .mhn-select, .mhn-textarea, :where(.mhn-form-controls) input, :where(.mhn-form-controls) select, :where(.mhn-form-controls) textarea):where(:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]))[readonly] {
  background: var(--input-readonly-background, var(--mhn-surface-1, #f8fafc));
}
:is(.mhn-input, .mhn-select, .mhn-textarea, :where(.mhn-form-controls) input, :where(.mhn-form-controls) select, :where(.mhn-form-controls) textarea):where(:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"])):is([aria-invalid="true"], .is-invalid, :user-invalid) {
  border-color: var(--input-invalid-border-color, var(--mhn-danger, #dc2626));
}
:is(.mhn-input, .mhn-select, .mhn-textarea, :where(.mhn-form-controls) input, :where(.mhn-form-controls) select, :where(.mhn-form-controls) textarea):where(:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"])):disabled {
  background: var(--input-disabled-background, var(--mhn-surface-2, #f1f5f9));
  color: var(--input-disabled-color, var(--body-text-muted, #64748b));
  cursor: not-allowed;
  opacity: 1;
}
:is(.mhn-input, .mhn-select, .mhn-textarea, :where(.mhn-form-controls) input, :where(.mhn-form-controls) select, :where(.mhn-form-controls) textarea):where(:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"])).mhn-input--compact,
:where(.mhn-form-controls--compact, .mhn-table.mhn-compact) :is(.mhn-input, .mhn-select, .mhn-textarea, :where(.mhn-form-controls) input, :where(.mhn-form-controls) select, :where(.mhn-form-controls) textarea):where(:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"])) {
  min-height: var(--input-compact-min-height, 2rem);
  padding: var(--input-compact-padding-y, 0.2rem) var(--input-compact-padding-x, 0.35rem);
  font-size: var(--input-compact-font-size, var(--font-size-sm, 0.875rem));
}
/* File uploads and color wells reuse Form chrome while keeping native pickers. */
input.mhn-input:is([type="file"], [type="color"]),
:where(.mhn-form-controls) input:is([type="file"], [type="color"]) {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  min-height: var(--input-min-height, 2.5rem);
  padding: var(--input-padding-y, 0.5rem) var(--input-padding-x, 0.5rem);
  border: var(--input-border-width, 1px) solid var(--input-border-color, var(--mhn-border, #e2e8f0));
  border-radius: var(--input-radius, 8px);
  background: var(--input-background, var(--mhn-surface, #fff));
  color: var(--input-color, var(--body-text-color, #0f172a));
  font-family: inherit;
  font-size: var(--input-font-size, var(--font-size-base, 1rem));
  font-weight: var(--input-font-weight, 400);
  line-height: var(--input-line-height, 1.5);
}
/* Inherit configured upload typography without replacing native button chrome. */
input.mhn-input[type="file"]::file-selector-button,
:where(.mhn-form-controls) input[type="file"]::file-selector-button { font: inherit; }
input.mhn-input[type="color"],
:where(.mhn-form-controls) input[type="color"] { cursor: pointer; }

input.mhn-input:is([type="file"], [type="color"]).mhn-input--compact,
:where(.mhn-form-controls) input:is([type="file"], [type="color"]).mhn-input--compact,
:where(.mhn-form-controls--compact, .mhn-table.mhn-compact) :is(input.mhn-input, :where(.mhn-form-controls) input):is([type="file"], [type="color"]) {
  min-height: var(--input-compact-min-height, 2rem);
  padding: var(--input-compact-padding-y, 0.2rem) var(--input-compact-padding-x, 0.35rem);
  font-size: var(--input-compact-font-size, var(--font-size-sm, 0.875rem));
}

input.mhn-input:is([type="file"], [type="color"]):focus,
:where(.mhn-form-controls) input:is([type="file"], [type="color"]):focus {
  border-color: var(--input-focus-border-color, var(--mhn-focus, #8b5cf6));
}
input.mhn-input:is([type="file"], [type="color"]):focus-visible,
:where(.mhn-form-controls) input:is([type="file"], [type="color"]):focus-visible {
  outline: 2px solid var(--input-focus-ring-color, var(--mhn-focus, #8b5cf6));
  outline-offset: 2px;
}
input.mhn-input:is([type="file"], [type="color"]):is([aria-invalid="true"], .is-invalid, :user-invalid),
:where(.mhn-form-controls) input:is([type="file"], [type="color"]):is([aria-invalid="true"], .is-invalid, :user-invalid) {
  border-color: var(--input-invalid-border-color, var(--mhn-danger, #dc2626));
}
input.mhn-input:is([type="file"], [type="color"]):disabled,
:where(.mhn-form-controls) input:is([type="file"], [type="color"]):disabled {
  background: var(--input-disabled-background, var(--mhn-surface-2, #f1f5f9));
  color: var(--input-disabled-color, var(--body-text-muted, #64748b));
  cursor: not-allowed;
  opacity: 1;
}

/* Record-state cues are opt-in, independent of native validity. Geometry and
 * focus/disabled behavior remain Form-owned; tones use the semantic Badge palette. */
.mhn-input--status-success {
  --input-background: var(--badge-success-bg, #dcfce7);
  --input-color: var(--badge-success-fg, #166534);
  --input-border-color: var(--badge-success-fg, #166534);
}
.mhn-input--status-danger {
  --input-background: var(--badge-danger-bg, #fee2e2);
  --input-color: var(--badge-danger-fg, #991b1b);
  --input-border-color: var(--badge-danger-fg, #991b1b);
}
.mhn-status-text--success {
  color: var(--badge-success-fg, #166534);
  font-weight: var(--font-weight-semibold, 600);
}
.mhn-status-text--danger {
  color: var(--badge-danger-fg, #991b1b);
  font-weight: var(--font-weight-semibold, 600);
}
.mhn-field__help {
  color: var(--body-text-muted, #64748b);
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: var(--font-weight-normal, 400);
  line-height: var(--line-height-base, 1.5);
}
.mhn-status-text--neutral {
  color: var(--body-text-color, var(--mhn-fg, #0f172a));
}

.mhn-input--inline {
  width: auto;
  max-width: 100%;
}
textarea:is(.mhn-input, .mhn-textarea), :where(.mhn-form-controls) textarea {
  min-height: var(--input-textarea-min-height, 6rem);
  resize: var(--input-textarea-resize, vertical);
}
.mhn-label,
:where(.mhn-form-controls) label:has(> :is(input:where(:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"])), select, textarea)) {
  color: var(--form-label-color, var(--body-text-color, #0f172a));
  font-size: var(--form-label-font-size, var(--font-size-sm, 0.875rem));
  font-weight: var(--form-label-font-weight, 600);
  letter-spacing: var(--form-label-letter-spacing, 0);
  text-transform: var(--form-label-text-transform, none);
}
/* Optional required marker shares the semantic danger palette. Native required
 * attributes remain the form's validation/accessibility source of truth. */
.mhn-label--required::after {
  content: " *";
  color: var(--mhn-danger, #dc2626);
}
.mhn-field,
:where(.mhn-form-controls) label:has(> :is(input:where(:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"])), select, textarea)) {
  display: flex;
  flex-direction: column;
  gap: var(--form-field-gap, 0.375rem);
  min-width: 0;
}
:where(.mhn-form-controls) input:is([type="checkbox"], [type="radio"], [type="range"]),
input.mhn-input:is([type="checkbox"], [type="radio"], [type="range"]) {
  accent-color: var(--mhn-accent, #741c73);
}
:where(.mhn-form-controls) input:is([type="checkbox"], [type="radio"], [type="range"]):focus-visible,
input.mhn-input:is([type="checkbox"], [type="radio"], [type="range"]):focus-visible {
  outline: 2px solid var(--input-focus-ring-color, var(--mhn-focus, #8b5cf6));
  outline-offset: 2px;
}

.mhn-input.mhn-text-mono,
.mhn-textarea.mhn-text-mono {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);
  font-variant-numeric: tabular-nums;
}

.mhn-autocomplete {
  position: absolute;
  z-index: 20;
  right: 0;
  left: 0;
  max-height: var(--autocomplete-max-height, 220px);
  overflow: auto;
  border: 1px solid var(--mhn-border, #e2e8f0);
  border-radius: var(--radius-sm, 8px);
  background: var(--mhn-surface, #ffffff);
  box-shadow: var(--shadow-md, 0 2px 8px rgba(0, 0, 0, 0.08));
}

.mhn-autocomplete:empty {
  display: none;
}

.mhn-autocomplete-item {
  display: block;
  width: 100%;
  padding: var(--spacing-sm, 0.5rem) var(--spacing-md, 0.75rem);
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.mhn-autocomplete-item:hover,
.mhn-autocomplete-item:focus-visible {
  background: var(--mhn-surface-2, #f1f5f9);
  outline: none;
}

.mhn-profile-layout {
  display: grid;
  gap: var(--spacing-lg, 1.5rem);
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  align-items: start;
}

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

/* Reorderable rows share the theme accent; geometry/workflow stays with the caller. */
.mhn-drag-handle { cursor: grab; user-select: none; }
.mhn-sortable-row.is-dragging { opacity: 0.6; }
.mhn-sortable-row.is-dragover { outline: 2px dashed var(--mhn-accent, #5b7fff); outline-offset: -2px; }
.mhn-sortable-row.is-drop-before { box-shadow: inset 0 3px 0 var(--table-selected-indicator, var(--mhn-accent, #741c73)); }
.mhn-sortable-row.is-drop-after { box-shadow: inset 0 -3px 0 var(--table-selected-indicator, var(--mhn-accent, #741c73)); }

.mhn-form-grid {
  display: grid;
  gap: var(--_compact-grid-gap, var(--spacing-md, 1rem));
  min-width: 0;
}

/* Form controls may shrink inside their managed grid track. */
.mhn-form-grid > * { min-width: 0; }

.mhn-form-grid--dense {
  gap: var(--_compact-grid-gap, var(--spacing-sm, 0.5rem));
}

.mhn-form-grid--balanced {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--form-grid-min, 220px)), 1fr));
}

/* Reuse the shared column cap without bypassing form minimum/gap settings. */
.mhn-form-grid--balanced.mhn-grid-cap,
.mhn-form-grid--checkboxes.mhn-grid-cap {
  --_grid-cap-min: var(--form-grid-min, 220px);
  --_grid-cap-gap: var(--_compact-grid-gap, var(--spacing-md, 1rem));
  grid-template-columns: repeat(auto-fit, minmax(min(100%, max(var(--_grid-cap-min), calc((100% - (var(--_grid-column-cap) - 1) * var(--_grid-cap-gap)) / var(--_grid-column-cap)))), 1fr));
}

.mhn-form-grid--wide {
  --form-grid-min: var(--form-grid-wide-min, 260px);
}

.mhn-form-grid--checkboxes {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--form-grid-min, 220px)), 1fr));
}

.mhn-form-grid__span-2 {
  grid-column: span 2;
}

.mhn-grid-span-full {
  grid-column: 1 / -1;
}

@media (max-width: 768px) {
  .mhn-form-grid__span-2 {
    grid-column: span 1;
  }
}

.mhn-grid-auto--md {
  --grid-auto-min: 240px;
}

.mhn-grid-auto--lg {
  --grid-auto-min: 320px;
}

.mhn-grid-auto--sm {
  gap: var(--_compact-grid-gap, var(--spacing-md, 1rem));
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--grid-auto-sm-min, 200px)), 1fr));
}

.mhn-grid-split {
  display: grid;
  gap: var(--spacing-lg, 1.5rem);
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

/* Equal comparisons and paired work panels share the editor's content gap. */
.mhn-grid-split--equal {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--layout-content-gap, var(--spacing-lg, 1.5rem));
}

/* Queue/detail workspaces share the editor's sidebar width and content gap. */
.mhn-grid-split--sidebar-first {
  grid-template-columns: minmax(0, var(--layout-sidebar-width, 320px)) minmax(0, 1fr);
  gap: var(--layout-content-gap, var(--spacing-lg, 1.5rem));
}
.mhn-grid-split--sidebar-last {
  grid-template-columns: minmax(0, 1fr) minmax(0, var(--layout-sidebar-width, 320px));
  gap: var(--layout-content-gap, var(--spacing-lg, 1.5rem));
}

/* Opt-in queue/detail panes use the existing Scroll Region height setting.
   Short panes stay natural; stacked and printed panes show all content. */
.mhn-grid-split--bounded > * {
  min-width: 0;
  min-height: 0;
  max-height: var(--scrollbox-max-height, 60vh);
  overflow: auto;
  overscroll-behavior: contain;
}
@media (max-width: 1023px) {
  .mhn-grid-split {
    grid-template-columns: minmax(0, 1fr);
  }
  .mhn-grid-split--bounded > * { max-height: none; overflow: visible; }
}
@media print {
  .mhn-grid-split--bounded > * { max-height: none; overflow: visible; }
}

/* Shared three-pane authoring workspaces: tools, content and inspector.
   Preferred side widths are capped to keep the content track usable. */
.mhn-workbench {
  display: grid;
  grid-template-columns: minmax(0, min(var(--workbench-tools-width, 15rem), 25%)) minmax(0, 1fr) minmax(0, min(var(--workbench-inspector-width, 22rem), 35%));
  align-items: start;
  gap: var(--layout-content-gap, 1.25rem);
  min-width: 0;
}
.mhn-workbench > * { min-width: 0; }
.mhn-workbench-preview { min-height: var(--workbench-preview-min-height, 18rem); }
@media (max-width: 1320px) {
  .mhn-workbench {
    grid-template-columns: minmax(0, min(var(--workbench-tools-width, 15rem), 40%)) minmax(0, 1fr);
  }
  .mhn-workbench > .mhn-workbench__inspector {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
  }
}
@media (max-width: 860px) {
  .mhn-workbench { grid-template-columns: minmax(0, 1fr); }
}
@media print {
  .mhn-workbench { grid-template-columns: minmax(0, 1fr); }
  .mhn-workbench > .mhn-workbench__tools { max-height: none; overflow: visible; }
}

/* Opt-in sidebars clear the measured shell header and use the editor's gap.
   The bounded variant is for keyboard-focusable scroll stacks, not card padding. */
.mhn-sticky-sidebar {
  box-sizing: border-box;
  min-width: 0;
  align-self: start;
}
@media (min-width: 1024px) {
  .mhn-sticky-sidebar {
    position: sticky;
    top: calc(var(--layout-sticky-clearance, var(--layout-header-scroll-offset, 0px)) + var(--layout-content-gap, 1rem));
  }
  .mhn-sticky-sidebar--bounded {
    max-height: calc(100dvh - var(--layout-sticky-clearance, var(--layout-header-scroll-offset, 0px)) - var(--layout-content-gap, 1rem) - var(--layout-content-gap, 1rem));
    overflow: auto;
    scrollbar-gutter: stable;
  }
}
@media print {
  .mhn-sticky-sidebar {
    position: static;
    top: auto;
    max-height: none;
    overflow: visible;
  }
}

/* Bounded navigation retains native links, layout and sticky behavior.
   Its height is independent of lookup choices, tables and text/output panes. */
.mhn-navigation-list {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  max-height: var(--navigation-list-max-height, 60vh);
  overflow: auto;
}
.mhn-navigation-list > * { flex-shrink: 0; }
@media print {
  .mhn-navigation-list,
  .mhn-navigation-list.mhn-tablist,
  .mhn-navigation-list.mhn-scroll-stack { max-height: none; overflow: visible; }
}

.mhn-list {
  padding-left: var(--spacing-xl, 1.5rem);
  margin: 0;
}

/* Marker-free lists stay unindented even when composed with the base list. */
.mhn-list.mhn-list-unstyled { padding: 0; }

/* Structural lists own spacing through their grid/stack/navigation layout. */
.mhn-list-unstyled > li,
.mhn-list.mhn-stack > li,
.mhn-rootmenu > li,
.mhn-submenu > li { margin: 0; }

.mhn-list--compact > li + li {
  margin-top: var(--spacing-xs, 0.25rem);
}

.mhn-article-body {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: var(--font-size-base, 16px);
  line-height: var(--line-height-base, 1.5);
  color: var(--body-text-color, var(--mhn-fg, #0f172a));
}

.mhn-article-body h1,
.mhn-article-body h2,
.mhn-article-body h3,
.mhn-article-body h4,
.mhn-article-body h5,
.mhn-article-body h6 {
  margin: var(--spacing-xl, 1.25rem) 0 var(--spacing-sm, 0.5rem);
}

.mhn-article-body p,
.mhn-article-body ul,
.mhn-article-body ol {
  margin: var(--spacing-sm, 0.5rem) 0;
}

.mhn-article-body pre {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  padding: var(--card-compact-padding, var(--spacing-md, 0.75rem));
  border-radius: var(--card-radius, 12px);
  background: var(--card-subtle-background, var(--mhn-surface-1, #f6f8fa));
}

.mhn-article-body > :first-child { margin-top: 0; }
.mhn-article-body > :last-child { margin-bottom: 0; }

.mhn-table-wrapper {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  contain: inline-size;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

/* Keep absolutely positioned accessible labels inside the scroll container. */
.mhn-table-wrapper--anchored {
  position: relative;
}

/* Opt-in table/card alternatives. A table without a card fallback stays visible. */
.mhn-table-cards {
  min-width: 0;
}
.mhn-table-cards > .mhn-table-cards__cards {
  display: none;
  gap: var(--spacing-md, 1rem);
  min-width: 0;
}
@media screen and (max-width: 768px) {
  .mhn-table-cards:has(> .mhn-table-cards__cards) > .mhn-table-wrapper {
    display: none;
  }
  .mhn-table-cards > .mhn-table-cards__cards {
    display: grid;
  }
}

/* Optional flush table frame; table borders and shared surface radius stay managed. */
.mhn-table-wrapper--framed {
  box-sizing: border-box;
  border: var(--table-border-width, 1px) solid var(--table-border-color, var(--mhn-border, #e2e8f0));
  border-radius: var(--card-radius, 12px);
}
.mhn-table-wrapper--framed > .mhn-table {
  margin-bottom: 0;
}

/* Opt-in matrices keep selected cells and frozen labels on shared table tokens. */
.mhn-table__value-label {
  /* Full text remains available to assistive technology and a title tooltip. */
  max-width: var(--table-value-min-width, 96px);
}
.mhn-table-wrapper--bounded {
  max-height: var(--table-scroll-max-height, 60vh);
}
@media print {
  .mhn-table-wrapper--bounded { max-height: none; overflow: visible; }
}
.mhn-table > tbody > tr > .mhn-table__selection.is-selected {
  background: var(--table-selected-background, var(--mhn-surface-2, #f1f5f9));
}
.mhn-table .mhn-table__frozen {
  position: sticky;
  inset-inline-start: 0;
  width: min(var(--table-text-min-width, 220px), 50vw);
  min-width: min(var(--table-text-min-width, 220px), 50vw);
  background: var(--table-background, var(--mhn-surface, #fff));
  z-index: 2;
}
.mhn-table .mhn-table__frozen--value {
  width: min(var(--table-value-min-width, 96px), 50vw);
  min-width: min(var(--table-value-min-width, 96px), 50vw);
}
.mhn-table > thead > tr > .mhn-table__frozen {
  background: var(--table-header-background, var(--mhn-surface-1, #f8fafc));
  z-index: 4;
}
/* Stick the entire header group, so multiple rows do not overlap at top: 0. */
.mhn-table--sticky-group > thead {
  position: sticky;
  top: 0;
  z-index: 3;
}

/* Opt-in editable record tables: one data/control tree, managed Card/Form layout. */
.mhn-table-wrapper--records {
  overflow: visible;
}
.mhn-table.mhn-table--records {
  display: block;
  min-width: 0;
  border-collapse: separate;
  border-spacing: 0;
  background: transparent;
}
.mhn-table--records > tbody {
  display: grid;
  gap: var(--card-grid-gap, var(--spacing-lg, 1.5rem));
}
.mhn-table--records > tbody > tr {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--form-grid-min, 220px)), 1fr));
  gap: var(--card-gap, var(--spacing-md, 1rem));
  align-items: start;
}
.mhn-table.mhn-table--records > tbody > tr > td {
  display: block;
  min-width: 0;
  padding: 0;
  border: 0;
  text-align: start;
  overflow-wrap: anywhere;
}
.mhn-table--records > tbody > tr > td[data-label]::before {
  content: attr(data-label);
  display: block;
  margin-block-end: var(--form-field-gap, 0.375rem);
  color: var(--form-label-color, var(--body-text-color, #0f172a));
  font-size: var(--form-label-font-size, var(--font-size-sm, 0.875rem));
  font-weight: var(--form-label-font-weight, 600);
  letter-spacing: var(--form-label-letter-spacing, 0);
  text-transform: var(--form-label-text-transform, none);
}
.mhn-table--records > tbody > tr > td.mhn-record-table__self-labelled::before {
  content: none;
}

.mhn-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--table-margin-bottom, var(--spacing-md, 1rem));
  background: var(--table-background, var(--mhn-surface, #fff));
  color: var(--table-color, var(--body-text-color, #1f2937));
  font-size: var(--table-font-size, var(--font-size-base, 1rem));
  text-align: start;
}

/* Embedded previews opt out of the table margin; their host owns spacing. */
.mhn-table.mhn-m-0 { margin: 0; }
.mhn-timeline-metrics .mhn-table { width: max-content; max-width: none; }

.mhn-table > :where(thead, tbody, tfoot) > tr > :where(th, td) {
  padding: var(--table-cell-padding-y, 0.5rem) var(--table-cell-padding-x, 0.75rem);
  border: var(--table-border-width, 1px) solid var(--table-border-color, var(--mhn-border, #e2e8f0));
  vertical-align: var(--table-cell-vertical-align, top);
}

.mhn-table > thead > tr > th {
  background: var(--table-header-background, var(--mhn-surface-1, #f8fafc));
  color: var(--table-header-color, var(--body-text-color, #1f2937));
  font-size: var(--table-header-font-size, var(--font-size-sm, 0.875rem));
  font-weight: var(--table-header-font-weight, 600);
  letter-spacing: var(--table-header-letter-spacing, 0);
  text-transform: var(--table-header-text-transform, none);
}

:where(.mhn-table) th {
  text-align: inherit;
}

.mhn-table.mhn-compact > :where(thead, tbody, tfoot) > tr > :where(th, td) {
  padding: var(--table-compact-padding-y, 0.25rem) var(--table-compact-padding-x, 0.5rem);
}

.mhn-striped > tbody > tr:nth-child(odd) {
  background: var(--table-stripe-background, var(--mhn-surface-1, #f8fafc));
}

.mhn-hoverable > tbody > tr:hover {
  background: var(--table-hover-background, var(--mhn-surface-2, #f1f5f9));
}

/* Semantic row tones reuse the Style Editor's status palette. Selection and
 * revision-difference states take precedence; status is also expressed in text. */
.mhn-table > tbody > tr.mhn-table__row--success:where(:not(.is-changed, .is-selected, [aria-selected="true"])) {
  background: var(--mhn-success-bg, #dcfce7);
  color: var(--mhn-success-fg, #166534);
}
.mhn-table > tbody > tr.mhn-table__row--warning:where(:not(.is-changed, .is-selected, [aria-selected="true"])) {
  background: var(--mhn-warning-bg, #fef3c7);
  color: var(--mhn-warning-fg, #92400e);
}
.mhn-table > tbody > tr.mhn-table__row--danger:where(:not(.is-changed, .is-selected, [aria-selected="true"])) {
  background: var(--mhn-danger-bg, #fee2e2);
  color: var(--mhn-danger-fg, #991b1b);
}
.mhn-table > tbody > tr.mhn-table__row--info:where(:not(.is-changed, .is-selected, [aria-selected="true"])) {
  background: var(--mhn-info-bg, #dbeafe);
  color: var(--mhn-info-fg, #1e40af);
}

/* Independent urgency markers can coexist with a semantic row background.
 * Selection is intentionally later in the cascade and replaces this marker. */
.mhn-table > tbody > tr.mhn-table__row-marker--warning > :first-child {
  box-shadow: inset 3px 0 0 var(--badge-warning-fg, #92400e);
}
.mhn-table > tbody > tr.mhn-table__row-marker--danger > :first-child {
  box-shadow: inset 3px 0 0 var(--badge-danger-fg, #991b1b);
}

/* Revision differences are not a user selection; use a separate managed color. */
.mhn-table > tbody > tr.is-changed {
  background: var(--table-changed-background, var(--badge-info-bg, #dbeafe));
}

.mhn-table > tbody > tr:is(.is-selected, [aria-selected="true"]) {
  background: var(--table-selected-background, var(--mhn-surface-2, #f1f5f9));
}

.mhn-table > tbody > tr:is(.is-selected, [aria-selected="true"]) > :first-child {
  box-shadow: inset 3px 0 0 var(--table-selected-indicator, var(--mhn-accent, #741c73));
}


/* Read-only scientific/report tables keep one semantic data tree at every width.
 * Desktop column allocation may remain domain-specific. On phones, each row
 * becomes a labelled record using Table appearance and managed grid sizing. */
.mhn-table--report > thead > tr > th,
.mhn-table--report .mhn-badge {
  overflow-wrap: normal;
  word-break: normal;
}
@media (max-width: 760px) {
  .mhn-table.mhn-table--report {
    display: block;
    width: 100%;
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }
  .mhn-table--report > thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
  .mhn-table--report > colgroup { display: none; }
  .mhn-table--report > tbody {
    display: grid;
    gap: var(--card-grid-gap, var(--spacing-lg, 1.5rem));
  }
  .mhn-table--report > tbody > tr {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--table-text-min-width, 220px)), 1fr));
    min-width: 0;
    border: var(--table-border-width, 1px) solid var(--table-border-color, var(--mhn-border, #e2e8f0));
    border-radius: var(--card-radius, 12px);
    overflow: hidden;
  }
  .mhn-table.mhn-table--report > tbody > tr > :is(th, td) {
    display: block;
    width: auto;
    min-width: 0;
    max-width: 100%;
    text-align: start;
    overflow-wrap: anywhere;
    white-space: normal;
    border: 0;
    border-block-end: var(--table-border-width, 1px) solid var(--table-border-color, var(--mhn-border, #e2e8f0));
  }
  .mhn-table.mhn-table--report > tbody > tr > :is(th[scope="row"], .mhn-table__row-heading) {
    grid-column: 1 / -1;
    background: var(--table-header-background, var(--mhn-surface-1, #f8fafc));
    color: var(--table-header-color, var(--body-text-color, #1f2937));
    font-size: var(--table-header-font-size, var(--font-size-sm, 0.875rem));
    font-weight: var(--table-header-font-weight, 600);
    letter-spacing: var(--table-header-letter-spacing, 0);
    text-transform: var(--table-header-text-transform, none);
  }
  .mhn-table--report > tbody > tr > td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-block-end: var(--spacing-xs, 0.25rem);
    color: var(--table-header-color, var(--body-text-color, #1f2937));
    font-size: var(--table-header-font-size, var(--font-size-sm, 0.875rem));
    font-weight: var(--table-header-font-weight, 600);
    letter-spacing: var(--table-header-letter-spacing, 0);
    text-transform: var(--table-header-text-transform, none);
  }
}

/* Several rows can form one report record, including a full-width detail cell.
 * Direct children only: nested scientific preview tables keep native columns. */
@media (max-width: 760px) {
  .mhn-table--report.mhn-table--report-grouped > tbody {
    gap: 0;
    border: var(--table-border-width, 1px) solid var(--table-border-color, var(--mhn-border, #e2e8f0));
    border-radius: var(--card-radius, 12px);
    overflow: hidden;
  }
  .mhn-table--report.mhn-table--report-grouped > tbody + tbody {
    margin-block-start: var(--card-grid-gap, var(--spacing-lg, 1.5rem));
  }
  .mhn-table--report.mhn-table--report-grouped > tbody > tr {
    border: 0;
    border-radius: 0;
  }
}

.mhn-table__primary {
  font-weight: var(--font-weight-semibold, 600);
}

.mhn-table--intrinsic {
  min-width: max-content;
}

/* Natural-width tables honor opted-in column bounds instead of stretching them. */
.mhn-table--fit-content {
  width: max-content;
}

.mhn-table--wide {
  min-width: var(--table-min-width, 960px);
}

/* Opt-in readable columns inside horizontally scrollable workbench tables. */
.mhn-table__text-cell {
  min-width: var(--table-text-min-width, 220px);
}

/* Opt-in wrapping for prose columns; values and controls keep their own sizing. */
.mhn-table__text-cell--bounded {
  max-width: var(--table-text-max-width, 26rem);
  overflow-wrap: anywhere;
  white-space: normal;
}

/* Keep short scientific values and units readable beside long-text columns. */
.mhn-table__value-cell {
  min-width: var(--table-value-min-width, 96px);
}

/* Action columns opt in independently of text/value columns and drag handles. */
.mhn-table__action-cell {
  min-width: var(--table-action-min-width, 160px);
}

.mhn-table__form-cell {
  min-width: var(--form-grid-min, 220px);
}

.mhn-table__status-cell {
  min-width: var(--stat-grid-min, 110px);
}

.mhn-table--sticky thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Opt-in native progress keeps browser value/ARIA semantics and shared tokens. */
progress.mhn-progress--native[value] {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: var(--progress-height, 0.75rem);
  border: 0;
  border-radius: var(--progress-radius, var(--radius-pill, 999px));
  overflow: hidden;
  background: var(--progress-track-background, var(--mhn-surface-2, #f1f5f9));
  color: var(--progress-fill-background, var(--mhn-accent, #4f46e5));
}
progress.mhn-progress--native[value]::-webkit-progress-bar {
  background: var(--progress-track-background, var(--mhn-surface-2, #f1f5f9));
  border-radius: inherit;
}
progress.mhn-progress--native[value]::-webkit-progress-value {
  background: var(--progress-fill-background, var(--mhn-accent, #4f46e5));
}
progress.mhn-progress--native[value]::-moz-progress-bar {
  background: var(--progress-fill-background, var(--mhn-accent, #4f46e5));
}

/* Decorative loading placeholders; callers retain ownership of data state. */
.mhn-skeleton {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: var(--skeleton-height, 7rem);
  overflow: hidden;
  border-radius: var(--skeleton-radius, var(--card-radius, 12px));
  background: linear-gradient(90deg,
    var(--skeleton-background, var(--card-subtle-background, var(--mhn-surface-1, #f8fafc))),
    var(--skeleton-highlight-color, var(--mhn-surface-2, #f1f5f9)),
    var(--skeleton-background, var(--card-subtle-background, var(--mhn-surface-1, #f8fafc))));
  background-size: 200% 100%;
  animation: mhn-skeleton-pulse var(--skeleton-duration, 1200ms) ease-in-out infinite;
}
@keyframes mhn-skeleton-pulse {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .mhn-skeleton { animation: none; }
}

.mhn-progress {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm, 0.75rem);
}

.mhn-progress.is-hidden {
  display: none;
}

.mhn-progress__track {
  position: relative;
  width: 100%;
  height: var(--progress-height, 0.75rem);
  border-radius: var(--progress-radius, var(--radius-pill, 999px));
  background: var(--progress-track-background, var(--mhn-surface-2, #f1f5f9));
  overflow: hidden;
}

.mhn-progress__fill {
  display: block;
  width: var(--mhn-progress-value, 0%);
  height: 100%;
  background: var(--progress-fill-background, var(--mhn-accent, #4f46e5));
  transition: width 180ms ease;
}

.mhn-progress__fill--success {
  background: var(--mhn-success, #16a34a);
}

.mhn-progress__status {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--body-text-muted, #64748b);
}


.mhn-truncate {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs, 0.25rem);
  max-width: 100%;
}

.mhn-truncate__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* Semantic fieldsets compose with field/stack layouts without browser chrome. */
.mhn-fieldset {
  margin: 0;
  min-width: 0;
}
.mhn-fieldset:where(:not(.mhn-panel):not(.mhn-card)) {
  border: 0;
  padding: 0;
}
.mhn-fieldset > legend {
  padding: 0;
  margin-block-end: var(--form-field-gap, 0.375rem);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.mhn-choice {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs, 0.25rem);
  font-weight: var(--font-weight-medium, 500);
}

/* Described settings choices keep the native control beside wrapping text. */
.mhn-choice--target {
  /* Anchor an sr-only name locally so it cannot escape a scrolling matrix. */
  position: relative;
  justify-content: center;
  min-width: var(--input-min-height, 40px);
  min-height: var(--input-min-height, 40px);
  cursor: pointer;
}
.mhn-choice--target:has(:disabled) {
  cursor: not-allowed;
}

.mhn-choice--described {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--spacing-sm, 0.5rem);
}

/* Native described choices can put their control before the description. */
.mhn-choice--described.mhn-choice--leading {
  grid-template-columns: auto minmax(0, 1fr);
}

.mhn-description-list {
  display: grid;
  grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
  column-gap: var(--spacing-xl, 1.5rem);
  row-gap: var(--spacing-sm, 0.75rem);
  margin: 0;
}

.mhn-description-list dt {
  font-weight: var(--font-weight-medium, 500);
  color: var(--body-text-muted, #64748b);
}

.mhn-description-list dd {
  margin: 0;
  color: var(--body-text-color, var(--body-text, var(--mhn-fg, #0f172a)));
}

/* Narrow cards can keep each label/value pair at the full available width. */
.mhn-description-list--stacked {
  grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 768px) {
  .mhn-description-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .mhn-description-list dt {
    margin-bottom: var(--spacing-2xs, 0.2rem);
  }
}

/* One-line record browsing composes independent Button, Card and spacing controls. */
.mhn-record-navigation {
  display: grid;
  grid-template-columns: minmax(min-content, var(--record-navigation-leading-max-width, 8rem)) minmax(min-content, 1fr) minmax(min-content, var(--record-navigation-trailing-max-width, 10rem));
  align-items: center;
  gap: var(--card-compact-gap, 0.5rem);
  overflow-x: auto;
}

.mhn-record-navigation > .mhn-record-navigation__leading {
  min-width: min-content;
  max-width: var(--record-navigation-leading-max-width, 8rem);
  overflow: hidden;
}

.mhn-record-navigation__trailing {
  min-width: min-content;
}

.mhn-record-navigation__trailing .mhn-record-navigation__action {
  min-width: min-content;
  max-width: var(--record-navigation-trailing-max-width, 10rem);
}

.mhn-record-navigation__sequence {
  display: grid;
  grid-template-columns: minmax(min-content, 1fr) max-content minmax(min-content, 1fr);
  min-width: var(--record-navigation-min-width, 34rem);
  width: 100%;
  align-items: center;
  justify-content: center;
  column-gap: var(--spacing-sm, 0.5rem);
  overflow: hidden;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  white-space: nowrap;
}

.mhn-record-navigation__sequence .mhn-record-navigation__link {
  display: inline-grid;
  grid-template-columns: auto minmax(min-content, 1fr);
}

/* Names may truncate, but retain a visible character-sized focus target. */
.mhn-record-navigation__link > .mhn-truncate__text { min-width: 1em; contain: inline-size; }

.mhn-record-navigation__previous {
  grid-column: 1;
  justify-self: end;
}

.mhn-record-navigation__position {
  grid-column: 2;
  justify-self: center;
  white-space: nowrap;
}

.mhn-record-navigation__sequence .mhn-record-navigation__next {
  grid-column: 3;
  justify-self: start;
  grid-template-columns: minmax(min-content, 1fr) auto;
}

@media (max-width: 900px) {
  .mhn-record-navigation__leading .mhn-record-navigation__leading-label { display: none; }
}

@media (max-width: 600px) {
  .mhn-record-navigation {
    position: static;
    display: flex;
    flex-wrap: nowrap;
  }
  .mhn-record-navigation__sequence { min-width: min-content; flex: 0 0 var(--record-navigation-min-width, 34rem); }
  .mhn-record-navigation__leading,
  .mhn-record-navigation__trailing,
  .mhn-record-navigation__action { flex: 0 0 auto; }
  .mhn-record-navigation > .mhn-record-navigation__leading { max-width: var(--record-navigation-leading-compact-max-width, 6.75rem); }
  .mhn-record-navigation__trailing .mhn-record-navigation__action { max-width: var(--record-navigation-trailing-compact-max-width, 7.5rem); }
  .mhn-record-navigation__previous { justify-self: start; }
  .mhn-record-navigation__next { justify-self: end; }
  .mhn-record-navigation__sequence .mhn-record-navigation__link { grid-template-columns: minmax(min-content, 1fr); }
  .mhn-record-navigation__link span[aria-hidden="true"] { display: none; }
}

/* Shared rating visuals; score/fraction and selection state belong to consumers. */
.mhn-rating-stars {
  display: inline-flex;
  gap: var(--rating-star-gap, 0.2rem);
  max-width: 100%;
  overflow-x: auto;
  vertical-align: middle;
}
.mhn-rating-star, .mhn-rating-icon {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: var(--_rating-size, var(--rating-star-size, 1.15rem));
  height: var(--_rating-size, var(--rating-star-size, 1.15rem));
  color: var(--body-text-muted, #64748b);
}
.mhn-rating-icon { --_rating-size: var(--rating-input-star-size, 1.4rem); max-width: 100%; max-height: 100%; }
.mhn-rating-button.is-selected .mhn-rating-icon { color: var(--mhn-accent, #673ab7); }
.mhn-rating-star::before, .mhn-rating-fill::before, .mhn-rating-icon::before {
  content: '';
  position: absolute;
  inset: 0;
  width: var(--_rating-size, var(--rating-star-size, 1.15rem));
  background-color: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='currentColor' d='M11.049 2.927a1 1 0 011.902 0l1.286 3.986a1 1 0 00.95.69h4.192c.969 0 1.371 1.24.588 1.81l-3.393 2.466a1 1 0 00-.364 1.118l1.287 3.987c.3.921-.755 1.688-1.54 1.118l-3.393-2.466a1 1 0 00-1.175 0l-3.393 2.466c-.784.57-1.839-.197-1.54-1.118l1.287-3.987a1 1 0 00-.364-1.118L2.23 9.413c-.783-.57-.38-1.81.588-1.81h4.192a1 1 0 00.95-.69l1.286-3.986z'/%3E%3C/svg%3E") no-repeat center / contain;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='currentColor' d='M11.049 2.927a1 1 0 011.902 0l1.286 3.986a1 1 0 00.95.69h4.192c.969 0 1.371 1.24.588 1.81l-3.393 2.466a1 1 0 00-.364 1.118l1.287 3.987c.3.921-.755 1.688-1.54 1.118l-3.393-2.466a1 1 0 00-1.175 0l-3.393 2.466c-.784.57-1.839-.197-1.54-1.118l1.287-3.987a1 1 0 00-.364-1.118L2.23 9.413c-.783-.57-.38-1.81.588-1.81h4.192a1 1 0 00.95-.69l1.286-3.986z'/%3E%3C/svg%3E") no-repeat center / contain;
}
/* A fractional fill clips the complete glyph instead of compressing it. */
.mhn-rating-icon::before { width: 100%; }
.mhn-rating-fill {
  position: absolute;
  inset: 0;
  width: var(--rating-fill, 0%);
  overflow: hidden;
  color: var(--mhn-accent, #673ab7);
}

.mhn-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm, 0.5rem);
  font-size: var(--font-size-sm, 0.875rem);
}

.mhn-pagination__link {
  color: var(--link-color, var(--mhn-accent, #4f46e5));
  text-decoration: none;
  font-weight: var(--font-weight-medium, 500);
}

.mhn-pagination__link:focus,
.mhn-pagination__link:hover {
  text-decoration: underline;
}

.mhn-pagination__status {
  color: var(--body-text-muted, #64748b);
}

.mhn-scroll-region,
.mhn-scrollbox {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  max-height: var(--scrollbox-max-height, 60vh);
}

/* Compatibility surface: new consumers can compose the bare scroll region
 * with a shared Card/Panel without adding a second surface. */
.mhn-scrollbox {
  padding: var(--card-padding, var(--spacing-lg, 1rem));
  background: var(--card-subtle-background, var(--mhn-surface-1, #f8fafc));
  border-radius: var(--card-radius, 12px);
  border: var(--card-border-width, 1px) solid var(--card-border-color, var(--mhn-border, #e2e8f0));
}

.mhn-badge,
.mhn-tag,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
  border-radius: var(--badge-border-radius, 12px);
  padding: var(--badge-padding-y, 0.25rem) var(--badge-padding-x, 0.75rem);
  border: var(--badge-border-width, 1px) solid var(--badge-neutral-border, var(--badge-border, transparent));
  background: var(--badge-neutral-bg, #E5E7EB);
  color: var(--badge-neutral-fg, #374151);
  letter-spacing: var(--badge-letter-spacing, 0.04em);
  font-weight: var(--badge-font-weight, var(--font-weight-semibold, 600));
  font-size: var(--badge-font-size, var(--font-size-xs, 0.75rem));
  line-height: var(--badge-line-height, 1.4);
  text-transform: var(--badge-text-transform, uppercase);
  white-space: var(--badge-white-space, nowrap);
  overflow-wrap: anywhere;
  text-align: center;
}

.mhn-badge.mhn-badge--compact {
  padding: var(--badge-compact-padding-y, 0.15rem) var(--badge-compact-padding-x, 0.2rem);
}

/* Shell-specific placement only; unread counters use shared badge appearance. */
.mhn-message-count {
  margin-inline-start: var(--spacing-xs, 0.25rem);
}

.mhn-profile-icon .mhn-message-count {
  position: absolute;
  inset-block-start: calc(-1 * var(--spacing-xs, 0.25rem));
  inset-inline-end: calc(-1 * var(--spacing-xs, 0.25rem));
  margin-inline-start: 0;
  max-width: none;
}

.mhn-badge--neutral,
.mhn-badge.mhn-neutral,
.mhn-badge-muted,
.mhn-badge-light,
.mhn-tag.mhn-neutral {
  background: var(--badge-neutral-bg, #E5E7EB);
  color: var(--badge-neutral-fg, #374151);
  border: var(--badge-border-width, 1px) solid var(--badge-neutral-border, var(--badge-border, none));
}

.mhn-badge--success,
.mhn-badge--level-success,
.mhn-badge-success,
.mhn-badge.mhn-success,
.badge-success {
  background: var(--badge-success-bg, #DCFCE7);
  color: var(--badge-success-fg, #166534);
  border: var(--badge-border-width, 1px) solid var(--badge-success-border, var(--badge-border, none));
}

.mhn-badge--warning,
.mhn-badge-warning,
.mhn-badge.mhn-warning,
.badge-warning {
  background: var(--badge-warning-bg, #FEF3C7);
  color: var(--badge-warning-fg, #92400E);
  border: var(--badge-border-width, 1px) solid var(--badge-warning-border, var(--badge-border, none));
}

.mhn-badge--info,
.mhn-badge-info,
.mhn-badge.mhn-info,
.badge-info {
  background: var(--badge-info-bg, #DBEAFE);
  color: var(--badge-info-fg, #1E40AF);
  border: var(--badge-border-width, 1px) solid var(--badge-info-border, var(--badge-border, none));
}

.mhn-badge--danger,
.mhn-badge--level-danger,
.mhn-badge-danger,
.mhn-badge.mhn-danger,
.mhn-badge.mhn-red,
.badge-danger,
.badge-error {
  background: var(--badge-danger-bg, #FEE2E2);
  color: var(--badge-danger-fg, #991B1B);
  border: var(--badge-border-width, 1px) solid var(--badge-danger-border, var(--badge-border, none));
}

.mhn-badge--secondary,
.badge-secondary,
.mhn-badge.mhn-grey,
.mhn-tag.mhn-grey {
  background: var(--badge-secondary-bg, #E5E7EB);
  color: var(--badge-secondary-fg, #374151);
  border: var(--badge-border-width, 1px) solid var(--badge-secondary-border, var(--badge-border, none));
}

.mhn-badge--subtle {
  background: var(--badge-subtle-bg, #F9FAFB);
  color: var(--badge-subtle-fg, #4B5563);
  border: var(--badge-border-width, 1px) solid var(--badge-subtle-border, var(--badge-border, #E5E7EB));
}

.mhn-badge--ghost {
  background: var(--badge-ghost-bg, transparent);
  color: var(--badge-ghost-fg, #4B5563);
  border: var(--badge-border-width, 1px) solid var(--badge-ghost-border, var(--badge-border, #D1D5DB));
}

.mhn-badge--accent,
.mhn-badge.mhn-purple,
.mhn-tag.mhn-purple {
  background: var(--badge-accent-bg, var(--mhn-accent));
  color: var(--badge-accent-fg, #FFFFFF);
  border: var(--badge-border-width, 1px) solid var(--badge-accent-border, var(--badge-border, none));
}

.mhn-badge--method-get,
.mhn-tag.mhn-method-get {
  background: var(--badge-method-get-bg, #DBEAFE);
  color: var(--badge-method-get-fg, #1E40AF);
  border: var(--badge-border-width, 1px) solid var(--badge-method-get-border, var(--badge-border, none));
}

.mhn-badge--method-post,
.mhn-tag.mhn-method-post {
  background: var(--badge-method-post-bg, #DDD6FE);
  color: var(--badge-method-post-fg, #4C1D95);
  border: var(--badge-border-width, 1px) solid var(--badge-method-post-border, var(--badge-border, none));
}

.mhn-badge--method-put,
.mhn-tag.mhn-method-put {
  background: var(--badge-method-put-bg, #FEF3C7);
  color: var(--badge-method-put-fg, #92400E);
  border: var(--badge-border-width, 1px) solid var(--badge-method-put-border, var(--badge-border, none));
}

.mhn-badge--method-patch,
.mhn-tag.mhn-method-patch {
  background: var(--badge-method-patch-bg, #DCFCE7);
  color: var(--badge-method-patch-fg, #166534);
  border: var(--badge-border-width, 1px) solid var(--badge-method-patch-border, var(--badge-border, none));
}

.mhn-badge--method-delete,
.mhn-tag.mhn-method-delete {
  background: var(--badge-method-delete-bg, #FEE2E2);
  color: var(--badge-method-delete-fg, #991B1B);
  border: var(--badge-border-width, 1px) solid var(--badge-method-delete-border, var(--badge-border, none));
}

.mhn-badge--method-options,
.mhn-tag.mhn-method-options {
  background: var(--badge-method-options-bg, #F3F4F6);
  color: var(--badge-method-options-fg, #374151);
  border: var(--badge-border-width, 1px) solid var(--badge-method-options-border, var(--badge-border, none));
}

.mhn-badge--method-head,
.mhn-tag.mhn-method-head {
  background: var(--badge-method-head-bg, #F3F4F6);
  color: var(--badge-method-head-fg, #374151);
  border: var(--badge-border-width, 1px) solid var(--badge-method-head-border, var(--badge-border, none));
}

.mhn-badge--level-debug,
.mhn-tag.mhn-level-debug {
  background: var(--badge-level-debug-bg, #F0F9FF);
  color: var(--badge-level-debug-fg, #0C4A6E);
  border: var(--badge-border-width, 1px) solid var(--badge-level-debug-border, var(--badge-border, none));
}

.mhn-badge--level-info,
.mhn-tag.mhn-level-info {
  background: var(--badge-level-info-bg, #DBEAFE);
  color: var(--badge-level-info-fg, #1E40AF);
  border: var(--badge-border-width, 1px) solid var(--badge-level-info-border, var(--badge-border, none));
}

.mhn-badge--level-notice,
.mhn-tag.mhn-level-notice {
  background: var(--badge-level-notice-bg, #DCFCE7);
  color: var(--badge-level-notice-fg, #166534);
  border: var(--badge-border-width, 1px) solid var(--badge-level-notice-border, var(--badge-border, none));
}

.mhn-badge--level-warning,
.mhn-tag.mhn-level-warning {
  background: var(--badge-level-warning-bg, #FEF3C7);
  color: var(--badge-level-warning-fg, #92400E);
  border: var(--badge-border-width, 1px) solid var(--badge-level-warning-border, var(--badge-border, none));
}

.mhn-badge--level-error,
.mhn-tag.mhn-level-error {
  background: var(--badge-level-error-bg, #FEE2E2);
  color: var(--badge-level-error-fg, #991B1B);
  border: var(--badge-border-width, 1px) solid var(--badge-level-error-border, var(--badge-border, none));
}

.mhn-badge--level-critical,
.mhn-tag.mhn-level-critical {
  background: var(--badge-level-critical-bg, #7F1D1D);
  color: var(--badge-level-critical-fg, #FFFFFF);
  border: var(--badge-border-width, 1px) solid var(--badge-level-critical-border, var(--badge-border, none));
}

.mhn-badge--level-alert,
.mhn-tag.mhn-level-alert {
  background: var(--badge-level-alert-bg, #7C2D12);
  color: var(--badge-level-alert-fg, #FFFFFF);
  border: var(--badge-border-width, 1px) solid var(--badge-level-alert-border, var(--badge-border, none));
}

.mhn-badge--level-emergency,
.mhn-tag.mhn-level-emergency {
  background: var(--badge-level-emergency-bg, #500724);
  color: var(--badge-level-emergency-fg, #FFFFFF);
  border: var(--badge-border-width, 1px) solid var(--badge-level-emergency-border, var(--badge-border, none));
}

.mhn-badge--wrap,
.mhn-table--report .mhn-badge--wrap {
  white-space: normal;
  overflow-wrap: anywhere;
}

















.mhn-sort-link {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2xs, 0.2rem);
  color: var(--link-color, var(--mhn-accent, #4f46e5));
  text-decoration: none;
  font-weight: var(--font-weight-medium, 500);
}

.mhn-sort-link:focus,
.mhn-sort-link:hover {
  text-decoration: underline;
}

.mhn-sort-link__icon {
  font-size: 0.75em;
}

.mhn-table__actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.mhn-inline-form {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs, 0.25rem);
  margin: 0;
}

.mhn-code-block {
  /* Parent card/stack gap owns spacing, not the browser's default pre margin. */
  margin: 0;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);
  font-size: var(--font-size-sm, 0.875rem);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Keep this after surface rules, whose default foreground is inherited. */
.mhn-text-body {
  color: var(--body-text-color, var(--mhn-fg, #0f172a));
}

.mhn-tablist {
  display: flex;
  flex-wrap: var(--tab-wrap, wrap);
  gap: var(--tab-gap, var(--spacing-xs, 0.25rem));
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  border-bottom: 1px solid var(--tab-border-color, var(--mhn-border, #e2e8f0));
  margin-bottom: var(--spacing-lg, 1rem);
}

/* Inline filter/view controls share tab appearance without page-nav spacing. */
.mhn-tablist--inline {
  margin-bottom: 0;
}

/* Sticky tab navigation uses the shared surface, not plugin-owned colors. */
.mhn-sticky-actions {
  position: sticky;
  top: calc(var(--layout-header-scroll-offset, 0px) + var(--spacing-xs, 0.25rem));
  z-index: 5;
  min-width: 0;
  max-width: 100%;
}

/* Large action toolbars stay in normal flow on narrow screens. */
@media (max-width: 1023px) {
  .mhn-sticky-actions--desktop { position: static; }
}

.mhn-tab-navigation--sticky {
  position: sticky;
  top: calc(var(--layout-header-scroll-offset, 0px) + var(--spacing-xs, 0.25rem));
  z-index: 6;
  min-width: 0;
  max-width: 100%;
  background: var(--card-background, var(--mhn-surface, #ffffff));
}

.mhn-tablist__tab {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: var(--spacing-xs, 0.25rem);
  max-width: 100%;
  min-width: 0;
  padding: var(--tab-padding-y, var(--spacing-sm, 0.5rem)) var(--tab-padding-x, var(--spacing-md, 1rem));
  border: 0;
  border-radius: var(--tab-radius, var(--radius-sm, 4px));
  background: transparent;
  box-shadow: none;
  font: inherit;
  font-size: var(--tab-font-size, var(--font-size-base, 1rem));
  font-weight: var(--tab-font-weight, 500);
  color: var(--tab-color, var(--body-text-muted, #64748b));
  text-decoration: none;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: color 120ms ease, background-color 120ms ease;
}

/* Navigation anchors and JS-controlled tabs share the same states. */
.mhn-tablist__tab:link,
.mhn-tablist__tab:visited {
  color: var(--tab-color, var(--body-text-muted, #64748b));
  text-decoration: none;
}

.mhn-tablist__tab:hover,
.mhn-tablist__tab:focus-visible,
.mhn-tablist__tab.is-active,
.mhn-tablist__tab[aria-selected="true"],
.mhn-tablist__tab[aria-pressed="true"],
.mhn-tablist__tab[aria-current="page"] {
  color: var(--tab-active-color, var(--mhn-accent, #4f46e5));
  background-color: var(--tab-active-background, transparent);
  background-image: none;
  text-decoration: none;
}

.mhn-tablist__tab:focus-visible {
  outline: 2px solid var(--focus-ring, var(--mhn-accent, #4f46e5));
  outline-offset: -2px;
}

.mhn-tablist__tab::after {
  content: '';
  position: absolute;
  left: var(--tab-padding-x, var(--spacing-md, 1rem));
  right: var(--tab-padding-x, var(--spacing-md, 1rem));
  bottom: 0;
  height: var(--tab-indicator-height, 2px);
  border-radius: var(--tab-radius, var(--radius-sm, 4px));
  background: transparent;
  transition: background 120ms ease;
}

.mhn-tablist__tab:hover::after,
.mhn-tablist__tab:focus-visible::after,
.mhn-tablist__tab.is-active::after,
.mhn-tablist__tab[aria-selected="true"]::after,
.mhn-tablist__tab[aria-pressed="true"]::after,
.mhn-tablist__tab[aria-current="page"]::after {
  background: var(--tab-active-color, var(--mhn-accent, #4f46e5));
}

.mhn-tablist__label {
  min-width: 0;
  font: inherit;
  color: inherit;
  text-decoration: none;
}

.mhn-tabpanel {
  display: none;
}

.mhn-tabpanel.is-active {
  display: block;
}

.mhn-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay, rgba(15, 23, 42, 0.45));
  display: none;
  z-index: 9998;
}

/* Native dialogs retain browser open/close, focus, Escape and top-layer behavior. */
/* Shared panel width is independent of modal and lookup-list sizing. In-flow
   previews use the same width; only anchored consumers opt into positioning. */
.mhn-floating-panel-host { position: relative; }
.mhn-floating-panel { inline-size: min(var(--floating-panel-width, 18rem), 100%); }
.mhn-floating-panel--wide { inline-size: min(var(--floating-panel-wide-width, 28rem), 100%); }
.mhn-floating-panel--anchored {
  position: absolute;
  inset-inline-end: 0;
  inset-block-start: calc(100% + var(--spacing-xs, 0.25rem));
  z-index: 30;
}

/* Width previews stay in flow; only the drawer role owns viewport placement. */
/* Typed lengths preserve valid unitless zero inside CSS min(). */
@property --_mhn-drawer-width {
  syntax: "<length-percentage>";
  inherits: false;
  initial-value: 420px;
}
@property --_mhn-drawer-max-width {
  syntax: "<length-percentage>";
  inherits: false;
  initial-value: 100%;
}
.mhn-drawer, .mhn-drawer-size {
  --_mhn-drawer-width: var(--drawer-width, 420px);
  --_mhn-drawer-max-width: var(--drawer-max-width, 92vw);
  box-sizing: border-box;
  min-inline-size: 0;
  inline-size: min(var(--_mhn-drawer-width), var(--_mhn-drawer-max-width), 100%);
  max-inline-size: 100%;
}
.mhn-drawer {
  position: fixed;
  inset-block-start: 0;
  inset-inline-end: 0;
  margin: 0;
  block-size: 100dvh;
  overflow: auto;
  /* Application-specific layers may override this structural integration hook. */
  z-index: var(--drawer-layer, 9997);
  transform: translateX(var(--_mhn-drawer-closed-offset, 100%));
  transition: transform var(--card-transition-duration, 120ms) ease;
}
.mhn-drawer:dir(rtl) { --_mhn-drawer-closed-offset: -100%; }
.mhn-drawer[aria-hidden="false"] { transform: translateX(0); }
@media (prefers-reduced-motion: reduce) {
  .mhn-drawer { transition: none; }
}

.mhn-dialog {
  margin: auto;
  width: min(calc(100% - 2 * var(--spacing-lg, 1.5rem)), var(--modal-max-width, 960px));
  max-width: calc(100% - 2 * var(--spacing-lg, 1.5rem));
  max-height: calc(100dvh - 2 * var(--spacing-lg, 1.5rem));
  overflow: auto;
}
.mhn-dialog:not([open]) { display: none; }
.mhn-dialog::backdrop { background: var(--modal-overlay, rgba(15, 23, 42, 0.45)); }
@media (max-width: 767px) {
  .mhn-dialog { width: min(calc(100% - 2 * var(--spacing-lg, 1.5rem)), var(--modal-max-width-mobile, 100%)); }
}

.mhn-modal {
  position: fixed;
  top: var(--modal-top-offset, 10%);
  left: 50%;
  transform: translateX(-50%);
  width: min(100% - var(--spacing-2xl, 2rem), var(--modal-max-width, 960px));
  background: var(--mhn-surface, #fff);
  border-radius: var(--radius-lg, 16px);
  box-shadow: var(--shadow-xl, 0 25px 50px -12px rgba(15, 23, 42, 0.35));
  display: none;
  z-index: 9999;
}

.mhn-modal-overlay.is-open,
.mhn-modal.is-open {
  display: block;
}

@media (max-width: 767px) {
  .mhn-modal {
    top: var(--modal-top-offset-mobile, 5%);
    width: min(100% - var(--spacing-lg, 1.5rem), var(--modal-max-width-mobile, 100%));
    border-radius: var(--radius-md, 12px);
  }
}

.mhn-session-countdown {
  font-variant-numeric: tabular-nums;
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--body-text-muted);
}

.mhn-session-countdown--warning {
  color: var(--mhn-warning-fg, #92400e);
  font-weight: var(--font-weight-semibold, 600);
}

.mhn-session-countdown--critical {
  color: var(--mhn-danger-fg, #991b1b);
  font-weight: var(--font-weight-bold, 700);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.mhn-profile,
.mhn-profile-group,
.mhn-logout-group {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm, 0.5rem);
}

.mhn-logo {
  max-height: 40px;
  display: block;
}

.mhn-breadcrumbs a {
  color: var(--breadcrumb-link-color, var(--mhn-accent, #741c73));
  text-decoration: none;
}

.mhn-breadcrumbs a:is(:hover, :focus-visible) {
  color: var(--breadcrumb-link-hover-color, var(--mhn-accent, #741c73));
  text-decoration: underline;
}

/* Additional utility classes */
.mhn-text-3xl {
  font-size: 3rem;
}

.mhn-opacity-30 {
  opacity: 0.3;
}

.mhn-cursor-pointer {
  cursor: pointer;
}

/* Shared help and validation cues. These reuse Card, Badge and Form settings;
 * they never set required/disabled state or decide whether a form is valid. */
.mhn-help-tip {
  position: relative;
  flex: 0 0 auto;
  cursor: help;
  overflow: visible;
}
/* Anchor field help to the whole label, keeping it inside narrow form columns. */
.mhn-label:has(> .mhn-help-tip) { position: relative; }
.mhn-label > .mhn-help-tip { position: static; }
.mhn-label > .mhn-help-tip::after { max-width: min(18rem, 100%); }
.mhn-help-tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 0;
  bottom: calc(100% + var(--spacing-xs, 0.25rem));
  z-index: 20;
  box-sizing: border-box;
  width: max-content;
  max-width: min(18rem, 70vw);
  padding: var(--card-compact-padding, var(--spacing-sm, 0.5rem));
  border: var(--card-border-width, 1px) solid var(--card-border-color, var(--mhn-border, #e2e8f0));
  border-radius: var(--card-radius, 12px);
  background: var(--card-background, var(--mhn-surface, #fff));
  color: var(--body-text-color, var(--mhn-fg, #0f172a));
  box-shadow: var(--card-shadow, var(--shadow-sm, 0 1px 2px rgba(0,0,0,.06)));
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: var(--font-weight-normal, 400);
  line-height: var(--line-height-base, 1.5);
  white-space: normal;
  overflow-wrap: anywhere;
  visibility: hidden;
  pointer-events: none;
}
.mhn-help-tip:is(:hover, :focus)::after { visibility: visible; }
.mhn-help-tip:focus-visible {
  outline: 2px solid var(--input-focus-ring-color, var(--mhn-focus, #8b5cf6));
  outline-offset: 2px;
}
.mhn-validation-target.is-invalid {
  outline: 2px solid var(--input-invalid-border-color, var(--mhn-danger, #dc2626));
  outline-offset: 2px;
}
.mhn-label--optional::after {
  content: attr(data-optional-label);
  display: inline-block;
  margin-inline-start: var(--spacing-xs, 0.25rem);
  padding: var(--badge-padding-y, 0.25rem) var(--badge-padding-x, 0.5rem);
  border-radius: var(--badge-radius, 999px);
  background: var(--badge-neutral-bg, #f3f4f6);
  color: var(--badge-neutral-fg, #374151);
  font-size: var(--badge-font-size, 0.75rem);
  font-weight: var(--badge-font-weight, 600);
  line-height: var(--badge-line-height, 1.2);
  letter-spacing: normal;
  text-transform: none;
}

/* Explicit composition utilities come after component margin/alignment resets.
 * Spacing reuses the editor's scale; alignment is caller-selected structure. */
.mhn-justify-start { justify-content: flex-start; }
.mhn-justify-center { justify-content: center; }
.mhn-mt-xs { margin-block-start: var(--spacing-xs, 0.25rem); }
.mhn-mt-sm { margin-block-start: var(--spacing-sm, 0.5rem); }
.mhn-mb-xs { margin-block-end: var(--spacing-xs, 0.25rem); }
.mhn-ms-sm { margin-inline-start: var(--spacing-sm, 0.5rem); }
