/* Quantum SecIntel global shell styles. */
/* Theme support is token-driven; shared chrome should use semantic variables first. */

/*
 * Token cascade. Canonical source of truth = /branding/tokens.css.
 * theme.tokens.css imports it and adds the single legacy alias bridge
 * (tokens-compat.css was folded into that bridge and retired).
 * dv8-design-tokens.css / design-tokens.css are now component CSS only
 * (their conflicting :root token redefinitions were neutralized).
 */
@import url('/branding/theme.tokens.css');
@import url('./dv8-design-tokens.css');
@import url('./design-tokens.css');
@import url('/branding/tokens.css');
@import url('/branding/theme.runtime.css');
@import url('./sandf-theme.css');
@import url('./vetting-certificate.css');

/*
 * DEFERRED (follow-up passes — intentionally NOT done here to stay surgical):
 *   1. `.btn` is redefined in ~10 files (site.css, dv8-design-tokens.css, design-tokens.css
 *      a11y-btn, sandf-theme.css, auth-*.css, operations-portal.css, …). Unify into a single
 *      button component in a later pass; blind-merging risks visual regressions.
 *   2. Bootstrap AND Bulma are both loaded (see _Head.cshtml / _AuthLayout.cshtml). Removing
 *      either is high-risk without a full visual audit — keep both for now.
 *   3. Remaining raw slate/grey hex + multi-value/gradient brand hex are left for stylelint
 *      (.stylelintrc.json bans raw hex in wwwroot/**/*.css) to surface for migration to
 *      var(--neutral-*) / brand tokens.
 */

html {
  min-height: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--app-shell-sticky-offset) + 1rem);
}

html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

body {
  min-height: 100%;
  font-family: var(--font-sans);
  background-color: var(--page-bg);
  color: var(--text);
}

:root {
  --app-shell-sticky-offset: 4rem;
  --app-canvas-bg: var(--page-bg, #ffffff);
  --app-canvas-bg-elevated: var(--surface-elevated, #f9fafb);
  --app-canvas-accent: rgba(201, 39, 54, 0.08);
  --app-canvas-accent-secondary: rgba(8, 145, 178, 0.04);
  --app-panel-bg: var(--surface-overlay, rgba(255, 255, 255, 0.95));
  --app-panel-bg-strong: var(--surface-bg, #ffffff);
  --app-panel-border: var(--border, #e5e7eb);
  --app-panel-border-strong: var(--border-strong, #d1d5db);
  --app-muted-bg: rgba(148, 163, 184, 0.08);
  --app-shadow-soft: 0 18px 48px rgba(15, 23, 42, 0.08);
  --app-scrollbar-track: var(--surface-elevated, #f9fafb);
  --app-scrollbar-thumb: var(--border-strong, #d1d5db);
  --app-scrollbar-thumb-hover: var(--text-tertiary, #6b7280);
  --app-surface-bg: var(--app-panel-bg);
  --app-surface-bg-strong: var(--app-panel-bg-strong);
  --app-surface-bg-muted: var(--form-control-bg-muted, var(--surface-elevated, #f9fafb));
  --app-surface-border: rgba(148, 163, 184, 0.2);
  --app-surface-border-strong: rgba(148, 163, 184, 0.28);
  --app-surface-text: var(--text, #111827);
  --app-surface-muted: var(--text-secondary, #475569);
  --app-surface-subtle: var(--text-tertiary, #64748b);
  --app-brand-bg: rgba(201, 39, 54, 0.1);
  --app-brand-bg-subtle: rgba(201, 39, 54, 0.04);
  --app-brand-border: rgba(201, 39, 54, 0.28);
  --app-brand-border-subtle: rgba(201, 39, 54, 0.1);
  --app-brand-text: var(--dv8-red, #c92736);
  --app-brand-shadow: 0 14px 28px rgba(201, 39, 54, 0.18);
  --app-brand-shadow-hover: 0 18px 32px rgba(201, 39, 54, 0.22);
  --app-secure-panel-bg:
    radial-gradient(circle at top right, rgba(248, 250, 252, 0.16), transparent 28%),
    linear-gradient(160deg, #0f172a 0%, #1e293b 58%, #7f1d1d 100%);
  --app-secure-panel-bg-muted: rgba(15, 23, 42, 0.24);
  --app-secure-panel-bg-hover: rgba(248, 250, 252, 0.14);
  --app-secure-panel-border: rgba(248, 250, 252, 0.16);
  --app-secure-panel-border-strong: rgba(252, 165, 165, 0.4);
  --app-secure-panel-text: #f8fafc;
  --app-secure-panel-muted: rgba(226, 232, 240, 0.84);
  --app-secure-panel-accent: #fecaca;
  --status-text-success: var(--success-dark, #047857);
  --status-text-warning: var(--warning-dark, #b45309);
  --status-text-danger: var(--danger-dark, #b91c1c);
  --status-text-info: var(--info-dark, #1d4ed8);
  --status-border-success: rgba(4, 120, 87, 0.16);
  --status-border-warning: rgba(180, 83, 9, 0.16);
  --status-border-danger: rgba(185, 28, 28, 0.16);
  --status-border-info: rgba(29, 78, 216, 0.16);
  --form-control-height: 3.1rem;
  --form-control-radius: 0.875rem;
  --form-control-border: rgba(148, 163, 184, 0.42);
  --form-control-border-focus: rgba(201, 39, 54, 0.5);
  --form-control-bg: var(--surface-bg, #ffffff);
  --form-control-bg-muted: var(--surface-elevated, #f9fafb);
  --form-control-text: var(--text, #111827);
  --form-control-placeholder: var(--text-tertiary, #6b7280);
  --form-control-focus-ring: 0 0 0 0.22rem rgba(201, 39, 54, 0.12);
  --form-label-color: var(--text, #1f2937);
  --form-helper-color: var(--text-secondary, #64748b);
  --form-panel-bg: var(--app-panel-bg);
  --form-panel-border: var(--app-panel-border);
  --form-panel-shadow: var(--app-shadow-soft);
}

[data-theme="dark"] {
  --app-canvas-accent: rgba(232, 74, 89, 0.12);
  --app-canvas-accent-secondary: rgba(8, 145, 178, 0.08);
  --app-muted-bg: rgba(148, 163, 184, 0.1);
  --app-shadow-soft: 0 18px 48px rgba(0, 0, 0, 0.28);
  --app-surface-bg: rgba(15, 23, 42, 0.9);
  --app-surface-bg-strong: rgba(17, 24, 39, 0.96);
  --app-surface-bg-muted: rgba(15, 23, 42, 0.78);
  --app-surface-border: rgba(148, 163, 184, 0.16);
  --app-surface-border-strong: rgba(148, 163, 184, 0.24);
  --app-brand-bg: rgba(232, 74, 89, 0.12);
  --app-brand-bg-subtle: rgba(232, 74, 89, 0.08);
  --app-brand-border: rgba(232, 74, 89, 0.28);
  --app-brand-border-subtle: rgba(232, 74, 89, 0.16);
  --app-brand-shadow: 0 14px 28px rgba(232, 74, 89, 0.2);
  --app-brand-shadow-hover: 0 18px 32px rgba(232, 74, 89, 0.24);
  --status-bg-success: rgba(6, 78, 59, 0.24);
  --status-bg-warning: rgba(146, 64, 14, 0.24);
  --status-bg-danger: rgba(127, 29, 29, 0.24);
  --status-bg-info: rgba(30, 64, 175, 0.24);
  --status-text-success: #a7f3d0;
  --status-text-warning: #fed7aa;
  --status-text-danger: #fecaca;
  --status-text-info: #bfdbfe;
  --status-border-success: rgba(16, 185, 129, 0.24);
  --status-border-warning: rgba(251, 146, 60, 0.24);
  --status-border-danger: rgba(248, 113, 113, 0.24);
  --status-border-info: rgba(96, 165, 250, 0.24);
  --form-control-border: rgba(148, 163, 184, 0.28);
  --form-control-bg-muted: rgba(17, 24, 39, 0.92);
  --form-control-focus-ring: 0 0 0 0.22rem rgba(232, 74, 89, 0.18);
  --form-panel-bg: rgba(15, 23, 36, 0.9);
  --form-panel-border: rgba(148, 163, 184, 0.18);
}

.db-heartbeat {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
  left: calc(env(safe-area-inset-left, 0px) + 1rem);
  z-index: 2100;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.85rem;
  height: 0.85rem;
  pointer-events: none;
}

.db-heartbeat__dot {
  width: 0.5rem;
  height: 0.5rem;
  display: inline-block;
  border-radius: 0.18rem;
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1) inset;
  background: #9e9e9e;
}

.db-heartbeat__msg {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* 2) Navbar */
.navbar-brand{
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-xl);
  color: var(--brand-600) !important;
}
.navbar-dark{ background-color: var(--brand-600) !important; }
.navbar-dark .navbar-nav .nav-link{ color: rgba(255,255,255,0.9) !important; }
.navbar-dark .navbar-nav .nav-link:hover{ color: rgba(255,255,255,1) !important; }

/* 3) Cards (QS-INTEL-v2025001 choice) */
.card{
  border: none;
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  box-shadow: var(--shadow-card);
  background-color: var(--surface-bg);
  /* Performance optimization for hover animations */
  will-change: transform, box-shadow;
  /* Better isolation for transformed elements */
  isolation: isolate;
}
.card:hover{
  transform: translateY(-2px);
  box-shadow: var(--shadow-elevated);
}
.card-header{
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border-bottom: 1px solid var(--border);
  font-weight: var(--font-weight-semibold);
  background: transparent;
  padding: var(--space-6) var(--space-6) var(--space-4);
}
.card-body{ 
  padding: var(--space-6); 
}

/* 4) Buttons */
.btn{
  border-radius: var(--radius-md);
  font-weight: var(--font-weight-medium);
  transition: all .2s ease;
  min-height: var(--min-touch-target, 44px);
  font-family: var(--font-family-primary, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
  /* Performance optimization for animations */
  will-change: transform, box-shadow;
  /* Better tap/click experience on mobile */
  touch-action: manipulation;
}

.btn:not(.btn-close) {
  align-items: center;
  display: inline-flex;
  gap: 0.55rem;
  justify-content: center;
  vertical-align: middle;
}

.btn:not(.btn-close) > i[class^="fa"],
.btn:not(.btn-close) > i[class*=" fa-"] {
  flex: 0 0 1.05rem;
  line-height: 1;
  margin: 0 !important;
  text-align: center;
  width: 1.05rem;
}

.btn:hover{
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.btn:focus{
  outline: 2px solid var(--dv8-red, #C92736);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px rgba(201, 39, 54, 0.3);
}
.btn:focus-visible{
  outline: 2px solid var(--dv8-red, #C92736);
  outline-offset: 2px;
}
.btn-primary{
  background-color: var(--dv8-red, #C92736);
  border-color: var(--dv8-red, #C92736);
}
.btn-primary:hover{
  background-color: var(--dv8-red-hover, #A31E2B);
  border-color: var(--dv8-red-hover, #A31E2B);
}
.btn-outline-primary{
  color: var(--dv8-red, #C92736);
  border-color: var(--dv8-red, #C92736);
}
.btn-outline-primary:hover{
  background-color: var(--dv8-red, #C92736);
  border-color: var(--dv8-red, #C92736);
  color: #ffffff;
}

.theme-transitioning,
.theme-transitioning *,
html.theme-transitioning,
html.theme-transitioning * {
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease !important;
}

.app-shell-body {
  --app-shell-side-width: 272px;
  --app-shell-panel: var(--app-panel-bg);
  --app-shell-panel-strong: var(--app-panel-bg-strong);
  --app-shell-border: var(--app-panel-border);
  --app-shell-border-strong: var(--app-panel-border-strong);
  --app-shell-text: var(--text, #111827);
  --app-shell-muted: var(--text-secondary, #4b5563);
  --app-shell-topbar-bg: rgba(255, 255, 255, 0.88);
  --app-shell-nav-bg:
    radial-gradient(circle at 0 0, rgba(201, 39, 54, 0.16), transparent 28%),
    linear-gradient(180deg, rgba(11, 23, 42, 0.98), rgba(15, 23, 42, 0.95));
  --app-shell-nav-border: rgba(148, 163, 184, 0.18);
  --app-shell-nav-shadow: 14px 0 42px rgba(15, 23, 42, 0.18);
  --app-shell-nav-text: #dbe7ff;
  --app-shell-nav-muted: #8ba1c7;
  --app-shell-nav-accent-soft: rgba(239, 106, 116, 0.16);
  --app-shell-nav-hover-bg: rgba(148, 163, 184, 0.14);
  --app-shell-nav-hover-border: rgba(148, 163, 184, 0.28);
  --app-shell-nav-active-bg: rgba(239, 106, 116, 0.16);
  --app-shell-nav-active-border: rgba(239, 106, 116, 0.4);
  --app-shell-nav-active-text: #ffe5e8;
  --app-shell-nav-logo-bg: rgba(255, 255, 255, 0.04);
  --app-shell-nav-logo-border: rgba(148, 163, 184, 0.18);
  --app-shell-background:
    radial-gradient(circle at top left, var(--app-canvas-accent), transparent 28rem),
    radial-gradient(circle at top right, var(--app-canvas-accent-secondary), transparent 30rem),
    linear-gradient(135deg, var(--app-canvas-bg) 0%, var(--app-canvas-bg-elevated) 100%);
  min-height: 100vh;
  background-color: var(--app-canvas-bg);
  background-image: var(--app-shell-background);
  background-position: top left, top right, center;
  background-repeat: no-repeat;
  background-size: min(70rem, 120vw) min(70rem, 120vw), min(60rem, 100vw) min(60rem, 100vw), auto;
  color: var(--app-shell-text);
}

[data-theme="dark"] .app-shell-body {
  --app-shell-panel: rgba(15, 23, 36, 0.9);
  --app-shell-panel-strong: rgba(17, 24, 39, 0.96);
  --app-shell-topbar-bg: rgba(15, 23, 36, 0.9);
  --app-shell-nav-bg:
    radial-gradient(circle at 0 0, rgba(232, 74, 89, 0.18), transparent 28%),
    linear-gradient(180deg, rgba(6, 14, 26, 0.98), rgba(11, 18, 32, 0.96));
  --app-shell-nav-shadow: 14px 0 42px rgba(0, 0, 0, 0.24);
}

.app-shell-frame {
  display: grid;
  grid-template-columns: var(--app-shell-side-width) minmax(0, 1fr);
  min-height: 100vh;
}

.app-shell-side-nav {
  background: var(--app-shell-nav-bg);
  border-right: 1px solid var(--app-shell-nav-border);
  box-shadow: var(--app-shell-nav-shadow);
  color: var(--app-shell-nav-text);
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 22px 18px;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky, 1020);
}

.app-shell-side-nav__brand {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  display: grid;
  height: 4.75rem;
  justify-self: center;
  line-height: 0;
  margin: 0 auto 1.4rem;
  max-width: 100%;
  padding: 0;
  place-items: center;
  text-decoration: none;
  transition: background-color var(--transition-fast, 160ms ease), border-color var(--transition-fast, 160ms ease);
  width: 4.75rem;
}

.app-shell-side-nav__brand .ss-logo-icon,
.app-shell-side-nav__brand .ss-logo-icon__img,
.app-shell-side-nav__brand-sandf {
  display: block;
  height: 4rem;
  max-height: 4rem;
  max-width: 4rem;
  object-fit: contain;
  width: 4rem;
}

.app-shell-side-nav__brand .ss-logo-icon {
  border-radius: 0;
  margin: 0 auto;
}

.app-shell-side-nav__brand-sandf {
  background: transparent;
  border-radius: 0;
  display: none;
  padding: 0;
}

.app-shell-side-nav__sections,
.app-shell-side-nav__section,
.app-shell-side-nav__list {
  display: grid;
  gap: 0.5rem;
}

.app-shell-side-nav__section {
  margin-top: 1rem;
}

.app-shell-side-nav__section-title,
.app-shell-side-nav__section h2 {
  margin: 0;
}

.app-shell-side-nav__section-toggle {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--app-shell-nav-muted);
  cursor: pointer;
  display: grid;
  font-size: 0.73rem;
  font-weight: 800;
  gap: 0.5rem;
  grid-template-columns: minmax(0, 1fr) auto auto;
  letter-spacing: 0.08em;
  min-height: 2rem;
  padding: 0.15rem 0.25rem;
  border-radius: 0.5rem;
  text-align: left;
  text-transform: uppercase;
  width: 100%;
}

.app-shell-side-nav__section-toggle i {
  font-size: 0.68rem;
  justify-self: end;
  line-height: 1;
  transform: rotate(-90deg);
  transition: transform var(--transition-fast, 160ms ease);
  width: 1rem;
}

.app-shell-side-nav__section.is-open .app-shell-side-nav__section-toggle i,
.app-shell-side-nav__section-toggle[aria-expanded="true"] i {
  transform: rotate(0deg);
}

.app-shell-side-nav__section-toggle:hover,
.app-shell-side-nav__section-toggle:focus-visible {
  background: var(--app-shell-nav-hover-bg);
  border-color: var(--app-shell-nav-hover-border);
  color: #ffffff;
  outline: none;
}

.app-shell-side-nav__section-meta {
  align-items: center;
  background: var(--app-shell-nav-accent-soft);
  border: 1px solid var(--app-shell-nav-hover-border);
  border-radius: 999px;
  color: var(--app-shell-nav-text);
  display: inline-flex;
  font-size: 0.68rem;
  justify-content: center;
  letter-spacing: 0;
  min-width: 1.45rem;
  padding: 0.12rem 0.36rem;
  text-transform: none;
}

.app-shell-side-nav__list {
  list-style: none;
  margin: 0;
  min-width: 0;
  padding: 0;
}

.app-shell-side-nav__list > li {
  min-width: 0;
}

.app-shell-side-nav__link {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.625rem;
  color: var(--app-shell-nav-text);
  display: flex;
  font-size: 0.9rem;
  font-weight: 650;
  gap: 0.75rem;
  justify-content: space-between;
  min-width: 0;
  min-height: 2.5rem;
  padding: 0.58rem 0.68rem;
  text-decoration: none;
  transition: background-color var(--transition-fast, 160ms ease), border-color var(--transition-fast, 160ms ease), color var(--transition-fast, 160ms ease);
  white-space: nowrap;
}

.app-shell-side-nav__link-copy,
.app-shell-side-nav__link-meta {
  align-items: center;
  min-width: 0;
}

.app-shell-side-nav__link-copy {
  display: grid;
  flex: 1 1 auto;
  gap: 0.65rem;
  grid-template-columns: 1.2rem minmax(0, 1fr);
}

.app-shell-side-nav__link-meta {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 0.55rem;
}

.app-shell-side-nav__link-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell-side-nav__link-copy i {
  align-items: center;
  color: var(--app-shell-nav-muted);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.9rem;
  justify-content: center;
  line-height: 1;
  text-align: center;
  width: 1.2rem;
}

.app-shell-side-nav__link-meta > i {
  color: var(--app-shell-nav-muted);
  font-size: 0.72rem;
  line-height: 1;
  text-align: center;
  width: 0.9rem;
}

.app-shell-side-nav__link:hover,
.app-shell-side-nav__link:focus-visible {
  background: var(--app-shell-nav-hover-bg);
  border-color: var(--app-shell-nav-hover-border);
  color: #ffffff;
  outline: none;
}

.app-shell-side-nav__link.is-active,
.app-shell-side-nav__link[aria-current="page"] {
  background: var(--app-shell-nav-active-bg);
  border-color: var(--app-shell-nav-active-border);
  color: var(--app-shell-nav-active-text);
}

.app-shell-side-nav__link.is-active .app-shell-side-nav__link-copy i,
.app-shell-side-nav__link[aria-current="page"] .app-shell-side-nav__link-copy i {
  color: #ffffff;
}

.app-shell-side-nav__pill {
  border: 1px solid var(--app-shell-nav-active-border);
  border-radius: 999px;
  color: var(--app-shell-nav-active-text);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  padding: 0.18rem 0.48rem;
  white-space: nowrap;
}

.dv8-information-list {
  display: grid;
  gap: 0.65rem 1rem;
  grid-template-columns: max-content minmax(12rem, 1fr);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

.dv8-information-list dt,
.dv8-information-list dd {
  margin: 0;
  min-width: 0;
  white-space: nowrap;
}

.dv8-information-list dd {
  overflow-x: auto;
  scrollbar-width: thin;
}

.dv8-information-row {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
  white-space: nowrap;
}

.dv8-information-row > * {
  flex: 0 0 auto;
}

.dv8-nowrap-value {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  white-space: nowrap;
}

.dv8-configuration-surface-card {
  min-width: 0;
  overflow: hidden;
}

.dv8-configuration-surface-copy {
  min-width: 0;
}

.dv8-configuration-surface-card h3,
.dv8-configuration-surface-card .badge {
  white-space: nowrap;
}

.dv8-configuration-surface-card h3 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-shell-workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
}

.app-shell-top-bar {
  align-items: center;
  background: var(--app-shell-topbar-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--app-shell-border);
  display: flex;
  gap: 0.875rem;
  justify-content: space-between;
  min-height: var(--app-shell-sticky-offset);
  padding: 14px 22px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-shell-top-bar__context,
.app-shell-top-bar__actions {
  align-items: center;
  display: flex;
  gap: 0.6rem;
  min-width: 0;
}

.app-shell-top-bar__copy {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.app-shell-top-bar__copy strong {
  color: var(--app-shell-text);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell-top-bar__copy span {
  color: var(--app-shell-muted);
  font-size: 0.8rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell-top-bar-button,
.app-shell-theme-toggle,
.app-shell-status-badge {
  align-items: center;
  border: 1px solid var(--app-shell-border);
  border-radius: 0.56rem;
  display: inline-flex;
  font-size: 0.84rem;
  font-weight: 700;
  gap: 0.48rem;
  justify-content: center;
  line-height: 1;
  min-height: 2.35rem;
  padding: 0.55rem 0.72rem;
  text-decoration: none;
  white-space: nowrap;
}

.app-shell-top-bar-button > i[class^="fa"],
.app-shell-top-bar-button > i[class*=" fa-"],
.app-shell-theme-toggle i[class^="fa"],
.app-shell-theme-toggle i[class*=" fa-"],
.app-shell-status-badge > i[class^="fa"],
.app-shell-status-badge > i[class*=" fa-"] {
  flex: 0 0 1rem;
  line-height: 1;
  margin: 0;
  text-align: center;
  width: 1rem;
}

.app-shell-top-bar-button,
.app-shell-theme-toggle {
  background: var(--app-shell-panel-strong);
  color: var(--app-shell-text);
  cursor: pointer;
}

.app-shell-status-badge {
  background: var(--app-muted-bg);
  color: var(--app-shell-muted);
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-shell-top-bar__signals {
  align-items: center;
  display: flex;
  gap: 0.45rem;
  min-width: 0;
}

.app-shell-signal-chip {
  align-items: center;
  background: var(--app-muted-bg);
  border: 1px solid var(--app-shell-border);
  border-radius: 999px;
  color: var(--app-shell-muted);
  display: inline-flex;
  font-size: 0.76rem;
  font-weight: 800;
  gap: 0.38rem;
  line-height: 1;
  min-height: 2rem;
  max-width: 11.5rem;
  padding: 0.42rem 0.62rem;
  white-space: nowrap;
}

.app-shell-signal-chip > i[class^="fa"],
.app-shell-signal-chip > i[class*=" fa-"] {
  flex: 0 0 0.95rem;
  line-height: 1;
  text-align: center;
  width: 0.95rem;
}

.app-shell-signal-chip > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-shell-signal-chip[data-tone="success"],
.app-shell-signal-chip[data-tone="ready"] {
  background: rgba(21, 128, 61, 0.09);
  border-color: rgba(21, 128, 61, 0.25);
  color: var(--ok, #15803d);
}

.app-shell-signal-chip[data-tone="warning"],
.app-shell-signal-chip[data-tone="watch"] {
  background: rgba(180, 83, 9, 0.1);
  border-color: rgba(180, 83, 9, 0.28);
  color: var(--warn, #b45309);
}

.app-shell-signal-chip[data-tone="danger"],
.app-shell-signal-chip[data-tone="active"] {
  background: rgba(185, 28, 28, 0.1);
  border-color: rgba(185, 28, 28, 0.28);
  color: var(--danger, #b91c1c);
}

.app-shell-integration-map {
  background: var(--app-shell-panel);
  border-bottom: 1px solid var(--app-shell-border);
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0.58rem 1.35rem;
}

.app-shell-integration-map__plane {
  align-items: center;
  background: var(--app-muted-bg);
  border: 1px solid var(--app-shell-border);
  border-radius: 0.5rem;
  color: var(--app-shell-text);
  display: grid;
  gap: 0.5rem;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 2.8rem;
  min-width: 0;
  padding: 0.5rem 0.62rem;
  text-decoration: none;
}

.app-shell-integration-map__plane:hover,
.app-shell-integration-map__plane:focus-visible {
  border-color: var(--app-shell-border-strong);
  outline: none;
  text-decoration: none;
}

.app-shell-integration-map__dot {
  background: var(--app-shell-muted);
  border-radius: 999px;
  box-shadow: 0 0 0 0.22rem rgba(100, 116, 139, 0.1);
  height: 0.48rem;
  width: 0.48rem;
}

.app-shell-integration-map__plane[data-tone="success"] .app-shell-integration-map__dot,
.app-shell-integration-map__plane[data-tone="ready"] .app-shell-integration-map__dot {
  background: var(--ok, #15803d);
  box-shadow: 0 0 0 0.22rem rgba(21, 128, 61, 0.12);
}

.app-shell-integration-map__plane[data-tone="warning"] .app-shell-integration-map__dot,
.app-shell-integration-map__plane[data-tone="watch"] .app-shell-integration-map__dot {
  background: var(--warn, #b45309);
  box-shadow: 0 0 0 0.22rem rgba(180, 83, 9, 0.12);
}

.app-shell-integration-map__copy {
  display: grid;
  gap: 0.08rem;
  min-width: 0;
}

.app-shell-integration-map__copy strong,
.app-shell-integration-map__copy span,
.app-shell-integration-map__state {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell-integration-map__copy strong {
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.15;
}

.app-shell-integration-map__copy span,
.app-shell-integration-map__state {
  color: var(--app-shell-muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.15;
}

.app-shell-top-bar-button:hover,
.app-shell-top-bar-button:focus-visible,
.app-shell-theme-toggle:hover,
.app-shell-theme-toggle:focus-visible {
  border-color: var(--app-shell-border-strong);
  color: var(--app-shell-text);
  outline: none;
  text-decoration: none;
}

.app-shell-top-bar-button--primary {
  background: var(--dv8-red, #c92736);
  border-color: var(--dv8-red, #c92736);
  color: #ffffff;
}

.app-shell-top-bar-button--primary:hover,
.app-shell-top-bar-button--primary:focus-visible {
  background: var(--dv8-red-hover, #a31e2b);
  color: #ffffff;
}

.app-shell-top-bar-button--danger {
  border-color: rgba(185, 28, 28, 0.28);
  color: var(--danger-dark, #991b1b);
}

.app-shell-theme-toggle {
  align-self: center;
}

.app-shell-toolbar__label {
  font-size: 0.84rem;
  line-height: 1;
}

.app-shell-mobile-nav-toggle {
  display: none;
}

.app-shell-main {
  min-width: 0;
}

.app-shell-footer {
  align-items: center;
  color: var(--text-secondary);
  display: flex;
  font-size: 0.82rem;
  gap: 1rem;
  justify-content: space-between;
  padding: 1rem 1.25rem 1.5rem;
}

.app-shell-footer__copy {
  display: grid;
  gap: 0.2rem;
}

.skip-link {
  background: var(--dv8-red, #C92736);
  border-radius: 0.85rem;
  color: #ffffff;
  font-weight: 700;
  left: 1rem;
  padding: 0.75rem 1rem;
  position: absolute;
  text-decoration: none;
  top: -3rem;
  z-index: 1200;
}

.skip-link:focus {
  top: 1rem;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

@media (min-width: 941px) {
  .app-shell-theme-toggle {
    width: 2.55rem;
    padding-inline: 0;
  }

  .app-shell-theme-toggle .app-shell-toolbar__label {
    display: none;
  }
}

@media (max-width: 1180px) {
  .app-shell-top-bar__signals {
    flex: 1 1 100%;
    order: 3;
  }

  .app-shell-integration-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 940px) {
  .app-shell-frame {
    grid-template-columns: 1fr;
  }

  .app-shell-side-nav {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    height: 100vh;
    inset: 0 auto 0 0;
    position: fixed;
    transform: translateX(-102%);
    transition: transform var(--transition-base, 240ms ease);
    width: min(300px, 84vw);
    z-index: 1060;
  }

  .app-shell-side-nav[data-open="true"] {
    transform: translateX(0);
  }

  .app-shell-mobile-nav-toggle {
    display: inline-flex;
  }

  .app-shell-top-bar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .app-shell-top-bar__actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .app-shell-integration-map {
    padding-inline: 0.85rem;
  }
}

@media (max-width: 720px) {
  .app-shell-top-bar {
    padding-inline: 0.85rem;
  }

  .app-shell-top-bar__context,
  .app-shell-top-bar__actions {
    width: 100%;
  }

  .app-shell-status-badge {
    max-width: 100%;
  }

  .app-shell-top-bar__signals {
    display: none;
  }

  .app-shell-integration-map {
    grid-template-columns: 1fr;
  }

  .app-shell-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* 5) Forms */
.form-group,
.field,
.mb-3:has(> .form-label),
.mb-4:has(> .form-label) {
  display: grid;
  align-content: start;
  gap: 0.42rem;
}

.form-label,
.field > span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.35rem;
  margin-bottom: 0;
  color: var(--form-label-color);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.25;
}

.form-label > i[class^="fa"],
.form-label > i[class*=" fa-"],
.field > span > i[class^="fa"],
.field > span > i[class*=" fa-"],
.form-title-icon {
  flex: 0 0 1rem;
  line-height: 1;
  margin: 0 !important;
  text-align: center;
  width: 1rem;
}

.form-control,
.form-select,
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: var(--form-control-height);
  padding: 0.72rem 0.9rem;
  border-radius: var(--form-control-radius);
  border: 1px solid var(--form-control-border);
  background-color: var(--form-control-bg);
  color: var(--form-control-text);
  line-height: 1.35;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
  font-family: var(--font-family-primary, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}

.form-select {
  padding-right: 2.4rem;
}

textarea.form-control {
  min-height: 7rem;
  resize: vertical;
}

.form-control::placeholder,
.field input::placeholder,
.field textarea::placeholder {
  color: var(--form-control-placeholder);
}

.form-control:focus,
.form-select:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--form-control-border-focus);
  background-color: var(--form-control-bg);
  box-shadow: var(--form-control-focus-ring);
  outline: 0;
}

.form-text,
.field small,
.form-group small,
.mb-3 > small,
.mb-4 > small {
  display: block;
  margin-top: 0;
  color: var(--form-helper-color);
  font-size: 0.82rem;
  line-height: 1.45;
}

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-height: 2.25rem;
  margin-bottom: 0;
  padding-left: 0;
}

.form-check .form-check-input {
  flex: 0 0 auto;
  width: 1.12rem;
  height: 1.12rem;
  margin-left: 0;
  margin-top: 0.18rem;
  border-color: rgba(100, 116, 139, 0.5);
  accent-color: var(--dv8-red, #C92736);
}

.form-check-input:checked {
  background-color: var(--dv8-red, #C92736);
  border-color: var(--dv8-red, #C92736);
}

.form-check-label {
  color: var(--form-label-color);
  line-height: 1.45;
}

.form-switch {
  align-items: center;
  min-height: 3rem;
  padding-left: 0;
}

.form-switch .form-check-input {
  width: 2.65rem;
  height: 1.42rem;
  margin-top: 0;
}

.text-danger[data-valmsg-for],
span.text-danger,
.field-error {
  display: block;
  min-height: 1.15rem;
  color: var(--danger-dark, #b42318) !important;
  font-size: 0.8rem;
  line-height: 1.35;
}

.form-card,
.form-section,
.role-selection {
  border: 1px solid var(--form-panel-border);
  background: var(--form-panel-bg);
  box-shadow: var(--form-panel-shadow);
}

.form-card {
  border-radius: 1rem;
  padding: clamp(1.25rem, 2vw, 2rem);
}

.form-section,
.role-selection {
  border-radius: var(--form-control-radius);
}

.form-section {
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.form-title-icon {
  color: var(--dv8-red, #C92736);
}

/* Enhanced focus management for better accessibility */
.form-control:focus-visible, .form-select:focus-visible{
  outline: 2px solid var(--dv8-red, #C92736);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .form-control:focus, .form-select:focus{
    border-width: 3px;
    box-shadow: 0 0 0 3px var(--dv8-red, #C92736);
  }
}

/* 6) Badges */
.badge{
  align-items: center;
  border-radius: var(--radius-sm);
  display: inline-flex;
  gap: 0.35rem;
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family-primary);
  line-height: 1.2;
  vertical-align: middle;
}

.badge > i[class^="fa"],
.badge > i[class*=" fa-"] {
  flex: 0 0 0.95rem;
  line-height: 1;
  margin: 0 !important;
  text-align: center;
  width: 0.95rem;
}
.bg-success{ background-color: var(--success-500) !important; }
.bg-danger{  background-color: var(--danger-500) !important; }
.bg-warning{ background-color: var(--warning-500) !important; }
.bg-info{    background-color: var(--info-500) !important; }
.bg-primary{ background-color: var(--accent-500) !important; }

/* 7) Text helpers */
.text-primary{ color: var(--accent-500) !important; }
.text-success{ color: var(--success-500) !important; }
.text-danger{  color: var(--danger-500) !important; }
.text-warning{ color: var(--warning-500) !important; }
.text-info{    color: var(--info-500) !important; }
.text-gray-800{ color: var(--ink-900); }
.text-gray-300{ color: var(--ink-600); }
.font-weight-bold{ font-weight: var(--font-weight-bold); }

/* 8) Alerts */
.alert{
  align-items: flex-start;
  border: none;
  border-radius: var(--radius-sm);
  border-left: 4px solid;
  display: flex;
  gap: 0.65rem;
  font-family: var(--font-family-primary);
}

.alert > i[class^="fa"],
.alert > i[class*=" fa-"] {
  flex: 0 0 1rem;
  line-height: 1;
  margin: 0.18rem 0 0 !important;
  text-align: center;
  width: 1rem;
}

.alert > .btn-close {
  flex: 0 0 auto;
  margin-left: auto;
}
.alert-success{
  border-left-color: var(--success-500);
  background-color: var(--status-bg-success, rgba(22, 163, 74, 0.1));
  color: var(--success-500);
}
.alert-info{
  border-left-color: var(--info-500);
  background-color: var(--status-bg-info, rgba(8, 145, 178, 0.1));
  color: var(--info-500);
}
.alert-warning{
  border-left-color: var(--warning-500);
  background-color: var(--status-bg-warning, rgba(217, 119, 6, 0.1));
  color: var(--warning-500);
}
.alert-danger{
  border-left-color: var(--danger-500);
  background-color: var(--status-bg-danger, rgba(220, 38, 38, 0.1));
  color: var(--danger-500);
}

/* 9) Charts */
canvas{ max-height: 400px; }

/* 10) Activity Feed */
#activityFeed .alert{
  margin-bottom: .5rem;
  padding: var(--space-lg);
  font-size: var(--font-size-sm);
}

/* 11) Module Selection */
.module-card{
  cursor: pointer;
  transition: all .2s ease;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
}
.module-card:hover{
  border-color: var(--dv8-red);
  background-color: rgba(201, 39, 54, 0.05);
}
.module-card .form-check-input:checked + .form-check-label{
  color: var(--dv8-red);
}

/* 12) Loading */
.spinner-border{ width: 2rem; height: 2rem; }

/* 13) Status */
.status-online{ color: var(--success-500); }
.status-offline{ color: var(--danger-500); }
.status-processing{ color: var(--warning-500); }

/* 14) Interactive */
.interactive-element{ transition: all .2s ease; }
.interactive-element:hover{ transform: scale(1.02); }

/* 15) Dashboard metrics */
.dashboard-metric{
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-semibold);
  color: var(--ink-900);
}
.dashboard-metric-label{
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: var(--space-sm);
}

/* 16) Footer helpers */
footer .disclaimer,
footer .copyright{
  font-size: 11px;
  line-height: 1.4;
  opacity: .9;
}

/* 17) Pulse (reduced-motion aware) - Cross-browser support */
.pulse{ 
  animation: pulse 2s infinite;
  /* Performance optimization */
  will-change: transform;
}

/* Keyframes with vendor prefixes for older browsers */
@keyframes pulse{
  0%{ 
    transform: scale(1);
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    -ms-transform: scale(1);
  }
  50%{ 
    transform: scale(1.05);
    -webkit-transform: scale(1.05);
    -moz-transform: scale(1.05);
    -ms-transform: scale(1.05);
  }
  100%{ 
    transform: scale(1);
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    -ms-transform: scale(1);
  }
}

/* Webkit prefix for older Safari/Chrome */
@-webkit-keyframes pulse{
  0%{ -webkit-transform: scale(1); }
  50%{ -webkit-transform: scale(1.05); }
  100%{ -webkit-transform: scale(1); }
}

/* Motion reduction support */
@media (prefers-reduced-motion: reduce){
  .pulse{ 
    animation: none;
    will-change: auto;
  }
  .interactive-element:hover{ 
    transform: none;
    -webkit-transform: none;
  }
  .btn:hover{ 
    transform: none;
    -webkit-transform: none;
  }
  .card:hover{
    transform: none;
    -webkit-transform: none;
  }
  /* Disable logo hover animations for reduced motion */
  .navbar-logo-img:hover,
  .dv8-logo-img:hover {
    transform: none;
    -webkit-transform: none;
  }
}

/* 18) Custom Scrollbar - Cross-browser support */
/* Firefox scrollbar styling */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--app-scrollbar-thumb) var(--app-scrollbar-track);
}

/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar{ 
  width: 8px; 
  height: 8px;
}
::-webkit-scrollbar-track{
  background: var(--app-scrollbar-track);
  border-radius: var(--radius-xs, 4px);
}
::-webkit-scrollbar-thumb{
  background: var(--app-scrollbar-thumb);
  border-radius: var(--radius-xs, 4px);
  border: 1px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover{ 
  background: var(--app-scrollbar-thumb-hover);
  background-clip: content-box;
}
::-webkit-scrollbar-corner{
  background: var(--app-scrollbar-track);
}

/* 19) Desktop-optimized layout */

/* Forced colors mode support (Windows High Contrast) */
@media (forced-colors: active) {
  .card {
    border: 1px solid;
  }
  .btn {
    border: 1px solid;
  }
  .form-control, .form-select {
    border: 1px solid;
  }
}

/* 21) Logo Image Classes */
.dv8-logo-img{
  height: 72px;
  width: auto;
  object-fit: contain;
  max-width: 240px;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.dv8-logo-img:hover{
  transform: scale(1.05);
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.2));
}

.navbar-logo-img{
  height: 40px;
  width: auto;
  object-fit: contain;
  max-width: 120px;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.navbar-logo-img:hover{
  transform: scale(1.05);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

/* Browser compatibility styles moved to browser-compatibility.css */
/* This file now focuses on application-specific styles */

/* Ensure consistent line-height across browsers */
body {
  line-height: 1.5;
}

/* Fix for iOS Safari input zoom */
input[type="text"], 
input[type="email"], 
input[type="password"], 
input[type="tel"], 
input[type="number"], 
select,
textarea {
  font-size: 16px;
}

/* Prevent horizontal scroll on mobile */
html, body {
  overflow-x: hidden;
}

/* Better touch target sizing for mobile browsers */
@media (max-width: 768px) {
  .btn, .form-control, .form-select {
    min-height: 48px;
    padding: 12px 16px;
  }
  
  .nav-link {
    padding: 12px 16px;
  }
}

/* Browser-specific styles moved to browser-compatibility.css for better organization */

