/**
 * Gideon: larger font size in main content area only
 */
.content-page {
  font-size: 1rem;
  margin-left: var(--ins-sidenav-width);
  transition: margin-left 0.25s ease-in-out;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: visible;
  padding-bottom: 0;
}

html[data-sidenav-size=condensed] .content-page {
  margin-left: var(--ins-sidenav-width-sm);
}

html[data-sidenav-size=compact] .content-page {
  margin-left: var(--ins-sidenav-width-md);
}

/* Main content container must participate in full-height flex layout */
.content-page > .container-fluid {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Availability reminder banner: inside container-fluid; full-bleed bar under page title */
.availability-banner-wrap {
  margin-left: calc(-1 * var(--bs-gutter-x, 0.75rem));
  margin-right: calc(-1 * var(--bs-gutter-x, 0.75rem));
  margin-bottom: 1rem;
}
.availability-banner-wrap .alert {
  border-radius: 0;
}
/* Mobile: message and button stack so message isn't squeezed into a small box */
@media (max-width: 991.98px) {
  .availability-banner-wrap .alert {
    flex-direction: column;
    align-items: stretch;
    text-align: start;
  }
  .availability-banner-wrap .alert > span {
    flex: 0 0 auto;
    min-width: 0;
  }
  .availability-banner-wrap .alert .dropdown {
    flex: 0 0 auto;
    align-self: flex-start;
  }
}

/* ==========================================================================
   Dedicated AI agent chat page
   - page fills viewport height, only messages area scrolls, composer always visible
   ========================================================================== */

/* Constrain the page to viewport height so the chat card fills it and only #chatMessages scrolls */
body.ai-agent-chat-route .wrapper {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}
body.ai-agent-chat-route .wrapper > .content-page,
body.ai-agent-chat-route .wrapper > .gideon-layout-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
body.ai-agent-chat-route .content-page > .container-fluid {
  min-height: 0;
  overflow: hidden;
  padding-bottom: 1.25rem;
}

/* ==========================================================================
   Remote terminal page (/terminal): fill viewport, xterm FitAddon sizes cols/rows
   ========================================================================== */

body.terminal-page-route .wrapper {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}
body.terminal-page-route .wrapper > .content-page,
body.terminal-page-route .wrapper > .gideon-layout-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
body.terminal-page-route .content-page > .container-fluid {
  min-height: 0;
  overflow: hidden;
  padding-bottom: 0.5rem;
}
body.terminal-page-route .gideon-remote-terminal-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
body.terminal-page-route .gideon-remote-terminal-card > .card-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.terminal-page-route #terminal-wrap {
  flex: 1 1 auto;
  min-height: 12rem;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
}
body.terminal-page-route #terminal-container {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  position: relative;
}
body.terminal-page-route #terminal-container .xterm {
  width: 100%;
  height: 100%;
}
/* Chat block: fills available space in the constrained layout */
#ai-agent-chat-page.ai-agent-chat-page {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  display: flex;
  flex-direction: column;
}

#ai-agent-chat-page.ai-agent-chat-page.row {
  --bs-gutter-x: 0;
  --bs-gutter-y: 0;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
}

#ai-agent-chat-page > .col-12 {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0;
}

#ai-agent-chat-page .card {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(920px, calc(100dvh - 1rem));
  display: flex;
  flex-direction: column;
}

#ai-agent-chat-page .ai-chat-bubble-assistant pre {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

#ai-agent-chat-page .ai-chat-bubble-assistant code {
  word-break: break-word;
}

#ai-agent-chat-page .card-header {
  flex: 0 0 auto;
}

#ai-agent-chat-page .card-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Column layout: scrollable thread + sticky composer */
#ai-agent-chat-page .ai-chat-container {
  height: 100%;
  min-height: 0;
}

#ai-agent-chat-page #chatAlert,
#ai-agent-chat-page .ai-chat-context-header {
  flex: 0 0 auto;
}

#ai-agent-chat-page #chatMessages.ai-chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

#ai-agent-chat-page .ai-chat-composer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--ins-border-color, rgba(0, 0, 0, 0.08));
  background: var(--bs-body-bg, #fff);
  background: color-mix(in srgb, var(--bs-body-bg, #fff) 82%, transparent);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.06);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

#ai-agent-chat-page .ai-chat-composer-wrap {
  flex: 0 0 auto;
}

#ai-agent-chat-page .min-height-0 {
  min-height: 0 !important;
}

/* Welcome stack (light + structure) */
#ai-agent-chat-page .ai-chat-welcome-stack {
  max-width: 42rem;
}

#ai-agent-chat-page .ai-chat-welcome-kicker {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bs-secondary-color, #6c757d);
  margin-bottom: 0.5rem;
}

#ai-agent-chat-page .ai-chat-welcome-body {
  color: var(--bs-body-color, #212529);
  font-size: 1.0625rem;
  line-height: 1.65;
}

#ai-agent-chat-page .ai-chat-welcome-hint {
  margin-top: 1rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--bs-secondary-color, #6c757d);
}

#ai-agent-chat-page .ai-chat-composer .ai-chat-context-instructions {
  border-top: 0;
  border-bottom: 1px solid var(--ins-border-color, #dee2e6);
  padding-top: 0.5rem;
  padding-bottom: 0.4rem;
}

#ai-agent-chat-page .ai-chat-suggestion-chips {
  gap: 0.5rem !important;
  padding-top: 0.35rem;
  padding-bottom: 0.5rem;
}

#ai-agent-chat-page .ai-chat-composer > .ai-chat-suggestion-chips:first-child {
  padding-top: 0.65rem;
}

#ai-agent-chat-page .ai-chat-quick-reply-section {
  padding-top: 0.15rem;
  padding-bottom: 0.35rem;
}

/* Header ghost buttons (light theme — outline-adjacent) */
#ai-agent-chat-page .ai-chat-header-btn {
  border: 1px solid var(--bs-border-color, #dee2e6);
  background: transparent;
  color: var(--bs-body-color, #212529);
}

#ai-agent-chat-page .ai-chat-header-btn:hover {
  background: var(--bs-light, #f8f9fa);
  border-color: var(--bs-border-color, #dee2e6);
  color: var(--bs-body-color, #212529);
}

#ai-agent-chat-page a.ai-chat-header-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* Inner toolbar + input (outer border/shadow on .ai-chat-composer) */
#ai-agent-chat-page .ai-chat-composer-wrap {
  background: transparent;
}

#ai-agent-chat-page .ai-chat-composer-toolbar {
  background: var(--bs-light, #f8f9fa);
  border-bottom: 1px solid var(--ins-border-color, #dee2e6);
}

#ai-agent-chat-page .ai-chat-composer-brand-row {
  font-size: 0.875rem;
}

#ai-agent-chat-page .ai-chat-composer-row {
  background: var(--bs-body-bg, #fff);
  padding-top: 0.75rem;
}

/* Shared: textarea + send — send stays vertically centered as textarea grows */
.ai-chat-composer-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ai-chat-textarea-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

.ai-chat-textarea-wrap .gideon-ai-textarea,
.ai-chat-textarea-wrap .ai-chat-textarea,
.ai-chat-textarea-wrap textarea.form-control {
  width: 100%;
}

textarea.ai-chat-textarea {
  max-height: 220px;
}

#chatInput.ai-chat-textarea {
  resize: none;
  min-height: 3.25rem;
  font-size: 1.0625rem;
  line-height: 1.45;
  padding: 0.75rem 1rem;
  overflow-y: auto;
}

#ai-agent-chat-page .ai-chat-send-btn {
  width: 3.25rem;
  height: 3.25rem;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

#ai-agent-chat-page .ai-chat-send-btn .ti {
  font-size: 1.35rem;
  margin: 0 !important;
}

#ai-agent-chat-page .ai-chat-send-btn .spinner-border {
  margin: 0 !important;
}

/* Suggestion chips — light */
#ai-agent-chat-page .ai-chat-suggestion-chip {
  border-radius: 999px;
  border: 1px solid var(--bs-border-color, #dee2e6);
  background: var(--bs-light, #f8f9fa);
  color: var(--bs-body-color, #212529);
  font-weight: 500;
  padding-left: 0.85rem;
  padding-right: 0.85rem;
}

#ai-agent-chat-page .ai-chat-suggestion-chip:hover {
  background: var(--bs-body-bg, #fff);
  border-color: var(--bs-primary, #5b73e8);
  color: var(--bs-primary, #5b73e8);
}

#ai-agent-chat-page .ai-chat-quick-replies-toggle {
  color: var(--bs-primary, #5b73e8);
  text-decoration: none;
}

#ai-agent-chat-page .ai-chat-quick-replies-toggle:hover {
  color: var(--bs-body-color, #212529);
}

/* Larger bubbles for recordings / demos */
#ai-agent-chat-page .ai-chat-bubble {
  display: inline-block;
  text-align: start;
  padding: 0.75rem 1.1rem;
  border-radius: 0.85rem;
  max-width: min(92%, 42rem);
  font-size: 1.0625rem;
  line-height: 1.55;
  word-break: break-word;
  overflow-wrap: anywhere;
}

#ai-agent-chat-page .ai-chat-bubble-user {
  background: var(--bs-primary, #5b73e8);
  color: #fff;
}

#ai-agent-chat-page .ai-chat-bubble-assistant {
  background: var(--ins-light-bg-subtle, #f1f3f5);
  color: var(--bs-body-color, #212529);
}

/* ----- AI agent chat page — dark theme (ManagerOS --mos-dark-*) ----- */

html[data-bs-theme="dark"] body.ai-agent-chat-route .content-page > .container-fluid {
  padding-bottom: 1.5rem;
}

html[data-bs-theme="dark"] body.ai-agent-chat-route .content-page .footer {
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--mos-dark-border);
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-page-card {
  background: var(--mos-dark-surface) !important;
  border: 1px solid var(--mos-dark-border) !important;
  box-shadow: var(--mos-dark-shadow-portal) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-card-header {
  background: var(--mos-dark-surface-2) !important;
  color: var(--mos-dark-text) !important;
  border-bottom: 1px solid var(--mos-dark-border) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-card-title {
  color: var(--mos-dark-text) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-card-title .ti {
  color: var(--mos-dark-accent);
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-header-btn {
  background: transparent !important;
  border: 1px solid var(--mos-dark-border) !important;
  color: var(--mos-dark-text) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-header-btn:hover {
  background: var(--mos-dark-accent-soft) !important;
  border-color: rgba(96, 165, 250, 0.4) !important;
  color: var(--mos-dark-accent) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-header-btn:focus-visible {
  box-shadow: 0 0 0 0.2rem var(--mos-dark-accent-soft) !important;
  outline: 0;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-card-body {
  background: transparent;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-alert {
  background: rgba(220, 53, 69, 0.14) !important;
  border: 1px solid rgba(248, 113, 113, 0.45) !important;
  color: #fecaca !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-context-header {
  background: var(--mos-dark-surface) !important;
  color: var(--mos-dark-muted) !important;
  border-color: var(--mos-dark-border) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-context-instructions {
  color: var(--mos-dark-muted) !important;
  background: transparent !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-composer .ai-chat-context-instructions {
  border-top: 0;
  border-bottom: 1px solid var(--mos-dark-border);
  padding-top: 0.65rem;
  padding-bottom: 0.45rem;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-messages-pane {
  background: var(--mos-dark-bg);
  border-top: 1px solid var(--mos-dark-border);
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-welcome-kicker {
  color: var(--mos-dark-accent) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-welcome-body {
  color: var(--mos-dark-text) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-welcome-body .text-muted,
html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-welcome-body.text-muted {
  color: var(--mos-dark-muted) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-welcome-hint {
  color: var(--mos-dark-muted) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-composer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--mos-dark-surface) !important;
  background: color-mix(in srgb, var(--mos-dark-surface) 82%, transparent) !important;
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.38);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-composer-wrap {
  background: transparent !important;
  border-top: none !important;
  box-shadow: none !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-composer-toolbar {
  background: var(--mos-dark-surface-3) !important;
  border-bottom: 1px solid var(--mos-dark-border) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-composer-brand-label {
  color: var(--mos-dark-text) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-composer-brand-icon {
  color: var(--mos-dark-accent) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-composer-shortcut-hint {
  color: var(--mos-dark-muted) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-composer-row {
  background: var(--mos-dark-surface-2) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page #chatInput.ai-chat-textarea,
html[data-bs-theme="dark"] #ai-agent-chat-page textarea.ai-chat-textarea {
  background-color: var(--mos-dark-surface-2) !important;
  border: 1px solid var(--mos-dark-border-strong) !important;
  color: var(--mos-dark-text) !important;
  caret-color: var(--mos-dark-accent);
}

html[data-bs-theme="dark"] #ai-agent-chat-page #chatInput.ai-chat-textarea::placeholder,
html[data-bs-theme="dark"] #ai-agent-chat-page textarea.ai-chat-textarea::placeholder {
  color: #b6c4d6;
  opacity: 1;
}

html[data-bs-theme="dark"] #ai-agent-chat-page #chatInput.ai-chat-textarea:focus,
html[data-bs-theme="dark"] #ai-agent-chat-page textarea.ai-chat-textarea:focus {
  border-color: rgba(96, 165, 250, 0.55) !important;
  box-shadow: 0 0 0 0.2rem var(--mos-dark-accent-soft) !important;
  outline: 0;
  background-color: var(--mos-dark-surface-2) !important;
  color: var(--mos-dark-text) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page textarea.ai-chat-textarea:disabled {
  background-color: var(--mos-dark-surface-3) !important;
  border-color: var(--mos-dark-border) !important;
  color: var(--mos-dark-muted) !important;
  opacity: 0.85;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-send-btn {
  box-shadow: none;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-send-btn:focus-visible {
  box-shadow: 0 0 0 0.2rem var(--mos-dark-accent-soft) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-suggestion-chip {
  background: var(--mos-dark-surface-3) !important;
  border: 1px solid var(--mos-dark-border-strong) !important;
  color: var(--mos-dark-text) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-suggestion-chip:hover {
  background: var(--mos-dark-surface-2) !important;
  border-color: rgba(96, 165, 250, 0.38) !important;
  color: var(--mos-dark-accent) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-quick-replies-toggle {
  color: var(--mos-dark-accent) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-quick-replies-toggle:hover {
  color: var(--mos-dark-text) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-quick-reply-section .text-muted {
  color: var(--mos-dark-muted) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-bubble-user {
  background: #2453a6 !important;
  color: #f8fafc !important;
  border: 1px solid rgba(96, 165, 250, 0.38);
}

@supports (color: color-mix(in srgb, white, black)) {
  html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-bubble-user {
    background: linear-gradient(
      145deg,
      color-mix(in srgb, var(--mos-dark-accent) 72%, #1e3a8a) 0%,
      color-mix(in srgb, var(--mos-dark-accent) 45%, var(--mos-dark-surface-3)) 100%
    ) !important;
  }
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-bubble-assistant {
  background: var(--mos-dark-surface-3) !important;
  color: var(--mos-dark-text) !important;
  border: 1px solid var(--mos-dark-border);
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-bubble-assistant a {
  color: var(--mos-dark-accent) !important;
  text-decoration: underline;
  text-underline-offset: 2px;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-bubble-assistant a:hover {
  color: #93c5fd !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-bubble-assistant pre {
  background: var(--mos-dark-surface-2) !important;
  border: 1px solid var(--mos-dark-border-strong) !important;
  color: var(--mos-dark-text) !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-bubble-assistant :not(pre) > code {
  background: var(--mos-dark-surface-2) !important;
  border: 1px solid var(--mos-dark-border);
  color: #e2e8f0 !important;
  padding: 0.12em 0.4em;
  border-radius: 0.3rem;
  font-size: 0.92em;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-bubble-assistant pre code {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  color: inherit !important;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-bubble-assistant blockquote {
  border-left: 3px solid var(--mos-dark-accent);
  padding-left: 0.75rem;
  margin: 0.5rem 0;
  color: var(--mos-dark-muted);
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-bubble-assistant ul,
html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-bubble-assistant ol {
  color: inherit;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-turn-meta {
  font-size: 0.75rem;
  color: var(--mos-dark-muted);
  margin-top: 0.35rem;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border-radius: 0.85rem;
  background: var(--mos-dark-surface-3);
  border: 1px solid var(--mos-dark-border);
  color: var(--mos-dark-muted);
  font-size: 0.9375rem;
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-send-btn .spinner-border {
  border-right-color: transparent;
}

/* Waiting for model: status strip + composer highlight (input stays editable; send blocked in JS) */
#ai-agent-chat-page .ai-chat-waiting-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  border-bottom: 1px solid var(--ins-border-color, rgba(0, 0, 0, 0.08));
  background: linear-gradient(90deg, rgba(91, 115, 232, 0.1), rgba(91, 115, 232, 0.02));
  color: var(--bs-body-color, #212529);
  font-weight: 500;
}

#ai-agent-chat-page .ai-chat-waiting-hint {
  font-weight: 400;
  color: var(--bs-secondary-color, #6c757d);
  font-size: 0.8125rem;
}

#ai-agent-chat-page .ai-chat-waiting-pulse {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--bs-primary, #5b73e8);
  animation: ai-chat-waiting-pulse 1.1s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes ai-chat-waiting-pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.92);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

#ai-agent-chat-page .ai-chat-composer.ai-chat-composer-waiting {
  box-shadow: 0 -8px 28px rgba(91, 115, 232, 0.12);
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-waiting-bar {
  border-bottom-color: var(--mos-dark-border);
  background: linear-gradient(90deg, rgba(96, 165, 250, 0.14), rgba(96, 165, 250, 0.03));
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-waiting-hint {
  color: var(--mos-dark-muted);
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-waiting-pulse {
  background: var(--mos-dark-accent, #60a5fa);
}

html[data-bs-theme="dark"] #ai-agent-chat-page .ai-chat-composer.ai-chat-composer-waiting {
  box-shadow: 0 -10px 32px rgba(96, 165, 250, 0.12);
}

/* ----- AI agent chat — IRC / terminal mode (flag irc_mode) -----
   Terminal look applies only inside #ai-agent-chat-page. Do not repaint .content-page / body:
   that broke the page shell vs normal pages (title + canvas should match Overview, etc.). */

/* Fill column under title instead of vertically centering a short card (reduces empty margins) */
#ai-agent-chat-page.ai-agent-chat-irc > .col-12 {
  justify-content: flex-start;
  align-items: stretch;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-page-card {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  height: min(920px, calc(100dvh - 7.5rem));
  background: #0c0c0f !important;
  border: 1px solid #1e293b !important;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.06), 0 12px 40px rgba(0, 0, 0, 0.55) !important;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-card-header {
  background: #0a0a0d !important;
  border-bottom: 1px solid #1e293b !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-card-title {
  color: #86efac !important;
  letter-spacing: 0.02em;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-card-title .ti {
  color: #4ade80 !important;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-header-btn {
  border-color: #334155 !important;
  color: #94a3b8 !important;
  background: #0f172a !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8125rem;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-header-btn:hover {
  border-color: #22c55e !important;
  color: #bbf7d0 !important;
  background: #14532d !important;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-card-body {
  background: #050508 !important;
}

#ai-agent-chat-page.ai-agent-chat-irc #chatAlert {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  border-color: #7f1d1d !important;
  background: rgba(127, 29, 29, 0.35) !important;
  color: #fecaca !important;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-context-header {
  background: #0a0a0d !important;
  border-color: #1e293b !important;
  color: #64748b !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8125rem;
}

#ai-agent-chat-page.ai-agent-chat-irc #chatMessages.ai-chat-messages {
  background: #000 !important;
  border-top: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.875rem;
  line-height: 1.45;
  color: #cbd5e1;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-welcome-stack {
  max-width: none;
  padding: 0.25rem 0;
  border-left: 3px solid #22c55e;
  padding-left: 0.75rem;
  margin-top: 0.25rem;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-welcome-kicker {
  color: #4ade80 !important;
  font-family: inherit;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-welcome-body {
  color: #e2e8f0 !important;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-welcome-hint {
  color: #64748b !important;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-irc-line {
  text-align: start;
  margin-bottom: 0.2rem;
  word-break: break-word;
  overflow-wrap: anywhere;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-irc-ts {
  color: #78716c;
  user-select: none;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-irc-line-user .ai-chat-irc-nick {
  color: #7dd3fc;
  font-weight: 600;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-irc-line-bot .ai-chat-irc-nick {
  color: #86efac;
  font-weight: 600;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-irc-text {
  color: #e2e8f0;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-irc-line-bot .ai-chat-irc-text a {
  color: #7dd3fc;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-irc-line-bot .ai-chat-irc-text pre {
  margin: 0.35rem 0 0;
  padding: 0.5rem 0.65rem;
  background: #0f172a !important;
  border: 1px solid #1e293b;
  color: #a5f3fc !important;
  white-space: pre-wrap;
  word-break: break-word;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-irc-line-bot .ai-chat-irc-text :not(pre) > code {
  background: #0f172a !important;
  color: #fde68a !important;
  border: 1px solid #334155;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-composer {
  border-top: 1px solid #0f172a;
  background: #000 !important;
  box-shadow: none;
  backdrop-filter: none;
}

/* Composer inner rows still used default light theme background — force full buffer */
#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-composer-wrap {
  background: transparent !important;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-composer-row {
  background: transparent !important;
  padding-top: 0.5rem;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-composer .ai-chat-context-instructions {
  border-color: #1e293b !important;
  color: #64748b !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8125rem;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-waiting-bar {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  border-bottom-color: #1e293b;
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.12), rgba(34, 197, 94, 0.02));
  color: #86efac;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-waiting-hint {
  color: #64748b !important;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-waiting-pulse {
  background: #22c55e;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-suggestion-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8125rem;
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #a5b4fc !important;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-suggestion-chip:hover {
  border-color: #22c55e !important;
  color: #bbf7d0 !important;
}

#ai-agent-chat-page.ai-agent-chat-irc #chatInput.ai-chat-textarea,
#ai-agent-chat-page.ai-agent-chat-irc textarea.ai-chat-textarea {
  background: #0a0a0a !important;
  border: 1px solid #27272a !important;
  color: #e4e4e7 !important;
  caret-color: #86efac;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.875rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#ai-agent-chat-page.ai-agent-chat-irc #chatInput.ai-chat-textarea::placeholder,
#ai-agent-chat-page.ai-agent-chat-irc textarea.ai-chat-textarea::placeholder {
  color: #52525b;
  opacity: 1;
}

#ai-agent-chat-page.ai-agent-chat-irc #chatInput.ai-chat-textarea:focus,
#ai-agent-chat-page.ai-agent-chat-irc textarea.ai-chat-textarea:focus {
  border-color: #3f3f46 !important;
  background: #0c0c0c !important;
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.2), 0 0 0 1px rgba(34, 197, 94, 0.35) !important;
  outline: 0 !important;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-send-btn {
  background: linear-gradient(180deg, #2d2d32 0%, #1f1f23 100%) !important;
  border: 1px solid #52525b !important;
  color: #a7f3d0 !important;
  border-radius: 0.375rem !important;
  --bs-btn-color: #a7f3d0;
  --bs-btn-hover-color: #d1fae5;
  --bs-btn-active-color: #d1fae5;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-send-btn .ti {
  color: #6ee7b7 !important;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-send-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #36363b 0%, #27272a 100%) !important;
  border-color: #6ee7b7 !important;
  color: #ecfdf5 !important;
  --bs-btn-hover-color: #ecfdf5;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-send-btn:hover:not(:disabled) .ti {
  color: #a7f3d0 !important;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-send-btn:focus-visible {
  box-shadow: 0 0 0 0.2rem rgba(110, 231, 183, 0.35) !important;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-send-btn:disabled .ti {
  color: #6b7280 !important;
}

#ai-agent-chat-page.ai-agent-chat-irc .ai-chat-send-btn .spinner-border {
  border-color: rgba(167, 243, 208, 0.95);
  border-right-color: transparent;
}

/* Hide floating launcher on dedicated full chat page */
body.ai-agent-chat-route .gideon-ai-toggle-btn {
  display: none !important;
}

/**
 * Gideon AI: right-side panel, same pattern as left .sidenav-menu (fixed, full height when shown).
 * Only applied when FEATURE_GIDEON_AI is on.
 */
:root {
  --ins-gideon-sidebar-width: 360px;
  --ins-footer-height: 3.5rem;
}

.gideon-layout-wrap {
  display: flex;
  min-width: 0;
  position: relative;
  margin-left: var(--ins-sidenav-width);
  transition: margin 0.25s ease-in-out;
}
html[data-sidenav-size=condensed] .gideon-layout-wrap {
  margin-left: var(--ins-sidenav-width-sm);
}
html[data-sidenav-size=compact] .gideon-layout-wrap {
  margin-left: var(--ins-sidenav-width-md);
}

.gideon-layout-wrap .content-page {
  flex: 1 1 auto;
  min-width: 0;
  margin-left: 0;
  transition: margin-right 0.2s ease-out;
}
html[data-sidenav-size=condensed] .gideon-layout-wrap .content-page,
html[data-sidenav-size=compact] .gideon-layout-wrap .content-page {
  margin-left: 0;
}

/*
 * Gideon AI panel: always position:fixed so closing never drops it into the flex row.
 * (Otherwise align-items:stretch made it full viewport height while width animated to 0.)
 */
.gideon-ai-sidebar {
  position: fixed;
  top: auto;
  bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  right: max(0.75rem, env(safe-area-inset-right, 0px));
  left: auto;
  z-index: 1005;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: none;
  width: 0;
  height: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: none;
  box-shadow: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: transparent;
}

/* Close: snap shut — no width transition (avoids tall strip flash on the right) */
.gideon-layout-wrap:not(.gideon-ai-open) .gideon-ai-sidebar {
  transition: none !important;
}

/* Open: floating card (bottom-right) */
.gideon-layout-wrap.gideon-ai-open .gideon-ai-sidebar {
  width: min(420px, calc(100vw - 1.5rem));
  height: min(640px, calc(100dvh - 5rem));
  max-height: min(640px, calc(100dvh - 5rem));
  border-radius: 1rem;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  background: var(--ins-light-bg-subtle, #f8f9fa);
  border: 1px solid var(--ins-border-color, #dee2e6);
  box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.12), 0 0.25rem 0.5rem rgba(0, 0, 0, 0.06);
  transition: opacity 0.2s ease-out, width 0.2s ease-out, height 0.2s ease-out,
    box-shadow 0.2s ease-out;
}

/* Floating panel overlays content; do not shrink the main layout */
.gideon-layout-wrap.gideon-ai-open {
  margin-right: 0;
}
body.gideon-ai-open .app-topbar {
  margin-right: 0;
}

.gideon-ai-sidebar-inner {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  height: 100%;
  width: var(--ins-gideon-sidebar-width);
  min-height: 0;
  overflow: hidden;
  font-size: 1rem;
}

.gideon-layout-wrap.gideon-ai-open .gideon-ai-sidebar-inner {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  box-sizing: border-box;
}

.gideon-ai-sidebar-inner .small {
  font-size: 0.95rem;
}

.gideon-ai-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  font-size: 1.0625rem;
  line-height: 1.5;
}

/* Demo-friendly bubbles in the floating widget */
.gideon-ai-bubble {
  display: inline-block;
  text-align: start;
  padding: 0.65rem 1rem;
  border-radius: 0.75rem;
  max-width: 92%;
  font-size: 1.0625rem;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.gideon-ai-bubble-user {
  background: var(--bs-primary, #5b73e8);
  color: #fff;
}

.gideon-ai-bubble-assistant {
  background: var(--ins-light-bg-subtle, #f1f3f5);
  color: var(--bs-body-color, #212529);
}

.gideon-ai-composer {
  border: 1px solid var(--ins-border-color, #dee2e6);
  background: var(--bs-body-bg, #fff);
}

.gideon-ai-composer-brand {
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}

.gideon-ai-textarea {
  resize: none;
  min-height: 2.5rem;
  max-height: 220px;
  font-size: 1.0625rem;
  line-height: 1.45;
  padding: 0.55rem 0.75rem;
  overflow-y: auto;
  box-sizing: border-box;
}

.gideon-ai-send-btn {
  width: 3rem;
  height: 3rem;
  padding: 0;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.gideon-ai-send-btn .ti {
  font-size: 1.35rem;
}

.gideon-ai-shortcuts-hint {
  font-size: 0.75rem;
  line-height: 1.35;
}

.gideon-ai-hint-short {
  font-size: 0.875rem;
  line-height: 1.4;
}

/* Gideon AI floating panel — dark theme (match ManagerOS --mos-dark-*) */
html[data-bs-theme="dark"] .gideon-layout-wrap.gideon-ai-open .gideon-ai-sidebar {
  background: var(--mos-dark-surface) !important;
  border-color: var(--mos-dark-border) !important;
  box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.45), 0 0.25rem 0.5rem rgba(0, 0, 0, 0.3) !important;
}

html[data-bs-theme="dark"] .gideon-ai-sidebar-inner > .d-flex .fw-semibold,
html[data-bs-theme="dark"] .gideon-ai-sidebar-inner > .d-flex span.fw-semibold {
  color: var(--mos-dark-text) !important;
}

html[data-bs-theme="dark"] .gideon-ai-sidebar-inner #gideon-ai-clear,
html[data-bs-theme="dark"] .gideon-ai-sidebar-inner #gideon-ai-close {
  color: var(--mos-dark-muted) !important;
}

html[data-bs-theme="dark"] .gideon-ai-sidebar-inner #gideon-ai-clear:hover,
html[data-bs-theme="dark"] .gideon-ai-sidebar-inner #gideon-ai-close:hover {
  color: var(--mos-dark-accent) !important;
}

html[data-bs-theme="dark"] .gideon-ai-hint-short {
  color: var(--mos-dark-muted) !important;
}

html[data-bs-theme="dark"] .gideon-ai-composer {
  background: var(--mos-dark-surface-2) !important;
  border: 1px solid var(--mos-dark-border-strong) !important;
  box-shadow: none;
}

html[data-bs-theme="dark"] .gideon-ai-composer-brand,
html[data-bs-theme="dark"] .gideon-ai-composer .text-body-secondary,
html[data-bs-theme="dark"] .gideon-ai-composer .fw-semibold.text-body {
  color: var(--mos-dark-text) !important;
}

html[data-bs-theme="dark"] .gideon-ai-composer .text-primary {
  color: var(--mos-dark-accent) !important;
}

html[data-bs-theme="dark"] .gideon-ai-textarea {
  background-color: var(--mos-dark-surface-3) !important;
  border: 1px solid var(--mos-dark-border-strong) !important;
  color: var(--mos-dark-text) !important;
  caret-color: var(--mos-dark-accent);
}

html[data-bs-theme="dark"] .gideon-ai-textarea::placeholder {
  color: #b6c4d6;
  opacity: 1;
}

html[data-bs-theme="dark"] .gideon-ai-textarea:focus {
  border-color: rgba(96, 165, 250, 0.55) !important;
  box-shadow: 0 0 0 0.2rem var(--mos-dark-accent-soft) !important;
  outline: 0;
  background-color: var(--mos-dark-surface-3) !important;
  color: var(--mos-dark-text) !important;
}

html[data-bs-theme="dark"] .gideon-ai-shortcuts-hint {
  color: var(--mos-dark-muted) !important;
}

html[data-bs-theme="dark"] .gideon-ai-bubble-assistant {
  background: var(--mos-dark-surface-3) !important;
  color: var(--mos-dark-text) !important;
  border: 1px solid var(--mos-dark-border);
}

/* Toggle button: fixed at bottom-right; hidden when panel is open (use X to close) */
.gideon-ai-toggle-btn {
  position: fixed;
  bottom: 4rem;
  right: 0.5rem;
  z-index: 1040;
  padding: 0 !important;
  border-radius: 50% !important;
}

@media (min-width: 576px) {
  .gideon-ai-toggle-btn {
    right: 0;
    border-radius: 8px 0 0 8px !important;
  }
}

/* Hide toggle when panel is open (button is outside the wrap, so use body class) */
body.gideon-ai-open .gideon-ai-toggle-btn {
  display: none !important;
}

/* ==========================================================================
   Mobile: allow horizontal scroll when content is wide (e.g. tickets table)
   ========================================================================== */
html {
  overflow-x: auto;
  max-width: 100%;
}
body {
  max-width: 100%;
  overflow-x: auto;
}
/* Wrapper: height by content so layout works with or without availability banner */
.wrapper {
  height: auto;
  min-height: 0;
  min-width: 0;
  overflow-x: visible;
  display: flex;
  flex-direction: column;
}

/* Main content blocks (direct children of .wrapper) take only their content height */
.wrapper > .content-page,
.wrapper > .gideon-layout-wrap {
  flex: 0 0 auto;
}

/* ==========================================================================
   Footer: in flow, no stretching
   ========================================================================== */

.content-page .footer {
  flex: 0 0 auto;
  margin-top: 1rem;
}

/* Profile avatar fallback when no picture: show initials in a circle */
.avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bs-primary, #5b73e8);
  color: #fff;
  font-weight: 600;
  font-size: 0.875em;
}
.avatar-initials.avatar-md {
  width: 2.5rem;
  height: 2.5rem;
}
.avatar-initials.topbar-avatar {
  width: 32px;
  height: 32px;
  font-size: 0.75rem;
}
.avatar-initials.dashboard-member-avatar,
.dashboard-member-avatar {
  width: 24px;
  height: 24px;
  font-size: 0.7rem;
  flex: 0 0 24px;
}

/* Topbar: allow flex items to shrink so avatar and title aren't cut off */
.app-topbar .topbar-menu {
  min-width: 0;
  flex-wrap: nowrap;
}
.app-topbar .topbar-menu > .d-flex:first-child {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.app-topbar .topbar-menu > .d-flex:last-child {
  flex: 0 0 auto;
  min-width: 0;
}
.app-topbar .logo-topbar .logo-lg img {
  max-height: 1.75rem;
}
.app-topbar .app-search {
  max-width: 100%;
  min-width: 0;
}
.app-topbar .app-search .form-control {
  max-width: 100%;
}
/* Topbar global search: dropdown must not be clipped by .d-flex:first-child overflow:hidden */
#topbar-search-results {
  position: fixed !important;
  z-index: 9999;
  top: 0;
  left: 0;
}
.topbar-item.nav-user .dropdown-toggle {
  min-width: 0;
  padding-left: 0.25rem !important;
  padding-right: 0.25rem !important;
}

/* Main content: allow horizontal scroll at page level so tickets/search tables don't sit in a small scroll frame */
.content-page {
  min-width: 0;
  overflow-x: visible;
}
.content-page .container-fluid {
  min-width: 0;
  overflow-x: visible;
}
/* Search and other pages that use .container: allow wide tables to extend and scroll at page level */
.content-page .container {
  max-width: none;
  overflow-x: visible;
}
.gideon-layout-wrap {
  min-width: 0;
  overflow-x: visible;
}

/* Page title / breadcrumb row: wrap and don't overflow */
.page-title-head {
  flex-wrap: wrap;
  min-width: 0;
  overflow-x: hidden;
}
.page-title-head .breadcrumb {
  flex-wrap: wrap;
}

/* Tickets / search: avoid inner scroll frame; let table extend and page scroll horizontally */
.table-responsive.overflow-visible {
  overflow-x: visible !important;
}

/* IPAM subnet list: whole row opens subnet except links/buttons */
#ipam-subnet-tbody tr.ipam-subnet-list-row {
  cursor: pointer;
}

/* On small viewports, content and topbar full width (sidebar is overlay) */
@media (max-width: 991.98px) {
  .app-topbar,
  .content-page,
  .gideon-layout-wrap {
    margin-left: 0 !important;
  }

  /* Hamburger first: ensure tap target and visibility over theme quirks */
  .app-topbar .sidenav-toggle-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 2.5rem;
    min-height: 2.5rem;
  }

  /* Availability: icon-only closed state (label hidden via d-none d-lg-inline in template) */
  #availability-dropdown-btn {
    min-width: 2.25rem;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
    justify-content: center;
  }
}

/* ==========================================================================
   Computers page: computer info modal (#info-dialog)
   ========================================================================== */
#info-dialog .info-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 0.35rem 1rem;
  align-items: baseline;
}
/* Allow long values (e.g. agent status badge) to wrap instead of overflowing the card */
#info-dialog .info-grid > * {
  min-width: 0;
}
#info-dialog #form-comp-status-msg {
  max-width: 100%;
}
#info-dialog #form-comp-status-msg .badge {
  white-space: normal;
  display: inline-block;
  max-width: 100%;
  text-align: left;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.35;
  vertical-align: top;
}
#info-dialog .modal-body .row > [class*="col-"] {
  min-width: 0;
}
#info-dialog .tracking-tight {
  letter-spacing: 0.02em;
}
#info-dialog .nav-pills .nav-link {
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  padding: 0.35rem 0.65rem;
}
#info-dialog .nav-pills .nav-link.active {
  font-weight: 600;
}
#info-dialog .modal-header.info-dialog-header {
  background: var(--bs-primary);
}
#info-dialog .info-dialog-icon-box {
  width: 48px;
  height: 48px;
}
#info-dialog .info-dialog-title {
  font-size: 1.25rem;
}
#info-dialog-status-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}
#info-dialog .info-dialog-inventory-tabs {
  flex-wrap: nowrap;
  scrollbar-width: thin;
}
#info-dialog .info-dialog-inventory-panes {
  max-height: 320px;
  overflow: auto;
}

/* ==========================================================================
   Inventory asset page: user picker (tag-style), details table, dropdown
   ========================================================================== */
.inv-user-picker {
  position: relative;
}

/* Picker frame: theme-aware (avoid hardcoded bg-white in dark mode) */
.inv-picker-shell,
.inv-user-picker.rounded.border {
  background-color: var(--bs-body-bg, #fff);
  border-color: var(--bs-border-color, rgba(0, 0, 0, 0.175)) !important;
}

.inv-user-picker.min-height-input {
  min-height: 38px;
}
.inv-user-picker .inv-user-search:focus {
  outline: none;
  box-shadow: none;
}
.inv-user-picker .inv-user-search {
  min-width: 140px;
  background-color: transparent !important;
  color: var(--bs-body-color, #212529);
}
/* KB category icon picker: selected icon */
#kb-category-icon-picker .kb-icon-opt.active {
  background-color: var(--bs-primary);
  color: var(--bs-white);
  border-color: var(--bs-primary);
}

/* User picker dropdown: custom list (not Bootstrap dropdown) so it's not clipped by overflow */
.inv-user-dropdown-list {
  display: none;
  position: fixed;
  z-index: 1060;
  min-width: 200px;
  max-height: 220px;
  overflow-y: auto;
  margin-top: 2px;
  padding: 0.25rem 0;
  font-size: 0.875rem;
  color: var(--bs-body-color, #212529);
  background-color: var(--bs-body-bg, #fff);
  border: 1px solid var(--bs-border-color, rgba(0,0,0,.175));
  border-radius: 0.3rem;
  box-shadow: 0 0.5rem 1rem rgba(0,0,0,.15);
}
.inv-user-dropdown-list.show {
  display: block;
}
.inv-user-dropdown-list .inv-user-option {
  display: block;
  width: 100%;
  padding: 0.4rem 0.94rem;
  clear: both;
  font-weight: 400;
  color: var(--bs-body-color, #212529);
  text-align: inherit;
  text-decoration: none;
  white-space: nowrap;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.inv-user-dropdown-list .inv-user-option:hover {
  background-color: var(--bs-tertiary-bg, rgba(0,0,0,.04));
}
.inv-user-dropdown-list .inv-user-option-item {
  display: block;
  padding: 0.4rem 0.94rem;
  color: var(--bs-secondary-color, #6c757d);
  font-size: 0.8125rem;
}
.inv-user-tag-remove {
  font-size: 1rem;
  line-height: 1;
}

/* Transfer modal: picker uses .manageros-user-picker (dropdown positioned under shell) */

/* Shared user picker (builder, flows, automation, ITAM): Choices-style single row = chip + input */
.manageros-user-picker.inv-picker-shell {
  position: relative;
  padding: 0;
}
.manageros-user-picker-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
  min-height: calc(1.5em + 0.5rem + 2px);
  padding: 0.2rem 0.5rem;
  box-sizing: border-box;
}
.manageros-user-picker .manageros-user-picker-tags {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  flex: 0 1 auto;
  max-width: 58%;
  min-width: 0;
}
.manageros-user-picker .manageros-user-picker-tags:empty {
  display: none;
}
.manageros-user-picker .manageros-user-picker-chip {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.15rem 0.35rem 0.15rem 0.45rem;
  line-height: 1.25;
  max-width: 100%;
  gap: 0.2rem !important;
}
.manageros-user-picker .manageros-user-picker-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  max-width: 14rem;
}
.manageros-user-picker-tag-remove {
  font-size: 0.8125rem;
  line-height: 1;
  flex-shrink: 0;
}
.manageros-user-picker .manageros-user-picker-q {
  flex: 1 1 0;
  min-width: 2.5rem;
  width: auto !important;
  max-width: none;
  box-sizing: border-box;
  height: auto;
  min-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}
.manageros-user-picker .manageros-user-picker-q:focus {
  box-shadow: none;
}
.manageros-user-picker .manageros-user-picker-menu.inv-user-dropdown-list {
  position: absolute !important;
  top: 100% !important;
  left: 0 !important;
  width: 100% !important;
  min-width: 100%;
  box-sizing: border-box;
}

/* Details table first column width (asset label) */
.inv-asset-details-table td:first-child {
  width: 38%;
}

/*
 * Dark mode: solid success badges (Resolved, Yes/On, Working, etc.)
 * Bootstrap default green is neon on slate; skip soft badges (bg-opacity-10 / 25).
 */
html[data-bs-theme="dark"] .content-page .badge.bg-success:not(.bg-opacity-10):not(.bg-opacity-25),
html[data-bs-theme="dark"] .modal .badge.bg-success:not(.bg-opacity-10):not(.bg-opacity-25) {
  background-color: #166534 !important;
  color: #d1fae5 !important;
  border: 1px solid rgba(74, 222, 128, 0.3);
}

/* Advisories: resolved checkmark column uses .text-success — muted emerald vs default neon */
html[data-bs-theme="dark"] .advisory-list-page .text-success {
  color: #34d399 !important;
}

/* Advisories: Active status badge — light sky primary (#60a5fa) needs dark text, not white */
html[data-bs-theme="dark"] .advisory-list-page .badge.bg-primary.adv-status-active,
html[data-bs-theme="dark"] .modal .badge.bg-primary.adv-status-active {
  color: #0f172a !important;
}

/* Advisories: filter tab when selected (outline-primary + active) — sky fill reads better with dark label */
html[data-bs-theme="dark"] .advisory-list-page .btn-group .adv-filter.btn-outline-primary.active,
html[data-bs-theme="dark"] .advisory-list-page .btn-group .adv-filter.btn-outline-primary.active:hover,
html[data-bs-theme="dark"] .advisory-list-page .btn-group .adv-filter.btn-outline-primary.active:focus-visible {
  --bs-btn-color: #0f172a;
  --bs-btn-hover-color: #0f172a;
  --bs-btn-active-color: #0f172a;
  color: #0f172a !important;
}

/* Advisories: outline success actions (e.g. Create Ticket) — softer green on slate */
html[data-bs-theme="dark"] .advisory-list-page .btn-outline-success {
  --bs-btn-color: #6ee7b7;
  --bs-btn-border-color: rgba(52, 211, 153, 0.45);
  --bs-btn-hover-bg: rgba(52, 211, 153, 0.12);
  --bs-btn-hover-border-color: rgba(52, 211, 153, 0.6);
  --bs-btn-hover-color: #d1fae5;
  --bs-btn-active-bg: rgba(52, 211, 153, 0.18);
  --bs-btn-active-border-color: rgba(52, 211, 153, 0.65);
  --bs-btn-active-color: #ecfdf5;
}

/* ITAM: assigned-to / transfer user picker shell (was hardcoded bg-white) */
html[data-bs-theme="dark"] .inv-picker-shell,
html[data-bs-theme="dark"] .inv-user-picker.rounded.border,
html[data-bs-theme="dark"] #inv-transfer-user-picker {
  background-color: var(--mos-dark-surface-2) !important;
  border-color: var(--mos-dark-border-strong) !important;
}

html[data-bs-theme="dark"] .manageros-user-picker .manageros-user-picker-q {
  background-color: transparent !important;
  color: var(--mos-dark-text) !important;
}
html[data-bs-theme="dark"] .manageros-user-picker .manageros-user-picker-q::placeholder {
  color: var(--mos-dark-muted);
}
html[data-bs-theme="dark"] .manageros-user-picker .manageros-user-picker-chip,
html[data-bs-theme="dark"] .manageros-user-picker .manageros-user-picker-tags .badge.rounded-pill {
  background-color: var(--mos-dark-accent-soft) !important;
  color: var(--mos-dark-accent) !important;
  border: 1px solid rgba(96, 165, 250, 0.35);
}
html[data-bs-theme="dark"] .manageros-user-picker .manageros-user-picker-tag-remove {
  color: var(--mos-dark-accent) !important;
}

html[data-bs-theme="dark"] .inv-user-picker .inv-user-tag {
  background-color: var(--mos-dark-accent-soft) !important;
  color: var(--mos-dark-accent) !important;
  border: 1px solid rgba(96, 165, 250, 0.35);
}
html[data-bs-theme="dark"] .inv-user-picker .inv-user-tag-remove {
  color: var(--mos-dark-accent) !important;
}

html[data-bs-theme="dark"] .inv-user-dropdown-list {
  background-color: var(--mos-dark-surface) !important;
  border: 1px solid var(--mos-dark-border) !important;
  color: var(--mos-dark-text) !important;
  box-shadow: var(--mos-dark-shadow-soft);
}

html[data-bs-theme="dark"] .inv-user-dropdown-list .inv-user-option {
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .inv-user-dropdown-list .inv-user-option:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

html[data-bs-theme="dark"] .inv-user-dropdown-list .inv-user-option-item {
  color: var(--mos-dark-muted);
}

/* --- Ticket list / view / edit (helpdesk) --- */
.ticket-list-page .ticket-filters {
  background: var(--bs-tertiary-bg, rgba(0,0,0,.03));
  padding: 0.5rem 0.75rem;
  border-radius: 0.25rem;
}
.ticket-table-wrap {
  overflow-x: auto;
}
.ticket-table {
  font-size: 0.95rem;
  line-height: 1.45;
}
.ticket-table th {
  white-space: nowrap;
  font-weight: 600;
}
.ticket-table .col-id { width: 3rem; }
.ticket-table .col-user { max-width: 120px; }
.ticket-table .col-title { min-width: 140px; }
.ticket-table .col-assignee { max-width: 100px; }
.ticket-table .col-priority, .ticket-table .col-status { white-space: nowrap; }
.ticket-table .col-created, .ticket-table .col-updated { white-space: nowrap; }
.ticket-table .col-duration { white-space: nowrap; }
.ticket-table td,
.ticket-table th {
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}
.ticket-row:hover {
  background-color: var(--bs-tertiary-bg, rgba(0,0,0,.04));
}
.ticket-row-overdue {
  border-left: 3px solid var(--bs-warning, #ffc107);
}
/* Priority borders override overdue when both apply (same specificity, order wins) */
.ticket-row-high-priority {
  border-left: 3px solid var(--bs-danger, #dc3545);
}
.ticket-row-critical {
  border-left: 3px solid purple;
}
.ticket-row-closed {
  border-left: 3px solid var(--bs-secondary, #6c757d);
}

/* SLA breach: subtle row tint + left accent (replaces harsh table-danger) */
@keyframes ticket-sla-breach-badge-pulse {
  0%,
  100% {
    box-shadow: 0 0 5px rgba(255, 77, 79, 0.45);
  }
  50% {
    box-shadow: 0 0 9px rgba(255, 77, 79, 0.62);
  }
}

.ticket-row.ticket-row--sla-breach {
  border-left: 3px solid #ff4d4f;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.ticket-row.ticket-row--sla-breach > * {
  background-color: rgba(255, 80, 80, 0.06);
  transition: background-color 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.ticket-table.table-striped > tbody > tr.ticket-row--sla-breach > * {
  --bs-table-accent-bg: rgba(255, 80, 80, 0.06);
  background-color: rgba(255, 80, 80, 0.06) !important;
}

.ticket-row.ticket-row--sla-breach:hover {
  background-color: transparent !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ticket-row.ticket-row--sla-breach:hover > * {
  background-color: rgba(255, 80, 80, 0.1);
}

.ticket-list-page .ticket-table.table-hover tbody tr.ticket-row--sla-breach:hover > * {
  background-color: rgba(255, 80, 80, 0.1) !important;
}

.ticket-sla-breach-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2em 0.45em 0.2em 0.35em;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.2;
  color: #fff !important;
  vertical-align: middle;
  border-radius: 999px;
  background-color: #ff4d4f !important;
  border: 0;
}

.ticket-sla-breach-badge .ti {
  font-size: 0.85em;
  line-height: 1;
}

/* Board / grid cards: same SLA breach language */
.ticket-list-page .ticket-card.ticket-card--sla-breach {
  border-left: 3px solid #ff4d4f;
  background-color: rgba(255, 80, 80, 0.06);
  transition: background-color 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.ticket-list-page .ticket-card.ticket-card--sla-breach:hover {
  background-color: rgba(255, 80, 80, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

html[data-bs-theme="dark"] .ticket-row.ticket-row--sla-breach > * {
  background-color: rgba(255, 80, 80, 0.08);
}

html[data-bs-theme="dark"] .ticket-table.table-striped > tbody > tr.ticket-row--sla-breach > * {
  --bs-table-accent-bg: rgba(255, 80, 80, 0.08);
  background-color: rgba(255, 80, 80, 0.08) !important;
}

html[data-bs-theme="dark"] .ticket-row.ticket-row--sla-breach:hover > * {
  background-color: rgba(255, 80, 80, 0.14);
}

html[data-bs-theme="dark"] .ticket-list-page .ticket-table.table-hover tbody tr.ticket-row--sla-breach:hover > * {
  background-color: rgba(255, 80, 80, 0.14) !important;
}

html[data-bs-theme="dark"] .ticket-row.ticket-row--sla-breach:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

html[data-bs-theme="dark"] .ticket-sla-breach-badge {
  box-shadow: 0 0 6px rgba(255, 77, 79, 0.5);
  animation: ticket-sla-breach-badge-pulse 2.8s ease-in-out infinite;
}

html[data-bs-theme="dark"] .ticket-list-page .ticket-card.ticket-card--sla-breach {
  background-color: rgba(255, 80, 80, 0.08) !important;
  box-shadow: var(--mos-dark-shadow-soft, 0 1px 2px rgba(0, 0, 0, 0.2)) !important;
}

html[data-bs-theme="dark"] .ticket-list-page .ticket-card.ticket-card--sla-breach:hover {
  background-color: rgba(255, 80, 80, 0.14) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
}

html[data-bs-theme="dark"] .ticket-list-page .tickets-board .ticket-card.ticket-card--sla-breach {
  background-color: rgba(255, 80, 80, 0.08) !important;
}

html[data-bs-theme="dark"] .ticket-list-page .tickets-board .ticket-card.ticket-card--sla-breach:hover {
  background-color: rgba(255, 80, 80, 0.14) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
}

@media (prefers-reduced-motion: reduce) {
  html[data-bs-theme="dark"] .ticket-sla-breach-badge {
    animation: none;
  }

  .ticket-row.ticket-row--sla-breach,
  .ticket-row.ticket-row--sla-breach > *,
  .ticket-list-page .ticket-card.ticket-card--sla-breach {
    transition: none;
  }
}

.badge-priority.bg-secondary { background-color: var(--bs-secondary) !important; }
.badge-status.bg-secondary { background-color: var(--bs-secondary) !important; }
/* Ensure status badges on ticket list have visible text (priority uses .priority-* classes with own colors) */
.ticket-table .col-status .badge:not(.bg-warning) {
  color: #fff !important;
}
.ticket-table .col-status .badge.bg-warning {
  color: #212529 !important;
}

/* Edit ticket form: ensure status select is visible (empty selects can collapse in some browsers) */
#edit-ticket-form #tstatus.form-select {
  min-height: 1.75rem;
  width: 100%;
}

/* Priority badge classes (from karnaf.css) - used when helpdesk_priorities.color_class is set or fallback by priority_id */
.badge.priority-low {
  background-color: #4DB0F7;
  color: #000;
}
.badge.priority-normal {
  background-color: #EFEFEF;
  color: #000;
}
.badge.priority-high {
  background-color: #FF3300;
  color: #fff;
}
.badge.priority-critical {
  background-color: purple;
  color: #fff;
}

/* Dark theme: medium/normal priority — slate gray (light theme #EFEFEF is harsh on dark UI) */
html[data-bs-theme="dark"] .badge.priority-normal {
  background-color: var(--mos-dark-surface-3) !important;
  color: var(--mos-dark-muted) !important;
  border: 1px solid var(--mos-dark-border-strong);
}

/* Urgency badge classes */
.badge.urgency-low {
  background-color: #E5E7EB;
  color: #000;
}

.badge.urgency-normal {
  background-color: #FCD34D;
  color: #000;
}

.badge.urgency-high {
  background-color: #F59E0B;
  color: #000;
}

.badge.urgency-urgent {
  background-color: #D97706;
  color: #fff;
}

.badge.urgency-critical {
  background-color: #92400E;
  color: #fff;
}

/* Dark theme: urgency-normal — light #FCD34D is loud on dark UI; keep a soft amber read */
html[data-bs-theme="dark"] .badge.urgency-normal {
  background-color: rgba(252, 211, 77, 0.16) !important;
  color: #fde68a !important;
  border: 1px solid rgba(252, 211, 77, 0.38);
}

.ticket-count {
  font-weight: 500;
}

.ticket-view-page pre,
.ticket-edit-page pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.95rem;
  line-height: 1.6;
}
.ticket-view-page .card-header,
.ticket-edit-page .card-header {
  font-size: 1rem;
}
.ticket-view-page .list-group-item pre,
.ticket-edit-page .list-group-item pre {
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 0;
}
.ticket-edit-page #editTicketTabContent .tab-pane {
  display: none;
}
.ticket-edit-page #editTicketTabContent .tab-pane.show {
  display: block;
}

/* KB article body: code blocks and callouts (warning, info, note) */
.kb-article-body pre,
.kb-article-layout pre {
  background: var(--bs-tertiary-bg, #f8f9fa);
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 0.25rem;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  font-size: 0.875rem;
}
.kb-article-body pre code,
.kb-article-layout pre code {
  background: none;
  padding: 0;
}
.kb-article-body .kb-callout,
.kb-article-layout .kb-callout {
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  border-left: 4px solid;
  border-radius: 0 0.25rem 0.25rem 0;
}
.kb-article-body .kb-callout-title,
.kb-article-layout .kb-callout-title {
  font-weight: 600;
  margin: 0 0 0.35em 0;
}
.kb-article-body .kb-callout p:last-child,
.kb-article-layout .kb-callout p:last-child {
  margin-bottom: 0;
}
.kb-article-body .kb-callout-warning,
.kb-article-layout .kb-callout-warning {
  background: #fff3cd;
  border-color: #ffc107;
}
.kb-article-body .kb-callout-info,
.kb-article-layout .kb-callout-info {
  background: #cff4fc;
  border-color: #0dcaf0;
}
.kb-article-body .kb-callout-note,
.kb-article-layout .kb-callout-note {
  background: #e7f1ff;
  border-color: #0d6efd;
}

/* KB redesign: premium layout, cards, hero, and browse/view surfaces */
.content-page .kb-page {
  --kb-bg: #f3f6fb;
  --kb-surface: #ffffff;
  --kb-border: #e6ebf2;
  --kb-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --kb-shadow-soft: 0 6px 18px rgba(15, 23, 42, 0.06);
  --kb-title: #0f172a;
  --kb-muted: #5b6577;
  --kb-accent: #2f6fed;
  color: var(--kb-title);
}
.content-page .kb-home-page .kb-hero {
  border-radius: 1rem;
  background: linear-gradient(135deg, #254e9f 0%, #2f6fed 35%, #4f8cff 100%);
  box-shadow: var(--kb-shadow);
  color: #fff;
  border: 0 !important;
}
.content-page .kb-home-page .kb-hero-inner {
  padding: 2rem 2rem 1.25rem;
}
.kb-hero-title {
  font-size: 2.3rem !important;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff !important;
}
.kb-hero-subtitle {
  color: rgba(255, 255, 255, 0.9);
  max-width: 44rem;
  font-size: 1rem;
}
.kb-hero-search {
  margin-top: 1.25rem;
  max-width: 52rem;
}
.kb-search-group .form-control {
  border: 0;
  box-shadow: none;
}
.kb-search-group .btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.kb-quick-link {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}
.kb-quick-link:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}
.kb-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}
.kb-stat-chip {
  min-width: 120px;
  padding: 0.5rem 0.7rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  display: flex;
  flex-direction: column;
}
.kb-stat-chip span {
  font-size: 1.15rem;
  line-height: 1.1;
  font-weight: 700;
  color: #fff;
}
.kb-stat-chip small {
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.88);
}
.kb-surface-card {
  border: 1px solid var(--kb-border) !important;
  border-radius: 1rem !important;
  box-shadow: var(--kb-shadow-soft) !important;
  background: #fff !important;
}
.kb-surface-card .card-header {
  border-top-left-radius: 1rem !important;
  border-top-right-radius: 1rem !important;
}
.kb-surface-card .card-body {
  padding: 1rem 1rem 1.1rem !important;
}
.kb-popular-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem;
  border: 1px solid var(--kb-border);
  border-radius: 0.7rem;
  transition: all 0.2s ease;
  color: var(--kb-title);
}
.kb-popular-link:hover {
  border-color: #c9d7ef;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}
.kb-popular-icon {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef4ff;
  color: var(--kb-accent);
}
.kb-popular-title {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
}
.kb-popular-arrow {
  color: #90a0b8;
}
.kb-cat-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 88px;
  padding: 0.85rem 1rem;
  border: 1px solid var(--kb-border);
  border-radius: 0.85rem;
  background: var(--kb-surface);
  transition: all 0.2s ease;
  text-decoration: none !important;
}
.kb-cat-card-clickable {
  cursor: pointer;
}
.kb-cat-card-clickable:focus-visible {
  outline: 2px solid #7aa6f7;
  outline-offset: 2px;
}
.kb-cat-card:hover {
  transform: translateY(-1px);
  border-color: #c9d7ef;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}
.kb-cat-icon-wrap {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #eef4ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.35rem;
}
.kb-cat-icon-wrap i {
  font-size: 1rem;
}
.kb-cat-card .flex-grow-1 {
  padding-right: 0.35rem;
}
.kb-cat-card .flex-grow-1 .fw-semibold {
  line-height: 1.28;
}
.kb-cat-card .text-muted.small {
  display: inline-block;
  margin-top: 0.15rem;
}
.kb-cat-arrow {
  color: #90a0b8;
}
.kb-cat-card .kb-cat-edit-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
}
.kb-browse-page .kb-categories-nav .kb-cat-row {
  border-radius: 0.7rem;
  margin-bottom: 0.45rem;
  border: 1px solid var(--kb-border);
  background: var(--kb-surface);
}
.kb-browse-page .kb-categories-nav .kb-cat-row.active {
  border-color: #bcd0f4;
  background: #eef4ff;
}
.kb-browse-page .kb-categories-nav .kb-cat-link {
  min-width: 0;
  gap: 0.4rem;
}
.kb-browse-page .kb-browse-cat-name {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 500;
  line-height: 1.25;
}
.kb-browse-page .kb-browse-cat-count {
  flex: 0 0 auto;
  margin-left: 0.35rem;
  padding: 0.08rem 0.46rem;
  border-radius: 999px;
  background: #eaf1ff;
  border: 1px solid #d6e4fb;
  color: #42679d;
  font-size: 0.72rem;
  font-weight: 700;
}
.kb-browse-page .kb-categories-nav .kb-cat-row.active .kb-browse-cat-count {
  background: #dce9ff;
  border-color: #c3d9ff;
  color: #2f5fa7;
}
.kb-browse-page #kb-category-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--kb-title);
}
.kb-article-card {
  display: block;
  border: 1px solid var(--kb-border);
  border-radius: 0.85rem;
  background: #fff;
  padding: 0.9rem 1rem;
  color: var(--kb-title);
  min-height: 126px;
  transition: all 0.2s ease;
}
.kb-article-card-clickable {
  cursor: pointer;
}
.kb-article-card-clickable:focus-visible {
  outline: 2px solid #7aa6f7;
  outline-offset: 2px;
}
.kb-article-card:hover {
  border-color: #c9d7ef;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
  color: var(--kb-title);
}
.kb-article-card-title {
  font-weight: 600;
  line-height: 1.35;
  font-size: 0.98rem;
}
.kb-article-card-meta {
  margin-top: 0.45rem;
  color: var(--kb-muted);
  font-size: 0.8125rem;
}
.kb-view-page #kb-view-title {
  color: var(--kb-title);
  letter-spacing: -0.02em;
  font-weight: 700;
}
.kb-reading-surface {
  border: 1px solid var(--kb-border);
  border-radius: 1rem;
  padding: 1.35rem 1.35rem 1.1rem;
  background: #fff;
}
.kb-view-page .card-body {
  padding: 1.25rem !important;
}
.kb-reading-surface p {
  color: #1f2937;
  line-height: 1.75;
}
.kb-reading-surface h2,
.kb-reading-surface h3,
.kb-reading-surface h4 {
  color: #0f172a;
  margin-top: 1.4rem;
  margin-bottom: 0.7rem;
}
.kb-reading-surface h2 {
  font-size: 1.42rem;
}
.kb-reading-surface h3 {
  font-size: 1.2rem;
}
.kb-reading-surface ul,
.kb-reading-surface ol {
  padding-left: 1.2rem;
  line-height: 1.8;
}

@media (max-width: 991px) {
  .kb-hero-title {
    font-size: 1.7rem !important;
  }
  .content-page .kb-home-page .kb-hero-inner {
    padding: 1.3rem 1.1rem 1rem;
  }
}

/* ==========================================================================
   ManagerOS dark palette — shared tokens (KB, tickets, portal, computers,
   dashboard, global card/table overrides). Hierarchy: bg < surface (cards) <
   surface-2 (headers / tabs / filters) < surface-3 (table thead).
   ========================================================================== */
html[data-bs-theme="dark"] {
  --mos-dark-bg: #0f172a;
  --mos-dark-surface: #111827;
  --mos-dark-surface-2: #1a2335;
  --mos-dark-surface-3: #243044;
  /* Ticket list / dense tables: thead one step brighter than global table-light mapping */
  --mos-dark-thead-elevated: #2d3d56;
  --mos-dark-thead-text: #f1f5f9;
  --mos-dark-border: rgba(255, 255, 255, 0.09);
  --mos-dark-border-strong: rgba(255, 255, 255, 0.14);
  --mos-dark-text: #e5e7eb;
  --mos-dark-muted: #94a3b8;
  --mos-dark-accent: #60a5fa;
  --mos-dark-accent-soft: rgba(96, 165, 250, 0.16);
  --mos-dark-shadow: 0 8px 28px rgba(0, 0, 0, 0.38);
  --mos-dark-shadow-soft: 0 4px 18px rgba(0, 0, 0, 0.28);
  --mos-dark-shadow-portal: 0 6px 24px rgba(0, 0, 0, 0.42);
  /* Align Bootstrap + Inspinia primary / links with ManagerOS sky accent in dark mode */
  --bs-primary: #60a5fa;
  --bs-primary-rgb: 96, 165, 250;
  --bs-link-color: #60a5fa;
  --bs-link-hover-color: #93c5fd;
  --ins-primary: #60a5fa;
  --ins-primary-rgb: 96, 165, 250;
}

html[data-bs-theme="dark"] .content-page {
  background-color: var(--mos-dark-bg);
}

/* KB: dark theme — uses ManagerOS palette (reference layout / polish) */
html[data-bs-theme="dark"] .content-page .kb-page {
  --kb-bg: var(--mos-dark-bg);
  --kb-surface: var(--mos-dark-surface);
  --kb-border: var(--mos-dark-border);
  --kb-shadow: var(--mos-dark-shadow);
  --kb-shadow-soft: var(--mos-dark-shadow-soft);
  --kb-title: var(--mos-dark-text);
  --kb-muted: var(--mos-dark-muted);
  --kb-accent: var(--mos-dark-accent);
  color: var(--kb-title);
}

html[data-bs-theme="dark"] .content-page .kb-page .text-muted {
  color: var(--kb-muted) !important;
}

html[data-bs-theme="dark"] .content-page .kb-home-page,
html[data-bs-theme="dark"] .content-page .kb-page.kb-browse-page,
html[data-bs-theme="dark"] .content-page .kb-page.kb-view-page {
  background-color: var(--kb-bg);
  border-radius: 0;
}

html[data-bs-theme="dark"] .content-page .kb-home-page .kb-hero {
  background: linear-gradient(
    145deg,
    var(--mos-dark-surface-2) 0%,
    var(--mos-dark-surface-3) 45%,
    #2a3a52 100%
  ) !important;
  box-shadow: var(--kb-shadow);
  border: 1px solid var(--mos-dark-border) !important;
}

html[data-bs-theme="dark"] .content-page .kb-home-page .kb-search-group .form-control {
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  color: #f8fafc !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

html[data-bs-theme="dark"] .content-page .kb-home-page .kb-search-group .form-control::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

html[data-bs-theme="dark"] .content-page .kb-home-page .kb-search-group .form-control:focus {
  border-color: rgba(96, 165, 250, 0.55) !important;
  box-shadow: 0 0 0 0.2rem var(--mos-dark-accent-soft);
}

html[data-bs-theme="dark"] .content-page .kb-home-page .kb-stat-chip {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

html[data-bs-theme="dark"] .kb-surface-card {
  background: var(--kb-surface) !important;
  border-color: var(--kb-border) !important;
  box-shadow: var(--kb-shadow-soft) !important;
}

html[data-bs-theme="dark"] .kb-surface-card .card-header.bg-white {
  background-color: var(--mos-dark-surface-2) !important;
  border-color: var(--mos-dark-border) !important;
  color: var(--kb-title);
}

html[data-bs-theme="dark"] .kb-surface-card .card-header .fw-semibold,
html[data-bs-theme="dark"] .kb-surface-card .card-header h5 {
  color: var(--kb-title);
}

html[data-bs-theme="dark"] .kb-surface-card .card-header .text-muted {
  color: var(--mos-dark-muted) !important;
}

html[data-bs-theme="dark"] .kb-surface-card .card-body {
  background: transparent;
}

html[data-bs-theme="dark"] .kb-popular-link {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--kb-border);
  color: var(--kb-title);
}

html[data-bs-theme="dark"] .kb-popular-link:hover {
  border-color: rgba(96, 165, 250, 0.35);
  box-shadow: var(--mos-dark-shadow-soft);
  background: rgba(255, 255, 255, 0.05);
}

html[data-bs-theme="dark"] .kb-popular-icon {
  background: var(--mos-dark-accent-soft);
  color: var(--mos-dark-accent);
}

html[data-bs-theme="dark"] .kb-popular-arrow {
  color: rgba(255, 255, 255, 0.45);
}

html[data-bs-theme="dark"] .kb-cat-card {
  background: var(--kb-surface) !important;
  border-color: var(--kb-border) !important;
  color: var(--kb-title) !important;
  box-shadow: var(--mos-dark-shadow-soft);
}

html[data-bs-theme="dark"] .kb-cat-card:hover {
  border-color: rgba(96, 165, 250, 0.35);
  box-shadow: var(--mos-dark-shadow);
}

html[data-bs-theme="dark"] .kb-cat-card .kb-cat-link-home,
html[data-bs-theme="dark"] .kb-cat-card .text-body {
  color: var(--kb-title) !important;
}

html[data-bs-theme="dark"] .kb-cat-card .text-muted.small {
  color: var(--kb-muted) !important;
}

html[data-bs-theme="dark"] .kb-cat-icon-wrap {
  background: var(--mos-dark-accent-soft);
}

html[data-bs-theme="dark"] .kb-cat-arrow {
  color: rgba(255, 255, 255, 0.45);
}

html[data-bs-theme="dark"] .kb-article-card {
  background: var(--kb-surface) !important;
  border-color: var(--kb-border) !important;
  color: var(--kb-title) !important;
}

html[data-bs-theme="dark"] .kb-article-card:hover {
  border-color: rgba(96, 165, 250, 0.35);
  box-shadow: var(--mos-dark-shadow);
  color: var(--kb-title) !important;
}

html[data-bs-theme="dark"] .kb-article-card-meta {
  color: var(--kb-muted);
}

html[data-bs-theme="dark"] .kb-browse-page .kb-categories-nav .kb-cat-row {
  background: var(--kb-surface);
  border-color: var(--kb-border);
}

html[data-bs-theme="dark"] .kb-browse-page .kb-categories-nav .kb-cat-row.active {
  background: var(--mos-dark-accent-soft);
  border-color: rgba(96, 165, 250, 0.38);
}

html[data-bs-theme="dark"] .kb-browse-page .kb-browse-cat-count {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--kb-border);
  color: var(--kb-muted);
}

html[data-bs-theme="dark"] .kb-browse-page .kb-categories-nav .kb-cat-row.active .kb-browse-cat-count {
  background: rgba(96, 165, 250, 0.22);
  border-color: rgba(96, 165, 250, 0.35);
  color: #bfdbfe;
}

html[data-bs-theme="dark"] .kb-reading-surface {
  background: var(--kb-surface);
  border-color: var(--kb-border);
}

html[data-bs-theme="dark"] .kb-reading-surface p {
  color: var(--kb-title);
}

html[data-bs-theme="dark"] .kb-reading-surface h2,
html[data-bs-theme="dark"] .kb-reading-surface h3,
html[data-bs-theme="dark"] .kb-reading-surface h4 {
  color: var(--kb-title);
}

html[data-bs-theme="dark"] .kb-article-body .kb-callout-warning,
html[data-bs-theme="dark"] .kb-article-layout .kb-callout-warning {
  background: rgba(255, 193, 7, 0.12);
  border-color: var(--bs-warning);
  color: var(--kb-title);
}

html[data-bs-theme="dark"] .kb-article-body .kb-callout-info,
html[data-bs-theme="dark"] .kb-article-layout .kb-callout-info {
  background: rgba(13, 202, 240, 0.12);
  border-color: var(--bs-info);
  color: var(--kb-title);
}

html[data-bs-theme="dark"] .kb-article-body .kb-callout-note,
html[data-bs-theme="dark"] .kb-article-layout .kb-callout-note {
  background: rgba(13, 110, 253, 0.12);
  border-color: var(--bs-primary);
  color: var(--kb-title);
}

html[data-bs-theme="dark"] .kb-page .list-group-item {
  background-color: var(--kb-surface);
  color: var(--kb-title);
  border-color: var(--kb-border);
}

html[data-bs-theme="dark"] .kb-page .list-group-item:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

html[data-bs-theme="dark"] .kb-page #kb-search-suggest.list-group {
  background: var(--kb-surface);
  border: 1px solid var(--kb-border);
  box-shadow: var(--kb-shadow-soft);
}

/* Ticket view page (/view/?id=...) - match reference layout */
.ticket-view-page {
  background: #f1f5f9;
}
.ticket-view-page-title {
  color: #0f172a;
  letter-spacing: 0.02em;
}
.ticket-view-page .card {
  border: 1px solid #e2e8f0 !important;
}
.ticket-title {
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #0f172a;
}
.ticket-hero {
  background: #ffffff;
}
.ticket-view-page .ticket-actions .btn {
  box-shadow: none;
}
.ticket-view-page .ticket-actions .btn-teal {
  background: #0d9488;
  border-color: #0d9488;
  color: #fff;
}
.ticket-view-page .ticket-actions .btn-teal:hover {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}
.ticket-status-badge {
  background: #0d9488;
  color: #fff;
  font-weight: 600;
}
.ticket-tag-neutral {
  background: #fff;
  color: #475569;
  border: 1px solid #cbd5e1;
  font-weight: 500;
}
.ticket-view-page .card-header {
  font-weight: 600;
  color: #0f172a;
}
.conversation-list .conversation-item:last-child {
  border-bottom: 0 !important;
}
.conversation-pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.6;
  font-family: inherit;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
}
.conversation-pre-private {
  background: #fff7ed;
  border-color: #fdba74;
}
/* Feature FEATURE_AUTO_RTL_CONTENT (see base.html): inbox view = stacked toolbar; ticket view/edit = corner overlay */
.gideon-conv-dir-wrap--stacked {
  min-width: 0;
}
.gideon-conv-dir-wrap--stacked > pre.conversation-pre {
  width: 100%;
  min-width: 0;
}
.gideon-conv-dir-wrap--overlay > pre.conversation-pre {
  padding-top: 1.85rem;
}
.gideon-conv-dir-tools .btn {
  font-size: 0.65rem;
  line-height: 1.2;
  min-height: 0;
}
.gideon-conv-dir-tools {
  z-index: 2;
  opacity: 0.88;
}
.gideon-conv-dir-wrap:hover .gideon-conv-dir-tools,
.gideon-conv-dir-tools:focus-within {
  opacity: 1;
}
.conversation-badge {
  font-weight: 600;
  text-transform: lowercase;
  font-size: 0.7rem;
}
.conversation-badge-requester {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
}
.conversation-badge-reply {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}
.conversation-badge-private {
  background: #ffedd5;
  color: #c2410c;
  border: 1px solid #fdba74;
}
.conversation-badge-action {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}
.ticket-view-page .kv-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.ticket-view-page .kv-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1rem;
  align-items: start;
}
.ticket-view-page .kv-label {
  color: #64748b;
}
.ticket-view-page .kv-value {
  color: #0f172a;
  font-weight: 500;
}
/* Ticket view / edit: icon timeline (Tabler timeline-icon-based pattern) */
.ticket-view-page .ticket-conversation-timeline,
.ticket-edit-page .ticket-conversation-timeline {
  position: relative;
}
.ticket-view-page .ticket-conversation-timeline .ticket-timeline-time,
.ticket-edit-page .ticket-conversation-timeline .ticket-timeline-time {
  min-width: 5.5rem;
  font-size: 0.8rem;
  line-height: 1.35;
  padding-top: 0.35rem;
}
@media (min-width: 768px) {
  .ticket-view-page .ticket-conversation-timeline .ticket-timeline-time,
  .ticket-edit-page .ticket-conversation-timeline .ticket-timeline-time {
    min-width: 7.5rem;
    font-size: 0.85rem;
    text-align: end;
  }
}
/* Mobile: time row above dot+content so the message column gets full width */
@media (max-width: 767.98px) {
  .ticket-view-page .ticket-conversation-timeline .timeline-item,
  .ticket-edit-page .ticket-conversation-timeline .timeline-item {
    display: grid !important;
    grid-template-columns: 32px minmax(0, 1fr);
    grid-template-areas:
      "time time"
      "dot content";
    column-gap: 0.75rem;
    row-gap: 0.35rem;
    align-items: start !important;
  }

  .ticket-view-page .ticket-conversation-timeline .ticket-timeline-time,
  .ticket-edit-page .ticket-conversation-timeline .ticket-timeline-time {
    grid-area: time;
    width: auto !important;
    min-width: 0 !important;
    padding: 0 0 0.35rem 0 !important;
    margin: 0;
    text-align: start !important;
    font-size: 0.8rem;
    line-height: 1.25;
    white-space: normal;
    word-break: break-word;
  }

  .ticket-view-page .ticket-conversation-timeline .timeline-dot,
  .ticket-edit-page .ticket-conversation-timeline .timeline-dot {
    grid-area: dot;
    margin-top: 0.1rem;
  }

  .ticket-view-page .ticket-conversation-timeline .timeline-content,
  .ticket-edit-page .ticket-conversation-timeline .timeline-content {
    grid-area: content;
    padding-left: 0 !important;
    min-width: 0;
    padding-bottom: 1rem !important;
  }

  .ticket-view-page .ticket-conversation-timeline .ticket-timeline-heading,
  .ticket-edit-page .ticket-conversation-timeline .ticket-timeline-heading {
    display: block;
  }

  .ticket-view-page .ticket-conversation-timeline .conversation-badge,
  .ticket-edit-page .ticket-conversation-timeline .conversation-badge {
    margin-top: 0.25rem;
  }

  .ticket-view-page .ticket-conversation-timeline pre.conversation-pre,
  .ticket-edit-page .ticket-conversation-timeline pre.conversation-pre {
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
  }
}
.ticket-view-page .ticket-conversation-timeline .timeline-dot,
.ticket-edit-page .ticket-conversation-timeline .timeline-dot {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  margin-top: 0;
  box-shadow: 0 0 0 3px #fff;
}
.ticket-view-page .ticket-timeline-dot--open,
.ticket-edit-page .ticket-timeline-dot--open {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
}
.ticket-view-page .ticket-timeline-dot--user,
.ticket-edit-page .ticket-timeline-dot--user {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.ticket-view-page .ticket-timeline-dot--staff,
.ticket-edit-page .ticket-timeline-dot--staff {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #6ee7b7;
}
.ticket-view-page .ticket-timeline-dot--private,
.ticket-edit-page .ticket-timeline-dot--private {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fdba74;
}
.ticket-view-page .ticket-timeline-dot--assign,
.ticket-edit-page .ticket-timeline-dot--assign {
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #7dd3fc;
}
.ticket-view-page .ticket-timeline-dot--merge,
.ticket-edit-page .ticket-timeline-dot--merge {
  background: #faf5ff;
  color: #7c3aed;
  border: 1px solid #d8b4fe;
}
.ticket-view-page .ticket-timeline-dot--system,
.ticket-edit-page .ticket-timeline-dot--system {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}
.ticket-view-page .ticket-timeline-heading,
.ticket-edit-page .ticket-timeline-heading {
  font-weight: 600;
  color: #0f172a;
}
@media (min-width: 1200px) {
  .ticket-view-page .ticket-sidebar-sticky {
    position: sticky;
    top: 1.25rem;
  }
}
@media (max-width: 767.98px) {
  .ticket-view-page {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }
  .ticket-view-page .kv-row {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
  .ticket-view-page .ticket-actions {
    width: 100%;
  }
  .ticket-view-page .ticket-actions .btn,
  .ticket-view-page .ticket-actions form,
  .ticket-view-page .ticket-actions form .btn {
    width: 100%;
  }
}

/* Ticket edit page (/edit/?id=...) */
.ticket-edit-page {
  background: #f4f7fb;
}
.ticket-edit-page .card {
  border: 1px solid rgba(15, 23, 42, 0.06) !important;
}
.ticket-edit-hero {
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
}
.ticket-edit-title {
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Hero status badge with bg-primary: black text in light and dark (sky primary fill) */
.ticket-edit-page .ticket-edit-hero .badge.bg-primary {
  color: #000 !important;
}

.ticket-edit-tabs .nav-link {
  border: 1px solid #dbe3ee;
  background: #fff;
  color: #334155;
  font-weight: 500;
  padding: 0.6rem 1rem;
}
.ticket-edit-tabs .nav-link.active {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}
.ticket-edit-page .card-header {
  font-weight: 600;
}
.ticket-edit-page .conversation-list .conversation-item:last-child {
  border-bottom: 0 !important;
}
.ticket-edit-page .conversation-pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.7;
  font-family: inherit;
  background: #f8fafc;
  border: 1px solid #e9eef5;
  border-radius: 1rem;
  padding: 1rem;
}
.ticket-edit-page .conversation-pre-private {
  background: #fff8e8;
  border-color: #f4ddb0;
}
.ticket-edit-page .conversation-badge {
  font-weight: 600;
  text-transform: lowercase;
}
.ticket-edit-page .reply-textarea,
.ticket-edit-page .action-textarea,
.ticket-edit-page #description,
.ticket-edit-page #description_tab {
  min-height: 160px;
}
.ticket-edit-page .kv-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.ticket-edit-page .kv-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1rem;
  align-items: start;
}
.ticket-edit-page .kv-label {
  color: #64748b;
}
.ticket-edit-page .kv-value {
  color: #0f172a;
  font-weight: 500;
}
@media (min-width: 1200px) {
  .ticket-edit-page .ticket-sidebar-sticky {
    position: sticky;
    top: 1.25rem;
  }
}
@media (max-width: 767.98px) {
  .ticket-edit-page {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }
  .ticket-edit-page .kv-row {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}

/* Ticket view / edit: dark theme (ManagerOS surfaces + hierarchy) */
html[data-bs-theme="dark"] .ticket-view-page {
  background: var(--mos-dark-bg);
}

html[data-bs-theme="dark"] .ticket-view-page-title,
html[data-bs-theme="dark"] .ticket-title,
html[data-bs-theme="dark"] .ticket-view-page .ticket-timeline-heading,
html[data-bs-theme="dark"] .ticket-view-page .kv-value {
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .ticket-view-page .card-header {
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .ticket-view-page .kv-label {
  color: var(--mos-dark-muted);
}

html[data-bs-theme="dark"] .ticket-hero {
  background: var(--mos-dark-surface);
  border: 1px solid var(--mos-dark-border);
  box-shadow: var(--mos-dark-shadow-soft);
}

html[data-bs-theme="dark"] .ticket-view-page .card {
  border: 1px solid var(--mos-dark-border) !important;
  background-color: var(--mos-dark-surface);
  box-shadow: var(--mos-dark-shadow-soft);
}

html[data-bs-theme="dark"] .ticket-view-page .card-header.bg-white,
html[data-bs-theme="dark"] .ticket-edit-page .card-header.bg-white {
  background-color: var(--mos-dark-surface-2) !important;
  border-color: var(--mos-dark-border) !important;
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .ticket-tag-neutral {
  background: var(--mos-dark-surface-2);
  color: var(--mos-dark-text);
  border-color: var(--mos-dark-border-strong);
}

html[data-bs-theme="dark"] .conversation-pre {
  background: var(--mos-dark-surface-2);
  border-color: var(--mos-dark-border);
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .conversation-pre-private {
  background: rgba(253, 186, 116, 0.12);
  border-color: rgba(253, 186, 116, 0.35);
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .conversation-badge-action {
  background: var(--mos-dark-surface-2);
  color: var(--mos-dark-text);
  border-color: var(--mos-dark-border-strong);
}

html[data-bs-theme="dark"] .conversation-badge-requester {
  background: var(--mos-dark-accent-soft);
  color: var(--mos-dark-accent);
  border-color: rgba(96, 165, 250, 0.35);
}

html[data-bs-theme="dark"] .conversation-badge-reply {
  background: rgba(25, 135, 84, 0.18);
  color: var(--bs-success);
  border-color: rgba(25, 135, 84, 0.35);
}

html[data-bs-theme="dark"] .conversation-badge-private {
  background: rgba(253, 186, 116, 0.14);
  color: #fdba74;
  border-color: rgba(253, 186, 116, 0.35);
}

html[data-bs-theme="dark"] .ticket-view-page .ticket-conversation-timeline .timeline-dot,
html[data-bs-theme="dark"] .ticket-edit-page .ticket-conversation-timeline .timeline-dot {
  box-shadow: 0 0 0 3px var(--mos-dark-surface);
}

html[data-bs-theme="dark"] .ticket-edit-page {
  background: var(--mos-dark-bg);
}

html[data-bs-theme="dark"] .ticket-edit-page .card {
  border: 1px solid var(--mos-dark-border) !important;
  background-color: var(--mos-dark-surface);
  box-shadow: var(--mos-dark-shadow-soft);
}

html[data-bs-theme="dark"] .ticket-edit-hero {
  background: linear-gradient(180deg, var(--mos-dark-bg) 0%, var(--mos-dark-surface) 100%);
}

html[data-bs-theme="dark"] .ticket-edit-tabs .nav-link {
  border-color: var(--mos-dark-border);
  background: var(--mos-dark-surface-2);
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .ticket-edit-tabs .nav-link.active {
  background: var(--mos-dark-accent-soft);
  color: var(--mos-dark-accent);
  border-color: rgba(96, 165, 250, 0.4);
}

html[data-bs-theme="dark"] .ticket-edit-page .ticket-timeline-heading,
html[data-bs-theme="dark"] .ticket-edit-page .kv-value {
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .ticket-edit-page .kv-label {
  color: var(--mos-dark-muted);
}

html[data-bs-theme="dark"] .ticket-edit-page .conversation-pre {
  background: var(--mos-dark-surface-2);
  border-color: var(--mos-dark-border);
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .ticket-edit-page .conversation-pre-private {
  background: rgba(253, 186, 116, 0.12);
  border-color: rgba(253, 186, 116, 0.35);
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .ticket-edit-page .list-group-item,
html[data-bs-theme="dark"] .ticket-view-page .list-group-item {
  background-color: var(--mos-dark-surface);
  color: var(--mos-dark-text);
  border-color: var(--mos-dark-border);
}

/* ==========================================================================
   Tom Select (timezone on settings, locations, org): readable dropdown
   - Raise stacking above siblings (MFA card, tabs, other fields) so the list
     isn't visually mixed with content behind it.
   - Opaque surfaces so option text stays legible on any background.
   ========================================================================== */
.ts-wrapper.dropdown-active {
  position: relative;
  z-index: 1060;
}
.ts-dropdown {
  z-index: 1061 !important;
  background-color: var(--bs-body-bg, #fff) !important;
  border: 1px solid var(--bs-border-color, rgba(0, 0, 0, 0.175));
  border-radius: var(--bs-border-radius, 0.375rem);
  box-shadow: var(--bs-box-shadow-lg, 0 0.5rem 1rem rgba(0, 0, 0, 0.15));
}
.ts-dropdown-content {
  background-color: var(--bs-body-bg, #fff) !important;
}
.ts-dropdown .option {
  background-color: var(--bs-body-bg, #fff);
  color: var(--bs-body-color, #212529);
}
.ts-dropdown .option:hover,
.ts-dropdown .option.active,
.ts-dropdown .create:hover,
.ts-dropdown .create.active {
  background-color: var(--bs-tertiary-bg, #f8f9fa) !important;
  color: var(--bs-body-color, #212529);
}
.ts-dropdown .optgroup-header {
  background-color: var(--bs-secondary-bg, #e9ecef);
  color: var(--bs-body-color, #212529);
}

/* Ticket inbox (/inbox/): horizontal toolbar on small screens (Inspinia email.html) */
.inbox-toolbar-scroll {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.inbox-page .inbox-star-btn {
  cursor: pointer;
}
/* Unread = newuserreply (customer replied); closed rows use Inspinia .mark-as-read on parent .email-app */
.inbox-page .inbox-unread-dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
}
.inbox-page .inbox-row-unread td {
  vertical-align: middle;
}

/* Inbox ticket view: one scrollbar - SimpleBar on #inboxViewThreadScroll only (no overflow-auto on same node).
   Cap .email-app height to viewport so the page body does not also scroll the same content. */
.inbox-view-page .inbox-view-email-app {
  min-height: 240px;
  max-height: calc(100vh - 12rem);
  overflow: hidden;
}
@media (max-width: 991.98px) {
  .inbox-view-page .inbox-view-email-app {
    max-height: calc(100vh - 10rem);
  }
}
.inbox-view-page .inbox-view-email-app > .card.d-flex.flex-column {
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}
.inbox-view-page #inboxViewThreadScroll.inbox-view-thread-scroll {
  min-height: 0;
  flex: 1 1 auto;
  position: relative;
  z-index: 1;
}
.inbox-view-page .card-body > .flex-shrink-0.border-top.mt-auto {
  position: relative;
  z-index: 3;
}

/* Compose (/inbox/compose): theme .outlook-box uses fixed viewport height + overflow, which forces a
   second scrollbar inside the card. Let the form define height and use normal page scroll only. */
.inbox-compose-page .outlook-box.email-app {
  height: auto;
  min-height: 0;
}
@media (max-width: 991.98px) {
  .inbox-compose-page .outlook-box.email-app {
    overflow: visible;
  }
}

/* --------------------------------------------------------------------------
   Self-service portal (/portal/*): capped content column; no page-title-head.
   Extra top padding so body sits below the app topbar comfortably.
   -------------------------------------------------------------------------- */
body.portal-company-route .content-page > .container-fluid {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-top: 1.25rem;
}
.portal-shell {
  padding-bottom: 2rem;
}
.portal-topnav {
  background: linear-gradient(135deg, var(--bs-body-bg, #fff) 0%, var(--bs-tertiary-bg, #f8f9fa) 100%);
  border-radius: 1rem;
  padding: 0.75rem 1.25rem !important;
}
.portal-brand-icon {
  width: 2.75rem;
  height: 2.75rem;
  background: linear-gradient(145deg, #3d5afe 0%, #1a237e 100%);
  color: #fff;
  font-size: 1.35rem;
  box-shadow: 0 4px 14px rgba(26, 35, 126, 0.35);
}
.portal-brand-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--bs-body-color, #212529);
}
.portal-brand-sub {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--bs-secondary-color, #6c757d);
  font-weight: 600;
}
.portal-nav-toggler {
  border-radius: 2rem;
  border: 1px solid var(--bs-border-color, #dee2e6);
  font-size: 0.875rem;
}
.portal-nav-pills .portal-nav-link {
  border-radius: 2rem;
  padding: 0.5rem 1rem;
  font-weight: 500;
  color: var(--bs-secondary-color, #6c757d);
  transition: background 0.2s ease, color 0.2s ease;
}
.portal-nav-pills .portal-nav-link:hover {
  background: var(--bs-tertiary-bg, #f8f9fa);
  color: var(--bs-body-color, #212529);
}
.portal-nav-pills .portal-nav-link.active {
  background: linear-gradient(135deg, #3949ab 0%, #1a237e 100%);
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(26, 35, 126, 0.25);
}
.portal-hero {
  background: #1a237e;
  min-height: 11rem;
}
.portal-hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 100% 0%, rgba(100, 181, 246, 0.45) 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 0% 100%, rgba(171, 71, 188, 0.35) 0%, transparent 50%),
    linear-gradient(125deg, #1a237e 0%, #283593 40%, #0d1642 100%);
  opacity: 1;
}
.portal-hero-eyebrow {
  opacity: 0.85;
  letter-spacing: 0.2em;
}
.portal-hero-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
}
.portal-hero-lead {
  max-width: 36rem;
}
.portal-tile {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid transparent !important;
}
.portal-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 0.75rem 2rem rgba(26, 35, 126, 0.12) !important;
  border-color: rgba(57, 73, 171, 0.15) !important;
}
.portal-tile-icon {
  width: 3rem;
  height: 3rem;
  font-size: 1.5rem;
  background: var(--bs-tertiary-bg, #f8f9fa);
}
.portal-quick-link {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.portal-quick-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.08) !important;
}
.portal-quick-link:hover .portal-quick-icon {
  background: linear-gradient(135deg, #3949ab 0%, #1a237e 100%);
  color: #fff;
}
.portal-quick-icon {
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.15rem;
  background: var(--bs-tertiary-bg, #f8f9fa);
  color: var(--bs-primary, #3d5afe);
  transition: background 0.2s ease, color 0.2s ease;
}
.portal-section-panel .portal-table-wrap {
  overflow: hidden;
}
.portal-catalog-card {
  transition: box-shadow 0.2s ease;
}
.portal-catalog-card:hover {
  box-shadow: 0 0.5rem 1.5rem rgba(26, 35, 126, 0.1) !important;
}
.portal-catalog-pkg {
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1.25rem;
  background: var(--bs-tertiary-bg, #f8f9fa);
  color: var(--bs-success, #198754);
}

/* Portal helpdesk form view (/portal/forms/view/) */
.portal-hf-view-card {
  overflow: hidden;
}
.portal-hf-view-head {
  background: linear-gradient(145deg, rgba(57, 73, 171, 0.09) 0%, var(--bs-tertiary-bg, #f8f9fa) 42%, var(--bs-body-bg, #fff) 100%);
  border-bottom: 1px solid rgba(57, 73, 171, 0.14);
}
.portal-hf-view-head-inner {
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
}
.portal-hf-view-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  justify-content: space-between;
}
.portal-hf-view-titleblock {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  min-width: 0;
  flex: 1 1 14rem;
}
.portal-hf-view-eyebrow {
  letter-spacing: 0.06em;
  color: rgba(57, 73, 171, 0.85);
  font-size: 0.7rem;
}
.portal-hf-view-title {
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--bs-emphasis-color, #212529);
}
.portal-hf-view-desc {
  font-size: 0.9375rem;
  line-height: 1.55;
  max-width: 36rem;
}
.portal-hf-view-back {
  color: var(--bs-body-color);
}
.portal-hf-view-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: linear-gradient(145deg, #3949ab 0%, #1a237e 100%);
  color: #fff;
  font-size: 1.5rem;
  box-shadow: 0 8px 22px rgba(26, 35, 126, 0.2);
}
.portal-hf-user-ac-menu .list-group-item-action:hover,
.portal-hf-user-ac-menu .list-group-item-action:focus {
  background-color: rgba(57, 73, 171, 0.08);
}
.portal-hf-form-wrap {
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
}
.portal-hf-section-enhanced {
  padding: 1rem 1.125rem;
  border-radius: 0.75rem;
  background: var(--bs-tertiary-bg, #f8f9fa);
  border: 1px solid var(--bs-border-color, #dee2e6);
  margin-top: 1.25rem;
}
.portal-hf-section-enhanced:first-child {
  margin-top: 0;
}
.portal-hf-field-block .form-control,
.portal-hf-field-block .form-select {
  border-radius: 0.5rem;
}
.portal-hf-footer {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--bs-border-color, #dee2e6);
}

/* Portal service request form (/portal/forms/view/) — SaaS layout */
.portal-form-wrapper {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  padding: 1.25rem 1rem 2rem;
}
@media (min-width: 768px) {
  .portal-form-wrapper {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}
.portal-form-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.portal-form-header-text {
  flex: 1 1 12rem;
  min-width: 0;
}
.portal-form-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, #5b7cff, #6fd3ff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 24px;
  flex-shrink: 0;
  box-shadow: 0 8px 22px rgba(91, 124, 255, 0.28);
}
.portal-form-title {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--bs-emphasis-color, #212529);
  margin: 0;
}
.portal-form-desc {
  font-size: 14px;
  line-height: 1.5;
  color: #6c757d;
  margin: 8px 0 0;
}
.portal-form-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  align-self: center;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #6c757d;
  text-decoration: none;
  border-radius: 10px;
  border: 1px solid #e6e8ec;
  background: var(--bs-body-bg, #fff);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.portal-form-back-link:hover {
  color: #5b7cff;
  border-color: #cfd6e4;
  background: #f8f9fc;
}
.portal-form-card {
  background: var(--bs-body-bg, #fff);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.04);
}
.portal-form-wrapper .portal-hf-form-wrap.portal-sr-form {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}
.form-field.portal-hf-field-block {
  margin-bottom: 20px;
}
.portal-label {
  font-size: 13px;
  font-weight: 600;
  color: #495057;
  margin-bottom: 6px;
  display: block;
}
.portal-required {
  color: #ff4d4f;
  margin-left: 4px;
}
.portal-input {
  height: 44px;
  border-radius: 10px;
  padding: 10px 14px;
  border: 1px solid #e6e8ec;
  background: var(--bs-body-bg, #fff);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea.portal-input {
  height: auto;
  min-height: 100px;
  line-height: 1.45;
}
select.portal-input,
.portal-input.form-select {
  padding-top: 10px;
  padding-bottom: 10px;
  padding-right: 2.25rem;
}
.portal-input:hover {
  border-color: #cfd6e4;
}
.portal-input:focus {
  border-color: #5b7cff;
  box-shadow: 0 0 0 3px rgba(91, 124, 255, 0.12);
  outline: none;
}
.portal-input.is-invalid {
  border-color: var(--bs-danger, #dc3545);
}
.portal-input.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.12);
}

/* Portal helpdesk form: user field uses ManagerOS picker shell (same pattern as /itam/) */
.portal-hf-user-picker.manageros-user-picker.inv-picker-shell {
  border-radius: 10px !important;
  border: 1px solid #e6e8ec !important;
  background: var(--bs-body-bg, #fff);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.portal-hf-user-picker.manageros-user-picker.inv-picker-shell:focus-within {
  border-color: #5b7cff;
  box-shadow: 0 0 0 3px rgba(91, 124, 255, 0.12);
}
.portal-hf-user-picker .manageros-user-picker-row {
  min-height: 40px;
  align-items: center;
}
.portal-hf-user-picker .manageros-user-picker-menu.inv-user-dropdown-list {
  z-index: 1050;
  max-height: 240px;
  overflow-y: auto;
  border-radius: 10px;
  box-shadow: 0 0.35rem 1rem rgba(0, 0, 0, 0.08);
}
html[data-bs-theme="dark"] .portal-hf-user-picker.manageros-user-picker.inv-picker-shell {
  border-color: var(--mos-dark-border, rgba(255, 255, 255, 0.12)) !important;
  background: var(--mos-dark-surface, #1a1d24);
}
html[data-bs-theme="dark"] .portal-hf-user-picker.manageros-user-picker.inv-picker-shell:focus-within {
  border-color: rgba(96, 165, 250, 0.45);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.12);
}

.portal-form-help {
  font-size: 12px;
  color: #868e96;
  margin-top: 6px;
}
.portal-form-check {
  margin-top: 4px;
  padding-left: 0;
  min-height: auto;
}
.portal-form-check-input {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.15rem;
  border-radius: 6px;
  border-color: #cfd6e4;
}
.portal-form-check-label {
  font-size: 14px;
  font-weight: 500;
  color: #495057;
  padding-left: 0.35rem;
}
.portal-form-note.portal-hf-section-enhanced {
  margin-top: 0;
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #f6f8fb;
  border: 1px solid #e8edf3;
}
.portal-form-note-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--bs-emphasis-color, #212529);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.portal-form-note-body {
  font-size: 14px;
  line-height: 1.5;
  color: #6c757d;
}
.portal-form-actions.portal-hf-footer {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid #eef1f4;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}
.portal-form-actions-secondary-below {
  margin-top: 1.125rem;
  width: 100%;
  max-width: 100%;
}
.btn-submit-form {
  height: 44px;
  padding: 0 22px;
  border-radius: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.12s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn-submit-form:hover:not(:disabled) {
  filter: brightness(1.03);
  box-shadow: 0 4px 14px rgba(13, 110, 253, 0.28);
}
.btn-submit-form:active:not(:disabled) {
  transform: translateY(1px);
}
.portal-form-actions-secondary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #6c757d;
}
.portal-form-actions-secondary-label {
  color: inherit;
  font-weight: 500;
  cursor: pointer;
}
.portal-sr-ac-menu.list-group {
  border-radius: 10px;
  border: 1px solid #e6e8ec;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  margin-top: 4px;
  overflow: hidden;
}
.portal-sr-ac-menu .list-group-item {
  border-color: #eef1f4;
}

/* Portal home: Your Forms section (after Quick Links) */
.portal-forms-home {
  background: linear-gradient(180deg, var(--bs-tertiary-bg, #f8f9fa) 0%, var(--bs-body-bg, #fff) 42%);
  border: 1px solid rgba(57, 73, 171, 0.1) !important;
}
.portal-forms-home-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid transparent !important;
}
.portal-forms-home-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1.5rem rgba(26, 35, 126, 0.1) !important;
  border-color: rgba(57, 73, 171, 0.14) !important;
}
.portal-forms-home-icon {
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1.25rem;
  color: var(--bs-primary, #0d6efd);
  background: rgba(var(--bs-primary-rgb, 13, 110, 253), 0.1);
}

/* Helpdesk form editor (/helpdesk_form/) */
.helpdesk-form-page {
  max-width: 1100px;
}
.helpdesk-form-page.hf-builder-page {
  max-width: 1440px;
}
.hf-builder-page .hf-page-hero {
  border-radius: 0.85rem;
  overflow: hidden;
}
.hf-sticky-actions {
  position: sticky;
  top: 0.35rem;
  z-index: 1020;
  border-radius: 0.85rem;
}
.hf-settings-sticky {
  position: sticky;
  top: 4.5rem;
}
@media (max-width: 991.98px) {
  .hf-settings-sticky {
    position: static;
  }
}
.hf-settings-card-label {
  background: var(--bs-tertiary-bg, #f8f9fa);
  border-radius: 0.85rem 0.85rem 0 0;
}
.hf-builder-main-card,
.hf-settings-card,
.hf-live-preview-card {
  border-radius: 0.85rem;
  overflow: hidden;
}
.hf-builder-list {
  border-radius: 0.85rem;
  border-style: solid;
  border-color: var(--bs-border-color-translucent, rgba(0, 0, 0, 0.08));
  background: var(--bs-body-bg, #fff);
  padding: 0.65rem;
  min-height: 2rem;
}
.hf-empty-state {
  border-color: var(--bs-border-color-translucent, rgba(0, 0, 0, 0.12)) !important;
  background: var(--bs-tertiary-bg, #f8f9fa);
  border-radius: 0.85rem !important;
}
.hf-empty-icon-wrap {
  width: 3.5rem;
  height: 3.5rem;
}
.hf-live-preview-scroll {
  max-height: 420px;
  overflow-y: auto;
}
.hf-live-preview-inner .form-label {
  font-size: 0.8125rem;
}
.hf-sortable-ghost {
  opacity: 0.55;
}
.hf-sortable-chosen {
  box-shadow: 0 0.35rem 1rem rgba(0, 0, 0, 0.08);
}
.hf-drag-handle {
  cursor: grab;
  line-height: 1;
}
.hf-drag-handle:active {
  cursor: grabbing;
}
.hf-field-card-head {
  background: var(--bs-tertiary-bg, #f8f9fa);
  border-radius: 0.85rem 0.85rem 0 0;
}
.hf-section-builder-card {
  border-left: 4px solid rgba(var(--bs-info-rgb, 13, 202, 240), 0.65) !important;
  background: linear-gradient(180deg, rgba(var(--bs-info-rgb, 13, 202, 240), 0.06) 0%, var(--bs-body-bg, #fff) 3.5rem);
}
.hf-section-pill {
  background: rgba(var(--bs-info-rgb, 13, 202, 240), 0.18);
  color: var(--bs-info-text-emphasis, #055160);
}
.hf-type-badge {
  background: rgba(var(--bs-secondary-rgb, 108, 117, 125), 0.15);
  color: var(--bs-secondary-color, #6c757d);
}
.hf-row-warn {
  outline: 2px solid rgba(var(--bs-warning-rgb, 255, 193, 7), 0.65);
  outline-offset: 2px;
  border-radius: 0.5rem;
}
.hf-adv-toggle .hf-adv-chevron {
  display: inline-block;
  transition: transform 0.2s ease;
}
.hf-adv-toggle[aria-expanded="true"] .hf-adv-chevron {
  transform: rotate(-180deg);
}
.hf-save-pulse {
  animation: hf-save-glow 1.4s ease-out 1;
}
@keyframes hf-save-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(25, 135, 84, 0.45);
  }
  100% {
    box-shadow: 0 0 0 10px rgba(25, 135, 84, 0);
  }
}
.helpdesk-form-card {
  overflow: hidden;
}
.helpdesk-form-card-head {
  background: linear-gradient(135deg, var(--bs-tertiary-bg, #f8f9fa) 0%, var(--bs-body-bg, #fff) 100%);
  border-bottom: 1px solid var(--bs-border-color, #dee2e6) !important;
}
.helpdesk-form-head-icon {
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.2rem;
  color: #fff;
  background: linear-gradient(145deg, #3949ab 0%, #1a237e 100%);
  box-shadow: 0 3px 10px rgba(26, 35, 126, 0.2);
}
.helpdesk-form-panel {
  border-radius: 0.75rem;
  border: 1px solid var(--bs-border-color, #dee2e6);
  background: var(--bs-body-bg, #fff);
  overflow: hidden;
}
.helpdesk-form-panel-header {
  padding: 0.65rem 1.15rem;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--bs-border-color, #dee2e6);
  background: var(--bs-tertiary-bg, #f8f9fa);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.helpdesk-form-panel-body {
  padding: 1.15rem 1.25rem 1.25rem;
}
.helpdesk-form-actions {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--bs-border-color, #dee2e6);
}
.hf-editor-card {
  border-radius: 0.65rem;
  border: 1px solid var(--bs-border-color, #dee2e6);
  background: var(--bs-body-bg, #fff);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  padding: 0.85rem 1rem;
  margin-bottom: 0.65rem;
}
.hf-editor-card-section {
  border-left: 3px solid var(--bs-primary, #0d6efd);
  background: rgba(var(--bs-primary-rgb, 13, 110, 253), 0.04);
}
.hf-editor-card-field:last-child {
  margin-bottom: 0;
}

/* Helpdesk form builder: equal gap and matching square hit targets for row actions */
.helpdesk-form-page .hf-row-actions {
  gap: 0.5rem;
}
.helpdesk-form-page .hf-row-actions .btn {
  width: 2.25rem;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-sizing: border-box;
}
.helpdesk-form-page .hf-row-actions .btn i {
  font-size: 1rem;
  line-height: 1;
}

html[data-bs-theme="dark"] .portal-topnav {
  background: linear-gradient(135deg, var(--mos-dark-surface) 0%, var(--mos-dark-surface-2) 100%);
  border: 1px solid var(--mos-dark-border);
  box-shadow: var(--mos-dark-shadow-soft);
}

html[data-bs-theme="dark"] .portal-brand-title {
  color: #fff !important;
}

html[data-bs-theme="dark"] .portal-hero-bg {
  background:
    radial-gradient(ellipse 90% 70% at 100% 0%, rgba(96, 165, 250, 0.28) 0%, transparent 52%),
    radial-gradient(ellipse 70% 55% at 0% 100%, rgba(129, 140, 248, 0.14) 0%, transparent 48%),
    linear-gradient(125deg, #0b1220 0%, #152a5c 42%, #0c1428 100%);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.06);
}
html[data-bs-theme="dark"] .portal-tile-icon,
html[data-bs-theme="dark"] .portal-quick-icon,
html[data-bs-theme="dark"] .portal-catalog-pkg {
  background: rgba(255, 255, 255, 0.06);
}

/* Portal inner pages (phonebook, my equipment, etc.): card + table header strip */
html[data-bs-theme="dark"] .portal-nav-pills .portal-nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .portal-nav-pills .portal-nav-link.active {
  background: var(--mos-dark-accent-soft) !important;
  color: var(--mos-dark-accent) !important;
  box-shadow: none;
  border: 1px solid rgba(96, 165, 250, 0.35);
}

html[data-bs-theme="dark"] .portal-shell > .card {
  background-color: var(--mos-dark-surface);
  border: 1px solid var(--mos-dark-border) !important;
  box-shadow: var(--mos-dark-shadow-portal) !important;
}

html[data-bs-theme="dark"] .portal-shell .card-header.bg-white {
  background-color: var(--mos-dark-surface-2) !important;
  border-color: var(--mos-dark-border) !important;
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .portal-shell .card-header .fw-semibold,
html[data-bs-theme="dark"] .portal-shell .card-header h5,
html[data-bs-theme="dark"] .portal-shell .card-header .h5 {
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .portal-hf-view-head {
  background: linear-gradient(145deg, rgba(129, 140, 248, 0.12) 0%, var(--mos-dark-surface-2) 45%, var(--mos-dark-surface) 100%);
  border-bottom-color: rgba(129, 140, 248, 0.2);
}
html[data-bs-theme="dark"] .portal-hf-view-eyebrow {
  color: rgba(165, 180, 252, 0.95);
}
html[data-bs-theme="dark"] .portal-hf-view-title {
  color: var(--mos-dark-text);
}
html[data-bs-theme="dark"] .portal-hf-view-icon {
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}
html[data-bs-theme="dark"] .portal-hf-view-back {
  background: var(--mos-dark-surface-2);
  border-color: var(--mos-dark-border);
  color: var(--mos-dark-text);
}
html[data-bs-theme="dark"] .portal-hf-user-ac-menu .list-group-item-action:hover,
html[data-bs-theme="dark"] .portal-hf-user-ac-menu .list-group-item-action:focus {
  background-color: rgba(129, 140, 248, 0.12);
}
html[data-bs-theme="dark"] .portal-hf-section-enhanced {
  background: var(--mos-dark-surface-2);
  border-color: var(--mos-dark-border);
}
html[data-bs-theme="dark"] .portal-hf-footer {
  border-color: var(--mos-dark-border);
}
html[data-bs-theme="dark"] .portal-form-card {
  background: var(--mos-dark-surface);
  border-color: var(--mos-dark-border);
  box-shadow: var(--mos-dark-shadow-portal, 0 6px 24px rgba(0, 0, 0, 0.35));
}
html[data-bs-theme="dark"] .portal-form-title {
  color: var(--mos-dark-text);
}
html[data-bs-theme="dark"] .portal-form-desc {
  color: var(--mos-dark-text-muted, rgba(255, 255, 255, 0.55));
}
html[data-bs-theme="dark"] .portal-form-icon {
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}
html[data-bs-theme="dark"] .portal-form-back-link {
  color: var(--mos-dark-text-muted, rgba(255, 255, 255, 0.65));
  border-color: var(--mos-dark-border);
  background: var(--mos-dark-surface-2);
}
html[data-bs-theme="dark"] .portal-form-back-link:hover {
  color: var(--mos-dark-accent, #93c5fd);
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(96, 165, 250, 0.08);
}
html[data-bs-theme="dark"] .portal-label {
  color: var(--mos-dark-text-muted, rgba(255, 255, 255, 0.82));
}
html[data-bs-theme="dark"] .portal-input {
  border-color: var(--mos-dark-border);
  background: var(--mos-dark-surface-2);
  color: var(--mos-dark-text);
}
html[data-bs-theme="dark"] .portal-input:hover {
  border-color: rgba(255, 255, 255, 0.18);
}
html[data-bs-theme="dark"] .portal-input:focus {
  border-color: var(--mos-dark-accent, #60a5fa);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}
html[data-bs-theme="dark"] .portal-form-help {
  color: var(--mos-dark-text-muted, rgba(255, 255, 255, 0.45));
}
html[data-bs-theme="dark"] .portal-form-check-label {
  color: var(--mos-dark-text-muted, rgba(255, 255, 255, 0.85));
}
html[data-bs-theme="dark"] .portal-form-note.portal-hf-section-enhanced {
  background: var(--mos-dark-surface-2);
  border-color: var(--mos-dark-border);
}
html[data-bs-theme="dark"] .portal-form-note-title {
  color: var(--mos-dark-text);
}
html[data-bs-theme="dark"] .portal-form-note-body {
  color: var(--mos-dark-text-muted, rgba(255, 255, 255, 0.55));
}
html[data-bs-theme="dark"] .portal-form-actions.portal-hf-footer {
  border-color: var(--mos-dark-border);
}
html[data-bs-theme="dark"] .portal-form-actions-secondary,
html[data-bs-theme="dark"] .portal-form-actions-secondary-label {
  color: var(--mos-dark-text-muted, rgba(255, 255, 255, 0.55));
}
html[data-bs-theme="dark"] .portal-sr-ac-menu.list-group {
  border-color: var(--mos-dark-border);
  box-shadow: var(--mos-dark-shadow-soft);
  background: var(--mos-dark-surface);
}
html[data-bs-theme="dark"] .portal-sr-ac-menu .list-group-item {
  border-color: var(--mos-dark-border);
  background: var(--mos-dark-surface);
  color: var(--mos-dark-text);
}
html[data-bs-theme="dark"] .helpdesk-form-card-head {
  background: linear-gradient(135deg, var(--mos-dark-surface-2) 0%, var(--mos-dark-surface) 100%);
}
html[data-bs-theme="dark"] .helpdesk-form-panel {
  border-color: var(--mos-dark-border);
  background: var(--mos-dark-surface);
}
html[data-bs-theme="dark"] .helpdesk-form-panel-header {
  background: var(--mos-dark-surface-2);
  border-color: var(--mos-dark-border);
  color: var(--mos-dark-text);
}
html[data-bs-theme="dark"] .hf-builder-list {
  background: rgba(0, 0, 0, 0.18);
  border-color: var(--mos-dark-border);
}
html[data-bs-theme="dark"] .hf-field-card-head {
  background: var(--mos-dark-surface-2);
  border-color: var(--mos-dark-border);
}
html[data-bs-theme="dark"] .hf-section-builder-card {
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.1) 0%, var(--mos-dark-surface) 3.5rem);
  border-color: var(--mos-dark-border);
}
html[data-bs-theme="dark"] .hf-settings-card-label {
  background: var(--mos-dark-surface-2);
}
html[data-bs-theme="dark"] .hf-empty-state {
  background: var(--mos-dark-surface-2);
  border-color: var(--mos-dark-border) !important;
}
html[data-bs-theme="dark"] .hf-sticky-actions {
  background: var(--mos-dark-surface);
  border: 1px solid var(--mos-dark-border);
}
html[data-bs-theme="dark"] .hf-editor-card {
  background: var(--mos-dark-surface);
  border-color: var(--mos-dark-border);
}
html[data-bs-theme="dark"] .hf-editor-card-section {
  background: rgba(96, 165, 250, 0.1);
}
html[data-bs-theme="dark"] .helpdesk-form-actions {
  border-color: var(--mos-dark-border);
}

html[data-bs-theme="dark"] .portal-forms-home {
  background: linear-gradient(180deg, var(--mos-dark-surface-2) 0%, var(--mos-dark-surface) 50%);
  border-color: var(--mos-dark-border) !important;
}
html[data-bs-theme="dark"] .portal-forms-home-card:hover {
  border-color: rgba(96, 165, 250, 0.35) !important;
  box-shadow: var(--mos-dark-shadow-soft) !important;
}
html[data-bs-theme="dark"] .portal-forms-home-icon {
  background: rgba(96, 165, 250, 0.12);
  color: var(--mos-dark-accent, #93c5fd);
}

/* Computers (/computers/): main card raised from page; table thead uses shared slate strip */
html[data-bs-theme="dark"] .card:has(#computers-page-content) {
  background-color: var(--mos-dark-surface);
  border: 1px solid var(--mos-dark-border);
  box-shadow: var(--mos-dark-shadow-soft);
}

html[data-bs-theme="dark"] .header-title {
  color: var(--mos-dark-text);
}

/* Dark theme: page title strip — sits on page bg; subtle divider */
html[data-bs-theme="dark"] .content-page .page-title-head {
  background-color: var(--mos-dark-surface-2) !important;
  border-bottom: 1px solid var(--mos-dark-border);
  margin-bottom: 1.1rem;
  padding-bottom: 0.65rem;
}

html[data-bs-theme="dark"] .content-page .page-title-head h4 {
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .content-page .availability-banner-wrap {
  margin-bottom: 1.1rem;
}

html[data-bs-theme="dark"] .availability-banner-wrap .alert-warning {
  background: rgba(251, 191, 36, 0.11) !important;
  color: var(--mos-dark-text) !important;
  border-bottom: 1px solid rgba(251, 191, 36, 0.22) !important;
}

html[data-bs-theme="dark"] .availability-banner-wrap .alert-warning .btn-warning {
  background: rgba(251, 191, 36, 0.18) !important;
  border-color: rgba(251, 191, 36, 0.38) !important;
  color: #fde68a !important;
}

html[data-bs-theme="dark"] .availability-banner-wrap .alert-warning .btn-warning:hover {
  background: rgba(251, 191, 36, 0.26) !important;
  border-color: rgba(251, 191, 36, 0.5) !important;
  color: #fef3c7 !important;
}

/* Overview: saved dashboards select — card-adjacent control surface */
html[data-bs-theme="dark"] .mos-dashboard .mos-dash-saved-card .form-select {
  background-color: var(--mos-dark-surface-2) !important;
  border: 1px solid var(--mos-dark-border-strong) !important;
  color: var(--mos-dark-text) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

html[data-bs-theme="dark"] .mos-dashboard .mos-dash-saved-card .form-select:focus {
  border-color: rgba(96, 165, 250, 0.5) !important;
  box-shadow: 0 0 0 0.2rem var(--mos-dark-accent-soft);
}

html[data-bs-theme="dark"] .mos-dashboard .mos-dash-saved-card .form-label {
  color: var(--mos-dark-muted);
}

/* Device fleet + generic .table-light thead: shared table-header strip (brighter than card headers) */
html[data-bs-theme="dark"] .content-page .mos-fleet-table thead th {
  background-color: var(--mos-dark-surface-3) !important;
  color: var(--mos-dark-text) !important;
  border-color: var(--mos-dark-border-strong) !important;
}

html[data-bs-theme="dark"] .content-page .table > thead.table-light > tr > th,
html[data-bs-theme="dark"] .content-page .table thead.table-light th {
  background-color: var(--mos-dark-surface-3) !important;
  color: var(--mos-dark-thead-text) !important;
  border-color: var(--mos-dark-border-strong) !important;
}

/* Sortable headers often use <a class="text-dark">; Bootstrap's utility wins over th color — force thead text. */
html[data-bs-theme="dark"] .content-page .table > thead.table-light > tr > th a.text-dark,
html[data-bs-theme="dark"] .content-page .table thead.table-light th a.text-dark {
  color: var(--mos-dark-thead-text) !important;
}

html[data-bs-theme="dark"] .computers-view-panel .board-column.bg-light {
  background-color: var(--mos-dark-surface-2) !important;
  border-color: var(--mos-dark-border) !important;
}

/* Karnaf-style ticket presence: who else is viewing/editing (polls /api_watching_heartbeat) */
.ticket-watching-presence {
  font-size: 0.9rem;
}
html[data-bs-theme="dark"] .ticket-watching-presence.alert-info {
  background: var(--mos-dark-accent-soft);
  color: var(--mos-dark-text);
  border: 1px solid rgba(96, 165, 250, 0.28) !important;
}

/* Language icon pickers (tenant settings, locations, platform tenant) */
.btn.ui-lang-opt.active,
.btn.location-lang-opt.active {
  background-color: rgba(13, 110, 253, 0.08);
  color: var(--bs-body-color, #212529);
  border-color: var(--bs-primary, #0d6efd);
}

/* Keep selected language labels readable when Bootstrap marks outline buttons active. */
.btn.btn-outline-secondary.ui-lang-opt.active,
.btn.btn-outline-secondary.location-lang-opt.active,
.btn.btn-outline-secondary.ui-lang-opt.active:hover,
.btn.btn-outline-secondary.location-lang-opt.active:hover,
.btn.btn-outline-secondary.ui-lang-opt.active:focus,
.btn.btn-outline-secondary.location-lang-opt.active:focus,
.btn-group > .btn.btn-outline-secondary.ui-lang-opt.active,
.btn-group > .btn.btn-outline-secondary.location-lang-opt.active,
.btn-group > .btn.btn-outline-secondary.ui-lang-opt.active:hover,
.btn-group > .btn.btn-outline-secondary.location-lang-opt.active:hover,
.btn-group > .btn.btn-outline-secondary.ui-lang-opt.active:focus,
.btn-group > .btn.btn-outline-secondary.location-lang-opt.active:focus {
  color: var(--bs-body-color, #212529);
  border-color: var(--bs-primary, #0d6efd);
}

html[data-bs-theme="dark"] .btn.btn-outline-secondary.ui-lang-opt.active,
html[data-bs-theme="dark"] .btn.btn-outline-secondary.location-lang-opt.active,
html[data-bs-theme="dark"] .btn-group > .btn.btn-outline-secondary.ui-lang-opt.active,
html[data-bs-theme="dark"] .btn-group > .btn.btn-outline-secondary.location-lang-opt.active {
  background-color: var(--mos-dark-accent-soft) !important;
  color: var(--mos-dark-accent) !important;
  border-color: rgba(96, 165, 250, 0.45) !important;
}

/* --------------------------------------------------------------------------
   RTL: keep <html dir="ltr"> and .sidenav-menu without dir. Use dir only on
   .content-page and .auth-box (see templates).
   Icon + label: flex + gap - strip icon margins (no me-*/ms-* with gap).
   :has(> i) limits to controls with a direct icon child; opt-in classes for
   nested icons or special cases. Use row-reverse if markup is text-then-icon.
   Topbar and sidebar stay LTR; dropdown items there keep default spacing.
   -------------------------------------------------------------------------- */
.content-page[dir="rtl"] .btn:has(> i),
.auth-box[dir="rtl"] .btn:has(> i),
.content-page[dir="rtl"] .btn-group > .btn:has(> i),
.auth-box[dir="rtl"] .btn-group > .btn:has(> i),
.content-page[dir="rtl"] .btn-with-icon,
.auth-box[dir="rtl"] .btn-with-icon,
.content-page[dir="rtl"] .btn-group > .btn-with-icon,
.auth-box[dir="rtl"] .btn-group > .btn-with-icon {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  column-gap: 0.5rem;
  text-align: start;
  vertical-align: middle;
}
.content-page[dir="rtl"] .btn:has(> i) > i,
.auth-box[dir="rtl"] .btn:has(> i) > i,
.content-page[dir="rtl"] .btn-group > .btn:has(> i) > i,
.auth-box[dir="rtl"] .btn-group > .btn:has(> i) > i,
.content-page[dir="rtl"] .btn-with-icon > i,
.auth-box[dir="rtl"] .btn-with-icon > i,
.content-page[dir="rtl"] .btn-group > .btn-with-icon > i,
.auth-box[dir="rtl"] .btn-group > .btn-with-icon > i {
  margin: 0 !important;
  flex: 0 0 auto;
}
.content-page[dir="rtl"] .btn:has(> i) > span,
.auth-box[dir="rtl"] .btn:has(> i) > span,
.content-page[dir="rtl"] .btn-with-icon > span,
.auth-box[dir="rtl"] .btn-with-icon > span,
.content-page[dir="rtl"] .btn-group > .btn:has(> i) > span,
.auth-box[dir="rtl"] .btn-group > .btn:has(> i) > span,
.content-page[dir="rtl"] .btn-group > .btn-with-icon > span,
.auth-box[dir="rtl"] .btn-group > .btn-with-icon > span {
  flex: 0 1 auto;
  text-align: start;
}

.content-page[dir="rtl"] .dropdown-item:has(> i),
.auth-box[dir="rtl"] .dropdown-item:has(> i),
.content-page[dir="rtl"] .dropdown-item-with-icon,
.auth-box[dir="rtl"] .dropdown-item-with-icon {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  column-gap: 0.5rem;
  text-align: start;
}
.content-page[dir="rtl"] .dropdown-item:has(> i) > i,
.auth-box[dir="rtl"] .dropdown-item:has(> i) > i,
.content-page[dir="rtl"] .dropdown-item-with-icon > i,
.auth-box[dir="rtl"] .dropdown-item-with-icon > i {
  margin: 0 !important;
  flex: 0 0 auto;
}
.content-page[dir="rtl"] .dropdown-item:has(> i) > span,
.auth-box[dir="rtl"] .dropdown-item:has(> i) > span,
.content-page[dir="rtl"] .dropdown-item-with-icon > span,
.auth-box[dir="rtl"] .dropdown-item-with-icon > span {
  flex: 0 1 auto;
  text-align: start;
}

/* Nav links with icon (main content / auth only; sidebar stays LTR) */
.content-page[dir="rtl"] .nav-link-with-icon,
.auth-box[dir="rtl"] .nav-link-with-icon {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  text-align: start;
}
.content-page[dir="rtl"] .nav-link-with-icon > i,
.auth-box[dir="rtl"] .nav-link-with-icon > i {
  flex: 0 0 auto;
  margin: 0 !important;
}

/* Send message: Choices.js multiple select - avoid double spacing with .mb-3 */
#sendmsg-recipients-wrap .choices {
  margin-bottom: 0;
}

/* Builder report combo (Choices.js multiple + optgroups, max 1 item → copies into text field) */
.mos-builder-combo .mos-builder-combo-choices-wrap .choices {
  margin-bottom: 0;
}
.mos-builder-combo .mos-builder-combo-choices-wrap .choices__inner {
  min-height: calc(1.5em + 0.5rem + 2px);
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

/* Broadcast: Tagify user list - match Inspinia form demo (bordered scope, no JSON input leak) */
.mb-recipient-tagify-wrap {
  position: relative;
  margin-bottom: 0;
}

/*
 * Tagify inserts <tags class="tagify form-control"> then leaves the original <input> as next sibling
 * for JSON value; Bootstrap .form-control keeps it visible unless hidden.
 */
.mb-recipient-tagify-wrap tags.tagify + #mb-user-tagify,
.mb-recipient-tagify-wrap .tagify + #mb-user-tagify,
.mb-recipient-tagify-wrap tags.tagify + #hr-ev-user-tagify,
.mb-recipient-tagify-wrap .tagify + #hr-ev-user-tagify,
.mb-recipient-tagify-wrap tags.tagify + #hr-sv-user-tagify,
.mb-recipient-tagify-wrap .tagify + #hr-sv-user-tagify {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Tagify recipient dropdown above modal when appended to body (broadcast-style / legacy). */
body.modal-open .tagify__dropdown.users-list {
  z-index: 1060 !important;
}

.mb-recipient-tagify-wrap tags.tagify,
.mb-recipient-tagify-wrap .tagify {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.35rem;
  width: 100%;
  min-height: calc(2.1259rem + 2px);
  /* Tight padding: large outer padding made Tagify treat "margin" clicks as focus/blur glitches (dropdown opens then closes on mouseup). */
  padding: 0.2rem 0.35rem;
  margin-bottom: 0;
  border: 1px solid var(--ins-border-color, var(--bs-border-color, #dee2e6));
  border-radius: var(--bs-border-radius, 0.375rem);
  background-color: var(--ins-secondary-bg, var(--bs-body-bg, #fff));
}

/* Fill the row so clicks land on the real input, not empty flex gutter. */
.mb-recipient-tagify-wrap .tagify__input {
  flex: 1 1 auto;
  min-width: 10rem;
  min-height: 1.65rem;
  padding: 0.2rem 0.35rem !important;
}

.mb-recipient-tagify-wrap tags.tagify:focus-within,
.mb-recipient-tagify-wrap .tagify.tagify--focus {
  border-color: var(--ins-primary, var(--bs-primary, #0d6efd));
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Avatar row + remove control on the end of the pill (theme default assumes <x> before <div>) */
.mb-recipient-tagify-wrap .tagify__tag {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  margin-inline-end: 0;
}
.mb-recipient-tagify-wrap .tagify__tag > .tagify__tag__removeBtn {
  flex: 0 0 auto;
  margin-inline-start: 0.35rem;
  margin-inline-end: 0.15rem;
  padding: 0.2rem 0.35rem;
}
.mb-recipient-tagify-wrap .tagify__tag > div.mb-broadcast-tag-body {
  padding-inline-end: 0.25rem;
  flex: 1 1 auto;
  min-width: 0;
}

.mb-recipient-tagify-wrap .tagify__dropdown.users-list {
  max-height: min(22rem, 70vh);
}

/*
 * Tagify targets .tagify__tag > div > * with overflow:hidden on direct flex children.
 * Theme demo (Full/dist form-tagify.js) wraps the photo in .avatar > img so the img is not that direct child.
 */
.mb-recipient-tagify-wrap .tagify__tag > div.mb-broadcast-tag-body > .avatar {
  overflow: visible !important;
  flex-shrink: 0 !important;
  min-width: 28px !important;
  min-height: 28px !important;
  max-width: none !important;
  line-height: 0;
}
.mb-recipient-tagify-wrap .tagify__tag > div.mb-broadcast-tag-body > .tagify__tag-text {
  min-width: 0 !important;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mb-recipient-tagify-wrap .tagify__dropdown__item .tagify__dropdown__item__avatar-wrap {
  flex-shrink: 0 !important;
  overflow: visible !important;
  min-width: 32px !important;
  min-height: 32px !important;
  max-width: none !important;
  line-height: 0;
}

.mb-recipient-tagify-wrap .tagify__dropdown__item .avatar-sm,
.mb-recipient-tagify-wrap .tagify__tag .avatar-xs,
.mb-recipient-tagify-wrap .mb-broadcast-avatar-img.avatar-xs,
.mb-recipient-tagify-wrap .mb-broadcast-avatar-fallback.avatar-xs {
  width: 28px;
  height: 28px;
  object-fit: cover;
}
.mb-recipient-tagify-wrap .mb-broadcast-avatar-img.avatar-sm,
.mb-recipient-tagify-wrap .mb-broadcast-avatar-fallback.avatar-sm {
  width: 32px;
  height: 32px;
  object-fit: cover;
}
.mb-recipient-tagify-wrap .tagify__tag .avatar-initials.avatar-xs {
  width: 28px;
  height: 28px;
  min-width: 28px;
  font-size: 0.65rem;
}
.mb-recipient-tagify-wrap .tagify__dropdown__item .avatar-initials.avatar-sm {
  width: 32px;
  height: 32px;
  min-width: 32px;
  font-size: 0.7rem;
}

/*
 * HR wizard modals: avoid modal-dialog-centered (min-height ~100vh + flex) and
 * modal-dialog-scrollable (forces full height). Use a plain dialog that shrink-wraps.
 * Tall steps scroll inside .modal-body only when needed.
 */
#modal-hr-edit-user .hr-modal-dialog,
#modal-hr-add-employee .hr-modal-dialog {
  margin-left: auto;
  margin-right: auto;
}
#modal-hr-edit-user .hr-modal-dialog .modal-content,
#modal-hr-add-employee .hr-modal-dialog .modal-content {
  max-height: calc(100vh - 2.5rem);
  max-height: calc(100dvh - 2.5rem);
  display: flex;
  flex-direction: column;
}
/* Override theme flex:1 on body so it cannot absorb phantom space; allow scroll when tall */
#modal-hr-edit-user .hr-modal-dialog .modal-body,
#modal-hr-add-employee .hr-modal-dialog .modal-body {
  flex: 0 1 auto !important;
  overflow-y: auto;
  max-height: calc(100vh - 11rem);
  max-height: calc(100dvh - 11rem);
}
/* Nav pills: no fixed min-height - it made the left column taller than short tabs (e.g. Contact), stretching the row */
#modal-hr-edit-user .ins-wizard [data-wizard-nav] > .nav-item > .nav-link,
#modal-hr-add-employee .ins-wizard [data-wizard-nav] > .nav-item > .nav-link {
  display: flex;
  align-items: center;
}

/* Unsaved-changes confirmation (global #manageros-modal-unsaved; HR + /users/) - full red frame */
.hr-unsaved-confirm {
  border: 3px solid #c82333 !important;
  box-shadow:
    0 1.25rem 3rem rgba(220, 53, 69, 0.12),
    0 0.5rem 1.5rem rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset !important;
}
.hr-unsaved-confirm-icon {
  width: 4.75rem;
  height: 4.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 25%, #fff8f8 0%, #ffe8ea 45%, #ffd6da 100%);
  border: 2px solid rgba(220, 53, 69, 0.35);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.8) inset,
    0 10px 28px rgba(220, 53, 69, 0.18);
}
.hr-unsaved-confirm-icon .ti {
  font-size: 2.35rem;
  color: #c82333;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.6));
}
#manageros-modal-unsaved .modal-dialog {
  max-width: 420px;
}
#manageros-modal-unsaved .btn-primary {
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.25);
}
#manageros-modal-unsaved .btn-outline-danger:hover {
  box-shadow: 0 2px 10px rgba(220, 53, 69, 0.2);
}

/* Advisories: category headers + compact table (default / table-sm sizing) */
.advisory-list-page .advisory-table-wrap {
  overflow-x: auto;
}
.advisory-list-page .advisory-table th {
  white-space: nowrap;
  font-weight: 600;
}
.advisory-list-page .advisory-table .adv-col-title {
  min-width: 200px;
}
.adv-row:hover {
  background-color: var(--bs-tertiary-bg, rgba(0, 0, 0, 0.04));
}
.adv-cat-header {
  font-size: 1rem;
  font-weight: 600;
  color: var(--bs-body-color);
}
.adv-affected-list li {
  margin-bottom: 0.25rem;
}
.adv-ai-content {
  line-height: 1.5;
}
.adv-ai-content pre {
  white-space: pre-wrap;
}
.adv-new-badge {
  background: linear-gradient(135deg, #e7f1ff 0%, #d4e8ff 100%);
  color: #0d47a1 !important;
  border: 1px solid rgba(13, 110, 253, 0.25);
  font-weight: 600;
  font-size: 0.7rem;
}

.btn-outline-black {
 --ins-btn-color: black;
 --ins-btn-bg: transparent;
 --ins-btn-border-color: black;
 --ins-btn-hover-bg: black;
 --ins-btn-hover-color: white;
 --ins-btn-hover-border-color: black;
 --ins-btn-focus-shadow-rgb: gray;
 --ins-btn-active-bg: black;
 --ins-btn-active-border-color: black;
}

/* /reports/ - full card is one link; hover + keyboard focus highlight.
   App theme uses --ins-* variables; --bs-primary is often undefined so border-color looked unchanged.
   .border and .shadow-sm both use !important - match with !important and add an outline ring so the frame always reads. */
a.report-card-tile {
  color: inherit;
}
a.report-card-tile .card {
  transition: outline-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  cursor: pointer;
  outline: 2px solid transparent !important;
  outline-offset: -2px;
}
a.report-card-tile:hover .card {
  border-color: var(--ins-primary) !important;
  outline-color: var(--ins-primary) !important;
  box-shadow: var(--ins-box-shadow-sm), 0 0.375rem 1rem rgba(var(--ins-primary-rgb), 0.22) !important;
}
a.report-card-tile:focus-visible {
  outline: none;
}
a.report-card-tile:focus-visible .card {
  border-color: var(--ins-primary) !important;
  outline-color: var(--ins-primary) !important;
  box-shadow: var(--ins-box-shadow-sm), 0 0 0 0.25rem rgba(var(--ins-primary-rgb), 0.35) !important;
}

/* /reports/ — SaaS-style reporting hub (catalog + classic); theme via scoped CSS variables.
   Same token names in light + dark (values switch on html[data-bs-theme="dark"]):
   --rep-hub-bg-primary (page), --rep-hub-bg-secondary (section shells), --rep-hub-bg-card (KPI + table),
   --rep-hub-text-primary / --rep-hub-text-muted, --rep-hub-border-color / --rep-hub-border-subtle */
.reports-hub-page {
  /* Surfaces */
  --rep-hub-bg-primary: var(--bs-tertiary-bg, #f1f5f9);
  --rep-hub-bg-secondary: var(--bs-body-bg, #ffffff);
  --rep-hub-bg-card: var(--bs-body-bg, #ffffff);
  --rep-hub-bg-elevated: var(--bs-tertiary-bg, #f1f3f5);
  --rep-hub-bg-row-alt: color-mix(in srgb, var(--bs-emphasis-color, #0f172a) 3.5%, var(--bs-body-bg, #fff));
  --rep-hub-bg-row-hover: color-mix(in srgb, var(--bs-emphasis-color, #0f172a) 7%, var(--bs-body-bg, #fff));
  /* Typography */
  --rep-hub-text-primary: var(--bs-emphasis-color, #0f172a);
  --rep-hub-text-muted: var(--bs-secondary-color, #64748b);
  /* Chrome */
  --rep-hub-border-color: color-mix(in srgb, var(--bs-emphasis-color, #0f172a) 10%, transparent);
  --rep-hub-border-subtle: color-mix(in srgb, var(--bs-emphasis-color, #0f172a) 6%, transparent);
  --rep-hub-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.06);
  --rep-hub-shadow-kpi-hover: 0 4px 14px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.05);
  /* Tabs */
  --rep-hub-tab-active-fg: var(--ins-primary, var(--bs-primary, #2563eb));
  --rep-hub-tab-active-bg: color-mix(in srgb, var(--ins-primary, var(--bs-primary, #2563eb)) 10%, transparent);
  --rep-hub-tab-active-border: color-mix(in srgb, var(--ins-primary, var(--bs-primary, #2563eb)) 22%, transparent);
  --rep-hub-tab-hover-bg: var(--bs-secondary-bg, #f1f5f9);
  /* KPI accents (left rail + icon wells) */
  --rep-hub-accent-blue: var(--ins-primary, var(--bs-primary, #2563eb));
  --rep-hub-accent-purple: #7c3aed;
  --rep-hub-accent-teal: #0d9488;
  --rep-hub-accent-orange: #ea580c;
  --rep-hub-accent-neutral: #64748b;
  /* Type / Report badges */
  --rep-hub-badge-report-fg: #1e40af;
  --rep-hub-badge-report-bg: color-mix(in srgb, #3b82f6 16%, var(--rep-hub-bg-card));
  --rep-hub-badge-report-border: color-mix(in srgb, #3b82f6 30%, transparent);
  --rep-hub-badge-group-fg: #6d28d9;
  --rep-hub-badge-group-bg: color-mix(in srgb, #7c3aed 14%, var(--rep-hub-bg-card));
  --rep-hub-badge-group-border: color-mix(in srgb, #7c3aed 28%, transparent);
  /* Row actions */
  --rep-hub-run-fg: #0f766e;
  --rep-hub-run-bg: #e6f4f1;
  --rep-hub-run-border: color-mix(in srgb, #2d9c8b 22%, #e6f4f1);
  --rep-hub-run-hover-bg: #d8efe9;
  --rep-hub-edit-fg: #f8fafc;
  --rep-hub-edit-bg: color-mix(in srgb, #2563eb 82%, #1e3a8a);
  --rep-hub-edit-border: color-mix(in srgb, #2563eb 55%, #1d4ed8);
  --rep-hub-edit-hover-bg: color-mix(in srgb, #3b82f6 70%, #1e40af);

  /* Aliases (same structure in light/dark; map to tokens above) */
  --bg-primary: var(--rep-hub-bg-primary);
  --bg-secondary: var(--rep-hub-bg-secondary);
  --bg-card: var(--rep-hub-bg-card);
  --text-primary: var(--rep-hub-text-primary);
  --text-muted: var(--rep-hub-text-muted);
  --border-color: var(--rep-hub-border-color);

  color: var(--rep-hub-text-primary);
  background: var(--rep-hub-bg-primary);
  border-radius: 0.75rem;
  padding: 1.25rem 1rem 1.75rem;
  margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
  .reports-hub-page {
    padding: 1.5rem 1.25rem 2rem;
  }
}

html[data-bs-theme="dark"] .reports-hub-page {
  --rep-hub-bg-primary: #0f172a;
  --rep-hub-bg-secondary: #1e293b;
  --rep-hub-bg-card: #1f2937;
  --rep-hub-bg-elevated: #273549;
  --rep-hub-bg-row-alt: rgba(255, 255, 255, 0.028);
  --rep-hub-bg-row-hover: rgba(255, 255, 255, 0.055);
  --rep-hub-text-primary: #e2e8f0;
  --rep-hub-text-muted: #94a3b8;
  --rep-hub-border-color: rgba(255, 255, 255, 0.1);
  --rep-hub-border-subtle: rgba(255, 255, 255, 0.055);
  --rep-hub-shadow-sm: 0 1px 0 rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.28);
  --rep-hub-shadow-kpi-hover: 0 6px 18px rgba(0, 0, 0, 0.38);
  --rep-hub-tab-active-fg: #93c5fd;
  --rep-hub-tab-active-bg: rgba(59, 130, 246, 0.12);
  --rep-hub-tab-active-border: rgba(96, 165, 250, 0.28);
  --rep-hub-tab-hover-bg: rgba(255, 255, 255, 0.05);
  --rep-hub-accent-blue: #60a5fa;
  --rep-hub-accent-purple: #a78bfa;
  --rep-hub-accent-teal: #2dd4bf;
  --rep-hub-accent-orange: #fb923c;
  --rep-hub-accent-neutral: #94a3b8;
  --rep-hub-badge-report-fg: #bfdbfe;
  --rep-hub-badge-report-bg: color-mix(in srgb, #3b82f6 22%, var(--rep-hub-bg-card));
  --rep-hub-badge-report-border: color-mix(in srgb, #60a5fa 34%, transparent);
  --rep-hub-badge-group-fg: #ddd6fe;
  --rep-hub-badge-group-bg: color-mix(in srgb, #7c3aed 20%, var(--rep-hub-bg-card));
  --rep-hub-badge-group-border: color-mix(in srgb, #a78bfa 30%, transparent);
  --rep-hub-run-fg: #5eead4;
  --rep-hub-run-bg: color-mix(in srgb, #2dd4bf 14%, var(--rep-hub-bg-card));
  --rep-hub-run-border: rgba(94, 234, 212, 0.26);
  --rep-hub-run-hover-bg: color-mix(in srgb, #2dd4bf 22%, var(--rep-hub-bg-card));
  --rep-hub-edit-fg: #f1f5f9;
  --rep-hub-edit-bg: color-mix(in srgb, #3b82f6 48%, #1e3a8a);
  --rep-hub-edit-border: rgba(96, 165, 250, 0.35);
  --rep-hub-edit-hover-bg: color-mix(in srgb, #60a5fa 42%, #1d4ed8);
}

.rep-hub-tabular {
  font-variant-numeric: tabular-nums;
}

/* /reports/ KPI row — SaaS-style metric strip (row-cols-md-5) */
.reports-hub-page .rep-hub-kpi-mos-row > .col {
  min-width: 0;
  display: flex;
}

.reports-hub-page .rep-hub-kpi-mos .rep-hub-kpi-card.mos-glass-card.mos-metric {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 1rem 1.1rem !important;
  border-radius: 0.5rem !important;
  background-color: var(--rep-hub-bg-card) !important;
  border: 1px solid var(--rep-hub-border-color) !important;
  border-left-width: 3px !important;
  border-left-style: solid !important;
  border-left-color: var(--rep-hub-accent-blue) !important;
  box-shadow: var(--rep-hub-shadow-sm) !important;
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.reports-hub-page .rep-hub-kpi-mos .rep-hub-kpi-card.mos-glass-card.mos-metric:hover {
  transform: translateY(-2px);
  box-shadow: var(--rep-hub-shadow-kpi-hover) !important;
}

.reports-hub-page .rep-hub-kpi-mos .rep-hub-kpi-card.mos-glass-card.mos-metric.mos-metric--blue {
  border-left-color: var(--rep-hub-accent-blue) !important;
}

.reports-hub-page .rep-hub-kpi-mos .rep-hub-kpi-card.mos-glass-card.mos-metric.mos-metric--violet {
  border-left-color: var(--rep-hub-accent-purple) !important;
}

.reports-hub-page .rep-hub-kpi-mos .rep-hub-kpi-card.mos-glass-card.mos-metric.mos-metric--teal {
  border-left-color: var(--rep-hub-accent-teal) !important;
}

.reports-hub-page .rep-hub-kpi-mos .rep-hub-kpi-card.mos-glass-card.mos-metric.mos-metric--amber {
  border-left-color: var(--rep-hub-accent-orange) !important;
}

.reports-hub-page .rep-hub-kpi-mos .rep-hub-kpi-card.mos-glass-card.mos-metric.mos-metric--neutral {
  border-left-color: var(--rep-hub-accent-neutral) !important;
}

@media (min-width: 992px) {
  .reports-hub-page .rep-hub-kpi-mos .rep-hub-kpi-card.mos-glass-card.mos-metric {
    padding: 1.25rem 1.35rem !important;
  }
}

.reports-hub-page .rep-hub-kpi-mos .mos-metric-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  margin-bottom: 0.2rem;
  color: var(--rep-hub-text-muted) !important;
}

.reports-hub-page .rep-hub-kpi-mos .mos-metric-value {
  font-size: 2rem;
  font-weight: 700 !important;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--rep-hub-text-primary);
}

.reports-hub-page .rep-hub-kpi-mos .mos-metric-value.rep-hub-kpi-most-used-title {
  font-size: 1.125rem;
  font-weight: 700 !important;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--rep-hub-text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.reports-hub-page .rep-hub-kpi-mos .mos-metric-meta {
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.35;
  margin-top: 0.2rem;
  color: var(--rep-hub-text-muted);
  opacity: 0.95;
}

.reports-hub-page .rep-hub-kpi-mos .rep-hub-kpi-mos-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
}

.reports-hub-page .rep-hub-kpi-mos .rep-hub-kpi-mos-icon--blue {
  color: var(--rep-hub-accent-blue);
  background: color-mix(in srgb, var(--rep-hub-accent-blue) 16%, var(--rep-hub-bg-card));
}

.reports-hub-page .rep-hub-kpi-mos .rep-hub-kpi-mos-icon--teal {
  color: var(--rep-hub-accent-teal);
  background: color-mix(in srgb, var(--rep-hub-accent-teal) 16%, var(--rep-hub-bg-card));
}

.reports-hub-page .rep-hub-kpi-mos .rep-hub-kpi-mos-icon--amber {
  color: var(--rep-hub-accent-orange);
  background: color-mix(in srgb, var(--rep-hub-accent-orange) 16%, var(--rep-hub-bg-card));
}

.reports-hub-page .rep-hub-kpi-mos .rep-hub-kpi-mos-icon--violet {
  color: var(--rep-hub-accent-purple);
  background: color-mix(in srgb, var(--rep-hub-accent-purple) 16%, var(--rep-hub-bg-card));
}

.reports-hub-page .rep-hub-kpi-mos .rep-hub-kpi-mos-icon--neutral {
  color: var(--rep-hub-accent-neutral);
  background: color-mix(in srgb, var(--rep-hub-accent-neutral) 18%, var(--rep-hub-bg-card));
}

@media (min-width: 768px) {
  .reports-hub-page .rep-hub-kpi-mos .mos-metric-meta {
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .reports-hub-page .rep-hub-kpi-mos .mos-metric-value.rep-hub-kpi-most-used-title {
    -webkit-line-clamp: 2;
  }
}

@media (max-width: 767.98px) {
  .reports-hub-page .rep-hub-kpi-mos .mos-metric-value {
    font-size: 1.5rem;
  }

  .reports-hub-page .rep-hub-kpi-mos .mos-metric-value.rep-hub-kpi-most-used-title {
    font-size: 1rem;
  }

  .reports-hub-page .rep-hub-kpi-mos .rep-hub-kpi-mos-icon {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 1.05rem;
  }
}

/* Section shells (header, catalog, classic, builder-unavailable) — one step above page canvas */
.reports-hub-page .reports-hub-header.card,
.reports-hub-page .reports-hub-catalog.card,
.reports-hub-page .reports-hub-classic.card,
.reports-hub-page .reports-hub-muted-panel.card {
  background: var(--rep-hub-bg-secondary) !important;
  border: 1px solid var(--rep-hub-border-subtle) !important;
  box-shadow: var(--rep-hub-shadow-sm) !important;
}

.reports-hub-page .reports-hub-header .card-body {
  background: transparent;
  border-radius: 0.75rem;
}

.reports-hub-page .reports-hub-header h1,
.reports-hub-page .reports-hub-header .text-body {
  color: var(--rep-hub-text-primary) !important;
}

.reports-hub-page .reports-hub-header .text-body-secondary {
  color: var(--rep-hub-text-muted) !important;
}

.reports-hub-page .reports-hub-muted-panel .text-body-secondary {
  color: var(--rep-hub-text-muted) !important;
}

.text-purple-rep {
  color: #7c3aed !important;
}

html[data-bs-theme="dark"] .text-purple-rep {
  color: #a78bfa !important;
}

/* Catalog: tabs, filters, table (inherits --rep-hub-* from .reports-hub-page) */
.reports-hub-page .rep-hub-tabs .nav-link {
  border: 1px solid transparent;
  color: var(--rep-hub-text-muted);
  font-weight: 500;
}

.reports-hub-page .rep-hub-tabs .nav-link:hover {
  color: var(--rep-hub-text-primary);
  background: var(--rep-hub-tab-hover-bg);
}

.reports-hub-page .rep-hub-tabs .nav-link.active {
  color: var(--rep-hub-tab-active-fg) !important;
  background: var(--rep-hub-tab-active-bg) !important;
  border-color: var(--rep-hub-tab-active-border) !important;
}

.reports-hub-page .rep-hub-tabs .rep-hub-tab-count {
  font-weight: 600;
  font-size: 0.7rem;
  vertical-align: middle;
  background: var(--rep-hub-bg-row-alt) !important;
  color: var(--rep-hub-text-primary) !important;
  border: 1px solid var(--rep-hub-border-subtle);
}

.reports-hub-page .rep-hub-category-bar {
  border-color: var(--rep-hub-border-subtle) !important;
}

.reports-hub-page .rep-hub-category-bar .text-body-secondary {
  color: var(--rep-hub-text-muted) !important;
}

.reports-hub-page .rep-hub-cat-pill {
  font-weight: 500;
  transition: color 0.12s ease, background-color 0.12s ease, border-color 0.12s ease;
}

.reports-hub-page .rep-hub-cat-pill.btn-outline-secondary {
  color: var(--rep-hub-text-muted);
  border-color: var(--rep-hub-border-color);
  background: transparent;
}

.reports-hub-page .rep-hub-cat-pill:hover {
  color: var(--rep-hub-text-primary);
  background: var(--rep-hub-tab-hover-bg);
  border-color: var(--rep-hub-border-color);
}

.reports-hub-page .rep-hub-cat-pill.active {
  color: var(--rep-hub-tab-active-fg) !important;
  background: var(--rep-hub-tab-active-bg) !important;
  border-color: var(--rep-hub-tab-active-border) !important;
}

.reports-hub-page .rep-hub-cat-pill .rep-hub-cat-pill-badge {
  background: var(--rep-hub-bg-row-alt) !important;
  color: var(--rep-hub-text-primary) !important;
  border: 1px solid var(--rep-hub-border-subtle);
}

.reports-hub-page .reports-hub-catalog > .card-body {
  background: transparent;
}

.reports-hub-page .rep-hub-table-wrap {
  background: var(--rep-hub-bg-card);
  border: 1px solid var(--rep-hub-border-color) !important;
  overflow: hidden;
  box-shadow: var(--rep-hub-shadow-sm);
}

.reports-hub-page .rep-hub-table {
  color: var(--rep-hub-text-primary);
  --bs-table-bg: transparent;
  --bs-table-hover-bg: var(--rep-hub-bg-row-hover);
}

.reports-hub-page .rep-hub-table .text-body {
  color: var(--rep-hub-text-primary) !important;
}

.reports-hub-page .rep-hub-table .text-body-secondary {
  color: var(--rep-hub-text-muted) !important;
}

.reports-hub-page .rep-hub-table thead.rep-hub-thead th.rep-hub-th {
  font-size: 0.6875rem;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--rep-hub-text-muted);
  background: var(--rep-hub-bg-elevated);
  border-bottom: 1px solid var(--rep-hub-border-color);
  padding: 0.65rem 0.75rem;
  white-space: nowrap;
  text-align: left;
  vertical-align: middle;
}

.reports-hub-page .rep-hub-table thead.rep-hub-thead th.rep-hub-th-star {
  text-align: center;
  color: var(--rep-hub-text-muted);
}

.reports-hub-page .rep-hub-table thead.rep-hub-thead th.rep-hub-th-actions {
  text-align: left;
}

.reports-hub-page .rep-hub-table tbody tr.rep-cat-row {
  transition: background-color 0.12s ease;
}

.reports-hub-page .rep-hub-table tbody tr.rep-cat-row:nth-child(even) {
  background-color: var(--rep-hub-bg-row-alt);
}

.reports-hub-page .rep-hub-table tbody tr.rep-cat-row:hover {
  background-color: var(--rep-hub-bg-row-hover) !important;
}

.reports-hub-page .rep-hub-table tbody td {
  padding: 0.95rem 0.75rem;
  vertical-align: middle;
  color: var(--rep-hub-text-primary);
  border-bottom: 1px solid var(--rep-hub-border-subtle);
}

.reports-hub-page .rep-hub-th-star,
.reports-hub-page .rep-hub-td-star {
  width: 2.5rem;
  text-align: center;
  padding-left: 0.5rem !important;
  padding-right: 0.25rem !important;
}

.reports-hub-page .rep-hub-table thead.rep-hub-thead th.rep-hub-th-star {
  padding-left: 0.5rem;
  padding-right: 0.25rem;
}

.reports-hub-page .rep-hub-star {
  line-height: 1;
  border: none !important;
  text-decoration: none !important;
  color: var(--rep-hub-text-muted) !important;
}

.reports-hub-page .rep-hub-star:hover {
  color: var(--rep-hub-text-primary) !important;
}

.reports-hub-page .rep-hub-star:focus-visible {
  box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--rep-hub-accent-blue) 32%, transparent);
  border-radius: 0.25rem;
}

.reports-hub-page .rep-hub-row-icon {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: var(--rep-hub-accent-blue);
  background: color-mix(in srgb, var(--rep-hub-accent-blue) 14%, var(--rep-hub-bg-card));
}

.reports-hub-page .rep-hub-row-icon-group {
  color: var(--rep-hub-accent-purple);
  background: color-mix(in srgb, var(--rep-hub-accent-purple) 14%, var(--rep-hub-bg-card));
}

.rep-hub-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.rep-hub-meta-sub {
  font-size: 0.75rem;
}

.rep-hub-badge {
  font-weight: 600;
  font-size: 0.7rem;
  padding: 0.35em 0.55em;
  border-radius: 0.4rem;
}

.reports-hub-page .rep-hub-badge-report {
  color: var(--rep-hub-badge-report-fg) !important;
  background: var(--rep-hub-badge-report-bg) !important;
  border: 1px solid var(--rep-hub-badge-report-border);
}

.reports-hub-page .rep-hub-badge-group {
  color: var(--rep-hub-badge-group-fg) !important;
  background: var(--rep-hub-badge-group-bg) !important;
  border: 1px solid var(--rep-hub-badge-group-border);
}

/* Row actions: Run (teal) + Edit (desaturated primary) — tokens in .reports-hub-page */
.reports-hub-page .rep-hub-table a.rep-hub-run.btn,
.reports-hub-page .rep-hub-table a.rep-hub-run.btn:visited {
  font-weight: 600;
  background-color: var(--rep-hub-run-bg);
  border: 1px solid var(--rep-hub-run-border);
  color: var(--rep-hub-run-fg) !important;
  box-shadow: none;
}

.reports-hub-page .rep-hub-table a.rep-hub-run.btn:hover {
  background-color: var(--rep-hub-run-hover-bg);
  border-color: var(--rep-hub-run-border);
  color: var(--rep-hub-run-fg) !important;
}

.reports-hub-page .rep-hub-table a.rep-hub-run.btn:focus-visible {
  background-color: var(--rep-hub-run-hover-bg);
  border-color: var(--rep-hub-run-border);
  color: var(--rep-hub-run-fg) !important;
  box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--rep-hub-accent-teal) 22%, transparent);
}

.reports-hub-page .rep-hub-table a.rep-hub-edit.btn,
.reports-hub-page .rep-hub-table a.rep-hub-edit.btn:visited {
  font-weight: 600;
  background-color: var(--rep-hub-edit-bg);
  border: 1px solid var(--rep-hub-edit-border);
  color: var(--rep-hub-edit-fg) !important;
  box-shadow: none;
}

.reports-hub-page .rep-hub-table a.rep-hub-edit.btn:hover {
  background-color: var(--rep-hub-edit-hover-bg);
  border-color: var(--rep-hub-edit-border);
  color: var(--rep-hub-edit-fg) !important;
}

.reports-hub-page .rep-hub-table a.rep-hub-edit.btn:focus-visible {
  background-color: var(--rep-hub-edit-hover-bg);
  border-color: var(--rep-hub-edit-border);
  color: var(--rep-hub-edit-fg) !important;
  box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--rep-hub-accent-blue) 22%, transparent);
}

.reports-hub-page .rep-hub-more-trigger {
  width: 2.125rem;
  height: 2.125rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  background: var(--rep-hub-bg-card);
  border: 1px solid var(--rep-hub-border-color);
  color: var(--rep-hub-text-muted);
  line-height: 1;
}

.reports-hub-page .rep-hub-more-trigger:hover,
.reports-hub-page .rep-hub-more-trigger:focus-visible {
  background: var(--rep-hub-bg-row-hover);
  border-color: var(--rep-hub-border-color);
  color: var(--rep-hub-text-primary);
}

.reports-hub-page .rep-hub-more-trigger .ti {
  font-size: 1.15rem;
}

.reports-hub-page .rep-hub-table .dropdown-menu {
  background: var(--rep-hub-bg-secondary);
  border: 1px solid var(--rep-hub-border-color);
  box-shadow: var(--rep-hub-shadow-sm);
}

.reports-hub-page .rep-hub-table .dropdown-item {
  color: var(--rep-hub-text-primary);
}

.reports-hub-page .rep-hub-table .dropdown-item:hover,
.reports-hub-page .rep-hub-table .dropdown-item:focus {
  background: var(--rep-hub-bg-row-hover);
  color: var(--rep-hub-text-primary);
}

.reports-hub-page .rep-hub-table .dropdown-item .text-body-secondary {
  color: var(--rep-hub-text-muted) !important;
}

.reports-hub-page .rep-hub-fav-section h2,
.reports-hub-page .rep-hub-fav-section .h6 {
  color: var(--rep-hub-text-primary);
}

.reports-hub-page .rep-hub-fav-pill.btn-light {
  background: var(--rep-hub-bg-card) !important;
  color: var(--rep-hub-text-primary) !important;
  border-color: var(--rep-hub-border-color) !important;
  box-shadow: var(--rep-hub-shadow-sm) !important;
}

.reports-hub-page .rep-hub-fav-pill.btn-light:hover {
  background: var(--rep-hub-bg-row-hover) !important;
  border-color: var(--rep-hub-border-color) !important;
}

.reports-hub-page .rep-hub-fav-pill {
  font-weight: 500;
  max-width: 100%;
}

.reports-hub-page .rep-hub-fav-pill span {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  vertical-align: bottom;
}

.reports-hub-page .rep-hub-empty-icon {
  width: 3.5rem;
  height: 3.5rem;
  background: color-mix(in srgb, var(--rep-hub-accent-blue) 14%, var(--rep-hub-bg-card));
  color: var(--rep-hub-accent-blue);
  font-size: 1.75rem;
}

.reports-hub-page .rep-hub-empty h3 {
  color: var(--rep-hub-text-primary);
}

.reports-hub-page .rep-hub-empty-copy {
  max-width: 28rem;
  color: var(--rep-hub-text-muted);
}

.reports-hub-page .rep-hub-empty .btn-primary {
  background-color: var(--rep-hub-edit-bg);
  border-color: var(--rep-hub-edit-border);
  color: var(--rep-hub-edit-fg) !important;
}

.reports-hub-page .rep-hub-empty .btn-primary:hover,
.reports-hub-page .rep-hub-empty .btn-primary:focus-visible {
  background-color: var(--rep-hub-edit-hover-bg);
  border-color: var(--rep-hub-edit-border);
  color: var(--rep-hub-edit-fg) !important;
}

.reports-hub-page .rep-hub-empty .btn-outline-primary {
  color: var(--rep-hub-tab-active-fg);
  border-color: var(--rep-hub-tab-active-border);
  background: transparent;
}

.reports-hub-page .rep-hub-empty .btn-outline-primary:hover,
.reports-hub-page .rep-hub-empty .btn-outline-primary:focus-visible {
  color: var(--rep-hub-tab-active-fg);
  background: var(--rep-hub-tab-active-bg);
  border-color: var(--rep-hub-tab-active-border);
}

.reports-hub-page .reports-hub-classic > .card-body {
  background: transparent;
}

/* Classic report tiles: calm hover/focus (scoped; global a.report-card-tile rules still apply as base) */
.reports-hub-page a.report-card-tile .card {
  background: var(--rep-hub-bg-card) !important;
  border-color: var(--rep-hub-border-subtle) !important;
  box-shadow: var(--rep-hub-shadow-sm) !important;
}

.reports-hub-page a.report-card-tile:hover .card {
  border-color: color-mix(in srgb, var(--rep-hub-accent-blue) 38%, var(--rep-hub-border-color)) !important;
  outline: 1px solid color-mix(in srgb, var(--rep-hub-accent-blue) 28%, transparent) !important;
  outline-offset: -1px;
  box-shadow: var(--rep-hub-shadow-kpi-hover) !important;
}

.reports-hub-page a.report-card-tile:focus-visible .card {
  border-color: color-mix(in srgb, var(--rep-hub-accent-blue) 45%, var(--rep-hub-border-color)) !important;
  outline: 2px solid color-mix(in srgb, var(--rep-hub-accent-blue) 35%, transparent) !important;
  outline-offset: -2px;
  box-shadow: var(--rep-hub-shadow-sm) !important;
}

.reports-hub-page .reports-hub-classic .report-card-tile .text-body-secondary {
  color: var(--rep-hub-text-muted) !important;
}

.reports-hub-page .reports-hub-classic .report-card-tile h3 {
  color: var(--rep-hub-text-primary);
}

.reports-hub-page .reports-hub-classic .btn-outline-primary {
  color: var(--rep-hub-tab-active-fg);
  border-color: var(--rep-hub-tab-active-border);
  background: transparent;
}

.reports-hub-page .reports-hub-classic .btn-outline-primary:hover,
.reports-hub-page .reports-hub-classic .btn-outline-primary:focus-visible {
  color: var(--rep-hub-tab-active-fg);
  background: var(--rep-hub-tab-active-bg);
  border-color: var(--rep-hub-tab-active-border);
}

/* /patch-management/ - outer shell: primary-tinted frame (matches report-card-tile --ins-primary accent) */
.card.patch-mgmt-shell {
  border: 1px solid var(--ins-primary, var(--bs-primary, #0d6efd)) !important;
  box-shadow: var(--ins-box-shadow-sm) !important;
}
/* Overview stat tiles: avoid stretched column height (h-100) leaving dead space under content */
a.patch-mgmt-overview-jump .patch-mgmt-overview-card-body {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}
a.patch-mgmt-overview-jump .patch-mgmt-overview-card-body > .h4 {
  line-height: 1.2;
}

/* ManagerOS notify modals (SweetAlert2): primary OK + readable label in dark (Inspinia uses --ins-btn-*) */
html[data-bs-theme="dark"] .swal2-popup .swal2-confirm.btn-primary {
  --ins-btn-color: #0f172a;
  --ins-btn-bg: var(--bs-primary);
  --ins-btn-border-color: var(--bs-primary);
  --ins-btn-hover-color: #020617;
  --ins-btn-hover-bg: #93c5fd;
  --ins-btn-hover-border-color: #93c5fd;
  --ins-btn-active-color: #020617;
  --ins-btn-active-bg: #7dd3fc;
  --ins-btn-active-border-color: #7dd3fc;
  color: #0f172a !important;
}

/* Automation rules: delete confirm (SweetAlert2) — spacing + icon buttons, centered */
.swal2-popup .swal2-actions.swal2-actions-ar {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem !important;
  width: 100%;
  box-sizing: border-box;
}
.swal2-popup .swal2-actions.swal2-actions-ar .swal2-confirm,
.swal2-popup .swal2-actions.swal2-actions-ar .swal2-cancel {
  margin: 0 !important;
}

/* ==========================================================================
   ManagerOS dashboard (light theme) + grouped sidebar subtitles
   ========================================================================== */

.mos-dashboard-root {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.mos-dashboard-body {
  padding-top: 0.25rem;
}

.mos-dashboard {
  color: inherit;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.mos-dashboard-hero {
  color: var(--ins-body-color, var(--bs-body-color, #212529));
  font-weight: 600;
  letter-spacing: -0.02em;
}

.mos-dashboard-sub {
  color: var(--ins-secondary-color, var(--bs-secondary-color, #6c757d));
}

.mos-glass-card {
  background: var(--ins-card-bg, var(--bs-body-bg, #fff));
  border: 1px solid var(--ins-border-color, var(--bs-border-color, #dee2e6));
  border-radius: 12px;
  padding: 1.15rem 1.25rem;
  box-shadow: var(--ins-box-shadow-sm, 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075));
}

/* Dashboard glass cards: soft shadow; border applied per type below */
.mos-dashboard .mos-glass-card {
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 0.25rem 0.75rem rgba(0, 0, 0, 0.06) !important;
}

/* Panels without KPI accent: uniform frame */
.mos-dashboard .mos-glass-card:not(.mos-metric) {
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
}

/* KPI metric tiles: colored left stripe (border shorthand on .mos-glass-card was wiping this) */
.mos-dashboard .mos-glass-card.mos-metric {
  border-top: 1px solid rgba(0, 0, 0, 0.12) !important;
  border-right: 1px solid rgba(0, 0, 0, 0.12) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12) !important;
  border-left: 4px solid var(--ins-primary, var(--bs-primary, #0d6efd)) !important;
}

.mos-dashboard .mos-glass-card.mos-metric.mos-metric--teal {
  border-left-color: #14b8a6 !important;
}

.mos-dashboard .mos-glass-card.mos-metric.mos-metric--cyan {
  border-left-color: #06b6d4 !important;
}

.mos-dashboard .mos-glass-card.mos-metric.mos-metric--blue {
  border-left-color: var(--ins-primary, var(--bs-primary, #0d6efd)) !important;
}

.mos-dashboard .mos-glass-card.mos-metric.mos-metric--amber {
  border-left-color: #f59e0b !important;
}

/* Saved dashboards selector: same horizontal band as KPI row (see .mos-dash-top-stack in index.html) */
.mos-dashboard .mos-dash-saved-card {
  max-width: none;
  width: 100%;
  box-sizing: border-box;
}

.mos-dashboard .mos-dash-top-stack {
  width: 100%;
  max-width: 100%;
  --bs-gutter-x: var(--bs-gutter-x, 1.5rem);
}

/* Dashboard: small screens — readable KPI tiles, stacked saved-dashboard actions, single-column builder grid */
@media (max-width: 575.98px) {
  .mos-dashboard .mos-dash-saved-actions__btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 767.98px) {
  .mos-dashboard-root .mos-dashboard-body {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .mos-dashboard .mos-glass-card {
    padding: 0.85rem 1rem;
  }

  .mos-dashboard .mos-metric-value {
    font-size: 1.7rem;
  }

  .mos-dashboard .mos-metric-meta {
    font-size: 0.8rem;
    line-height: 1.35;
  }

  .mos-fleet-table {
    font-size: 0.8125rem;
  }

  .mos-fleet-table .device-name {
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .mos-fleet-table .mos-icon-btn {
    width: 1.75rem;
    height: 1.75rem;
    margin-left: 0.1rem;
  }

  /* Builder dashboards: one widget per row (inline grid-column on items is overridden) */
  #idxDashGrid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #idxDashGrid > .idx-dash-item {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
  }

  .content-page:has(.mos-dashboard-root) .page-title-head {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.35rem;
  }

  .content-page:has(.mos-dashboard-root) .page-title-head .breadcrumb {
    font-size: 0.8rem;
  }
}

.mos-dashboard .mos-dash-default-hideable {
  min-width: 0;
}

/* Shifts + queues: full content width (sibling row under fleet+rail), queues column first (left in LTR) */
.mos-dashboard .mos-dash-default-hideable > .mos-dash-shifts-queues {
  width: 100%;
  max-width: 100%;
}

.mos-dashboard .mos-dash-shifts-queues .mos-dash-queue-table {
  width: 100%;
  table-layout: auto;
}

.mos-dashboard .mos-dash-shifts-queues .mos-dash-queue-th-member {
  min-width: 7.5rem;
}

/* Helpdesk queue cards: two per row from md+, slightly tighter chrome */
.mos-dashboard .mos-dash-shifts-queues .mos-dash-queue-card .card-header {
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
  font-size: 0.9rem;
}

.mos-dashboard .mos-dash-shifts-queues .mos-dash-queue-card .card-body {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.mos-dashboard .mos-dash-shifts-queues .mos-dash-queue-card .badge {
  font-size: 0.7rem;
}

/* Right column: Gideon insight + compact metric cards */
.mos-dashboard-rail {
  min-width: 0;
}

/* Operating Systems chart: full-width row under fleet + rail (wider pie + side legend on desktop) */
.mos-dashboard .mos-dash-os-chart-row {
  min-width: 0;
}
.mos-dashboard .mos-dash-os-chart--wide.mos-glass-card {
  min-width: 0;
}
.mos-dashboard .mos-dash-os-chart__canvas {
  min-height: 260px;
}
@media (min-width: 992px) {
  .mos-dashboard .mos-dash-os-chart__canvas {
    min-height: 340px;
  }
}
html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dashboard .mos-dash-os-chart-row .mos-glass-card {
  border-color: rgba(255, 255, 255, 0.08);
}

/* Overview rail: “Fleet by platform” donut + outside labels (connector lines + %) */
.mos-dashboard .mos-dash-project-progress.mos-glass-card {
  min-width: 0;
}
.mos-dash-os-family-chart {
  min-height: 288px;
}
html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dashboard .mos-dash-project-progress.mos-glass-card {
  border-color: rgba(255, 255, 255, 0.08);
}

.mos-dashboard .mos-insight-card {
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  background: var(--ins-card-bg, var(--bs-body-bg, #fff));
}

.mos-dashboard .mos-insight-card--compact {
  padding: 0.85rem 1rem !important;
}

.mos-insight-card__head {
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.mos-insight-card__title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--ins-secondary-color, var(--bs-secondary-color, #6c757d));
}

.mos-insight-card__live {
  font-size: 0.72rem;
  line-height: 1.3;
  margin-left: auto;
}

@media (max-width: 1399.98px) {
  .mos-insight-card__live {
    margin-left: 0;
    width: 100%;
    flex-basis: 100%;
  }
}

.mos-insight-card__body {
  margin-bottom: 0.15rem;
}

.mos-insight-card__body + .mos-insight-card__actions {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.mos-insight-issue {
  line-height: 1.4;
  color: var(--ins-body-color, var(--bs-body-color, #212529));
}

.mos-insight-issue__title {
  font-weight: 600;
}

/* Gideon AI copilot insight (Overview rail) — reusable pattern */
.mos-dashboard .mos-gideon-ai-copilot.mos-insight-card {
  padding: 1.25rem 1.4rem 1.35rem !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  border-left: 3px solid rgba(99, 102, 241, 0.5) !important;
  background: rgba(99, 102, 241, 0.055);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 0 0 1px rgba(99, 102, 241, 0.04);
}

.mos-gideon-ai-copilot__head {
  padding-bottom: 0.75rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
}

.mos-gideon-ai-copilot__brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  flex-shrink: 0;
  border-radius: 0.5rem;
  font-size: 1.05rem;
  line-height: 1;
  color: #4f46e5;
  background: rgba(99, 102, 241, 0.14);
}

.mos-gideon-ai-copilot__title {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.3;
  color: var(--ins-body-color, var(--bs-body-color, #212529));
}

.mos-gideon-ai-copilot__status {
  font-size: 0.7rem;
  line-height: 1.35;
  opacity: 0.88;
  max-width: 100%;
}

.mos-gideon-ai-copilot__status .ti {
  opacity: 0.75;
}

@media (max-width: 1399.98px) {
  .mos-gideon-ai-copilot__status {
    flex-basis: 100%;
  }
}

.mos-gideon-ai-copilot__body {
  margin-bottom: 0.35rem;
}

.mos-gideon-ai-copilot__body > .mos-gideon-ai-severity {
  margin-bottom: 0.75rem;
}

.mos-gideon-ai-copilot__narrative {
  font-size: 0.875rem;
  line-height: 1.55;
  margin-bottom: 0;
}

.mos-gideon-ai-copilot__freshness {
  line-height: 1.4;
}

.mos-gideon-ai-severity {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  padding: 0.28rem 0.5rem;
  border-radius: 0.3rem;
}

.mos-gideon-ai-severity--high {
  color: #9a3412;
  background: rgba(254, 215, 170, 0.55);
  border: 1px solid rgba(251, 146, 60, 0.45);
}

.mos-gideon-ai-severity--action {
  color: #854d0e;
  background: rgba(253, 224, 71, 0.35);
  border: 1px solid rgba(234, 179, 8, 0.45);
}

.mos-gideon-ai-copilot__actions {
  margin-top: 1rem;
  padding-top: 0.95rem;
  border-top: 1px solid rgba(15, 23, 42, 0.07);
}

.mos-gideon-ai-copilot__btn-tertiary {
  color: var(--ins-secondary-color, var(--bs-secondary, #6c757d)) !important;
  font-weight: 500;
  margin-left: 0.15rem;
}

.mos-gideon-ai-copilot__btn-tertiary:hover {
  color: var(--ins-body-color, var(--bs-body-color, #212529)) !important;
}

/* ==========================================================================
   Overview / platform home: dark theme depth (scoped to pages with .mos-dashboard-root)
   ========================================================================== */

html[data-bs-theme="dark"]:has(.mos-dashboard-root) body {
  background-color: var(--mos-dark-bg);
  background-image: radial-gradient(
    circle at top,
    var(--mos-dark-surface-2) 0%,
    var(--mos-dark-bg) 60%
  );
  background-repeat: no-repeat;
  background-attachment: fixed;
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) .content-page {
  background-color: var(--mos-dark-bg);
}

/* Sidebar + topbar: blue-slate gradient (all dark pages; dashboard inherits same) */
html[data-bs-theme="dark"] .sidenav-menu {
  background: linear-gradient(165deg, #070b14 0%, #0c1424 38%, #101c32 72%, #0f172a 100%) !important;
  border-right-color: rgba(255, 255, 255, 0.08) !important;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
}

html[data-bs-theme="dark"] .sidenav-menu .menu-icon i {
  color: rgba(186, 205, 230, 0.88);
}

html[data-bs-theme="dark"] .sidenav-menu .side-nav-link:hover .menu-icon i {
  color: #e2e8f0;
}

html[data-bs-theme="dark"] .app-topbar {
  background: linear-gradient(90deg, #0d1526 0%, #111d33 50%, #0f172a 100%) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Dark theme: initials on primary circle — dark label (matches sky accent buttons) */
html[data-bs-theme="dark"] .avatar-initials {
  color: #0f172a !important;
}

/* Topbar: availability, visible, locale, theme — muted slate pills (Inspinia uses --ins-btn-*) */
html[data-bs-theme="dark"] .app-topbar .btn-outline-secondary {
  --ins-btn-color: var(--mos-dark-text);
  --ins-btn-bg: var(--mos-dark-surface-3);
  --ins-btn-border-color: var(--mos-dark-border-strong);
  --ins-btn-hover-color: #f1f5f9;
  --ins-btn-hover-bg: #334155;
  --ins-btn-hover-border-color: rgba(148, 163, 184, 0.35);
  --ins-btn-active-color: #f8fafc;
  --ins-btn-active-bg: #3d4f66;
  --ins-btn-active-border-color: rgba(148, 163, 184, 0.42);
}

html[data-bs-theme="dark"] .app-topbar .btn-outline-secondary:focus-visible {
  box-shadow: 0 0 0 0.2rem var(--mos-dark-accent-soft);
}

/* Menu (hamburger): sky fill + dark glyph (override .btn-primary --ins-btn-color: #fff from theme) */
html[data-bs-theme="dark"] .app-topbar .btn-primary.btn-icon.sidenav-toggle-button {
  --ins-btn-color: #0f172a;
  --ins-btn-bg: var(--bs-primary);
  --ins-btn-border-color: var(--bs-primary);
  --ins-btn-hover-color: #020617;
  --ins-btn-hover-bg: #93c5fd;
  --ins-btn-hover-border-color: #93c5fd;
  --ins-btn-active-color: #020617;
  --ins-btn-active-bg: #7dd3fc;
  --ins-btn-active-border-color: #7dd3fc;
  --ins-btn-disabled-color: #0f172a;
  color: #0f172a !important;
  background-color: var(--bs-primary) !important;
  border-color: var(--bs-primary) !important;
}

html[data-bs-theme="dark"] .app-topbar .btn-primary.btn-icon.sidenav-toggle-button:hover {
  color: #020617 !important;
  background-color: #93c5fd !important;
  border-color: #93c5fd !important;
}

html[data-bs-theme="dark"] .app-topbar .btn-primary.btn-icon.sidenav-toggle-button:focus-visible {
  color: #020617 !important;
  background-color: #93c5fd !important;
  border-color: #93c5fd !important;
}

html[data-bs-theme="dark"] .app-topbar .btn-primary.btn-icon.sidenav-toggle-button:active {
  color: #020617 !important;
  background-color: #7dd3fc !important;
  border-color: #7dd3fc !important;
}

html[data-bs-theme="dark"] .app-topbar .sidenav-toggle-button .ti {
  color: inherit;
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dashboard .mos-glass-card:not(.mos-gideon-ai-copilot) {
  background-color: var(--mos-dark-surface) !important;
  border: 1px solid var(--mos-dark-border) !important;
  box-shadow: var(--mos-dark-shadow-soft) !important;
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dashboard .mos-glass-card.mos-metric {
  border-top-color: var(--mos-dark-border) !important;
  border-right-color: var(--mos-dark-border) !important;
  border-bottom-color: var(--mos-dark-border) !important;
  border-left-width: 3px !important;
  border-left-style: solid !important;
  border-left-color: rgba(96, 165, 250, 0.55) !important;
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dashboard .mos-glass-card.mos-metric.mos-metric--teal {
  border-left-color: rgba(20, 184, 166, 0.55) !important;
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dashboard .mos-glass-card.mos-metric.mos-metric--cyan {
  border-left-color: rgba(34, 211, 238, 0.55) !important;
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dashboard .mos-glass-card.mos-metric.mos-metric--blue {
  border-left-color: rgba(96, 165, 250, 0.55) !important;
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dashboard .mos-glass-card.mos-metric.mos-metric--amber {
  border-left-color: rgba(245, 158, 11, 0.55) !important;
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dashboard .mos-metric:not(.mos-rail-metric--compact) .mos-metric-label {
  color: var(--mos-dark-muted) !important;
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dashboard .mos-metric:not(.mos-rail-metric--compact) .mos-metric-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--mos-dark-text) !important;
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root)
  .mos-dashboard
  .mos-metric:not(.mos-rail-metric--compact)
  .mos-metric-value.mos-metric-value--sm {
  font-size: 1.25rem;
  line-height: 1.25;
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dashboard .metric-label {
  color: var(--mos-dark-muted);
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dashboard .metric-number {
  font-size: 28px;
  font-weight: 600;
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dashboard .btn {
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dashboard .btn-success {
  background: #14c784;
  border-color: transparent;
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dashboard .btn-success:hover {
  background: #19d68f;
  border-color: transparent;
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dashboard .card:not(.mos-dashboard-root) {
  background-color: var(--mos-dark-surface);
  border: 1px solid var(--mos-dark-border);
  box-shadow: var(--mos-dark-shadow-soft);
}

/* Overview Gideon AI insight: dark theme (severity + icon tuned for dark surfaces) */
html[data-bs-theme="dark"] .mos-dashboard .mos-gideon-ai-copilot.gideon-card.mos-insight-card,
html[data-bs-theme="dark"] .mos-dashboard .mos-gideon-ai-copilot.mos-insight-card {
  border: 1px solid rgba(96, 165, 250, 0.22) !important;
  border-left: 3px solid rgba(96, 165, 250, 0.45) !important;
  background: var(--mos-dark-accent-soft);
  box-shadow: var(--mos-dark-shadow-soft), 0 0 20px rgba(96, 165, 250, 0.08);
}

html[data-bs-theme="dark"] .mos-gideon-ai-copilot__head {
  border-bottom-color: var(--mos-dark-border);
}

html[data-bs-theme="dark"] .mos-gideon-ai-copilot__brand-icon {
  color: var(--mos-dark-accent);
  background: var(--mos-dark-accent-soft);
  border: 1px solid rgba(96, 165, 250, 0.35);
}

html[data-bs-theme="dark"] .mos-gideon-ai-severity--high {
  color: #fdba74;
  background: rgba(251, 146, 60, 0.16);
  border-color: rgba(251, 146, 60, 0.4);
}

html[data-bs-theme="dark"] .mos-gideon-ai-severity--action {
  color: #fde68a;
  background: rgba(234, 179, 8, 0.14);
  border-color: rgba(234, 179, 8, 0.38);
}

html[data-bs-theme="dark"] .mos-gideon-ai-copilot__actions {
  border-top-color: var(--mos-dark-border);
}

/* Gideon narrative: spacing + hierarchy (dark overview) */
html[data-bs-theme="dark"] .mos-dashboard .mos-gideon-ai-copilot__narrative,
html[data-bs-theme="dark"] .mos-dashboard .gideon-message {
  line-height: 1.6;
  margin-top: 8px;
}

html[data-bs-theme="dark"] .mos-dashboard .mos-gideon-ai-copilot__narrative:first-child,
html[data-bs-theme="dark"] .mos-dashboard .gideon-message:first-child {
  margin-top: 0;
}

html[data-bs-theme="dark"] .mos-dashboard .mos-gideon-ai-copilot__narrative.text-muted,
html[data-bs-theme="dark"] .mos-dashboard .gideon-message.text-muted {
  color: var(--mos-dark-muted) !important;
}

.mos-dashboard-rail .mos-metric-value--rail {
  font-size: 1.65rem;
}

/* Rail metric CTAs: content width, not stretched */
.mos-rail-side-cards .mos-metric > .btn {
  width: auto;
  align-self: flex-start;
}

/* Users + Locations: compact tiles, one row when both visible */
.mos-rail-side-cards--inline .mos-rail-metric--compact {
  padding: 0.6rem 0.7rem !important;
}

.mos-rail-side-cards--inline .mos-rail-metric--compact .mos-metric-label {
  font-size: 0.62rem;
  margin-bottom: 0.15rem;
  line-height: 1.2;
}

.mos-rail-side-cards--inline .mos-rail-metric--compact .mos-metric-value--rail {
  font-size: 1.15rem;
  line-height: 1.15;
}

.mos-rail-side-cards--inline .mos-rail-metric--compact > .btn {
  margin-top: 0.35rem !important;
  padding: 0.15rem 0.4rem;
  font-size: 0.72rem;
}

.mos-dashboard-rail .mos-glass-card.mos-metric {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.mos-metric-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ins-secondary-color, var(--bs-secondary-color, #6c757d));
  margin-bottom: 0.35rem;
}

.mos-metric-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ins-body-color, var(--bs-body-color, #212529));
}

.mos-metric-value--sm {
  font-size: 1.35rem;
}

.mos-metric--teal {
  border-left: 4px solid #14b8a6;
}

.mos-metric--cyan {
  border-left: 4px solid #06b6d4;
}

.mos-metric--blue {
  border-left: 4px solid var(--ins-primary, var(--bs-primary, #0d6efd));
}

.mos-metric--amber {
  border-left: 4px solid #f59e0b;
}

.mos-metric--violet {
  border-left: 4px solid #7c3aed;
}

.mos-table thead th {
  border-bottom: 1px solid var(--ins-border-color, var(--bs-border-color, #dee2e6));
}

.mos-table tbody tr + tr {
  border-top: 1px solid var(--ins-border-color, rgba(0, 0, 0, 0.08));
}

.mos-status-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--ins-secondary-color, #adb5bd);
}

.mos-status-dot--ok {
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

/* Overview: compact “Top issues” under Device fleet status */
.mos-top-issues-card.mos-glass-card {
  padding: 0.85rem 1rem !important;
}
.mos-top-issues-list {
  margin-bottom: 0;
}
.mos-top-issues-item {
  padding: 0.4rem 0.55rem;
  border-radius: 0.375rem;
  border: 1px solid var(--ins-border-color, var(--bs-border-color, rgba(0, 0, 0, 0.1)));
  background: var(--ins-card-bg, var(--bs-body-bg, #fff));
}
.mos-top-issues-item + .mos-top-issues-item {
  margin-top: 0.45rem;
}
.mos-top-issues-item--critical {
  border-left: 3px solid #dc2626;
}
.mos-top-issues-item--critical .mos-top-issues-icon {
  color: #dc2626;
}
.mos-top-issues-item--warning {
  border-left: 3px solid #ea580c;
}
.mos-top-issues-item--warning .mos-top-issues-icon {
  color: #ea580c;
}
.mos-top-issues-item--caution {
  border-left: 3px solid #ca8a04;
}
.mos-top-issues-item--caution .mos-top-issues-icon {
  color: #d97706;
}
.mos-top-issues-icon {
  font-size: 0.95rem;
  line-height: 1.35;
  margin-top: 0.05rem;
}
.mos-top-issues-line {
  color: var(--ins-body-color, var(--bs-body-color, #212529));
  line-height: 1.35;
  min-width: 0;
}
html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-top-issues-item {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Dashboard fleet row: Font Awesome health icon (computers list uses .mos-fleet-health-icon small) */
.mos-fleet-health-icon {
  font-size: 0.7rem;
  line-height: 1;
  vertical-align: middle;
}

/* Overview fleet table: status + hostname (ManagerOS concept) */
.mos-fleet-table tbody tr.device-row:hover {
  /* Theme-aware: light = subtle dark tint; dark = subtle light tint (was hardcoded #f7f9fc). */
  background-color: rgba(var(--bs-emphasis-color-rgb, 33, 37, 41), 0.075);
}

html[data-bs-theme="dark"] .mos-fleet-table tbody tr.device-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

html[data-bs-theme="dark"] .mos-fleet-table tbody tr + tr {
  border-top: none !important;
}

html[data-bs-theme="dark"] .mos-fleet-table tbody tr.device-row:hover {
  background-color: rgba(255, 255, 255, 0.03) !important;
}

@keyframes gideon-overview-device-pulse {
  0% {
    opacity: 0.8;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.8;
  }
}

html[data-bs-theme="dark"] .mos-fleet-table .device-status-icon.device-online {
  animation: gideon-overview-device-pulse 2.5s ease-in-out infinite;
}

.mos-fleet-table .device-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.mos-fleet-table .device-status-icon {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.mos-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin-left: 0.15rem;
  border-radius: 10px;
  color: var(--ins-body-color, #495057);
  background: var(--ins-light-bg-subtle, #f8f9fa);
  border: 1px solid var(--ins-border-color, #dee2e6);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.mos-icon-btn:hover {
  color: var(--ins-primary, #0d6efd);
  background: var(--bs-body-bg, #fff);
  border-color: var(--ins-primary, #0d6efd);
}

html[data-bs-theme="dark"] .mos-icon-btn:hover {
  background: var(--bs-secondary-bg);
}

/* Dashboard fleet: CPU / RAM / disk meters (device_monitor_current + extra.filesystems) */
.mos-fleet-health-cell {
  vertical-align: middle;
}

.mos-fleet-health {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 7.5rem;
}

.mos-health-meter {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.mos-fleet-health .health-metric {
  margin-bottom: 4px;
}

.mos-fleet-health .health-metric:last-child {
  margin-bottom: 0;
}

.mos-fleet-health .mos-health-meter--hint {
  cursor: help;
}

.mos-health-meter__icon {
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--ins-secondary-color, var(--bs-secondary-color, #6c757d));
  opacity: 0.9;
}

.mos-fleet-progress {
  flex: 1 1 auto;
  min-width: 0;
  height: 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.mos-fleet-progress .progress-bar {
  border-radius: 999px;
}

.mos-fleet-progress--cpu .progress-bar {
  background: linear-gradient(90deg, #16a34a, #22c55e);
}

.mos-fleet-progress--mem .progress-bar {
  background: linear-gradient(90deg, #0284c7, #38bdf8);
}

.mos-fleet-progress--disk .progress-bar {
  background: linear-gradient(90deg, #475569, #64748b);
}

.mos-fleet-progress--warn {
  box-shadow: 0 0 0 1px rgba(234, 179, 8, 0.45);
}

.mos-fleet-progress--warn .progress-bar {
  background: linear-gradient(90deg, #ca8a04, #eab308) !important;
}

.mos-health-meter__pct {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  color: var(--ins-secondary-color, var(--bs-secondary-color, #6c757d));
  min-width: 2.1rem;
  text-align: right;
}

.mos-pulse-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #3b82f6;
  box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5);
  animation: mos-pulse 2s ease-out infinite;
}

@keyframes mos-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.45);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

/* Sidebar: grouped nav subtitles + softer group rows */
.sidenav-menu .side-nav-group > .side-nav-link .menu-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  line-height: 1.25;
}

.sidenav-menu .menu-label {
  font-weight: 600;
}

.sidenav-menu .menu-subtitle {
  display: block;
  font-size: 0.68rem;
  font-weight: 400;
  opacity: 0.55;
  max-width: 11rem;
  white-space: normal;
}

.sidenav-menu .side-nav-item:not(.side-nav-group) .menu-subtitle {
  margin-top: 0.15rem;
}

.sidenav-menu .sub-menu .side-nav-link {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

/* --------------------------------------------------------------------------
   Dark theme: global Bootstrap surface overrides (ManagerOS palette).
   -------------------------------------------------------------------------- */
html[data-bs-theme="dark"] .card-header.bg-white {
  background-color: var(--mos-dark-surface-2) !important;
  border-color: var(--mos-dark-border) !important;
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .table th.bg-light,
html[data-bs-theme="dark"] .table td.bg-light {
  background-color: var(--mos-dark-surface-2) !important;
  border-color: var(--mos-dark-border);
}

/* =============================================================================
   ManagerOS dark mode — page polish (Passes 1–4)
   Uses --mos-dark-* tokens; hierarchy: page bg → card → header strip → table thead
   ============================================================================= */

/* ----- Pass 1: Dashboard + device pages ----- */

html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dashboard-hero {
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dashboard-sub,
html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dashboard .text-muted {
  color: var(--mos-dark-muted) !important;
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dashboard .mos-insight-card {
  background: var(--mos-dark-surface) !important;
  border: 1px solid var(--mos-dark-border) !important;
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dash-queue-card {
  background: var(--mos-dark-surface) !important;
  border: 1px solid var(--mos-dark-border) !important;
  box-shadow: var(--mos-dark-shadow-soft);
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dash-queue-card > .card-header {
  background: var(--mos-dark-surface-2) !important;
  border-color: var(--mos-dark-border) !important;
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dash-queue-card .mos-dash-queue-th-member,
html[data-bs-theme="dark"]:has(.mos-dashboard-root) .mos-dash-queue-table thead th {
  color: var(--mos-dark-muted);
  border-color: var(--mos-dark-border);
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) #idxDashGrid .idx-dash-item.card {
  background: var(--mos-dark-surface) !important;
  border: 1px solid var(--mos-dark-border) !important;
  box-shadow: var(--mos-dark-shadow-soft) !important;
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) #idxDashGrid .idx-dash-item .card-header.bg-white {
  background: var(--mos-dark-surface-2) !important;
  border-color: var(--mos-dark-border) !important;
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) #idxDashGrid .idx-dash-item .card-body {
  background: transparent;
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) #idxDashGrid .table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-accent-bg: rgba(255, 255, 255, 0.035);
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"]:has(.mos-dashboard-root) #idxDashGrid .table > :not(caption) > * > * {
  border-color: var(--mos-dark-border);
}

/* Device monitor (/monitor/) */
html[data-bs-theme="dark"] .mos-device-monitor-page > .card {
  background: var(--mos-dark-surface) !important;
  border: 1px solid var(--mos-dark-border) !important;
  box-shadow: var(--mos-dark-shadow-soft) !important;
}

html[data-bs-theme="dark"] .mos-device-monitor-page > .card > .card-body {
  background: transparent;
}

html[data-bs-theme="dark"] .mos-device-monitor-page .card.bg-light.border-0 {
  background: var(--mos-dark-surface-2) !important;
  border: 1px solid var(--mos-dark-border) !important;
}

html[data-bs-theme="dark"] .mos-device-monitor-page .card .card-header.bg-white {
  background: var(--mos-dark-surface-3) !important;
  border-color: var(--mos-dark-border) !important;
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .mos-device-monitor-page .btn-check:checked + .btn-outline-secondary {
  background: var(--mos-dark-accent-soft);
  border-color: rgba(96, 165, 250, 0.45);
  color: var(--mos-dark-accent);
}

/* Computers list: filter toggles + table body + code/pre panels */
html[data-bs-theme="dark"] .card:has(#computers-page-content) .btn-check:checked + .btn-outline-secondary {
  background: #3d4f66 !important;
  border-color: rgba(148, 163, 184, 0.42) !important;
  color: #f8fafc !important;
}

/* Computers page — dark: same slate pills as app topbar (availability, locale, etc.) */
html[data-bs-theme="dark"] .card:has(#computers-page-content) .btn-outline-secondary,
html[data-bs-theme="dark"] .card:has(#computers-page-content) a.btn-outline-secondary {
  --ins-btn-color: var(--mos-dark-text);
  --ins-btn-bg: var(--mos-dark-surface-3);
  --ins-btn-border-color: var(--mos-dark-border-strong);
  --ins-btn-hover-color: #f1f5f9;
  --ins-btn-hover-bg: #334155;
  --ins-btn-hover-border-color: rgba(148, 163, 184, 0.35);
  --ins-btn-focus-shadow-rgb: 96, 165, 250;
  --ins-btn-active-color: #f8fafc;
  --ins-btn-active-bg: #3d4f66;
  --ins-btn-active-border-color: rgba(148, 163, 184, 0.42);
  --ins-btn-disabled-color: var(--mos-dark-muted);
  --ins-btn-disabled-bg: var(--mos-dark-surface-2);
  --ins-btn-disabled-border-color: var(--mos-dark-border);
}

html[data-bs-theme="dark"] .card:has(#computers-page-content) .btn-outline-primary,
html[data-bs-theme="dark"] .card:has(#computers-page-content) a.btn-outline-primary,
html[data-bs-theme="dark"] .card:has(#computers-page-content) button.btn-outline-primary {
  --ins-btn-color: var(--mos-dark-text);
  --ins-btn-bg: var(--mos-dark-surface-3);
  --ins-btn-border-color: var(--mos-dark-border-strong);
  --ins-btn-hover-color: #f1f5f9;
  --ins-btn-hover-bg: #334155;
  --ins-btn-hover-border-color: rgba(148, 163, 184, 0.35);
  --ins-btn-focus-shadow-rgb: 96, 165, 250;
  --ins-btn-active-color: #f8fafc;
  --ins-btn-active-bg: #3d4f66;
  --ins-btn-active-border-color: rgba(148, 163, 184, 0.42);
  --ins-btn-disabled-color: var(--mos-dark-muted);
  --ins-btn-disabled-bg: var(--mos-dark-surface-2);
  --ins-btn-disabled-border-color: var(--mos-dark-border);
}

html[data-bs-theme="dark"] .card:has(#computers-page-content) .btn-outline-secondary:focus-visible,
html[data-bs-theme="dark"] .card:has(#computers-page-content) a.btn-outline-secondary:focus-visible,
html[data-bs-theme="dark"] .card:has(#computers-page-content) .btn-outline-primary:focus-visible {
  box-shadow: 0 0 0 0.2rem var(--mos-dark-accent-soft);
}

html[data-bs-theme="dark"] .card:has(#computers-page-content) .btn-primary,
html[data-bs-theme="dark"] .card:has(#computers-page-content) a.btn-primary,
html[data-bs-theme="dark"] .card:has(#computers-page-content) button.btn-primary {
  --ins-btn-color: var(--mos-dark-text);
  --ins-btn-bg: var(--mos-dark-surface-3);
  --ins-btn-border-color: var(--mos-dark-border-strong);
  --ins-btn-hover-color: #f1f5f9;
  --ins-btn-hover-bg: #334155;
  --ins-btn-hover-border-color: rgba(148, 163, 184, 0.35);
  --ins-btn-focus-shadow-rgb: 96, 165, 250;
  --ins-btn-active-color: #f8fafc;
  --ins-btn-active-bg: #3d4f66;
  --ins-btn-active-border-color: rgba(148, 163, 184, 0.42);
  --ins-btn-disabled-color: var(--mos-dark-muted);
  --ins-btn-disabled-bg: var(--mos-dark-surface-2);
  --ins-btn-disabled-border-color: var(--mos-dark-border);
}

/* View toggle: selected mode reads slightly brighter than Install + inactive peers */
html[data-bs-theme="dark"] .card:has(#computers-page-content) .btn-group > .btn-primary,
html[data-bs-theme="dark"] .card:has(#computers-page-content) .btn-group > a.btn-primary {
  --ins-btn-color: #f8fafc;
  --ins-btn-bg: #3d4f66;
  --ins-btn-border-color: rgba(148, 163, 184, 0.42);
  --ins-btn-hover-color: #f8fafc;
  --ins-btn-hover-bg: #465a73;
  --ins-btn-hover-border-color: rgba(148, 163, 184, 0.5);
  --ins-btn-active-color: #f8fafc;
  --ins-btn-active-bg: #4a5f7a;
  --ins-btn-active-border-color: rgba(148, 163, 184, 0.55);
}

html[data-bs-theme="dark"] .card:has(#computers-page-content) .btn-group > .btn-primary:hover,
html[data-bs-theme="dark"] .card:has(#computers-page-content) .btn-group > a.btn-primary:hover {
  --ins-btn-hover-bg: #465a73;
  --ins-btn-hover-border-color: rgba(148, 163, 184, 0.5);
}

html[data-bs-theme="dark"] .card:has(#computers-page-content) #computers-table tbody td {
  border-color: var(--mos-dark-border);
}

html[data-bs-theme="dark"] .card:has(#computers-page-content) #computers-table tbody tr:hover td {
  background-color: rgba(255, 255, 255, 0.04);
}

html[data-bs-theme="dark"] .card:has(#computers-page-content) code.bg-light,
html[data-bs-theme="dark"] .card:has(#computers-page-content) pre.bg-light {
  background: var(--mos-dark-surface-2) !important;
  color: var(--mos-dark-text) !important;
  border: 1px solid var(--mos-dark-border);
}

/* Computer details modal — replace light gray panels */
html[data-bs-theme="dark"] #info-dialog .modal-body .bg-light,
html[data-bs-theme="dark"] #info-dialog .info-dialog-inventory-panes {
  background: var(--mos-dark-surface-2) !important;
  border-color: var(--mos-dark-border) !important;
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] #info-dialog .nav-pills .nav-link {
  background: var(--mos-dark-surface);
  color: var(--mos-dark-text);
  border: 1px solid var(--mos-dark-border);
}

html[data-bs-theme="dark"] #info-dialog .nav-pills .nav-link.active {
  background: var(--mos-dark-accent-soft);
  color: var(--mos-dark-accent);
  border-color: rgba(96, 165, 250, 0.4);
}

html[data-bs-theme="dark"] #rc-session-history-modal .modal-header.bg-light,
html[data-bs-theme="dark"] #status-history-modal .modal-header.bg-light {
  background: var(--mos-dark-surface-2) !important;
  border-bottom: 1px solid var(--mos-dark-border) !important;
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] #rc-session-history-modal .table-responsive.bg-light,
html[data-bs-theme="dark"] #status-history-modal #status-history-modal-content {
  background: var(--mos-dark-surface-2) !important;
  border-color: var(--mos-dark-border) !important;
}

html[data-bs-theme="dark"] #rc-session-history-modal thead th {
  color: var(--mos-dark-muted);
}

/* TV dashboard (standalone body, no .content-page) */
html[data-bs-theme="dark"] body.mos-tv-dashboard {
  background: var(--mos-dark-bg);
}

html[data-bs-theme="dark"] body.mos-tv-dashboard > .card.border-0.shadow-sm {
  background: var(--mos-dark-surface) !important;
  border: 1px solid var(--mos-dark-border) !important;
  box-shadow: var(--mos-dark-shadow-soft) !important;
}

html[data-bs-theme="dark"] body.mos-tv-dashboard .card-header.bg-white {
  background: var(--mos-dark-surface-2) !important;
  border-color: var(--mos-dark-border) !important;
  color: var(--mos-dark-text);
}

/* ----- Pass 2: Helpdesk (list, view, edit, inbox) ----- */

html[data-bs-theme="dark"] .ticket-list-page .card:not(.ticket-card) {
  background: var(--mos-dark-surface) !important;
  border: 1px solid var(--mos-dark-border) !important;
  box-shadow: var(--mos-dark-shadow-soft) !important;
}

html[data-bs-theme="dark"] .ticket-list-page .card-body > .d-flex.justify-content-between:first-child {
  margin-bottom: 1rem;
}

html[data-bs-theme="dark"] .ticket-list-page .ticket-filters {
  background: linear-gradient(180deg, var(--mos-dark-surface-2) 0%, rgba(26, 35, 53, 0.92) 100%);
  border: 1px solid var(--mos-dark-border-strong);
  border-radius: 0.5rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 1px 0 rgba(0, 0, 0, 0.2);
  padding: 0.65rem 0.85rem;
  margin-bottom: 1.25rem;
}

html[data-bs-theme="dark"] .ticket-list-page .ticket-filters .form-label,
html[data-bs-theme="dark"] .ticket-list-page .ticket-count {
  color: var(--mos-dark-muted);
}

html[data-bs-theme="dark"] .ticket-list-page .ticket-table thead.table-light th {
  background-color: var(--mos-dark-thead-elevated) !important;
  color: var(--mos-dark-thead-text) !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25);
}

html[data-bs-theme="dark"] .ticket-list-page .ticket-table thead.table-light th a.text-dark {
  color: var(--mos-dark-thead-text) !important;
}

html[data-bs-theme="dark"] .ticket-list-page .ticket-table tbody td {
  border-color: var(--mos-dark-border);
}

html[data-bs-theme="dark"] .ticket-list-page .ticket-table.table-hover tbody tr:hover > * {
  --bs-table-hover-bg: rgba(96, 165, 250, 0.1);
}

html[data-bs-theme="dark"] .ticket-list-page .col-actions .btn {
  color: #cbd5e1;
  border-color: rgba(255, 255, 255, 0.16);
}

html[data-bs-theme="dark"] .ticket-list-page .col-actions .btn:hover {
  color: #f1f5f9;
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(96, 165, 250, 0.1);
}

html[data-bs-theme="dark"] .ticket-list-page .col-actions .btn-outline-primary {
  color: var(--mos-dark-accent);
  border-color: rgba(96, 165, 250, 0.45);
}

html[data-bs-theme="dark"] .ticket-list-page .col-actions .btn-outline-primary:hover {
  color: #e0f2fe;
  background: rgba(96, 165, 250, 0.16);
}

html[data-bs-theme="dark"] .ticket-list-page .btn-group > .btn-primary,
html[data-bs-theme="dark"] .ticket-list-page .btn-group > a.btn-primary {
  background: var(--mos-dark-accent-soft) !important;
  border-color: rgba(96, 165, 250, 0.45) !important;
  color: var(--mos-dark-accent) !important;
}

html[data-bs-theme="dark"] .ticket-list-page .btn-group > .btn-primary:hover,
html[data-bs-theme="dark"] .ticket-list-page .btn-group > a.btn-primary:hover {
  background: rgba(96, 165, 250, 0.22) !important;
  color: #bfdbfe !important;
}

html[data-bs-theme="dark"] .ticket-list-page .ticket-card {
  background: var(--mos-dark-surface) !important;
  border: 1px solid var(--mos-dark-border) !important;
  box-shadow: var(--mos-dark-shadow-soft) !important;
}

html[data-bs-theme="dark"] .ticket-list-page .ticket-card .card-title a.text-dark {
  color: var(--mos-dark-text) !important;
}

html[data-bs-theme="dark"] .ticket-list-page .tickets-board .board-column.bg-light {
  background: var(--mos-dark-surface-2) !important;
  border-color: var(--mos-dark-border) !important;
}

html[data-bs-theme="dark"] .ticket-list-page .tickets-board .board-column h6 {
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .ticket-list-page .tickets-board .ticket-card {
  background: var(--mos-dark-surface) !important;
  border: 1px solid var(--mos-dark-border) !important;
}

html[data-bs-theme="dark"] .ticket-list-page .tickets-board .ticket-card a.text-dark {
  color: var(--mos-dark-text) !important;
}

html[data-bs-theme="dark"] .ticket-list-page .pagination .page-link {
  background: var(--mos-dark-surface-2);
  border-color: var(--mos-dark-border);
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .ticket-list-page .pagination .page-item.active .page-link {
  background: var(--mos-dark-accent-soft);
  border-color: rgba(96, 165, 250, 0.45);
  color: var(--mos-dark-accent);
}

html[data-bs-theme="dark"] .ticket-list-page .pagination .page-item.disabled .page-link {
  background: var(--mos-dark-surface);
  color: var(--mos-dark-muted);
}

html[data-bs-theme="dark"] .inbox-page .outlook-box.email-app > .card,
html[data-bs-theme="dark"] .inbox-view-page .outlook-box.email-app > .card,
html[data-bs-theme="dark"] .inbox-compose-page .outlook-box.email-app > .card {
  background: var(--mos-dark-surface) !important;
  border-color: var(--mos-dark-border) !important;
}

/* Inbox: left folder panel as a proper card */
html[data-bs-theme="dark"] .inbox-page .outlook-left-menu .card,
html[data-bs-theme="dark"] .inbox-view-page .outlook-left-menu .card,
html[data-bs-theme="dark"] .inbox-compose-page .outlook-left-menu .card {
  background: var(--mos-dark-surface) !important;
  border: 1px solid var(--mos-dark-border) !important;
  box-shadow: var(--mos-dark-shadow-soft);
}

html[data-bs-theme="dark"] .inbox-page .outlook-left-menu .card-body,
html[data-bs-theme="dark"] .inbox-view-page .outlook-left-menu .card-body,
html[data-bs-theme="dark"] .inbox-compose-page .outlook-left-menu .card-body {
  background: transparent;
}

html[data-bs-theme="dark"] .inbox-page .list-group-item.list-group-item-action:not(.active):hover,
html[data-bs-theme="dark"] .inbox-view-page .list-group-item.list-group-item-action:not(.active):hover,
html[data-bs-theme="dark"] .inbox-compose-page .list-group-item.list-group-item-action:not(.active):hover {
  background: rgba(255, 255, 255, 0.055);
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .inbox-page .list-group-item.active,
html[data-bs-theme="dark"] .inbox-view-page .list-group-item.active,
html[data-bs-theme="dark"] .inbox-compose-page .list-group-item.active {
  background: var(--mos-dark-accent-soft) !important;
  border-color: rgba(96, 165, 250, 0.38) !important;
  color: var(--mos-dark-accent) !important;
}

html[data-bs-theme="dark"] .inbox-page .list-group-item.active .ti,
html[data-bs-theme="dark"] .inbox-view-page .list-group-item.active .ti,
html[data-bs-theme="dark"] .inbox-compose-page .list-group-item.active .ti {
  color: inherit;
  opacity: 1;
}

html[data-bs-theme="dark"] .inbox-page .list-group-item .badge.bg-light {
  background: var(--mos-dark-surface-2) !important;
  color: var(--mos-dark-muted) !important;
  border: 1px solid var(--mos-dark-border);
}

html[data-bs-theme="dark"] .inbox-page .table.table-hover tbody tr:hover > * {
  --bs-table-hover-bg: rgba(96, 165, 250, 0.07);
}

html[data-bs-theme="dark"] .inbox-page .card-header.card-bg,
html[data-bs-theme="dark"] .inbox-view-page .card-header.card-bg {
  background: var(--mos-dark-surface-2) !important;
  border-color: var(--mos-dark-border) !important;
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .inbox-page .card-body,
html[data-bs-theme="dark"] .inbox-view-page .card-body {
  background: transparent;
}

html[data-bs-theme="dark"] .inbox-view-page .outlook-box.email-app > .card.border-start-0 {
  background: var(--mos-dark-surface) !important;
}

/* ----- Pass 3: Knowledge base + portal ----- */

html[data-bs-theme="dark"] .content-page .kb-page .btn-light.kb-quick-link {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid var(--mos-dark-border) !important;
  color: var(--mos-dark-text) !important;
}

html[data-bs-theme="dark"] .content-page .kb-page .btn-light.kb-quick-link:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(96, 165, 250, 0.35) !important;
  color: var(--mos-dark-text) !important;
}

html[data-bs-theme="dark"] .content-page .kb-home-page .kb-search-group .btn-primary {
  background: rgba(96, 165, 250, 0.25);
  border-color: rgba(96, 165, 250, 0.45);
  color: #e0f2fe;
}

html[data-bs-theme="dark"] .content-page .kb-home-page .kb-search-group .btn-primary:hover {
  background: rgba(96, 165, 250, 0.35);
  border-color: rgba(96, 165, 250, 0.55);
  color: #fff;
}

html[data-bs-theme="dark"] .portal-hero .text-white-50,
html[data-bs-theme="dark"] .portal-shell .text-muted {
  color: var(--mos-dark-muted) !important;
}

html[data-bs-theme="dark"] .portal-shell .portal-tile,
html[data-bs-theme="dark"] .portal-shell .portal-catalog-card {
  background: var(--mos-dark-surface);
  border: 1px solid var(--mos-dark-border) !important;
  box-shadow: var(--mos-dark-shadow-portal);
}

html[data-bs-theme="dark"] .portal-shell .portal-tile:hover,
html[data-bs-theme="dark"] .portal-shell .portal-catalog-card:hover {
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.48) !important;
  border-color: rgba(96, 165, 250, 0.2) !important;
}

html[data-bs-theme="dark"] .portal-shell .portal-tile .card-body,
html[data-bs-theme="dark"] .portal-shell .portal-catalog-card .card-body {
  background: transparent;
}

html[data-bs-theme="dark"] .portal-shell .table tbody td {
  border-color: var(--mos-dark-border);
}

/* ----- Pass 4: Settings / admin tabs, HR, shared surfaces, modals, pickers ----- */

/* Plain Bootstrap cards (no shadow-sm) in grid columns — e.g. new ticket, many admin lists */
html[data-bs-theme="dark"] .content-page [class*="col-"] > .card:not(.mos-dashboard-root):not(.mos-glass-card):not(.ticket-card):not(.kb-surface-card):not(.kb-cat-card):not(.kb-article-card):not(.portal-tile):not(.portal-catalog-card):not(.idx-dash-item):not(.mos-dash-queue-card) {
  background: var(--mos-dark-surface) !important;
  border: 1px solid var(--mos-dark-border) !important;
  box-shadow: var(--mos-dark-shadow-soft);
}

html[data-bs-theme="dark"] .content-page .card.shadow-sm:not(.mos-dashboard-root):not(.mos-glass-card):not(.kb-surface-card):not(.kb-cat-card):not(.kb-article-card):not(.portal-tile):not(.portal-catalog-card) {
  background: var(--mos-dark-surface) !important;
  border: 1px solid var(--mos-dark-border) !important;
  box-shadow: var(--mos-dark-shadow-soft) !important;
}

html[data-bs-theme="dark"] .content-page .card.border-0.shadow-sm:not(.mos-dashboard-root):not(.kb-surface-card):not(.kb-cat-card):not(.kb-article-card):not(.portal-tile):not(.portal-catalog-card) {
  border: 1px solid var(--mos-dark-border) !important;
}

html[data-bs-theme="dark"] .content-page .card > .card-header.border-0:not(.bg-white):not(.text-white) {
  background: var(--mos-dark-surface-2) !important;
  border-bottom: 1px solid var(--mos-dark-border) !important;
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .content-page .card-header .nav-tabs.card-header-tabs {
  border-bottom-color: var(--mos-dark-border);
}

html[data-bs-theme="dark"] .content-page .card-header .nav-tabs.card-header-tabs .nav-link {
  color: var(--mos-dark-muted);
  border-color: transparent;
}

html[data-bs-theme="dark"] .content-page .card-header .nav-tabs.card-header-tabs .nav-link:hover {
  color: var(--mos-dark-text);
  border-color: var(--mos-dark-border);
}

html[data-bs-theme="dark"] .content-page .card-header .nav-tabs.card-header-tabs .nav-link.active {
  background: var(--mos-dark-accent-soft);
  border-color: rgba(96, 165, 250, 0.35);
  color: var(--mos-dark-accent);
}

html[data-bs-theme="dark"] .content-page .table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-accent-bg: rgba(255, 255, 255, 0.035);
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .content-page .table-hover > tbody > tr:hover > * {
  --bs-table-hover-bg: rgba(255, 255, 255, 0.05);
}

html[data-bs-theme="dark"] .content-page .form-control,
html[data-bs-theme="dark"] .content-page .form-select {
  background-color: var(--mos-dark-surface-2);
  border-color: var(--mos-dark-border-strong);
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .content-page .form-control:focus,
html[data-bs-theme="dark"] .content-page .form-select:focus {
  background-color: var(--mos-dark-surface-2);
  border-color: rgba(96, 165, 250, 0.5);
  color: var(--mos-dark-text);
  box-shadow: 0 0 0 0.2rem var(--mos-dark-accent-soft);
}

html[data-bs-theme="dark"] .content-page .form-control::placeholder {
  color: var(--mos-dark-muted);
}

html[data-bs-theme="dark"] .content-page .input-group-text {
  background: var(--mos-dark-surface-2);
  border-color: var(--mos-dark-border-strong);
  color: var(--mos-dark-muted);
}

html[data-bs-theme="dark"] .content-page .text-muted {
  color: var(--mos-dark-muted) !important;
}

html[data-bs-theme="dark"] .modal-content {
  background: var(--mos-dark-surface);
  border: 1px solid var(--mos-dark-border);
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .modal-header:not(.text-white):not(.info-dialog-header) {
  background: var(--mos-dark-surface-2);
  border-bottom-color: var(--mos-dark-border);
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .modal-footer {
  border-top-color: var(--mos-dark-border);
}

html[data-bs-theme="dark"] .dropdown-menu {
  background: var(--mos-dark-surface);
  border: 1px solid var(--mos-dark-border);
  box-shadow: var(--mos-dark-shadow-soft);
}

html[data-bs-theme="dark"] .dropdown-item {
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .dropdown-item:hover,
html[data-bs-theme="dark"] .dropdown-item:focus {
  background: rgba(255, 255, 255, 0.06);
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .dropdown-divider {
  border-top-color: var(--mos-dark-border);
}

html[data-bs-theme="dark"] .ts-dropdown,
html[data-bs-theme="dark"] .ts-dropdown-content {
  background-color: var(--mos-dark-surface) !important;
  border: 1px solid var(--mos-dark-border) !important;
}

html[data-bs-theme="dark"] .ts-dropdown .option {
  background-color: var(--mos-dark-surface);
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .ts-dropdown .option:hover,
html[data-bs-theme="dark"] .ts-dropdown .option.active,
html[data-bs-theme="dark"] .ts-dropdown .create:hover {
  background-color: var(--mos-dark-surface-2) !important;
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .ts-dropdown .optgroup-header {
  background: var(--mos-dark-surface-3);
  color: var(--mos-dark-muted);
}

html[data-bs-theme="dark"] .mb-recipient-tagify-wrap tags.tagify,
html[data-bs-theme="dark"] .mb-recipient-tagify-wrap .tagify {
  background-color: var(--mos-dark-surface-2) !important;
  border-color: var(--mos-dark-border-strong) !important;
}

html[data-bs-theme="dark"] .mb-recipient-tagify-wrap tags.tagify:focus-within,
html[data-bs-theme="dark"] .mb-recipient-tagify-wrap .tagify.tagify--focus {
  border-color: rgba(96, 165, 250, 0.5) !important;
  box-shadow: 0 0 0 0.2rem var(--mos-dark-accent-soft);
}

html[data-bs-theme="dark"] .tagify__dropdown {
  background: var(--mos-dark-surface);
  border: 1px solid var(--mos-dark-border);
}

html[data-bs-theme="dark"] .tagify__dropdown__item--active {
  background: var(--mos-dark-surface-2);
}

/* daterangepicker (vendors bundle) */
html[data-bs-theme="dark"] .daterangepicker {
  background: var(--mos-dark-surface);
  border: 1px solid var(--mos-dark-border);
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .daterangepicker .calendar-table {
  background: var(--mos-dark-surface);
  border-color: var(--mos-dark-border);
}

html[data-bs-theme="dark"] .daterangepicker .calendar-table td,
html[data-bs-theme="dark"] .daterangepicker .calendar-table th {
  color: var(--mos-dark-text);
}

html[data-bs-theme="dark"] .daterangepicker td.available:hover,
html[data-bs-theme="dark"] .daterangepicker th.available:hover {
  background: var(--mos-dark-surface-2);
}

html[data-bs-theme="dark"] .daterangepicker td.active,
html[data-bs-theme="dark"] .daterangepicker td.active:hover {
  background: var(--mos-dark-accent-soft);
  color: var(--mos-dark-accent);
}

html[data-bs-theme="dark"] .daterangepicker .drp-buttons {
  border-top-color: var(--mos-dark-border);
}

html[data-bs-theme="dark"] .daterangepicker .ranges li:hover {
  background: var(--mos-dark-surface-2);
}

html[data-bs-theme="dark"] .daterangepicker .ranges li.active {
  background: var(--mos-dark-accent-soft);
  color: var(--mos-dark-accent);
}

/* HR / broadcast wizards: scope & recipient boxes that used bg-light */
html[data-bs-theme="dark"] .content-page #hr-ev-aud-scope-targets.bg-light,
html[data-bs-theme="dark"] .content-page #hr-ev-recipient-box.bg-light,
html[data-bs-theme="dark"] .content-page #hr-sv-aud-scope-targets.bg-light,
html[data-bs-theme="dark"] .content-page #hr-sv-recipient-box.bg-light,
html[data-bs-theme="dark"] .content-page #mb-scope-targets-container.bg-light,
html[data-bs-theme="dark"] .content-page #mb-recipient-box.bg-light {
  background: var(--mos-dark-surface-2) !important;
  border-color: var(--mos-dark-border) !important;
}

.bg-manageros-logo {
  background-color: #37517E;
}

/* Deployments: console log row — black terminal look; block table-hover from washing out the row */
#modal-deployment-status .deployment-status-console-cell {
  background-color: #000;
  color: #e0e0e0;
  vertical-align: top;
}
#modal-deployment-status .table-hover > tbody > tr.deployment-status-console-row:hover > .deployment-status-console-cell {
  background-color: #000;
  color: #e0e0e0;
}
#modal-deployment-status .deployment-status-console-pre {
  max-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #e0e0e0;
  background-color: #000;
  border: 1px solid #333;
  border-radius: 0.25rem;
  padding: 0.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
#modal-deployment-status .deployment-status-copy-log-btn {
  flex-shrink: 0;
}

/* Ticket Flow panel: vertical step diagram */
.ticket-flow-diagram {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}
.ticket-flow-diagram-arrow {
  text-align: center;
  color: var(--bs-secondary-color);
  line-height: 1;
  padding: 0.15rem 0;
}
.ticket-flow-diagram-node {
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--bs-border-color);
  background: var(--bs-body-bg);
}
.ticket-flow-diagram-node--completed {
  border-color: var(--bs-success);
  background-color: rgba(25, 135, 84, 0.08);
}
.ticket-flow-diagram-node--awaiting {
  border-color: var(--bs-warning);
  background-color: rgba(255, 193, 7, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 193, 7, 0.45);
}
.ticket-flow-diagram-node--current {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.35);
}
.ticket-flow-diagram-node--upcoming {
  opacity: 0.9;
}
.ticket-flow-diagram-node--skipped {
  opacity: 0.65;
  border-style: dashed;
}
html[data-bs-theme="dark"] .ticket-flow-diagram-node--completed {
  background-color: rgba(25, 135, 84, 0.15);
}
html[data-bs-theme="dark"] .ticket-flow-diagram-node--awaiting {
  background-color: rgba(255, 193, 7, 0.08);
}

/* Flow panel in main column (active ticket flow on view/edit) */
.ticket-flow-panel-main-column {
  border: 2px solid rgba(13, 110, 253, 0.22);
}
.ticket-flow-nav-strip-inner {
  background-color: var(--bs-secondary-bg);
}
html[data-bs-theme="dark"] .ticket-flow-nav-strip-inner {
  background-color: var(--mos-dark-surface-2, rgba(255, 255, 255, 0.04));
}

/* Builder dashboard: status banner widget (query-driven ok / warning / bad) */
/* gh (row span) needs row tracks; ~90px matches layout preview in builder_dashboards */
#bdGrid,
#idxDashGrid,
#tvGrid {
  grid-auto-rows: minmax(90px, auto);
}

.bd-status-banner-wrap {
  min-height: 0;
}

/* Status banner widgets fill their grid cell so layout gw/gh affects real dashboards */
.bd-dash-widget--status-banner {
  align-self: stretch;
  min-height: 0;
}
.bd-dash-widget--status-banner.card {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.bd-dash-widget--status-banner .card-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.bd-dash-widget--status-banner.bd-widget-frameless {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.bd-dash-widget--status-banner.bd-widget-frameless .bd-widget-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.bd-dash-widget--status-banner .bd-status-banner-wrap {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

.bd-status-banner.hugebox {
  border-radius: 3px;
  box-shadow: 1px 1px 11px rgba(0, 0, 0, 0.35);
  min-height: 150px;
  max-width: 100%;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding: 10px;
  position: relative;
  margin-bottom: 0.5rem;
  transition: 0.1s all;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bd-dash-widget--status-banner .bd-status-banner.hugebox {
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 0;
  height: 100%;
}
.bd-status-banner.hugebox.ok {
  background: #198754;
  color: #fff;
}
.bd-status-banner.hugebox.warning {
  background: #fd7e14;
  color: #111;
}
.bd-status-banner.hugebox.bad {
  background: #dc3545;
  color: #fff;
}
.bd-status-banner.hugebox .bd-status-banner-text {
  font-size: clamp(1.25rem, 5vw, 2.75rem);
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.45);
  width: 100%;
  padding: 0.25rem 0.5rem;
  word-break: break-word;
}
.bd-dash-widget--status-banner .bd-status-banner.hugebox .bd-status-banner-text {
  font-size: clamp(1.35rem, 3.2vmin + 0.85rem, 4rem);
}
.bd-status-banner.hugebox.warning .bd-status-banner-text {
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.35);
}
html[data-bs-theme="dark"] .bd-status-banner.hugebox.warning {
  color: #111;
}
html[data-bs-theme="dark"] .bd-status-banner.hugebox {
  box-shadow: 1px 1px 14px rgba(0, 0, 0, 0.55);
}

/* ----- IPAM subnet address grid & table (status / conflict visibility) ----- */
.content-page .ipam-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.content-page .ipam-grid .ipam-tile {
  width: 4.5rem;
  min-height: 2.85rem;
  font-size: 0.7rem;
  padding: 0.2rem 0.15rem;
  text-align: center;
  border-radius: 0.25rem;
  cursor: pointer;
  border: 1px solid var(--bs-border-color, #dee2e6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
}
/* Subnet detail IP table: same pointer affordance as grid tiles and /ipam subnet list */
.content-page #ipam-table tbody tr.ipam-table-row {
  cursor: pointer;
}
.content-page .ipam-grid .ipam-tile-flag {
  font-size: 0.65rem;
  line-height: 1;
}
.content-page .ipam-grid .ipam-tile-ip {
  font-weight: 600;
}
.content-page .ipam-grid .ipam-tile-status {
  font-size: 0.58rem;
  line-height: 1.1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.92;
}
.content-page .ipam-grid .ipam-tile.st0 { background: var(--bs-secondary-bg, #f8f9fa); }
.content-page .ipam-grid .ipam-tile.st1 { background: #cfe2ff; }
.content-page .ipam-grid .ipam-tile.st2 { background: #cff4fc; }
.content-page .ipam-grid .ipam-tile.st3 { background: #fff3cd; }
.content-page .ipam-grid .ipam-tile.st4 { background: #e2e3e5; }
.content-page .ipam-grid .ipam-tile.st5 { background: #f8d7da; }
/* Free / gateway tiles: base colors are light-mode; without these, st0 looks like bright slabs on dark pages */
html[data-bs-theme="dark"] .content-page .ipam-grid .ipam-tile.st0 {
  background: rgba(255, 255, 255, 0.07);
  color: var(--bs-body-color, #dee2e6);
  border-color: rgba(255, 255, 255, 0.14);
}
html[data-bs-theme="dark"] .content-page .ipam-grid .ipam-tile.st0 .ipam-tile-status {
  opacity: 1;
  color: rgba(255, 255, 255, 0.75);
}
html[data-bs-theme="dark"] .content-page .ipam-grid .ipam-tile.st1 { background: rgba(13, 110, 253, 0.35); color: #fff; }
html[data-bs-theme="dark"] .content-page .ipam-grid .ipam-tile.st2 { background: rgba(13, 202, 240, 0.25); color: #e7f8fb; }
html[data-bs-theme="dark"] .content-page .ipam-grid .ipam-tile.st3 { background: rgba(255, 193, 7, 0.25); color: #fff8e6; }
html[data-bs-theme="dark"] .content-page .ipam-grid .ipam-tile.st4 {
  background: rgba(255, 255, 255, 0.11);
  color: var(--bs-body-color, #e9ecef);
  border-color: rgba(255, 255, 255, 0.2);
}
html[data-bs-theme="dark"] .content-page .ipam-grid .ipam-tile.st5 { background: rgba(220, 53, 69, 0.45); color: #fff; }

.content-page .ipam-tile.ipam-tile-gateway {
  border-width: 2px;
  border-color: #495057;
  box-shadow: 0 0 0 1px rgba(73, 80, 87, 0.35);
}
.content-page .ipam-tile.ipam-tile-conflict {
  border-width: 2px;
  border-color: #dc3545;
  box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.45);
  font-weight: 700;
}

.content-page .ipam-status-badge-0 {
  background: var(--bs-secondary-bg, #e9ecef) !important;
  color: var(--bs-body-color, #212529) !important;
  border: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.08));
}
.content-page .ipam-status-badge-1 {
  background: #cfe2ff !important;
  color: #084298 !important;
}
.content-page .ipam-status-badge-2 {
  background: #cff4fc !important;
  color: #055160 !important;
}
.content-page .ipam-status-badge-3 {
  background: #ffc107 !important;
  color: #212529 !important;
}
.content-page .ipam-status-badge-4 {
  background: #495057 !important;
  color: #fff !important;
}
.content-page .ipam-status-badge-5 {
  background: #dc3545 !important;
  color: #fff !important;
}
html[data-bs-theme="dark"] .content-page .ipam-status-badge-0 {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--bs-body-color, #dee2e6) !important;
  border-color: rgba(255, 255, 255, 0.12);
}
html[data-bs-theme="dark"] .content-page .ipam-status-badge-1 {
  background: rgba(13, 110, 253, 0.35) !important;
  color: #fff !important;
}
html[data-bs-theme="dark"] .content-page .ipam-status-badge-2 {
  background: rgba(13, 202, 240, 0.28) !important;
  color: #cff4fc !important;
}
/* Single left accent on the row (every td had its own inset shadow = repeated “column” lines) */
.content-page .table tr.ipam-row-conflict > td:first-child {
  box-shadow: inset 4px 0 0 #dc3545;
}
.content-page .table tr.ipam-row-gateway > td:first-child {
  box-shadow: inset 4px 0 0 #495057;
}

.content-page .ipam-chip-gateway.ipam-filter-chip.active {
  border-color: #495057;
  background: rgba(73, 80, 87, 0.12);
}
.content-page .ipam-chip-conflict.ipam-filter-chip.active {
  border-color: #dc3545;
  background: rgba(220, 53, 69, 0.12);
  color: #842029;
}
html[data-bs-theme="dark"] .content-page .ipam-chip-conflict.ipam-filter-chip.active {
  color: #f8d7da;
}

.content-page #ipam-bulk-toolbar:not(.d-none) {
  display: flex;
}
.content-page #ipam-bulk-toolbar {
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
