/* ===================================================================
   Jelli Track WebApp — site.css
   ===================================================================

   THEMING SYSTEM
   ==============
   This stylesheet uses CSS custom properties (variables) for consistent
   theming across light and dark modes. The theme is toggled by adding
   the `jl-dark-mode` class to the <body> element.

   STRUCTURE
   =========
   1. CSS Custom Properties (Theme Variables)
   2. Base / Resets
   3. Utilities / Layout
   4. Shared Components (tabs, cards, badges, etc.)
   5. Page-Specific Sections
   6. Dark Mode Overrides

   NAMING CONVENTIONS
   ==================
   - `jl-` prefix for all custom classes (avoids Bootstrap collisions)
   - `--jl-` prefix for CSS custom properties
   - State classes use `jl-is-*` or `jl-state-*` patterns

   =================================================================== */

/* ============================================================
   1. CSS CUSTOM PROPERTIES — THEME VARIABLES
   ============================================================

   These variables define the color palette for both light and dark modes.
   Light mode values are set in :root, dark mode overrides in body.jl-dark-mode.

   Variable naming:
   - bg-*      : Background colors
   - text-*    : Text/foreground colors
   - border-*  : Border colors
   - accent-*  : Brand/accent colors
   - status-*  : Status indicator colors (success, warning, error)
   ============================================================ */

:root {
  /* ---- Background Colors ---- */
  --jl-bg-body: #ffffff;
  --jl-bg-surface: #ffffff;
  --jl-bg-surface-raised: #f8f9fa;
  --jl-bg-surface-sunken: #f1f3f5;
  --jl-bg-overlay: rgba(0, 0, 0, 0.6);
  --jl-bg-hover: rgba(0, 0, 0, 0.04);
  --jl-bg-selected: rgba(13, 110, 253, 0.12);

  /* ---- Text Colors ---- */
  --jl-text-primary: #111111;
  --jl-text-secondary: #555555;
  --jl-text-muted: #6c757d;
  --jl-text-disabled: #adb5bd;
  --jl-text-inverse: #ffffff;
  --jl-text-link: #0d6efd;
  --jl-text-link-hover: #0a58ca;

  /* ---- Border Colors ---- */
  --jl-border-default: #c8c8c8;
  --jl-border-light: #dddddd;
  --jl-border-strong: #aaaaaa;
  --jl-border-focus: #0d6efd;

  /* ---- Accent/Brand Colors ---- */
  --jl-accent-primary: #0d6efd;
  --jl-accent-primary-hover: #0b5ed7;
  --jl-accent-primary-active: #0a58ca;
  --jl-accent-secondary: #6c757d;

  /* ---- Status Colors ---- */
  --jl-status-success-bg: #d4edda;
  --jl-status-success-border: #b7e2bf;
  --jl-status-success-text: #155724;

  --jl-status-warning-bg: #fff3cd;
  --jl-status-warning-border: #ffe69c;
  --jl-status-warning-text: #664d03;

  --jl-status-error-bg: #f8d7da;
  --jl-status-error-border: #f5c6cb;
  --jl-status-error-text: #721c24;

  --jl-status-info-bg: #cce5ff;
  --jl-status-info-border: #b8daff;
  --jl-status-info-text: #004085;

  /* ---- Shadows ---- */
  --jl-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --jl-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --jl-shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.15);

  /* ---- Transitions ---- */
  --jl-transition-fast: 0.1s ease;
  --jl-transition-normal: 0.15s ease;
  --jl-transition-slow: 0.25s ease;

  /* ---- Border Radius ---- */
  --jl-radius-sm: 4px;
  --jl-radius-md: 6px;
  --jl-radius-lg: 8px;
  --jl-radius-xl: 12px;
  --jl-radius-pill: 999px;

  /* ---- Spacing (used in some components) ---- */
  --jl-spacing-xs: 4px;
  --jl-spacing-sm: 8px;
  --jl-spacing-md: 12px;
  --jl-spacing-lg: 16px;
  --jl-spacing-xl: 24px;
}

/* Dark Mode Theme Variables */
body.jl-dark-mode {
  /* ---- Background Colors ---- */
  --jl-bg-body: #0f1115;
  --jl-bg-surface: #141821;
  --jl-bg-surface-raised: #1a2030;
  --jl-bg-surface-sunken: #0f1420;
  --jl-bg-overlay: rgba(0, 0, 0, 0.75);
  --jl-bg-hover: rgba(255, 255, 255, 0.06);
  --jl-bg-selected: rgba(37, 99, 235, 0.25);

  /* ---- Text Colors ---- */
  --jl-text-primary: #e6e6e6;
  --jl-text-secondary: #b0b8c4;
  --jl-text-muted: #9aa4af;
  --jl-text-disabled: #6e7681;
  --jl-text-inverse: #0f1115;
  --jl-text-link: #8ab4ff;
  --jl-text-link-hover: #a8c8ff;

  /* ---- Border Colors ---- */
  --jl-border-default: #2a2f3a;
  --jl-border-light: #1e2430;
  --jl-border-strong: #3a4150;
  --jl-border-focus: #2563eb;

  /* ---- Accent/Brand Colors ---- */
  --jl-accent-primary: #2563eb;
  --jl-accent-primary-hover: #1e4fd3;
  --jl-accent-primary-active: #1a45ba;
  --jl-accent-secondary: #6c757d;

  /* ---- Status Colors ---- */
  --jl-status-success-bg: #142a19;
  --jl-status-success-border: #214c2b;
  --jl-status-success-text: #bfe7cc;

  --jl-status-warning-bg: #2c1f00;
  --jl-status-warning-border: #6a4b00;
  --jl-status-warning-text: #ffd28a;

  --jl-status-error-bg: #2a1416;
  --jl-status-error-border: #5b2b33;
  --jl-status-error-text: #f7c6cc;

  --jl-status-info-bg: #0d1f33;
  --jl-status-info-border: #1a3d66;
  --jl-status-info-text: #9bd5ff;

  /* ---- Shadows (stronger in dark mode) ---- */
  --jl-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --jl-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
  --jl-shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.45);
}

/* ============================================================
   2. BASE / RESETS
   ============================================================ */
html, body { overflow-x: hidden; overflow-y: auto; }

/* Smooth page-scrolling control (used to temporarily lock page scroll) */
.jl-no-page-scroll { height: 100%; margin: 0; overflow: hidden; }

/* Content area below the navbar */
.jl-content-container { height: calc(100% - 56px); overflow-y: auto; padding: 2rem; }

/* Keyframes (keep both names for legacy) */
@keyframes flashHighlight {
  0%, 100% { background-color: inherit; font-weight: normal; }
  50% { background-color: #fff3cd; font-weight: bold; }
}
@keyframes flash {
  0%, 100% { background-color: inherit; font-weight: normal; }
  50% { background-color: #fff3cd; font-weight: bold; }
}

/* Reusable highlight utility */
.jl-highlight-flash { animation: flashHighlight 2s ease-in-out 3; }

/* Generic scroll frame (used across pages) */
.jl-scroll-frame {
  max-height: 500px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
}

/* Buttons reused in some lists */
.jl-company-button {
  display: block; width: 100%;
  padding: 12px; margin: 6px 0;
  background-color: #007bff; color: #fff;
  border: none; border-radius: 6px;
  cursor: pointer; font-size: 1rem;
}
.jl-company-button:hover { background-color: #0056b3; }

/* Table truncation helpers (used widely) */
table td, td.jl-sort-caret--description-cell {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 250px;
}

/* ========================
   Utilities / Layout
   ======================== */
.jl-pair { display:flex; gap:12px; align-items:flex-end; flex-wrap:wrap; }
.jl-pair .jl-box { flex: 1 1 360px; min-width: 340px; }
.jl-actions { display:flex; justify-content:center; }

/* Horizontal scroller defaults */
.jl-org-scroller {
  display:grid; grid-auto-flow:column;
  grid-auto-columns: calc((100% - 4*12px) / 5);
  gap:12px; overflow-x:auto; scroll-behavior:auto;
  padding: 10px 0 10px 12px;
}

/* Generic info box */
.jl-info-box { border:1px solid #ddd; border-radius:8px; background:#fafafa; padding:12px; }
.jl-info-grid { display:grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap:8px 16px; }
.jl-info-row label { font-weight:600; margin-right:6px; }

/* ========================
   Shared Components
   ======================== */
/* Tabs */
.jl-tabs { display:flex; gap:8px; flex-wrap:wrap; }
.jl-tabs__btn {
  display:inline-block; padding:8px 12px;
  border:1px solid #ddd; border-radius:6px; background:#fff;
  text-decoration:none; color:#111; font-weight:600;
}
.jl-tabs__btn:hover { background:#f3f4f6; }
.jl-tabs__btn.active { background:#2563eb; color:#fff; border-color:#2563eb; }

/* Org/company cards */
.jl-org-card {
  display:block; border:1px solid #ddd; border-radius:8px; background:#fff;
  color:#111; text-decoration:none; padding:10px 12px; min-height:82px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.jl-org-card.jl-is-selected { outline:2px solid #2563eb; background:#eef5ff; }
.jl-org-card__title { font-weight:600; margin-bottom:4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.jl-org-card__meta  { font-size:12px; color:#555; line-height:1.2; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* Search row (Datto, Ingram, etc.) */
.jl-search { display:flex; gap:10px; align-items:center; }
.jl-search input[type="text"] { flex:1; padding:8px 10px; border:1px solid #ccc; border-radius:6px; }
.jl-search button { padding:8px 14px; border:1px solid #ddd; border-radius:6px; background:#f5f5f5; cursor:pointer; }

/* Generic table frame wrapper */
.table-frame { border:1px solid var(--jl-border-strong); border-radius:8px; background:var(--jl-bg-surface); overflow:auto; }
table { width:100%; border-collapse:collapse; }
th, td { padding:8px 10px; border-bottom:1px solid var(--jl-border-default); white-space:nowrap; }
thead th { background:#f0f1f3; position:sticky; top:0; z-index:1; border-bottom:2px solid var(--jl-border-strong) !important; }
body.jl-dark-mode thead th { background:#1a2030 !important; color:#e6e6e6 !important; border-color:#2a2f3a !important; }

/* Status badges */
.badge { padding:2px 8px; border-radius:999px; font-size:12px; display:inline-block; }
.jl-badge--added { background:#e6ffed; color:#076e25; border:1px solid #b7f0c4; }
.jl-badge--updated { background:#eef3ff; color:#1e40af; border:1px solid #cdd7ff; }
.jl-badge--deleted { background:#fff1f2; color:#991b1b; border:1px solid #ffd5d8; }
body.jl-dark-mode .jl-badge--added { background:rgba(22,163,74,.15); color:#7ee787; border-color:rgba(22,163,74,.4); }
body.jl-dark-mode .jl-badge--updated { background:rgba(59,130,246,.15); color:#8ab4ff; border-color:rgba(59,130,246,.4); }
body.jl-dark-mode .jl-badge--deleted { background:rgba(239,68,68,.15); color:#ff7b72; border-color:rgba(239,68,68,.4); }

/* Banners / messages (shared) */
.jl-banner,
.jl-msg {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #f8f9fb;
  color: #111;
}

/* State modifiers (use .jl-is-*) */
.jl-banner.jl-is-ok,
.jl-msg.jl-is-ok { background:#e7f6e7; border-color:#b5e1b5; color:#1f4d1f; }

.jl-banner.jl-is-err,
.jl-msg.jl-is-err { background:#fff1f2; border-color:#ffd5d8; color:#991b1b; }

/* Pager */
.jl-pager { display:flex; gap:8px; align-items:center; }
.jl-pager a, .jl-pager span, .jl-pager input {
  border:1px solid #ddd; padding:4px 10px; border-radius:6px; background:#fff; text-decoration:none; color:#111;
}
.jl-pager .disabled { opacity:.5; pointer-events:none; }

/* Notifications dropdown sizing */
.jl-notif__badge { position:absolute; top:2px; right:0; transform: translate(35%, -35%); }
.jl-notif-item__title { font-weight:650; font-size:1rem; line-height:1.25; }
.jl-notif-item__sub   { font-size:.86rem; color:#9aa7b5; line-height:1.25; }
.jl-notif-item__time  { font-size:.8rem; color:#7f8b98; }
.jl-notif-item__title,
.jl-notif-item__sub {
  display:-webkit-box;
  -webkit-box-orient: vertical;
  overflow:hidden;
}
.jl-notif-item__title { -webkit-line-clamp: 2; }
.jl-notif-item__sub { -webkit-line-clamp: 3; }

.dropdown-menu-notifs { width:520px; max-width:95vw; max-height:60vh; overflow-y:auto; }
@media (max-width:576px){ .dropdown-menu-notifs{ width:100vw; max-width:100vw; } }

/* Notification grouping styles */
.jl-notif-group { border-bottom: 1px solid var(--jl-border-light); }
.jl-notif-group:last-child { border-bottom: none; }
.jl-notif-group__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--jl-bg-surface-sunken);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--jl-text-secondary);
}
.jl-notif-group__label { flex: 1; }
.jl-notif-group .list-group-item {
  padding: 10px 12px 10px 24px;
  border-left: 3px solid transparent;
}
.jl-notif-group .list-group-item:not(.jl-notif-read) {
  border-left-color: var(--jl-accent-primary);
  background: rgba(13, 110, 253, 0.04);
}
.jl-notif-read {
  opacity: 0.7;
  background: var(--jl-bg-surface);
}
.jl-notif-read .jl-notif-item__title { font-weight: 500; }

/* Notification groups (full page) */
.jl-notif-groups { display: flex; flex-direction: column; gap: 16px; }
.jl-notif-section {
  background: var(--jl-bg-surface);
  border: 1px solid var(--jl-border-default);
  border-radius: 8px;
  overflow: hidden;
}
.jl-notif-section__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--jl-bg-surface-sunken);
  cursor: pointer;
  user-select: none;
}
.jl-notif-section__header:hover { background: var(--jl-bg-hover); }
.jl-notif-section__icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--jl-bg-surface);
  font-size: 1.1rem;
}
.jl-notif-section__info { flex: 1; }
.jl-notif-section__title { font-weight: 600; font-size: 1rem; }
.jl-notif-section__desc { font-size: 0.85rem; color: var(--jl-text-muted); margin-top: 2px; }
.jl-notif-section__badges { display: flex; gap: 6px; }
.jl-notif-section__toggle { color: var(--jl-text-muted); transition: transform var(--jl-transition-fast); }
.jl-notif-section.jl-collapsed .jl-notif-section__body { display: none; }
.jl-notif-section__body { border-top: 1px solid var(--jl-border-light); }

.jl-notif-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--jl-border-light);
  background: var(--jl-bg-surface);
}
.jl-notif-card:last-child { border-bottom: none; }
.jl-notif-card:not(.jl-notif-card--read) {
  border-left: 3px solid var(--jl-accent-primary);
  background: rgba(13, 110, 253, 0.03);
}
.jl-notif-card--read { opacity: 0.7; }
.jl-notif-card__main { flex: 1; min-width: 0; }
.jl-notif-card__title { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jl-notif-card__msg { font-size: 0.85rem; color: var(--jl-text-secondary); margin-top: 2px; }
.jl-notif-card__context { font-size: 0.85rem; color: var(--jl-text-muted); margin-top: 2px; }
.jl-notif-card__time { font-size: 0.8rem; color: var(--jl-text-muted); margin-top: 4px; }
.jl-notif-card__actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ============================================================
   DASHBOARD STYLES
   ============================================================ */
.jl-dashboard { max-width: 1400px; margin: 0 auto; }

/* Welcome Banner */
.jl-welcome-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 28px;
  background: linear-gradient(135deg, var(--jl-accent-primary) 0%, #4f46e5 100%);
  border-radius: 12px;
  margin-bottom: 24px;
  color: #fff;
}
.jl-welcome-banner__greeting {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 4px 0;
}
.jl-welcome-banner__subtitle {
  font-size: 0.95rem;
  opacity: 0.9;
  margin: 0;
}
.jl-welcome-banner__last-login {
  display: block;
  margin-top: 4px;
  font-size: 0.85rem;
  opacity: 0.75;
}
.jl-welcome-banner__actions { flex-shrink: 0; }
.jl-welcome-banner .jl-btn--outline {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.3);
  color: #fff;
}
.jl-welcome-banner .jl-btn--outline:hover {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.5);
}
.jl-btn__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 8px;
  background: #ef4444;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Dashboard Sections */
.jl-dashboard__section {
  margin-bottom: 24px;
}
.jl-dashboard__section--half { flex: 1; min-width: 0; }
.jl-dashboard__section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--jl-text-primary);
  margin: 0 0 16px 0;
}
.jl-dashboard__section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.jl-dashboard__section-header .jl-dashboard__section-title { margin: 0; }
.jl-dashboard__row {
  display: flex;
  gap: 24px;
}
@media (max-width: 991px) {
  .jl-dashboard__row { flex-direction: column; }
}

/* Metrics Grid */
.jl-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.jl-metric-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--jl-bg-surface);
  border: 1px solid var(--jl-border-default);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: all var(--jl-transition-normal);
}
.jl-metric-card--clickable:hover {
  border-color: var(--jl-accent-primary);
  box-shadow: var(--jl-shadow-md);
  transform: translateY(-2px);
}
.jl-metric-card__icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.jl-metric-card__icon--primary { background: rgba(13, 110, 253, 0.12); color: #0d6efd; }
.jl-metric-card__icon--success { background: rgba(25, 135, 84, 0.12); color: #198754; }
.jl-metric-card__icon--danger { background: rgba(220, 53, 69, 0.12); color: #dc3545; }
.jl-metric-card__icon--warning { background: rgba(255, 193, 7, 0.12); color: #d97706; }
.jl-metric-card__icon--info { background: rgba(13, 202, 240, 0.12); color: #0891b2; }
.jl-metric-card__icon--secondary { background: rgba(108, 117, 125, 0.12); color: #6c757d; }
.jl-metric-card__icon--purple { background: rgba(139, 92, 246, 0.12); color: #8b5cf6; }
.jl-metric-card__content { flex: 1; min-width: 0; }
.jl-metric-card__value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--jl-text-primary);
}
.jl-metric-card__label {
  font-size: 0.875rem;
  color: var(--jl-text-secondary);
  margin-top: 2px;
}
.jl-metric-card__sub {
  font-size: 0.8rem;
  color: var(--jl-text-muted);
  margin-top: 2px;
}
.jl-metric-card__sub--warning { color: #d97706; }

/* Quick Actions */
.jl-quick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.jl-action-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--jl-bg-surface);
  border: 1px solid var(--jl-border-default);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: all var(--jl-transition-normal);
  text-align: left;
  width: 100%;
  font-family: inherit;
  font-size: inherit;
}
.jl-action-card:hover {
  border-color: var(--jl-accent-primary);
  background: var(--jl-bg-hover);
}
.jl-action-card:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.jl-action-card__icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--jl-bg-surface-sunken);
  border-radius: 8px;
  color: var(--jl-accent-primary);
  flex-shrink: 0;
}
.jl-action-card__content { flex: 1; min-width: 0; }
.jl-action-card__title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--jl-text-primary);
}
.jl-action-card__desc {
  font-size: 0.8rem;
  color: var(--jl-text-muted);
  margin-top: 2px;
}
.jl-action-card__arrow {
  color: var(--jl-text-muted);
  flex-shrink: 0;
}

/* Status Panel */
.jl-status-panel {
  background: var(--jl-bg-surface);
  border: 1px solid var(--jl-border-default);
  border-radius: 10px;
  overflow: hidden;
}
.jl-status-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--jl-border-light);
}
.jl-status-item:last-child { border-bottom: none; }
.jl-status-item__icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--jl-bg-surface-sunken);
  border-radius: 8px;
  color: var(--jl-text-secondary);
  flex-shrink: 0;
}
.jl-status-item__content { flex: 1; }
.jl-status-item__title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--jl-text-primary);
}
.jl-status-item__detail {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--jl-text-muted);
  margin-top: 2px;
}

/* Notifications List (Dashboard) */
.jl-notifications-list {
  background: var(--jl-bg-surface);
  border: 1px solid var(--jl-border-default);
  border-radius: 10px;
  overflow: hidden;
}
.jl-notifications-list__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px;
  color: var(--jl-text-muted);
}
.jl-notifications-list__empty--error { color: var(--jl-status-error-text); }
.jl-notif-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--jl-border-light);
  text-decoration: none;
  color: inherit;
  transition: background var(--jl-transition-fast);
}
.jl-notif-row:last-child { border-bottom: none; }
.jl-notif-row:hover { background: var(--jl-bg-hover); }
.jl-notif-row:not(.jl-notif-row--read) {
  border-left: 3px solid var(--jl-accent-primary);
}
.jl-notif-row--read { opacity: 0.7; }
.jl-notif-row__icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.jl-notif-row__content { flex: 1; min-width: 0; }
.jl-notif-row__title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--jl-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jl-notif-row__sub {
  font-size: 0.8rem;
  color: var(--jl-text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jl-notif-row__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.jl-notif-row__time {
  font-size: 0.75rem;
  color: var(--jl-text-muted);
}

/* Link style */
.jl-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.875rem;
  color: var(--jl-accent-primary);
  text-decoration: none;
}
.jl-link:hover { text-decoration: underline; }

/* Small badge variant */
.jl-badge--sm {
  font-size: 0.7rem;
  padding: 2px 6px;
}

/* Responsive adjustments */
@media (max-width: 767px) {
  .jl-welcome-banner {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }
  .jl-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .jl-metric-card {
    flex-direction: column;
    text-align: center;
    padding: 16px;
  }
  .jl-notif-row__meta { display: none; }
}
@media (max-width: 575px) {
  .jl-metrics-grid {
    grid-template-columns: 1fr;
  }
}

/* Navbar tweaks */
.dropdown-toggle-split::after { margin-left:.25rem; }
nav.navbar { margin-bottom:8px; }
@media (min-width:992px){
  .navbar .dropdown:hover > .dropdown-menu:not(.dropdown-menu-notifs),
  .navbar .dropdown:focus-within > .dropdown-menu:not(.dropdown-menu-notifs) { display:block; }
  .navbar .dropdown-menu { margin-top:0; }
}

/* ========================
   Page Sections
   ======================== */
/* --- Agreements --- */
#agreements .hidden { display:none !important; }
#companyList.jl-scroll-frame { max-height:300px; } /* Scoped height for company list */
.list-group-item.jl-is-active { background-color:#0d6efd; color:#fff; }
.card.jl-is-selected { border:2px solid #0d6efd; }
.jl-additions__frame {
  max-height:300px;
  overflow:auto;
  border-top:1px solid #ddd;
  padding:0;              /* IMPORTANT: avoid sticky header "bleed" into padded area */
  position:relative;
  background:#fff;
}

/* /Agreements: additions table sticky header should fully cover rows while scrolling */
#additionsDetails table.table{
  margin:0;
  border-collapse:separate;  /* fixes sticky header artifacts seen with border-collapse:collapse */
  border-spacing:0;
}
#additionsDetails table.table thead th{
  position:sticky;
  top:0;
  z-index:10;
  background:#f8f9fb;        /* ensure opaque header */
  background-clip:padding-box;
}

/* Agreements: metadata card (agreement details) */
.jl-metadata-card {
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  background-color: #f8f9fa;
}

/* Agreements scroller */
#agreementsScroll { padding-left:12px; padding-top:8px; padding-bottom:8px; }
#agreementsScroll .card { flex:0 0 320px; min-width:280px; max-width:360px; }
#agreementsScroll .card h5 { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-bottom:6px; }
#agreementsScroll .card p { margin-bottom:0; }
@media (max-width:900px){ #agreementsScroll .card{ flex-basis:260px; } }

/* Agreements: card meta + inactive styling */
.jl-agreement-card__meta { font-size: 12px; color: #555; margin-top: 6px; }
.jl-inactive-card { background: #f8d7da; border-color: #f5c6cb; }
.jl-inactive-chip { background: #f8d7da; border-color: #f5c6cb; }

/* Agreements: inactive additions (red like Datto's "unprotected") */
#additionsDetails tr.jl-inactive-row > td { background-color: #f8d7da !important; }

/* Agreements: invoice popup overlay */
.popup-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
}

.invoice-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(720px, 92vw);
  max-height: min(70vh, 720px);
  overflow: auto;
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  transform: translate(-50%, -50%);
  z-index: 1000;
  box-shadow: 0 0 20px rgba(0,0,0,0.3);
}

.invoice-popup button.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
}

/* Bottom additions table borders */
#additionsDetails table.table,
#additionsDetails table.table :not(caption) > * > * { border-color:#eee; }

/* --- Agreement Tracking --- */
.jl-frame.jl-frame--ms { max-height: calc(100vh - 210px); overflow: auto; }

/* Agreements matching */
.jl-agreements-match__groupsFrame{max-height: 320px; overflow:auto;}
.jl-agreements-match__detailsFrame{max-height: 800px; overflow:auto;}

/* AgreementsMatch: make the match list + item tables comfortably tall (page-scoped overrides).
   This page stacks multiple filterable tables; keep each table readable without being huge. */
.jl-page--agreementsmatch .jl-agreements-match__groupsFrame{
  max-height: min(520px, 45vh);
}
.jl-page--agreementsmatch .jl-agreements-match__detailsFrame{
  max-height: calc(100vh - 320px);
}
.jl-page--agreementsmatch .jl-table-scroll{
  max-height: min(520px, 55vh);
}

/* Back-compat (older class names from earlier iterations). */
.page-agreementsmatch .match-table-scroll{ max-height: min(520px, 45vh); overflow:auto; }
.page-agreementsmatch .table-scroll{ max-height: min(520px, 55vh); overflow:auto; }
.jl-agreements__row{cursor:pointer;}
.jl-agreements__row.jl-agreements__row--selected{outline: 1px solid rgba(59,130,246,0.55);}


/* M365 Connections toolbar layout */
.jl-m365-connections-toolbar { display:flex; flex-direction:column; gap:8px; align-items:flex-end; }
.jl-m365-connections-toolbar-row { display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
.jl-m365-connections-toolbar .jl-top-btn { width: 210px; }

/* M365 Connections table: allow action buttons to fully render and enable horizontal scroll */
.jl-m365-connections-table { min-width: 1150px; }
.jl-m365-connections-table td.jl-actions__cell {
  max-width:none;
  overflow:visible;
  text-overflow:clip;
  white-space:nowrap;
}
.table-responsive {height: auto;}
.jl-frame { max-height:260px; overflow-y:auto; border:1px solid #ddd; border-radius:6px; padding:10px; background:#fff; }
.row-line { display:flex; align-items:center; justify-content:space-between; padding:6px 8px; border-bottom:1px solid #eee; }
body.jl-dark-mode .row-line { border-bottom-color:#2a2f3a; }
.row-line:last-child { border-bottom:none; }
.jl-company__left { display:flex; gap:12px; align-items:center; min-width:0; }
.jl-company__name { font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:38vw; }
.jl-type-pill { font-size:.85rem; background:#eef4ff; border:1px solid #d6e4ff; border-radius:999px; padding:2px 10px; color:#2b59c3; }
body.jl-dark-mode .jl-type-pill { background:#1a2744; border-color:#2a3f6a; color:#8ab4ff; }
.jl-section-title { font-size:1.05rem; font-weight:600; margin-bottom:6px; }

#agreementcards { display:flex; overflow-x:auto; gap:8px; padding-left:12px; padding-top:8px; padding-bottom:8px; }
#agreementcards .card { flex:0 0 320px; min-width:280px; max-width:360px; }
#agreementcards .card h5, #agreementcards .card .card-title { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-bottom:6px; }
@media (max-width:900px){ #agreementcards .card{ flex-basis:260px; } }

/* --- Datto --- */
.jl-datto-wrap { display:grid; gap:16px; }
.jl-counts { display:flex; flex-wrap:wrap; gap:10px; margin-top:6px; }
.jl-chip { border-radius:999px; display:inline-flex; align-items:center; }
.jl-chip--count { border:1px solid #ddd; border-radius:999px; padding:6px 10px; background:#fff; font-size:12px; }

.jl-seat-list { display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:12px; }
@media (max-width:900px){ .jl-seat-list{ grid-template-columns:1fr; } }

.jl-seat-card { border-radius:8px; padding:10px 12px; border:1px solid #ddd; color:#000; }
.jl-state-active { background:#d4edda; }     /* light green */
.jl-state-archived { background:#e9ecef; }   /* light grey */
.jl-state-unprotected { background:#f8d7da; }/* light red */

.jl-seat-head { font-weight:600; margin-bottom:4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.jl-seat-head .jl-muted { font-weight:400; color:#333; }
.jl-seat-line { font-size:12px; color:#111; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }

.jl-no-results { padding:10px; border-radius:8px; background:#fff3cd; border:1px solid #ffe69c; color:#664d03; }

/* --- Ingram --- */
.jl-ingram-wrap { display:grid; gap:16px; }

/* Table used on Ingram and elsewhere */
table.jl-data { width:max-content; border-collapse:separate; border-spacing:0; }
table.jl-data th, table.jl-data td {
  padding:8px 10px; border-bottom:1px solid #eee; border-right:1px solid #f2f2f2; white-space:nowrap; background:transparent;
}
table.jl-data th:first-child, table.jl-data td:first-child { border-left:1px solid #f2f2f2; }
#licTable tbody tr.jl-status--active  > td { background-color:#d4edda !important; }
#licTable tbody tr.jl-status--removed > td { background-color:#f8d7da !important; }

/* Column resizer */
.jl-th-inner { position:relative; display:flex; align-items:center; }
.jl-resizer { position:absolute; right:0; top:0; width:6px; height:100%; cursor:col-resize; user-select:none; }

@media (max-width:900px){
  .jl-org-scroller { grid-auto-columns: calc((100% - 12px)/2); }
  .jl-info-grid { grid-template-columns:1fr; }
}

/* --- ICW Link --- */
.jl-wrap { display:grid; gap:16px; }
.jl-intro { padding:10px 12px; border:1px solid #ddd; border-radius:8px; background:#f9fafb; }
.jl-box { border:1px solid #ddd; border-radius:8px; padding:12px; background:#fff; }
.jl-box h4 { margin:0 0 8px 0; }
.jl-box label { font-weight:600; display:block; margin-bottom:6px; }
.jl-box input[type=text] { width:300px; padding:8px; border:1px solid #ccc; border-radius:6px; }
.jl-box select { width:320px; padding:8px; border:1px solid #ccc; border-radius:6px; max-height:340px; }
/*
  IMPORTANT:
  Avoid overriding Bootstrap variant buttons (btn-primary, btn-outline-*, etc.).
  This rule is only for legacy/plain buttons that use class="btn" without a
  Bootstrap variant.
*/
button.btn
:not(.btn-primary)
:not(.btn-secondary)
:not(.btn-success)
:not(.btn-danger)
:not(.btn-warning)
:not(.btn-info)
:not(.btn-light)
:not(.btn-dark)
:not(.btn-outline-primary)
:not(.btn-outline-secondary)
:not(.btn-outline-success)
:not(.btn-outline-danger)
:not(.btn-outline-warning)
:not(.btn-outline-info)
:not(.btn-outline-light)
:not(.btn-outline-dark)
{
  padding:10px 16px;
  border:1px solid #ccc;
  background:#f5f5f5;
  border-radius:6px;
  cursor:pointer;
}
.table-frame.jl-max60 { max-height:60vh; }

/* --- ICW Compare --- */
.small { font-size:12px; color:#666; }
body.jl-dark-mode .small { color:#9aa4af; }

/* --- History --- */
.jl-hist-wrap { display:grid; gap:16px; }
.jl-filters { display:grid; gap:10px; grid-template-columns:repeat(6, minmax(0,1fr)); align-items:end; }
.jl-filters .col-span-2 { grid-column:span 2; }
.jl-filters label { font-weight:600; font-size:12px; color:#444; }
.jl-filters input, .jl-filters select { width:100%; padding:6px 8px; border:1px solid #ccc; border-radius:6px; height:36px; }
.jl-filters button { height:36px; padding:0 14px; border:1px solid #ddd; border-radius:6px; background:#f5f5f5; cursor:pointer; }
body.jl-dark-mode .jl-filters label { color:#c9d1d9; }
body.jl-dark-mode .jl-filters input, body.jl-dark-mode .jl-filters select { background:#0f1420; color:#e6e6e6; border-color:#2a2f3a; }
body.jl-dark-mode .jl-filters button { background:#1a2030; color:#e6e6e6; border-color:#2a2f3a; }
body.jl-dark-mode .jl-filters button:hover { background:#232a3d; border-color:#394257; }
.table { width:100%; border-collapse:collapse; }
.table th, .table td { border-bottom:1px solid #eee; padding:8px 10px; vertical-align:top; }
details { background:#fafafa; border:1px solid #eee; border-radius:6px; padding:6px 8px; }
details pre { white-space:pre-wrap; word-break:break-word; background:#fff; border:1px solid #eee; padding:8px; border-radius:6px; }
.jl-json-grid { display:grid; gap:8px; grid-template-columns:1fr 1fr; }

/* --- Reports --- */
.jl-reports { padding: .5rem; }
.jl-reports__filters { grid-template-columns:repeat(6, minmax(0,1fr)); }
.jl-reports__scopePills { display:flex; gap:8px; flex-wrap:wrap; align-items:center; padding:2px 0; }
.jl-pill { display:inline-flex; align-items:center; gap:.45rem; padding:6px 10px; border:1px solid #ddd; border-radius:999px; background:#fff; cursor:pointer; user-select:none; }
.jl-pill input { width:auto; height:auto; margin:0; }
.jl-pill span { font-size:13px; color:#333; }
.jl-report-section { padding-top:2px; }
.jl-reports__compareTable td, .jl-reports__compareTable th { vertical-align:middle; }

/* Reports: pricing mismatch highlight */
.jl-price-mismatch { background: rgba(220, 53, 69, .12); }
body.jl-dark-mode .jl-price-mismatch { background: rgba(220, 53, 69, .18); }
.jl-delta { font-weight:600; }
.jl-delta--up { color:#155724; font-weight:600; }
.jl-delta--down { color:#7a1e1e; font-weight:600; }
.jl-report-cards { display:grid; gap:12px; grid-template-columns:repeat(auto-fit, minmax(260px, 1fr)); }
.jl-report-card { display:flex; align-items:flex-start; gap:12px; border:1px solid #e0e0e0; border-radius:.75rem; padding:14px 16px; background:#fff; text-decoration:none; color:inherit; box-shadow:0 2px 10px rgba(0,0,0,.04); transition: border-color .15s, box-shadow .15s, transform .15s; }
.jl-report-card:hover { border-color:#cfd7e2; box-shadow:0 4px 14px rgba(0,0,0,.06); transform:translateY(-1px); }
.jl-report-card__icon { font-size:1.5rem; flex-shrink:0; width:36px; text-align:center; padding-top:2px; opacity:.85; }
.jl-report-card:hover .jl-report-card__icon { opacity:1; }
.jl-report-card-title { font-weight:700; margin-bottom:4px; }
.jl-report-card-sub { color:#666; font-size:13px; }
body.jl-dark-mode .jl-report-card-sub { color:#9aa4af; }

/* Locked/disabled report cards */
.jl-report-card--locked { opacity:.55; cursor:not-allowed; pointer-events:none; border-left:3px solid #9ca3af !important; position:relative; }
.jl-report-card--locked:hover { transform:none; box-shadow:0 2px 10px rgba(0,0,0,.04); }
.jl-report-card__lock { position:absolute; top:10px; right:12px; color:#9ca3af; font-size:14px; }
body.jl-dark-mode .jl-report-card--locked { opacity:.4; }
body.jl-dark-mode .jl-report-card__lock { color:#6b7280; }

/* Inline report error (keeps the page usable instead of throwing HTTP 500) */
.jl-reports__error {
  border:1px solid #f5c2c7;
  background:#fff5f6;
  color:#842029;
  border-radius:10px;
  padding:10px 12px;
}
.jl-reports__error pre { margin:8px 0 0; max-height:260px; overflow:auto; }

/* Reports -> History Search (readable diffs) */
.jl-hist2 { display:grid; gap:16px; padding:.5rem; }
.jl-hist2__filters { grid-template-columns:repeat(6, minmax(0,1fr)); }
.table-frame { overflow:auto; border:1px solid #eee; border-radius:10px; }
.jl-hist2__table { margin:0; }
.jl-hist2__summary { font-size:13px; color:#333; }
.jl-hist2__modalbody{ max-height: calc(100vh - 220px); overflow:auto; padding-right:6px; }

/* Code blocks (History details modal) */
.jl-code{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size:12px; line-height:1.35; white-space:pre; overflow:auto;
  border:1px solid #ddd; background:#f6f8fa; color:#24292e;
  border-radius:10px; padding:10px 12px; margin:8px 0 0;
}
body.jl-dark-mode .jl-code{ border-color:rgba(255,255,255,.10); background:rgba(9, 12, 18, .6); color:#e6e6e6; }
.jl-code--wrap{ white-space:pre-wrap; word-break:break-word; }
.jl-hist2__meta{ display:flex; gap:10px; flex-wrap:wrap; }
.jl-hist2__metaitem{ font-size:13px; color:#555; }
.jl-hist2__metalabel{ color:#777; margin-right:6px; }
body.jl-dark-mode .jl-hist2__metaitem{ color:#d1d5db; }
body.jl-dark-mode .jl-hist2__metalabel{ color:#9ca3af; }

@media (max-width: 900px){
  .jl-json-grid{ grid-template-columns:1fr; }
}
.jl-diff-table { width:100%; border-collapse:collapse; }
.jl-diff-table th, .jl-diff-table td { border-bottom:1px solid #eee; padding:6px 8px; vertical-align:top; }
.jl-diff-field { font-weight:600; white-space:nowrap; }
.jl-diff-old { color:#7a1e1e; }
.jl-diff-new { color:#155724; }
.jl-diff-cell-old { background:rgba(220,38,38,.07); }
.jl-diff-cell-new { background:rgba(22,163,74,.07); }
.jl-diff-unchanged td { color:#999; }
.jl-diff-border { border-left:3px solid; padding-left:8px; }
.jl-diff-border--added { border-color:#16a34a; }
.jl-diff-border--deleted { border-color:#dc2626; }


/* --- M365 --- */
.jl-frame.jl-m365 { height:420px; overflow:auto; border:1px solid #e0e0e0; border-radius:.5rem; }
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.45); display:none; align-items:center; justify-content:center; z-index:1050; }
.modal-card { background:#fff; border-radius:.5rem; padding:1rem; width:420px; max-width:92vw; box-shadow:0 10px 30px rgba(0,0,0,.25); }
.modal-card-wide { width:600px; max-width:94vw; }
.modal-card h5 { margin-bottom:.5rem; }

/* Bootstrap modal compatibility: if .modal-card is used on .modal-content, avoid fixed width/padding
   so the dialog stays centered and can be sized via modal-lg/modal-xl. */
.modal .modal-content.modal-card { width:100%; max-width:100%; padding:0; }
.modal .modal-content.modal-card .modal-header,
.modal .modal-content.modal-card .modal-body,
.modal .modal-content.modal-card .modal-footer { padding:1rem; }
.badge-dot { display:inline-flex; align-items:center; gap:.4rem; padding:.35rem .6rem; border-radius:1rem; background:#f1f1f1; }
.badge-dot.jl-is-live::before { content:""; width:.6rem; height:.6rem; border-radius:50%; background:#28a745; display:inline-block; }
.badge-dot.jl-is-off::before  { content:""; width:.6rem; height:.6rem; border-radius:50%; background:#6c757d; display:inline-block; }
.jl-iframe-wrap { border:1px solid #e0e0e0; border-radius:.5rem; overflow:hidden; }
.jl-iframe-wrap iframe { width:100%; border:0; }
table thead th.jl-sortable { cursor:pointer; user-select:none; }
tr.jl-is-selected { background: rgba(13,110,253,.15); }

/* --- Notifications page --- */
.badge-pill { border-radius:999px; }
.row-actions { white-space:nowrap; }
.table-notifs td { vertical-align:middle; }

/* --- Settings page --- */
.jl-settings-rail .list-group-item.active { background:#0d6efd; border-color:#0d6efd; }
.jl-settings-card .card-header .btn { margin-left:.4rem; }
.form-help { font-size:.875rem; color:#6c757d; }
/* Buttons */
.jl-settings-card button[id$="Test"],
.jl-settings-card button[id$="Run"] {
  background-color:#f5f5f5; border-color:#dddddd; color:#111111;
  box-shadow:none; transition: background-color .15s ease, border-color .15s ease;
}
.jl-settings-card button[id$="Test"]:hover,
.jl-settings-card button[id$="Run"]:hover { background-color:#e5e5e5; border-color:#d5d5d5; }
.jl-settings-card button[id$="Test"]:active,
.jl-settings-card button[id$="Run"]:active { background-color:#d5d5d5; border-color:#c9c9c9; }
.jl-settings-card button[id$="Save"] { background-color:#0d6efd; border-color:#0d6efd; color:#fff; }
.jl-settings-card button[id$="Save"]:hover { background-color:#0b5ed7; border-color:#0b5ed7; }
.jl-settings-card button[id$="Save"]:active { background-color:#0a58ca; border-color:#0a58ca; }
/* Run Sync Now = green */
.jl-settings-card button[id$="Run"] { background-color:#198754; border-color:#198754; color:#fff; }
.jl-settings-card button[id$="Run"]:hover { background-color:#157347; border-color:#157347; }
.jl-settings-card button[id$="Run"]:active { background-color:#146c43; border-color:#146c43; }

/* ========================
   DARK MODE (apply via body.jl-dark-mode)
   ======================== */
body.jl-dark-mode {
  --bs-body-bg:#0f1115; --bs-body-color:#e6e6e6;
  background-color: var(--bs-body-bg) !important;
  color: var(--bs-body-color) !important;
}
body.jl-dark-mode a { color:#8ab4ff; }
body.jl-dark-mode .text-muted { color:#9aa4af !important; }

body.jl-dark-mode .jl-pill { background:#151923; border-color:#2b3444; }
body.jl-dark-mode .jl-pill span { color:#e6e6e6; }

body.jl-dark-mode .jl-reports__error {
  background:#2a1316;
  border-color:#5c2b31;
  color:#ffd1d6;
}

body.jl-dark-mode .jl-reports__error {
  background:#2a1316;
  border-color:#5c2b31;
  color:#ffd1d6;
}

/* Surfaces & borders */
body.jl-dark-mode .card,
body.jl-dark-mode .jl-metadata-card,
body.jl-dark-mode .list-group-item,
body.jl-dark-mode .dropdown-menu,
body.jl-dark-mode .jl-box,
body.jl-dark-mode .jl-report-card,
body.jl-dark-mode .jl-frame,
body.jl-dark-mode .jl-info-box { background-color:#141821 !important; color:#e6e6e6 !important; border-color:#2a2f3a !important; }

/* Card headers (dark) */
body.jl-dark-mode .card-header {
  background-color: #1a2030 !important;
  color: #e6e6e6 !important;
  border-bottom-color: #2a2f3a !important;
}

/* Branding preview boxes (dark) */
body.jl-dark-mode .brand-logo-preview,
body.jl-dark-mode .brand-banner-preview {
  background-color: #1a2030 !important;
  border-color: #2a2f3a !important;
}
body.jl-dark-mode .brand-logo-preview .text-muted,
body.jl-dark-mode .brand-banner-preview .text-muted {
  color: #7b8694 !important;
}

body.jl-dark-mode details { background-color:#141821; border-color:#2a2f3a; }
body.jl-dark-mode details pre { background-color:#0f1420; border-color:#2a2f3a; }
body.jl-dark-mode .jl-diff-table th, body.jl-dark-mode .jl-diff-table td { border-bottom-color:#2a2f3a; }
body.jl-dark-mode .jl-diff-cell-old { background:rgba(220,38,38,.15); }
body.jl-dark-mode .jl-diff-cell-new { background:rgba(22,163,74,.15); }
body.jl-dark-mode .jl-diff-old { color:#ff7b72; }
body.jl-dark-mode .jl-diff-new { color:#7ee787; }
body.jl-dark-mode .jl-diff-unchanged td { color:#555; }
body.jl-dark-mode .table-frame { border-color:#2a2f3a; }
body.jl-dark-mode .jl-hist2__summary { color:#d6d6d6; }

body.jl-dark-mode .jl-delta { font-weight:600; }
body.jl-dark-mode .jl-delta--up { color:#7ee787; }
body.jl-dark-mode .jl-delta--down { color:#ff7b72; }

body.jl-dark-mode .jl-pill { background-color:#141821; border-color:#2a2f3a; }
body.jl-dark-mode .jl-pill span { color:#e6e6e6; }

/* Modals (dark) */
body.jl-dark-mode .modal-card {
  background-color:#141821;
  color:#e6e6e6;
  border:1px solid #2a2f3a;
}
/* Bootstrap close button is dark by default; invert for dark modal surfaces */
body.jl-dark-mode .modal-card .btn-close { filter: invert(1) grayscale(100%); }
body.jl-dark-mode .modal-card hr { border-color:#2a2f3a; }
body.jl-dark-mode .border, body.jl-dark-mode .table, body.jl-dark-mode hr, body.jl-dark-mode .dropdown-divider, body.jl-dark-mode .list-group-item { border-color:#2a2f3a !important; }

/* Inputs */
body.jl-dark-mode .form-control,
body.jl-dark-mode input[type="text"],
body.jl-dark-mode input[type="password"],
body.jl-dark-mode select,
body.jl-dark-mode textarea {
  background-color:#0f1420; color:#e6e6e6; border-color:#2a2f3a;
}
body.jl-dark-mode .form-control::placeholder,
body.jl-dark-mode input::placeholder,
body.jl-dark-mode textarea::placeholder { color:#7b8694; }

/* Tables (Bootstrap tables) */
body.jl-dark-mode table.table { color:#e6e6e6; background-color:#141821; }
body.jl-dark-mode .table thead, body.jl-dark-mode .table thead th { color:#e6e6e6; border-color:#2a2f3a; background-color:#1a2030; }
body.jl-dark-mode .table tbody td { border-color:#2a2f3a; }
body.jl-dark-mode .table-striped > tbody > tr:nth-of-type(odd) { --bs-table-accent-bg:#11161f; color:#e6e6e6; }

/* Dropdowns */
body.jl-dark-mode .dropdown-menu { background-color:#141821; color:#e6e6e6; }
body.jl-dark-mode .dropdown-item { color:#e6e6e6; }
body.jl-dark-mode .dropdown-item:hover { background-color:#1a2030; color:#e6e6e6; }

/* List group */
body.jl-dark-mode .list-group-item { background-color:#141821; color:#e6e6e6; }
body.jl-dark-mode .list-group-item.active { background-color:#2563eb; border-color:#2563eb; color:#fff; }

/* Settings buttons (dark) */
body.jl-dark-mode .jl-settings-card button[id$="Test"],
body.jl-dark-mode .jl-settings-card button[id$="Run"] {
  background-color:#2b303b; border-color:#3a4150; color:#e6e6e6;
}
body.jl-dark-mode .jl-settings-card button[id$="Test"]:hover,
body.jl-dark-mode .jl-settings-card button[id$="Run"]:hover { background-color:#333845; border-color:#484f61; }
body.jl-dark-mode .jl-settings-card button[id$="Test"]:active,
body.jl-dark-mode .jl-settings-card button[id$="Run"]:active { background-color:#3a4150; border-color:#525b70; }
/* Save stays blue (contrast OK) */

/* Misc */
body.jl-dark-mode .jl-org-card { background-color:#141821; color:#e6e6e6; border-color:#2f3a52; }
body.jl-dark-mode .jl-org-card .jl-org-card__meta { color:#c8d3ea; }
body.jl-dark-mode .jl-org-card.jl-is-selected { outline:2px solid #3b82f6; background:#0c223a; }
body.jl-dark-mode .jl-no-results { background:#2c1f00; border-color:#6a4b00; color:#ffd28a; }
body.jl-dark-mode code, body.jl-dark-mode pre { background:#0f1420; color:#d6e7ff; }
body.jl-dark-mode .navbar .dropdown-menu { border-color:#2a2f3a; }

/* Tabs (dark) */
body.jl-dark-mode .jl-tabs__btn { background:#1a2030; border-color:#2a2f3a; color:#e6e6e6; }
body.jl-dark-mode .jl-tabs__btn:hover { background:#232a3d; border-color:#394257; }
body.jl-dark-mode .jl-tabs__btn.active { background:#2563eb; border-color:#2563eb; color:#fff; }

/* Org scroller (dark) */
body.jl-dark-mode .jl-org-scroller {
  background-color:#233044; border:1px solid #2f3a52; border-radius:8px;
  scrollbar-color:#596586 #233044; scrollbar-width:thin;
}
body.jl-dark-mode .jl-org-scroller::-webkit-scrollbar { height:10px; }
body.jl-dark-mode .jl-org-scroller::-webkit-scrollbar-track { background:#233044; border-radius:8px; }
body.jl-dark-mode .jl-org-scroller::-webkit-scrollbar-thumb { background:#596586; border-radius:8px; border:2px solid #233044; }
body.jl-dark-mode .jl-org-scroller::-webkit-scrollbar-thumb:hover { background:#6a789d; }

/* Search row actions (dark) */
body.jl-dark-mode .jl-search button,
body.jl-dark-mode .jl-search a,
body.jl-dark-mode .jl-search .btn,
body.jl-dark-mode .jl-search .btn-light {
  background:#1a2030; border:1px solid #2a2f3a; color:#e6e6e6; border-radius:6px;
}
body.jl-dark-mode .jl-search button:hover,
body.jl-dark-mode .jl-search a:hover,
body.jl-dark-mode .jl-search .btn:hover,
body.jl-dark-mode .jl-search .btn-light:hover { background:#232a3d; border-color:#394257; }
body.jl-dark-mode .jl-search button:active,
body.jl-dark-mode .jl-search a:active,
body.jl-dark-mode .jl-search .btn:active,
body.jl-dark-mode .jl-search .btn-light:active { background:#2b3146; border-color:#475274; }

/* Data tables (dark) */
body.jl-dark-mode .table-frame { background:#141821; border-color:#2a2f3a; }
body.jl-dark-mode table.jl-data { color:#e6e6e6; }
body.jl-dark-mode table.jl-data thead th { background:#1a2030; color:#e6e6e6; border-bottom:1px solid #2a2f3a; border-right:1px solid #2a2f3a; }
body.jl-dark-mode table.jl-data th:first-child, body.jl-dark-mode table.jl-data td:first-child { border-left:1px solid #2a2f3a; }
body.jl-dark-mode table.jl-data tbody td { border-bottom:1px solid #2a2f3a; border-right:1px solid #2a2f3a; }
body.jl-dark-mode table.jl-data tbody tr.jl-status--active  > td { background-color:#142a19 !important; color:#bfe7cc; }
body.jl-dark-mode table.jl-data tbody tr.jl-status--removed > td { background-color:#2a1416 !important; color:#f7c6cc; }
body.jl-dark-mode table.jl-data tbody tr.jl-is-selected > td { background: rgba(37,99,235,.25) !important; }

/* Scroll frame dark mode surface + scrollbars */
body.jl-dark-mode .jl-scroll-frame { background:#141821; border-color:#2a2f3a; }
body.jl-dark-mode .table-frame,
body.jl-dark-mode .jl-scroll-frame {
  scrollbar-color:#596586 #141821; scrollbar-width:thin;
}
body.jl-dark-mode .table-frame::-webkit-scrollbar,
body.jl-dark-mode .jl-scroll-frame::-webkit-scrollbar { width:10px; height:10px; }
body.jl-dark-mode .table-frame::-webkit-scrollbar-track,
body.jl-dark-mode .jl-scroll-frame::-webkit-scrollbar-track { background:#141821; border-radius:8px; }
body.jl-dark-mode .table-frame::-webkit-scrollbar-thumb,
body.jl-dark-mode .jl-scroll-frame::-webkit-scrollbar-thumb { background:#596586; border-radius:8px; border:2px solid #141821; }
body.jl-dark-mode .table-frame::-webkit-scrollbar-thumb:hover,
body.jl-dark-mode .jl-scroll-frame::-webkit-scrollbar-thumb:hover { background:#6a789d; }

/* Datto: seat-list dark variants */
body.jl-dark-mode .jl-seat-card { border-color:#2a2f3a; }
body.jl-dark-mode .jl-seat-card.jl-state-active { background-color:#142a19 !important; border-color:#214c2b !important; color:#bfe7cc; }
body.jl-dark-mode .jl-seat-card.jl-state-unprotected { background-color:#2a1416 !important; border-color:#5b2b33 !important; color:#f7c6cc; }
body.jl-dark-mode .jl-seat-card.jl-state-archived { background-color:#191d24 !important; border-color:#2a2f3a !important; color:#c9d1d9; }
body.jl-dark-mode .jl-seat-card, body.jl-dark-mode .jl-seat-card .jl-seat-head, body.jl-dark-mode .jl-seat-card .jl-seat-line { color:#e6e6e6 !important; }

/* Agreements: company list panel & selected */
body.jl-dark-mode #companyList { background:#1a2030; border:1px solid #2a2f3a; border-radius:8px; padding:4px; }
body.jl-dark-mode #companyList .list-group-item { background:#1a2030; color:#e6e6e6; border-color:#2a2f3a; }
body.jl-dark-mode #companyList .list-group-item:hover { background:#232a3d; }
body.jl-dark-mode #companyList .list-group-item.jl-is-active { background:#2563eb; border-color:#2563eb; color:#fff; }

/* Agreements scroller (match org scroller) */
body.jl-dark-mode #agreementsScroll {
  background:#233044; border:1px solid #2f3a52; border-radius:8px;
  scrollbar-color:#596586 #233044; scrollbar-width:thin;
}
body.jl-dark-mode #agreementsScroll::-webkit-scrollbar { height:10px; }
body.jl-dark-mode #agreementsScroll::-webkit-scrollbar-track { background:#233044; border-radius:8px; }
body.jl-dark-mode #agreementsScroll::-webkit-scrollbar-thumb { background:#596586; border-radius:8px; border:2px solid #233044; }
body.jl-dark-mode #agreementsScroll::-webkit-scrollbar-thumb:hover { background:#6a789d; }

/* Agreements: inactive cards/chips (red like Datto unprotected) */
body.jl-dark-mode .jl-inactive-card,
body.jl-dark-mode .jl-inactive-chip {
  background-color:#2a1416 !important;
  border-color:#5b2b33 !important;
  color:#f7c6cc;
}

/* /Agreements: search hits (static highlight; avoid flash/bold toggling) */
#additionsDetails tr.jl-search-hit > td { background:#fff3cd !important; color:#664d03 !important; }
body.jl-dark-mode #additionsDetails tr.jl-search-hit > td { background:#2c1f00 !important; color:#ffd28a !important; border-color:#6a4b00 !important; }

/* Agreements: inactive additions rows in dark mode (red) */
body.jl-dark-mode #additionsDetails tr.jl-inactive-row > td {
  background-color:#2a1416 !important;
  color:#f7c6cc !important;
  border-color:#5b2b33 !important;
}

/* Agreements: invoice popup dark */
body.jl-dark-mode .invoice-popup {
  background:#141821;
  color:#e6e6e6;
  border:1px solid #2a2f3a;
}
/* ===== /Agreements: Additions table dark styling ===== */
body.jl-dark-mode .jl-additions__frame {
  background: #141821;
  border-color: #2a2f3a;
}
body.jl-dark-mode #additionsDetails.jl-additions__frame {
  border-top: 1px solid #2a2f3a;
  padding: 0;
}

/* Table header, grid lines, and text */
body.jl-dark-mode #additionsDetails table.table {
  color: #e6e6e6;
}
body.jl-dark-mode #additionsDetails table.table thead th {
  background: #1a2030;
  color: #e6e6e6;
  border-bottom: 1px solid #2a2f3a;
  z-index: 11;
}
body.jl-dark-mode #additionsDetails table.table.table-bordered > :not(caption) > * > * {
  border-color: #2a2f3a;           /* cell borders */
  background: transparent;         /* let highlight rows show through */
}

/* (Intentionally no animation for /Agreements search-hit rows) */

/* Buttons inside the table (e.g., View) */
body.jl-dark-mode #additionsDetails .btn.btn-sm.btn-outline-primary {
  color: #8ab4ff;
  border-color: #3d57a5;
  background: transparent;
}
body.jl-dark-mode #additionsDetails .btn.btn-sm.btn-outline-primary:hover {
  color: #ffffff;
  background: #2a3b66;
  border-color: #3d57a5;
}
body.jl-dark-mode #additionsDetails .btn.btn-sm.btn-outline-primary:active {
  background: #243358;
  border-color: #3d57a5;
}
body.jl-dark-mode #additionsDetails .btn.btn-sm.btn-outline-primary:focus-visible {
  outline: 2px solid #8ab4ff;
  outline-offset: 2px;
}

/* Scrollbar for the additions frame (if it overflows) */
body.jl-dark-mode #additionsDetails.jl-additions__frame {
  scrollbar-color: #596586 #141821;  /* Firefox */
  scrollbar-width: thin;
}
body.jl-dark-mode #additionsDetails.jl-additions__frame::-webkit-scrollbar {
  height: 10px; width: 10px;
}
body.jl-dark-mode #additionsDetails.jl-additions__frame::-webkit-scrollbar-track {
  background: #141821; border-radius: 8px;
}
body.jl-dark-mode #additionsDetails.jl-additions__frame::-webkit-scrollbar-thumb {
  background: #596586; border-radius: 8px; border: 2px solid #141821;
}
body.jl-dark-mode #additionsDetails.jl-additions__frame::-webkit-scrollbar-thumb:hover {
  background: #6a789d;
}
/* ===== /M365/Connections & /AgreementTracking: tables dark styling ===== */

/* Frame containers: keep surface + borders consistent and give them dark scrollbars */
body.jl-dark-mode .jl-frame,
body.jl-dark-mode .jl-frame.jl-m365 {
  background: #141821;
  border-color: #2a2f3a;
  /* Scrollbars */
  scrollbar-color: #596586 #141821;  /* Firefox */
  scrollbar-width: thin;
}
body.jl-dark-mode .jl-frame::-webkit-scrollbar { width: 10px; height: 10px; }
body.jl-dark-mode .jl-frame::-webkit-scrollbar-track { background: #141821; border-radius: 8px; }
body.jl-dark-mode .jl-frame::-webkit-scrollbar-thumb { background: #596586; border-radius: 8px; border: 2px solid #141821; }
body.jl-dark-mode .jl-frame::-webkit-scrollbar-thumb:hover { background: #6a789d; }

/* Tables inside frames (works whether they’re Bootstrap .table or plain tables) */
body.jl-dark-mode .jl-frame table,
body.jl-dark-mode .jl-frame.jl-m365 table {
  color: #e6e6e6;
}
body.jl-dark-mode .jl-frame table thead th,
body.jl-dark-mode .jl-frame.jl-m365 table thead th {
  background: #1a2030;
  color: #e6e6e6;
  border-bottom: 1px solid #2a2f3a;
}

/* If the table uses Bootstrap’s .table-bordered, ensure grid lines show in dark mode */
body.jl-dark-mode .jl-frame table.table.table-bordered > :not(caption) > * > *,
body.jl-dark-mode .jl-frame.jl-m365 table.table.table-bordered > :not(caption) > * > * {
  border-color: #2a2f3a;
}

/* If the table is not using .table-bordered but still wants borders (common on some pages) */
body.jl-dark-mode .jl-frame table:not(.table-bordered) th,
body.jl-dark-mode .jl-frame table:not(.table-bordered) td,
body.jl-dark-mode .jl-frame.jl-m365 table:not(.table-bordered) th,
body.jl-dark-mode .jl-frame.jl-m365 table:not(.table-bordered) td {
  border-color: #2a2f3a;
}

/* Optional: outline-primary buttons inside these tables (e.g., Connect/Disconnect, View) */
body.jl-dark-mode .jl-frame .btn.btn-outline-primary,
body.jl-dark-mode .jl-frame.jl-m365 .btn.btn-outline-primary {
  color: #8ab4ff;
  border-color: #3d57a5;
  background: transparent;
}
body.jl-dark-mode .jl-frame .btn.btn-outline-primary:hover,
body.jl-dark-mode .jl-frame.jl-m365 .btn.btn-outline-primary:hover {
  color: #ffffff;
  background: #2a3b66;
  border-color: #3d57a5;
}
body.jl-dark-mode .jl-frame .btn.btn-outline-primary:active,
body.jl-dark-mode .jl-frame.jl-m365 .btn.btn-outline-primary:active {
  background: #243358;
  border-color: #3d57a5;
}
body.jl-dark-mode .jl-frame .btn.btn-outline-primary:focus-visible,
body.jl-dark-mode .jl-frame.jl-m365 .btn.btn-outline-primary:focus-visible {
  outline: 2px solid #8ab4ff;
  outline-offset: 2px;
}
/* ===== /M365/Connections & /AgreementTracking: dark row backgrounds ===== */

/* Default row background inside the scrolling frames */
body.jl-dark-mode .jl-frame table tbody tr > th,
body.jl-dark-mode .jl-frame table tbody tr > td,
body.jl-dark-mode .jl-frame.jl-m365 table tbody tr > th,
body.jl-dark-mode .jl-frame.jl-m365 table tbody tr > td {
  background-color: #141821; /* match dark surface */
}

/* Zebra striping (works whether or not .table-striped is present) */
body.jl-dark-mode .jl-frame table.table-striped > tbody > tr:nth-of-type(odd) > *,
body.jl-dark-mode .jl-frame.jl-m365 table.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: #11161f;
}
/* If not using .table-striped, still give a subtle odd-row tint */
body.jl-dark-mode .jl-frame table:not(.table-striped) > tbody > tr:nth-of-type(odd) > *,
body.jl-dark-mode .jl-frame.jl-m365 table:not(.table-striped) > tbody > tr:nth-of-type(odd) > * {
  background-color: #11161f;
}

/* Hover highlight */
body.jl-dark-mode .jl-frame table tbody tr:hover > *,
body.jl-dark-mode .jl-frame.jl-m365 table tbody tr:hover > * {
  background-color: #1a2030;
}

/* Keep special status/selected styles visible if present */
body.jl-dark-mode .jl-frame table tbody tr.jl-is-selected > * ,
body.jl-dark-mode .jl-frame.jl-m365 table tbody tr.jl-is-selected > *  {
  background: rgba(37,99,235,.25) !important;
}
body.jl-dark-mode .jl-frame table tbody tr[class*="status-"] > *,
body.jl-dark-mode .jl-frame.jl-m365 table tbody tr[class*="status-"] > * {
  background-color: transparent; /* let status row colors show through */
}
/* ===== Plain tables inside .table-frame (e.g., #aggTbl) — dark rows, borders, zebra ===== */
body.jl-dark-mode .table-frame table:not(.jl-data) {
  color: #e6e6e6;
  border-collapse: collapse; /* ensure consistent borders */
}

/* Header */
body.jl-dark-mode .table-frame table:not(.jl-data) thead th {
  background: #1a2030;
  color: #e6e6e6;
  border-bottom: 1px solid #2a2f3a;
}

/* Cell borders + default row background */
body.jl-dark-mode .table-frame table:not(.jl-data) th,
body.jl-dark-mode .table-frame table:not(.jl-data) td {
  border-bottom: 1px solid #2a2f3a;
  background-color: #141821; /* give tbody cells a dark surface */
}

/* Zebra striping (even if .table-striped isn't used) */
body.jl-dark-mode .table-frame table:not(.jl-data) > tbody > tr:nth-of-type(odd) > * {
  background-color: #11161f;
}

/* Hover highlight */
body.jl-dark-mode .table-frame table:not(.jl-data) > tbody > tr:hover > * {
  background-color: #1a2030;
}


body.jl-dark-mode .table-frame table:not(.jl-data) th,
body.jl-dark-mode .table-frame table:not(.jl-data) td { border-right: 1px solid #2a2f3a; }
body.jl-dark-mode .table-frame table:not(.jl-data) th:first-child,
body.jl-dark-mode .table-frame table:not(.jl-data) td:first-child { border-left: 1px solid #2a2f3a; }

/* ===== /Ingram: #licTable (table.jl-data) — dark rows, zebra, hover, resizer ===== */
body.jl-dark-mode #licTable {
  color: #e6e6e6;
}

/* Header */
body.jl-dark-mode #licTable thead th {
  background: #1a2030;
  color: #e6e6e6;
  border-bottom: 1px solid #2a2f3a;
  border-right: 1px solid #2a2f3a;
}
body.jl-dark-mode #licTable thead th:first-child {
  border-left: 1px solid #2a2f3a;
}

/* Default cell surface + grid lines */
body.jl-dark-mode #licTable th,
body.jl-dark-mode #licTable td {
  background-color: #141821;          /* give rows a real surface */
  border-bottom: 1px solid #2a2f3a;
  border-right: 1px solid #2a2f3a;
}
body.jl-dark-mode #licTable th:first-child,
body.jl-dark-mode #licTable td:first-child {
  border-left: 1px solid #2a2f3a;
}

/* Zebra striping only for non-status rows */
body.jl-dark-mode #licTable tbody tr:not([class*="status-"]):nth-of-type(odd) > * {
  background-color: #11161f;
}

/* Hover (keep status rows unaffected) */
body.jl-dark-mode #licTable tbody tr:not([class*="status-"]):hover > * {
  background-color: #1a2030;
}

/* Preserve status row colors (we already styled these globally, but reinforce here) */
body.jl-dark-mode #licTable tbody tr.jl-status--active  > td { background-color:#142a19 !important; color:#bfe7cc; }
body.jl-dark-mode #licTable tbody tr.jl-status--removed > td { background-color:#2a1416 !important; color:#f7c6cc; }

/* Column resizer visibility in dark mode */
body.jl-dark-mode #licTable .jl-th-inner { position: relative; display: flex; align-items: center; }
body.jl-dark-mode #licTable .jl-th-inner .jl-resizer {
  background: #394257;
  width: 6px; height: 100%;
  cursor: col-resize; user-select: none;
}
body.jl-dark-mode #licTable .jl-th-inner .jl-resizer:hover {
  background: #6a789d;
}
/* ===== /Agreements: additions table default rows in dark mode ===== */
body.jl-dark-mode #additionsDetails table {
  color: #e6e6e6; /* ensure table text defaults to light */
}

/* Give tbody cells a proper dark surface + light text */
body.jl-dark-mode #additionsDetails table tbody tr > th,
body.jl-dark-mode #additionsDetails table tbody tr > td {
  background-color: #141821;   /* same surface as cards */
  color: #e6e6e6 !important;   /* override any black text */
  border-color: #2a2f3a;       /* consistent grid lines */
}

/* Zebra striping + hover */
body.jl-dark-mode #additionsDetails table tbody tr:nth-of-type(odd) > * {
  background-color: #11161f;
}
body.jl-dark-mode #additionsDetails table tbody tr:hover > * {
  background-color: #1a2030;
}

/* Keep special highlight rows as-is */
body.jl-dark-mode #additionsDetails table tr.jl-highlight-flash > td {
  background: #2c1f00 !important;
  color: #ffd28a !important;
  border-color: #6a4b00 !important;
}

/* Make the small outline-success button readable on dark */
body.jl-dark-mode #additionsDetails .btn.btn-sm.btn-outline-success {
  color: #7de0ae;             /* light green text */
  border-color: #2b7a57;      /* deeper green border */
  background: transparent;
}
body.jl-dark-mode #additionsDetails .btn.btn-sm.btn-outline-success:hover {
  color: #ffffff;
  background: #1f5137;
  border-color: #2b7a57;
}
body.jl-dark-mode #additionsDetails .btn.btn-sm.btn-outline-success:active {
  background: #1b4630;
  border-color: #2b7a57;
}
body.jl-dark-mode #additionsDetails .btn.btn-sm.btn-outline-success:focus-visible {
  outline: 2px solid #7de0ae;
  outline-offset: 2px;
}
/* ===== AgreementTracking tables: force dark rows/cells ===== */
/* If you can add a wrapper on the page, e.g. <div id="agreementtracking">...</div>,
   these rules will scope perfectly. Otherwise the generic .card/.jl-metadata-card
   fallbacks below will still fix it. */

/* Scoped (preferred if you add id="agreementtracking" to the page root) */
body.jl-dark-mode #agreementtracking table {
  color: #e6e6e6 !important;
}
body.jl-dark-mode #agreementtracking thead th {
  background: #1a2030 !important;
  color: #e6e6e6 !important;
  border-bottom: 1px solid #2a2f3a !important;
}
body.jl-dark-mode #agreementtracking tbody td,
body.jl-dark-mode #agreementtracking tbody th {
  background-color: #141821 !important;
  color: #e6e6e6 !important;
  border-color: #2a2f3a !important;
}
body.jl-dark-mode #agreementtracking tbody tr:nth-of-type(odd) > * {
  background-color: #11161f !important;
}
body.jl-dark-mode #agreementtracking tbody tr:hover > * {
  background-color: #1a2030 !important;
}

/* Generic fallbacks (hit tables living inside cards/metadata cards on that page) */
body.jl-dark-mode .jl-metadata-card table,
body.jl-dark-mode .card table {
  color: #e6e6e6 !important;
}
body.jl-dark-mode .jl-metadata-card thead th,
body.jl-dark-mode .card thead th {
  background: #1a2030 !important;
  color: #e6e6e6 !important;
  border-bottom: 1px solid #2a2f3a !important;
}
body.jl-dark-mode .jl-metadata-card tbody td,
body.jl-dark-mode .jl-metadata-card tbody th,
body.jl-dark-mode .card tbody td,
body.jl-dark-mode .card tbody th {
  background-color: #141821 !important;
  color: #e6e6e6 !important;
  border-color: #2a2f3a !important;
}
body.jl-dark-mode .jl-metadata-card tbody tr:nth-of-type(odd) > *,
body.jl-dark-mode .card tbody tr:nth-of-type(odd) > * {
  background-color: #11161f !important;
}
body.jl-dark-mode .jl-metadata-card tbody tr:hover > *,
body.jl-dark-mode .card tbody tr:hover > * {
  background-color: #1a2030 !important;
}
/* ==== AgreementTracking (and any plain Bootstrap tables): dark rows/cells ==== */
/* Scope to all non-.jl-data Bootstrap tables so we don't collide with Ingram's .jl-data grid */
body.jl-dark-mode table.table:not(.jl-data) {
  color: #e6e6e6 !important;
}

/* Header */
body.jl-dark-mode table.table:not(.jl-data) thead th {
  background: #1a2030 !important;
  color: #e6e6e6 !important;
  border-bottom: 1px solid #2a2f3a !important;
  border-right: 1px solid #2a2f3a !important;
}

/* Body cells: give them an actual dark surface and visible grid lines */
body.jl-dark-mode table.table:not(.jl-data) tbody tr > * {
  background-color: #141821 !important;
  color: #e6e6e6 !important;
  border-color: #2a2f3a !important;
}

/* Zebra + hover */
body.jl-dark-mode table.table:not(.jl-data) tbody tr:nth-of-type(odd) > * {
  background-color: #11161f !important;
}
body.jl-dark-mode table.table:not(.jl-data) tbody tr:hover > * {
  background-color: #1a2030 !important;
}

/* If any status rows exist, keep their special coloring */
body.jl-dark-mode table.table:not(.jl-data) tbody tr[class*="status-"] > * {
  background-color: inherit !important;
  color: inherit !important;
}

/* Outline buttons inside these tables (e.g., Remove) */
body.jl-dark-mode .btn.btn-sm.btn-outline-danger {
  color: #ffb4b4 !important;
  border-color: #a23a3a !important;
  background: transparent !important;
}
body.jl-dark-mode .btn.btn-sm.btn-outline-danger:hover {
  color: #ffffff !important;
  background: #5a2424 !important;
  border-color: #a23a3a !important;
}
body.jl-dark-mode .btn.btn-sm.btn-outline-danger:active {
  background: #4b1e1e !important;
  border-color: #a23a3a !important;
}
body.jl-dark-mode .btn.btn-sm.btn-outline-danger:focus-visible {
  outline: 2px solid #ffb4b4 !important;
  outline-offset: 2px !important;
}
/* ===== FINAL DARK-MODE POLISH PACK ===== */

/* Generic Bootstrap tables that weren't wrapped/scoped */
body.jl-dark-mode table.table:not(.jl-data) tbody tr > * {
  background-color:#141821 !important;
  color:#e6e6e6 !important;
  border-color:#2a2f3a !important;
}
body.jl-dark-mode table.table.table-hover tbody tr:hover > * {
  background-color:#1a2030 !important;
}

/* Outline buttons (global) for readability */
body.jl-dark-mode .btn-outline-primary   { color:#8ab4ff; border-color:#3d57a5; background:transparent; }
body.jl-dark-mode .btn-outline-secondary { color:#d1d5db; border-color:#3a4150; background:transparent; }
body.jl-dark-mode .btn-outline-success   { color:#7de0ae; border-color:#2b7a57; background:transparent; }
body.jl-dark-mode .btn-outline-warning   { color:#ffd28a; border-color:#6a4b00; background:transparent; }
body.jl-dark-mode .btn-outline-info      { color:#9bd5ff; border-color:#2f6a8a; background:transparent; }
body.jl-dark-mode .btn-outline-danger    { color:#ffb4b4; border-color:#a23a3a; background:transparent; }
body.jl-dark-mode .btn-outline-light     { color:#e6e6e6; border-color:#3a4150; background:transparent; }
body.jl-dark-mode .btn-outline-dark      { color:#cbd5e1; border-color:#3a4150; background:transparent; }
body.jl-dark-mode .btn-outline-primary:hover   { background:#2a3b66; }
body.jl-dark-mode .btn-outline-secondary:hover { background:#232a3d; }
body.jl-dark-mode .btn-outline-success:hover   { background:#1f5137; }
body.jl-dark-mode .btn-outline-warning:hover   { background:#3a2a09; }
body.jl-dark-mode .btn-outline-info:hover      { background:#203b4d; }
body.jl-dark-mode .btn-outline-danger:hover    { background:#5a2424; }
body.jl-dark-mode .btn-outline-light:hover     { background:#232a3d; }
body.jl-dark-mode .btn-outline-dark:hover      { background:#1a2030; }

/* Solid Bootstrap buttons - ensure proper dark mode visibility */
body.jl-dark-mode .btn-success { background-color:#198754; border-color:#198754; color:#fff; }
body.jl-dark-mode .btn-success:hover { background-color:#157347; border-color:#146c43; }
body.jl-dark-mode .btn-success:active { background-color:#146c43; border-color:#13653f; }
body.jl-dark-mode .btn-warning { background-color:#ffc107; border-color:#ffc107; color:#000; }
body.jl-dark-mode .btn-warning:hover { background-color:#ffca2c; border-color:#ffc720; }
body.jl-dark-mode .btn-info { background-color:#0dcaf0; border-color:#0dcaf0; color:#000; }
body.jl-dark-mode .btn-info:hover { background-color:#31d2f2; border-color:#25cff2; }

/* Card body background for dark mode */
body.jl-dark-mode .card-body {
  background-color: #141821 !important;
  color: #e6e6e6;
}

/* Form help text for dark mode */
body.jl-dark-mode .form-help,
body.jl-dark-mode .form-text {
  color: #9aa4af !important;
}

/* File input button dark mode */
body.jl-dark-mode input[type="file"]::file-selector-button {
  background-color: #2b303b;
  border: 1px solid #3a4150;
  color: #e6e6e6;
  padding: 0.375rem 0.75rem;
  border-radius: 0.25rem;
  cursor: pointer;
}
body.jl-dark-mode input[type="file"]::file-selector-button:hover {
  background-color: #333845;
  border-color: #484f61;
}
body.jl-dark-mode input[type="file"] {
  color: #e6e6e6;
}

/* jl-table dark mode fixes */
body.jl-dark-mode .jl-table thead {
  background: #1a2030 !important;
}
body.jl-dark-mode .jl-table thead th {
  color: #e6e6e6 !important;
  border-bottom-color: #2a2f3a !important;
}
body.jl-dark-mode .jl-table td {
  color: #e6e6e6;
  border-bottom-color: #2a2f3a !important;
}
body.jl-dark-mode .jl-table-wrap {
  border-color: #2a2f3a !important;
}

/* Forms: checks, radios, input-group chrome */
body.jl-dark-mode .form-check-input {
  background-color:#0f1420; border-color:#3a4150;
}
body.jl-dark-mode .form-check-input:checked {
  background-color:#2563eb; border-color:#2563eb;
}
body.jl-dark-mode .input-group-text {
  background:#1a2030; color:#e6e6e6; border-color:#2a2f3a;
}
/* Native select dropdown items (where respected) */
body.jl-dark-mode select option { background:#141821; color:#e6e6e6; }

/* Nav tabs / pills (Bootstrap variants some pages use) */
body.jl-dark-mode .nav-tabs .nav-link {
  color:#e6e6e6; background:#1a2030; border-color:#2a2f3a;
}
body.jl-dark-mode .nav-tabs .nav-link.active,
body.jl-dark-mode .nav-tabs .nav-item.show .nav-link {
  color:#fff; background:#141821; border-color:#2563eb #2563eb #141821;
}
body.jl-dark-mode .nav-pills .nav-link { color:#e6e6e6; background:#1a2030; }
body.jl-dark-mode .nav-pills .nav-link.active { color:#fff; background:#2563eb; }

/* Pagination */
body.jl-dark-mode .page-link {
  background:#1a2030; color:#e6e6e6; border-color:#2a2f3a;
}
body.jl-dark-mode .page-item.active .page-link {
  background:#2563eb; border-color:#2563eb; color:#fff;
}
body.jl-dark-mode .page-link:hover { background:#232a3d; }

/* Modals, toasts, popovers, tooltips */
body.jl-dark-mode .modal-content,
body.jl-dark-mode .toast {
  background:#141821; color:#e6e6e6; border-color:#2a2f3a;
}
body.jl-dark-mode .modal-header,
body.jl-dark-mode .toast-header { background:#1a2030; border-bottom-color:#2a2f3a; }
body.jl-dark-mode .modal-footer { border-top-color:#2a2f3a; }

body.jl-dark-mode .popover { background:#141821; color:#e6e6e6; border-color:#2a2f3a; }
body.jl-dark-mode .popover-header { background:#1a2030; border-bottom-color:#2a2f3a; }

body.jl-dark-mode .tooltip .tooltip-inner { background:#1a2030; color:#e6e6e6; }
body.jl-dark-mode .bs-tooltip-auto[data-popper-placement^="top"] .tooltip-arrow::before,
body.jl-dark-mode .bs-tooltip-top .tooltip-arrow::before { border-top-color:#1a2030; }
body.jl-dark-mode .bs-tooltip-auto[data-popper-placement^="bottom"] .tooltip-arrow::before,
body.jl-dark-mode .bs-tooltip-bottom .tooltip-arrow::before { border-bottom-color:#1a2030; }
body.jl-dark-mode .bs-tooltip-auto[data-popper-placement^="left"] .tooltip-arrow::before,
body.jl-dark-mode .bs-tooltip-start .tooltip-arrow::before { border-left-color:#1a2030; }
body.jl-dark-mode .bs-tooltip-auto[data-popper-placement^="right"] .tooltip-arrow::before,
body.jl-dark-mode .bs-tooltip-end .tooltip-arrow::before { border-right-color:#1a2030; }

/* Breadcrumbs & badges (minor contrast tweaks) */
body.jl-dark-mode .breadcrumb .breadcrumb-item + .breadcrumb-item::before { color:#9aa4af; }
body.jl-dark-mode .badge.bg-light { color:#0f172a; } /* keep readable on light badges */
/* ==== FINAL PATCH: remaining dark-mode bits ==== */

/* 1) Status pill: .badge-dot (live/off) */
body.jl-dark-mode .badge-dot {
  background:#1a2030; color:#e6e6e6; border:1px solid #2a2f3a;
}
body.jl-dark-mode .badge-dot.jl-is-live::before { background:#28a745; } /* green dot */
body.jl-dark-mode .badge-dot.jl-is-off::before  { background:#6c757d; } /* grey dot */

/* 2) Buttons that aren't using Bootstrap classes (Apply, Add, Remove, etc.) */
body.jl-dark-mode button[type="submit"]:not(.btn),
body.jl-dark-mode button:not([class]):not(.btn),
body.jl-dark-mode input[type="button"]:not(.btn),
body.jl-dark-mode input[type="submit"]:not(.btn) {
  background:#1a2030; color:#e6e6e6; border:1px solid #2a2f3a;
  border-radius:6px; padding:.5rem .85rem; cursor:pointer;
}
body.jl-dark-mode button[type="submit"]:not(.btn):hover,
body.jl-dark-mode button:not([class]):not(.btn):hover,
body.jl-dark-mode input[type="button"]:not(.btn):hover,
body.jl-dark-mode input[type="submit"]:not(.btn):hover {
  background:#232a3d; border-color:#394257;
}
body.jl-dark-mode button[type="submit"]:not(.btn):active,
body.jl-dark-mode button:not([class]):not(.btn):active,
body.jl-dark-mode input[type="button"]:not(.btn):active,
body.jl-dark-mode input[type="submit"]:not(.btn):active {
  background:#2b3146; border-color:#475274;
}

/* 2a) Specifics you mentioned */
body.jl-dark-mode #btnSyncDomainsAuth.btn-success {
  background:#157347; border-color:#157347; color:#fff;
}
body.jl-dark-mode #btnSyncDomainsAuth.btn-success:hover { background:#146c43; border-color:#146c43; }
body.jl-dark-mode #btnSyncDomainsAuth.btn-success:active { background:#125f3e; border-color:#125f3e; }

/* 2b) Make the “Add” button on the pick-row look primary */
body.jl-dark-mode #addForm button[type="submit"] {
  background:#2563eb; border-color:#2563eb; color:#fff;
}
body.jl-dark-mode #addForm button[type="submit"]:hover  { background:#1e4fd3; border-color:#1e4fd3; }
body.jl-dark-mode #addForm button[type="submit"]:active { background:#1a45ba; border-color:#1a45ba; }

/* 2c) Make “Remove” buttons (no class) look like outline-danger */
body.jl-dark-mode .jl-js-remove button[type="submit"] {
  background:transparent; color:#ffb4b4; border:1px solid #a23a3a; border-radius:6px; padding:.35rem .7rem;
}
body.jl-dark-mode .jl-js-remove button[type="submit"]:hover  { background:#5a2424; color:#fff; }
body.jl-dark-mode .jl-js-remove button[type="submit"]:active { background:#4a1f1f; }

/* 3) Input type="date" */
body.jl-dark-mode input[type="date"] {
  background:#0f1420; color:#e6e6e6; border:1px solid #2a2f3a; border-radius:6px;
}
body.jl-dark-mode input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.85); }

/* 4) <details> + <summary> + <pre> (History/JSON sections) */
body.jl-dark-mode details {
  background:#141821; border:1px solid #2a2f3a; border-radius:6px; padding:6px 8px;
}
body.jl-dark-mode details > summary {
  color:#e6e6e6; cursor:pointer;
}
body.jl-dark-mode details pre {
  background:#0f1420; color:#d6e7ff; border:1px solid #2a2f3a; border-radius:6px; padding:8px;
}

/* 5) Pager section (Prev / Next) */
body.jl-dark-mode .jl-pager a,
body.jl-dark-mode .jl-pager span,
body.jl-dark-mode .jl-pager input {
  background:#1a2030; color:#e6e6e6; border:1px solid #2a2f3a; border-radius:6px; text-decoration:none;
}
body.jl-dark-mode .jl-pager a:hover { background:#232a3d; border-color:#394257; }
body.jl-dark-mode .jl-pager .disabled { opacity:.5; pointer-events:none; }

/* 6) Pick-row (search/select strip) */
body.jl-dark-mode .jl-pick-row select,
body.jl-dark-mode .jl-pick-row input[type="text"] {
  background:#0f1420; color:#e6e6e6; border:1px solid #2a2f3a; border-radius:6px;
}
body.jl-dark-mode .jl-pick-row button:not(.btn) {
  background:#1a2030; color:#e6e6e6; border:1px solid #2a2f3a; border-radius:6px;
}
body.jl-dark-mode .jl-pick-row button:not(.btn):hover { background:#232a3d; border-color:#394257; }

/* 6a) Intro/info strip on that page */
body.jl-dark-mode .jl-intro {
  background:#141821; color:#e6e6e6; border:1px solid #2a2f3a;
}

/* 6b) Flash / msg banners */
body.jl-dark-mode .jl-msg { background:#233044; border:1px solid #2f3a52; color:#e6e6e6; }
body.jl-dark-mode .jl-msg.jl-is-ok  { background:#142a19; border-color:#214c2b; color:#bfe7cc; }
body.jl-dark-mode .jl-msg.jl-is-err { background:#2a1416; border-color:#5b2b33; color:#f7c6cc; }
/* ==== DARK-MODE PATCH: addBtn, #matchTable remove buttons, and pair selects ==== */

/* A) Generic fallback for plain .btn (no Bootstrap variant classes) */
body.jl-dark-mode .btn:not(.btn-primary):not(.btn-secondary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-info):not(.btn-light):not(.btn-dark):not(.btn-outline-primary):not(.btn-outline-secondary):not(.btn-outline-success):not(.btn-outline-danger):not(.btn-outline-warning):not(.btn-outline-info):not(.btn-outline-light):not(.btn-outline-dark) {
  background:#1a2030; color:#e6e6e6; border:1px solid #2a2f3a;
}
body.jl-dark-mode .btn:not([class*="btn-"]):hover  { background:#232a3d; border-color:#394257; }
body.jl-dark-mode .btn:not([class*="btn-"]):active { background:#2b3146; border-color:#475274; }

/* A1) Specific “Add link” button */
body.jl-dark-mode #addBtn.btn {
  background:#2563eb; border-color:#2563eb; color:#fff;
}
body.jl-dark-mode #addBtn.btn:hover  { background:#1e4fd3; border-color:#1e4fd3; }
body.jl-dark-mode #addBtn.btn:active { background:#1a45ba; border-color:#1a45ba; }

/* B) Match table (grouped list) */
body.jl-dark-mode #matchTable { color:#e6e6e6; border-collapse:collapse; width:100%; }
body.jl-dark-mode #matchTable thead th {
  background:#1a2030; color:#e6e6e6; border-bottom:1px solid #2a2f3a;
}
body.jl-dark-mode #matchTable th, 
body.jl-dark-mode #matchTable td { border-bottom:1px solid #2a2f3a; }

/* Default row surface + zebra + hover */
body.jl-dark-mode #matchTable tbody tr > * { background:#141821; }
body.jl-dark-mode #matchTable tbody tr:nth-of-type(odd) > * { background:#11161f; }
body.jl-dark-mode #matchTable tbody tr:hover > * { background:#1a2030; }

/* Group header rows */
body.jl-dark-mode #matchTable tbody tr.jl-group > td {
  background:#232a3d; color:#cbd5e1; font-weight:600;
  border-top:1px solid #2a2f3a; border-bottom:1px solid #2a2f3a;
}

/* Remove buttons inside #matchTable (have class="btn" and data-del) */
body.jl-dark-mode #matchTable .btn[data-del] {
  background:transparent; color:#ffb4b4; border:1px solid #a23a3a; border-radius:6px; padding:.35rem .7rem;
}
body.jl-dark-mode #matchTable .btn[data-del]:hover  { background:#5a2424; color:#fff; }
body.jl-dark-mode #matchTable .btn[data-del]:active { background:#4a1f1f; }

/* C) The twin pick lists (scrollbars + inputs) */
body.jl-dark-mode .jl-pair .jl-box input[type="text"],
body.jl-dark-mode .jl-pair .jl-box select {
  background:#0f1420; color:#e6e6e6; border:1px solid #2a2f3a; border-radius:6px;
}

/* Dark scrollbars inside those long selects */
body.jl-dark-mode .jl-pair .jl-box select { scrollbar-color:#596586 #0f1420; scrollbar-width:thin; }
body.jl-dark-mode .jl-pair .jl-box select::-webkit-scrollbar { width:10px; }
body.jl-dark-mode .jl-pair .jl-box select::-webkit-scrollbar-track { background:#0f1420; border-radius:8px; }
body.jl-dark-mode .jl-pair .jl-box select::-webkit-scrollbar-thumb { background:#596586; border-radius:8px; border:2px solid #0f1420; }
body.jl-dark-mode .jl-pair .jl-box select::-webkit-scrollbar-thumb:hover { background:#6a789d; }

/* Optional niceties */
body.jl-dark-mode .jl-pair .jl-box h4 { color:#e6e6e6; }
body.jl-dark-mode .jl-pair .jl-box .small { color:#9aa4af; }
/* /m365/customers dark fixes */
body.jl-dark-mode .form-select {
  background-color:#0f1420; color:#e6e6e6; border-color:#2a2f3a;
}
body.jl-dark-mode .form-select:disabled {
  background-color:#0d1117; color:#98a2b3; opacity:1;
}

/* Ensure multi-select options are readable in dark mode (Windows browsers can render <option> with default colors) */
body.jl-dark-mode select.form-select[multiple] option,
body.jl-dark-mode select.form-select[size] option {
  background-color:#0f1420;
  color:#e6e6e6;
}
body.jl-dark-mode select.form-select[multiple]:disabled option,
body.jl-dark-mode select.form-select[size]:disabled option {
  background-color:#0d1117;
  color:#98a2b3;
}

body.jl-dark-mode .btn.btn-primary:disabled {
  background-color:#1e4fd3; border-color:#1e4fd3; color:#dbe5ff; opacity:.9;
}
body.jl-dark-mode .jl-iframe-wrap { background:#141821; border-color:#2a2f3a; }
body.jl-dark-mode .jl-iframe-wrap iframe { background:transparent; }
/* CustomersTable dark mode */
body.jl-dark-mode #usersTbl {
  color:#e6e6e6;
}
body.jl-dark-mode #usersTbl thead th {
  background:#1a2030; color:#e6e6e6; border-bottom:1px solid #2a2f3a;
}
body.jl-dark-mode #usersTbl tbody tr > * {
  background:#141821;
}
body.jl-dark-mode #usersTbl tbody tr:nth-of-type(odd) > * {
  background:#11161f;
}
body.jl-dark-mode #usersTbl tbody tr:hover > * {
  background:#1a2030;
}
body.jl-dark-mode #usersTbl tbody tr.jl-is-selected > * {
  background:#233044 !important; color:#fff;
}
/* Make selected rows obvious in both modes */
#usersTbl tbody tr.jl-is-selected > * { background: rgba(13,110,253,.15) !important; }
body.jl-dark-mode #usersTbl thead th { background:#1a2030; color:#e6e6e6; border-bottom:1px solid #2a2f3a; }
body.jl-dark-mode #usersTbl tbody tr > * { background:#141821; }
body.jl-dark-mode #usersTbl tbody tr:nth-of-type(odd) > * { background:#11161f; }
body.jl-dark-mode #usersTbl tbody tr:hover > * { background:#1a2030; }
body.jl-dark-mode #usersTbl tbody tr.jl-is-selected > * { background: rgba(37,99,235,.25) !important; }
#usersTbl tbody tr.jl-is-selected > * { background: rgba(13,110,253,.15) !important; }
/* M365 Customers: Sync Users button — dark mode */
body.jl-dark-mode #btnSync.btn-primary {
  /* base */
  --bs-btn-color: #fff;
  --bs-btn-bg: #2563eb;                 /* blue-600 */
  --bs-btn-border-color: #2563eb;

  /* hover / active */
  --bs-btn-hover-bg: #1e4edc;           /* slightly darker */
  --bs-btn-hover-border-color: #1e4edc;
  --bs-btn-active-bg: #1b46c9;
  --bs-btn-active-border-color: #1b46c9;

  /* focus ring */
  --bs-btn-focus-shadow-rgb: 37, 99, 235; /* rgba(var(...), .5) used by BS */

  /* disabled look on dark surfaces */
  --bs-btn-disabled-bg: #2b3146;
  --bs-btn-disabled-border-color: #2b3146;
  --bs-btn-disabled-color: #9aa4af;
}

body.jl-dark-mode #btnSync.btn-primary:focus-visible {
  outline: 2px solid #8ab4ff;  /* high-contrast keyboard focus */
  outline-offset: 2px;
}

/* Optional: pointer feedback when disabled */
body.jl-dark-mode #btnSync.btn-primary:disabled {
  cursor: not-allowed;
  opacity: 0.95; /* keep readable while muted */
}
/* Count chips — dark mode */
body.jl-dark-mode .jl-chip { border-radius:999px; display:inline-flex; align-items:center; }
body.jl-dark-mode .jl-chip--count {
  background: #1a2030;
  color: #e6e6e6;
  border-color: #2a2f3a;
  border-radius: 999px;
}
/* Agreements matching */
.jl-multiselect { }
.jl-multiselect--match {
    min-height: 260px;
}

/* Keep selected items visually obvious even when the control loses focus.
   Some browsers change the inactive selection color to something very close
   to the background (especially in dark mode), which makes it look "unselected". */
.jl-multiselect--match option:checked {
    background: linear-gradient(var(--bs-primary), var(--bs-primary));
    color: #fff;
}

body.jl-dark-mode .jl-multiselect--match {
    background-color: var(--bs-gray-900);
    color: var(--bs-light);
    border-color: rgba(255,255,255,0.15);
}

/* AgreementsMatch action buttons */
.jl-agreements__row .btn-action{ min-width: 84px; }

/* Tracking groups viewer (below selector) */
.jl-tracking-groups .jl-tracking-groups__groupPanels {
    max-height: 360px;
    overflow: auto;
    padding-right: 6px;
}

.jl-tracking-groups .jl-group-panel {
    border: 1px solid var(--jl-border-default, #ddd);
    border-radius: 12px;
    padding: 12px;
    background: var(--jl-bg-surface-raised, #fff);
}
body.jl-dark-mode .jl-tracking-groups .jl-group-panel {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}


/* Agreement addition groups page */
.jl-addition-groups__frame {
    max-height: 260px;
    overflow: auto;
    border: 1px solid var(--jl-border-default, #ddd);
    border-radius: 10px;
}
body.jl-dark-mode .jl-addition-groups__frame {
    border-color: rgba(255,255,255,0.12);
}


/* Agreement Tracker report */
.jl-atrk__group { border: 1px solid var(--jl-border-default, #ddd); border-radius: .6rem; margin-bottom: .75rem; background: var(--jl-bg-surface-raised, #fff); }
.jl-atrk__summary { padding: .75rem 1rem; cursor: pointer; display:flex; flex-direction:column; gap:.25rem; }
.jl-atrk__title { font-weight: 600; }
.jl-atrk__meta { font-size: .85rem; opacity: .8; }
.jl-atrk__body { padding: .75rem 1rem 1rem 1rem; display:flex; flex-direction:column; gap:1rem; }
.jl-atrk__section { border-top: 1px solid var(--jl-border-default, #eee); padding-top: .75rem; }
.jl-atrk__section-title { font-weight: 600; margin-bottom: .35rem; }
.jl-atrk__subtitle { font-weight: 600; margin: .25rem 0 .35rem 0; }
.jl-atrk__table th, .jl-atrk__table td { vertical-align: top; }
.jl-atrk { max-width: 520px; white-space: pre-wrap; word-break: break-word; }

body.jl-dark-mode .jl-atrk__group { border-color: rgba(255,255,255,.10); background: rgba(255,255,255,.02); }


/* Agreement Tracker (reports) - selectable groups layout */
.jl-atrk__groupsFrame{max-height: 320px; overflow:auto;}
.jl-atrk__detailsFrame{padding: 14px;}
.jl-atrk__row{cursor: pointer;}
.jl-atrk__row-selected{outline: 1px solid rgba(13,110,253,.55); outline-offset:-1px; background: rgba(13,110,253,.08);}
.jl-atrk__selectAll:indeterminate{
  background-color: rgba(25,135,84,.85);
  border-color: rgba(25,135,84,.95);
}



/* AgreementsTracking (template-based tracking of CW additions) */
.jl-agreements-tracking .jl-agreements-tracking__scroll{max-height: 360px; overflow:auto;}
.jl-agreements-tracking .jl-agreements-tracking__scroll.jl-agreements-tracking__scroll--sm{max-height: 220px; overflow:auto;}
.jl-agreements-tracking .jl-agreements-tracking__lines{max-height: 520px; overflow:auto;}
.jl-agreements-tracking .card{border-radius: 1rem;}
body.jl-dark-mode .jl-agreements-tracking .card{background: rgba(255,255,255,.02); border-color: rgba(255,255,255,.10);}
body.jl-dark-mode .jl-agreements-tracking .table{color: inherit;}

/* AgreementsTracking (company list + all additions) */
.jl-agreements-tracking__companyList { max-height: 260px; overflow: auto; }
.jl-agreements-tracking__additions { max-height: 520px; overflow: auto; }

/* AgreementsTracking (company list + all active additions) */
.jl-agreements-tracking__companyList { max-height: 260px; overflow: auto; }
.jl-agreements-tracking__additions { max-height: 520px; overflow: auto; }



/* --- Tracking groups page --- */
.jl-tracking-groups__companyList { max-height: 260px; overflow: auto; }
.jl-tracking-groups__lines { max-height: 320px; overflow: auto; }
.jl-tracking-groups__groupList { max-height: 260px; overflow: auto; padding-right: 4px; }
.jl-tracking-group-details { border: 1px solid var(--jl-border-default, #ddd); border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; background: var(--jl-bg-surface-raised, #fff); }
body.jl-dark-mode .jl-tracking-group-details { border-color: rgba(255,255,255,0.08); background: rgba(255,255,255,0.02); }
.jl-tracking-group-details > summary { cursor: pointer; list-style: none; }
.jl-tracking-group-details > summary::-webkit-details-marker { display: none; }
.btn-action { min-width: 82px; }

.jl-reports__info { border: 1px solid rgba(25, 135, 84, .35); background: rgba(25, 135, 84, .08); color: #155724; padding: 10px 12px; border-radius: 10px; }
body.jl-dark-mode .jl-reports__info { color: #d1e7dd; }


/* Disabled buttons in dark mode: mute appearance */
body.jl-dark-mode .btn:disabled,
body.jl-dark-mode .btn.disabled {
  opacity: 0.55 !important;
}
body.jl-dark-mode .btn:disabled:not([class*="btn-primary"]):not([class*="btn-success"]):not([class*="btn-danger"]):not([class*="btn-warning"]):not([class*="btn-info"]) {
  background-color: transparent !important;
  color: rgba(230,230,230,0.65) !important;
  border-color: rgba(255,255,255,0.20) !important;
}

/* ------------------------------------------------------------
   Searchable dropdown (LPDMatch)
------------------------------------------------------------- */

/* Keep the two search boxes on one line (Ingram left, ConnectWise right)
   with the Add button to the far right. */
.jl-pick-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: start;
  margin: 12px 0 18px;
}

.jl-pick-row > button[type="submit"] {
  height: 44px;
  padding: 0 18px;
  border-radius: 10px;
}

@media (max-width: 900px) {
  .jl-pick-row { grid-template-columns: 1fr; }
  .jl-pick-row > button[type="submit"] { width: 100%; }
}

.jl-filter-select { position: relative; min-width: 260px; flex: 1; }

.jl-filter-select__input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.18);
  background: rgba(255,255,255,0.92);
  color: #111;
}

body.jl-dark-mode .jl-filter-select__input {
  border-color: rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.25);
  color: #e6e6e6;
}

.jl-filter-select__list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  max-height: 320px;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.18);
  background: rgba(255,255,255,0.98);
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
  padding: 6px;
}

body.jl-dark-mode .jl-filter-select__list {
  border-color: rgba(255,255,255,0.14);
  background: rgba(18,18,18,0.98);
  box-shadow: 0 10px 24px rgba(0,0,0,0.45);
}

.jl-filter-select__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.jl-filter-select__item:hover {
  background: rgba(0,0,0,0.06);
}

body.jl-dark-mode .jl-filter-select__item:hover {
  background: rgba(255,255,255,0.08);
}



/* ------------------------------------------------------------
   Generic scrollable tables with sticky headers
------------------------------------------------------------- */
.table-scroll { overflow: auto; }
.table-scroll table { margin-bottom: 0; }
.table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f0f1f3;
  border-bottom: 2px solid var(--jl-border-strong);
}
body.jl-dark-mode .table-scroll thead th {
  background: rgba(12, 13, 18, 0.96);
  border-bottom: 1px solid rgba(255,255,255,0.12);
  color: #e6e6e6;
}

/* Tracked items table: keep controls aligned */
.jl-override__inputGroup { width: 150px; }
.jl-override__inputGroup .btn { width: 34px; padding: 0; }
.jl-override__inputGroup .jl-override__input { max-width: 70px; text-align: center; }
.jl-override__noteInput { width: 100%; min-width: 220px; }

/* Extra-small buttons used in compact management panels */
.btn-xxs {
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
  line-height: 1.15;
}

/* Compact group list (about ~3 rows visible) */
.jl-groups-mini {
  max-height: 110px;
  border: 1px solid var(--jl-border-default, #ddd);
  border-radius: 0.5rem;
}
body.jl-dark-mode .jl-groups-mini { border-color: rgba(255,255,255,0.10); }

/* Ensure multi-select options are readable in dark mode (some browsers render <option> using default colors) */
body.jl-dark-mode select.form-select[multiple] option,
body.jl-dark-mode select.form-select[size] option {
  background-color: #0f1420;
  color: #e6e6e6;
}
body.jl-dark-mode select.form-select[multiple]:disabled option,
body.jl-dark-mode select.form-select[size]:disabled option {
  background-color: #0d1117;
  color: #98a2b3;
}


/* =========================================================
   LOOKUP UI CUSTOM CSS
   - All custom styling lives in this file
   - Naming is standardised to a `jl-` prefix to avoid Bootstrap collisions
   ========================================================= */

/* Page wrappers */
.jl-page-pad { padding: .5rem; }
.jl-page-wrap { padding: 0; }

/* Layout utilities */
.jl-grid-2col { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
@media (max-width: 900px){ .jl-grid-2col { grid-template-columns:1fr; } }

/* Panels (lightweight cards) */
.jl-panel { border:1px solid var(--jl-border-default, #ddd); border-radius:12px; padding:12px; background:var(--jl-bg-surface-raised, #fff); }
body.jl-dark-mode .jl-panel { border-color:rgba(255,255,255,.08); background:rgba(255,255,255,.02); }
.jl-panel__title { font-weight:600; margin-bottom:4px; }
.jl-panel__sub { opacity:.8; font-size:.9em; margin-bottom:10px; }

/* Small helpers */
.jl-empty { opacity:.7; padding:8px 0; }
.jl-text-preline { white-space: pre-line; }

/* Buttons */
.jl-btn-outline { padding:6px 10px; border:1px solid #ddd; background:transparent; border-radius:8px; color:inherit; }
.jl-btn-outline:hover { border-color:#aaa; }
body.jl-dark-mode .jl-btn-outline { border-color:rgba(255,255,255,.2); }
body.jl-dark-mode .jl-btn-outline:hover { border-color:rgba(255,255,255,.4); }

/* Scrollable tables (used on AgreementsMatch detail panes) */
.jl-table-scroll{ max-height: 320px; overflow-y: auto; overflow-x: auto; }
.jl-table-scroll thead th{ position: sticky; top: 0; z-index: 2; }
.jl-table-scroll thead tr.jl-table-filter-row th{ top: 32px; z-index: 3; }
.jl-table-filter-row select{ min-width: 80px; }

/* Modals / overlays (no Bootstrap JS required) */
.jl-modal{ position:fixed; inset:0; z-index:9999; }
.jl-modal__backdrop{ position:absolute; inset:0; background:rgba(0,0,0,.65); }
.jl-modal__dialog{ position:relative; z-index:1; height:100%; display:flex; align-items:center; justify-content:center; padding:16px; }
.jl-modal__panel{ width:min(720px, 100%); background:#fff; border:1px solid #ddd; border-radius:12px; padding:16px; box-shadow:0 12px 36px rgba(0,0,0,.15); color:#111; }
.jl-modal__panel--wide{ width:min(1100px, 96vw); box-shadow:0 18px 60px rgba(0,0,0,.2); }
body.jl-dark-mode .jl-modal__panel{ background:#0f1115; border-color:rgba(255,255,255,.10); box-shadow:0 12px 36px rgba(0,0,0,.4); color:#e5e7eb; }
body.jl-dark-mode .jl-modal__panel--wide{ background: rgba(15, 23, 42, .98); box-shadow:0 18px 60px rgba(0,0,0,.55); }
.jl-modal__scroll{ overflow-x:auto; scrollbar-gutter: stable both-edges; }
.jl-modal__scroll table{ min-width: 980px; width: max-content; }
.jl-modal__scroll table td, .jl-modal__scroll table th{ max-width:none !important; overflow:visible !important; text-overflow:clip !important; }
.jl-modal__panel a{ color:inherit; }

/* Badges */
.jl-badge{ display:inline-block; padding:.2rem .55rem; border-radius:999px; font-size:.75rem; font-weight:650; }
.jl-badge--error{ background: rgba(239,68,68,.22); border:1px solid rgba(239,68,68,.55); }
.jl-badge--warning{ background: rgba(245,158,11,.20); border:1px solid rgba(245,158,11,.55); }
.jl-badge--info{ background: rgba(148,163,184,.18); border:1px solid rgba(148,163,184,.45); }

/* Notifications table */
.jl-table-notifs th{ white-space: nowrap; }
.jl-table-notifs td{ vertical-align: top; padding-top: .65rem; padding-bottom: .65rem; }
.jl-notif__title{ font-size: 1rem; font-weight: 650; line-height: 1.25; }
.jl-notif__msg{ font-size: .9rem; opacity: .85; line-height: 1.2; margin-top: .15rem; }
.jl-notif__company{ white-space: normal; word-break: break-word; }
.jl-row-actions{ white-space: nowrap; }
.jl-table-notifs tbody tr{ border-top: 1px solid var(--jl-border-default, #eee); }

/* Notifications: LPD inline linker modal */
#lpdLinkList{ max-height: 260px; overflow: auto; }
body.jl-dark-mode #lpdLinkModal .modal-content{ background: rgba(15, 23, 42, .98); color: #e5e7eb; border: 1px solid rgba(255,255,255,.08); }
body.jl-dark-mode #lpdLinkModal .modal-header{ border-bottom: 1px solid rgba(255,255,255,.08); }
body.jl-dark-mode #lpdLinkModal .modal-footer{ border-top: 1px solid rgba(255,255,255,.08); }
body.jl-dark-mode #lpdLinkModal .form-control{ background: rgba(2,6,23,.6); color: #e5e7eb; border-color: rgba(255,255,255,.12); }
body.jl-dark-mode #lpdLinkModal .list-group-item{ background: rgba(2,6,23,.55); color: #e5e7eb; border-color: rgba(255,255,255,.08); }
body.jl-dark-mode #lpdLinkModal .list-group-item:hover{ background: rgba(30,41,59,.65); }
body.jl-dark-mode #lpdLinkModal .list-group-item.active{ background: rgba(59,130,246,.35); border-color: rgba(59,130,246,.7); }

/* M365 Customers */
.jl-iframe-wrap{ position: relative; height: 70vh; border: 1px solid var(--bs-border-color, #dee2e6); border-radius: .5rem; overflow: hidden; }
#usersFrame{ width: 100%; height: 100%; border: 0; background: transparent; }
#statusBar{ display:none; }
.jl-status--show{ display:block !important; }
.jl-spin{ display:inline-block; width:1rem; height:1rem; border:.2rem solid #ccc; border-top-color:transparent; border-radius:50%; animation:jl-spin 0.8s linear infinite; margin-right:.5rem; vertical-align:-2px; }
@keyframes jl-spin { to { transform: rotate(360deg); } }

/* M365 Customers Table (standalone page) */
body.jl-page--m365-customers-table.jl-dark-mode .table thead.table-light th,
body.jl-page--m365-customers-table.jl-dark-mode .table thead.table-light > tr > th{ background:#1a2030!important; color:#e6e6e6!important; border-color:#2a2f3a!important; }
body.jl-page--m365-customers-table.jl-dark-mode .table-responsive{ background:#141821; border:1px solid #2a2f3a; border-radius:.5rem; }
body.jl-page--m365-customers-table th .jl-th-inner{ display:flex; flex-direction:column; gap:.25rem; }
body.jl-page--m365-customers-table th .jl-sort-label{ cursor:pointer; user-select:none; display:inline-flex; align-items:center; gap:.25rem; }
body.jl-page--m365-customers-table th .jl-sort-caret{ font-size:.75rem; opacity:.6; display:none; }
body.jl-page--m365-customers-table th.jl-sorted-asc .jl-sort-label .jl-sort-caret.jl-sort-caret--asc,
body.jl-page--m365-customers-table th.jl-sorted-desc .jl-sort-label .jl-sort-caret.jl-sort-caret--desc{ display:inline; }
body.jl-page--m365-customers-table th .form-select.form-select-sm,
body.jl-page--m365-customers-table th .form-control.form-control-sm{ height: calc(1.5em + .5rem + 2px); width: 100%; }
body.jl-page--m365-customers-table.jl-dark-mode .form-select,
body.jl-page--m365-customers-table.jl-dark-mode .form-control{ background-color:#1a2030; color:#e6e6e6; border-color:#2a2f3a; }
body.jl-page--m365-customers-table.jl-dark-mode .form-select option{ background-color:#1a2030; color:#e6e6e6; }
body.jl-page--m365-customers-table .table-responsive thead th{ position:sticky; top:0; z-index:2; }
body.jl-page--m365-customers-table tr.jl-is-selected{ outline:2px solid var(--bs-primary); outline-offset:-2px; }

/* M365 Customers table: keep EACH licence on a single line.
   If the licences column needs more space, allow the table to grow horizontally
   and scroll, rather than wrapping words onto new lines. */
body.jl-page--m365-customers-table .mstable{ overflow:auto; }
body.jl-page--m365-customers-table #usersTbl{ width:max-content; min-width:100%; }
body.jl-page--m365-customers-table #usersTbl th[data-key="M365Licences"],
body.jl-page--m365-customers-table #usersTbl td.jl-licences{ min-width: 320px; }
body.jl-page--m365-customers-table td.jl-licences{ white-space: normal; }
body.jl-page--m365-customers-table td.jl-licences .jl-lic-line{
  white-space: nowrap !important;
  display: block;
}

/* ============================================================
   SIDEBAR NAVIGATION LAYOUT
   ============================================================
   A collapsible sidebar navigation system with:
   - Fixed top bar with logo, hamburger, notifications, user menu
   - Collapsible sidebar with grouped navigation items
   - Main content area that adjusts to sidebar state
   - Mobile overlay mode
   ============================================================ */

/* --- Layout Variables --- */
:root {
  --jl-topbar-height: 56px;
  --jl-sidebar-width: 260px;
  --jl-sidebar-collapsed-width: 60px;
}

/* --- Body with Sidebar --- */
body.jl-has-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================
   TOP BAR
   ============================================ */
.jl-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  height: var(--jl-topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

body.jl-dark-mode .jl-topbar {
  background: #0f172a;
  border-bottom-color: #1e293b;
}

.jl-topbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.jl-topbar__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: #e2e8f0;
  font-size: 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.jl-topbar__toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

.jl-topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}

.jl-topbar__brand-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.jl-topbar__right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.jl-topbar__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: #e2e8f0;
  font-size: 1.1rem;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s ease;
}

.jl-topbar__icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.jl-topbar__user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  color: #e2e8f0;
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.jl-topbar__user:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.jl-topbar__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #3b82f6;
  color: #fff;
  border-radius: 50%;
  font-size: 0.85rem;
}

.jl-topbar__username {
  font-size: 0.9rem;
  font-weight: 500;
}

/* ============================================
   SIDEBAR
   ============================================ */
.jl-sidebar {
  position: fixed;
  top: var(--jl-topbar-height);
  left: 0;
  bottom: 0;
  z-index: 1020;
  width: var(--jl-sidebar-width);
  display: flex;
  flex-direction: column;
  background: #1e293b;
  border-right: 1px solid #334155;
  overflow: hidden;
  transition: width 0.25s ease, transform 0.25s ease;
}

body.jl-dark-mode .jl-sidebar {
  background: #0f172a;
  border-right-color: #1e293b;
}

.jl-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
}

/* Scrollbar styling for sidebar */
.jl-sidebar__nav::-webkit-scrollbar {
  width: 6px;
}

.jl-sidebar__nav::-webkit-scrollbar-track {
  background: transparent;
}

.jl-sidebar__nav::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 3px;
}

.jl-sidebar__nav::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Sidebar sections */
.jl-sidebar__section {
  padding: 8px 12px 16px;
}

.jl-sidebar__section:not(:last-child) {
  border-bottom: 1px solid #334155;
}

body.jl-dark-mode .jl-sidebar__section {
  border-bottom-color: #1e293b;
}

.jl-sidebar__section-title {
  padding: 8px 12px 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

body.jl-dark-mode .jl-sidebar__section-title {
  color: #64748b;
}

/* Sidebar links */
.jl-sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: #cbd5e1;
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
}

.jl-sidebar__link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.jl-sidebar__link.active {
  background: #3b82f6;
  color: #fff;
}

body.jl-dark-mode .jl-sidebar__link {
  color: #94a3b8;
}

body.jl-dark-mode .jl-sidebar__link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}

body.jl-dark-mode .jl-sidebar__link.active {
  background: #2563eb;
  color: #fff;
}

.jl-sidebar__icon {
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  font-size: 1rem;
  opacity: 0.85;
}

.jl-sidebar__link.active .jl-sidebar__icon {
  opacity: 1;
}

/* Sidebar footer */
.jl-sidebar__footer {
  padding: 12px 16px;
  text-align: center;
  color: #64748b;
  font-size: 0.75rem;
  border-top: 1px solid #334155;
}

body.jl-dark-mode .jl-sidebar__footer {
  border-top-color: #1e293b;
  color: #475569;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.jl-main {
  flex: 1;
  margin-top: var(--jl-topbar-height);
  margin-left: var(--jl-sidebar-width);
  min-height: calc(100vh - var(--jl-topbar-height));
  transition: margin-left 0.25s ease;
}

/* No sidebar (sign-in, sign-out, error pages) */
body:not(.jl-has-sidebar) .jl-main {
  margin-left: 0;
}

body:not(.jl-has-sidebar) .jl-main__inner {
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.jl-main__inner {
  padding: 24px;
  max-width: 1600px;
}

/* ============================================
   SIDEBAR COLLAPSED STATE (Desktop)
   ============================================ */
body.jl-sidebar-collapsed .jl-sidebar {
  width: var(--jl-sidebar-collapsed-width);
}

body.jl-sidebar-collapsed .jl-sidebar__section-title {
  display: none;
}

body.jl-sidebar-collapsed .jl-sidebar__link span {
  opacity: 0;
  width: 0;
}

body.jl-sidebar-collapsed .jl-sidebar__link {
  justify-content: center;
  padding: 10px;
}

body.jl-sidebar-collapsed .jl-sidebar__link .badge {
  display: none;
}

body.jl-sidebar-collapsed .jl-sidebar__footer {
  display: none;
}

body.jl-sidebar-collapsed .jl-main {
  margin-left: var(--jl-sidebar-collapsed-width);
}

/* Tooltip on hover when collapsed */
body.jl-sidebar-collapsed .jl-sidebar__link {
  position: relative;
}

body.jl-sidebar-collapsed .jl-sidebar__link::after {
  content: attr(href);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 10px;
  background: #1e293b;
  color: #fff;
  font-size: 0.8rem;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 1050;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

body.jl-sidebar-collapsed .jl-sidebar__link:hover::after {
  opacity: 1;
}

/* ============================================
   SIDEBAR OVERLAY (Mobile)
   ============================================ */
.jl-sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 1015;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

body.jl-sidebar-open .jl-sidebar-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* ============================================
   RESPONSIVE: Mobile (< 992px)
   ============================================ */
@media (max-width: 991.98px) {
  .jl-sidebar {
    transform: translateX(-100%);
    width: var(--jl-sidebar-width);
  }

  body.jl-sidebar-open .jl-sidebar {
    transform: translateX(0);
  }

  .jl-main {
    margin-left: 0;
  }

  .jl-main__inner {
    padding: 16px;
  }

  /* Hide username on mobile */
  .jl-topbar__username {
    display: none;
  }
}

/* ============================================
   RESPONSIVE: Large screens (> 1400px)
   ============================================ */
@media (min-width: 1400px) {
  .jl-main__inner {
    padding: 32px;
  }
}

/* ============================================
   DATTO MASTER-DETAIL LAYOUT
   ============================================ */
.jl-master-detail {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  height: calc(100vh - var(--jl-topbar-height) - 40px);
  max-height: calc(100vh - var(--jl-topbar-height) - 40px);
}

@media (max-width: 991.98px) {
  .jl-master-detail {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
  }

  .jl-master-panel {
    height: auto;
    max-height: 350px;
  }

  .jl-detail-panel {
    height: auto;
    max-height: none;
    overflow-y: visible;
  }
}

/* Master panel (left side - org list) */
.jl-master-panel {
  display: flex;
  flex-direction: column;
  background: var(--jl-bg-surface);
  border: 1px solid var(--jl-border-default);
  border-radius: 12px;
  overflow: hidden;
  height: 100%;
  max-height: 100%;
}

/* Master panel header with search */
.jl-master-panel__header {
  padding: 16px;
  border-bottom: 1px solid var(--jl-border-default);
  background: var(--jl-bg-surface-raised);
}

.jl-master-panel__title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--jl-text-primary);
}

.jl-master-panel__search {
  display: flex;
  gap: 8px;
}

.jl-master-panel__search-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--jl-border-default);
  border-radius: 8px;
  background: var(--jl-bg-surface);
  color: var(--jl-text-primary);
  font-size: 0.9rem;
}

.jl-master-panel__search-input:focus {
  outline: none;
  border-color: var(--jl-border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.jl-master-panel__search-btn {
  padding: 10px 16px;
  border: 1px solid var(--jl-border-default);
  border-radius: 8px;
  background: var(--jl-bg-surface-raised);
  color: var(--jl-text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.jl-master-panel__search-btn:hover {
  background: var(--jl-bg-hover);
}

/* Master panel list */
.jl-master-panel__list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

/* Org list item */
.jl-org-item {
  display: block;
  padding: 12px;
  margin-bottom: 4px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--jl-text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.jl-org-item:hover {
  background: var(--jl-bg-hover);
}

.jl-org-item.active {
  background: var(--jl-bg-selected);
  border-color: var(--jl-accent-primary);
}

.jl-org-item__name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jl-org-item__meta {
  font-size: 0.8rem;
  color: var(--jl-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Detail panel (right side) */
.jl-detail-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  min-height: 0;
}

/* Detail header card */
.jl-detail-header {
  background: var(--jl-bg-surface);
  border: 1px solid var(--jl-border-default);
  border-radius: 12px;
  padding: 20px;
}

.jl-detail-header__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--jl-text-primary);
}

.jl-detail-header__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.jl-detail-header__item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.jl-detail-header__label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--jl-text-muted);
}

.jl-detail-header__value {
  font-size: 0.95rem;
  color: var(--jl-text-primary);
}

/* Stat chips */
.jl-stat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--jl-border-light);
}

.jl-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--jl-bg-surface-raised);
  border: 1px solid var(--jl-border-default);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--jl-text-primary);
}

.jl-stat-chip__count {
  font-weight: 700;
  color: var(--jl-accent-primary);
}

/* Detail tabs */
.jl-detail-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--jl-bg-surface-raised);
  border: 1px solid var(--jl-border-default);
  border-radius: 10px;
}

.jl-detail-tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--jl-text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.jl-detail-tab:hover {
  background: var(--jl-bg-hover);
  color: var(--jl-text-primary);
}

.jl-detail-tab.active {
  background: var(--jl-accent-primary);
  color: #fff;
}

/* Detail content area */
.jl-detail-content {
  background: var(--jl-bg-surface);
  border: 1px solid var(--jl-border-default);
  border-radius: 12px;
  padding: 16px;
  min-height: 300px;
}

/* Seat grid for Datto */
.jl-seat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

/* Updated seat card styling for master-detail */
.jl-seat-card--md {
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--jl-border-default);
  background: var(--jl-bg-surface);
  transition: border-color 0.15s ease;
}

.jl-seat-card--md:hover {
  border-color: var(--jl-border-strong);
}

.jl-seat-card--md.jl-state-active {
  background: var(--jl-status-success-bg);
  border-color: var(--jl-status-success-border);
}

.jl-seat-card--md.jl-state-archived {
  background: var(--jl-bg-surface-raised);
  border-color: var(--jl-border-default);
  opacity: 0.8;
}

.jl-seat-card--md.jl-state-unprotected {
  background: var(--jl-status-error-bg);
  border-color: var(--jl-status-error-border);
}

/* Empty state */
.jl-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--jl-text-muted);
}

.jl-empty-state__icon {
  font-size: 3rem;
  opacity: 0.4;
  margin-bottom: 16px;
}

.jl-empty-state__text {
  font-size: 1rem;
}

/* ============================================
   DATTO PAGE - ADDITIONAL MASTER-DETAIL STYLES
   ============================================ */

/* Master Panel Header */
.jl-master-header {
  padding: 16px;
  border-bottom: 1px solid var(--jl-border-default);
  background: var(--jl-bg-surface-raised);
}

.jl-master-header__title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 12px 0;
  color: var(--jl-text-primary);
}

/* Master Search Box */
.jl-master-search {
  margin: 0;
}

.jl-master-search__wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.jl-master-search__icon {
  position: absolute;
  left: 12px;
  color: var(--jl-text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

.jl-master-search__input {
  width: 100%;
  padding: 10px 36px 10px 36px;
  border: 1px solid var(--jl-border-default);
  border-radius: 8px;
  background: var(--jl-bg-surface);
  color: var(--jl-text-primary);
  font-size: 0.9rem;
}

.jl-master-search__input:focus {
  outline: none;
  border-color: var(--jl-border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.jl-master-search__input::placeholder {
  color: var(--jl-text-muted);
}

.jl-master-search__clear {
  position: absolute;
  right: 8px;
  padding: 4px 8px;
  background: transparent;
  border: none;
  color: var(--jl-text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
}

.jl-master-search__clear:hover {
  color: var(--jl-text-primary);
  background: var(--jl-bg-hover);
}

/* Master List */
.jl-master-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  min-height: 0;
}

/* Master List Item */
.jl-master-item {
  display: block;
  padding: 12px;
  margin-bottom: 4px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--jl-text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.jl-master-item:hover {
  background: var(--jl-bg-hover);
  text-decoration: none;
  color: var(--jl-text-primary);
}

.jl-master-item.jl-is-selected {
  background: var(--jl-bg-selected);
  border-color: var(--jl-accent-primary);
}

.jl-master-item__title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--jl-text-primary);
}

.jl-master-item__meta {
  display: flex;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--jl-text-muted);
}

.jl-master-item__meta > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.jl-master-item__domain {
  color: var(--jl-text-link);
}

.jl-master-item__badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--jl-bg-surface-sunken);
  border-radius: 4px;
  color: var(--jl-text-secondary);
}

/* Master Empty State */
.jl-master-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  color: var(--jl-text-muted);
  gap: 12px;
}

.jl-master-empty i {
  font-size: 2rem;
  opacity: 0.5;
}

/* Detail Empty State */
.jl-detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
  color: var(--jl-text-muted);
  background: var(--jl-bg-surface);
  border: 1px solid var(--jl-border-default);
  border-radius: 12px;
  padding: 48px 24px;
}

.jl-detail-empty i {
  font-size: 3rem;
  opacity: 0.4;
  margin-bottom: 16px;
}

.jl-detail-empty h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--jl-text-primary);
}

.jl-detail-empty p {
  margin: 0;
  font-size: 0.95rem;
}

/* Detail Header - Extended */
.jl-detail-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.jl-detail-header__info {
  flex: 1;
  min-width: 200px;
}

.jl-detail-header__title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: var(--jl-text-primary);
}

.jl-detail-header__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 0.9rem;
}

.jl-detail-meta {
  color: var(--jl-text-secondary);
}

.jl-detail-meta__sep {
  color: var(--jl-text-muted);
  margin: 0 4px;
}

.jl-detail-header__counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Count Chip */
.jl-count-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  background: var(--jl-bg-surface-raised);
  border: 1px solid var(--jl-border-default);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--jl-text-primary);
}

/* Detail Tabs - Extended */
.jl-detail-tabs__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--jl-text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.jl-detail-tabs__btn:hover {
  background: var(--jl-bg-hover);
  color: var(--jl-text-primary);
}

.jl-detail-tabs__btn.jl-is-active {
  background: var(--jl-accent-primary);
  color: #ffffff;
}

.jl-detail-tabs__btn i {
  font-size: 0.9em;
}

/* Seats Empty State */
.jl-seats-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: var(--jl-text-muted);
  text-align: center;
  gap: 12px;
}

.jl-seats-empty i {
  font-size: 2.5rem;
  opacity: 0.4;
}

/* Seat Cards - New Style */
.jl-seat {
  position: relative;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--jl-border-default);
  background: var(--jl-bg-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.jl-seat:hover {
  border-color: var(--jl-border-strong);
  box-shadow: var(--jl-shadow-sm);
}

.jl-seat--active {
  background: var(--jl-status-success-bg);
  border-color: var(--jl-status-success-border);
}

.jl-seat--active .jl-seat__badge {
  background: var(--jl-status-success-border);
  color: var(--jl-status-success-text);
}

.jl-seat--archived {
  background: var(--jl-bg-surface-raised);
  border-color: var(--jl-border-default);
  opacity: 0.85;
}

.jl-seat--archived .jl-seat__badge {
  background: var(--jl-bg-surface-sunken);
  color: var(--jl-text-muted);
}

.jl-seat--unprotected {
  background: var(--jl-status-error-bg);
  border-color: var(--jl-status-error-border);
}

.jl-seat--unprotected .jl-seat__badge {
  background: var(--jl-status-error-border);
  color: var(--jl-status-error-text);
}

.jl-seat__badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 3px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--jl-bg-surface-sunken);
  border-radius: 4px;
  color: var(--jl-text-secondary);
}

.jl-seat__name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
  padding-right: 70px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--jl-text-primary);
}

.jl-seat__email {
  font-size: 0.85rem;
  color: var(--jl-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}

.jl-seat__footer {
  display: flex;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--jl-border-light);
}

.jl-seat__date {
  font-size: 0.8rem;
  color: var(--jl-text-muted);
}

.jl-seat__date i {
  margin-right: 6px;
  opacity: 0.7;
}

/* Mobile responsive for detail panel */
@media (max-width: 991.98px) {
  .jl-detail-header {
    flex-direction: column;
  }

  .jl-detail-header__counts {
    width: 100%;
  }

  .jl-detail-tabs {
    flex-wrap: wrap;
  }

  .jl-detail-tabs__btn {
    flex: 1 1 auto;
    min-width: 80px;
    justify-content: center;
  }

  .jl-seat-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   PAGE HEADER COMPONENT
   ============================================ */

.jl-page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--jl-border-default);
}

.jl-page-header__info {
  flex: 1;
  min-width: 200px;
}

.jl-page-header__title {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: var(--jl-text-primary);
}

.jl-page-header__desc {
  font-size: 0.95rem;
  color: var(--jl-text-secondary);
  margin: 0;
}

.jl-page-header__meta {
  font-size: 0.85rem;
  color: var(--jl-text-muted);
  margin-top: 4px;
}

.jl-page-header__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* ============================================
   TOOLBAR COMPONENT
   ============================================ */

.jl-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  margin-bottom: 16px;
}

.jl-toolbar__left,
.jl-toolbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.jl-toolbar__search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--jl-bg-surface-raised);
  border: 1px solid var(--jl-border-default);
  border-radius: var(--jl-radius-md);
  color: var(--jl-text-muted);
}

.jl-toolbar__search:focus-within {
  border-color: var(--jl-border-focus);
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.15);
}

.jl-toolbar__input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.875rem;
  color: var(--jl-text-primary);
  min-width: 180px;
}

.jl-toolbar__input::placeholder {
  color: var(--jl-text-muted);
}

/* ============================================
   BUTTON SYSTEM
   ============================================ */

.jl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.jl-btn:hover {
  text-decoration: none;
}

.jl-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.jl-btn--primary {
  background: var(--jl-accent-primary);
  border-color: var(--jl-accent-primary);
  color: #ffffff;
}

.jl-btn--primary:hover:not(:disabled) {
  background: var(--jl-accent-hover);
  border-color: var(--jl-accent-hover);
}

.jl-btn--success {
  background: #198754;
  border-color: #198754;
  color: #ffffff;
}

.jl-btn--success:hover:not(:disabled) {
  background: #157347;
  border-color: #157347;
}

.jl-btn--warning {
  background: #ffc107;
  border-color: #ffc107;
  color: #000000;
}

.jl-btn--warning:hover:not(:disabled) {
  background: #e0a800;
  border-color: #e0a800;
}

.jl-btn--danger {
  background: #dc3545;
  border-color: #dc3545;
  color: #ffffff;
}

.jl-btn--danger:hover:not(:disabled) {
  background: #bb2d3b;
  border-color: #bb2d3b;
}

.jl-btn--outline {
  background: transparent;
  border-color: var(--jl-border-default);
  color: var(--jl-text-primary);
}

.jl-btn--outline:hover:not(:disabled) {
  background: var(--jl-bg-hover);
  border-color: var(--jl-border-strong);
}

.jl-btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--jl-text-secondary);
}

.jl-btn--ghost:hover:not(:disabled) {
  background: var(--jl-bg-hover);
  color: var(--jl-text-primary);
}

.jl-btn--sm {
  padding: 4px 10px;
  font-size: 0.8rem;
}

.jl-btn-group {
  display: flex;
  gap: 4px;
}

/* ============================================
   SELECT COMPONENT
   ============================================ */

.jl-select {
  padding: 8px 32px 8px 12px;
  font-size: 0.9rem;
  border: 1px solid var(--jl-border-default);
  border-radius: 6px;
  background: var(--jl-bg-surface);
  color: var(--jl-text-primary);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23666' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
  min-width: 180px;
}

.jl-select:focus {
  outline: none;
  border-color: var(--jl-border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.jl-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   ALERT COMPONENT
   ============================================ */

.jl-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.jl-alert--info {
  background: var(--jl-status-info-bg);
  border: 1px solid var(--jl-status-info-border);
  color: var(--jl-status-info-text);
}

.jl-alert--success {
  background: var(--jl-status-success-bg);
  border: 1px solid var(--jl-status-success-border);
  color: var(--jl-status-success-text);
}

.jl-alert--warning {
  background: var(--jl-status-warning-bg);
  border: 1px solid var(--jl-status-warning-border);
  color: var(--jl-status-warning-text);
}

.jl-alert--danger {
  background: var(--jl-status-error-bg);
  border: 1px solid var(--jl-status-error-border);
  color: var(--jl-status-error-text);
}

/* ============================================
   FORM COMPONENTS
   ============================================ */

.jl-form-group {
  margin-bottom: 16px;
}

.jl-form-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--jl-text-primary);
}

.jl-form-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.9rem;
  border: 1px solid var(--jl-border-default);
  border-radius: 6px;
  background: var(--jl-bg-surface);
  color: var(--jl-text-primary);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.jl-form-input:focus {
  outline: none;
  border-color: var(--jl-border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.jl-form-input::placeholder {
  color: var(--jl-text-muted);
}

/* ============================================
   MODAL COMPONENTS
   ============================================ */

.jl-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1050;
  padding: 20px;
}

.jl-modal-card {
  background: var(--jl-bg-surface);
  border-radius: 12px;
  box-shadow: var(--jl-shadow-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.jl-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--jl-border-default);
}

.jl-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--jl-text-primary);
}

.jl-modal-close {
  background: transparent;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--jl-text-muted);
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

.jl-modal-close:hover {
  background: var(--jl-bg-hover);
  color: var(--jl-text-primary);
}

.jl-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.jl-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--jl-border-default);
  background: var(--jl-bg-surface-raised);
}

.jl-modal-card--wide {
  max-width: 1000px;
}

.jl-modal-desc {
  margin: 0 0 16px 0;
  color: var(--jl-text-secondary);
}

/* Tenant Details Modal */
.jl-detail-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.jl-detail-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.jl-detail-label {
  flex: 0 0 120px;
  font-size: 0.82rem;
  color: var(--jl-text-muted);
  font-weight: 500;
}

.jl-detail-value {
  flex: 1;
  font-size: 0.9rem;
}

.jl-detail-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.jl-stat-card {
  flex: 1;
  text-align: center;
  padding: 14px 8px;
  border-radius: var(--jl-radius-md, 8px);
  background: var(--jl-bg-surface-sunken);
  border: 1px solid var(--jl-border-default);
}

.jl-stat-card__value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--jl-text-primary);
}

.jl-stat-card__label {
  font-size: 0.78rem;
  color: var(--jl-text-muted);
  margin-top: 2px;
}

.jl-detail-section {
  margin-bottom: 16px;
}

.jl-detail-section__title {
  font-size: 0.88rem;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--jl-text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.jl-detail-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.jl-detail-tag {
  display: inline-block;
  padding: 3px 10px;
  font-size: 0.82rem;
  border-radius: 4px;
  background: var(--jl-bg-surface-sunken);
  border: 1px solid var(--jl-border-default);
  color: var(--jl-text-secondary);
}

.jl-table--compact th,
.jl-table--compact td {
  padding: 6px 10px;
  font-size: 0.84rem;
}

.jl-text-danger { color: #dc3545; }
.jl-text-warning { color: #f59e0b; }
.jl-text-muted { color: var(--jl-text-muted); }

/* Breakdown Summary */
.jl-breakdown-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--jl-bg-surface-raised);
  border-radius: var(--jl-radius-md);
}

.jl-breakdown-stat {
  flex: 1;
  min-width: 100px;
  text-align: center;
}

.jl-breakdown-stat__value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--jl-text-primary);
  font-variant-numeric: tabular-nums;
}

.jl-breakdown-stat__label {
  font-size: 0.7rem;
  color: var(--jl-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.jl-breakdown-stat--primary .jl-breakdown-stat__value {
  color: var(--jl-accent-primary);
}

.jl-breakdown-stat--success .jl-breakdown-stat__value {
  color: var(--jl-status-success-text);
}

.jl-breakdown-stat--danger .jl-breakdown-stat__value {
  color: var(--jl-status-error-text);
}

.jl-breakdown-table-wrap {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--jl-border-default);
  border-radius: var(--jl-radius-md);
}

/* Checkbox Group */
.jl-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding: 12px;
  background: var(--jl-bg-surface-raised);
  border-radius: var(--jl-radius-md);
}

.jl-checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: var(--jl-radius-sm);
  transition: background 0.15s ease;
}

.jl-checkbox-item:hover {
  background: var(--jl-bg-hover);
}

.jl-checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.jl-checkbox-item span {
  color: var(--jl-text-primary);
  font-size: 0.9rem;
}

.jl-checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--jl-text-secondary);
}

.jl-checkbox-inline input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.jl-form-actions {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--jl-border-light);
}

.jl-cell--center {
  text-align: center;
}

.jl-text--error {
  color: var(--jl-status-error-text);
}

/* ============================================
   CONNECTWISE SETTINGS COMPONENTS
   ============================================ */

.jl-cw-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.jl-cw-stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--jl-bg-surface);
  border: 1px solid var(--jl-border-default);
  border-radius: var(--jl-radius-md);
}

.jl-cw-stat-card--wide {
  grid-column: span 2;
}

.jl-cw-stat-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--jl-bg-surface-raised);
  border-radius: var(--jl-radius-sm);
  color: var(--jl-accent-primary);
  font-size: 1.1rem;
}

.jl-cw-stat-content {
  flex: 1;
  min-width: 0;
}

.jl-cw-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--jl-text-primary);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.jl-cw-stat-value--sm {
  font-size: 0.9rem;
  font-weight: 600;
}

.jl-cw-stat-label {
  font-size: 0.75rem;
  color: var(--jl-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.jl-sync-card .card-header {
  background: var(--jl-bg-surface-raised);
}

.jl-sync-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.jl-sync-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
}

.jl-sync-info-label {
  color: var(--jl-text-muted);
  font-weight: 500;
}

.jl-sync-info-value {
  color: var(--jl-text-primary);
  text-align: right;
  max-width: 60%;
}

.jl-text-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sync Console */
.jl-sync-console {
  background: #1e1e1e;
  color: #d4d4d4;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.4;
  min-height: 400px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 12px;
}

.jl-sync-console-entry {
  display: flex;
  gap: 8px;
  padding: 2px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.jl-sync-console-time {
  color: #6a9955;
  white-space: nowrap;
  flex-shrink: 0;
}

.jl-sync-console-level {
  width: 60px;
  flex-shrink: 0;
  text-transform: uppercase;
  font-weight: 600;
}

.jl-sync-console-level.level-info { color: #569cd6; }
.jl-sync-console-level.level-success { color: #4ec9b0; }
.jl-sync-console-level.level-warning { color: #dcdcaa; }
.jl-sync-console-level.level-error { color: #f14c4c; }
.jl-sync-console-level.level-debug { color: #808080; }

.jl-sync-console-category {
  color: #c586c0;
  width: 80px;
  flex-shrink: 0;
}

.jl-sync-console-message {
  color: #d4d4d4;
  word-break: break-word;
  flex-grow: 1;
}

.jl-sync-console-empty {
  color: #808080;
  text-align: center;
  padding: 40px;
}

.jl-product-filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.jl-product-filter {
  border: 1px solid var(--jl-border-light);
  border-radius: var(--jl-radius-sm);
  padding: 8px;
}

.jl-filter-list {
  max-height: 120px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.jl-filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--jl-radius-xs);
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--jl-text-secondary);
  transition: background 0.1s ease;
}

.jl-filter-item:hover {
  background: var(--jl-bg-hover);
}

.jl-filter-item input {
  margin: 0;
}

.btn-xs {
  padding: 2px 6px;
  font-size: 0.7rem;
}

@@media (max-width: 768px) {
  .jl-cw-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .jl-cw-stat-card--wide {
    grid-column: span 2;
  }
}

/* ============================================
   TABLE ENHANCEMENTS
   ============================================ */

.jl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.jl-table thead {
  background: var(--jl-bg-surface-raised);
  position: sticky;
  top: 0;
  z-index: 10;
}

.jl-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--jl-text-primary);
  border-bottom: 2px solid var(--jl-border-default);
}

.jl-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--jl-border-light);
  color: var(--jl-text-primary);
}

.jl-table--hover tbody tr:hover {
  background: var(--jl-bg-hover);
}

.jl-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--jl-border-default);
  border-radius: 8px;
}

.jl-cell--primary {
  font-weight: 600;
}

.jl-cell--number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.jl-cell--actions {
  text-align: right;
  white-space: nowrap;
}

.jl-row--highlight {
  background: rgba(59, 130, 246, 0.1) !important;
}

.jl-row--muted {
  opacity: 0.65;
}

/* Sortable table headers */
.jl-table--sortable .jl-th--sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 24px;
}

.jl-table--sortable .jl-th--sortable:hover {
  background: var(--jl-bg-hover);
}

.jl-table--sortable .jl-th--sortable::after {
  content: '\f0dc';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  opacity: 0.3;
}

.jl-table--sortable .jl-th--sort-asc::after {
  content: '\f0de';
  opacity: 1;
  color: var(--jl-accent-primary);
}

.jl-table--sortable .jl-th--sort-desc::after {
  content: '\f0dd';
  opacity: 1;
  color: var(--jl-accent-primary);
}

/* ============================================
   STATS BAR COMPONENT
   ============================================ */

.jl-stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 20px;
  background: var(--jl-bg-surface);
  border: 1px solid var(--jl-border-default);
  border-radius: var(--jl-radius-lg);
  margin-bottom: 20px;
}

.jl-stat-item {
  flex: 1;
  min-width: 120px;
  text-align: center;
  padding: 8px 16px;
  border-right: 1px solid var(--jl-border-light);
}

.jl-stat-item:last-child {
  border-right: none;
}

.jl-stat-item__value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--jl-text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.jl-stat-item__label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--jl-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 4px;
}

.jl-stat-item--primary .jl-stat-item__value {
  color: var(--jl-accent-primary);
}

.jl-stat-item--success .jl-stat-item__value {
  color: var(--jl-status-success-text);
}

.jl-stat-item--danger .jl-stat-item__value {
  color: var(--jl-status-error-text);
}

@@media (max-width: 768px) {
  .jl-stats-bar {
    gap: 8px;
  }
  .jl-stat-item {
    min-width: 80px;
    padding: 8px;
  }
  .jl-stat-item__value {
    font-size: 1.1rem;
  }
  .jl-stat-item__label {
    font-size: 0.65rem;
  }
}

/* ============================================
   SUMMARY FOOTER COMPONENT
   ============================================ */

.jl-summary-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 16px 20px;
  background: var(--jl-bg-surface-raised);
  border: 1px solid var(--jl-border-default);
  border-radius: var(--jl-radius-md);
  margin-top: 16px;
}

.jl-summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.jl-summary-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--jl-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.jl-summary-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--jl-text-primary);
  font-variant-numeric: tabular-nums;
}

.jl-summary-item--highlight .jl-summary-value {
  color: var(--jl-status-success-text);
}

.jl-text--negative {
  color: var(--jl-status-error-text) !important;
}

/* ============================================
   BADGE COMPONENT
   ============================================ */

.jl-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.jl-badge--success {
  background: var(--jl-status-success-bg);
  color: var(--jl-status-success-text);
}

.jl-badge--warning {
  background: var(--jl-status-warning-bg);
  color: var(--jl-status-warning-text);
}

.jl-badge--info {
  background: var(--jl-status-info-bg);
  color: var(--jl-status-info-text);
}

.jl-connect-dropdown {
  position: fixed;
  background: var(--fluent-card-bg, #fff);
  border: 1px solid var(--fluent-divider, #e2e8f0);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  overflow: visible;
  z-index: 9999;
}
.jl-connect-dropdown__item {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .5rem .75rem;
  border: none;
  background: none;
  color: var(--fluent-text, #1e293b);
  font-size: .82rem;
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
}
.jl-connect-dropdown__item:hover {
  background: var(--fluent-hover, rgba(0,0,0,.05));
}
.jl-connect-dropdown__item i { width: 16px; text-align: center; opacity: .7; }

.jl-badge--danger {
  background: rgba(220, 53, 69, 0.18);
  color: #dc3545;
  border: 1px solid rgba(220, 53, 69, 0.45);
}

.jl-badge--muted {
  background: var(--jl-bg-surface-sunken);
  color: var(--jl-text-muted);
}

.jl-count-chip--muted {
  opacity: 0.7;
}

/* ============================================
   STATUS DOT
   ============================================ */

.jl-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.jl-status-dot--success {
  background: #198754;
}

.jl-status-dot--warning {
  background: #ffc107;
}

.jl-status-dot--danger {
  background: #dc3545;
}

.jl-status-dot--muted {
  background: #6c757d;
}

/* ============================================
   CODE/MONOSPACE
   ============================================ */

.jl-code {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.85em;
  padding: 2px 6px;
  background: var(--jl-bg-surface-sunken);
  border-radius: 4px;
  color: var(--jl-text-primary);
}

/* ============================================
   SPINNER
   ============================================ */

.jl-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--jl-border-default);
  border-top-color: var(--jl-accent-primary);
  border-radius: 50%;
  animation: jl-spin 0.8s linear infinite;
}

@keyframes jl-spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   DOMAIN LIST (M365 Connections)
   ============================================ */

.jl-domain-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.jl-domain-list__item {
  padding: 10px 0;
  border-bottom: 1px solid var(--jl-border-light);
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--jl-text-primary);
}

.jl-domain-list__item:last-child {
  border-bottom: none;
}

.jl-domain-list__item i {
  color: var(--jl-text-muted);
}

.jl-domain-list__empty {
  padding: 20px 0;
  text-align: center;
  color: var(--jl-text-muted);
}

/* ============================================
   IFRAME CONTAINER
   ============================================ */

.jl-detail-content--frame {
  padding: 0;
}

.jl-iframe {
  width: 100%;
  min-height: 500px;
  border: 1px solid var(--jl-border-default);
  border-radius: 8px;
  background: var(--jl-bg-surface);
}

/* ============================================
   AGREEMENTS PAGE - AGREEMENT TABS
   ============================================ */

.jl-agreement-tabs {
  display: flex;
  gap: 12px;
  padding: 16px 0;
  overflow-x: auto;
  margin-bottom: 16px;
}

.jl-agreement-tab {
  flex-shrink: 0;
  padding: 12px 16px;
  min-width: 180px;
  border: 1px solid var(--jl-border-default);
  border-radius: 10px;
  background: var(--jl-bg-surface);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.jl-agreement-tab:hover {
  border-color: var(--jl-border-strong);
  box-shadow: var(--jl-shadow-sm);
}

.jl-agreement-tab.jl-is-selected {
  border-color: var(--jl-accent-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.jl-agreement-tab.jl-is-inactive {
  opacity: 0.65;
}

.jl-agreement-tab__name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: var(--jl-text-primary);
}

.jl-agreement-tab__type {
  font-size: 0.8rem;
  color: var(--jl-text-secondary);
  margin-bottom: 6px;
}

.jl-agreement-tab__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--jl-text-muted);
}

/* ============================================
   METADATA GRID
   ============================================ */

.jl-metadata-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px 24px;
}

.jl-metadata-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0; /* Allows text truncation to work */
}

.jl-metadata-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--jl-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.jl-metadata-value {
  font-size: 0.95rem;
  color: var(--jl-text-primary);
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Long values like emails can be truncated with tooltip on hover */
.jl-metadata-value--truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   INFO CARDS (Ingram)
   ============================================ */

.jl-info-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.jl-card {
  padding: 16px;
  border: 1px solid var(--jl-border-default);
  border-radius: 10px;
  background: var(--jl-bg-surface);
}

.jl-card__title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--jl-text-muted);
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.jl-card__title i {
  color: var(--jl-accent-primary);
}

.jl-card__content {
  font-size: 0.9rem;
  color: var(--jl-text-primary);
  line-height: 1.5;
}

.jl-contact-name {
  font-weight: 600;
  margin-bottom: 4px;
}

.jl-contact-email {
  color: var(--jl-text-link);
}

.jl-contact-phone {
  color: var(--jl-text-secondary);
}

.jl-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--jl-text-primary);
  margin: 0 0 16px 0;
}

/* ============================================
   MASTER TOGGLE CHECKBOX
   ============================================ */

.jl-master-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--jl-text-secondary);
  cursor: pointer;
  margin-top: 12px;
}

.jl-master-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--jl-accent-primary);
}

/* ============================================
   SETTINGS PAGE LAYOUT
   ============================================ */

.jl-settings-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  min-height: calc(100vh - var(--jl-topbar-height) - 40px);
}

.jl-settings-nav {
  position: sticky;
  top: calc(var(--jl-topbar-height) + 20px);
  height: fit-content;
  background: var(--jl-bg-surface);
  border: 1px solid var(--jl-border-default);
  border-radius: 12px;
  overflow: hidden;
}

.jl-settings-nav__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--jl-border-default);
  background: var(--jl-bg-surface-raised);
}

.jl-settings-nav__title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--jl-text-primary);
}

.jl-settings-nav__list {
  padding: 8px;
}

.jl-settings-nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  color: var(--jl-text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.jl-settings-nav__item:hover {
  background: var(--jl-bg-hover);
  color: var(--jl-text-primary);
  text-decoration: none;
}

.jl-settings-nav__item.jl-is-active {
  background: var(--jl-bg-selected);
  color: var(--jl-accent-primary);
}

.jl-settings-nav__item i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
}

.jl-settings-content {
  min-width: 0;
}

/* Mobile responsive for settings */
@media (max-width: 991.98px) {
  .jl-settings-layout {
    grid-template-columns: 1fr;
  }

  .jl-settings-nav {
    position: static;
  }

  .jl-settings-nav__list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .jl-settings-nav__item {
    flex: 1 1 auto;
    justify-content: center;
    min-width: fit-content;
  }

  .jl-page-header {
    flex-direction: column;
  }

  .jl-page-header__actions {
    width: 100%;
  }
}

/* ============================================================
   HELP SECTIONS
   ============================================================
   Collapsible help panels for page documentation.
   ============================================================ */

.jl-help {
  margin-bottom: 1rem;
}

.jl-help__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--jl-text-secondary);
  background: transparent;
  border: 1px solid var(--jl-border-default);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--jl-transition-fast);
}

.jl-help__toggle:hover {
  background: var(--jl-bg-hover);
  border-color: var(--jl-border-strong);
}

.jl-help__toggle i {
  font-size: 0.875rem;
  transition: transform var(--jl-transition-fast);
}

.jl-help__toggle[aria-expanded="true"] i {
  transform: rotate(180deg);
}

.jl-help__content {
  display: none;
  margin-top: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--jl-bg-surface-raised);
  border: 1px solid var(--jl-border-light);
  border-radius: 6px;
  font-size: 0.875rem;
  line-height: 1.6;
}

.jl-help__content.jl-is-open {
  display: block;
}

.jl-help__content h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--jl-text-primary);
}

.jl-help__content h5 {
  margin: 1rem 0 0.375rem 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--jl-text-primary);
}

.jl-help__content p {
  margin: 0 0 0.75rem 0;
  color: var(--jl-text-secondary);
}

.jl-help__content p:last-child {
  margin-bottom: 0;
}

.jl-help__content ul,
.jl-help__content ol {
  margin: 0 0 0.75rem 0;
  padding-left: 1.25rem;
  color: var(--jl-text-secondary);
}

.jl-help__content li {
  margin-bottom: 0.25rem;
}

.jl-help__content code {
  padding: 0.125rem 0.375rem;
  font-size: 0.8125rem;
  background: var(--jl-bg-surface-sunken);
  border-radius: 3px;
}

.jl-help__content kbd {
  padding: 0.125rem 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--jl-bg-surface-sunken);
  border: 1px solid var(--jl-border-default);
  border-radius: 3px;
}

.jl-help__content .jl-help__tip {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  margin: 0.75rem 0;
  background: var(--jl-status-info-bg);
  border-left: 3px solid var(--jl-accent-primary);
  border-radius: 0 4px 4px 0;
  color: var(--jl-status-info-text);
}

.jl-help__content .jl-help__tip i {
  flex-shrink: 0;
  margin-top: 0.125rem;
}

/* Dark mode adjustments */
body.jl-dark-mode .jl-help__toggle {
  color: var(--jl-text-secondary);
  border-color: var(--jl-border-default);
}

body.jl-dark-mode .jl-help__toggle:hover {
  background: var(--jl-bg-hover);
}

body.jl-dark-mode .jl-help__content {
  background: var(--jl-bg-surface-raised);
  border-color: var(--jl-border-default);
}

body.jl-dark-mode .jl-help__content .jl-help__tip {
  background: rgba(13, 110, 253, 0.15);
  color: #93c5fd;
}

/* ============================================================
   MISSING CSS CLASSES (Added 2026-01-16)
   ============================================================
   These classes were identified as being used in CSHTML pages
   but not previously defined in the stylesheet.
   ============================================================ */

/* ============================================
   PAGE IDENTIFIERS
   ============================================
   These classes are added to the body element for page-specific
   styling and JavaScript targeting. They use the convention:
   jl-page--{pagename}
   ============================================ */

/* LPD Match page identifier */
.jl-page--lpdmatch {
  /* Base styling for LPD Match page */
}

/* Notifications page identifier */
.jl-page--notifications {
  /* Base styling for Notifications page */
}

/* ============================================
   WELCOME BANNER COMPONENTS (Dashboard)
   ============================================ */

/* Content wrapper inside the welcome banner */
.jl-welcome-banner__content {
  flex: 1;
  min-width: 0;
}

/* ============================================
   REPORT ERROR COMPONENTS
   ============================================
   Used across multiple report pages for displaying
   error messages in a consistent, user-friendly format.
   ============================================ */

/* Error title - bold heading for error messages */
.jl-reports__error-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--jl-status-error-text);
}

/* Error body - container for error message content */
.jl-reports__error-body {
  font-size: 0.9rem;
  color: var(--jl-status-error-text);
  line-height: 1.5;
}

/* Error pre - preformatted text for stack traces / technical details */
.jl-reports__error-pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 10px 12px;
  margin-top: 8px;
  background: var(--jl-bg-surface-sunken);
  border: 1px solid var(--jl-border-default);
  border-radius: var(--jl-radius-md);
  color: var(--jl-text-secondary);
  max-height: 200px;
  overflow: auto;
}

/* ============================================
   AGREEMENT TRACKER COMPONENTS
   ============================================
   Used in Reports/AgreementTracker.cshtml and
   Reports/TrackingGroups.cshtml for tracking UI.
   ============================================ */

/* Group checkbox - styled checkbox for selecting groups */
.jl-atrk__groupcheck {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--jl-accent-primary);
}

.jl-atrk__groupcheck:focus {
  outline: 2px solid var(--jl-border-focus);
  outline-offset: 2px;
}

/* Section title - heading for Ingram/ConnectWise/etc sections */
.jl-atrk__sectionTitle {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--jl-text-primary);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--jl-border-light);
}

/* ============================================
   TABLE SORTING COMPONENTS (Generic)
   ============================================
   These extend the existing M365 CustomersTable sort
   styles to be available globally for any sortable table.
   ============================================ */

/* Sort label - clickable header text for sortable columns */
.jl-sort-label {
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.jl-sort-label:hover {
  color: var(--jl-accent-primary);
}

/* Sort caret - arrow indicators for sort direction */
.jl-sort-caret {
  font-size: 0.75rem;
  opacity: 0.5;
  display: none;
}

.jl-sort-caret--asc,
.jl-sort-caret--desc {
  display: none;
}

/* Show appropriate caret when column is sorted */
th.jl-sorted-asc .jl-sort-caret--asc,
th.jl-sorted-desc .jl-sort-caret--desc {
  display: inline;
  opacity: 1;
}

/* ============================================
   LICENCE DISPLAY COMPONENTS
   ============================================
   Used in M365/CustomersTable for displaying
   licence information in table cells.
   ============================================ */

/* Licence list container */
.jl-licences {
  white-space: normal;
  min-width: 280px;
}

/* Individual licence line - each licence on its own row */
.jl-lic-line {
  display: block;
  white-space: nowrap;
  padding: 2px 0;
  font-size: 0.85rem;
  color: var(--jl-text-secondary);
}

.jl-lic-line:first-child {
  padding-top: 0;
}

.jl-lic-line:last-child {
  padding-bottom: 0;
}

/* ============================================
   DARK MODE OVERRIDES FOR NEW CLASSES
   ============================================ */

/* Report error components - dark mode */
body.jl-dark-mode .jl-reports__error-title {
  color: var(--jl-status-error-text);
}

body.jl-dark-mode .jl-reports__error-body {
  color: var(--jl-status-error-text);
}

body.jl-dark-mode .jl-reports__error-pre {
  background: var(--jl-bg-surface-sunken);
  border-color: var(--jl-border-default);
  color: #f7c6cc;
}

/* Agreement tracker components - dark mode */
body.jl-dark-mode .jl-atrk__groupcheck {
  accent-color: #3b82f6;
}

body.jl-dark-mode .jl-atrk__sectionTitle {
  color: var(--jl-text-primary);
  border-bottom-color: var(--jl-border-default);
}

/* Sort components - dark mode */
body.jl-dark-mode .jl-sort-label:hover {
  color: #8ab4ff;
}

body.jl-dark-mode th.jl-sorted-asc .jl-sort-caret--asc,
body.jl-dark-mode th.jl-sorted-desc .jl-sort-caret--desc {
  color: #8ab4ff;
}

/* Licence display - dark mode */
body.jl-dark-mode .jl-lic-line {
  color: var(--jl-text-secondary);
}

/* ============================================
   SCROLLBAR STYLING FOR NEW COMPONENTS
   ============================================ */

/* Error pre scrollbar - dark mode */
body.jl-dark-mode .jl-reports__error-pre {
  scrollbar-color: #596586 var(--jl-bg-surface-sunken);
  scrollbar-width: thin;
}

body.jl-dark-mode .jl-reports__error-pre::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

body.jl-dark-mode .jl-reports__error-pre::-webkit-scrollbar-track {
  background: var(--jl-bg-surface-sunken);
  border-radius: 4px;
}

body.jl-dark-mode .jl-reports__error-pre::-webkit-scrollbar-thumb {
  background: #596586;
  border-radius: 4px;
}

body.jl-dark-mode .jl-reports__error-pre::-webkit-scrollbar-thumb:hover {
  background: #6a789d;
}

