/**
 * brand.css — Wolves Den brand overrides
 *
 * Loaded after app.min.css in main.ejs so these always win.
 * Maps the root.css design-token palette onto Bootstrap 5 and
 * the theme's own component variables.
 *
 * Dark and light palettes are defined once below. Components consume
 * semantic variables so Bootstrap and custom screens switch together.
 */

/* ── Wolves Den color modes ──────────────────────────────────── */
:root,
[data-bs-theme="dark"] {
  color-scheme: dark;
  --wd-bg: #0e1015;
  --wd-bg-elevated: #191c24;
  --wd-card: #161920;
  --wd-hover: #1f2330;
  --wd-text: #d4d4d8;
  --wd-text-strong: #f4f4f5;
  --wd-text-soft: #a1a1aa;
  --wd-secondary-action-text: #e4e4e7;
  --wd-muted: #838387;
  --wd-muted-subtle: #6b6b70;
  --wd-muted-strong: #555560;
  --wd-border: #1e2028;
  --wd-border-strong: #2e3040;
  --wd-border-hover: #3e4050;
  --wd-border-translucent: rgba(255,255,255,.075);
  --wd-surface-subtle: rgba(255,255,255,.03);
  --wd-surface-hover: rgba(255,255,255,.05);
  --wd-surface-active: rgba(255,255,255,.06);
  --wd-shadow-hover: rgba(0,0,0,.3);
  --wd-accent: #ff5c5c;
  --wd-accent-hover: #ff7070;
  --wd-accent-active: #e84848;
  --wd-accent-rgb: 255, 92, 92;
  /* Action green — primary/confirm/positive (redesign 2026-07) */
  --wd-primary: #16a34a;
  --wd-primary-hover: #1eb85a;
  --wd-primary-active: #178a44;
  --wd-primary-rgb: 22, 163, 74;
  --wd-money: #34d17e;      /* positive money TEXT + accent bars on dark */
  --wd-amber-text: #f5b544; /* warning TEXT on dark */
  --wd-blue-text: #6ba5f7;  /* info TEXT on dark */
}

[data-bs-theme="light"] {
  color-scheme: light;
  --wd-bg: #f8f9fa;
  --wd-bg-elevated: #f1f3f5;
  --wd-card: #ffffff;
  --wd-hover: #eceef0;
  --wd-text: #3c3c43;
  --wd-text-strong: #1a1a1e;
  --wd-text-soft: #545458;
  --wd-secondary-action-text: #3c3c43;
  --wd-muted: #6e6e73;
  --wd-muted-subtle: #606066;
  --wd-muted-strong: #75757d;
  --wd-border: #e5e5ea;
  --wd-border-strong: #d1d1d6;
  --wd-border-hover: #aeaeb2;
  --wd-border-translucent: rgba(0,0,0,.075);
  --wd-surface-subtle: rgba(0,0,0,.025);
  --wd-surface-hover: rgba(0,0,0,.04);
  --wd-surface-active: rgba(0,0,0,.06);
  --wd-shadow-hover: rgba(0,0,0,.12);
  --wd-accent: #dc2626;
  --wd-accent-hover: #b91c1c;
  --wd-accent-active: #991b1b;
  --wd-accent-rgb: 220, 38, 38;
}

/* ── Bootstrap core ──────────────────────────────────────────── */
[data-bs-theme="dark"] {
  /* Brand accent */
  --bs-primary:             var(--wd-accent);
  --bs-primary-rgb:         var(--wd-accent-rgb);
  --bs-link-color:          var(--wd-accent);
  --bs-link-hover-color:    var(--wd-accent-hover);

  /* Page & surface backgrounds */
  --bs-body-bg:             var(--wd-bg);
  --bs-body-bg-rgb:         14, 16, 21;
  --bs-secondary-bg:        var(--wd-bg-elevated);
  --bs-tertiary-bg:         var(--wd-card);

  /* Text */
  --bs-body-color:          var(--wd-text);
  --bs-body-color-rgb:      212, 212, 216; /* .text-body utility reads the -rgb var */
  --bs-emphasis-color:      var(--wd-text-strong);
  --bs-secondary-color:     var(--wd-muted);
  --bs-heading-color:       var(--wd-text-strong);

  /* Borders & inputs */
  --bs-border-color:        var(--wd-border);
  --bs-border-color-translucent: var(--wd-surface-active);
  --bs-input-bg:            var(--wd-border);
  --bs-input-border-color:  var(--wd-border-strong);
  --bs-input-focus-border-color: var(--wd-accent);

  /* Card */
  --bs-card-bg:             var(--wd-card);
  --bs-card-border-color:   var(--wd-border);
  --bs-card-cap-bg:         var(--wd-bg-elevated);

  /* Table */
  --bs-table-bg:            transparent;
  --bs-table-striped-bg:    var(--wd-surface-subtle);
  --bs-table-border-color:  var(--wd-border);

  /* Dropdown */
  --bs-dropdown-bg:         var(--wd-bg-elevated);
  --bs-dropdown-border-color: var(--wd-border-strong);
  --bs-dropdown-link-color: var(--wd-text);
  --bs-dropdown-link-hover-bg: var(--wd-hover);
  --bs-dropdown-link-active-bg: var(--wd-accent);

  /* Modal */
  --bs-modal-bg:            var(--wd-card);
  --bs-modal-header-border-color: var(--wd-border);
  --bs-modal-footer-border-color: var(--wd-border);

  /* List group */
  --bs-list-group-bg:       var(--wd-card);
  --bs-list-group-border-color: var(--wd-border);
  --bs-list-group-color:    var(--wd-text);
  --bs-list-group-active-bg: var(--wd-accent);
  --bs-list-group-active-border-color: var(--wd-accent);

  /* Nav pills & tabs */
  --bs-nav-pills-link-active-bg: var(--wd-accent);

  /* Pagination */
  --bs-pagination-bg:       var(--wd-card);
  --bs-pagination-border-color: var(--wd-border);
  --bs-pagination-color:    var(--wd-text);
  --bs-pagination-hover-bg: var(--wd-hover);
  --bs-pagination-hover-border-color: var(--wd-border-strong);
  --bs-pagination-active-bg: var(--wd-accent);
  --bs-pagination-active-border-color: var(--wd-accent);

  /* Utility badges */
  --bs-success:             #22c55e;
  --bs-success-rgb:         34, 197, 94;
  --bs-warning:             #f59e0b;
  --bs-warning-rgb:         245, 158, 11;
  --bs-danger:              #ef4444;
  --bs-danger-rgb:          239, 68, 68;
  --bs-info:                #3b82f6;
  --bs-info-rgb:            59, 130, 246;
}

[data-bs-theme="light"] {
  --bs-primary:             var(--wd-accent);
  --bs-primary-rgb:         var(--wd-accent-rgb);
  --bs-link-color:          var(--wd-accent);
  --bs-link-hover-color:    var(--wd-accent-hover);
  --bs-body-bg:             var(--wd-bg);
  --bs-body-color:          var(--wd-text);
  --bs-secondary-bg:        var(--wd-bg-elevated);
  --bs-tertiary-bg:         var(--wd-card);
  --bs-emphasis-color:      var(--wd-text-strong);
  --bs-secondary-color:     var(--wd-muted);
  --bs-heading-color:       var(--wd-text-strong);
  --bs-border-color:        var(--wd-border);
  --bs-border-color-translucent: var(--wd-border-translucent);
}

/* ── Theme sidebar ───────────────────────────────────────────── */
[data-bs-theme] {
  --bs-sidebar-bg:                         var(--wd-bg);
  --bs-sidebar-border-color:               var(--wd-border);

  --bs-sidebar-menu-item-color:            var(--wd-muted);
  --bs-sidebar-menu-sub-item-color:        var(--wd-muted-subtle);
  --bs-sidebar-menu-item-icon-color:       var(--wd-muted-strong);
  --bs-sidebar-menu-item-hover-color:      var(--wd-text-strong);
  --bs-sidebar-menu-item-active-color:     var(--wd-accent);
  --bs-sidebar-menu-sub-item-active-color: var(--wd-accent);
  --bs-sidebar-menu-item-active-bg-color:  rgba(var(--wd-accent-rgb), .12);

  /* dark sidebar variant — same values */
  --bs-sidebar-dark-bg:                         var(--wd-bg);
  --bs-sidebar-dark-menu-item-color:            var(--wd-muted);
  --bs-sidebar-dark-menu-sub-item-color:        var(--wd-muted-subtle);
  --bs-sidebar-dark-menu-item-icon-color:       var(--wd-muted-strong);
  --bs-sidebar-dark-menu-item-hover-color:      var(--wd-text-strong);
  --bs-sidebar-dark-menu-item-active-color:     var(--wd-accent);
  --bs-sidebar-dark-menu-item-active-bg-color:  rgba(var(--wd-accent-rgb), .12);
}

/* ── Theme topbar / header ───────────────────────────────────── */
[data-bs-theme] {
  --bs-header-bg:            var(--wd-bg);
  --bs-header-dark-bg:       var(--wd-bg);
  --bs-header-item-color:    var(--wd-muted);
  --bs-header-dark-item-color: var(--wd-muted);
  --bs-navbar-brand-box-bg:  var(--wd-bg);
  --bs-topnav-bg:            var(--wd-bg);
  --bs-topnav-item-color:    var(--wd-muted);
  --bs-topnav-item-color-active: var(--wd-accent);
  --bs-topbar-user-bg:       var(--wd-card);
}

/* ── Form controls ───────────────────────────────────────────── */
.form-control,
.form-select {
  background-color: var(--wd-border);
  border-color: var(--wd-border-strong);
  color: var(--wd-text);
}
.form-control:focus,
.form-select:focus {
  background-color: var(--wd-border);
  border-color: var(--wd-accent);
  color: var(--wd-text-strong);
  box-shadow: 0 0 0 3px rgba(var(--wd-accent-rgb), .15);
}
.form-control::placeholder { color: var(--wd-muted-strong); }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background-color: var(--wd-card);
  border-color: var(--wd-border);
}
.card-header,
.card-footer {
  background-color: var(--wd-bg-elevated);
  border-color: var(--wd-border);
}

/* ── Tables ──────────────────────────────────────────────────── */
.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--wd-text);
  --bs-table-border-color: var(--wd-border);
  --bs-table-striped-bg: var(--wd-surface-subtle);
  --bs-table-hover-bg: var(--wd-surface-hover);
}
.table thead th {
  color: var(--wd-muted);
  border-bottom-color: var(--wd-border);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Buttons — tier system (see docs/redesign/design_handoff_ui_refinement) ── */
/* Geometry: radius 8, weight 600, flat. Focus ring stays brand red. */
.btn {
  border-radius: 8px;
  font-weight: 600;
  box-shadow: none;
}
.btn:focus-visible { box-shadow: 0 0 0 3px rgba(var(--wd-accent-rgb), .15); }

/* Primary tier — the single most important action per view.
   .btn-success is aliased to the same green so legacy confirm/checkout
   buttons collapse into one hue with zero view edits. */
.btn-primary,
.btn-success {
  /* Bootstrap state machinery (:disabled, .show, etc.) reads the vars,
     so both the vars and the direct props must point at the tokens */
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--wd-primary);
  --bs-btn-border-color: var(--wd-primary);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--wd-primary-hover);
  --bs-btn-hover-border-color: var(--wd-primary-hover);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--wd-primary-active);
  --bs-btn-active-border-color: var(--wd-primary-active);
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--wd-primary);
  --bs-btn-disabled-border-color: var(--wd-primary);
  --bs-btn-focus-shadow-rgb: var(--wd-primary-rgb);
  background-color: var(--wd-primary);
  border-color: var(--wd-primary);
  color: #fff;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-success:hover,
.btn-success:focus {
  background-color: var(--wd-primary-hover);
  border-color: var(--wd-primary-hover);
  color: #fff;
}
.btn-primary:active,
.btn-success:active,
.btn-primary.active,
.btn-success.active {
  background-color: var(--wd-primary-active);
  border-color: var(--wd-primary-active);
  color: #fff;
}

/* Secondary tier — real but non-primary actions.
   .btn-outline-primary rides along: red is never an action color, and these
   are all navigate/act-adjacent buttons ("Resume", "Ready", "Edit"). */
.btn-light,
.btn-outline-secondary,
.btn-outline-primary {
  --bs-btn-color: var(--wd-secondary-action-text);
  --bs-btn-bg: var(--wd-border);
  --bs-btn-border-color: var(--wd-border-strong);
  --bs-btn-disabled-color: var(--wd-muted);
  --bs-btn-disabled-bg: var(--wd-border);
  --bs-btn-disabled-border-color: var(--wd-border-strong);
  background-color: var(--wd-border);
  border: 1px solid var(--wd-border-strong);
  color: var(--wd-secondary-action-text);
}
.btn-light:hover,
.btn-light:focus,
.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background-color: var(--wd-hover);
  border-color: var(--wd-border-hover);
  color: var(--wd-text-strong);
}
.btn-light:active,
.btn-outline-secondary:active,
.btn-light.active,
.btn-outline-secondary.active,
.btn-outline-primary:active,
.btn-outline-primary.active {
  background-color: var(--wd-hover);
  border-color: var(--wd-border-hover);
  color: var(--wd-text-strong);
}

/* Tertiary tier — low-stakes / dismissive */
.btn-tertiary {
  background: transparent;
  border: 0;
  color: var(--wd-text-soft);
  font-weight: 600;
}
.btn-tertiary:hover,
.btn-tertiary:focus {
  color: var(--wd-text-strong);
  background: var(--wd-surface-hover);
}

/* Attention tier — resolve-CTA in warning banners */
.btn-warning {
  --bs-btn-color: #1a1205;
  --bs-btn-bg: #f59e0b;
  --bs-btn-border-color: #f59e0b;
  --bs-btn-disabled-color: #1a1205;
  --bs-btn-disabled-bg: #f59e0b;
  --bs-btn-disabled-border-color: #f59e0b;
  background-color: #f59e0b;
  border-color: #f59e0b;
  color: #1a1205;
}
.btn-warning:hover,
.btn-warning:focus {
  background-color: #f8ac28;
  border-color: #f8ac28;
  color: #1a1205;
}
.btn-warning:active {
  background-color: #dd8f09;
  border-color: #dd8f09;
  color: #1a1205;
}

/* Destructive tier — outline by default, solid only on final confirm */
.btn-outline-danger {
  --bs-btn-color: #ff7070;
  --bs-btn-bg: transparent;
  --bs-btn-border-color: rgba(var(--wd-accent-rgb), .42);
  --bs-btn-disabled-color: #ff7070;
  --bs-btn-disabled-bg: transparent;
  --bs-btn-disabled-border-color: rgba(var(--wd-accent-rgb), .42);
  background: transparent;
  border: 1px solid rgba(var(--wd-accent-rgb), .42);
  color: #ff7070;
}
.btn-outline-danger:hover,
.btn-outline-danger:focus {
  background-color: rgba(var(--wd-accent-rgb), .1);
  border-color: rgba(var(--wd-accent-rgb), .6);
  color: #ff7070;
}
.btn-danger {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--wd-accent-active);
  --bs-btn-border-color: var(--wd-accent-active);
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--wd-accent-active);
  --bs-btn-disabled-border-color: var(--wd-accent-active);
  background-color: var(--wd-accent-active);
  border-color: var(--wd-accent-active);
  color: #fff;
}
.btn-danger:hover,
.btn-danger:focus {
  background-color: var(--wd-accent);
  border-color: var(--wd-accent);
  color: #fff;
}

/* Secondary-danger — reads as a quiet secondary at rest, reveals its
   destructive nature on hover (red text + border, no fill) */
.btn-secondary-danger {
  --bs-btn-color: #e4e4e7;
  --bs-btn-bg: var(--wd-border);
  --bs-btn-border-color: var(--wd-border-strong);
  --bs-btn-disabled-color: var(--wd-muted);
  --bs-btn-disabled-bg: var(--wd-border);
  --bs-btn-disabled-border-color: var(--wd-border-strong);
  background-color: var(--wd-border);        /* #1e2028 */
  border: 1px solid var(--wd-border-strong); /* #2e3040 */
  color: #e4e4e7;
}
.btn-secondary-danger:hover,
.btn-secondary-danger:focus {
  background-color: var(--wd-border);
  border-color: rgba(var(--wd-accent-rgb), .42);
  color: #ff7070;
}
.btn-secondary-danger:active,
.btn-secondary-danger.active {
  background-color: rgba(var(--wd-accent-rgb), .1);
  border-color: rgba(var(--wd-accent-rgb), .6);
  color: #ff7070;
}

/* ── Row-action ghost icon chips ─────────────────────────────── */
.wd-icon-chip {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--wd-border-strong);
  color: #9a9aa4;
  font-size: .95rem;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s, background .15s, color .15s;
}
.wd-icon-chip:hover,
.wd-icon-chip:focus {
  color: var(--wd-text-strong);
  border-color: var(--wd-border-hover);
  background: var(--wd-surface-hover);
}
.wd-icon-chip.wd-chip-danger {
  border-color: rgba(var(--wd-accent-rgb), .4);
  color: #ff7070;
}
.wd-icon-chip.wd-chip-danger:hover,
.wd-icon-chip.wd-chip-danger:focus {
  background: rgba(var(--wd-accent-rgb), .1);
  border-color: rgba(var(--wd-accent-rgb), .6);
  color: #ff7070;
}

/* ── KPI / stat tile accent bars ─────────────────────────────── */
/* Cards already clip (radius 15 + overflow hidden) so the bar hugs the edge */
.wd-tile { position: relative; }
.wd-tile::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--wd-tile-accent, var(--wd-border-strong));
}
.wd-tile-money::before { width: 4px; }
.wd-tile-success   { --wd-tile-accent: var(--wd-money); }
.wd-tile-warning   { --wd-tile-accent: #f59e0b; }
.wd-tile-danger    { --wd-tile-accent: var(--wd-accent); }
.wd-tile-info      { --wd-tile-accent: #3b82f6; }
.wd-tile-secondary { --wd-tile-accent: var(--wd-border-strong); }

/* ── Amber warning banner ────────────────────────────────────── */
.wd-banner-warning {
  background: rgba(245, 158, 11, .07) !important;
  border: 1px solid rgba(245, 158, 11, .30) !important;
}

/* ── Semantic TEXT variants (brighter on dark) ───────────────── */
.text-success { color: var(--wd-money) !important; }
.text-warning { color: var(--wd-amber-text) !important; }
.text-info    { color: var(--wd-blue-text) !important; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge.bg-primary { background-color: rgba(var(--wd-accent-rgb),.15) !important; color: var(--wd-accent) !important; }

/* Status pill spec: tinted bg + full-intensity text, radius 6, 11.5/600 */
.badge { font-weight: 600; }
.badge[class*="-subtle"] {
  border-radius: 6px;
  font-size: .72rem;
  padding: 3px 10px;
}

/* Neutral surface pill — academy codes, card-on-file chips */
.badge.bg-light {
  background-color: var(--wd-border) !important;
  border: 1px solid var(--wd-border-strong);
  color: var(--wd-text-soft) !important;
}

/* thead.table-light on dark */
.table-light {
  --bs-table-bg: var(--wd-bg-elevated);
  --bs-table-color: var(--wd-muted);
  --bs-table-border-color: var(--wd-border);
}

/* ── Page background ─────────────────────────────────────────── */
body {
  background-color: var(--wd-bg) !important;
}

/* ── Chrome dimensions — 230px sidebar / 64px topbar (redesign) ── */
/* Scoped to desktop expanded state; collapsed (sm) keeps theme's 70px. */
@media (min-width: 992px) {
  body:not([data-sidebar-size=sm]) .vertical-menu   { width: 230px; }
  body:not([data-sidebar-size=sm]) .navbar-brand-box { width: 230px; }
  body:not([data-sidebar-size=sm]) #page-topbar      { left: 230px; }
  body:not([data-sidebar-size=sm]) .main-content     { margin-left: 230px; }
}
.navbar-header { height: 64px; }
.header-item   { height: 64px; }
.main-content .content { margin-top: 64px; }
/* Brand box rides the same 64px grid (theme's .logo line-height is 70px) */
.navbar-brand-box { height: 64px; }
.navbar-brand-box .logo { line-height: 64px; }
@media (max-width: 992px) {
  .vertical-menu { top: 64px; }
}

/* Tabor system marks. The theme's existing .logo-dark/.logo-light rules
   choose the correct transparent asset when the staff color mode changes. */
.tabor-logo-horizontal {
  width: 164px;
  height: 34px;
  object-fit: contain;
}
.tabor-logo-stacked {
  width: 38px;
  height: 38px;
  object-fit: contain;
}
.navbar-brand-box .logo img { vertical-align: middle; }

/* Sidebar MDI nav icons (feather → MDI swap).
   Theme sizes .nav-icon for 16px SVGs (height:16px, top:-1px) — reset that
   so the 19px font glyph centers on the flex row instead of the baseline. */
#sidebar-menu .nav-icon.mdi {
  font-size: 19px;
  width: 22px;
  min-width: 22px;
  height: auto;
  top: 0;
  line-height: 1;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
}
/* Collapsed rail — hand sizing back to the theme (centered in 50px) */
body[data-sidebar-size=sm] #sidebar-menu .nav-icon.mdi {
  width: auto;
  min-width: 50px;
  margin-right: 0;
  font-size: 1.3rem;
}
/* Collapsed anchors: kill the expanded-mode side margins so the 50px icon
   box centers in the 70px rail (10 + 50 + 10) */
body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li > a {
  margin: 1px 0;
  padding: 15px 10px;
}

/* ── Sidebar — explicit overrides (beat theme's rules) ── */
.vertical-menu {
  background: var(--wd-bg) !important;
  border-right: 1px solid var(--wd-border) !important;
  border-color: var(--wd-border) !important;
}

/* Logo box */
.navbar-brand-box {
  background: var(--wd-bg) !important;
  border-right: 1px solid var(--wd-border) !important;
  border-bottom: 1px solid var(--wd-border) !important;
}

/* Section titles (MAIN / ADMIN) */
#sidebar-menu .menu-title {
  color: var(--wd-border-hover) !important;
  font-size: .65rem;
  letter-spacing: .08em;
  padding: 16px 20px 4px;
}

/* Default nav items */
#sidebar-menu ul li a {
  color: var(--wd-muted) !important;
  border-radius: 6px;
  margin: 1px 8px;
  padding: 8px 12px;
}
#sidebar-menu ul li a .nav-icon {
  color: var(--wd-muted-strong) !important;
}

/* Hover */
#sidebar-menu ul li a:hover {
  color: var(--wd-text-strong) !important;
  background-color: var(--wd-hover) !important;
}
#sidebar-menu ul li a:hover .nav-icon {
  color: var(--wd-text) !important;
}

/* Active item */
#sidebar-menu ul li.mm-active > a {
  background-color: rgba(var(--wd-accent-rgb), .12) !important;
  color: var(--wd-accent) !important;
}
#sidebar-menu ul li.mm-active > a .nav-icon {
  color: var(--wd-accent) !important;
}
#sidebar-menu ul li.mm-active {
  color: var(--wd-accent) !important;
}

/* Sub-menu */
#sidebar-menu ul li ul.sub-menu {
  background: transparent;
  padding-left: 8px;
}
#sidebar-menu ul li ul.sub-menu li a {
  color: var(--wd-muted-subtle) !important;
  margin: 1px 0 !important;
  padding: 6px 12px !important;
}
#sidebar-menu ul li ul.sub-menu li a:before {
  display: none !important;
}
#sidebar-menu ul li ul.sub-menu li a:hover {
  color: var(--wd-text-strong) !important;
  background-color: var(--wd-hover) !important;
}
#sidebar-menu ul li.mm-active .mm-show .mm-active > a {
  color: var(--wd-accent) !important;
}
#sidebar-menu ul li.mm-active .mm-show .mm-active > a:before {
  background-color: var(--wd-accent) !important;
  border-color: var(--wd-accent) !important;
}

/* Collapsed sidebar hover (hardcoded in theme — override it).
   The flyout floats over page content, so the tint is layered on a solid
   base — a bare rgba() bg lets the page bleed through and kills contrast. */
body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li:hover > a {
  background: linear-gradient(rgba(var(--wd-accent-rgb), .12), rgba(var(--wd-accent-rgb), .12)), var(--wd-bg) !important;
  color: var(--wd-accent) !important;
}
/* Collapsed sub-menu flyout (e.g. Billing) — solid panel, not transparent */
body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li:hover > ul.sub-menu {
  background: var(--wd-bg-elevated) !important;
  border: 1px solid var(--wd-border-strong);
  border-radius: 0 8px 8px 0;
}

/* ── Topbar ───────────────────────────────────────────────────── */
#page-topbar {
  background-color: var(--wd-bg) !important;
  border-bottom: 1px solid var(--wd-border) !important;
  box-shadow: none !important;
}
.header-item {
  color: var(--wd-muted) !important;
}
.header-item:hover {
  color: var(--wd-text-strong) !important;
}

/* Location chip */
.wd-topbar-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--wd-border-strong);
  border-radius: 8px;
  color: var(--wd-text);
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.2;
  transition: border-color .15s, background .15s;
}
.wd-topbar-chip .mdi { font-size: 16px; color: var(--wd-muted); }
.wd-topbar-chip .wd-chip-chevron { font-size: 15px; color: var(--wd-muted-subtle); }
.wd-topbar-chip-btn { background: transparent; border: 0; }
.wd-topbar-chip-btn:hover .wd-topbar-chip {
  border-color: var(--wd-border-hover);
  background: var(--wd-surface-hover);
}

/* User block — name + role stacked, right-aligned */
.header-item.user .user-item-desc {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.25;
}
.header-item.user .user-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--wd-text-strong);
}
.header-item.user .user-sub-title {
  font-size: 11.5px;
  color: var(--wd-muted);
}

/* ── Sidebar logo box border ─────────────────────────────────── */
.navbar-brand-box {
  border-right: 1px solid var(--wd-border);
}

/* ── MDI icons — brand accent ────────────────────────────────── */
.mdi_bar { color: var(--wd-accent); }

/* ── Filter bar inputs & selects ─────────────────────────────── */
.filter-input-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.filter-input-icon {
  position: absolute;
  left: 10px;
  color: var(--wd-muted-strong);
  font-size: .95rem;
  pointer-events: none;
}
.filter-input {
  background: var(--wd-border);
  border: 1px solid var(--wd-border-strong);
  border-radius: 8px;
  color: var(--wd-text);
  font-size: .8rem;
  height: 34px;
  padding: 0 12px 0 32px;
  width: 220px;
  outline: none;
  transition: border-color .15s;
}
.filter-input::placeholder { color: var(--wd-muted-strong); }
.filter-input:focus {
  border-color: var(--wd-accent);
  box-shadow: 0 0 0 3px rgba(var(--wd-accent-rgb),.1);
}

.filter-select {
  background: var(--wd-border);
  border: 1px solid var(--wd-border-strong);
  border-radius: 8px;
  color: var(--wd-text);
  font-size: .8rem;
  height: 34px;
  padding: 0 28px 0 12px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%23838387' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color .15s;
}
.filter-select:focus {
  border-color: var(--wd-accent);
  box-shadow: 0 0 0 3px rgba(var(--wd-accent-rgb),.1);
}
.filter-select option {
  background: var(--wd-bg-elevated);
  color: var(--wd-text);
}

/* ── View toggle (Kanban / List pill) ────────────────────────── */
.view-toggle-group {
  display: inline-flex;
  background: var(--wd-border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.view-toggle-btn {
  border: none;
  background: transparent;
  color: var(--wd-muted);
  font-size: .8rem;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s;
  line-height: 1.4;
}
.view-toggle-btn:hover {
  color: var(--wd-text-strong);
  background: var(--wd-border-strong);
}
.view-toggle-btn.active {
  background: var(--wd-accent);
  color: #fff;
}

/* ── Kanban board ────────────────────────────────────────────── */
.kboard-col {
  background: var(--wd-bg-elevated);
  border-radius: 12px;
  border: 1px solid var(--wd-border);
  height: 100%;
  display: flex;
  flex-direction: column;
}
.kboard-col-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--wd-border);
  flex-shrink: 0;
}
.kboard-col-title  { font-size: .85rem; color: var(--wd-text-strong); }
.kboard-col-count  { font-size: .75rem; color: var(--wd-muted); font-weight: 500; }
.kboard-add-btn    { color: var(--wd-muted); text-decoration: none; font-size: 1.1rem; line-height: 1; }
.kboard-add-btn:hover { color: var(--wd-text-strong); }
.kboard-cards-area { padding: 10px; flex: 1; max-height: 65vh; }

/* Stage dot */
.kdot          { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.kdot-default  { background: var(--wd-accent); }
.kdot-won      { background: #22c55e; }
.kdot-lost     { background: #ef4444; }

/* Lead card */
.kcard {
  background: var(--wd-bg);
  border: 1px solid var(--wd-border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.kcard:hover {
  border-color: var(--wd-border-strong);
  box-shadow: 0 4px 12px var(--wd-shadow-hover);
}
.kcard-name   { font-size: .85rem; color: var(--wd-text-strong); }
.kcard-source { font-size: .7rem; color: var(--wd-muted-strong); margin-top: 1px; }

/* Avatar */
.kavatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.kavatar-0 { background: var(--wd-accent); }
.kavatar-1 { background: #3b82f6; }
.kavatar-2 { background: #22c55e; }
.kavatar-3 { background: #f59e0b; }
.kavatar-4 { background: #a855f7; }
.kavatar-5 { background: #14b8a6; }

/* Temperature badge */
.ktemp-badge {
  font-size: .65rem; padding: 2px 7px; border-radius: 20px;
  font-weight: 600; flex-shrink: 0;
}
.ktemp-hot  { background: rgba(239,68,68,.15);  color: #ef4444; }
.ktemp-warm { background: rgba(245,158,11,.15); color: #f59e0b; }
.ktemp-cool { background: rgba(59,130,246,.15); color: #3b82f6; }

/* Card dividers */
.kcard-divider {
  border-top: 1px solid var(--wd-border);
  padding-top: 8px;
  margin-bottom: 8px;
}
.kcard-footer {
  border-top: 1px solid var(--wd-border);
  padding-top: 8px;
}
.kcard-meta   { font-size: .75rem; color: var(--wd-muted); }
.kcard-detail { font-size: .72rem; color: #3b82f6; margin-top: 3px; }
.kcard-date   { font-size: .7rem; color: var(--wd-muted-strong); }
.kcard-advisor{ font-size: .68rem; color: var(--wd-muted-strong); }

/* ── Lead show — tabs ────────────────────────────────────────── */
.lead-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--wd-muted);
  font-size: .82rem;
  font-weight: 500;
  padding: 12px 16px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.lead-tab:hover { color: var(--wd-text-strong); }
.lead-tab.active { color: var(--wd-accent); border-bottom-color: var(--wd-accent); }
.lead-tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(var(--wd-accent-rgb),.15); color: var(--wd-accent);
  font-size: .65rem; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%;
  margin-left: 5px;
}

/* ── Lead show — detail rows ─────────────────────────────────── */
.lead-detail-row {
  display: flex; align-items: center; gap: 9px;
  font-size: .9rem; color: var(--wd-text-soft);
  padding: 7px 0;
  border-bottom: 1px solid var(--wd-border);
}
.lead-detail-row:last-child { border-bottom: none; }
.lead-detail-row .mdi { color: var(--wd-muted-subtle); font-size: 1rem; flex-shrink: 0; }
.lead-detail-row strong { color: var(--wd-text); }

/* ── Lead show — activity timeline ──────────────────────────── */
.act-row { border-bottom: 1px solid var(--wd-border); }
.act-row:last-child { border-bottom: none; margin-bottom: 0 !important; padding-bottom: 0 !important; }

.act-icon-lg { width: 34px; height: 34px; font-size: .9rem; }

.act-stage   { background: rgba(var(--wd-accent-rgb),.12);  color: var(--wd-accent); }
.act-call    { background: rgba(34,197,94,.12);  color: #22c55e; }
.act-sms     { background: rgba(59,130,246,.12); color: #3b82f6; }
.act-whatsapp{ background: rgba(34,197,94,.12);  color: #22c55e; }
.act-email   { background: rgba(245,158,11,.12); color: #f59e0b; }
.act-note    { background: rgba(131,131,135,.12);color: var(--wd-muted); }

/* ── Action menu (lead show page) ───────────────────────────── */
.action-group { display: flex; flex-direction: column; }

.action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  color: var(--wd-text);
  transition: background .12s;
}
.action-btn:hover { background: var(--wd-hover); color: var(--wd-text-strong); }

.action-icon {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: .9rem;
}
.action-icon .mdi { color: inherit; }

.action-label { flex: 1; font-size: .82rem; font-weight: 500; }

.action-chevron { font-size: .8rem; color: var(--wd-border-hover); }
.action-btn:hover .action-chevron { color: var(--wd-muted-strong); }

.action-divider {
  height: 1px; background: var(--wd-border);
  margin: 6px 4px;
}

/* ── DataTables ──────────────────────────────────────────────── */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  background-color: var(--wd-border);
  border-color: var(--wd-border-strong);
  color: var(--wd-text);
}
.page-item .page-link {
  background-color: var(--wd-card);
  border-color: var(--wd-border);
  color: var(--wd-text);
}
.page-item.active .page-link {
  background-color: var(--wd-accent);
  border-color: var(--wd-accent);
}

.card {
  border-radius: 15px !important;
  overflow: hidden;
}

/* ── Lead chat / messages tab ───────────────────────────────── */
#panelMessages { display: flex; }
#chatWindow { scrollbar-width: thin; scrollbar-color: var(--wd-border-strong) transparent; }

.chat-bubble {
  max-width: 72%;
  padding: 9px 14px;
  border-radius: 16px;
  font-size: .9rem;
  line-height: 1.45;
  word-break: break-word;
}
.chat-out {
  background: #1d4ed8;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-in {
  background: var(--wd-border);
  color: var(--wd-text);
  border: 1px solid var(--wd-border-strong);
  border-bottom-left-radius: 4px;
}
/* ── Trial booking — schedule slot buttons ───────────────────── */
.slot-btn {
  background: var(--wd-bg-elevated);
  border: 1px solid var(--wd-border-strong);
  border-radius: 8px;
  color: var(--wd-text-strong);
  font-size: .82rem;
  font-weight: 500;
  padding: 8px 14px;
  text-align: center;
  line-height: 1.3;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.slot-btn:hover { border-color: var(--wd-accent); background: rgba(var(--wd-accent-rgb),.06); }
.slot-btn-active {
  border-color: var(--wd-accent);
  background: rgba(var(--wd-accent-rgb),.12);
  color: var(--wd-accent);
}

.chat-meta {
  font-size: .7rem;
  color: var(--wd-muted-strong);
  margin-top: 3px;
  padding: 0 4px;
}

/* ── Communications Inbox ─────────────────────────────────── */
.msg-shell {
  --msg-bg: var(--wd-bg);
  --msg-panel: var(--wd-card);
  --msg-panel-2: var(--wd-bg);
  --msg-line: var(--wd-border-translucent);
  --msg-muted: var(--wd-muted);
  --msg-text: var(--wd-text-strong);
  --msg-accent: #ef6a5f;
  --msg-blue: #3652d8;
  height: calc(100vh - 112px);
  max-height: calc(100vh - 112px);
  min-height: 540px;
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  background: var(--msg-bg);
  border: 1px solid var(--msg-line);
  border-radius: 8px;
}
.msg-list-pane {
  background: var(--wd-bg);
  border-right: 1px solid var(--msg-line);
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.msg-list-head {
  padding: 16px;
  border-bottom: 1px solid var(--msg-line);
}
.msg-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.msg-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--msg-text);
}
.msg-brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--msg-accent);
  color: #fff;
}
.msg-search {
  display: flex;
  gap: 8px;
  align-items: center;
}
.msg-search-field {
  position: relative;
  flex: 1;
}
.msg-search-field i {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--wd-muted-strong);
  font-size: 17px;
}
.msg-search input {
  width: 100%;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--wd-border-strong);
  background: var(--wd-bg-elevated);
  color: var(--msg-text);
  padding: 0 12px 0 38px;
  outline: none;
}
.msg-search input:focus {
  border-color: rgba(239,106,95,.55);
  box-shadow: 0 0 0 3px rgba(239,106,95,.12);
}
.msg-new-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--msg-accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.msg-tabs {
  display: flex;
  gap: 8px;
  padding-top: 14px;
}
.msg-tab {
  border: 0;
  border-radius: 999px;
  background: var(--wd-card);
  color: var(--msg-muted);
  padding: 7px 14px;
  font-size: .83rem;
  font-weight: 700;
}
.msg-tab.active {
  background: rgba(239,106,95,.18);
  color: #ff8b81;
}
.msg-filter-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px 8px;
}
.msg-filter {
  border: 1px solid transparent;
  background: transparent;
  color: var(--msg-muted);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: .76rem;
  font-weight: 700;
}
.msg-filter.active {
  background: var(--wd-hover);
  color: var(--msg-text);
  border-color: var(--wd-border-strong);
}
.msg-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 12px;
  min-height: 0;
}
.msg-row-btn {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  text-align: left;
}
.msg-row-btn:hover,
.msg-row-btn.active {
  background: rgba(239,106,95,.16);
}
.msg-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0;
  position: relative;
  flex-shrink: 0;
}
.msg-avatar::after {
  content: "";
  width: 9px;
  height: 9px;
  background: #68d36a;
  border: 2px solid var(--wd-bg);
  border-radius: 50%;
  position: absolute;
  right: 1px;
  bottom: 3px;
}
.msg-row-name {
  color: var(--msg-text);
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-row-preview {
  color: var(--msg-muted);
  font-size: .82rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.msg-kind {
  display: inline-flex;
  align-items: center;
  height: 18px;
  border-radius: 999px;
  padding: 0 7px;
  font-size: .66rem;
  font-weight: 900;
  text-transform: uppercase;
  margin-left: 6px;
  vertical-align: 1px;
}
.msg-kind.lead { color: #ffb2aa; background: rgba(239,106,95,.18); }
.msg-kind.member { color: #8ee8b0; background: rgba(34,197,94,.15); }
.msg-row-meta {
  color: var(--wd-muted);
  font-size: .75rem;
  text-align: right;
  white-space: nowrap;
}
.msg-empty {
  color: var(--msg-muted);
  padding: 34px 18px;
  text-align: center;
  font-size: .9rem;
}
.msg-chat-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle, var(--wd-surface-subtle) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--wd-bg);
}
.msg-chat-head {
  height: 64px;
  background: var(--wd-card);
  border-bottom: 1px solid var(--msg-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
}
.msg-head-person {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.msg-head-title {
  color: var(--msg-text);
  font-weight: 900;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-head-sub {
  color: #68d36a;
  font-size: .78rem;
  font-weight: 700;
  margin-top: 2px;
}
.msg-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.msg-handle-btn {
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--wd-border-strong);
  background: transparent;
  color: var(--wd-text);
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  font-weight: 800;
}
.msg-handle-btn:hover {
  background: var(--wd-hover);
  color: var(--msg-text);
}
.msg-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--wd-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.msg-icon-btn:hover {
  background: var(--wd-hover);
  color: var(--msg-text);
}
.msg-thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg-date-pill {
  align-self: center;
  border-radius: 999px;
  background: var(--wd-surface-hover);
  color: var(--wd-muted);
  padding: 5px 12px;
  font-size: .75rem;
  font-weight: 800;
  margin: 4px 0 12px;
}
.msg-bubble-row {
  display: flex;
  flex-direction: column;
  max-width: min(420px, 74%);
}
.msg-bubble-row.outbound {
  align-self: flex-end;
  align-items: flex-end;
}
.msg-bubble-row.inbound {
  align-self: flex-start;
  align-items: flex-start;
}
.msg-bubble {
  border-radius: 8px;
  padding: 11px 13px;
  color: #f7f8fb;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 8px 24px rgba(0,0,0,.16);
}
.msg-bubble-row.outbound .msg-bubble {
  background: var(--msg-blue);
  border-bottom-right-radius: 3px;
}
.msg-bubble-row.inbound .msg-bubble {
  background: var(--wd-bg-elevated);
  color: var(--wd-text);
  border-bottom-left-radius: 3px;
}
.msg-bubble-meta {
  color: var(--wd-muted);
  font-size: .72rem;
  margin-top: 4px;
}
.msg-compose {
  min-height: 68px;
  flex-shrink: 0;
  border-top: 1px solid var(--msg-line);
  background: var(--wd-card);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
}
.msg-compose textarea {
  flex: 1;
  min-height: 42px;
  max-height: 110px;
  resize: none;
  border-radius: 999px;
  border: 1px solid var(--wd-border-strong);
  background: var(--wd-bg-elevated);
  color: var(--msg-text);
  padding: 11px 16px;
  outline: none;
}
.msg-compose textarea:focus {
  border-color: rgba(54,82,216,.7);
  box-shadow: 0 0 0 3px rgba(54,82,216,.14);
}
.msg-send {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--wd-border-strong);
  color: var(--wd-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}
.msg-send.ready {
  background: var(--msg-blue);
  color: #fff;
}
.msg-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--msg-muted);
  text-align: center;
  padding: 24px;
}
.msg-mobile-back { display: none; }
@media (max-width: 991.98px) {
  .msg-shell {
    height: calc(100vh - 96px);
    max-height: calc(100vh - 96px);
    min-height: 520px;
    grid-template-columns: 1fr;
  }
  .msg-shell.has-active .msg-list-pane { display: none; }
  .msg-shell:not(.has-active) .msg-chat-pane { display: none; }
  .msg-mobile-back { display: inline-flex; }
}
