/* ═══════════════════════════════════════════════════════════════
   White Property CRM — Global Design System
   Upnez · Real Estate Operations Platform
   ═══════════════════════════════════════════════════════════════ */

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

/* ─── Color Tokens ─── */
:root {
  --color-primary:   #0074FF;
  --color-primary-light: #3390ff;
  --color-primary-dark:  #0055cc;
  --color-dark:      #081A3E;
  --color-dark-2:    #0d2252;
  --color-dark-3:    #132c65;
  --color-white:     #FFFFFF;
  --color-success:   #1FAE60;
  --color-warning:   #F5A623;
  --color-danger:    #E5484D;
  --color-info:      #5B8DEF;
  --color-muted:     #8A94A6;

  --bg-body:         #F0F4FF;
  --bg-card:         rgba(255,255,255,0.92);
  --bg-card-hover:   rgba(255,255,255,0.98);
  --sidebar-width:   260px;
  --topbar-height:   64px;

  --shadow-sm:  0 1px 3px rgba(8,26,62,0.08);
  --shadow-md:  0 4px 16px rgba(8,26,62,0.12);
  --shadow-lg:  0 8px 32px rgba(8,26,62,0.16);
  --shadow-xl:  0 16px 48px rgba(8,26,62,0.2);

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-pill:50px;

  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
  --font-family: 'Inter', 'Noto Sans Bengali', system-ui, -apple-system, sans-serif;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-family);
  background: var(--bg-body);
  color: var(--color-dark);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(8,26,62,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-primary); }

/* ════════════════════════════════
   LAYOUT
   ════════════════════════════════ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(160deg, var(--color-dark) 0%, var(--color-dark-2) 60%, var(--color-dark-3) 100%);
  position: fixed;
  top: var(--topbar-height); left: 0; bottom: 0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.06);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) transparent;
  transition: transform var(--transition);
}

.sidebar::-webkit-scrollbar {
  width: 5px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.16);
  border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.32);
}

/* ─── Unified App Header (replaces sidebar-logo + old topbar) ─── */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  display: flex;
  z-index: 200;
  box-shadow: 0 1px 0 rgba(8,26,62,0.1), 0 2px 12px rgba(8,26,62,0.08);
}

.app-header-brand {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: linear-gradient(160deg, var(--color-dark) 0%, var(--color-dark-2) 100%);
  border-right: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  padding: 0 20px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.app-header-topbar {
  flex: 1;
  background: white;
  border-bottom: 1px solid rgba(8,26,62,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
}

.header-divider {
  width: 1px;
  height: 24px;
  background: rgba(8,26,62,0.1);
  margin: 0 4px;
  flex-shrink: 0;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}
.header-user:hover { background: rgba(0,116,255,0.06); }

.header-user-avatar {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-info));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white;
  flex-shrink: 0;
}

.header-user-info { line-height: 1.25; }
.header-user-name { font-size: 12.5px; font-weight: 600; color: var(--color-dark); }
.header-user-role { font-size: 10.5px; color: var(--color-muted); text-transform: capitalize; }

/* ─── Sidebar (no longer has logo — header handles it) ─── */
.sidebar-logo { display: none; }

.sidebar-logo a {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-mark {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,116,255,0.4);
}

.logo-text { color: white; }
.logo-text .company { font-size: 15px; font-weight: 700; letter-spacing: -0.3px; }
.logo-text .tagline { font-size: 10px; color: rgba(255,255,255,0.45); font-weight: 400; letter-spacing: 0.5px; text-transform: uppercase; }

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.34);
  padding: 10px 10px 4px;
  margin-top: 2px;
}

.nav-section-label:first-child {
  padding-top: 4px;
  margin-top: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7.5px 10px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  margin-bottom: 2px;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: white;
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(0,116,255,0.32) 0%, rgba(0,116,255,0.12) 100%);
  color: #ffffff;
  font-weight: 600;
  border-left: 3px solid var(--color-primary);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 65%;
  background: var(--color-primary);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  width: 17px; height: 17px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--color-danger);
  color: white;
  font-size: 9.5px;
  font-weight: 700;
  padding: 1.5px 5.5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
  line-height: 1.2;
}

.sidebar-footer {
  padding: 10px 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}

.sidebar-user:hover { background: rgba(255,255,255,0.08); }

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-info));
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-info .user-name { font-size: 12.5px; font-weight: 600; color: white; }
.user-info .user-role { font-size: 10.5px; color: rgba(255,255,255,0.4); text-transform: capitalize; }

/* ─── Sidebar Collapsed State ─── */
body.sidebar-collapsed {
  --sidebar-width: 68px;
}
body.sidebar-collapsed .app-header-brand {
  width: var(--sidebar-width);
  padding: 0;
  justify-content: center;
}
body.sidebar-collapsed .logo-text,
body.sidebar-collapsed .nav-section-label,
body.sidebar-collapsed .nav-item span:not(.nav-badge),
body.sidebar-collapsed .nav-item .nav-badge,
body.sidebar-collapsed .sidebar-footer .user-info {
  display: none !important;
}
body.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 12px 0;
  gap: 0;
  border-left: none;
}
body.sidebar-collapsed .nav-item.active {
  background: rgba(0,116,255,0.25);
  border-radius: var(--radius-sm);
}
body.sidebar-collapsed .main-content {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
}

/* ─── Main Content ─── */
.main-content {
  margin-left: var(--sidebar-width);
  padding-top: var(--topbar-height);
  flex: 1;
  min-width: 0;
  width: calc(100% - var(--sidebar-width));
  max-width: 100vw;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  transition: all var(--transition);
}
/* ─── Topbar helpers (used inside .app-header-topbar) ─── */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-dark);
  letter-spacing: -0.3px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-muted);
}

.breadcrumb a { color: var(--color-primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-action {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--bg-body);
  color: var(--color-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  position: relative;
}

.topbar-action:hover {
  background: var(--color-primary);
  color: white;
  transform: scale(1.05);
}

.notif-badge {
  position: absolute;
  top: -2px; right: -2px;
  width: 16px; height: 16px;
  background: var(--color-danger);
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  color: white;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid white;
}

/* ─── Page Content ─── */
.page-content {
  padding: 24px;
  flex: 1;
}

/* ════════════════════════════════
   CARDS
   ════════════════════════════════ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(8,26,62,0.06);
  transition: box-shadow var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-dark);
  letter-spacing: -0.2px;
}

.card-subtitle {
  font-size: 12px;
  color: var(--color-muted);
  margin-top: 2px;
}

.card-body { padding: 20px 24px 24px; }

/* ─── KPI Stat Cards ─── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(8,26,62,0.06);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--kpi-color, var(--color-primary));
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: color-mix(in srgb, var(--kpi-color, var(--color-primary)) 12%, transparent);
  color: var(--kpi-color, var(--color-primary));
  flex-shrink: 0;
}

.kpi-content {}
.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--color-dark);
  line-height: 1;
  letter-spacing: -1px;
}
.kpi-label {
  font-size: 12px;
  color: var(--color-muted);
  margin-top: 4px;
  font-weight: 500;
}
.kpi-change {
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.kpi-change.up { color: var(--color-success); }
.kpi-change.down { color: var(--color-danger); }

/* ════════════════════════════════
   BADGES / PILLS
   ════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-primary   { background: rgba(0,116,255,0.12);  color: var(--color-primary); }
.badge-success   { background: rgba(31,174,96,0.12);  color: var(--color-success); }
.badge-warning   { background: rgba(245,166,35,0.15); color: #c4830b; }
.badge-danger    { background: rgba(229,72,77,0.12);  color: var(--color-danger); }
.badge-info      { background: rgba(91,141,239,0.12); color: var(--color-info); }
.badge-muted     { background: rgba(138,148,166,0.12);color: var(--color-muted); }
.badge-dark      { background: rgba(8,26,62,0.1);     color: var(--color-dark); }

/* Priority badges */
.badge-hot    { background: rgba(0,116,255,0.15); color: var(--color-primary); }
.badge-high   { background: rgba(31,174,96,0.15); color: var(--color-success); }
.badge-medium { background: rgba(245,166,35,0.15);color: #c4830b; }
.badge-low    { background: rgba(138,148,166,0.15);color: var(--color-muted); }

/* ════════════════════════════════
   TABLES
   ════════════════════════════════ */
.table-wrap {
  border-radius: var(--radius-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(8,26,62,0.06);
  background: white;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  position: relative;
}

/* Custom styled horizontal scrollbar for tables */
.table-wrap::-webkit-scrollbar {
  height: 6px;
}
.table-wrap::-webkit-scrollbar-track {
  background: #F1F5F9;
  border-radius: 3px;
}
.table-wrap::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 3px;
}
.table-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

/* Tables inside cards — remove card overflow so rows show */
.card .data-table {
  margin: 0 -0px;
}

.card-body.p-0 { padding: 0 !important; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead {
  background: #F8FAFC;
  border-bottom: 2px solid rgba(8,26,62,0.08);
}

.data-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-muted);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(8,26,62,0.05);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background var(--transition);
  position: relative;
}

.data-table tbody tr:hover { background: rgba(0,116,255,0.03); }

/* Sticky Action Column on the right */
.data-table th.sticky-action,
.data-table td.sticky-action {
  position: sticky;
  right: 0;
  background: white;
  z-index: 2;
  box-shadow: -4px 0 8px rgba(0,0,0,0.04);
  text-align: right;
  min-width: 185px;
  width: 185px;
  white-space: nowrap !important;
}
.data-table thead th.sticky-action {
  background: #F8FAFC;
  z-index: 3;
}
.data-table tbody tr:hover td.sticky-action {
  background: #F4F8FF;
}

.table-action-group {
  display: flex !important;
  align-items: center;
  gap: 5px;
  justify-content: flex-end;
  white-space: nowrap !important;
  flex-wrap: nowrap !important;
}

.table-action-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  max-width: 28px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid rgba(8,26,62,0.1);
  background: #F8FAFC;
  color: var(--color-muted);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  padding: 0;
}

.table-action-btn:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  transform: scale(1.08);
}
.table-action-btn.btn-call { color: #0074FF; background: #EFF6FF; border-color: rgba(0,116,255,0.2); }
.table-action-btn.btn-call:hover { background: #0074FF; color: white; border-color: #0074FF; }
.table-action-btn.btn-whatsapp { color: #1FAE60; background: #F0FDF4; border-color: rgba(31,174,96,0.2); }
.table-action-btn.btn-whatsapp:hover { background: #1FAE60; color: white; border-color: #1FAE60; }
.table-action-btn.btn-visit { color: #06B6D4; background: #ECFEFF; border-color: rgba(6,182,212,0.2); }
.table-action-btn.btn-visit:hover { background: #06B6D4; color: white; border-color: #06B6D4; }
.table-action-btn.btn-apt { color: #F59E0B; background: #FFFBEB; border-color: rgba(245,158,11,0.2); }
.table-action-btn.btn-apt:hover { background: #F59E0B; color: white; border-color: #F59E0B; }
.table-action-btn.btn-complete { color: #10B981; background: #ECFDF5; border-color: rgba(16,185,129,0.2); }
.table-action-btn.btn-complete:hover { background: #10B981; color: white; border-color: #10B981; }
.table-action-btn.btn-resched { color: #8B5CF6; background: #F5F3FF; border-color: rgba(139,92,246,0.2); }
.table-action-btn.btn-resched:hover { background: #8B5CF6; color: white; border-color: #8B5CF6; }
.table-action-btn.btn-more { color: var(--color-muted); background: #F8FAFC; }
.table-action-btn.btn-more:hover { background: var(--color-dark); color: white; border-color: var(--color-dark); }

/* Row Dropdown Menu */
.row-dropdown-container {
  position: relative;
  display: inline-block;
}

.row-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(8,26,62,0.15);
  border: 1px solid rgba(8,26,62,0.08);
  padding: 6px;
  min-width: 180px;
  z-index: 1000;
  text-align: left;
}

.row-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-dark);
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.15s;
  white-space: nowrap;
}

.row-dropdown-item:hover {
  background: rgba(0, 116, 255, 0.08);
  color: var(--color-primary);
}

/* Priority strip on left edge */
.data-table tbody tr.priority-hot td:first-child    { border-left: 3px solid var(--color-primary); }
.data-table tbody tr.priority-high td:first-child   { border-left: 3px solid var(--color-success); }
.data-table tbody tr.priority-medium td:first-child { border-left: 3px solid var(--color-warning); }
.data-table tbody tr.priority-low td:first-child    { border-left: 3px solid var(--color-muted); }

.data-table tbody tr.status-overdue   { background: rgba(229,72,77,0.03); }
.data-table tbody tr.status-escalated { background: rgba(229,72,77,0.06); }

.data-table tfoot td {
  padding: 14px;
  border-top: 2px solid rgba(8,26,62,0.08);
  background: var(--bg-body);
}

/* ─── Table Actions ─── */
.actions {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.action-btn {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: none;
  background: var(--bg-body);
  color: var(--color-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  font-size: 13px;
}

.action-btn:hover { background: var(--color-primary); color: white; transform: scale(1.1); }
.action-btn.danger:hover { background: var(--color-danger); }
.action-btn.success:hover { background: var(--color-success); }
.action-btn.warning:hover { background: var(--color-warning); color: white; }

/* ════════════════════════════════
   BUTTONS
   ════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(0,116,255,0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
  box-shadow: 0 6px 20px rgba(0,116,255,0.45);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, var(--color-success), #27c672);
  color: white;
  box-shadow: 0 4px 12px rgba(31,174,96,0.3);
}
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(31,174,96,0.4); }

.btn-danger {
  background: linear-gradient(135deg, var(--color-danger), #f06060);
  color: white;
  box-shadow: 0 4px 12px rgba(229,72,77,0.3);
}
.btn-danger:hover { transform: translateY(-1px); }

.btn-warning {
  background: linear-gradient(135deg, var(--color-warning), #f8bc4a);
  color: white;
  box-shadow: 0 4px 12px rgba(245,166,35,0.3);
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
}
.btn-outline:hover { background: var(--color-primary); color: white; }

.btn-ghost {
  background: var(--bg-body);
  color: var(--color-dark);
  border: 1px solid rgba(8,26,62,0.12);
}
.btn-ghost:hover { background: white; box-shadow: var(--shadow-sm); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 9px; border-radius: var(--radius-sm); }

/* ════════════════════════════════
   FORMS
   ════════════════════════════════ */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-dark);
  letter-spacing: 0.2px;
}

.form-label .required {
  color: var(--color-danger);
  margin-left: 2px;
}

.form-control {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(8,26,62,0.15);
  font-size: 13.5px;
  font-family: var(--font-family);
  color: var(--color-dark);
  background: white;
  transition: all var(--transition);
  outline: none;
  width: 100%;
}

.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0,116,255,0.1);
}

.form-control.error {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(229,72,77,0.1);
}

.form-control::placeholder { color: var(--color-muted); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

.form-hint {
  font-size: 11.5px;
  color: var(--color-muted);
}

.form-hint.counter { text-align: right; }
.form-hint.counter.danger { color: var(--color-danger); font-weight: 600; }

.form-error {
  font-size: 11.5px;
  color: var(--color-danger);
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-section {
  padding: 24px;
  border-radius: var(--radius-md);
  background: rgba(240,244,255,0.6);
  border: 1px solid rgba(8,26,62,0.06);
  margin-bottom: 20px;
}

.form-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-dark);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Wizard steps */
.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 32px;
  padding: 0 4px;
}

.wizard-step {
  display: flex;
  align-items: center;
  flex: 1;
  position: relative;
}

.wizard-step-indicator {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(8,26,62,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-muted);
  background: white;
  transition: all var(--transition);
  flex-shrink: 0;
  z-index: 1;
}

.wizard-step.done .wizard-step-indicator { background: var(--color-success); border-color: var(--color-success); color: white; }
.wizard-step.active .wizard-step-indicator { background: var(--color-primary); border-color: var(--color-primary); color: white; box-shadow: 0 0 0 4px rgba(0,116,255,0.2); }

.wizard-step-label {
  margin-left: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-muted);
}
.wizard-step.active .wizard-step-label { color: var(--color-primary); }
.wizard-step.done .wizard-step-label { color: var(--color-success); }

.wizard-step-line {
  flex: 1;
  height: 2px;
  background: rgba(8,26,62,0.1);
  margin: 0 12px;
}
.wizard-step.done + .wizard-step .wizard-step-line,
.wizard-step.done .wizard-step-line { background: var(--color-success); }

/* ════════════════════════════════
   FILTERS BAR
   ════════════════════════════════ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  background: white;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(8,26,62,0.06);
  width: 100%;
  box-sizing: border-box;
}

.filter-bar .form-control {
  min-width: 110px;
  flex: 1 1 120px;
  max-width: 100%;
  font-size: 12.5px;
  padding: 7px 10px;
  height: 36px;
}

.filter-bar .search-input {
  min-width: 160px;
  flex: 2 1 200px;
}

/* ════════════════════════════════
   PAGE HEADER
   ════════════════════════════════ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-header-left {}
.page-header-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--color-dark);
  letter-spacing: -0.5px;
}
.page-header-subtitle {
  font-size: 13px;
  color: var(--color-muted);
  margin-top: 4px;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ════════════════════════════════
   ALERTS / FLASH MESSAGES
   ════════════════════════════════ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 20px;
  border-left: 4px solid;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert-success { background: rgba(31,174,96,0.1);  border-color: var(--color-success); color: #0e6b3a; }
.alert-danger  { background: rgba(229,72,77,0.1);  border-color: var(--color-danger);  color: #b01c22; }
.alert-warning { background: rgba(245,166,35,0.1); border-color: var(--color-warning); color: #8a5c00; }
.alert-info    { background: rgba(91,141,239,0.1); border-color: var(--color-info);    color: #2e58c4; }

/* ════════════════════════════════
   KANBAN BOARD
   ════════════════════════════════ */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
}

.kanban-column {
  min-width: 280px;
  max-width: 320px;
  flex-shrink: 0;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: white;
  border-bottom: 3px solid var(--stage-color, var(--color-primary));
  box-shadow: var(--shadow-sm);
}

.kanban-column-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-dark);
}

.kanban-count {
  font-size: 11px;
  font-weight: 700;
  background: var(--stage-color, var(--color-primary));
  color: white;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.kanban-cards {
  background: rgba(240,244,255,0.5);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  min-height: 200px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanban-card {
  background: white;
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(8,26,62,0.06);
  cursor: pointer;
  transition: all var(--transition);
}

.kanban-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.kanban-card-title { font-size: 13px; font-weight: 600; color: var(--color-dark); margin-bottom: 8px; }
.kanban-card-meta  { font-size: 11.5px; color: var(--color-muted); display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.kanban-card-value { font-size: 14px; font-weight: 700; color: var(--color-primary); }

/* ════════════════════════════════
   TIMELINE (Activity Log)
   ════════════════════════════════ */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px; top: 0; bottom: 0;
  width: 2px;
  background: rgba(8,26,62,0.08);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-dot {
  position: absolute;
  left: -20px; top: 4px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 2px solid white;
  box-shadow: 0 0 0 2px rgba(0,116,255,0.2);
}

.timeline-content {
  background: white;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(8,26,62,0.06);
}

.timeline-title { font-size: 13px; font-weight: 600; color: var(--color-dark); }
.timeline-meta  { font-size: 11.5px; color: var(--color-muted); margin-top: 4px; }

/* ════════════════════════════════
   DETAIL VIEW (Show Page)
   ════════════════════════════════ */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
}

.detail-item { padding: 8px 0; border-bottom: 1px solid rgba(8,26,62,0.05); }
.detail-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--color-muted); margin-bottom: 4px; }
.detail-value { font-size: 13.5px; color: var(--color-dark); font-weight: 500; }

/* ════════════════════════════════
   EMPTY STATE
   ════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-muted);
}

.empty-state-icon { font-size: 52px; margin-bottom: 16px; opacity: 0.5; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--color-dark); margin-bottom: 8px; }
.empty-state-text { font-size: 13.5px; margin-bottom: 20px; }

/* ════════════════════════════════
   PAGINATION
   ════════════════════════════════ */
.pagination-wrap {
  display: flex;
  justify-content: center;
  padding: 20px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
}

.page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-dark);
  text-decoration: none;
  transition: all var(--transition);
  background: white;
  border: 1px solid rgba(8,26,62,0.1);
}

.page-link:hover { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.page-item.active .page-link { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.page-item.disabled .page-link { opacity: 0.4; cursor: not-allowed; }

/* ════════════════════════════════
   CHARTS
   ════════════════════════════════ */
.chart-wrap {
  width: 100%;
  min-height: 200px;
  position: relative;
}

/* ════════════════════════════════
   CALENDAR
   ════════════════════════════════ */
.fc-toolbar-title { font-size: 16px !important; font-weight: 700 !important; }
.fc-button-primary { background: var(--color-primary) !important; border-color: var(--color-primary) !important; border-radius: var(--radius-sm) !important; font-size: 12px !important; }
.fc-event { border-radius: 4px !important; font-size: 11px !important; }

/* ════════════════════════════════
   MODALS
   ════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(8, 26, 62, 0.6);
  backdrop-filter: blur(4px);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.open,
.modal-overlay[style*="display: flex"],
.modal-overlay[style*="display:flex"] {
  opacity: 1 !important;
  pointer-events: all !important;
  display: flex !important;
}

.modal {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  z-index: 100000;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition);
}

.modal-overlay.open .modal,
.modal-overlay[style*="display: flex"] .modal,
.modal-overlay[style*="display:flex"] .modal {
  transform: scale(1) translateY(0) !important;
}

.modal-header {
  padding: 24px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 17px; font-weight: 700; color: var(--color-dark); }
.modal-close { background: none; border: none; font-size: 20px; color: var(--color-muted); cursor: pointer; transition: color var(--transition); }
.modal-close:hover { color: var(--color-danger); }

.modal-body { padding: 20px 24px; }
.modal-footer { padding: 0 24px 24px; display: flex; gap: 10px; justify-content: flex-end; }

/* ════════════════════════════════
   RESPONSIVE & MULTI-DEVICE RATIOS
   ════════════════════════════════ */
@media (max-width: 1440px) {
  :root {
    --sidebar-width: 230px;
  }
  .page-content { padding: 18px 20px; }
  .data-table th, .data-table td { padding: 8px 10px; font-size: 12.5px; }
}

@media (max-width: 1200px) {
  :root {
    --sidebar-width: 220px;
  }
  .page-content { padding: 16px; }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
  .filter-bar .form-control { min-width: 100px; font-size: 12px; }
}

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; width: 100% !important; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kanban-board { gap: 12px; }
}

@media (max-width: 768px) {
  .page-content { padding: 12px; }
  .filter-bar { gap: 6px; padding: 10px 12px; }
  .filter-bar .form-control { flex: 1 1 100%; min-width: 100%; }
  .page-header { flex-direction: column; align-items: stretch; }
  .page-header-actions { justify-content: flex-start; }
}

@media (max-width: 640px) {
  .page-content { padding: 10px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .form-control { max-width: 100%; }
}

/* ════════════════════════════════
   ANIMATIONS
   ════════════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes countUp {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.05); }
}

.fade-up { animation: fadeUp 0.4s ease both; }
.fade-up-1 { animation-delay: 0.05s; }
.fade-up-2 { animation-delay: 0.1s; }
.fade-up-3 { animation-delay: 0.15s; }
.fade-up-4 { animation-delay: 0.2s; }
.fade-up-5 { animation-delay: 0.25s; }

.kpi-value { animation: countUp 0.5s ease both; }

/* ─── Utility Classes ─── */
.text-primary  { color: var(--color-primary) !important; }
.text-success  { color: var(--color-success) !important; }
.text-warning  { color: #c4830b !important; }
.text-danger   { color: var(--color-danger) !important; }
.text-muted    { color: var(--color-muted) !important; }
.text-sm       { font-size: 12px !important; }
.text-xs       { font-size: 11px !important; }
.fw-600        { font-weight: 600 !important; }
.fw-700        { font-weight: 700 !important; }
.d-flex        { display: flex !important; }
.align-center  { align-items: center !important; }
.gap-8         { gap: 8px !important; }
.gap-12        { gap: 12px !important; }
.mt-4          { margin-top: 4px !important; }
.mt-8          { margin-top: 8px !important; }
.mt-16         { margin-top: 16px !important; }
.mt-24         { margin-top: 24px !important; }
.mb-16         { margin-bottom: 16px !important; }
.mb-24         { margin-bottom: 24px !important; }

/* ════════════════════════════════
   KPI 6-CARD GRID SYSTEM
   ════════════════════════════════ */
.kpi-cards-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

@media (max-width: 1400px) {
  .kpi-cards-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
  }
}

@media (max-width: 1180px) {
  .kpi-cards-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 850px) {
  .kpi-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .kpi-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ════════════════════════════════
   STICKY ACTIONS & TABLE ICON BUTTONS
   ════════════════════════════════ */
.sticky-action {
  position: sticky !important;
  right: 0 !important;
  background: white !important;
  z-index: 15 !important;
  min-width: 155px !important;
  width: 155px !important;
  white-space: nowrap !important;
  box-shadow: -4px 0 8px rgba(8, 26, 62, 0.04) !important;
  text-align: right !important;
}

thead th.sticky-action {
  background: #F8FAFC !important;
  z-index: 20 !important;
}

.table-action-group {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 4px !important;
  justify-content: flex-end !important;
  align-items: center !important;
  position: relative !important;
}

.table-action-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 28px !important;
  height: 28px !important;
  border-radius: 6px !important;
  border: 1px solid rgba(8, 26, 62, 0.12) !important;
  background: #FFFFFF !important;
  color: var(--color-dark) !important;
  cursor: pointer !important;
  transition: all 0.15s ease-in-out !important;
  padding: 0 !important;
  text-decoration: none !important;
  flex-shrink: 0 !important;
}

.table-action-btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 5px rgba(8, 26, 62, 0.1) !important;
}

.table-action-btn.btn-call:hover {
  background: #EFF6FF !important;
  color: #0074FF !important;
  border-color: #0074FF !important;
}

.table-action-btn.btn-whatsapp:hover {
  background: #F0FDF4 !important;
  color: #16A34A !important;
  border-color: #16A34A !important;
}

.table-action-btn.btn-complete:hover {
  background: #ECFDF5 !important;
  color: #10B981 !important;
  border-color: #10B981 !important;
}

.table-action-btn.btn-resched:hover {
  background: #FFFBEB !important;
  color: #D97706 !important;
  border-color: #D97706 !important;
}

.table-action-btn.btn-expand:hover {
  background: #F1F5F9 !important;
  color: #0074FF !important;
  border-color: #0074FF !important;
}

.table-action-btn.btn-more:hover {
  background: #F1F5F9 !important;
  color: var(--color-dark) !important;
  border-color: rgba(8, 26, 62, 0.25) !important;
}

/* ─── Row Floating Dropdown Menu ─── */
.row-dropdown-container {
  position: relative !important;
  display: inline-block !important;
}

.row-dropdown-menu {
  display: none;
  position: fixed !important;
  z-index: 99999 !important;
  min-width: 185px !important;
  background: #FFFFFF !important;
  border-radius: 9px !important;
  box-shadow: 0 10px 30px rgba(8, 26, 62, 0.18), 0 2px 8px rgba(8, 26, 62, 0.08) !important;
  border: 1px solid rgba(8, 26, 62, 0.12) !important;
  padding: 6px 0 !important;
  animation: fadeUp 0.15s ease both !important;
}

.row-dropdown-item {
  display: flex !important;
  align-items: center !important;
  gap: 9px !important;
  padding: 8px 14px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: var(--color-dark) !important;
  text-decoration: none !important;
  transition: all 0.12s ease !important;
  white-space: nowrap !important;
  border: none !important;
  background: transparent !important;
  width: 100% !important;
  text-align: left !important;
  cursor: pointer !important;
}

.row-dropdown-item:hover {
  background: #F0F4FF !important;
  color: var(--color-primary) !important;
}

.row-dropdown-divider {
  height: 1px !important;
  background: rgba(8, 26, 62, 0.08) !important;
  margin: 4px 0 !important;
}

/* ─── Expandable Details Row ─── */
.details-row {
  transition: all 0.2s ease-in-out;
}

.details-row td {
  background: #F8FAFC !important;
}

/* ─── Collapsed Sidebar Mode ─── */
body.sidebar-collapsed {
  --sidebar-width: 68px;
}

body.sidebar-collapsed .sidebar .nav-item {
  justify-content: center;
  padding: 10px 0;
  font-size: 0;
}

body.sidebar-collapsed .sidebar .nav-item .nav-icon {
  margin-right: 0;
  width: 20px;
  height: 20px;
}

body.sidebar-collapsed .sidebar .nav-section-label,
body.sidebar-collapsed .sidebar .badge,
body.sidebar-collapsed .app-header-brand .logo-text {
  display: none !important;
}

body.sidebar-collapsed .app-header-brand {
  justify-content: center;
  padding: 0;
}
