/* ========== Design system: palette, type, spacing ========== */
:root {
  /* Brand (overridden in head.ejs per tenant) */
  --brand-primary: #8E8DBB;
  --brand-primary-hover: #7271a0;
  /* Neutral palette – consistent contrast */
  --text-primary: #1a1d21;
  --text-secondary: #495057;
  --text-muted: #6c757d;
  --surface: #f5f6f8;
  --surface-raised: #ffffff;
  --surface-overlay: #fafbfc;
  --border-color: #dee2e6;
  --border-light: #e9ecef;
  /* Semantic (accessible contrast) */
  --color-success: #198754;
  --color-warning: #b8860b;
  --color-danger: #dc3545;
  --color-info: #0dcaf0;
  /* Application Portfolio Management (APM) accent — flags portfolio rationalization features across the app */
  --apm-accent: #0e7490;
  --apm-accent-soft: rgba(14, 116, 144, 0.12);
  /* IT Asset Management (ITAM) accent — flags physical asset / license / patch features, kept distinct from APM */
  --itam-accent: #6d28d9;
  --itam-accent-soft: rgba(109, 40, 217, 0.12);
  /* Typography scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.375rem;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  /* Layout */
  --spacing-page: var(--space-6);
  --spacing-section: var(--space-5);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.1);
  /* Sidebar (theme toggle) */
  --sidebar-bg: var(--surface-raised);
  --sidebar-text: #1f2936;
  --sidebar-text-muted: var(--text-muted);
  --sidebar-border: var(--border-color);
  --sidebar-hover-bg: #f3f4f6;
  --sidebar-accent: var(--brand-primary);
  --sidebar-accent-hover: var(--brand-primary-hover);
  /* Top navbar primary actions (shared: model filter selected/hover) */
  --nav-accent: #3b82f6;
  --nav-accent-hover: #2563eb;
  /* Left sidebar current page — same accent family as enterprise top bar */
  --sidebar-menu-active-bg: var(--nav-accent);
  --sidebar-menu-active-bg-hover: var(--nav-accent-hover);
  --sidebar-menu-active-fg: #ffffff;
  --sidebar-width: 270px;
  --sidebar-width-collapsed: 80px;
  --sidebar-width-min: 200px;
  --sidebar-width-max: 480px;
  /* Chart colors – light mode: dark text on light bg */
  --chart-label: #1a1d21;
  --chart-tick: #495057;
  --chart-grid: #dee2e6;
  /* Motion tokens (respect prefers-reduced-motion below) */
  --ux-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ux-duration: 0.22s;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--text-primary);
  background-color: var(--surface);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}

/* Ambient “command center” backdrop — subtle depth + brand wash; still boardroom-appropriate */
body:not(.dark-theme) {
  background-image:
    radial-gradient(ellipse 100% 85% at 100% 0%, var(--brand-faint, rgba(99, 102, 241, 0.07)) 0%, transparent 55%),
    radial-gradient(ellipse 80% 70% at 0% 100%, rgba(59, 130, 246, 0.055) 0%, transparent 50%),
    linear-gradient(175deg, #f7f8fb 0%, var(--surface) 42%, #e9ecf2 100%);
  background-attachment: fixed;
}

body.dark-theme {
  --apm-accent: #2dd4bf;
  --apm-accent-soft: rgba(45, 212, 191, 0.16);
  --itam-accent: #c4b5fd;
  --itam-accent-soft: rgba(196, 181, 253, 0.16);
  background-image:
    radial-gradient(ellipse 90% 80% at 100% 0%, color-mix(in srgb, var(--brand-primary, #6366f1) 14%, transparent) 0%, transparent 55%),
    radial-gradient(ellipse 70% 60% at 0% 100%, rgba(30, 58, 138, 0.28) 0%, transparent 50%),
    linear-gradient(180deg, #0f1419 0%, #111827 45%, #0c1017 100%);
  background-attachment: fixed;
}

@media (prefers-reduced-motion: reduce) {
  .card:hover {
    transform: none;
  }
  .btn-outline-secondary:active {
    transform: none;
  }
}

/* ---------- Page structure & hierarchy ---------- */
.app-content {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--surface-raised);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    var(--shadow-sm);
  border-radius: var(--radius-lg) 0 0 0;
  padding: var(--spacing-page);
  border-left: 1px solid rgba(255, 255, 255, 0.45);
  /* Compact content scale (nav + sidebar unchanged) */
  --text-xs: 0.625rem;
  --text-sm: 0.75rem;
  --text-base: 0.8125rem;
  --text-lg: 0.875rem;
  --text-xl: 0.96875rem;
  --text-2xl: 1.0625rem;
  --space-1: 0.15rem;
  --space-2: 0.35rem;
  --space-3: 0.5rem;
  --space-4: 0.65rem;
  --space-5: 0.8125rem;
  --space-6: 1rem;
  --space-8: 1.25rem;
  --spacing-page: 0.875rem;
  --spacing-section: 0.75rem;
  font-size: var(--text-base);
  line-height: 1.4;
}

main.app-content.container.py-4,
main.app-content.container.py-5,
.app-content.container-fluid.content-page-body,
.app-content.container-fluid.admin-settings-hub {
  padding-top: 0.875rem !important;
  padding-bottom: 1rem !important;
}

.app-content .row.g-4 {
  --bs-gutter-x: 0.75rem;
  --bs-gutter-y: 0.75rem;
}
.app-content .row.g-3 {
  --bs-gutter-x: 0.625rem;
  --bs-gutter-y: 0.625rem;
}
.app-content .row.g-2 {
  --bs-gutter-x: 0.4rem;
  --bs-gutter-y: 0.4rem;
}

.app-content .card-body {
  padding: var(--space-2) var(--space-3);
}
.app-content .card-header {
  padding: var(--space-2) var(--space-3);
}
.app-content .btn {
  font-size: var(--text-sm);
  padding: 0.3rem 0.65rem;
}
.app-content .btn-sm {
  padding: 0.15rem 0.45rem;
  font-size: 0.6875rem;
}
.app-content .badge {
  font-size: 0.65rem;
}
.app-content .table > :not(caption) > * > * {
  padding: 0.3rem 0.45rem;
}
.app-content .list-group-item {
  padding: 0.35rem 0.55rem;
  font-size: var(--text-sm);
}
.app-content .page-actions {
  margin-bottom: var(--space-3);
  gap: var(--space-2);
}
.app-content .mb-3 {
  margin-bottom: var(--space-3) !important;
}
.app-content .mb-4 {
  margin-bottom: var(--space-4) !important;
}

body.dark-theme .app-content {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), var(--shadow-sm);
  border-left-color: rgba(255, 255, 255, 0.06);
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  letter-spacing: -0.01em;
  line-height: var(--leading-tight);
}
.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
  line-height: var(--leading-relaxed);
}

.section-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-color);
}

/* Heading scale (use in content) */
.app-content h1, .app-content .h1 { font-size: var(--text-2xl); font-weight: var(--font-semibold); margin-bottom: var(--space-2); }
.app-content h2, .app-content .h2 { font-size: var(--text-xl); font-weight: var(--font-semibold); margin-bottom: var(--space-3); }
.app-content h3, .app-content .h3 { font-size: var(--text-lg); font-weight: var(--font-semibold); margin-bottom: var(--space-2); }
.app-content .text-muted { color: var(--text-muted) !important; }
.app-content .small { font-size: var(--text-sm); }

/* ---------- Cards – one system ---------- */
.card {
  border: 1px solid color-mix(in srgb, var(--border-color) 88%, var(--brand-primary, #8e8dbb) 12%);
  border-radius: calc(var(--radius-md) + 1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 2px 8px rgba(15, 23, 42, 0.04);
  background: var(--surface-raised);
  transition:
    box-shadow var(--ux-duration) var(--ux-ease-out),
    border-color var(--ux-duration) var(--ux-ease-out),
    transform var(--ux-duration) var(--ux-ease-out);
}
.card:hover {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 4px 14px rgba(15, 23, 42, 0.08),
    0 12px 28px color-mix(in srgb, var(--brand-primary, #8e8dbb) 9%, transparent);
  border-color: color-mix(in srgb, var(--border-color) 72%, var(--brand-primary, #8e8dbb) 28%);
}
@media (prefers-reduced-motion: no-preference) {
  .card:hover {
    transform: translateY(-2px);
  }
}
body.dark-theme .card {
  border-color: color-mix(in srgb, var(--border-color) 90%, var(--brand-primary, #6366f1) 10%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 10px rgba(0, 0, 0, 0.35);
}
body.dark-theme .card:hover {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 6px 20px rgba(0, 0, 0, 0.45),
    0 0 0 1px color-mix(in srgb, var(--brand-primary, #6366f1) 22%, transparent);
}
.card-header {
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.65) 0%, var(--surface-overlay) 100%);
  border-bottom: 1px solid var(--border-color);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
body.dark-theme .card-header {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, var(--surface-overlay) 100%);
}
.card-body {
  padding: var(--space-4);
}
.card-title {
  font-weight: var(--font-semibold);
  font-size: var(--text-base);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

/* Light mode only (body:not(.dark-theme)): card/report text dark on light – do not affect dark theme */
body:not(.dark-theme) .app-content,
body:not(.dark-theme) .card,
body:not(.dark-theme) .card-body {
  color: #1a1d21;
}
body:not(.dark-theme) .card .small,
body:not(.dark-theme) .card-body .small {
  color: #495057;
}
body:not(.dark-theme) .card .text-muted,
body:not(.dark-theme) .card-body .text-muted {
  color: #6c757d !important;
}
body:not(.dark-theme) .card-header {
  color: #1a1d21;
  background: var(--surface-overlay);
  border-bottom-color: var(--border-color);
}

/* ---------- Forms ---------- */
.form-label {
  font-weight: var(--font-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
  font-size: var(--text-sm);
}
.form-control:focus,
.form-select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-soft, rgba(142, 141, 187, 0.28));
}
.form-text {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

/* ---------- Object entry form (create-object "entering journey") ---------- */
/* Auto-growing textareas: JS sets height inline; this just removes the
   default resize handle jitter and caps runaway growth from pasted text. */
.object-entry-form textarea.form-control {
  overflow-y: hidden;
  max-height: 420px;
  transition: height var(--ux-duration) var(--ux-ease-out);
}
.object-entry-form textarea.form-control.is-capped {
  overflow-y: auto;
}
.object-entry-form .is-invalid ~ .invalid-feedback,
.object-entry-form .invalid-feedback.is-shown {
  display: block;
}
.object-entry-form .form-label.is-invalid-label {
  color: var(--color-danger);
}

/* Right-rail "before you save" checklist */
.field-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
}
.field-checklist__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.field-checklist__icon {
  flex: 0 0 auto;
  width: 1.1em;
  height: 1.1em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1.5px solid var(--border-color);
  color: transparent;
  font-size: 0.7em;
  transition: background-color var(--ux-duration) var(--ux-ease-out),
    border-color var(--ux-duration) var(--ux-ease-out);
}
.field-checklist__item.is-complete {
  color: var(--text-primary);
}
.field-checklist__item.is-complete .field-checklist__icon {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
}
.field-checklist__item.is-invalid {
  color: var(--color-danger);
}
.field-checklist__item.is-invalid .field-checklist__icon {
  border-color: var(--color-danger);
}
.field-checklist__progress {
  height: 6px;
  border-radius: 999px;
}

/* Compact dashboard stat-tile grid — APM/ITAM cards side by side in one row instead
   of each being a full-width row of 4 large cards. Stat-tile contract: label (small,
   muted, sentence case) + value (semibold, prominent) + optional hint/delta/sparkline. */
.dashboard-compact-card .card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.dashboard-compact-stat {
  display: block;
  height: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-md);
  color: inherit;
  text-decoration: none;
  transition: background-color var(--ux-duration) var(--ux-ease-out);
}
.dashboard-compact-stat:hover,
.dashboard-compact-stat:focus-visible {
  background-color: var(--surface);
  color: inherit;
  text-decoration: none;
}
.dashboard-compact-stat__label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-weight: var(--font-medium);
  margin-bottom: 0.3rem;
}
.dashboard-compact-stat__value {
  font-size: 1.4rem;
  font-weight: var(--font-semibold);
  line-height: 1.15;
}
.dashboard-compact-stat__hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 0.2rem;
}
.dashboard-compact-stat__delta {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  margin-left: 0.4rem;
}
.dashboard-compact-sparkline {
  height: 32px;
  margin-top: 0.3rem;
}
.dashboard-compact-stat .visiona-completeness {
  margin-top: 0.35rem;
}

/* Whole accordion-section header toggles the section (not just the small Show/Hide
   label) — a visible hover/focus state makes that click target obvious. */
.section-accordion-toggle {
  cursor: pointer;
  user-select: none;
  transition: background-color var(--ux-duration) var(--ux-ease-out);
}
.section-accordion-toggle:hover {
  background-color: var(--surface);
}
.section-accordion-toggle:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: -2px;
}

/* Per-accordion-section required-field badge (object create/edit forms) — lets a long
   list of collapsed sections be scanned for "what's still missing" without opening each. */
.section-required-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-light);
}
.section-required-badge.is-incomplete {
  color: var(--color-warning);
  border-color: color-mix(in srgb, var(--color-warning) 40%, var(--border-light));
  background: color-mix(in srgb, var(--color-warning) 8%, var(--surface));
}
.section-required-badge.is-complete {
  color: var(--color-success);
  border-color: color-mix(in srgb, var(--color-success) 35%, var(--border-light));
  background: color-mix(in srgb, var(--color-success) 8%, var(--surface));
}

/* Repository / object-list completeness indicator (grid cell) */
.visiona-completeness {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 5.5rem;
}
.visiona-completeness__track {
  flex: 1 1 auto;
  width: 3.25rem;
  height: 5px;
  border-radius: 999px;
  background: var(--border-light);
  overflow: hidden;
}
.visiona-completeness__fill {
  height: 100%;
  border-radius: 999px;
  background: var(--color-success);
}
.visiona-completeness--mid .visiona-completeness__fill {
  background: var(--color-warning);
}
.visiona-completeness--low .visiona-completeness__fill {
  background: var(--color-danger);
}
.visiona-completeness__pct {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

/* Searchable combobox — replaces a large relation SELECT/MULTISELECT's native control.
   The real <select> stays in the DOM (display:none) as the source of truth; see
   public/js/searchable-select.js. */
.visiona-combo { position: relative; }
.visiona-combo__native { display: none !important; }
.visiona-combo__control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  min-height: 2.35rem;
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--pl-pill-border, var(--border-color));
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  cursor: text;
  transition: border-color var(--ux-duration) var(--ux-ease-out), box-shadow var(--ux-duration) var(--ux-ease-out);
}
.visiona-combo__control:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-soft, rgba(142, 141, 187, 0.28));
}
.visiona-combo__control.is-invalid {
  border-color: var(--color-danger);
}
.visiona-combo__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.1rem 0.35rem;
  background: var(--surface-overlay);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  font-size: var(--text-xs);
  line-height: 1.4;
  max-width: 100%;
}
.visiona-combo__chip-remove {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  line-height: 1;
  padding: 0;
  font-size: 1rem;
  cursor: pointer;
}
.visiona-combo__chip-remove:hover {
  color: var(--color-danger);
}
.visiona-combo__input {
  flex: 1 1 60px;
  min-width: 60px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font-size: var(--text-sm);
  padding: 0.1rem 0.2rem;
}
.visiona-combo__menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface-raised);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 0.25rem 0;
}
.visiona-combo__option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  font-size: var(--text-sm);
  cursor: pointer;
}
.visiona-combo__option:hover,
.visiona-combo__option.is-active {
  background: var(--surface);
}
.visiona-combo__option.is-selected {
  font-weight: var(--font-medium);
}
.visiona-combo__option-check {
  width: 1rem;
  flex: 0 0 auto;
  color: var(--brand-primary);
  visibility: hidden;
}
.visiona-combo__option.is-selected .visiona-combo__option-check {
  visibility: visible;
}
.visiona-combo__empty {
  padding: 0.5rem 0.6rem;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ---------- Buttons – alignment & spacing ---------- */
.btn {
  font-weight: var(--font-medium);
  border-radius: var(--radius-sm);
  transition:
    background-color var(--ux-duration) var(--ux-ease-out),
    border-color var(--ux-duration) var(--ux-ease-out),
    color var(--ux-duration) var(--ux-ease-out),
    box-shadow var(--ux-duration) var(--ux-ease-out),
    transform var(--ux-duration) var(--ux-ease-out);
}
.btn-outline-secondary:hover {
  box-shadow: 0 2px 8px color-mix(in srgb, var(--brand-primary, #64748b) 12%, transparent);
}
.btn-outline-secondary:active {
  transform: translateY(1px);
}
body.dark-theme .btn-outline-secondary:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
}
/* Toolbar / action row: consistent gap and vertical align */
/* Page-level action row: same gap and bottom margin everywhere */
.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.app-content .container {
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}
.app-content .container.py-4 {
  padding-top: var(--space-5);
  padding-bottom: var(--space-5);
}

/* ---------- Tables – one source of truth ---------- */
.table {
  font-size: var(--text-sm);
  color: var(--text-primary);
}
.table thead th {
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  color: var(--text-primary);
  padding: var(--space-2) var(--space-3);
  border-bottom: 2px solid var(--border-color);
  background: var(--surface-overlay);
}
.table td {
  padding: var(--space-2) var(--space-3);
  vertical-align: middle;
  border-color: var(--border-light);
}
.table-hover tbody tr:hover td {
  background-color: color-mix(in srgb, var(--brand-primary, #3b82f6) 7%, var(--surface-raised)) !important;
}
body.dark-theme .table-hover tbody tr:hover td {
  background-color: color-mix(in srgb, var(--brand-primary, #6366f1) 12%, #1f2937) !important;
}
.table tbody tr:nth-child(even) td {
  background-color: var(--surface);
}
.table tbody tr:nth-child(odd) td {
  background-color: var(--surface-raised);
}

/* ---------- Alerts ---------- */
.alert {
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}
.alert-success { border-color: rgba(25, 135, 84, 0.3); }
.alert-danger { border-color: rgba(220, 53, 69, 0.3); }
.alert-info { border-color: rgba(13, 202, 240, 0.3); }
.alert-warning { border-color: rgba(255, 193, 7, 0.4); }

/* ---------- Badges ---------- */
.badge {
  font-weight: var(--font-medium);
  font-size: 0.75em;
  letter-spacing: 0.02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
body.dark-theme .badge {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ---------- Footer ---------- */
.app-footer {
  border-top: 1px solid var(--border-color);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ---------- List groups ---------- */
.list-group-item {
  padding: var(--space-3) var(--space-4);
  border-color: var(--border-light);
  transition: background-color 0.15s ease;
}
.list-group-item-action:hover {
  background-color: var(--surface);
}
.list-group-item-action:active {
  background-color: var(--surface-overlay);
}

/* ---------- Enterprise Navbar (3-zone: Brand | Search | Actions) ---------- */
.app-navbar {
  --nav-bg: #222437;
  --nav-text: #ffffff;
  --nav-text-muted: #d1d5db;
  --nav-hover: #2d2f45;
  --nav-search-bg: #1e1f2d;
  --nav-height: 48px;
  --scope-bar-height: 0px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.app-navbar.app-navbar-enterprise {
  position: sticky;
  top: 0;
  z-index: 1030;
  min-height: var(--nav-height);
  padding-left: 0;
  padding-right: 0;
  background: var(--nav-bg) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Subtle matte grain texture over navbar (same as swatch) */
.app-navbar.app-navbar-enterprise::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' result='n'/%3E%3CfeColorMatrix in='n' type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  background-repeat: repeat;
}
.app-navbar.app-navbar-enterprise .app-navbar__container {
  position: relative;
  z-index: 1;
}

.app-navbar__container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-left: 16px;
  padding-right: 12px;
  min-height: var(--nav-height);
}

/* LEFT: Brand + slogan + workspace */
.app-navbar__left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  min-width: 0;
}

.app-navbar__brand-col {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  min-width: 0;
  flex-shrink: 0;
}

.app-navbar.app-navbar--tenant-brand {
  --nav-height: 60px;
}

.app-navbar__logo {
  height: 42px;
  width: auto;
  max-width: min(200px, 38vw);
  display: block;
  object-fit: contain;
  object-position: left center;
  vertical-align: middle;
}

.app-navbar__logo.app-navbar__tenant-logo {
  height: auto;
  max-height: 54px;
  width: auto;
  max-width: min(400px, 58vw);
}

.app-navbar__slogan--guest {
  font-family: "Patrick Hand", "Segoe Script", cursive;
  font-size: 0.8rem;
  color: var(--nav-text-muted);
  margin-right: 0.5rem;
  white-space: nowrap;
}

.app-navbar__model-filter {
  display: flex;
  flex-shrink: 0;
  align-items: center;
}

.app-navbar__model-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.app-navbar__model-pill {
  display: inline-flex;
  align-items: center;
  margin: 0;
  cursor: pointer;
  user-select: none;
}

.app-navbar__model-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.app-navbar__model-pill > span {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  color: var(--nav-text-muted);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.2;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.app-navbar__model-pill:hover > span {
  color: var(--nav-text);
  border-color: rgba(255, 255, 255, 0.35);
}

.app-navbar__model-pill.is-active > span,
.app-navbar__model-pill:has(input:checked) > span {
  background: var(--brand-primary, #8e8dbb);
  border-color: var(--brand-primary, #8e8dbb);
  color: #fff;
}

.app-sidebar .sidebar-menu-count {
  margin-left: auto;
  flex-shrink: 0;
  min-width: 1.35rem;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  background: rgba(255, 255, 255, 0.1);
  color: var(--sidebar-text-muted);
}

.app-sidebar .nav-link.sidebar-menu-link.active .sidebar-menu-count {
  background: rgba(255, 255, 255, 0.22);
  color: var(--sidebar-menu-active-fg);
}

.app-sidebar.collapsed .sidebar-menu-count {
  display: none !important;
}

.app-navbar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--nav-text) !important;
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1;
}

.app-navbar__workspace-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.1rem;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  margin-left: 2px;
  align-self: center;
  min-width: 0;
  max-width: 11rem;
}
.app-navbar__workspace-name {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--nav-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.app-navbar__maturity-score {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.1;
  color: var(--nav-text-muted);
  text-decoration: none;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s ease;
}
.app-navbar__maturity-score i {
  font-size: 0.65rem;
  opacity: 0.85;
  flex-shrink: 0;
}
.app-navbar__maturity-score:hover {
  color: var(--nav-text);
  text-decoration: none;
}
.app-navbar__maturity-score--empty {
  opacity: 0.75;
  font-style: normal;
}
.app-navbar__maturity-score--empty:hover {
  color: #93c5fd;
}

/* CENTER: Search */
.app-navbar__center {
  flex: 1 1 auto;
  max-width: 420px;
  margin-left: 8px;
  margin-right: 8px;
  min-width: 0;
}

.app-navbar__search {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 160px;
  height: 28px;
  padding: 0 8px;
  background: #ffffff;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.app-navbar__search:focus-within {
  border-color: var(--nav-accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.app-navbar__search-icon {
  color: #6b7280;
  font-size: 0.875rem;
  margin-right: 8px;
  flex-shrink: 0;
}

.app-navbar__search-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: none;
  background: transparent !important;
  color: #1a1d21 !important;
  font-size: 0.8125rem;
  outline: none;
}

.app-navbar__search-input::placeholder {
  color: #6b7280;
  opacity: 1;
}

/* RIGHT: Actions + User — pushed right, inset from edge */
.app-navbar__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
  margin-right: 24px;
}

.app-navbar__divider {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.app-navbar__btn-new {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--nav-text);
  background: var(--nav-accent);
  border: none;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}

.app-navbar__btn-new:hover {
  background: var(--nav-accent-hover);
  color: var(--nav-text);
}

.app-navbar__btn-new::after {
  margin-left: 4px;
}

.app-navbar__actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.app-navbar__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--nav-text-muted);
  text-decoration: none;
  position: relative;
  transition: color 0.2s, background 0.2s;
  font-size: 0.9375rem;
}

.app-navbar__icon:hover {
  color: var(--nav-text);
  background: var(--nav-hover);
}

.app-navbar__icon--active {
  color: var(--nav-text) !important;
  background: var(--nav-hover);
}

.app-navbar__badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  font-size: 0.6rem;
  font-weight: 600;
  line-height: 14px;
  text-align: center;
  color: #fff;
  background: #ef4444;
  border-radius: 999px;
}

.app-navbar__env {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 5px;
  border-radius: 4px;
}

.app-navbar__env--prod {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.app-navbar__env--dev {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
}

.app-navbar__user {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px 3px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--nav-text);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.2s;
}

.app-navbar__user:hover {
  background: var(--nav-hover);
  color: var(--nav-text);
}

.app-navbar__avatar {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: var(--nav-hover);
  color: var(--nav-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.app-navbar__name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-navbar__chevron {
  font-size: 0.6875rem;
  color: var(--nav-text-muted);
  transition: transform 0.2s;
}

.app-navbar__user[aria-expanded="true"] .app-navbar__chevron {
  transform: rotate(180deg);
}

/* Dropdowns (navbar) */
.app-navbar__dropdown {
  margin-top: 8px;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.app-navbar__dropdown .dropdown-item {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.875rem;
}

.app-navbar__dropdown .dropdown-item:hover {
  background: var(--surface);
}

.app-navbar__user-dropdown .dropdown-header {
  padding: 12px;
}

.app-navbar__user-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.app-navbar__user-email {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Guest (login/signup) */
.app-navbar__right--guest {
  gap: 12px;
}

.app-navbar__btn-outline {
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--nav-text-muted);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.app-navbar__btn-outline:hover {
  color: var(--nav-text);
  border-color: rgba(255, 255, 255, 0.4);
  background: var(--nav-hover);
}

.app-navbar__btn-primary {
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  background: var(--nav-accent);
  border: none;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s;
}

.app-navbar__btn-primary:hover {
  background: var(--nav-accent-hover);
  color: #fff;
}

/* Toggler (mobile) */
.app-navbar__toggler {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--nav-text-muted);
  padding: 8px;
  border-radius: 8px;
}

.app-navbar__toggler:hover {
  background: var(--nav-hover);
  color: var(--nav-text);
  border-color: transparent;
}

.app-navbar__toggler .navbar-toggler-icon {
  filter: none;
  opacity: 0.9;
}

/* Collapse: on small screens center goes below */
.app-navbar__collapse {
  flex-basis: 100%;
}

@media (max-width: 991.98px) {
  .app-navbar__container {
    flex-wrap: wrap;
  }
  .app-navbar__center {
    order: 3;
    width: 100%;
    margin: 0 0 12px 0;
    max-width: none;
  }
  .app-navbar__search {
    min-width: 0;
  }
  .app-navbar__right {
    order: 2;
  }
}

/* Legacy / fallback (e.g. model-select if ever in nav) */
.app-navbar .navbar-brand,
.app-navbar .nav-link,
.app-navbar .navbar-text {
  color: var(--nav-text) !important;
}
.app-navbar .model-select {
  min-width: 200px;
  background: var(--nav-search-bg);
  color: var(--nav-text);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
}
.app-navbar .text-white-90 {
  color: var(--nav-text-muted) !important;
}

/* Handwritten-style slogan: readable script (Patrick Hand) */
.handwritten {
  font-family: "Patrick Hand", "Caveat", "Segoe Script", "Lucida Handwriting", cursive;
  letter-spacing: .02em;
  font-weight: 400;
  font-size: 1.05em;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.navbar-brand {
  letter-spacing: 0.2px;
}

/* App shell with left sidebar */
.app-shell {
  display: flex;
  min-height: calc(100vh - var(--nav-height) - var(--scope-bar-height));
}

/* Global scope bar — model scope + discovery */
body.has-scope-bar {
  --scope-bar-height: 38px;
}
.scope-bar {
  position: sticky;
  top: var(--nav-height);
  z-index: 1020;
  background: var(--surface-subtle, #f4f5f7);
  border-bottom: 1px solid var(--border-color, #e2e6ea);
  font-size: 0.8125rem;
  line-height: 1.2;
}
.scope-bar__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  min-height: var(--scope-bar-height, 38px);
  padding: 0.35rem 1rem;
}
.scope-bar__left,
.scope-bar__center,
.scope-bar__right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  min-width: 0;
}
.scope-bar__center {
  flex: 1 1 auto;
  justify-content: center;
}
.scope-bar__model-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.scope-bar__model-pill {
  display: inline-flex;
  align-items: center;
  margin: 0;
  cursor: pointer;
  user-select: none;
}
.scope-bar__model-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.scope-bar__model-pill > span {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border-color, #ced4da);
  background: #fff;
  color: var(--text-muted, #6c757d);
  font-size: 0.75rem;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.scope-bar__model-pill.is-active > span,
.scope-bar__model-pill:has(input:checked) > span {
  background: var(--brand-primary, #8e8dbb);
  border-color: var(--brand-primary, #8e8dbb);
  color: #fff;
}
.scope-bar__stat strong {
  font-variant-numeric: tabular-nums;
  color: var(--text-primary, #212529);
}
.scope-bar__sep {
  color: var(--text-muted, #adb5bd);
}
.scope-bar__scope-label {
  font-size: 0.75rem;
  max-width: 14rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scope-bar__nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}
.scope-bar__nav-link {
  border: 0;
  background: transparent;
  color: var(--text-secondary, #495057);
  text-decoration: none;
  font-size: 0.8125rem;
  padding: 0.2rem 0.45rem;
  border-radius: 0.35rem;
}
.scope-bar__nav-link:hover {
  color: var(--brand-primary, #8e8dbb);
  background: rgba(142, 141, 187, 0.08);
}
.scope-bar__nav-link.is-active {
  color: var(--brand-primary, #8e8dbb);
  font-weight: 600;
  background: rgba(142, 141, 187, 0.12);
}
.scope-bar__search-btn {
  cursor: pointer;
}
.scope-bar--saving {
  opacity: 0.72;
  pointer-events: none;
}
body.dark-theme .scope-bar {
  background: #1a2332;
  border-bottom-color: #374151;
}
body.dark-theme .scope-bar__model-pill > span {
  background: #243044;
  border-color: #3d4f66;
  color: #cbd5e1;
}
body.dark-theme .scope-bar__model-pill.is-active > span,
body.dark-theme .scope-bar__model-pill:has(input:checked) > span {
  background: var(--brand-primary, #8e8dbb);
  color: #fff;
}

/* Right rail: toggle + column of stacked accordions */
.app-right-rail {
  position: fixed;
  right: 12px;
  top: 96px;
  z-index: 1015;
  gap: 0.5rem;
  align-items: stretch; /* toggle strip matches full height of accordion column */
  max-height: calc(100vh - 108px);
  overflow-y: auto;
  overflow-x: hidden;
}
.app-right-rail__inner {
  width: 300px;
  flex: 0 0 auto;
  align-self: flex-start; /* column sizes to content; toggle stretches to this height */
  gap: 0.75rem;
  transition: width 0.22s ease, opacity 0.18s ease, margin 0.22s ease;
  overflow: hidden;
}
.app-right-rail--collapsed .app-right-rail__inner {
  width: 0;
  min-width: 0;
  opacity: 0;
  margin: 0;
  pointer-events: none;
}
.app-right-rail__toggle {
  flex: 0 0 auto;
  align-self: stretch;
  width: 30px;
  min-height: 5rem; /* minimum grab area when inner has no height */
  padding: 0.35rem 0.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: 8px 0 0 8px;
  background: var(--surface-raised);
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.app-right-rail__toggle:hover {
  background: var(--sidebar-hover-bg);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.app-right-rail__toggle:focus-visible {
  outline: 2px solid var(--nav-accent, #3b82f6);
  outline-offset: 2px;
}
body.dark-theme .app-right-rail__toggle {
  background: #1f2937;
  border-color: #374151;
  color: #cbd5e1;
}
body.dark-theme .app-right-rail__toggle:hover {
  background: #374151;
  color: #f1f5f9;
}
.app-right-rail__inner > .app-reference-accordion,
.app-right-rail__inner > .app-workspace-tools-accordion,
.app-right-rail__inner > .app-ai-usecases-accordion,
.app-right-rail__inner > .dashboard-pref-tab {
  position: static;
  width: 100%;
  flex: 0 0 auto;
}
.app-right-rail .accordion {
  width: 100%;
}
.app-right-rail .accordion-button {
  min-height: 44px;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  box-shadow: var(--shadow-sm);
  border-radius: 8px !important;
}
.app-right-rail .accordion-item {
  border-radius: 8px;
  overflow: hidden;
}
.app-reference-accordion .accordion-item,
.app-workspace-tools-accordion .accordion .accordion-item,
.app-ai-usecases-accordion .accordion-item {
  border-radius: 8px;
  overflow: hidden;
}
.reference-rail-link {
  display: flex;
  align-items: center;
  min-height: 40px;
  width: 100%;
  padding: 0.35rem 0.65rem;
  font-size: 0.8125rem;
  color: var(--sidebar-text);
}
.app-reference-accordion .accordion-body .reference-rail-link:hover,
.app-workspace-tools-accordion .accordion-body .reference-rail-link:hover,
.app-ai-usecases-accordion .accordion-body .reference-rail-link:hover {
  background: var(--sidebar-hover-bg);
}
.app-reference-accordion .accordion-body .reference-rail-link.active,
.app-workspace-tools-accordion .accordion-body .reference-rail-link.active,
.app-ai-usecases-accordion .accordion-body .reference-rail-link.active {
  background: var(--sidebar-accent);
  color: #fff !important;
}
body.dark-theme .app-right-rail .accordion-button {
  background: #1f2937;
  color: #f1f5f9;
}
body.dark-theme .app-reference-accordion .accordion-body,
body.dark-theme .app-workspace-tools-accordion .accordion-body,
body.dark-theme .app-ai-usecases-accordion .accordion-body {
  background: #111827;
}
body.dark-theme .reference-rail-link {
  color: #e2e8f0;
}
/* Workspace tools accordions when shown inside sidebar (< lg, right rail hidden) */
.app-sidebar .workspace-tools-sidebar-fallback .accordion-button {
  min-height: 44px;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  box-shadow: var(--shadow-sm);
  border-radius: 8px !important;
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text);
}
.app-sidebar .workspace-tools-sidebar-fallback .accordion-item {
  border-radius: 8px;
  overflow: hidden;
}
body.dark-theme .app-sidebar .workspace-tools-sidebar-fallback .accordion-button {
  background: #1f2937;
  color: #f1f5f9;
}
body.dark-theme .app-sidebar .workspace-tools-sidebar-fallback .accordion-body {
  background: #111827;
}
/* Large screens: sidebar + content only (right rail removed) */
@media (min-width: 992px) {
  .app-shell {
    align-items: flex-start;
  }
  .app-sidebar {
    order: 1;
    flex: 0 0 auto;
  }
  .app-content {
    order: 2;
    flex: 1 1 auto;
    min-width: 0;
    /* .app-shell uses align-items: flex-start at this breakpoint so the
       sidebar's own min-height can be independent of content length —
       without this, short pages (e.g. a form with one section) leave the
       content panel visibly shorter than the sidebar and expose raw page
       background beneath it. Matches .app-sidebar's own min-height calc
       below (var(--nav-height) isn't reachable here: it's scoped to
       .app-navbar, a sibling subtree, not inherited by .app-content). */
    min-height: calc(100vh - 64px);
  }
}

/* ---------- Sidebar (theme toggle + collapsible) ---------- */
body.dark-theme {
  --sidebar-bg: #1f2937;
  --sidebar-text: #f1f5f9;
  --sidebar-text-muted: #94a3b8;
  --sidebar-border: #374151;
  --sidebar-hover-bg: #374151;
  --sidebar-accent: var(--brand-primary, #6366f1);
  --sidebar-accent-hover: #818cf8;
  /* Chart colors – dark mode: light text on dark bg */
  --chart-label: #f1f5f9;
  --chart-tick: #cbd5e1;
  --chart-grid: #64748b;
}
body.dark-theme {
  background: #111827;
}
body.dark-theme .app-content,
body.dark-theme .table {
  background: #1f2937;
  color: #f1f5f9;
}
/* Dark theme only (body.dark-theme): light text on dark – do not affect light theme */
body.dark-theme .card {
  background: #374151 !important;
  color: #f1f5f9;
  border: 1px solid #4b5563 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
body.dark-theme .page-title {
  color: #f1f5f9 !important;
}
body.dark-theme .page-subtitle {
  color: #cbd5e1 !important;
}
body.dark-theme .card svg text {
  fill: #f1f5f9 !important;
}
body.dark-theme .card-header,
body.dark-theme .table th {
  background: #374151 !important;
  color: #f1f5f9;
  border-color: #374151;
}
body.dark-theme .table td,
body.dark-theme .table-hover tbody tr:hover td {
  background: #1f2937 !important;
  color: #f1f5f9;
  border-color: #374151;
}
body.dark-theme .text-muted {
  color: #cbd5e1 !important;
}
/* Dark theme: clear font colors – card and dashboard text */
body.dark-theme .card-title,
body.dark-theme .card-body .h5,
body.dark-theme .risk-card-title {
  color: #f1f5f9 !important;
}
body.dark-theme .risk-card-subtitle,
body.dark-theme .card-text {
  color: #cbd5e1 !important;
}
body.dark-theme .risk-card-ai-line {
  color: #a78bfa !important;
}
body.dark-theme .card .small,
body.dark-theme .card-body .small {
  color: #cbd5e1 !important;
}
/* Risk metric boxes: dark background (no big white in dark mode) */
body.dark-theme .risk-metric {
  background: #374151 !important;
  border-color: #4b5563 !important;
}
body.dark-theme .risk-metric-red .risk-metric-label {
  color: #f87171 !important;
}
body.dark-theme .risk-metric-amber .risk-metric-label {
  color: #fbbf24 !important;
}
/* Light badges in dark: dark surface, light text */
body.dark-theme .badge.text-bg-light,
body.dark-theme .badge.text-bg-light.text-dark {
  background: #374151 !important;
  color: #e2e8f0 !important;
  border-color: #4b5563 !important;
}
/* AI badge in dark: readable purple */
body.dark-theme .ai-badge {
  background: rgba(139, 92, 246, 0.25) !important;
  color: #c4b5fd !important;
  border-color: rgba(139, 92, 246, 0.4) !important;
}

/* Dark theme: remove big white gadgets – no bright white surfaces */
body.dark-theme .navbar-search .input-group-text.navbar-search-icon,
body.dark-theme .navbar-search .form-control.navbar-search-input {
  background: rgba(255,255,255,.1) !important;
  color: #f1f5f9 !important;
  border-color: rgba(255,255,255,.2) !important;
}
body.dark-theme .navbar-search .form-control::placeholder {
  color: rgba(255,255,255,.55);
}
body.dark-theme .form-control,
body.dark-theme .form-select {
  background: #374151 !important;
  color: #f1f5f9 !important;
  border-color: #4b5563 !important;
}
body.dark-theme .visiona-combo__control {
  background: #374151 !important;
  color: #f1f5f9 !important;
  border-color: #4b5563 !important;
}
body.dark-theme .visiona-combo__control:focus-within {
  background: #4b5563 !important;
  border-color: var(--sidebar-accent);
}
body.dark-theme .visiona-combo__input {
  color: #f1f5f9;
}
body.dark-theme .visiona-combo__input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}
body.dark-theme .visiona-combo__menu {
  background: #374151;
  border-color: #4b5563;
}
body.dark-theme .visiona-combo__option:hover,
body.dark-theme .visiona-combo__option.is-active {
  background: #4b5563;
}
body.dark-theme .visiona-combo__chip {
  background: #4b5563;
  border-color: #5b6472;
  color: #f1f5f9;
}
body.dark-theme .form-control:focus {
  background: #4b5563 !important;
  border-color: var(--sidebar-accent);
  color: #f1f5f9;
}
body.dark-theme .input-group-text {
  background: #374151 !important;
  color: #e2e8f0 !important;
  border-color: #4b5563 !important;
}
body.dark-theme .list-group-item {
  background: #1f2937 !important;
  color: #f1f5f9 !important;
  border-color: #374151 !important;
}
body.dark-theme .list-group-item:hover {
  background: #374151 !important;
}
body.dark-theme .modal-content {
  background: #1f2937 !important;
  border-color: #374151 !important;
  color: #f1f5f9;
}
body.dark-theme .dropdown-menu {
  background: #1f2937 !important;
  border-color: #374151 !important;
}
body.dark-theme .dropdown-item {
  color: #e2e8f0 !important;
}
body.dark-theme .dropdown-item:hover {
  background: #374151 !important;
  color: #fff !important;
}
body.dark-theme .bg-white {
  background: #1f2937 !important;
}
body.dark-theme .border,
body.dark-theme .border-top,
body.dark-theme .border-bottom {
  border-color: #374151 !important;
}
body.dark-theme .alert {
  color: #e2e8f0;
}
body.dark-theme .alert-light {
  background: #374151 !important;
  border-color: #4b5563 !important;
  color: #e2e8f0;
}

/* Dark theme: observations / linkage gaps panel – no light background */
body.dark-theme .linkage-gaps-panel {
  background: linear-gradient(135deg, #1f2937 0%, #374151 100%) !important;
  border-color: #374151 !important;
  color: #f1f5f9;
}
body.dark-theme .linkage-gaps-panel .observation-title {
  color: #f1f5f9;
}
body.dark-theme .linkage-gaps-panel .observation-subtitle {
  color: #cbd5e1;
}
body.dark-theme .linkage-gaps-col {
  background: #1f2937 !important;
  border-color: #374151 !important;
  box-shadow: none;
}
body.dark-theme .linkage-gaps-col .col-header {
  background: #374151 !important;
  border-color: #374151 !important;
  color: #f1f5f9;
}
body.dark-theme .linkage-gaps-col .col-header a {
  color: #e2e8f0;
}
body.dark-theme .linkage-gaps-col .col-header a:hover {
  color: var(--brand-primary);
}
body.dark-theme .linkage-gaps-col .col-body {
  color: #e2e8f0;
}
body.dark-theme .linkage-gaps-col .gap-item {
  color: #94a3b8;
  border-color: #374151 !important;
}
body.dark-theme .linkage-gaps-col .no-gaps {
  color: #94a3b8;
}

.app-sidebar {
  width: var(--sidebar-width, 270px);
  min-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  box-shadow: var(--shadow-sm);
  transition: width 0.4s ease;
  color: var(--sidebar-text);
}

.sidebar-tenant-brand {
  flex-shrink: 0;
  padding: 0.65rem 0.55rem 0.55rem;
  border-bottom: 1px solid var(--sidebar-border);
  background: var(--sidebar-bg);
}

.sidebar-tenant-brand__link {
  display: block;
  text-decoration: none;
  line-height: 0;
}

.sidebar-tenant-brand__logo {
  display: block;
  width: 100%;
  height: auto;
  max-height: 64px;
  object-fit: contain;
  object-position: center center;
}

.app-sidebar.collapsed .sidebar-tenant-brand {
  padding: 0.45rem 0.3rem 0.4rem;
}

.app-sidebar.collapsed .sidebar-tenant-brand__logo {
  max-height: 48px;
}
.app-sidebar.is-resizing {
  transition: none;
}
.app-sidebar.collapsed {
  width: var(--sidebar-width-collapsed, 80px);
}
.app-sidebar .sidebar-resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 30;
  touch-action: none;
  background: transparent;
  transition: background 0.15s ease;
}
.app-sidebar .sidebar-resize-handle::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2px;
  width: 2px;
  background: transparent;
  transition: background 0.15s ease;
}
.app-sidebar .sidebar-resize-handle:hover::after,
.app-sidebar .sidebar-resize-handle.is-dragging::after,
.app-sidebar .sidebar-resize-handle:focus-visible::after {
  background: var(--nav-accent, #3b82f6);
}
.app-sidebar.collapsed .sidebar-resize-handle {
  display: none;
}
body.sidebar-resize-active {
  cursor: col-resize !important;
  user-select: none !important;
}
.app-sidebar.collapsed .sidebar-collapse-hide {
  opacity: 0;
  max-width: 0;
  max-height: 0;
  overflow: hidden;
  padding: 0 !important;
  margin: 0 !important;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.2s ease, max-width 0.2s ease, max-height 0.2s ease;
}
.app-sidebar.collapsed .sidebar-collapse-hide.form-control,
.app-sidebar.collapsed .sidebar-collapse-hide.btn {
  display: none;
}
.app-sidebar .sidebar-fold-btn {
  position: absolute;
  top: 12px;
  right: -12px;
  z-index: 35;
  width: 24px;
  height: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--sidebar-border);
  border-radius: 999px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text-muted);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
  cursor: pointer;
  font-size: 0.7rem;
  line-height: 1;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.app-sidebar .sidebar-fold-btn:hover {
  background: var(--nav-accent, #3b82f6);
  border-color: var(--nav-accent, #3b82f6);
  color: #fff;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.35);
}
.app-sidebar .sidebar-fold-btn:focus-visible {
  outline: 2px solid var(--nav-accent, #3b82f6);
  outline-offset: 2px;
}
.app-sidebar .sidebar-fold-btn i {
  display: block;
  transition: transform 0.35s ease;
}
.app-sidebar.collapsed .sidebar-fold-btn i {
  transform: rotate(180deg);
}
body.dark-theme .app-sidebar .sidebar-fold-btn {
  background: #1f2937;
  border-color: #374151;
  color: #94a3b8;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
body.dark-theme .app-sidebar .sidebar-fold-btn:hover {
  background: var(--nav-accent, #3b82f6);
  border-color: var(--nav-accent, #3b82f6);
  color: #fff;
}
.app-sidebar .sidebar-content {
  flex: 1;
  padding: 12px 12px 14px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.app-sidebar .fw-semibold.text-uppercase.small.text-muted {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
  color: var(--sidebar-text-muted);
  transition: opacity 0.2s ease;
}
.app-sidebar .nav .nav-link.sidebar-menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 8px;
  padding: 12px 15px;
  color: var(--sidebar-text);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: 0.3s ease;
  white-space: nowrap;
}
.app-sidebar .nav .nav-link.sidebar-menu-link i {
  width: 1.25rem;
  flex-shrink: 0;
  text-align: center;
  font-size: 1.1rem;
}
.app-sidebar .nav .nav-link.sidebar-menu-link:hover {
  background: color-mix(in srgb, var(--nav-accent) 14%, var(--sidebar-hover-bg));
  color: var(--nav-accent);
}
.app-sidebar .nav .nav-link.sidebar-menu-link.active {
  background: var(--sidebar-menu-active-bg);
  color: var(--sidebar-menu-active-fg) !important;
  font-weight: 700;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.12),
    0 4px 14px color-mix(in srgb, var(--nav-accent) 32%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
body.dark-theme .app-sidebar .nav .nav-link.sidebar-menu-link.active {
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.app-sidebar .nav .nav-link.sidebar-menu-link.active:hover {
  background: var(--sidebar-menu-active-bg-hover);
  color: var(--sidebar-menu-active-fg) !important;
}
.app-sidebar .nav .nav-link.sidebar-menu-link.active i {
  color: inherit;
}

/* Model filter: row + pill switch (multi-select checkboxes) */
.app-sidebar .model-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 44px;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--sidebar-border);
  background: var(--sidebar-hover-bg);
  cursor: pointer;
  margin: 0;
}
.app-sidebar.collapsed .model-filter-row {
  justify-content: center;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}
.app-sidebar .model-filter-row__text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--sidebar-text);
  flex: 1;
  min-width: 0;
}
.app-sidebar .model-filter-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
  width: 46px;
  height: 26px;
}
.app-sidebar .model-filter-switch-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}
.app-sidebar .model-filter-switch-track {
  display: block;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #94a3b8;
  position: relative;
  transition: background 0.2s ease;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
  pointer-events: none;
}
.app-sidebar .model-filter-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
  pointer-events: none;
}
.app-sidebar .model-filter-switch-input:checked + .model-filter-switch-track {
  background: #34d399;
}
.app-sidebar .model-filter-switch-input:checked + .model-filter-switch-track .model-filter-switch-thumb {
  transform: translateX(20px);
}
.app-sidebar .model-filter-switch-input:focus-visible + .model-filter-switch-track {
  outline: 2px solid var(--nav-accent, #3b82f6);
  outline-offset: 2px;
}
body.dark-theme .app-sidebar .model-filter-row {
  background: #374151;
  border-color: #4b5563;
}
body.dark-theme .app-sidebar .model-filter-row__text {
  color: #f1f5f9;
}
body.dark-theme .app-sidebar .model-filter-switch-track {
  background: #64748b;
}
body.dark-theme .app-sidebar .model-filter-switch-input:checked + .model-filter-switch-track {
  background: #34d399;
}

.sidebar-group-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: 0.3s ease;
}
.sidebar-group-toggle:hover {
  background: var(--sidebar-border);
  color: var(--nav-accent);
}
.sidebar-group-toggle .sidebar-group-icon {
  flex-shrink: 0;
  width: 1.25rem;
  text-align: center;
  opacity: 0.9;
}
.sidebar-group-toggle .sidebar-collapse-hide {
  flex: 1;
  min-width: 0;
  text-align: left;
}
.app-sidebar.collapsed .sidebar-group-toggle {
  justify-content: center;
  min-width: 44px;
}
.app-sidebar.collapsed .sidebar-group-toggle .sidebar-group-chevron {
  transform: rotate(-90deg);
  margin-left: 0 !important;
}
.app-sidebar.collapsed .sidebar-group-toggle .sidebar-group-icon {
  margin-right: 0;
}
.app-sidebar.collapsed .sidebar-menu-link {
  justify-content: center;
  padding-left: 15px;
  padding-right: 15px;
}
.app-sidebar .sidebar-footer {
  padding: 16px 14px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.sidebar-footer-fixed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar-footer-btn {
  width: 100%;
  min-height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 15px;
  border: none;
  text-decoration: none;
  cursor: pointer;
  /* Match primary nav links: no fill until hover (was hover-bg always-on = looked “selected”) */
  background: transparent;
  color: var(--sidebar-text);
  font-size: 0.9rem;
  transition: background 0.3s ease, color 0.3s ease;
}
.sidebar-footer-btn:hover {
  background: color-mix(in srgb, var(--nav-accent) 12%, var(--sidebar-hover-bg));
  color: var(--nav-accent);
}
.sidebar-footer-btn:focus-visible {
  outline: 2px solid var(--nav-accent, #3b82f6);
  outline-offset: 2px;
}
.sidebar-footer-btn i {
  width: 1.25rem;
  flex-shrink: 0;
  text-align: center;
  font-size: 1.1rem;
}
.app-sidebar.collapsed .sidebar-footer-btn {
  justify-content: center;
  padding-left: 12px;
  padding-right: 12px;
}
.sidebar-theme-toggle {
  width: 100%;
  min-height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 15px;
  border: none;
  cursor: pointer;
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text);
  transition: 0.3s ease;
}
.sidebar-theme-toggle:hover {
  background: var(--sidebar-border);
}
.sidebar-theme-toggle .theme-toggle-track {
  height: 24px;
  width: 48px;
  border-radius: 999px;
  margin-left: auto;
  background: #c3d1ec;
  position: relative;
  flex-shrink: 0;
  transition: background 0.3s ease;
}
body.dark-theme .sidebar-theme-toggle .theme-toggle-track {
  background: var(--sidebar-accent);
}
.sidebar-theme-toggle .theme-toggle-indicator {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  transition: transform 0.3s ease;
}
body.dark-theme .sidebar-theme-toggle .theme-toggle-indicator {
  transform: translateX(24px);
}
.app-sidebar.collapsed .sidebar-theme-toggle .theme-toggle-text,
.app-sidebar.collapsed .sidebar-theme-toggle .theme-toggle-track {
  opacity: 0;
  width: 0;
  margin: 0;
  overflow: hidden;
  transition: opacity 0.2s ease, width 0.2s ease;
}

/* List hover (reinforce) */
.list-group-item:hover {
  background: var(--surface);
}

/* AI badge – used wherever AI features are shown */
.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #5c4d9e;
  background: linear-gradient(135deg, #e8e4f3 0%, #f0edf8 100%);
  border: 1px solid rgba(92, 77, 158, 0.35);
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.ai-badge i.bi-stars {
  font-size: 0.85em;
}
.ai-badge-text {
  line-height: 1;
}
.ai-badge-sm {
  padding: 1px 5px;
  font-size: 0.65rem;
}
.ai-badge-sm .ai-badge-text {
  font-size: 0.9em;
}
.ai-badge-sm i {
  font-size: 0.75em;
}

/* Application risk card */
.risk-card-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0 0 var(--space-1) 0;
}
.risk-card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0 0 var(--space-2) 0;
}

/* Dashboard — Cloud Adoption Percentage gadget */
.hosting-mix-title-icons {
  font-size: 1.15rem;
  line-height: 1;
}
.hosting-mix-bar-icon {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  margin-bottom: 0.15rem;
}

.risk-card-ai-line {
  font-size: var(--text-xs);
  color: #5c4d9e;
  margin: 0 0 var(--space-4) 0;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
/* minmax(0,1fr) + min-width:0 prevents grid blow-out overlapping text when cards are narrow (e.g. right rail open) */
.risk-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  width: 100%;
}
.risk-metric {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border-color);
}
/* Stack Red/Amber rows when the card body is very narrow */
.card-body:has(.risk-metrics) {
  container-type: inline-size;
  container-name: dash-risk-card;
}
@container dash-risk-card (max-width: 280px) {
  .risk-metrics {
    grid-template-columns: 1fr;
  }
}
.risk-metric-red .risk-metric-count { background: var(--color-danger); color: #fff; }
.risk-metric-amber .risk-metric-count { background: #ffc107; color: #000; }
.risk-metric-count {
  min-width: 1.75rem;
  flex-shrink: 0;
  padding: var(--space-1) var(--space-2);
  border-radius: 4px;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  text-align: center;
}
.risk-metric-label {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  min-width: 0;
  overflow-wrap: anywhere;
}
.risk-metric-red .risk-metric-label { color: var(--color-danger); }
.risk-metric-amber .risk-metric-label { color: var(--color-warning); }

/* Dashboard Content overview — hover popover only when domain has gaps */
.content-overview-card--has-empty {
  cursor: help;
}
.content-overview-empty-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.25em 0.5em;
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border: 1px solid #fecaca !important;
}
.popover.content-overview-empty-popover {
  border: 1px solid #f87171;
  box-shadow: 0 6px 20px rgba(185, 28, 28, 0.12);
  max-width: min(340px, 92vw);
}
.popover.content-overview-empty-popover .popover-body {
  background: #fef2f2;
  color: #450a0a;
  padding: 0.75rem 1rem;
}
.popover.content-overview-empty-popover .content-overview-popover-lead {
  color: #b91c1c;
}
body.dark-theme .popover.content-overview-empty-popover {
  border-color: #f87171;
}
body.dark-theme .popover.content-overview-empty-popover .popover-body {
  background: #451a1a;
  color: #fecaca;
}
body.dark-theme .popover.content-overview-empty-popover .content-overview-popover-lead {
  color: #fca5a5;
}
body.dark-theme .content-overview-empty-badge {
  background: rgba(248, 113, 113, 0.22) !important;
  color: #fecaca !important;
  border-color: rgba(248, 113, 113, 0.5) !important;
}

/* Linkage gaps / observations panel */
.linkage-gaps-panel {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-overlay) 100%);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--brand-primary);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  margin-top: var(--space-4);
}
.linkage-gaps-panel .observation-title {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}
.linkage-gaps-panel .observation-title i {
  color: var(--brand-primary);
  font-size: 1.1rem;
}
.linkage-gaps-panel .observation-subtitle {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}
.linkage-gaps-col {
  background: var(--surface-raised);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.linkage-gaps-col .col-header {
  padding: var(--space-2) var(--space-3);
  background: var(--surface-overlay);
  border-bottom: 1px solid var(--border-color);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-1);
}
.linkage-gaps-col .col-header a {
  color: var(--text-primary);
}
.linkage-gaps-col .col-header a:hover {
  color: var(--brand-primary);
}
.linkage-gaps-col .col-body {
  padding: var(--space-2) var(--space-3);
  min-height: 2.5rem;
}
.linkage-gaps-col .gap-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
}
.linkage-gaps-col .gap-item:last-child {
  border-bottom: none;
}
.linkage-gaps-col .gap-item i {
  color: #fd7e14;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.linkage-gaps-col .gap-item .gap-count {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: #fff;
  background: var(--text-muted);
  min-width: 1.5rem;
  padding: var(--space-1) var(--space-2);
  border-radius: 4px;
  text-align: center;
}
.linkage-gaps-col .no-gaps {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-style: italic;
  padding: var(--space-1) 0;
}

/* Object detail: timeline tab – list style (fallback) */
.object-timeline {
  position: relative;
  padding-left: 0.5rem;
}
.object-timeline .object-timeline-dot {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand-primary, #8E8DBB);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.1);
  margin-top: 0.25rem;
}
.object-timeline .d-flex {
  position: relative;
}
.object-timeline .d-flex::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 1.25rem;
  bottom: -0.75rem;
  width: 2px;
  background: #dee2e6;
}
.object-timeline .d-flex:last-child::before {
  display: none;
}

/* What-if report: tiered section headers (strategy → process) */
.whatif-impact-summary-heading {
  letter-spacing: 0.06em;
}
.whatif-detailed-report-title {
  font-size: var(--text-xl);
}
.whatif-report-block {
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  background: var(--surface-raised);
}
.whatif-report-block-header {
  padding: var(--space-3) var(--space-4);
  font-weight: var(--font-bold);
  font-size: var(--text-lg);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  color: #fff;
  border-bottom: 3px solid rgba(255, 255, 255, 0.25);
}
.whatif-report-block-header .whatif-report-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.whatif-report-block-header .whatif-report-title i {
  font-size: 1.15rem;
  opacity: 0.95;
}
.whatif-report-block-header .whatif-report-sub {
  font-weight: var(--font-medium);
  font-size: var(--text-xs);
  opacity: 0.92;
  width: 100%;
  margin-top: 0.15rem;
}
.whatif-tier-strategy {
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 55%, #3b82f6 100%);
}
.whatif-tier-objective {
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 55%, #14b8a6 100%);
}
.whatif-tier-kpi {
  background: linear-gradient(135deg, #9a3412 0%, #ea580c 55%, #f97316 100%);
}
.whatif-tier-service {
  background: linear-gradient(135deg, #3730a3 0%, #4f46e5 55%, #6366f1 100%);
}
.whatif-tier-data {
  background: linear-gradient(135deg, #581c87 0%, #7c3aed 55%, #a78bfa 100%);
}
.whatif-tier-process {
  background: linear-gradient(135deg, #14532d 0%, #16a34a 55%, #22c55e 100%);
}
.whatif-report-block .table {
  margin-bottom: 0;
}
.whatif-report-block .table thead th {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  border-bottom-width: 2px;
}

/* Model filter reload — keep page hidden until scroll is restored */
html.visiona-scroll-pending body {
  visibility: hidden;
}

/* Full-page loading splash (see partials/page_splash_loader.ejs) */
body.page-splash-pending {
  overflow: hidden;
}
.page-splash-loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.38s ease, visibility 0.38s ease;
}
.page-splash-loader--hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.page-splash-loader__bg {
  position: absolute;
  inset: 0;
  background-color: #0f172a;
  background-image: url('/brand/splash-bg.png?v=1');
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
}
.page-splash-loader__veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(15, 23, 42, 0.35) 0%,
    rgba(15, 23, 42, 0.55) 100%
  );
  pointer-events: none;
}
.page-splash-loader__content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem;
}
.page-splash-loader__logo {
  max-width: 220px;
  width: min(60vw, 220px);
  height: auto;
  display: block;
  margin: 0 auto;
}

.page-splash-loader__logo--tenant {
  max-width: min(360px, 82vw);
  max-height: 96px;
}
.page-splash-loader__spinner {
  width: 2.75rem;
  height: 2.75rem;
  border-width: 0.22rem;
}

/* Impact graph — card / node-link layout (optional view=cards) */
.impact-cards-root {
  position: relative;
  min-height: 420px;
  max-height: 78vh;
  background: var(--surface-overlay);
  border-radius: 0.375rem;
}
.impact-cards-edges {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.impact-cards-edges path.impact-edge-hit {
  pointer-events: stroke;
  stroke: transparent;
  stroke-width: 12;
}
.impact-card-node {
  position: absolute;
  z-index: 1;
  transform: translate(-50%, -50%);
  max-width: min(280px, 92vw);
}
.impact-card-node a.impact-card {
  display: flex;
  align-items: stretch;
  min-height: 3.5rem;
  box-sizing: border-box;
  border-radius: 0.375rem;
  background: var(--surface-raised);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.impact-card-node a.impact-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.impact-card-node--focus a.impact-card {
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.25);
}
.impact-card__swatch {
  width: 0.35rem;
  min-width: 0.35rem;
  border-radius: 0.25rem 0 0 0.25rem;
  background: var(--border-color);
}
.impact-card__body {
  min-width: 0;
  padding: 0.5rem 0.65rem;
}
.impact-card__title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  line-height: var(--leading-tight);
}
.impact-card__type {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.impact-card__chev {
  align-self: flex-end;
  padding: 0 0.4rem 0.35rem 0;
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1;
}

/* Impact — type quiz (4-option cards) */
.impact-type-quiz-mount {
  min-height: 4rem;
}
.impact-type-quiz__row {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}
.impact-type-quiz-card {
  border-color: color-mix(in srgb, var(--border-color) 85%, var(--brand-primary, #8e8dbb) 10%) !important;
  box-shadow: var(--shadow-sm);
}
.impact-type-quiz__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
@media (max-width: 576px) {
  .impact-type-quiz__grid {
    grid-template-columns: 1fr;
  }
}
.impact-type-quiz__opt {
  font-size: 0.78rem;
  line-height: 1.3;
  padding: 0.5rem 0.55rem;
  white-space: normal;
  hyphens: auto;
  word-break: break-word;
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.impact-type-quiz__opt:disabled {
  cursor: default;
  opacity: 1;
}
body.dark-theme .impact-type-quiz-card {
  border-color: var(--sidebar-border) !important;
}

.section-count-badge {
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 1.5rem;
  line-height: 1.2;
}
.nav-tabs .nav-link .section-count-badge {
  font-size: 0.65rem;
  vertical-align: middle;
}

/* Metamodel insights — per-type heatmap (green = used, gray = empty) */
.metamodel-type-legend {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.metamodel-type-heatmap {
  display: grid;
  grid-template-columns: repeat(var(--mm-heatmap-cols, 8), minmax(0, 1fr));
  gap: 2px;
  width: 100%;
  margin: 0.2rem 0 0.1rem;
  min-height: 10px;
}
.metamodel-heatmap-cell {
  display: block;
  width: 100%;
  min-width: 6px;
  height: 10px;
  border-radius: 2px;
  background: #cbd5e1;
  border: 1px solid rgba(15, 23, 42, 0.06);
  cursor: default;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.metamodel-heatmap-cell:hover {
  transform: scaleY(1.15);
  z-index: 1;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15);
}
.metamodel-type-legend .metamodel-heatmap-cell {
  width: 10px;
  height: 10px;
  min-width: 10px;
}

.metamodel-heatmap-cell--used {
  background: linear-gradient(
    180deg,
    rgba(74, 222, 128, calc(0.2 + var(--mm-fill, 1) * 0.75)) 0%,
    rgba(22, 163, 74, calc(0.35 + var(--mm-fill, 1) * 0.55)) 100%
  );
  border-color: rgba(22, 101, 52, calc(0.12 + var(--mm-fill, 1) * 0.35));
}

/* Full-page metamodel heat map — dense tiles */
.metamodel-heatmap-page {
  max-width: none;
}
.metamodel-heatmap-page .page-title {
  font-size: 1.15rem;
}
.metamodel-heatmap-page .page-subtitle {
  font-size: 0.75rem;
}
.metamodel-heatmap-page .alert {
  padding: 0.4rem 0.65rem;
  margin-bottom: 0.65rem !important;
  font-size: 0.75rem;
}
.metamodel-heatmap-summary .card-body {
  min-height: 0;
}
.metamodel-heatmap-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  font-size: 0.68rem;
  margin-bottom: 0.65rem !important;
}
.metamodel-heatmap-legend__sample {
  display: inline-block;
  width: 1.1rem;
  height: 0.65rem;
  border-radius: 2px;
  margin-right: 0.25rem;
  vertical-align: middle;
  border: 1px solid rgba(15, 23, 42, 0.08);
}
.metamodel-heatmap-legend__sample--empty {
  background: #e2e8f0;
}
.metamodel-heatmap-legend__sample--low {
  background: linear-gradient(180deg, rgba(74, 222, 128, 0.35), rgba(22, 163, 74, 0.45));
}
.metamodel-heatmap-legend__sample--high {
  background: linear-gradient(180deg, #4ade80, #15803d);
}
.metamodel-heatmap-domain {
  padding-bottom: 0.35rem;
  margin-bottom: 0.65rem !important;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}
.metamodel-heatmap-domain:last-child {
  border-bottom: 0;
  margin-bottom: 0 !important;
}
.metamodel-heatmap-domain .h6 {
  font-size: 0.8rem;
}
.metamodel-heatmap-domain .small {
  font-size: 0.68rem !important;
}
.metamodel-heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr));
  gap: 0.2rem;
}
.metamodel-heatmap-tile {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  min-height: 0;
  padding: 0.15rem 0.3rem;
  border-radius: 0.25rem;
  background: #e2e8f0;
  border: 1px solid rgba(15, 23, 42, 0.08);
  transition: box-shadow 0.1s ease;
}
.metamodel-heatmap-tile--used {
  background: linear-gradient(
    145deg,
    rgba(134, 239, 172, calc(0.25 + var(--mm-fill, 1) * 0.55)) 0%,
    rgba(34, 197, 94, calc(0.35 + var(--mm-fill, 1) * 0.5)) 50%,
    rgba(21, 128, 61, calc(0.4 + var(--mm-fill, 1) * 0.45)) 100%
  );
  border-color: rgba(22, 101, 52, calc(0.15 + var(--mm-fill, 1) * 0.4));
}
.metamodel-heatmap-tile:hover {
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}
.metamodel-heatmap-tile__name {
  font-size: 0.58rem;
  font-weight: 600;
  line-height: 1.15;
  color: #0f172a;
  word-break: break-word;
  flex: 1 1 auto;
  min-width: 0;
}
.metamodel-heatmap-tile__count {
  font-size: 0.55rem;
  font-weight: 700;
  line-height: 1;
  color: rgba(15, 23, 42, 0.55);
  flex-shrink: 0;
  min-width: 1.1rem;
  text-align: right;
}
.metamodel-heatmap-tile--used .metamodel-heatmap-tile__count {
  color: rgba(20, 83, 45, 0.9);
}

/* Metamodel settings — type browser */
.metamodel-settings-page {
  max-width: 1600px;
}
.metamodel-type-browser__list {
  max-height: min(70vh, 640px);
  overflow-y: auto;
}
.metamodel-type-domain__title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary, #6c757d);
  background: var(--surface-overlay, #f8f9fa);
  border-bottom: 1px solid var(--border-color, #dee2e6);
}
.metamodel-type-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--border-color, #eee);
  font-size: 0.8125rem;
}
.metamodel-type-item:hover {
  background: rgba(142, 141, 187, 0.08);
}
.metamodel-type-item--active {
  background: rgba(142, 141, 187, 0.15);
  border-left: 3px solid var(--brand-primary, #8e8dbb);
  padding-left: calc(0.75rem - 3px);
  font-weight: 600;
}
.metamodel-type-item--off {
  opacity: 0.65;
}
.metamodel-type-item__icon-wrap {
  flex-shrink: 0;
}
.metamodel-type-item__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.metamodel-type-item__badges {
  flex-shrink: 0;
}
.metamodel-type-item__badges .badge {
  min-width: 1.5rem;
  text-align: center;
}
.metamodel-detail-tabs .nav-link {
  font-size: 0.875rem;
}

/* Metamodel overview (readable alternative to full graph) */
.metamodel-diagram-page .metamodel-diagram-type-list {
  max-height: min(52vh, 520px);
  overflow-y: auto;
}
.metamodel-diagram-type-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem;
  border-radius: 0.375rem;
  color: inherit;
  background: var(--bs-light, #f8f9fa);
  border: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 0.8125rem;
  transition: background 0.15s ease;
}
.metamodel-diagram-type-chip:hover {
  background: #e9ecef;
}
.metamodel-diagram-type-chip__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.metamodel-diagram-type-chip__badge {
  font-size: 0.65rem;
}
.metamodel-focus-canvas-wrap {
  min-height: 380px;
  position: relative;
  overflow: auto;
  background: #f8f9fa;
}
.metamodel-focus-canvas-wrap--tall {
  min-height: 640px;
  max-height: min(78vh, 820px);
}
.metamodel-focus-svg {
  display: block;
  width: 100%;
  min-height: 360px;
}
.metamodel-focus-svg--tall {
  min-height: 620px;
}
.mm-focus-zoom-toolbar {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.mm-focus-zoom-toolbar .mm-focus-zoom-level {
  min-width: 3.25rem;
  pointer-events: none;
}
.mm-edge-label-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2px 4px;
  width: 100%;
  height: 100%;
  padding: 1px 3px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #dee2e6;
  border-radius: 3px;
  line-height: 1.15;
}
.mm-edge-label-list--in {
  border-style: dashed;
  border-color: #ced4da;
}
.mm-edge-label-chip {
  display: inline-block;
  white-space: nowrap;
  font-size: 9px;
  font-weight: 500;
  color: #212529;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 2px;
  padding: 1px 4px;
}
.mm-focus-edge-legend {
  margin-top: 0.5rem;
  padding: 0.4rem 0.55rem;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  max-height: 200px;
  overflow-y: auto;
}
.mm-focus-edge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.4rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid #f1f3f5;
  font-size: 0.7rem;
  line-height: 1.3;
}
.mm-focus-edge-row:last-child {
  border-bottom: 0;
}
.mm-focus-edge-dir {
  flex: 0 0 auto;
  min-width: 1.75rem;
  font-size: 0.58rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #495057;
}
.mm-focus-edge-row--out .mm-focus-edge-dir { color: #0d6efd; }
.mm-focus-edge-row--in .mm-focus-edge-dir { color: #6c757d; }
.mm-focus-edge-neighbor {
  flex: 0 0 auto;
  font-weight: 600;
  color: #212529;
}
.mm-focus-edge-arrow {
  flex: 0 0 auto;
  color: #868e96;
}
.mm-focus-edge-labels {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.3rem;
  flex: 1 1 auto;
  min-width: 0;
}
.mm-focus-hint {
  font-size: 0.7rem;
}
.metamodel-focus-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.metamodel-focus-legend-line {
  display: inline-block;
  width: 1.25rem;
  height: 0;
  border-top: 2px solid #adb5bd;
  vertical-align: middle;
  margin-right: 0.25rem;
}
.relations-view-tabs .nav-link {
  font-size: 0.875rem;
}
.mm-relations-catalog--preview .btn,
.mm-relations-catalog--preview a.btn,
.mm-relations-catalog--preview .mm-focus-zoom-toolbar,
.mm-relations-catalog--preview form[action*="/toggle"] {
  display: none !important;
}
.mm-relations-catalog--preview a.mm-cat-type-link {
  pointer-events: none;
  color: inherit;
  text-decoration: none;
  cursor: default;
}
.mm-relations-frame {
  border: 1px solid var(--border-color, #dee2e6);
  border-radius: 0.5rem;
  background: #fff;
  overflow: hidden;
}
.mm-relations-frame__toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-color, #e9ecef);
  background: var(--surface-subtle, #f8f9fa);
}
.mm-relations-frame__filters {
  padding: 0.85rem 1rem 1rem;
}
.mm-relations-frame__filters--compact {
  padding: 0.5rem 0.75rem;
}
.mm-relations-frame__filters--compact .mm-relations-filter-label {
  margin-bottom: 0.2rem;
  font-size: 0.65rem;
}
.mm-relations-count-badge {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.35rem 0.55rem;
}
.mm-relations-filter-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-primary, #212529);
  margin-bottom: 0.35rem;
}
.mm-relations-frame .form-select,
.mm-relations-frame .form-control {
  width: 100%;
  max-width: 100%;
}
.metamodel-relations-page .page-subtitle--sm {
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--text-muted, #6c757d);
}
.mm-relations-frame__toolbar--solo {
  border-bottom: 0;
}
.mm-relations-type-section + .mm-relations-type-section {
  padding-top: 1rem;
  border-top: 1px solid var(--border-color, #e9ecef);
}
.metamodel-relations-page .card-body {
  padding: 1rem 1.25rem 1.25rem;
}
@media (min-width: 992px) {
  .mm-relations-frame__filters .row > [class*="col-"] {
    min-width: 0;
  }
}

/* Admin settings hub */
.admin-settings-hub {
  max-width: 1400px;
}
.admin-settings-content {
  width: 100%;
}
.admin-settings-content--relations {
  max-width: none;
}
.admin-settings-content--maturity-weights {
  max-width: none;
}
.admin-settings-hub:has(.admin-settings-content--maturity-weights) {
  max-width: none;
}
.sidebar-settings-menu {
  padding: 0 0.35rem 0.5rem;
}
.sidebar-nav-groups {
  padding: 0 0 0.5rem;
  flex: 1;
  min-height: 0;
}
/* Category wrapper — visually solidifies the EA / Application Portfolio / IT Asset groupings by
   tying their pinned header + collapsible sub-sections together under one accent-colored rail. */
.sidebar-nav-category {
  border-left: 3px solid color-mix(in srgb, var(--cat-accent, var(--nav-accent)) 45%, transparent);
  margin-left: 0.5rem;
  padding-left: 0.35rem;
}
.sidebar-nav-category--ea {
  --cat-accent: var(--nav-accent);
}
.sidebar-nav-category--portfolio {
  --cat-accent: var(--apm-accent);
}
.sidebar-nav-category--itam {
  --cat-accent: var(--itam-accent);
}
.app-sidebar.collapsed .sidebar-nav-category {
  border-left: none;
  margin-left: 0;
  padding-left: 0;
}
.sidebar-nav-top {
  margin-bottom: 0.35rem !important;
}
.sidebar-nav-section + .sidebar-nav-section {
  margin-top: 0.15rem;
}
.sidebar-nav-section--pinned {
  margin-bottom: 0.15rem;
}
.sidebar-section-label {
  padding: 0.35rem 0.5rem 0.25rem 0.65rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--sidebar-text-muted);
  opacity: 0.85;
}
.sidebar-nav-divider {
  height: 1px;
  margin: 0.5rem 0.65rem 0.35rem;
  background: var(--sidebar-border);
  opacity: 0.65;
}
.sidebar-nav-groups .sidebar-section-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.55rem 0.5rem 0.5rem;
  margin: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-text);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-nav-groups .sidebar-section-head:hover {
  background: color-mix(in srgb, var(--nav-accent) 10%, var(--sidebar-hover-bg));
  color: var(--nav-accent);
}
.sidebar-nav-groups .sidebar-section-head[aria-expanded="true"] {
  color: var(--nav-accent);
}
.sidebar-nav-groups .sidebar-section-head[aria-expanded="true"] .sidebar-section-icon {
  color: var(--nav-accent);
}
.sidebar-nav-groups .sidebar-section-icon {
  flex-shrink: 0;
  width: 1.15rem;
  text-align: center;
  font-size: 0.95rem;
  color: var(--sidebar-text-muted);
}
.sidebar-nav-groups .sidebar-section-title {
  flex: 1;
  min-width: 0;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-nav-groups .sidebar-section-chevron {
  flex-shrink: 0;
  font-size: 0.7rem;
  opacity: 0.55;
  transition: transform 0.2s ease, opacity 0.15s ease;
}
.sidebar-nav-groups .sidebar-section-head[aria-expanded="true"] .sidebar-section-chevron {
  transform: rotate(180deg);
  opacity: 0.85;
}
.sidebar-nav-groups .sidebar-section-panel {
  padding: 0.1rem 0 0.2rem;
}
/* Top-level category accordion header (Enterprise Architecture / Application Portfolio / IT Asset) —
   bolder and accent-colored so it reads as the primary foldable entry point for its category. Placed
   after the generic .sidebar-nav-groups .sidebar-section-head rules above so these accent overrides win. */
.sidebar-nav-category .sidebar-nav-section--top > .sidebar-section-head {
  font-size: 0.875rem;
  font-weight: 700;
}
.sidebar-nav-category .sidebar-section-head:hover,
.sidebar-nav-category .sidebar-section-head[aria-expanded="true"],
.sidebar-nav-category .sidebar-section-head[aria-expanded="true"] .sidebar-section-icon {
  color: var(--cat-accent, var(--nav-accent));
}
.sidebar-nav-category .sidebar-section-head:hover {
  background: color-mix(in srgb, var(--cat-accent, var(--nav-accent)) 10%, var(--sidebar-hover-bg));
}
.sidebar-nav-category .sidebar-nav-links {
  border-left-color: color-mix(in srgb, var(--sidebar-border) 85%, var(--cat-accent, var(--nav-accent)));
}
.sidebar-nav-links {
  padding: 0.1rem 0 0.25rem 0.25rem;
  margin: 0 0.35rem 0 0.85rem;
  border-left: 2px solid color-mix(in srgb, var(--sidebar-border) 85%, var(--nav-accent));
}
.sidebar-nav-links--flat {
  margin-left: 0;
  padding-left: 0;
  border-left: none;
}
.sidebar-nav-groups .sidebar-settings-menu {
  padding-left: 0.15rem;
  margin-left: 0.85rem;
  border-left: 2px solid color-mix(in srgb, var(--sidebar-border) 85%, var(--nav-accent));
}
.sidebar-nav-sublink-row {
  margin: -0.15rem 0 0.1rem;
  padding-left: 2.15rem;
}
.sidebar-nav-sublink {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--sidebar-text-muted);
  text-decoration: none;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}
.sidebar-nav-sublink:hover {
  color: var(--nav-accent);
}
.sidebar-nav-sublink--apm:not(.active) {
  color: var(--apm-accent);
}
.sidebar-nav-sublink.active {
  color: var(--nav-accent);
  font-weight: 600;
}
.app-sidebar .sidebar-menu-link--top {
  font-weight: 600;
}
.app-sidebar.collapsed .sidebar-nav-groups .sidebar-section-head {
  justify-content: center;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
}
.app-sidebar.collapsed .sidebar-nav-links {
  margin-left: 0;
  border-left: none;
  padding-left: 0;
}
.sidebar-nav-section--admin .sidebar-settings-menu .sidebar-group-toggle {
  background: transparent;
  text-transform: none;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0;
  padding: 0.4rem 0.5rem;
  color: var(--sidebar-text-muted);
}
.sidebar-nav-section--admin .sidebar-settings-menu .sidebar-group-toggle:hover {
  background: color-mix(in srgb, var(--nav-accent) 8%, var(--sidebar-hover-bg));
  color: var(--nav-accent);
}
.sidebar-nav-section--admin .sidebar-settings-links {
  padding-left: 0.35rem;
}
.sidebar-settings-group + .sidebar-settings-group {
  margin-top: 0.35rem;
}
.sidebar-settings-links {
  padding: 0.15rem 0 0.35rem 0.35rem;
}
.sidebar-menu-link--sub {
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.5rem 0.65rem !important;
  gap: 0.55rem;
}
.sidebar-menu-link--sub i {
  font-size: 0.9rem;
}

/* Application Portfolio Management (APM) accent — used across sidebar, page headers, and reports
   to flag application/technology portfolio rationalization features (matrix views, roadmap, what-if,
   AI APM, cost/TCO). Kept separate from per-type diagram colors so shape legibility is unaffected. */
.sidebar-menu-link--apm:not(.active) i {
  color: var(--apm-accent);
}
.sidebar-menu-link--apm::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--apm-accent);
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0.85;
}
.sidebar-menu-link--apm.active::after {
  background: #fff;
}
.app-sidebar.collapsed .sidebar-menu-link--apm::after {
  display: none;
}
.badge-apm {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  color: var(--apm-accent);
  background: var(--apm-accent-soft);
  border: 1px solid color-mix(in srgb, var(--apm-accent) 35%, transparent);
  white-space: nowrap;
}
.badge-apm::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--apm-accent);
  flex-shrink: 0;
}
.apm-accent-icon {
  color: var(--apm-accent) !important;
}

/* IT Asset Management (ITAM) accent — same treatment as APM above, distinct color, for physical asset /
   license compliance / patch status features (kept separate so it isn't confused with APM). */
.sidebar-menu-link--itam:not(.active) i {
  color: var(--itam-accent);
}
.sidebar-menu-link--itam::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--itam-accent);
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0.85;
}
.sidebar-menu-link--itam.active::after {
  background: #fff;
}
.app-sidebar.collapsed .sidebar-menu-link--itam::after {
  display: none;
}
.badge-itam {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  color: var(--itam-accent);
  background: var(--itam-accent-soft);
  border: 1px solid color-mix(in srgb, var(--itam-accent) 35%, transparent);
  white-space: nowrap;
}
.badge-itam::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--itam-accent);
  flex-shrink: 0;
}
.itam-accent-icon {
  color: var(--itam-accent) !important;
}
.admin-settings-nav__list {
  max-height: min(72vh, 680px);
  overflow-y: auto;
  padding: 0.25rem 0 0.5rem;
}
.admin-settings-accordion {
  --bs-accordion-border-width: 0;
  --bs-accordion-border-radius: 0;
  --bs-accordion-inner-border-radius: 0;
  --bs-accordion-btn-padding-x: 1rem;
  --bs-accordion-btn-padding-y: 0.55rem;
  --bs-accordion-body-padding-x: 0;
  --bs-accordion-body-padding-y: 0;
  --bs-accordion-active-color: var(--text-secondary, #6c757d);
  --bs-accordion-active-bg: transparent;
  --bs-accordion-btn-focus-box-shadow: none;
}
.admin-settings-nav__group {
  border: 0;
  background: transparent;
}
.admin-settings-nav__group-header {
  margin: 0;
}
.admin-settings-nav__group-toggle {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary, #6c757d);
  background: transparent;
  box-shadow: none;
  padding-top: 0.65rem;
  padding-bottom: 0.35rem;
}
.admin-settings-nav__group-toggle:not(.collapsed) {
  color: var(--text-secondary, #6c757d);
  background: transparent;
}
.admin-settings-nav__group-toggle::after {
  width: 0.65rem;
  height: 0.65rem;
  background-size: 0.65rem;
  opacity: 0.65;
}
.admin-settings-nav__group-toggle:hover {
  background: rgba(142, 141, 187, 0.06);
}
.admin-settings-nav__group-title {
  flex: 1;
  text-align: left;
  font-size: inherit;
  font-weight: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  color: inherit;
  padding: 0;
}
.admin-settings-nav__group-body {
  padding: 0;
}
.admin-settings-nav__item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  text-decoration: none;
  color: inherit;
  font-size: 0.875rem;
  border-left: 3px solid transparent;
}
.admin-settings-nav__item:hover {
  background: rgba(142, 141, 187, 0.08);
  color: inherit;
}
.admin-settings-nav__item--active {
  background: rgba(142, 141, 187, 0.14);
  border-left-color: var(--brand-primary, #8e8dbb);
  font-weight: 600;
}
.admin-settings-nav__item i {
  width: 1.25rem;
  text-align: center;
  opacity: 0.85;
}
.admin-settings-panel__body {
  min-height: 280px;
}
.admin-settings-tile {
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.admin-settings-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.35rem 0.85rem rgba(0, 0, 0, 0.08);
  border-color: var(--brand-primary, #8e8dbb) !important;
}
.admin-settings-tile__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  background: rgba(142, 141, 187, 0.12);
  color: var(--brand-primary, #8e8dbb);
  flex-shrink: 0;
}
.admin-settings-link-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-color, #dee2e6);
  border-radius: var(--radius-md, 8px);
  text-decoration: none;
  color: inherit;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.admin-settings-link-card:hover {
  background: rgba(142, 141, 187, 0.06);
  border-color: var(--brand-primary, #8e8dbb);
  color: inherit;
}
.admin-settings-link-card > i:first-child {
  font-size: 1.25rem;
  color: var(--brand-primary, #8e8dbb);
}
.admin-settings-overview-group__title {
  letter-spacing: 0.06em;
  font-size: 0.7rem;
}
.admin-settings-op-group__title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary, #6c757d);
  margin-bottom: 0.65rem;
}
.admin-settings-relations-table {
  max-height: min(62vh, 560px);
  overflow-y: auto;
}
.admin-settings-panel__body--relations {
  min-height: 360px;
}

/* Solid shape-type icon badges (colored tile + white glyph) */
.shape-type-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 5px;
  background: var(--shape-type-color, var(--brand-primary, #8e8dbb));
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.shape-type-icon-badge--sm {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 4px;
}
.shape-type-icon-badge--lg {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
}
.shape-type-icon-badge i {
  font-size: 0.9rem;
  line-height: 1;
}
.shape-type-icon-badge--lg i {
  font-size: 1.15rem;
}
.metamodel-type-item__icon-wrap {
  flex-shrink: 0;
}
.content-type-icon .shape-type-icon-badge {
  vertical-align: middle;
}

/* Content / object list — fixed top toolbar */
.content-objects-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.35rem 0.75rem;
  margin-bottom: 0.75rem;
  background: var(--surface-card, #fff);
  border: 1px solid var(--border-color, #dee2e6);
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  position: sticky;
  top: 0;
  z-index: 20;
}
.content-objects-toolbar__left,
.content-objects-toolbar__right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
}
.content-objects-toolbar__btn {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary, #212529);
  text-decoration: none;
  padding: 0.35rem 0.5rem;
  white-space: nowrap;
}
.content-objects-toolbar__btn:hover:not(:disabled):not(.disabled) {
  color: var(--brand-primary, #8e8dbb);
}
.content-objects-toolbar__btn:disabled,
.content-objects-toolbar__btn.disabled {
  opacity: 0.45;
  pointer-events: none;
}
.content-objects-toolbar__sep {
  color: var(--border-color, #ced4da);
  user-select: none;
  padding: 0 0.15rem;
}
.content-objects-toolbar__search {
  position: relative;
  min-width: 10rem;
  width: min(220px, 40vw);
}
.content-objects-toolbar__search-icon {
  position: absolute;
  left: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary, #6c757d);
  font-size: 0.85rem;
  pointer-events: none;
}
.content-objects-toolbar__search .form-control {
  padding-left: 2rem;
}
.content-objects-toolbar__add-menu {
  max-height: min(70vh, 420px);
  overflow-y: auto;
}
.content-domain-card .list-group-item--type-only {
  gap: 0.5rem;
}

/* Repository — full-width type table */
.content-page-body {
  max-width: none;
}
.content-repository-summary {
  font-size: 0.875rem;
}
.visiona-grid--content-types {
  width: 100%;
  margin-bottom: 0;
}
.visiona-grid--content-types .visiona-grid__table-wrap {
  max-height: min(78vh, 1400px);
  width: 100%;
}
.visiona-grid--content-types .visiona-grid-table {
  width: 100%;
  table-layout: auto;
}
.content-types-col-name {
  min-width: 22rem;
  width: 22rem;
  max-width: 28rem;
  white-space: nowrap;
}
.visiona-grid-icon-text--nowrap {
  flex-wrap: nowrap;
  max-width: 100%;
}
.visiona-grid-icon-text--nowrap .visiona-grid-link,
.visiona-grid-icon-text--nowrap .fw-medium {
  overflow: hidden;
  text-overflow: ellipsis;
}
.visiona-grid--content-types .visiona-grid-table__head th[data-content-sort] {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.visiona-grid--content-types .visiona-grid-table__head th[data-content-sort]:hover {
  color: var(--brand-primary, #8e8dbb);
}
.visiona-grid--content-types .visiona-grid-description {
  display: block;
  line-height: 1.45;
  white-space: normal;
  word-break: break-word;
  color: var(--text-muted, #6c757d) !important;
}
.content-types-col-desc {
  min-width: 0;
}
.content-domain-filter {
  margin-bottom: 0.85rem;
}
.repository-type-tags {
  line-height: 1;
}
.repository-type-tag {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.repository-type-tag__label {
  font-weight: 500;
  opacity: 0.9;
}
.visiona-grid-icon-text .repository-type-tags {
  margin-left: 0.15rem;
}
/* Repository — object-type importance indicator (Content page). A sequential scale (one hue,
   light -> dark) rather than a status color: this ranks architectural centrality, it isn't a
   good/bad signal, so it deliberately avoids red/amber risk semantics. */
.repository-importance {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.repository-importance__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.repository-importance--critical {
  color: color-mix(in srgb, var(--brand-primary, #8e8dbb) 70%, black 30%);
}
.repository-importance--critical .repository-importance__dot {
  background: color-mix(in srgb, var(--brand-primary, #8e8dbb) 70%, black 30%);
}
.repository-importance--high {
  color: var(--brand-primary, #8e8dbb);
}
.repository-importance--high .repository-importance__dot {
  background: var(--brand-primary, #8e8dbb);
}
.repository-importance--medium {
  color: var(--text-muted, #6c757d);
}
.repository-importance--medium .repository-importance__dot {
  background: color-mix(in srgb, var(--brand-primary, #8e8dbb) 55%, transparent 45%);
}
.repository-importance--low {
  color: var(--text-muted, #6c757d);
  opacity: 0.6;
}
.repository-importance--low .repository-importance__dot {
  background: transparent;
  border: 1px solid var(--border-color, #ced4da);
}
.visiona-grid-table td.text-center .repository-type-tags {
  justify-content: center;
}
.content-domain-filter__pills {
  align-items: center;
}

/* Visiona unified data grid (repository-style tables) */
.visiona-grid {
  margin-bottom: 1rem;
}
.visiona-grid-toolbar__btn,
.visiona-grid-toolbar__btn.content-objects-toolbar__btn {
  min-width: 2rem;
  padding: 0.35rem 0.45rem;
  line-height: 1;
}
.visiona-grid-toolbar__btn i {
  font-size: 1.05rem;
}
.visiona-grid__table-wrap {
  border: 1px solid var(--border-color, #dee2e6);
  border-radius: var(--radius-md, 8px);
  background: var(--surface-card, #fff);
  max-height: min(72vh, 900px);
  overflow: auto;
}
.visiona-grid-table {
  margin-bottom: 0;
  font-size: 0.875rem;
}
.visiona-grid-table__head th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted, #6c757d);
  border-bottom-width: 1px;
  white-space: nowrap;
  vertical-align: middle;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}
.visiona-grid-table__body td {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
  border-color: var(--border-color, #eef0f2);
  vertical-align: middle;
}
.visiona-grid-table__row:hover {
  background: rgba(142, 141, 187, 0.04);
}
.visiona-grid-table__check {
  width: 2.25rem;
  padding-left: 0.65rem !important;
  padding-right: 0.25rem !important;
}
.visiona-grid-table__check .form-check-input {
  margin: 0;
  cursor: pointer;
}
.visiona-grid-link {
  color: var(--text-primary, #212529);
  text-decoration: none;
}
.visiona-grid-link:hover {
  color: var(--brand-primary, #8e8dbb);
  text-decoration: underline;
}
.visiona-grid-protected {
  font-size: 0.85rem;
  opacity: 0.55;
}
.visiona-grid-number {
  font-variant-numeric: tabular-nums;
}
.visiona-grid-table.visiona-grid-table--legacy {
  /* applied when wrapping existing tables */
}
table.table.visiona-grid-table:not(.visiona-grid-table--no-style) thead th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted, #6c757d);
}
body.dark-theme .visiona-grid__table-wrap {
  background: #1f2937;
  border-color: #374151;
}

/* Compact tabular pages — less header chrome, more grid height */
.app-content:has(.visiona-grid),
.app-content.visiona-table-page,
.admin-settings-hub:has(.mm-relations-catalog) {
  padding-top: 0.65rem !important;
  padding-bottom: 0.75rem !important;
}
.app-content:has(.visiona-grid) .page-title,
.app-content.visiona-table-page .page-title,
.page-title--compact {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.1rem;
  line-height: 1.25;
}
.app-content:has(.visiona-grid) .page-subtitle,
.app-content.visiona-table-page .page-subtitle,
.page-subtitle--compact {
  font-size: 0.75rem;
  margin-bottom: 0.35rem;
  line-height: 1.35;
  color: var(--text-muted, #6c757d);
}
.visiona-page-header--compact {
  margin-bottom: 0.35rem !important;
}
.visiona-page-header--compact .page-subtitle--compact {
  margin-top: 0.1rem;
}
.app-content:has(.visiona-grid) .visiona-grid,
.app-content.visiona-table-page .visiona-grid {
  margin-bottom: 0.35rem;
}
.app-content:has(.visiona-grid) .visiona-grid__table-wrap,
.app-content.visiona-table-page .visiona-grid__table-wrap,
.mm-relations-catalog .visiona-grid__table-wrap {
  max-height: min(78vh, 980px);
}
.visiona-grid-toolbar--compact {
  padding: 0.15rem 0.4rem;
  margin-bottom: 0.25rem;
  gap: 0.25rem 0.5rem;
  box-shadow: none;
}
.visiona-grid-toolbar--compact .visiona-grid-toolbar__btn,
.visiona-grid-toolbar--compact .content-objects-toolbar__btn {
  min-width: 1.75rem;
  padding: 0.2rem 0.35rem;
}
.visiona-grid-toolbar--compact .visiona-grid-toolbar__btn i {
  font-size: 0.95rem;
}
.visiona-grid-toolbar--compact .content-objects-toolbar__search {
  min-width: 8rem;
  width: min(180px, 36vw);
}
.app-content:has(.visiona-grid) .alert,
.app-content.visiona-table-page .alert {
  margin-bottom: 0.5rem;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}
.app-content:has(.visiona-grid) .card > .card-body,
.app-content.visiona-table-page .card > .card-body {
  padding: 0.65rem 0.85rem;
}
.mm-relations-catalog .card-body.p-3 {
  padding: 0.65rem !important;
}

/* Object workspace — unified detail shell */
.object-workspace-page {
  max-width: 1200px;
}
.object-workspace-tabs .nav-link {
  font-size: 0.875rem;
  padding: 0.35rem 0.75rem;
}
.object-workspace-tabs .section-count-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
}
.breadcrumb-sm {
  font-size: 0.75rem;
}
.object-workspace-impact-frame {
  width: 100%;
  height: min(72vh, 720px);
  border: 0;
  display: block;
}
.object-workspace-overview-dl dt {
  font-weight: 500;
}
.object-workspace-impact-card .card-header {
  background: var(--surface-subtle, #f8f9fa);
}

.object-relations-section .card-header {
  padding-bottom: 0;
}
.object-relations-grid .visiona-grid-table__head th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #6c757d);
  font-weight: 600;
  white-space: nowrap;
}
.object-relations-grid .visiona-grid-table__row--navigable {
  cursor: pointer;
}
.object-relations-grid .visiona-grid-table__row--navigable:hover {
  background: color-mix(in srgb, var(--brand-primary, #8e8dbb) 7%, transparent);
}
.object-relations-grid .visiona-grid-icon-text .visiona-grid-link {
  font-weight: 600;
}
.object-relations-add-card .card-body {
  padding-top: 0.35rem;
}
body.dark-theme .visiona-grid-table__row:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* Content object list — cleaner repository-style rows */
.visiona-grid--instances .visiona-grid-table__row--navigable {
  cursor: pointer;
}
.visiona-grid--instances .visiona-grid-table__row--navigable:hover {
  background: rgba(142, 141, 187, 0.06);
}
.visiona-grid-hint {
  margin-top: -0.15rem;
  line-height: 1.35;
}
.visiona-grid-actions--compact {
  gap: 0;
  opacity: 0.35;
  transition: opacity 0.15s ease;
}
.visiona-grid-table__row:hover .visiona-grid-actions--compact,
.visiona-grid-table__row:focus-within .visiona-grid-actions--compact {
  opacity: 1;
}
.visiona-grid-icon-btn {
  min-width: 1.75rem;
  padding: 0.15rem 0.35rem;
  line-height: 1;
  color: var(--text-muted, #6c757d);
  text-decoration: none;
}
.visiona-grid-icon-btn:hover {
  color: var(--brand-primary, #8e8dbb);
}
.visiona-grid-icon-btn.text-danger:hover {
  color: var(--bs-danger, #dc3545) !important;
}
.visiona-grid-table__actions-col {
  width: 2.5rem;
  padding-right: 0.35rem !important;
}
.visiona-grid--instances .visiona-grid-link {
  font-weight: 500;
}
.visiona-grid--instances td.text-end .visiona-grid-link {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* EA Maturity — horizontal module bars */
.maturity-modules-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.maturity-module-row {
  display: block;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border-color, #e9ecef);
  border-radius: 0.5rem;
  text-decoration: none;
  color: inherit;
  background: #fff;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.maturity-module-row:hover {
  background: rgba(142, 141, 187, 0.05);
  border-color: rgba(142, 141, 187, 0.35);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  color: inherit;
}
.maturity-module-row__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}
.maturity-module-row__name {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  flex: 1;
  min-width: 0;
}
.maturity-module-row__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.maturity-module-row__level {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #6c757d);
  background: #f1f3f5;
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
}
.maturity-module-row__pct {
  font-size: 0.8125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary, #212529);
  min-width: 2.75rem;
  text-align: right;
}
.maturity-module-row__track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: #e9ecef;
  overflow: hidden;
}
.maturity-module-row__track--lg {
  height: 14px;
}
.maturity-module-row__fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  border-radius: 999px;
  min-width: 0;
  max-width: 100%;
  transition: width 0.35s ease;
  display: block;
}
.maturity-module-row__fill--pending {
  width: 0;
  background: transparent;
}
.maturity-module-row__fill--l1 { background: linear-gradient(90deg, #e03131, #c92a2a); }
.maturity-module-row__fill--l2 { background: linear-gradient(90deg, #f76707, #e8590c); }
.maturity-module-row__fill--l3 { background: linear-gradient(90deg, #fab005, #f59f00); }
.maturity-module-row__fill--l4 { background: linear-gradient(90deg, #339af0, #228be6); }
.maturity-module-row__fill--l5 { background: linear-gradient(90deg, #40c057, #2f9e44); }
.maturity-legend-swatch {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 2px;
  margin-right: 0.2rem;
  vertical-align: middle;
}
.maturity-legend-swatch--l1 { background: #e03131; }
.maturity-legend-swatch--l2 { background: #f76707; }
.maturity-legend-swatch--l3 { background: #fab005; }
.maturity-legend-swatch--l4 { background: #339af0; }
.maturity-legend-swatch--l5 { background: #40c057; }
.maturity-bar-legend span {
  white-space: nowrap;
}

/* Dashboard — data completeness gauges always one row */
.dashboard-completeness-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
}
.dashboard-completeness-gauge {
  flex: 1 1 0;
  min-width: 0;
}
.dashboard-completeness-gauge__label {
  font-size: clamp(0.7rem, 1.1vw, 0.875rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dashboard-completeness-gauge__svg {
  width: min(100px, 100%);
  height: auto;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* Dashboard — metamodel maturity beside data completeness */
.dashboard-metamodel-gauge__svg {
  width: 72px;
  height: auto;
  display: block;
}
.dashboard-metrics-row .dashboard-metamodel-card {
  width: max-content;
  max-width: 100%;
}
.dashboard-metamodel-card__body {
  padding: 0.65rem 0.85rem !important;
}
.dashboard-metamodel-compact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  text-align: center;
}
.dashboard-metamodel-card__hint {
  line-height: 1.35;
  max-width: 13rem;
  margin-left: auto;
  margin-right: auto;
}
.dashboard-metamodel-compact__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem 0.75rem;
}
.dashboard-metamodel-compact__gauge {
  flex: 0 0 auto;
  line-height: 0;
}
.dashboard-maturity-radar-wrap {
  position: relative;
  width: 100%;
  min-height: 300px;
  margin: 0 auto;
  overflow: visible;
}
.dashboard-maturity-radar-wrap canvas {
  display: block;
  width: 100% !important;
  height: 300px !important;
}
.dashboard-maturity-radar-card .card-body {
  overflow: visible;
}
.dashboard-maturity-radar-wrap--sm {
  min-height: 220px;
}
.dashboard-maturity-radar-wrap--sm canvas {
  height: 220px !important;
}
.dashboard-maturity-model-card .card-body {
  overflow: visible;
}
.dashboard-metamodel-compact__meta {
  flex: 0 1 auto;
  min-width: 0;
}
.dashboard-metamodel-compact__link {
  flex: 0 0 auto;
  white-space: nowrap;
}
.dashboard-metamodel-calculated-at {
  font-size: 0.62rem !important;
}

/* Metamodel maturity — consistent journey nav */
.metamodel-maturity-nav {
  width: 100%;
}
.metamodel-maturity-nav__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.metamodel-maturity-nav__item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.metamodel-maturity-nav__sep {
  color: #94a3b8;
  font-size: 0.65rem;
  line-height: 1;
}
.metamodel-maturity-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
  padding: 0.2rem 0.45rem;
  border-radius: 0.35rem;
  white-space: nowrap;
}
.metamodel-maturity-nav__link:hover {
  color: #0f172a;
  background: rgba(148, 163, 184, 0.15);
}
.metamodel-maturity-nav__item--active .metamodel-maturity-nav__link {
  color: #0f172a;
  background: rgba(142, 141, 187, 0.18);
  font-weight: 600;
}
.metamodel-maturity-nav--compact {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid #e2e8f0;
}
.metamodel-maturity-nav--compact .metamodel-maturity-nav__list {
  flex-wrap: nowrap;
  justify-content: center;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}
.metamodel-maturity-nav--compact .metamodel-maturity-nav__link {
  font-size: 0.68rem;
  padding: 0.15rem 0.35rem;
}

/* Admin — metamodel maturity weights (5 domain columns) */
.mm-weight-columns {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
  align-items: stretch;
}
.mm-weight-col__head {
  text-align: center;
  border-bottom: 1px solid #e2e8f0;
}
.mm-weight-col__body {
  max-height: min(72vh, 42rem);
  overflow-y: auto;
}
.mm-weight-type-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.mm-weight-type-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}
.mm-weight-type-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.mm-weight-type-row__label {
  line-height: 1.2;
  word-break: break-word;
  margin: 0;
}
.mm-weight-type-row__input .form-control {
  font-size: 0.78rem;
  padding: 0.2rem 0.35rem;
}
.mm-weight-col--invalid .card-header {
  background: rgba(254, 226, 226, 0.35) !important;
}
.mm-weight-col--valid .card-header {
  background: rgba(220, 252, 231, 0.35) !important;
}
@media (max-width: 1399.98px) {
  .mm-weight-columns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 991.98px) {
  .mm-weight-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 575.98px) {
  .mm-weight-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 991.98px) {
  .dashboard-metrics-row .dashboard-metamodel-card {
    width: 100%;
  }
  .dashboard-metamodel-compact {
    justify-content: center;
  }
}

.dashboard-metrics-row .card-body {
  padding-bottom: 0.85rem;
}

/* Optional sidebar: Suggested actions (enabled via account menu) */
.sidebar-optional-item--suggested-actions {
  display: none;
}
html.visiona-menu-suggested-actions .sidebar-optional-item--suggested-actions {
  display: list-item;
}
#toggleSuggestedActionsMenuBtn .menu-pref-check {
  opacity: 0;
}
#toggleSuggestedActionsMenuBtn.active .menu-pref-check {
  opacity: 1;
}

.suggested-next-steps__spark {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
  flex-shrink: 0;
}
.suggested-step-card {
  height: 100%;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  text-decoration: none;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #fff;
  padding: 0.75rem;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.suggested-step-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  text-decoration: none;
}
.suggested-step-card__icon {
  width: 2rem;
  height: 2rem;
  border-radius: 0.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.suggested-step-card__content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  gap: 0.15rem;
}
.suggested-step-card__title {
  color: #0f172a;
  font-weight: 600;
  line-height: 1.25;
}
.suggested-step-card__hint {
  font-size: 0.78rem;
  line-height: 1.3;
}
.suggested-step-card__cta {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 0.1rem;
}
.suggested-step-card--primary {
  border-color: rgba(37, 99, 235, 0.35);
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.45), #fff 55%);
}
.suggested-step-card--primary .suggested-step-card__icon {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}
.suggested-step-card--primary:hover { border-color: #2563eb; }
.suggested-step-card--warning {
  border-color: rgba(245, 158, 11, 0.4);
  background: linear-gradient(180deg, rgba(255, 247, 237, 0.65), #fff 55%);
}
.suggested-step-card--warning .suggested-step-card__icon {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
}
.suggested-step-card--warning:hover { border-color: #d97706; }
.suggested-step-card--danger {
  border-color: rgba(239, 68, 68, 0.35);
  background: linear-gradient(180deg, rgba(254, 242, 242, 0.7), #fff 55%);
}
.suggested-step-card--danger .suggested-step-card__icon {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}
.suggested-step-card--danger:hover { border-color: #dc2626; }
body.dark-theme .suggested-step-card {
  background: var(--bs-body-bg, #1e293b);
  border-color: rgba(148, 163, 184, 0.25);
}
body.dark-theme .suggested-step-card__title {
  color: var(--bs-body-color, #f1f5f9);
}

/* Roadmap & target state overview */
.roadmap-overview-page {
  max-width: 1400px;
}
.roadmap-swatch {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 0.2rem;
  margin-right: 0.35rem;
  vertical-align: -0.1rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
}
.roadmap-swatch--done {
  background: #bbf7d0;
}
.roadmap-swatch--pending {
  background: #e2e8f0;
}
.roadmap-rule-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 0.75rem 0.85rem;
}
.roadmap-row--done {
  background: rgba(187, 247, 208, 0.22);
}
.roadmap-row--pending {
  background: rgba(248, 250, 252, 0.9);
}
.roadmap-status-table tbody tr.roadmap-row--done:hover {
  background: rgba(187, 247, 208, 0.35);
}
.roadmap-status-table tbody tr.roadmap-row--pending:hover {
  background: #f1f5f9;
}
.roadmap-status-badge--done {
  background: #dcfce7 !important;
  color: #166534 !important;
  border: 1px solid rgba(22, 101, 52, 0.2);
}
.roadmap-status-badge--pending {
  background: #f1f5f9 !important;
  color: #64748b !important;
  border: 1px solid #e2e8f0;
}
.roadmap-initiative-list .list-group-item {
  border-left: 0;
  border-right: 0;
}
.roadmap-timeline-bar-sample {
  display: inline-block;
  width: 1.5rem;
  height: 0.55rem;
  border-radius: 0.25rem;
  margin-right: 0.35rem;
  vertical-align: middle;
}
.roadmap-timeline-bar-sample--done {
  background: #22c55e;
}
.roadmap-timeline-bar-sample--pending {
  background: #94a3b8;
}
.roadmap-gantt-wrapper {
  max-height: 28rem;
  overflow: auto;
}
.roadmap-gantt-label {
  width: 240px;
  max-width: 34vw;
}
.roadmap-gantt-track {
  min-height: 2.5rem;
}
.roadmap-gantt-track--axis {
  min-height: 2.25rem;
  padding-top: 0.15rem;
}
.roadmap-gantt-tick {
  position: absolute;
  top: 0.2rem;
  font-size: 0.68rem;
  white-space: nowrap;
  transform: translateX(-50%);
  color: #64748b;
  pointer-events: none;
  max-width: 5rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.roadmap-gantt-tick--start {
  transform: translateX(0);
  text-align: left;
}
.roadmap-gantt-tick--end {
  transform: translateX(-100%);
  text-align: right;
}
.roadmap-gantt-gridline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(148, 163, 184, 0.35);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 0;
}
.roadmap-gantt-row {
  min-height: 3rem;
}
.roadmap-gantt-bar {
  position: absolute;
  top: 0.55rem;
  bottom: 0.55rem;
  border-radius: 0.35rem;
  min-width: 4px;
  z-index: 1;
}
.roadmap-gantt-bar--done {
  background: linear-gradient(90deg, #4ade80, #16a34a);
}
.roadmap-gantt-bar--pending {
  background: linear-gradient(90deg, #cbd5e1, #94a3b8);
}
.roadmap-gantt-marker {
  position: absolute;
  top: 50%;
  width: 0.65rem;
  height: 0.65rem;
  transform: translate(-50%, -50%) rotate(45deg);
  border-radius: 0.1rem;
  z-index: 1;
}
.roadmap-gantt-marker.roadmap-gantt-bar--done {
  background: #16a34a;
}
.roadmap-gantt-marker.roadmap-gantt-bar--pending {
  background: #94a3b8;
}
.roadmap-gantt-nodate {
  position: absolute;
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
}

