/*
 * Fusion 360 CRM — Modern UI Theme
 * Inspired by Dwellio's warm, clean aesthetic
 *
 * Features:
 * - Narrow icon sidebar (70px collapsed, 230px expanded on hover)
 * - Warm cream/beige background
 * - Lime/chartreuse accent color
 * - Softer shadows and rounded corners
 * - Cleaner typography and spacing
 */

/* ============================================================
   CSS VARIABLES
   ============================================================ */
:root {
  --sidebar-width: 70px;
  --sidebar-expanded: 240px;
  --header-height: 60px;
  --bg-base: #f5f1eb;
  --bg-card: #ffffff;
  --bg-sidebar: #faf8f5;
  --accent: #e11d48;
  --accent-dark: #be123c;
  --accent-soft: #ffe4e6;
  --text-primary: #1a1a1a;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border-color: #e8e4de;
  --border-light: #f0ece6;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

/* ============================================================
   GLOBAL / BODY
   ============================================================ */
body {
  background: var(--bg-base) !important;
  color: var(--text-primary) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--accent);
  color: var(--text-primary);
}

/* ============================================================
   SIDEBAR — Narrow Icon Mode (full height, overlaps logo)
   ============================================================ */
.sidebar:not(#setup-menu-wrapper) {
  width: var(--sidebar-width) !important;
  background: var(--bg-sidebar) !important;
  border-right: 1px solid var(--border-light) !important;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  z-index: 1001 !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  height: 100vh !important;
}

/* slimScroll bars hidden — JS removes the wrapper entirely */
.sidebar:not(#setup-menu-wrapper) .slimScrollBar,
.sidebar:not(#setup-menu-wrapper) .slimScrollRail {
  display: none !important;
}

.sidebar:not(#setup-menu-wrapper):hover {
  width: var(--sidebar-expanded) !important;
  box-shadow: var(--shadow-lg) !important;
}

/* Wrapper adjusts to narrow sidebar */
#wrapper {
  margin-left: var(--sidebar-width) !important;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

[dir="rtl"] #wrapper {
  margin-left: 0 !important;
  margin-right: var(--sidebar-width) !important;
  transition: margin-right 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Hide sidebar body state override */
body.hide-sidebar .sidebar {
  width: 0 !important;
}
body.hide-sidebar #wrapper {
  margin-left: 0 !important;
}

/* Sidebar user profile — aligned with header/logo height */
.sidebar-user-profile {
  margin-top: 0 !important;
  padding: 0 8px !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  height: var(--header-height) !important;
  display: flex !important;
  align-items: center !important;
  flex-shrink: 0 !important;
  border-bottom: 1px solid var(--border-light) !important;
}

.sidebar .dropdown.sidebar-user-profile > a.profile {
  padding: 6px !important;
  border-radius: var(--radius-md) !important;
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  justify-content: center !important;
}

.sidebar:not(:hover) .sidebar-user-profile > a.profile span > span {
  display: none !important;
}

.sidebar:not(:hover) .sidebar-user-profile > a.profile > span {
  gap: 0 !important;
  justify-content: center !important;
}

/* Menu items — icon-only when collapsed */
#side-menu {
  padding: 8px 6px !important;
  margin-top: 0 !important;
}

#side-menu > li > a {
  padding: 8px 12px !important;
  border-radius: var(--radius-sm) !important;
  margin-bottom: 1px !important;
  transition: all 0.15s ease !important;
  color: var(--text-secondary) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  font-size: 13px !important;
}

#side-menu > li > a:hover,
#side-menu > li > a:focus {
  background: rgba(0, 0, 0, 0.04) !important;
  color: var(--text-primary) !important;
}

#side-menu > li.active > a,
#side-menu > li.active > a:first-child {
  background: var(--text-primary) !important;
  color: #ffffff !important;
  box-shadow: var(--shadow-sm) !important;
}

#side-menu > li.active > a .menu-icon,
#side-menu > li.active > a:hover .menu-icon {
  color: #ffffff !important;
}

/* Menu icons — always visible, centered when collapsed */
.menu-icon {
  width: 20px !important;
  text-align: center !important;
  font-size: 15px !important;
  flex-shrink: 0 !important;
  margin-right: 12px !important;
  transition: color 0.15s ease !important;
}

/* Hide text labels when sidebar collapsed */
.sidebar:not(:hover) .menu-text,
.sidebar:not(:hover) .sub-menu-text,
.sidebar:not(:hover) .fa.arrow,
.sidebar:not(:hover) #side-menu .badge,
.sidebar:not(:hover) .nav-second-level,
.sidebar:not(:hover) #setup-menu-item .menu-text,
.sidebar:not(:hover) #setup-menu-item span.badge {
  display: none !important;
}

.sidebar:not(:hover) #side-menu > li > a {
  text-align: center !important;
  padding: 10px 0 !important;
  display: flex !important;
  justify-content: center !important;
}

.sidebar:not(:hover) .menu-icon {
  margin-right: 0 !important;
}

/* Submenu styling */
.nav-second-level {
  background: rgba(0, 0, 0, 0.02) !important;
  border-radius: var(--radius-sm) !important;
  margin: 0 4px 4px !important;
  padding: 4px !important;
}

.nav-second-level > li > a {
  padding: 5px 12px 5px 38px !important;
  border-radius: 6px !important;
  color: var(--text-secondary) !important;
  font-size: 12px !important;
}

.nav-second-level > li > a:hover {
  background: rgba(0, 0, 0, 0.04) !important;
  color: var(--text-primary) !important;
}

/* ============================================================
   HEADER
   ============================================================ */
#header {
  height: var(--header-height) !important;
  background: var(--bg-base) !important;
  border-bottom: 1px solid var(--border-light) !important;
  box-shadow: none !important;
  padding: 0 !important;
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  left: var(--sidebar-width) !important;
  z-index: 999 !important;
}

#header nav {
  padding: 0 24px !important;
}

/* Logo — show in header, to the right of sidebar */
#logo {
  height: var(--header-height) !important;
  margin-left: 0 !important;
  display: flex !important;
  align-items: center !important;
}

#logo img {
  max-height: 40px !important;
}

/* Header positioning handled above via position:fixed + left */

[dir="rtl"] #header {
  left: 0 !important;
  right: var(--sidebar-width) !important;
}

body.hide-sidebar #header {
  left: 0 !important;
}

/* Hide menu toggle — sidebar auto-expands on hover */
.hide-menu {
  display: none !important;
}

/* Search bar */
#search_input {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-lg) !important;
  height: 42px !important;
  font-size: 14px !important;
  padding-left: 40px !important;
  transition: all 0.2s ease !important;
  margin-top: 9px !important;
}

#search_input:focus {
  border-color: var(--text-primary) !important;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05) !important;
  background: var(--bg-card) !important;
}

/* Quick action button — lime accent */
.nav.navbar-nav .tw-bg-primary-600 {
  background: var(--accent) !important;
  color: var(--text-primary) !important;
}

.nav.navbar-nav .tw-bg-primary-600:hover,
.nav.navbar-nav .group-hover\:tw-bg-primary-700 {
  background: var(--accent-dark) !important;
}

/* Notification icons */
.navbar-nav > li.icon > a {
  color: var(--text-secondary) !important;
}

.navbar-nav > li.icon > a:hover {
  color: var(--text-primary) !important;
}

/* Settings link in header */
.navbar-nav.navbar-right > li > a {
  font-size: 13px !important;
  color: var(--text-secondary) !important;
  font-weight: 500 !important;
}

.navbar-nav.navbar-right > li > a:hover {
  color: var(--text-primary) !important;
}

/* ============================================================
   CONTENT AREA
   ============================================================ */
.content {
  padding: 20px 28px !important;
  margin-top: var(--header-height) !important;
}

/* ============================================================
   CARDS / PANELS
   ============================================================ */
.panel_s,
.panel-default,
.panel {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-sm) !important;
  overflow: visible !important;
}

.panel_s .panel-body {
  padding: 20px 24px !important;
}

.panel_s .panel-heading {
  border-bottom: 1px solid var(--border-light) !important;
  padding: 16px 24px !important;
  background: transparent !important;
}

.panel_s .panel-heading h4,
.panel_s .panel-heading .panel-title {
  font-weight: 600 !important;
  font-size: 15px !important;
  color: var(--text-primary) !important;
}

/* ============================================================
   DASHBOARD STAT WIDGETS
   ============================================================ */
.widget {
  border-radius: var(--radius-lg) !important;
  overflow: hidden !important;
}

/* First stat card — accent */
.row > [data-container="top-12"] .widget:first-child .panel_s,
.row > [data-container="top-12"] .col-md-3:first-child .panel_s {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
}

.row > [data-container="top-12"] .widget:first-child .panel_s .text-muted,
.row > [data-container="top-12"] .col-md-3:first-child .panel_s .text-muted {
  color: rgba(255, 255, 255, 0.7) !important;
}

.row > [data-container="top-12"] .widget:first-child .panel_s h3,
.row > [data-container="top-12"] .col-md-3:first-child .panel_s h3,
.row > [data-container="top-12"] .widget:first-child .panel_s a,
.row > [data-container="top-12"] .col-md-3:first-child .panel_s a {
  color: #ffffff !important;
  font-weight: 700 !important;
}

/* Second stat card — soft rose */
.row > [data-container="top-12"] .col-md-3:nth-child(2) .panel_s {
  background: #fce4ec !important;
  border-color: #fce4ec !important;
}

/* Third stat card — soft blue */
.row > [data-container="top-12"] .col-md-3:nth-child(3) .panel_s {
  background: #e3f2fd !important;
  border-color: #e3f2fd !important;
}

/* Fourth stat card — soft green */
.row > [data-container="top-12"] .col-md-3:nth-child(4) .panel_s {
  background: #ecfdf5 !important;
  border-color: #ecfdf5 !important;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  border-radius: var(--radius-sm) !important;
  font-weight: 500 !important;
  font-size: 13px !important;
  transition: all 0.15s ease !important;
  border: none !important;
  padding: 8px 16px !important;
}

.btn-primary,
.btn-info {
  background: var(--text-primary) !important;
  color: #ffffff !important;
  box-shadow: var(--shadow-sm) !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-info:hover,
.btn-info:focus {
  background: #333333 !important;
  box-shadow: var(--shadow-md) !important;
}

.btn-success {
  background: var(--accent) !important;
  color: #ffffff !important;
}

.btn-success:hover,
.btn-success:focus {
  background: var(--accent-dark) !important;
  color: #ffffff !important;
}

.btn-default,
.btn-secondary {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
}

.btn-default:hover,
.btn-default:focus {
  background: #f9f9f9 !important;
  border-color: var(--text-muted) !important;
}

.btn-danger {
  background: #ef4444 !important;
  color: #ffffff !important;
}

.btn-warning {
  background: #f59e0b !important;
  color: #ffffff !important;
}

/* Button groups — no jagged corners */
.btn-group .btn {
  border-radius: 0 !important;
}
.btn-group .btn:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important;
}
.btn-group .btn:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
}

/* ============================================================
   TABLES
   ============================================================ */
.table > thead > tr > th {
  background: var(--bg-base) !important;
  border-bottom: 1px solid var(--border-color) !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.03em !important;
  color: var(--text-secondary) !important;
  padding: 10px 14px !important;
}

.table > tbody > tr > td {
  border-bottom: 1px solid var(--border-light) !important;
  padding: 12px 14px !important;
  vertical-align: middle !important;
  font-size: 13.5px !important;
  color: var(--text-primary) !important;
  border-top: none !important;
}

.table > tbody > tr:hover > td {
  background: rgba(0, 0, 0, 0.015) !important;
}

.table > tbody > tr:last-child > td {
  border-bottom: none !important;
}

/* DataTables wrapper */
.dataTables_wrapper {
  padding: 0 !important;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  padding: 12px 0 !important;
}

.dataTables_wrapper .dataTables_filter input {
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--border-color) !important;
  padding: 6px 12px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: var(--radius-sm) !important;
  margin: 0 2px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--text-primary) !important;
  color: #ffffff !important;
  border-color: var(--text-primary) !important;
}

/* Filter row pills above tables */
._filters,
.filters-area,
.table-filters {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  padding: 12px 0 !important;
}

._filters select,
._filters input,
.filters-area select,
.filters-area input {
  border-radius: var(--radius-lg) !important;
  border: 1px solid var(--border-color) !important;
  background: var(--bg-card) !important;
  padding: 6px 14px !important;
  font-size: 13px !important;
  height: auto !important;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-control {
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--border-color) !important;
  padding: 9px 14px !important;
  font-size: 14px !important;
  color: var(--text-primary) !important;
  background: var(--bg-card) !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
  height: auto !important;
  box-shadow: none !important;
}

.form-control:focus {
  border-color: var(--text-primary) !important;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06) !important;
}

.form-group label,
label.control-label {
  font-weight: 500 !important;
  font-size: 13px !important;
  color: var(--text-secondary) !important;
  margin-bottom: 6px !important;
}

select.form-control {
  -webkit-appearance: none !important;
  appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 20px !important;
  padding-right: 36px !important;
}

textarea.form-control {
  min-height: 80px !important;
}

/* Fix all select elements — ensure text is visible */
select,
select option {
  color: var(--text-primary) !important;
}

/* Bootstrap Select plugin — fix invisible text (high specificity) */
body .content .bootstrap-select > .btn.dropdown-toggle,
body .content .bootstrap-select > button.btn,
body .panel_s .bootstrap-select > .btn.dropdown-toggle,
body .bootstrap-select > .btn.dropdown-toggle {
  color: var(--text-primary) !important;
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  font-size: 13px !important;
  box-shadow: none !important;
  padding: 4px 24px 4px 10px !important;
  line-height: 1.5 !important;
  height: auto !important;
  min-height: 30px !important;
}

body .bootstrap-select .btn .filter-option,
body .bootstrap-select .filter-option {
  overflow: visible !important;
  height: auto !important;
  position: static !important;
}

body .bootstrap-select .btn .filter-option-inner,
body .bootstrap-select .btn .filter-option-inner-inner,
body .bootstrap-select .filter-option-inner,
body .bootstrap-select .filter-option-inner-inner {
  color: var(--text-primary) !important;
  overflow: visible !important;
  height: auto !important;
}

.bootstrap-select .dropdown-menu li a {
  color: var(--text-primary) !important;
}

.bootstrap-select .dropdown-menu li.selected a,
.bootstrap-select .dropdown-menu li a:hover {
  background: rgba(0, 0, 0, 0.04) !important;
  color: var(--text-primary) !important;
}

/* Selectpicker caret */
.bootstrap-select .bs-caret,
.bootstrap-select .caret {
  color: var(--text-secondary) !important;
}

/* ============================================================
   BADGES & STATUS PILLS
   ============================================================ */
.badge,
.label {
  border-radius: 20px !important;
  padding: 4px 10px !important;
  font-weight: 500 !important;
  font-size: 12px !important;
  letter-spacing: 0.01em !important;
}

.bg-success,
.badge-success,
.label-success {
  background-color: #dcfce7 !important;
  color: #166534 !important;
}

.bg-info,
.badge-info,
.label-info {
  background-color: #dbeafe !important;
  color: #1d4ed8 !important;
}

.bg-warning,
.badge-warning,
.label-warning {
  background-color: #fef3c7 !important;
  color: #92400e !important;
}

.bg-danger,
.badge-danger,
.label-danger {
  background-color: #fee2e2 !important;
  color: #dc2626 !important;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-content {
  border-radius: var(--radius-lg) !important;
  border: none !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15) !important;
  overflow: visible !important;
}

.modal-header {
  border-bottom: 1px solid var(--border-light) !important;
  padding: 18px 24px !important;
}

.modal-header h4 {
  font-weight: 600 !important;
  font-size: 16px !important;
}

.modal-body {
  padding: 24px !important;
  overflow: visible !important;
}

/* Ensure dropdowns inside modals are not clipped */
.modal .bootstrap-select .dropdown-menu,
.modal .select2-container--open .select2-dropdown {
  z-index: 10060 !important;
}

.modal-footer {
  border-top: 1px solid var(--border-light) !important;
  padding: 16px 24px !important;
  background: #fafaf8 !important;
}

/* ============================================================
   DROPDOWN MENUS
   ============================================================ */
.dropdown-menu {
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--border-light) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 6px !important;
  margin-top: 4px !important;
}

.dropdown-menu > li > a {
  padding: 8px 14px !important;
  border-radius: 6px !important;
  font-size: 13px !important;
  color: var(--text-primary) !important;
  transition: background 0.1s ease !important;
}

.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
  background: rgba(0, 0, 0, 0.04) !important;
  color: var(--text-primary) !important;
}

.dropdown-header {
  font-size: 11px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  color: var(--text-muted) !important;
  padding: 8px 14px 4px !important;
  font-weight: 600 !important;
}

/* ============================================================
   TABS
   ============================================================ */
.nav-tabs {
  border-bottom: 1px solid var(--border-light) !important;
}

.nav-tabs > li > a {
  border: none !important;
  border-radius: 0 !important;
  color: var(--text-secondary) !important;
  font-weight: 500 !important;
  font-size: 13.5px !important;
  padding: 10px 16px !important;
  border-bottom: 2px solid transparent !important;
  transition: all 0.15s ease !important;
  margin: 0 !important;
}

.nav-tabs > li > a:hover {
  background: transparent !important;
  color: var(--text-primary) !important;
  border-color: transparent !important;
  border-bottom-color: var(--text-muted) !important;
}

.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
  color: var(--text-primary) !important;
  font-weight: 600 !important;
  background: transparent !important;
  border: none !important;
  border-bottom: 2px solid var(--text-primary) !important;
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  border-radius: var(--radius-md) !important;
  border: none !important;
  padding: 14px 18px !important;
  font-size: 13.5px !important;
}

.alert-success {
  background: var(--accent-soft) !important;
  color: #365314 !important;
}

.alert-info {
  background: #eff6ff !important;
  color: #1e40af !important;
}

.alert-warning {
  background: #fffbeb !important;
  color: #92400e !important;
}

.alert-danger {
  background: #fef2f2 !important;
  color: #991b1b !important;
}

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress {
  border-radius: 20px !important;
  height: 6px !important;
  background: var(--border-light) !important;
  box-shadow: none !important;
  overflow: hidden !important;
}

.progress-bar {
  border-radius: 20px !important;
}

.progress-bar-success {
  background: #22c55e !important;
}

.progress-bar-info {
  background: var(--text-primary) !important;
}

/* ============================================================
   TASK / KANBAN VIEWS
   ============================================================ */
.kan-ban-col {
  background: var(--bg-base) !important;
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--border-light) !important;
}

.kan-ban-col .panel_s {
  border-radius: var(--radius-sm) !important;
  margin-bottom: 8px !important;
}

/* ============================================================
   TOOLTIPS
   ============================================================ */
.tooltip-inner {
  background: var(--text-primary) !important;
  border-radius: 6px !important;
  font-size: 12px !important;
  padding: 6px 10px !important;
}

.tooltip.top .tooltip-arrow {
  border-top-color: var(--text-primary) !important;
}
.tooltip.bottom .tooltip-arrow {
  border-bottom-color: var(--text-primary) !important;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* ============================================================
   SETUP/CUSTOMIZER PANEL
   ============================================================ */
#setup-menu-wrapper {
  background: var(--bg-card) !important;
  border-left: 1px solid var(--border-light) !important;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.08) !important;
}

/* ============================================================
   BREADCRUMBS
   ============================================================ */
.breadcrumb {
  background: transparent !important;
  padding: 0 !important;
  font-size: 13px !important;
}

.breadcrumb > li + li::before {
  color: var(--text-muted) !important;
}

/* ============================================================
   SCREEN OPTIONS
   ============================================================ */
.screen-options-btn {
  border-radius: var(--radius-sm) !important;
  background: var(--bg-card) !important;
  border: 1px solid var(--border-light) !important;
  box-shadow: var(--shadow-sm) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--text-secondary) !important;
}

.screen-options-btn:hover {
  color: var(--text-primary) !important;
}

/* ============================================================
   LOADING STATES
   ============================================================ */
.dt-loader {
  border-radius: var(--radius-lg) !important;
}

/* ============================================================
   RESPONSIVE — Mobile
   ============================================================ */
@media (max-width: 767px) {
  .sidebar {
    width: 0 !important;
  }

  .sidebar:hover {
    width: var(--sidebar-expanded) !important;
  }

  #wrapper {
    margin-left: 0 !important;
  }

  .content {
    padding: 16px !important;
  }

  .hide-menu {
    display: inline-flex !important;
  }
}

@media (max-width: 991px) {
  body:not(.hide-sidebar) .sidebar {
    width: 0 !important;
  }

  body.show-sidebar .sidebar {
    width: var(--sidebar-expanded) !important;
  }

  body:not(.hide-sidebar) #wrapper {
    margin-left: 0 !important;
  }

  .hide-menu {
    display: inline-flex !important;
  }
}

/* ============================================================
   MISC OVERRIDES
   ============================================================ */

/* Remove old default shadows */
.panel_s,
.panel-default {
  -webkit-box-shadow: none !important;
}

/* Clean up well elements */
.well {
  background: var(--bg-base) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: none !important;
}

/* Customer/Lead summary boxes */
.row-summary {
  background: var(--bg-card) !important;
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--border-light) !important;
  padding: 16px 20px !important;
}

/* Notification dropdown */
.notifications-wrapper .dropdown-menu {
  min-width: 350px !important;
}

/* Setup menu item — always visible (Perfex hides it on non-hover) */
#setup-menu-item {
  display: block !important;
}

/* Setup panel — position to the right of the narrow sidebar */
#setup-menu-wrapper {
  width: 240px !important;
  position: fixed !important;
  top: 0 !important;
  left: var(--sidebar-width) !important;
  height: 100vh !important;
  z-index: 1002 !important;
  overflow-y: auto !important;
  background: var(--bg-card) !important;
  border-right: 1px solid var(--border-light) !important;
  box-shadow: var(--shadow-lg) !important;
}

/* When setup panel is NOT open, hide it */
#setup-menu-wrapper:not(.display-block) {
  display: none !important;
  width: 0 !important;
}

/* Fix pinned projects in sidebar */
.sidebar .pinned-projects-wrapper {
  padding: 4px 6px !important;
}

.sidebar:not(:hover) .pinned-projects-wrapper {
  display: none !important;
}

/* Search results dropdown */
#search_results {
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
}

.search-results {
  border-radius: var(--radius-md) !important;
}

/* ============================================================
   PREMIUM REFINEMENT — unified admin experience
   ============================================================ */
:root {
  --sidebar-width: 72px;
  --sidebar-expanded: 256px;
  --header-height: 64px;
  --bg-base: #f5f4f1;
  --bg-card: #ffffff;
  --bg-sidebar: #fbfaf8;
  --accent: #e43f4b;
  --accent-dark: #c92f3b;
  --accent-soft: #fff0f1;
  --text-primary: #17191f;
  --text-secondary: #626977;
  --text-muted: #949ba7;
  --border-color: #dedbd5;
  --border-light: #ece9e4;
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.04), 0 1px 1px rgba(24, 24, 27, 0.02);
  --shadow-md: 0 8px 24px rgba(24, 24, 27, 0.07);
  --shadow-lg: 0 20px 48px rgba(24, 24, 27, 0.14);
  --focus-ring: 0 0 0 3px rgba(228, 63, 75, 0.18);
}

html {
  scroll-padding-top: calc(var(--header-height) + 16px);
}

body,
button,
input,
select,
textarea {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

a,
button,
input,
select,
textarea,
[tabindex] {
  outline: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  box-shadow: var(--focus-ring) !important;
  outline: 2px solid transparent !important;
}

::selection {
  background: rgba(228, 63, 75, 0.2);
  color: var(--text-primary);
}

/* The rail remains compact by default and expands for mouse or keyboard users. */
.sidebar:not(#setup-menu-wrapper) {
  scrollbar-gutter: stable;
  transition: width 180ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 180ms ease !important;
}

.sidebar:not(#setup-menu-wrapper):hover,
.sidebar:not(#setup-menu-wrapper):focus-within {
  width: var(--sidebar-expanded) !important;
  box-shadow: 18px 0 42px rgba(24, 24, 27, 0.13) !important;
}

.sidebar-user-profile {
  position: sticky !important;
  top: 0 !important;
  z-index: 4 !important;
  height: var(--header-height) !important;
  background: rgba(251, 250, 248, 0.96) !important;
  backdrop-filter: blur(12px);
}

.sidebar .dropdown.sidebar-user-profile > a.profile {
  min-height: 48px;
  transition: background 150ms ease, box-shadow 150ms ease !important;
}

.sidebar:not(#setup-menu-wrapper):hover .dropdown.sidebar-user-profile > a.profile,
.sidebar:not(#setup-menu-wrapper):focus-within .dropdown.sidebar-user-profile > a.profile {
  justify-content: flex-start !important;
  background: #ffffff !important;
  box-shadow: var(--shadow-sm) !important;
}

#side-menu {
  padding: 10px 8px 24px !important;
}

#side-menu > li > a {
  min-height: 42px;
  display: flex !important;
  align-items: center !important;
  margin-bottom: 3px !important;
  border: 1px solid transparent !important;
  font-size: 13.5px !important;
  font-weight: 550 !important;
}

#side-menu > li > a:hover,
#side-menu > li > a:focus-visible {
  background: #f1efeb !important;
  border-color: #e7e3dd !important;
}

#side-menu > li.active > a,
#side-menu > li.mm-active > a,
#side-menu > li.active > a:first-child {
  background: var(--text-primary) !important;
  border-color: var(--text-primary) !important;
  color: #ffffff !important;
  box-shadow: 0 6px 16px rgba(24, 24, 27, 0.16) !important;
}

#side-menu > li.active > a::before,
#side-menu > li.mm-active > a::before {
  content: "";
  width: 3px;
  height: 18px;
  position: absolute;
  left: 4px;
  border-radius: 99px;
  background: var(--accent);
}

.sidebar:not(#setup-menu-wrapper):focus-within .menu-text,
.sidebar:not(#setup-menu-wrapper):focus-within .sub-menu-text,
.sidebar:not(#setup-menu-wrapper):focus-within .fa.arrow,
.sidebar:not(#setup-menu-wrapper):focus-within #side-menu .badge,
.sidebar:not(#setup-menu-wrapper):focus-within .nav-second-level,
.sidebar:not(#setup-menu-wrapper):focus-within #setup-menu-item .menu-text {
  display: inline-block !important;
}

.sidebar:not(#setup-menu-wrapper):focus-within #side-menu > li > a {
  justify-content: flex-start !important;
  padding: 8px 12px !important;
  text-align: left !important;
}

.sidebar:not(#setup-menu-wrapper):focus-within .menu-icon {
  margin-right: 12px !important;
}

.nav-second-level {
  margin: 2px 4px 8px 16px !important;
  padding: 5px 4px 5px 8px !important;
  border-left: 1px solid var(--border-color) !important;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
}

.nav-second-level > li > a {
  padding: 7px 10px !important;
  line-height: 1.35 !important;
}

/* Calm, persistent command bar. */
#header {
  background: rgba(245, 244, 241, 0.94) !important;
  border-bottom-color: rgba(222, 219, 213, 0.8) !important;
  backdrop-filter: blur(16px) saturate(130%);
}

#header nav {
  height: var(--header-height);
  padding: 0 28px !important;
}

#logo img {
  max-height: 36px !important;
}

#top_search {
  width: min(42vw, 520px) !important;
  max-width: 520px !important;
}

#search_input {
  height: 44px !important;
  margin-top: 10px !important;
  border-radius: 14px !important;
  border-color: var(--border-color) !important;
  box-shadow: 0 1px 1px rgba(24, 24, 27, 0.02) !important;
}

#search_input:focus {
  border-color: rgba(228, 63, 75, 0.55) !important;
  box-shadow: var(--focus-ring) !important;
}

.nav.navbar-nav .tw-bg-primary-600 {
  background: var(--accent) !important;
  color: #ffffff !important;
  box-shadow: 0 5px 14px rgba(228, 63, 75, 0.22) !important;
}

.navbar-nav > li.icon > a {
  border-radius: 10px !important;
}

.navbar-nav > li.icon > a:hover,
.navbar-nav > li.icon > a:focus-visible {
  background: rgba(24, 24, 27, 0.055) !important;
}

/* Page composition and dashboard command centre. */
.content {
  padding: 28px clamp(20px, 2.5vw, 36px) 44px !important;
}

.fusion-dashboard-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 6px 0 22px;
}

.fusion-eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.fusion-dashboard-copy h1 {
  margin: 0;
  color: var(--text-primary);
  font-size: clamp(24px, 2.4vw, 34px);
  font-weight: 680;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.fusion-dashboard-copy p {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.fusion-dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.fusion-dashboard-actions .btn,
.fusion-dashboard-options {
  min-height: 40px;
  padding: 9px 14px !important;
  border-radius: 10px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  line-height: 1.2 !important;
}

.fusion-dashboard-actions .btn i {
  margin-right: 7px;
}

.fusion-dashboard-options {
  position: static !important;
  gap: 7px;
  color: var(--text-secondary) !important;
  cursor: pointer;
}

.fusion-dashboard-options svg {
  width: 17px;
  height: 17px;
}

body.fusion-dashboard-page .content > .row {
  margin-right: -10px;
  margin-left: -10px;
}

body.fusion-dashboard-page .content > .row > [data-container] {
  padding-right: 10px;
  padding-left: 10px;
}

[data-container="top-12"] {
  margin-top: 0 !important;
}

[data-container="top-12"] > .widget > .row {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 0 !important;
}

/* Bootstrap's clearfix pseudo-elements become grid items unless removed. */
[data-container="top-12"] > .widget > .row::before,
[data-container="top-12"] > .widget > .row::after,
.finance-summary .home-summary::before,
.finance-summary .home-summary::after,
.finance-summary .home-summary > [class*="col-"] > .row::before,
.finance-summary .home-summary > [class*="col-"] > .row::after {
  display: none !important;
  content: none !important;
}

[data-container="top-12"] > .widget > .row > [class*="col-"] {
  float: none !important;
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
}

.top_stats_wrapper {
  min-height: 106px;
  padding: 17px 18px !important;
  background: var(--bg-card) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: 14px !important;
  box-shadow: var(--shadow-sm) !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.top_stats_wrapper:hover {
  border-color: var(--border-color) !important;
  box-shadow: var(--shadow-md) !important;
  transform: translateY(-1px);
}

.top_stats_wrapper svg {
  box-sizing: border-box;
  width: 34px !important;
  height: 34px !important;
  padding: 7px;
  border-radius: 9px;
  background: #f5f4f1;
  color: var(--text-secondary) !important;
  flex: 0 0 auto;
}

.top_stats_wrapper .tw-font-medium {
  color: var(--text-primary) !important;
  font-size: 13.5px;
}

.top_stats_wrapper .tw-font-semibold {
  color: var(--text-secondary) !important;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.widget {
  margin-bottom: 18px !important;
}

.widget .panel_s {
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.widget .panel_s:hover {
  border-color: var(--border-color) !important;
  box-shadow: var(--shadow-md) !important;
}

.widget-dragger {
  opacity: 0;
  transition: opacity 150ms ease;
}

.widget:hover .widget-dragger,
.widget:focus-within .widget-dragger {
  opacity: 0.55;
}

/* Compress finance summaries into scannable status/value pairs. */
.finance-summary .home-summary {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0;
  margin: 0 !important;
}

.finance-summary .panel-body {
  padding: 18px !important;
}

.finance-summary .home-summary > [class*="col-"] {
  float: none !important;
  width: auto !important;
  min-width: 0;
  padding: 4px 20px 8px !important;
  border-right: 1px solid var(--border-light);
}

.finance-summary .home-summary > [class*="col-"]:last-child {
  border-right: 0;
}

.finance-summary .home-summary > [class*="col-"] > .row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(96px, 40%);
  align-items: center;
  gap: 0 12px;
  margin: 0 !important;
}

.finance-summary .home-summary > [class*="col-"] > .row > [class*="col-"] {
  float: none !important;
  width: auto !important;
  padding: 0 !important;
}

.finance-summary .home-summary > [class*="col-"] > .row > [class*="col-"]:first-child {
  grid-column: 1 / -1;
}

.finance-summary .text-stats-wrapper {
  min-width: 0;
  margin: 0 !important;
  padding: 7px 0 !important;
  font-size: 12.5px;
}

.finance-summary .text-stats-wrapper a {
  max-width: 100%;
  margin: 0 !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-summary .progress-finance-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--text-muted) !important;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.finance-summary .progress-finance-status .progress {
  width: 66%;
  min-width: 64px;
}

.finance-summary .fusion-zero-summary {
  opacity: 0.48;
}

.finance-summary .fusion-zero-summary:hover,
.finance-summary .fusion-zero-summary:focus-within {
  opacity: 0.78;
}

/* Working tables: quieter at rest, clearer on interaction. */
.table-responsive {
  border-radius: 12px;
}

.table > thead > tr > th {
  height: 44px;
  padding: 11px 14px !important;
  background: #f8f7f4 !important;
  color: #707784 !important;
  font-size: 11px !important;
  letter-spacing: 0.055em !important;
}

.table > tbody > tr > td {
  min-height: 54px;
  padding: 13px 14px !important;
  line-height: 1.45 !important;
}

.table > tbody > tr:hover > td,
.table > tbody > tr:focus-within > td {
  background: #fbfaf8 !important;
}

.table .row-options {
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.table tr:hover .row-options,
.table tr:focus-within .row-options {
  opacity: 1;
  transform: translateY(0);
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  min-height: 38px !important;
  border-color: var(--border-color) !important;
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: rgba(228, 63, 75, 0.55) !important;
  box-shadow: var(--focus-ring) !important;
}

/* Controls and feedback. */
.btn {
  min-height: 38px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.btn-primary,
.btn-info {
  background: var(--text-primary) !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-info:hover,
.btn-info:focus {
  background: #2b2e36 !important;
  transform: translateY(-1px);
}

.btn-success {
  background: #168653 !important;
}

.alert-success {
  background: #ecfdf3 !important;
  color: #166534 !important;
}

.form-control:hover {
  border-color: #c9c5be !important;
}

.panel_s,
.panel-default,
.panel {
  border-color: var(--border-light) !important;
  border-radius: 14px !important;
}

/* Job Pipeline inherits the same product language without changing workflow. */
.fusion-page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.fusion-page-heading h4 {
  margin: 0 0 5px !important;
  color: var(--text-primary);
  font-size: 22px !important;
  letter-spacing: -0.025em;
}

.fusion-page-heading p {
  margin: 0 !important;
}

.fusion-page-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.fusion-pipeline-board {
  display: flex;
  gap: 12px;
  min-height: 64vh;
  padding-bottom: 16px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}

.pipeline-column {
  min-width: 264px !important;
  max-width: 300px !important;
  flex: 1 0 264px;
  scroll-snap-align: start;
}

.pipeline-column-header {
  padding: 12px 14px !important;
  border: 1px solid color-mix(in srgb, var(--stage-color) 24%, transparent) !important;
  border-bottom: 3px solid var(--stage-color) !important;
  border-radius: 12px 12px 0 0 !important;
  background: color-mix(in srgb, var(--stage-color) 8%, white) !important;
}

.pipeline-column-title {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--stage-color) !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
}

.pipeline-column-count {
  min-width: 24px;
  padding: 3px 7px !important;
  border-radius: 99px !important;
  background: var(--stage-color) !important;
  color: #fff !important;
  font-size: 10.5px !important;
  text-align: center;
}

.pipeline-cards {
  min-height: 220px !important;
  padding: 10px !important;
  border-color: var(--border-light) !important;
  border-radius: 0 0 12px 12px !important;
  background: #f8f7f4 !important;
}

.pipeline-empty {
  display: grid;
  min-height: 168px;
  place-items: center;
  color: var(--text-muted);
  font-size: 12px;
}

.pipeline-card {
  padding: 13px !important;
  border-color: var(--border-light) !important;
  border-radius: 10px !important;
  box-shadow: var(--shadow-sm);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease !important;
}

.pipeline-card:hover,
.pipeline-card:focus-visible {
  border-color: var(--border-color) !important;
  box-shadow: var(--shadow-md) !important;
  transform: translateY(-2px);
}

@media (max-width: 1199px) {
  [data-container="top-12"] > .widget > .row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-summary .home-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-summary .home-summary > [class*="col-"] {
    padding: 16px 18px !important;
    border-bottom: 1px solid var(--border-light);
  }

  .finance-summary .home-summary > [class*="col-"]:nth-child(even) {
    border-right: 0;
  }

  .finance-summary .home-summary > [class*="col-"]:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
}

@media (max-width: 767px) {
  :root {
    --header-height: 60px;
  }

  #header nav {
    padding: 0 12px !important;
  }

  #top_search {
    width: auto !important;
    max-width: none !important;
  }

  .content {
    padding: 18px 14px 32px !important;
  }

  .fusion-dashboard-intro,
  .fusion-page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .fusion-dashboard-actions,
  .fusion-page-actions {
    width: 100%;
    justify-content: flex-start;
  }

  [data-container="top-12"] > .widget > .row {
    grid-template-columns: 1fr;
  }

  .finance-summary .home-summary {
    grid-template-columns: 1fr;
  }

  .finance-summary .home-summary > [class*="col-"] {
    padding: 16px 4px !important;
    border-right: 0;
    border-bottom: 1px solid var(--border-light) !important;
  }

  .finance-summary .home-summary > [class*="col-"]:last-child {
    border-bottom: 0 !important;
  }

  .finance-summary .home-summary > [class*="col-"] > .row {
    grid-template-columns: minmax(0, 1fr) 108px;
  }

  body.show-sidebar .sidebar:not(#setup-menu-wrapper),
  .sidebar:not(#setup-menu-wrapper):focus-within {
    width: min(86vw, var(--sidebar-expanded)) !important;
  }

  .table .row-options {
    opacity: 1;
    transform: none;
  }
}

@media (hover: none) {
  .table .row-options {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
