/* =============================================================
   ThorServer — UNIFIED THEME
   Drop-in CSS · re-skinea body-header, side.navbar, dashboard
   con un único sistema visual sin tocar los archivos .ctp.

   IMPORTANTE: incluir AL FINAL en head.all.css.ctp
   para que sus reglas sobre-escriban los inline-styles antiguos.

   Acento: Naranja ámbar #ea580c (mantenido del sidebar original)
   Base:   Dark profundo #07090f
   Personalidad: Premium · Técnico · Glassmorphism refinado
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* Backgrounds */
  --irl-bg-0: #07090f;
  --irl-bg-1: #0b0e15;
  --irl-bg-2: #11151e;
  --irl-bg-3: #181c27;
  --irl-bg-4: #232735;

  /* Borders */
  --irl-border-subtle: rgba(255,255,255,0.05);
  --irl-border: rgba(255,255,255,0.08);
  --irl-border-strong: rgba(255,255,255,0.14);
  --irl-border-accent: rgba(234,88,12,0.32);

  /* Text */
  --irl-text: #e6e9ef;
  --irl-text-dim: #9ba3b3;
  --irl-text-mute: #6b7280;
  --irl-text-faint: #4b5563;

  /* Accent — orange amber (matches sidebar) */
  --irl-accent: #ea580c;
  --irl-accent-light: #f97316;
  --irl-accent-bright: #fb923c;
  --irl-accent-glow: rgba(234,88,12,0.32);
  --irl-accent-soft: rgba(234,88,12,0.10);
  --irl-accent-tint: rgba(234,88,12,0.06);

  /* Semantic */
  --irl-ok: #10b981;
  --irl-ok-soft: rgba(16,185,129,0.12);
  --irl-warn: #f59e0b;
  --irl-warn-soft: rgba(245,158,11,0.12);
  --irl-danger: #ef4444;
  --irl-danger-soft: rgba(239,68,68,0.12);
  --irl-info: #38bdf8;
  --irl-info-soft: rgba(56,189,248,0.12);

  /* Fonts */
  --irl-font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --irl-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', ui-monospace, monospace;
}

/* =============================================================
   GLOBAL BODY · PAGE WRAPPER
   ============================================================= */
body {
  background: var(--irl-bg-0) !important;
  color: var(--irl-text) !important;
  font-family: var(--irl-font) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss03';
  letter-spacing: -0.005em;
}

.page-wrapper,
.body-wrapper,
.container-fluid {
  background: var(--irl-bg-0) !important;
}

@keyframes irl-pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
@keyframes irl-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* =============================================================
   TOP HEADER  (.irm-hdr-*)
   Era blanco/claro con indigo — pasa a dark + naranja.
   ============================================================= */
.irm-hdr {
  background: rgba(11,14,21,0.85) !important;
  border-bottom: 1px solid var(--irl-border) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 1px 0 rgba(255,255,255,0.02) inset, 0 4px 12px rgba(0,0,0,0.3);
}

.irm-hdr-nav {
  height: 56px !important;
}

.irm-hdr-toggle {
  color: var(--irl-text-dim) !important;
  border-radius: 8px !important;
}
.irm-hdr-toggle:hover {
  background: var(--irl-bg-3) !important;
  color: var(--irl-text) !important;
}

/* Logo image — keep small but make sure it's not on white */
.irm-hdr-logo-img {
  filter: drop-shadow(0 0 0 transparent);
}

/* Right-side icons & links */
.irm-hdr-actions a,
.irm-hdr-actions button {
  color: var(--irl-text-dim) !important;
}
.irm-hdr-actions a:hover,
.irm-hdr-actions button:hover {
  color: var(--irl-text) !important;
}

/* Avatar button */
.irm-hdr-avatar-btn {
  background: transparent !important;
  border-radius: 10px;
}
.irm-hdr-avatar-btn:hover {
  background: var(--irl-bg-3) !important;
}
.irm-hdr-avatar-wrap {
  background: linear-gradient(135deg, var(--irl-accent), var(--irl-accent-light)) !important;
  box-shadow: 0 2px 8px var(--irl-accent-glow), inset 0 1px 0 rgba(255,255,255,0.18);
}
.irm-hdr-avatar-img {
  border: 2px solid var(--irl-bg-3) !important;
  background: var(--irl-bg-2) !important;
}
.irm-hdr-online-dot {
  background: var(--irl-ok) !important;
  border-color: var(--irl-bg-0) !important;
  box-shadow: 0 0 6px var(--irl-ok);
}
.irm-hdr-chevron {
  color: var(--irl-text-mute) !important;
}

/* Profile dropdown */
.irm-hdr-dropdown {
  background: linear-gradient(180deg, rgba(17,21,30,0.96), rgba(11,14,21,0.98)) !important;
  border: 1px solid var(--irl-border-strong) !important;
  border-radius: 14px !important;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55), 0 4px 12px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.05) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.irm-hdr-dd-user {
  padding: 18px 18px 14px !important;
}
.irm-hdr-dd-avatar-wrap {
  background: linear-gradient(135deg, var(--irl-accent), var(--irl-accent-light)) !important;
  box-shadow: 0 4px 12px var(--irl-accent-glow), inset 0 1px 0 rgba(255,255,255,0.18);
}
.irm-hdr-dd-name {
  color: #fff !important;
}
.irm-hdr-dd-email {
  color: var(--irl-text-dim) !important;
}
.irm-hdr-dd-role {
  background: linear-gradient(135deg, rgba(251,191,36,0.18), rgba(245,158,11,0.10)) !important;
  border: 1px solid rgba(251,191,36,0.28) !important;
  color: #fbbf24 !important;
  border-radius: 5px;
  padding: 2px 8px;
  letter-spacing: 0.06em;
}
.irm-hdr-dd-divider {
  background: var(--irl-border) !important;
}
.irm-hdr-dd-section-title {
  color: var(--irl-text-mute) !important;
  letter-spacing: 0.08em;
}
.irm-hdr-dd-toggle {
  background: var(--irl-bg-1) !important;
  border: 1px solid var(--irl-border);
  color: var(--irl-text) !important;
}
.irm-hdr-dd-toggle i {
  color: var(--irl-accent-light) !important;
}
.irm-hdr-dd-switch {
  background: var(--irl-bg-4) !important;
}
.irm-hdr-dd-toggle input:checked ~ .irm-hdr-dd-switch {
  background: var(--irl-accent) !important;
  box-shadow: 0 2px 6px var(--irl-accent-glow);
}
.irm-hdr-dd-link {
  color: var(--irl-text) !important;
  border-radius: 8px;
}
.irm-hdr-dd-link:hover {
  background: var(--irl-bg-3) !important;
  color: #fff !important;
}
.irm-hdr-dd-link i {
  color: var(--irl-text-mute) !important;
}
.irm-hdr-dd-link:hover i {
  color: var(--irl-accent-light) !important;
}
.irm-hdr-dd-logout {
  color: #f87171 !important;
  background: rgba(239,68,68,0.06) !important;
  border: 1px solid rgba(239,68,68,0.15);
  border-radius: 8px;
}
.irm-hdr-dd-logout:hover {
  background: rgba(239,68,68,0.12) !important;
}

/* Online counter chip */
.online-modern {
  background: var(--irl-bg-1) !important;
  border: 1px solid var(--irl-border);
  color: var(--irl-text) !important;
  border-radius: 999px !important;
  padding: 6px 12px !important;
}
.online-modern::before { display: none !important; }
.online-modern:hover {
  background: var(--irl-bg-3) !important;
  transform: none !important;
}
.users-count {
  color: #fff !important;
  font-family: var(--irl-mono);
}
.users-label {
  color: var(--irl-text-dim) !important;
  font-size: 11px;
}
.status-indicator {
  background: var(--irl-ok) !important;
  width: 6px !important;
  height: 6px !important;
}
.status-indicator::after {
  background: var(--irl-ok) !important;
}

/* Language selector */
.lang-btn {
  background: var(--irl-bg-1) !important;
  border: 1px solid var(--irl-border) !important;
  color: var(--irl-text) !important;
  border-radius: 999px !important;
  padding: 7px 12px !important;
  min-width: auto !important;
}
.lang-btn:hover {
  background: var(--irl-bg-3) !important;
  border-color: var(--irl-border-strong) !important;
}
.lang-menu {
  background: linear-gradient(180deg, rgba(17,21,30,0.96), rgba(11,14,21,0.98)) !important;
  border: 1px solid var(--irl-border-strong) !important;
  border-radius: 12px !important;
  box-shadow: 0 20px 50px rgba(0,0,0,0.55) !important;
  backdrop-filter: blur(20px);
}
.lang-item {
  color: var(--irl-text) !important;
  border-radius: 8px;
  padding: 8px 12px !important;
}
.lang-item:hover {
  background: var(--irl-bg-3) !important;
}
.lang-item.active {
  background: var(--irl-accent-soft) !important;
  color: var(--irl-accent-bright) !important;
}
.lang-item.active::before {
  color: var(--irl-accent-bright) !important;
}
.lang-spinner {
  border-top-color: var(--irl-accent) !important;
}

/* =============================================================
   SIDEBAR  (.irm-sb-* / .irm-sidebar)
   Ya estaba dark + orange — solo refinos.
   ============================================================= */
.irm-sidebar {
  background:
    radial-gradient(circle at 30% 5%, rgba(234,88,12,0.10), transparent 40%),
    radial-gradient(circle at 70% 95%, rgba(249,115,22,0.06), transparent 45%),
    linear-gradient(180deg, #0a0d14 0%, var(--irl-bg-0) 100%) !important;
  border-right: 1px solid var(--irl-border) !important;
}

/* Refine the user section to match the rest */
.irm-sidebar-user {
  background: linear-gradient(180deg, rgba(234,88,12,0.04), transparent) !important;
}

.irm-user-avatar {
  background: linear-gradient(135deg, var(--irl-accent), var(--irl-accent-light)) !important;
  box-shadow: 0 4px 12px var(--irl-accent-glow), inset 0 1px 0 rgba(255,255,255,0.2) !important;
  border-radius: 12px !important;
}
.irm-user-avatar.irm-avatar-admin {
  background: linear-gradient(135deg, #fbbf24, var(--irl-accent)) !important;
}
.irm-user-avatar::after {
  background: #fbbf24 !important;
}

.irm-user-email { color: #fff !important; }
.irm-role-admin {
  background: linear-gradient(135deg, rgba(251,191,36,0.18), rgba(245,158,11,0.10)) !important;
  border: 1px solid rgba(251,191,36,0.28) !important;
  color: #fbbf24 !important;
}

/* Sub bar — make sure unlimited is the shimmer accent */
.irm-sub-bar.irm-sub-unlimited {
  background: linear-gradient(90deg, var(--irl-accent), var(--irl-accent-light), var(--irl-accent-bright)) !important;
  background-size: 200% 100% !important;
  animation: irl-shimmer 3s linear infinite !important;
}
.irm-sub-unlimited-text { color: var(--irl-accent-bright) !important; }

/* Nav links — refined hover & active */
.irm-nav-link {
  font-family: var(--irl-font);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.irm-nav-link:hover {
  background: var(--irl-bg-3) !important;
}
.irm-nav-link.irm-active {
  background: var(--irl-accent-soft) !important;
  border-left: 3px solid var(--irl-accent) !important;
}
.irm-nav-link.irm-active .irm-nav-icon-wrap {
  background: rgba(234,88,12,0.14) !important;
}
.irm-nav-link.irm-active .irm-nav-icon-wrap i {
  color: var(--irl-accent-bright) !important;
  -webkit-text-fill-color: var(--irl-accent-bright) !important;
  filter: drop-shadow(0 0 8px currentColor);
}

.irm-pro-badge {
  background: var(--irl-ok) !important;
  color: #fff !important;
  font-family: var(--irl-mono);
}

.irm-nc-badge {
  background: var(--irl-accent) !important;
  color: #fff !important;
  font-family: var(--irl-mono);
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 10px;
  box-shadow: 0 2px 6px var(--irl-accent-glow);
}

.irm-badge-credits {
  background: var(--irl-ok-soft) !important;
  color: #34d399 !important;
  border: 1px solid rgba(16,185,129,0.22) !important;
  font-family: var(--irl-mono);
}
.irm-badge-ip {
  background: rgba(56,189,248,0.08) !important;
  color: #7dd3fc !important;
  border: 1px solid rgba(56,189,248,0.18) !important;
  font-family: var(--irl-mono);
}

/* =============================================================
   DASHBOARD (system32 — .realm-*)
   Era multicolor glass — pasa a glass naranja unificado.
   ============================================================= */
.realm-dashboard-wrapper {
  background: var(--irl-bg-0) !important;
  color: var(--irl-text);
  font-family: var(--irl-font);
}

/* Glass header — strip the aurora, unify to dark+orange */
.realm-glass-header {
  background: linear-gradient(180deg, rgba(17,21,30,0.96), rgba(11,14,21,0.98)) !important;
  border: 1px solid var(--irl-border-strong) !important;
  border-radius: 18px !important;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05) !important;
  overflow: hidden;
  position: relative;
}
.realm-header-aurora {
  background:
    radial-gradient(circle at 20% 20%, rgba(234,88,12,0.16), transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(249,115,22,0.08), transparent 50%) !important;
  opacity: 1 !important;
}
.realm-header-particles span {
  background: var(--irl-accent-light) !important;
  box-shadow: 0 0 8px var(--irl-accent-glow);
}
.realm-header-wave {
  display: none !important; /* the wavy white edge looked dated */
}

.realm-avatar-glass {
  background: linear-gradient(135deg, var(--irl-accent), var(--irl-accent-light)) !important;
  border: 2px solid rgba(255,255,255,0.15) !important;
  box-shadow: 0 8px 22px var(--irl-accent-glow), inset 0 1px 0 rgba(255,255,255,0.2) !important;
}
.realm-status-dot {
  background: var(--irl-ok) !important;
  border: 3px solid var(--irl-bg-1) !important;
  box-shadow: 0 0 8px var(--irl-ok);
}
.realm-profile-name {
  color: #fff !important;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.realm-profile-email {
  color: var(--irl-text-dim) !important;
}
.realm-role-badge {
  border-radius: 999px !important;
  padding: 4px 12px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase;
}
.realm-role-badge.admin {
  background: linear-gradient(135deg, rgba(251,191,36,0.18), rgba(245,158,11,0.10)) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(251,191,36,0.28) !important;
}
.realm-role-badge.user {
  background: var(--irl-bg-3) !important;
  color: var(--irl-text-dim) !important;
  border: 1px solid var(--irl-border) !important;
}

/* Quick stats inside the header */
.realm-stats-quick {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.realm-quick-stat {
  padding: 10px 16px !important;
  background: rgba(11,14,21,0.55) !important;
  border: 1px solid var(--irl-border) !important;
  border-radius: 10px !important;
  backdrop-filter: blur(10px);
}
.realm-quick-stat-value {
  color: #fff !important;
  font-family: var(--irl-mono) !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em;
}
.realm-quick-stat-label {
  color: var(--irl-text-mute) !important;
  font-size: 10px !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase;
}

/* Nav glass — segmented control */
.realm-nav-glass {
  background: linear-gradient(180deg, rgba(17,21,30,0.7), rgba(11,14,21,0.85)) !important;
  border: 1px solid var(--irl-border) !important;
  border-radius: 14px !important;
  padding: 6px !important;
  gap: 4px;
  backdrop-filter: blur(12px);
}
.realm-nav-btn {
  background: transparent !important;
  border-radius: 9px !important;
  color: var(--irl-text-dim) !important;
  font-family: var(--irl-font) !important;
  font-weight: 600 !important;
  padding: 10px 16px !important;
  transition: all 0.18s;
}
.realm-nav-btn:hover {
  background: var(--irl-bg-3) !important;
  color: var(--irl-text) !important;
}
.realm-nav-btn.active {
  background: linear-gradient(135deg, var(--irl-accent), var(--irl-accent-light)) !important;
  color: #fff !important;
  box-shadow: 0 6px 18px var(--irl-accent-glow), inset 0 1px 0 rgba(255,255,255,0.18) !important;
}
.realm-nav-icon {
  color: inherit !important;
}

/* Mini stats cards in the dashboard */
.realm-cards-grid--mini {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
  gap: 14px !important;
}
.realm-glass-card--mini {
  background: linear-gradient(180deg, rgba(17,21,30,0.7), rgba(11,14,21,0.85)) !important;
  border: 1px solid var(--irl-border) !important;
  border-radius: 14px !important;
  padding: 16px !important;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  /* Strip the wild --card-color-1/-2 gradient — single unified accent */
  --card-color-1: var(--irl-accent) !important;
  --card-color-2: var(--irl-accent-light) !important;
}
.realm-glass-card--mini::before,
.realm-glass-card--mini::after {
  background: linear-gradient(135deg, var(--irl-accent-soft), transparent 60%) !important;
  opacity: 1 !important;
}
.realm-card-badge {
  background: var(--irl-accent-soft) !important;
  color: var(--irl-accent-bright) !important;
  border: 1px solid var(--irl-border-accent) !important;
  border-radius: 999px !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
  padding: 3px 9px !important;
  text-transform: uppercase;
}
.realm-card-icon-wrapper {
  background: var(--irl-accent-soft) !important;
  border: 1px solid var(--irl-border-accent) !important;
  border-radius: 10px !important;
  width: 36px !important;
  height: 36px !important;
}
.realm-card-icon {
  color: var(--irl-accent-bright) !important;
  font-size: 16px !important;
}
.realm-card-label {
  color: var(--irl-text-dim) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}
.realm-card-value {
  color: #fff !important;
  font-family: var(--irl-mono) !important;
  font-weight: 800 !important;
  font-size: 28px !important;
  letter-spacing: -0.02em !important;
}
.realm-card-line-glow {
  background: linear-gradient(90deg, transparent, var(--irl-accent-light), transparent) !important;
}

/* Process table */
.realm-order-row {
  background: transparent !important;
  border-bottom: 1px solid var(--irl-border-subtle) !important;
  transition: background 0.15s;
}
.realm-order-row:hover {
  background: var(--irl-bg-1) !important;
}
.realm-order-row td {
  padding: 12px 14px !important;
  border-bottom: 1px solid var(--irl-border-subtle) !important;
}
.realm-tbl-id {
  color: var(--irl-text-mute) !important;
  font-family: var(--irl-mono) !important;
  font-size: 12px !important;
}

/* Status pills */
.realm-tbl-status {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 3px 10px !important;
  border-radius: 999px !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
}
.realm-tbl-status.success  { background: var(--irl-ok-soft) !important;     color: #34d399 !important; border: 1px solid rgba(16,185,129,0.22) !important; }
.realm-tbl-status.awaiting { background: var(--irl-warn-soft) !important;   color: #fbbf24 !important; border: 1px solid rgba(245,158,11,0.22) !important; }
.realm-tbl-status.visited  { background: var(--irl-info-soft) !important;   color: #7dd3fc !important; border: 1px solid rgba(56,189,248,0.22) !important; }
.realm-tbl-status.passcode { background: var(--irl-accent-soft) !important; color: var(--irl-accent-bright) !important; border: 1px solid var(--irl-border-accent) !important; }
.realm-tbl-status.blocked  { background: var(--irl-danger-soft) !important; color: #f87171 !important; border: 1px solid rgba(239,68,68,0.22) !important; }

/* Visit bar */
.realm-visit-bar {
  background: var(--irl-bg-3) !important;
  height: 3px !important;
  border-radius: 2px !important;
}
.realm-visit-text {
  font-family: var(--irl-mono) !important;
  font-size: 10px !important;
  color: var(--irl-text-mute) !important;
}

/* Script + link + IMEI cells */
.realm-tbl-script {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}
.realm-tbl-script-icon {
  width: 28px !important;
  height: 28px !important;
  border-radius: 7px !important;
  display: grid !important;
  place-items: center !important;
  font-size: 13px !important;
}
.realm-tbl-script-name {
  color: var(--irl-text) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
}
.realm-tbl-link {
  color: var(--irl-accent-light) !important;
  font-family: var(--irl-mono) !important;
  font-size: 12px !important;
  text-decoration: none;
}
.realm-tbl-link:hover {
  color: var(--irl-accent-bright) !important;
  text-decoration: underline;
}
.realm-tbl-imei,
.realm-tbl-notes {
  font-family: var(--irl-mono) !important;
  font-size: 12px !important;
  color: var(--irl-text-dim) !important;
}
.realm-tbl-age {
  font-family: var(--irl-mono) !important;
  font-size: 11px !important;
  color: var(--irl-text-mute) !important;
}
.realm-tbl-creator {
  font-size: 12px !important;
  color: var(--irl-text) !important;
}

/* Action buttons */
.realm-tbl-action-btn {
  width: 26px !important;
  height: 26px !important;
  border-radius: 6px !important;
  background: var(--irl-bg-1) !important;
  border: 1px solid var(--irl-border) !important;
  color: var(--irl-text-dim) !important;
  display: inline-grid !important;
  place-items: center !important;
  transition: all 0.15s !important;
  position: relative;
  margin: 0 2px !important;
}
.realm-tbl-action-btn:hover {
  background: var(--irl-bg-3) !important;
  border-color: var(--irl-border-strong) !important;
  color: #fff !important;
}
.realm-tbl-action-btn.btn-delete:hover  { color: #f87171 !important; border-color: rgba(239,68,68,0.35) !important; }
.realm-tbl-action-btn.btn-block:hover   { color: #f87171 !important; border-color: rgba(239,68,68,0.35) !important; }
.realm-tbl-action-btn.btn-unblock:hover { color: #34d399 !important; border-color: rgba(16,185,129,0.35) !important; }
.realm-tbl-action-btn.btn-edit:hover    { color: var(--irl-accent-bright) !important; border-color: var(--irl-border-accent) !important; }
.realm-tbl-action-btn.btn-sms:hover,
.realm-tbl-action-btn.btn-call:hover,
.realm-tbl-action-btn.btn-whatsapp:hover { color: var(--irl-accent-bright) !important; border-color: var(--irl-border-accent) !important; }
.realm-tbl-action-btn.btn-logs:hover    { color: #7dd3fc !important; border-color: rgba(56,189,248,0.35) !important; }
.realm-tbl-action-btn.btn-creds:hover   { color: #fbbf24 !important; border-color: rgba(251,191,36,0.35) !important; }

.action-badge {
  position: absolute !important;
  top: -3px !important;
  right: -3px !important;
  font-family: var(--irl-mono) !important;
  font-size: 8px !important;
  font-weight: 800 !important;
  min-width: 13px;
  height: 13px;
  padding: 0 3px;
  border-radius: 7px;
  background: var(--irl-accent) !important;
  color: #fff !important;
  border: 1.5px solid var(--irl-bg-1) !important;
  display: grid;
  place-items: center;
}

/* Table header / wrapper */
.realm-content-section {
  background: transparent !important;
}
.realm-content-section table thead th {
  background: var(--irl-bg-1) !important;
  color: var(--irl-text-mute) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  padding: 11px 14px !important;
  border-bottom: 1px solid var(--irl-border) !important;
}

/* ===== Modals (irm-overlay / irm-dialog) ===== */
.irm-backdrop {
  background: rgba(0,0,0,0.78) !important;
}
.irm-dialog {
  background: linear-gradient(180deg, rgba(17,21,30,0.96), rgba(11,14,21,0.98)) !important;
  border: 1px solid var(--irl-border-strong) !important;
  box-shadow: 0 30px 80px rgba(0,0,0,0.55) !important;
}

/* =============================================================
   GLOBAL FORM CONTROLS · BOOTSTRAP OVERRIDES
   ============================================================= */
.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
select.form-control,
textarea.form-control {
  background: var(--irl-bg-1) !important;
  border: 1px solid var(--irl-border) !important;
  color: var(--irl-text) !important;
  border-radius: 10px !important;
  font-family: var(--irl-font);
  font-size: 14px;
  padding: 11px 14px;
  transition: all 0.18s;
}

.form-control:focus,
input:focus {
  background: var(--irl-bg-2) !important;
  border-color: var(--irl-accent) !important;
  box-shadow: 0 0 0 3px var(--irl-accent-soft) !important;
  outline: none !important;
}

.form-control::placeholder,
input::placeholder {
  color: var(--irl-text-faint) !important;
}

/* Default Bootstrap buttons re-skinned */
.btn-primary {
  background: linear-gradient(135deg, var(--irl-accent), var(--irl-accent-light)) !important;
  border-color: var(--irl-accent) !important;
  color: #fff !important;
  font-weight: 600;
  border-radius: 10px;
  box-shadow: 0 6px 18px var(--irl-accent-glow), inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px var(--irl-accent-glow), inset 0 1px 0 rgba(255,255,255,0.22);
}
.btn-secondary,
.btn-default {
  background: var(--irl-bg-3) !important;
  border: 1px solid var(--irl-border) !important;
  color: var(--irl-text) !important;
  border-radius: 10px;
}

/* Preloader */
.preloader {
  background: var(--irl-bg-0) !important;
}

/* Tippy/tooltip tones */
[data-tooltip]::after {
  background: var(--irl-bg-2) !important;
  border: 1px solid var(--irl-border-strong) !important;
  color: var(--irl-text) !important;
}

/* Hide the wavy SVG decoration on top of the dashboard header */
.realm-glass-header svg[viewBox="0 0 1200 30"] {
  display: none !important;
}

/* Force the original sidebar (template) to stay hidden */
.left-sidebar, .app-sidebar {
  display: none !important;
}

/* Card/panel utility — re-skin any random Bootstrap card to dark */
.card {
  background: linear-gradient(180deg, rgba(17,21,30,0.7), rgba(11,14,21,0.85)) !important;
  border: 1px solid var(--irl-border) !important;
  color: var(--irl-text) !important;
  border-radius: 14px !important;
  backdrop-filter: blur(10px);
}
.card-header {
  background: rgba(11,14,21,0.5) !important;
  border-bottom: 1px solid var(--irl-border) !important;
  color: #fff !important;
}

/* Scrollbar global on dark */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--irl-bg-4); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--irl-border-strong); }

/* Selection color */
::selection {
  background: var(--irl-accent-soft);
  color: var(--irl-accent-bright);
}

/* =============================================================
   TYPOGRAPHY HELPERS (opt-in for new code)
   ============================================================= */
.irl-mono { font-family: var(--irl-mono) !important; }
.irl-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--irl-accent-light);
}

/* =============================================================
   BOOTSTRAP UTILITY OVERRIDES — Dark theme for global components
   (covers DataTables Actions dropdown, pagination, badges,
   "btn-light-*" utilities used across the panel)
   ============================================================= */

/* "Actions" dropdown button (DataTables btn-light-secondary) */
.btn-light-secondary,
.btn.btn-light-secondary {
  --bs-btn-color: #e6e9ef !important;
  --bs-btn-bg: var(--irl-bg-2) !important;
  --bs-btn-border-color: var(--irl-border-strong) !important;
  --bs-btn-hover-color: #fff !important;
  --bs-btn-hover-bg: var(--irl-bg-3) !important;
  --bs-btn-hover-border-color: var(--irl-accent) !important;
  --bs-btn-active-color: #fff !important;
  --bs-btn-active-bg: var(--irl-accent) !important;
  --bs-btn-active-border-color: var(--irl-accent) !important;
  --bs-btn-disabled-color: var(--irl-text-mute) !important;
  --bs-btn-disabled-bg: var(--irl-bg-2) !important;
  --bs-btn-disabled-border-color: var(--irl-border) !important;
  color: #e6e9ef !important;
  background: var(--irl-bg-2) !important;
  border: 1px solid var(--irl-border-strong) !important;
}
.btn-light-secondary:hover, .btn.btn-light-secondary:hover {
  color: #fff !important;
  background: var(--irl-bg-3) !important;
  border-color: var(--irl-accent) !important;
}
.btn-light-secondary.text-secondary,
.btn.btn-light-secondary.text-secondary {
  color: #e6e9ef !important;
}

/* Selected count badge inside Actions (bg-primary) */
.btn-light-secondary .badge.bg-primary,
.btn .badge.bg-primary {
  background: linear-gradient(135deg, var(--irl-accent), var(--irl-accent-light)) !important;
  color: #fff !important;
  border: none !important;
  box-shadow: 0 2px 8px var(--irl-accent-glow);
}

/* All Bootstrap utility badges — re-skin for dark */
.badge.bg-primary   { background: linear-gradient(135deg, var(--irl-accent), var(--irl-accent-light)) !important; color: #fff !important; }
.badge.bg-secondary { background: var(--irl-bg-3) !important; color: var(--irl-text) !important; }
.badge.bg-success   { background: rgba(16,185,129,0.15) !important; color: #34d399 !important; border: 1px solid rgba(16,185,129,0.32); }
.badge.bg-info      { background: rgba(56,189,248,0.15) !important; color: #7dd3fc !important; border: 1px solid rgba(56,189,248,0.32); }
.badge.bg-warning   { background: rgba(245,158,11,0.15) !important; color: #fbbf24 !important; border: 1px solid rgba(245,158,11,0.32); }
.badge.bg-danger    { background: rgba(239,68,68,0.15) !important; color: #f87171 !important; border: 1px solid rgba(239,68,68,0.32); }
.badge.bg-muted     { background: var(--irl-bg-3) !important; color: var(--irl-text-mute) !important; border: 1px solid var(--irl-border); }
.badge.bg-light     { background: var(--irl-bg-3) !important; color: var(--irl-text) !important; }
.badge.bg-dark      { background: var(--irl-bg-1) !important; color: var(--irl-text) !important; }

/* =============================================================
   PAGINATION (Bootstrap .page-link / .page-item) — Dark theme
   "Previous 1 2 3 4 5 … 193 Next"
   ============================================================= */
.pagination { --bs-pagination-bg: transparent; gap: 4px; }
.page-link,
.page-item .page-link {
  background: var(--irl-bg-2) !important;
  border: 1px solid var(--irl-border-strong) !important;
  color: var(--irl-text-dim) !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  margin: 0 1px;
  transition: all 0.18s ease;
}
.page-link:hover,
.page-item .page-link:hover {
  background: var(--irl-bg-3) !important;
  border-color: var(--irl-accent) !important;
  color: var(--irl-accent-light) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}
.page-link:focus,
.page-item .page-link:focus {
  background: var(--irl-bg-3) !important;
  border-color: var(--irl-accent) !important;
  color: #fff !important;
  box-shadow: 0 0 0 3px var(--irl-accent-soft) !important;
}
.page-item.active .page-link,
.page-link.active {
  background: linear-gradient(135deg, var(--irl-accent), var(--irl-accent-light)) !important;
  border-color: var(--irl-accent) !important;
  color: #fff !important;
  box-shadow: 0 4px 14px var(--irl-accent-glow);
}
.page-item.disabled .page-link,
.page-link.disabled {
  background: var(--irl-bg-1) !important;
  border-color: var(--irl-border) !important;
  color: var(--irl-text-faint) !important;
  opacity: 0.6;
  cursor: not-allowed;
}

/* DataTables-specific pagination overrides */
.dataTables_wrapper .dataTables_paginate .paginate_button {
  background: var(--irl-bg-2) !important;
  border: 1px solid var(--irl-border-strong) !important;
  color: var(--irl-text-dim) !important;
  border-radius: 8px !important;
  margin: 0 2px !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--irl-bg-3) !important;
  border-color: var(--irl-accent) !important;
  color: var(--irl-accent-light) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: linear-gradient(135deg, var(--irl-accent), var(--irl-accent-light)) !important;
  border-color: var(--irl-accent) !important;
  color: #fff !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  background: var(--irl-bg-1) !important;
  border-color: var(--irl-border) !important;
  color: var(--irl-text-faint) !important;
  cursor: not-allowed;
}

/* DataTables: "Showing X to Y of Z entries" info text */
.dataTables_wrapper .dataTables_info {
  color: var(--irl-text-dim) !important;
  font-weight: 500 !important;
}

/* DataTables: search box ("Search Records...") */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  background: var(--irl-bg-1) !important;
  border: 1px solid var(--irl-border) !important;
  color: var(--irl-text) !important;
  border-radius: 8px !important;
  padding: 7px 12px !important;
}
.dataTables_wrapper .dataTables_filter input::placeholder {
  color: var(--irl-text-faint) !important;
}
.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
  border-color: var(--irl-accent) !important;
  box-shadow: 0 0 0 3px var(--irl-accent-soft) !important;
  outline: none !important;
}

/* Generic Bootstrap dropdown menu — dark */
.dropdown-menu {
  background: var(--irl-bg-2) !important;
  border: 1px solid var(--irl-border-strong) !important;
  box-shadow: 0 12px 36px rgba(0,0,0,0.55) !important;
  border-radius: 10px !important;
  z-index: 1080 !important;          /* above sidebar (~1050) */
  min-width: 140px !important;
}
/* Dropdowns must appear ABOVE the fixed sidebar (z-index ≈ 10–1040).
   Don't override position/transform — let Bootstrap/Popper auto-place
   the menu near the trigger. We just raise z-index. */
.dropdown-menu.show {
  z-index: 1080 !important;
  max-width: calc(100vw - 24px);   /* never wider than viewport */
}

/* =============================================================
   TABLE ROW DROPDOWN — simple 20px right-shift fix
   The 3-dots action menu inside DataTables was being clipped by
   the wrapper's `overflow-x: auto`. We:
   1) Allow overflow:visible on the wrapper when a menu is open (uses :has).
   2) Shift the menu 20px to the right of its computed position so
      Popper's auto-flip-left doesn't push it behind the sidebar.
   ============================================================= */
.table-responsive:has(.dropdown-menu.show),
.dataTables_wrapper:has(.dropdown-menu.show),
.dataTables_scroll:has(.dropdown-menu.show),
.dataTables_scrollBody:has(.dropdown-menu.show),
.card-body:has(.dropdown-menu.show),
.card:has(.dropdown-menu.show) {
  overflow: visible !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
}

/* Nudge row-level dropdowns to the right of Popper's auto position.
   Uses the standalone CSS `translate` property (independent of
   `transform`) so it ADDS to Popper's inline transform instead of
   replacing it. Modern browsers (Chrome 104+, Safari 14.1+, FF 72+). */
.dataTables_wrapper .dropdown-menu.show,
.table-responsive .dropdown-menu.show,
table.dataTable .dropdown-menu.show {
  translate: 20px 0 !important;
}
.dropdown-item {
  color: var(--irl-text) !important;
}
.dropdown-item:hover, .dropdown-item:focus {
  background: var(--irl-bg-3) !important;
  color: var(--irl-accent-light) !important;
}
.dropdown-item.active, .dropdown-item:active {
  background: linear-gradient(135deg, var(--irl-accent), var(--irl-accent-light)) !important;
  color: #fff !important;
}
.dropdown-divider {
  border-color: var(--irl-border) !important;
}

/* =============================================================
   MODAL CLOSE BUTTON (.btn-close) — FORCE VISIBLE WHITE X
   Bootstrap default uses a black SVG icon → invisible on dark cards.
   Strategy: override the --bs-btn-close-bg CSS variable so the SVG
   itself becomes white, AND clear any filter from dark-theme. This
   wins regardless of [data-bs-theme=dark] specificity.
   ============================================================= */
.btn-close,
.modal .btn-close,
.modal-header .btn-close,
.modal-content .btn-close,
[data-bs-theme=dark] .btn-close {
  /* Override the Bootstrap CSS variable with a WHITE-fill SVG */
  --bs-btn-close-bg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3E%3Cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3E%3C/svg%3E") !important;
  --bs-btn-close-opacity: 0.9 !important;
  --bs-btn-close-hover-opacity: 1 !important;
  /* Force-clear the dark-mode invert filter (we already use a white SVG) */
  filter: none !important;
  /* Visible button frame on dark modal */
  background-color: rgba(255,255,255,0.06) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3E%3Cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 14px 14px !important;
  border: 1px solid rgba(255,255,255,0.14) !important;
  border-radius: 8px !important;
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  opacity: 0.9 !important;
  box-sizing: border-box !important;
  transition: background-color 0.18s, border-color 0.18s, opacity 0.18s !important;
}
.btn-close:hover,
.modal .btn-close:hover,
.modal-header .btn-close:hover,
[data-bs-theme=dark] .btn-close:hover {
  background-color: rgba(239,68,68,0.22) !important;
  border-color: rgba(239,68,68,0.55) !important;
  opacity: 1 !important;
  filter: none !important;
}
.btn-close:focus,
.modal .btn-close:focus,
[data-bs-theme=dark] .btn-close:focus {
  box-shadow: 0 0 0 3px rgba(239,68,68,0.20) !important;
  outline: none !important;
  filter: none !important;
}
.btn-close:disabled, .btn-close.disabled {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
}

/* =============================================================
   FORM LABELS — dark theme legibility
   Bootstrap default .form-label uses #2A3547 (dark slate) which is
   invisible on dark backgrounds. Re-tint for unified theme.
   ============================================================= */
.form-label,
.col-form-label,
.form-control-label,
label.form-label,
.form-check-label {
  color: var(--irl-text) !important;
  font-weight: 600 !important;
}
.form-label small,
.col-form-label small,
.form-label .text-muted,
.form-label .text-danger,
.col-form-label .text-muted {
  font-weight: 500 !important;
}
.form-label .text-danger,
.col-form-label .text-danger {
  color: #fb923c !important;     /* warning red→amber, keep visible */
}
.form-label .text-muted,
.col-form-label .text-muted {
  color: var(--irl-text-mute) !important;
}

/* Required-field asterisk (Bootstrap default red on dark needs lighter) */
.form-label .required,
.required-field::after {
  color: #f87171 !important;
}

/* Form input groups input-text (form-text helper) */
.form-text {
  color: var(--irl-text-dim) !important;
}

/* =============================================================
   SHARED RESPONSIVE POLISH — 2026-08
   Conservative compatibility layer for the existing Bootstrap UI.
   Important: width:100% is restricted to the Select2 control that
   Select2 inserts directly after a <select>. It is never applied to
   the floating dropdown container appended to body or to a modal.
   ============================================================= */

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

*,
*::before,
*::after { box-sizing: border-box; }

img,
video,
canvas,
svg { max-width: 100%; }

.body-wrapper,
.body-wrapper > .container-fluid,
.page-wrapper,
.modal,
.offcanvas,
.swal2-container { min-width: 0; }

.body-wrapper > .container-fluid {
  width: 100%;
  max-width: 100%;
  padding-bottom: max(28px, env(safe-area-inset-bottom, 0px));
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid rgba(249,115,22,.34) !important;
  outline-offset: 2px;
}

/* Forms */
:where(.form-control, .form-select, select, textarea,
  input[type='text'], input[type='email'], input[type='password'],
  input[type='tel'], input[type='number'], input[type='search'],
  input[type='url'], input[type='date'], input[type='time'],
  input[type='datetime-local']) {
  max-width: 100%;
  min-height: 42px;
  background-color: var(--irl-bg-1) !important;
  color: var(--irl-text) !important;
  -webkit-text-fill-color: var(--irl-text) !important;
  border: 1px solid var(--irl-border-strong) !important;
  border-radius: 9px !important;
  box-shadow: none !important;
  font-family: var(--irl-font) !important;
}

textarea { min-height: 108px; resize: vertical; }

:where(.form-control, .form-select, select, textarea, input)::placeholder {
  color: var(--irl-text-mute) !important;
  -webkit-text-fill-color: var(--irl-text-mute) !important;
  opacity: 1;
}

:where(.form-control, .form-select, select, textarea, input):focus {
  background-color: var(--irl-bg-2) !important;
  border-color: var(--irl-accent) !important;
  box-shadow: 0 0 0 3px var(--irl-accent-soft) !important;
  outline: 0 !important;
}

:where(.form-control, .form-select, select, textarea, input):disabled,
:where(.form-control, .form-select, select, textarea, input)[readonly] {
  background-color: var(--irl-bg-3) !important;
  color: var(--irl-text-mute) !important;
  -webkit-text-fill-color: var(--irl-text-mute) !important;
  opacity: .72;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--irl-text) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--irl-bg-1) inset !important;
  caret-color: var(--irl-text);
}

.input-group { max-width: 100%; flex-wrap: nowrap; }
.input-group > :where(.form-control, .form-select, .iti, .select2-container) { min-width: 0; }
.input-group-text {
  min-height: 42px;
  background: var(--irl-bg-3) !important;
  color: var(--irl-text-dim) !important;
  border-color: var(--irl-border-strong) !important;
}

.form-check-input {
  background-color: var(--irl-bg-2);
  border-color: var(--irl-border-strong);
}
.form-check-input:checked { background-color: var(--irl-accent); border-color: var(--irl-accent); }

/* Select2 — control width and floating-layer width are intentionally separate. */
select.select2-hidden-accessible + .select2-container,
select[data-select2-id] + .select2-container {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

.select2-container .select2-selection {
  min-height: 42px !important;
  background: var(--irl-bg-1) !important;
  color: var(--irl-text) !important;
  border: 1px solid var(--irl-border-strong) !important;
  border-radius: 9px !important;
}

.select2-container .select2-selection__rendered {
  min-width: 0;
  max-width: 100%;
  color: var(--irl-text) !important;
  line-height: 40px !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select2-container .select2-selection__placeholder { color: var(--irl-text-mute) !important; }
.select2-container .select2-selection__arrow { height: 40px !important; }

/* This is the floating positioning container. Never stretch it to 100%. */
body > .select2-container.select2-container--open,
.modal > .select2-container.select2-container--open,
.modal .select2-container.select2-container--open:has(> .select2-dropdown) {
  width: var(--ThorServer-select2-floating-width, auto) !important;
  min-width: 0 !important;
  max-width: calc(100vw - 16px) !important;
  z-index: 20050 !important;
}

.select2-container--open .select2-dropdown {
  width: 100% !important;
  min-width: min(220px, calc(100vw - 16px));
  max-width: calc(100vw - 16px) !important;
  background: var(--irl-bg-2) !important;
  color: var(--irl-text) !important;
  border: 1px solid var(--irl-border-strong) !important;
  border-radius: 9px !important;
  box-shadow: 0 18px 48px rgba(0,0,0,.58) !important;
  overflow-x: hidden;
}

.select2-search--dropdown { background: var(--irl-bg-2) !important; }
.select2-search--dropdown .select2-search__field {
  width: 100% !important;
  min-height: 42px;
  background: var(--irl-bg-1) !important;
  color: var(--irl-text) !important;
  -webkit-text-fill-color: var(--irl-text) !important;
  border-color: var(--irl-border-strong) !important;
}
.select2-results__options {
  max-width: 100%;
  overflow-x: hidden;
  background: var(--irl-bg-2) !important;
  color: var(--irl-text) !important;
}
.select2-container--default .select2-results__option,
.select2-results__option {
  overflow-wrap: anywhere;
  background: transparent !important;
  color: var(--irl-text) !important;
}

/* Select2 ships a light-gray rule for the current option. Override every
   version-specific selected/highlighted state so dark dropdowns never flash
   white while mouse and keyboard selection move independently. */
.select2-container--default .select2-results__option[aria-selected="true"],
.select2-container--default .select2-results__option--selected,
.select2-results__option[aria-selected="true"] {
  background: var(--irl-bg-3) !important;
  color: var(--irl-text) !important;
}
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable,
.select2-results__option--highlighted {
  background: var(--irl-accent-soft) !important;
  color: var(--irl-accent-bright) !important;
}
.select2-container--default .select2-results__option[aria-disabled="true"],
.select2-results__option--disabled {
  background: transparent !important;
  color: var(--irl-text-mute) !important;
  opacity: .7;
}

/* Native selects are still used in a few legacy forms. Give their popup and
   selected row the same graphite palette where the browser permits styling. */
select,
select option,
select optgroup {
  color-scheme: dark;
  background-color: var(--irl-bg-1);
  color: var(--irl-text);
}
select option:checked {
  background: linear-gradient(var(--irl-bg-3), var(--irl-bg-3));
  color: var(--irl-text);
}

/* intl-tel-input, including the body-portalled mobile popup. */
.iti { display: block; width: 100%; max-width: 100%; }
.iti input { width: 100%; max-width: 100%; }
.iti input.iti__tel-input,
.iti input[type="tel"] {
  background-color: var(--irl-bg-1, #0d1119) !important;
  color: var(--irl-text, #f4f6fa) !important;
  -webkit-text-fill-color: var(--irl-text, #f4f6fa) !important;
  caret-color: var(--irl-text, #f4f6fa) !important;
  border-color: var(--irl-border-strong, rgba(255,255,255,.14)) !important;
  color-scheme: dark;
}
.iti input.iti__tel-input::placeholder,
.iti input[type="tel"]::placeholder {
  color: var(--irl-text-mute, #707887) !important;
  -webkit-text-fill-color: var(--irl-text-mute, #707887) !important;
  opacity: 1;
}
.iti input.iti__tel-input:-webkit-autofill,
.iti input.iti__tel-input:-webkit-autofill:hover,
.iti input.iti__tel-input:-webkit-autofill:focus,
.iti input[type="tel"]:-webkit-autofill {
  -webkit-text-fill-color: var(--irl-text, #f4f6fa) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--irl-bg-1, #0d1119) inset !important;
  box-shadow: 0 0 0 1000px var(--irl-bg-1, #0d1119) inset !important;
}
.iti:focus-within input.iti__tel-input,
.iti:focus-within input[type="tel"] {
  background-color: var(--irl-bg-1, #0d1119) !important;
  border-color: var(--irl-accent, #f97316) !important;
}
.iti__selected-country,
.iti__selected-flag {
  background: transparent !important;
  color: var(--irl-text, #f4f6fa) !important;
}
.iti__selected-country:hover,
.iti__selected-country:focus,
.iti__selected-flag:hover,
.iti__selected-flag:focus { background: rgba(255,255,255,.055) !important; }
.iti__selected-dial-code { color: var(--irl-text-dim, #aeb5c2) !important; }
body > .iti.iti--container {
  width: auto !important;
  max-width: calc(100vw - 16px) !important;
  z-index: 30050 !important;
}
body > .iti.iti--container .iti__dropdown-content,
body > .iti.iti--container .iti__country-list {
  max-width: calc(100vw - 16px) !important;
  max-height: min(62dvh, 440px) !important;
  background: var(--irl-bg-2) !important;
  color: var(--irl-text) !important;
  border-color: var(--irl-border-strong) !important;
  box-shadow: 0 18px 48px rgba(0,0,0,.58) !important;
}

/* The library adds this class only when our adaptive JS detects a compact or
   touch-first device. Keep the popup usable on phones and every iPad size,
   including Safari's desktop user-agent mode. */
body > .iti.iti--container.iti--fullscreen-popup {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  padding: max(16px, env(safe-area-inset-top)) clamp(10px, 3vw, 28px) max(16px, env(safe-area-inset-bottom)) !important;
  overflow: hidden !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(7,9,15,.97) !important;
  overscroll-behavior: none;
}
body > .iti.iti--container.iti--fullscreen-popup .iti__dropdown-content {
  width: min(640px, 100%) !important;
  max-width: 100% !important;
  max-height: calc(100dvh - 32px) !important;
  margin: 0 auto !important;
  border-radius: 16px !important;
  overflow: hidden !important;
  background: var(--irl-bg-2) !important;
}
body > .iti.iti--container.iti--fullscreen-popup .iti__country-list {
  width: 100% !important;
  max-width: 100% !important;
  max-height: min(68dvh, 620px) !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.iti__country.iti__highlight { background: var(--irl-accent-soft) !important; color: var(--irl-accent-bright) !important; }
.iti__dial-code { color: var(--irl-text-dim) !important; }

/* Bootstrap modals: one scroll owner, no horizontal page growth. */
body.modal-open { overflow: hidden !important; }
.modal {
  width: 100vw;
  max-width: 100vw;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  padding: max(10px, env(safe-area-inset-top, 0px)) 10px max(10px, env(safe-area-inset-bottom, 0px)) !important;
  z-index: 10550 !important;
}
.modal-backdrop { z-index: 10540 !important; }

/* Bootstrap backdrops are intentionally disabled across the panel.
 * Several legacy views open nested modals and can leave a .fade.show layer
 * attached to <body>, blocking the complete UI after the dialog closes.
 * Custom page overlays use their own classes and remain unaffected. */
.modal-backdrop,
.modal-backdrop.fade,
.modal-backdrop.show,
.modal-backdrop.fade.show {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* intl-tel-input prefix spacing.
 * Current and legacy versions use different wrapper classes. The JavaScript
 * layer measures the real flag/dial-code width and updates this variable. */
.iti--show-selected-dial-code input.iti__tel-input,
.iti--separate-dial-code input.iti__tel-input {
    padding-left: var(--ThorServer-iti-prefix-space, 96px) !important;
    padding-right: 12px !important;
    min-width: 0 !important;
}

.iti__flag-container,
.iti__selected-country,
.iti__selected-flag,
.iti__selected-dial-code {
    white-space: nowrap !important;
}

[dir="rtl"] .iti--show-selected-dial-code input.iti__tel-input,
[dir="rtl"] .iti--separate-dial-code input.iti__tel-input {
    padding-right: var(--ThorServer-iti-prefix-space, 96px) !important;
    padding-left: 12px !important;
}

.modal-dialog {
  width: min(100%, var(--irl-modal-width, 720px));
  max-width: var(--irl-modal-width, 720px);
  min-height: calc(100% - 1rem);
  margin: .5rem auto !important;
  display: flex;
  align-items: center;
}
.modal-sm { --irl-modal-width: 420px; }
.modal-lg { --irl-modal-width: 960px; }
.modal-xl { --irl-modal-width: 1180px; }

.modal-content {
  width: 100%;
  max-width: 100%;
  max-height: calc(100dvh - 20px);
  display: flex;
  flex-direction: column;
  overflow: hidden !important;
  background: var(--irl-bg-2) !important;
  border: 1px solid var(--irl-border-strong) !important;
  border-radius: 14px !important;
  box-shadow: 0 24px 64px rgba(0,0,0,.6) !important;
}

.modal-header,
.modal-footer { flex: 0 0 auto; border-color: var(--irl-border) !important; }
.modal-body {
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.offcanvas { max-width: min(100vw, 460px); overflow-x: hidden; }
.offcanvas-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }

.swal2-container { z-index: 30000 !important; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)) !important; }
.swal2-popup { max-width: calc(100vw - 24px) !important; }
.daterangepicker,
.datepicker,
.ui-datepicker,
.tooltip,
.popover { z-index: 20070 !important; max-width: calc(100vw - 16px); }

/* Tables and navigation stay inside their own scroll regions. */
.table-responsive,
.ThorServer-auto-table-scroll,
.dataTables_scroll,
.dataTables_scrollBody {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
}

.nav-tabs,
.nav-pills {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  scrollbar-width: thin;
}
.nav-tabs .nav-link,
.nav-pills .nav-link { white-space: nowrap; }

.note-editor,
.note-editable,
.CodeMirror,
.tox,
.cke { max-width: 100% !important; }

@media (max-width: 991.98px) {
  .body-wrapper > .container-fluid { padding-inline: clamp(12px, 3vw, 20px) !important; }
  .dataTables_wrapper .row { gap: 10px 0; }
}

@media (max-width: 767.98px) {
  :where(.form-control, .form-select, select, textarea,
    input[type='text'], input[type='email'], input[type='password'],
    input[type='tel'], input[type='number'], input[type='search'], input[type='url']),
  .select2-search__field {
    min-height: 46px;
    font-size: 16px !important;
  }

  .btn,
  button,
  input[type='button'],
  input[type='submit'] { min-height: 42px; }

  .modal-dialog { min-height: calc(100% - .5rem); margin: .25rem auto !important; }
  .modal-content { max-height: calc(100dvh - 12px); border-radius: 12px !important; }
  .modal-header,
  .modal-body,
  .modal-footer { padding-inline: 14px !important; }
  .modal-footer { gap: 8px; }
  .modal-footer .btn { flex: 1 1 140px; }

  .dataTables_wrapper :where(.dataTables_filter, .dataTables_length) { text-align: left !important; }

  body > .iti.iti--container.iti--fullscreen-popup {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    padding: max(10px, env(safe-area-inset-top)) 8px max(10px, env(safe-area-inset-bottom)) !important;
    background: rgba(7,9,15,.97) !important;
    overflow: hidden !important;
  }
  body > .iti.iti--container.iti--fullscreen-popup .iti__dropdown-content {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 20px) !important;
    margin: 0 auto !important;
  }
}

@media (max-width: 420px) {
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; flex-basis: auto; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .modal { align-items: flex-start; }
  .modal-dialog { min-height: auto; align-items: flex-start; }
  .modal-content { max-height: calc(100dvh - 12px); }
}

@media (prefers-reduced-motion: reduce) {
  .modal *,
  .offcanvas *,
  .select2-container *,
  .iti--container * {
    animation: none !important;
    transition: none !important;
  }

  /* A 0.01ms duration makes infinite loaders run thousands of times per
     second. Disable motion cleanly instead of producing the accelerated
     flicker reported in modals and phone/select widgets. */
  html body *,
  html body *::before,
  html body *::after {
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

/* =============================================================
   EMBEDDED INPUT ICONS
   Font Awesome/Tabler search glyphs are absolutely positioned in
   many legacy views. Reserve a dedicated inline slot so global form
   padding can never place placeholder text underneath the glyph.
   ============================================================= */
html body :is([class*="search"], .position-relative):not(.irm-nav-search)
  > :is(i.fa-search, i.fa-magnifying-glass, i.ti-search,
        i[class*="search-icon"], span[class*="search-icon"]) {
  position: absolute !important;
  inset-inline-start: 14px !important;
  inset-inline-end: auto !important;
  top: 50% !important;
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  display: grid !important;
  place-items: center !important;
  transform: translateY(-50%) !important;
  line-height: 1 !important;
  pointer-events: none !important;
  z-index: 3 !important;
}

html body :is([class*="search"], .position-relative)
  :has(> :is(i.fa-search, i.fa-magnifying-glass, i.ti-search,
             i[class*="search-icon"], span[class*="search-icon"]))
  > input:not([type="checkbox"]):not([type="radio"]):not([type="file"]) {
  box-sizing: border-box !important;
  padding-inline-start: 42px !important;
  text-indent: 0 !important;
}

html body :is([class*="search"], .position-relative)
  :has(> :is(button, a)[class*="clear"])
  > input:not([type="checkbox"]):not([type="radio"]):not([type="file"]) {
  padding-inline-end: 42px !important;
}

/* Dashboard contract: protect both slots even if its inline CSS changes. */
html body .realm-search-input-wrapper > .realm-search-input {
  padding-left: 42px !important;
  padding-inline-start: 42px !important;
}
html body .realm-search-input-wrapper > .realm-search-clear > i,
html body :is([class*="search"], .position-relative)
  > :is(button, a)[class*="clear"] > i {
  position: static !important;
  inset: auto !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  display: inline-block !important;
  transform: none !important;
  line-height: 1 !important;
}
