/* ========================================
   GREEN SPACE CRM – DESIGN SYSTEM
   ======================================== */

/* --- CSS Variables --- */
:root {
  /* Brand Colors */
  --primary:   #2E7D32; 
  --green-900: #0d2b10;
  --green-800: #1B3A1E;
  --green-700: #255228;
  --green-600: var(--primary);
  --green-500: #388E3C;
  --green-400: #4CAF50;
  --green-300: #81C784;
  --green-200: #A8D5A2;
  --green-100: #C8E6C9;
  --green-50:  #E8F5E9;

  /* UI Colors */
  --bg-base:      #F4F8F4;
  --bg-card:      #FFFFFF;
  --bg-card-alt:  #F9FCF9;
  --border:       #E0EDE0;
  --border-strong:#C3DCC3;

  /* Text */
  --text-primary: #1a2e1c;
  --text-secondary:#4A6B4D;
  --text-muted:   #8FA98F;
  --text-white:   #FFFFFF;

  /* Semantic */
  --success: #22C55E;
  --warning: #F59E0B;
  --danger:  #EF4444;
  --info:    #3B82F6;
  --purple:  #8B5CF6;

  /* Sidebar */
  --sidebar-bg:        #152318;
  --sidebar-bg-hover:  rgba(255,255,255,0.07);
  --sidebar-bg-active: rgba(168, 213, 162, 0.15);
  --sidebar-border:    rgba(255,255,255,0.08);
  --sidebar-text:      rgba(255,255,255,0.65);
  --sidebar-text-active:#A8D5A2;
  --sidebar-width:     264px;
  --sidebar-collapsed: 72px;

  /* Layout */
  --topbar-height:  64px;
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      14px;
  --radius-xl:      20px;
  --radius-full:    999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.05);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.07);
  --shadow-green: 0 4px 20px rgba(62, 139, 81, 0.25);

  /* Transitions */
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.13s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3,h4,h5,h6 { font-family: 'Poppins', sans-serif; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width var(--transition);
  overflow: hidden;
  border-right: 1px solid var(--sidebar-border);
  box-shadow: 4px 0 24px rgba(0,0,0,0.18);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

/* --- Sidebar Header --- */
.sidebar-header {
  padding: 20px 16px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--sidebar-border);
  min-height: 72px;
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.logo-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--green-400), var(--green-600));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: var(--shadow-green);
  animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

.brand-text {
  display: flex;
  flex-direction: column;
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition);
}

.sidebar.collapsed .brand-text { opacity: 0; pointer-events: none; }

.brand-name {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: white;
  line-height: 1.2;
  letter-spacing: -0.3px;
}

.brand-sub {
  font-size: 10px;
  color: var(--green-200);
  font-weight: 400;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-toggle {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition-fast);
  flex-shrink: 0;
  font-size: 14px;
}

.sidebar-toggle:hover {
  background: var(--sidebar-bg-hover);
  color: white;
}

/* --- Sidebar User --- */
.sidebar-user {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--sidebar-border);
  overflow: hidden;
  flex-shrink: 0;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--green-500), var(--green-300));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
  border: 2px solid var(--green-600);
  font-family: 'Poppins', sans-serif;
}

.user-info {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition);
}

.sidebar.collapsed .user-info { opacity: 0; }
.sidebar.collapsed .role-switch-btn { opacity: 0; }

.user-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: white;
}

.user-role-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  color: var(--green-200);
  background: rgba(168,213,162,0.15);
  border: 1px solid rgba(168,213,162,0.25);
  border-radius: var(--radius-full);
  padding: 1px 8px;
  margin-top: 2px;
}

.role-switch-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.role-switch-btn:hover {
  background: var(--sidebar-bg-hover);
  color: var(--green-300);
}

/* --- Sidebar Nav --- */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.nav-section-label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.28);
  padding: 12px 8px 6px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition);
}

.sidebar.collapsed .nav-section-label { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 450;
  position: relative;
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--sidebar-bg-hover);
  color: rgba(255,255,255,0.9);
  transform: translateX(2px);
}

.nav-item.active {
  background: var(--sidebar-bg-active);
  color: var(--sidebar-text-active);
  font-weight: 600;
}

.nav-item.active .nav-icon {
  color: var(--green-300);
}

.nav-item.hidden {
  display: none;
}

.nav-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.nav-label {
  flex: 1;
  transition: opacity var(--transition);
}

.sidebar.collapsed .nav-label { opacity: 0; }

.nav-badge {
  font-size: 10px;
  font-weight: 700;
  background: var(--green-600);
  color: white;
  border-radius: var(--radius-full);
  padding: 2px 7px;
  min-width: 20px;
  text-align: center;
  transition: opacity var(--transition);
}

.nav-badge.urgent {
  background: var(--warning);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.5); }
  50% { box-shadow: 0 0 0 6px rgba(245,158,11,0); }
}

.sidebar.collapsed .nav-badge { opacity: 0; }

.nav-indicator {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--green-300);
  border-radius: 3px 0 0 3px;
  transition: height var(--transition-fast);
}

.nav-item.active .nav-indicator { height: 24px; }

/* Tooltip on collapsed */
.sidebar.collapsed .nav-item {
  position: relative;
}

.sidebar.collapsed .nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(var(--sidebar-collapsed) + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--green-800);
  color: white;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  box-shadow: var(--shadow-md);
  z-index: 99;
}

.sidebar.collapsed .nav-item:hover::after { opacity: 1; }

/* --- Sidebar Footer --- */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  flex-shrink: 0;
  transition: opacity var(--transition);
}

.sidebar.collapsed .sidebar-footer { opacity: 0; }

.sidebar-version {
  font-size: 10px;
  color: rgba(255,255,255,0.25);
  font-weight: 500;
}

.sidebar-date {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
  width: calc(100% - var(--sidebar-width));
}

.sidebar.collapsed ~ .main-content {
  margin-left: var(--sidebar-collapsed);
  width: calc(100% - var(--sidebar-collapsed));
}

/* ========================================
   TOPBAR
   ======================================== */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.mobile-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.mobile-menu-btn:hover {
  background: var(--green-50);
  color: var(--green-600);
}

.page-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.breadcrumb-icon {
  color: var(--green-500);
  font-size: 15px;
}

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

.topbar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 15px;
  transition: all var(--transition-fast);
  position: relative;
}

.topbar-btn:hover {
  background: var(--green-50);
  color: var(--green-600);
}

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning);
  border: 1.5px solid white;
  animation: pulse 2s infinite;
}

.topbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 4px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.topbar-user:hover { background: var(--green-50); }

.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green-500), var(--green-300));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  font-family: 'Poppins', sans-serif;
}

.topbar-username {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ========================================
   PAGE SECTIONS
   ======================================== */
.page-section {
  display: none;
  padding: 28px 28px 40px;
  flex: 1;
  animation: fadeInUp 0.3s ease forwards;
}

.page-section.active { display: flex; flex-direction: column; gap: 24px; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.3;
}

.page-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

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

/* ========================================
   BUTTONS
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--green-500), var(--green-600));
  color: white;
  box-shadow: var(--shadow-green);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--green-400), var(--green-500));
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(62,139,81,0.35);
}

.btn-outline {
  background: white;
  color: var(--text-secondary);
  border: 1.5px solid var(--border-strong);
}

.btn-outline:hover {
  background: var(--green-50);
  border-color: var(--green-400);
  color: var(--green-700);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12.5px;
}

.btn-white {
  background: white;
  color: var(--green-700);
  font-weight: 600;
}

.btn-white:hover {
  background: var(--green-50);
}

/* ========================================
   STAT CARDS (Dashboard)
   ======================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  cursor: default;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--green-200);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
  flex-shrink: 0;
}

.bg-green {
  background: linear-gradient(135deg, var(--green-400), var(--green-600));
  box-shadow: 0 4px 16px rgba(76,175,80,0.35);
}

.bg-blue {
  background: linear-gradient(135deg, #60A5FA, #3B82F6);
  box-shadow: 0 4px 16px rgba(59,130,246,0.3);
}

.bg-yellow {
  background: linear-gradient(135deg, #FCD34D, #F59E0B);
  box-shadow: 0 4px 16px rgba(245,158,11,0.3);
}

.bg-purple {
  background: linear-gradient(135deg, #A78BFA, #8B5CF6);
  box-shadow: 0 4px 16px rgba(139,92,246,0.3);
}

.stat-content { flex: 1; }

.stat-number {
  font-family: 'Poppins', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.stat-change {
  font-size: 11.5px;
  margin-top: 6px;
  font-weight: 500;
}

.stat-change.neutral { color: var(--text-muted); }
.stat-change.up { color: var(--success); }
.stat-change.warn { color: var(--warning); }

/* ========================================
   CHART CARDS (Dashboard)
   ======================================== */
.empty-chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.chart-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.chart-period {
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.chart-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 140px;
  color: var(--text-muted);
  background: var(--bg-card-alt);
  border-radius: var(--radius-md);
  border: 1.5px dashed var(--border);
}

.chart-empty-state i { font-size: 28px; color: var(--green-300); }
.chart-empty-state p { font-size: 12px; text-align: center; max-width: 200px; }

/* ========================================
   REMINDER ALERT
   ======================================== */
.reminder-alert {
  background: linear-gradient(135deg, #1E3A20, #2A5230);
  border: 1px solid rgba(168,213,162,0.2);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: white;
  box-shadow: var(--shadow-green);
  animation: slideIn 0.4s ease;
}

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

.reminder-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: rgba(168,213,162,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--green-200);
  flex-shrink: 0;
}

.reminder-content {
  flex: 1;
  font-size: 13.5px;
  color: rgba(255,255,255,0.85);
}

.reminder-content strong {
  color: var(--green-200);
  font-weight: 700;
}

/* ========================================
   COMING SOON CARD
   ======================================== */
.coming-soon-card {
  background: var(--bg-card);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 60px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  flex: 1;
}

.cs-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-xl);
  background: var(--green-50);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--green-500);
  margin-bottom: 6px;
}

.cs-icon.urgent-icon { background: #FFF9EB; color: var(--warning); }

.coming-soon-card h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.coming-soon-card p {
  font-size: 13.5px;
  color: var(--text-muted);
  max-width: 360px;
  line-height: 1.6;
}

.phase-badge {
  display: inline-block;
  background: var(--green-50);
  color: var(--green-700);
  border: 1px solid var(--green-200);
  border-radius: var(--radius-full);
  padding: 5px 16px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
}

/* ========================================
   TOAST NOTIFICATION
   ======================================== */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--text-primary);
  color: white;
  padding: 13px 20px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  z-index: 9999;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast i { color: var(--warning); }

/* ========================================
   SIDEBAR OVERLAY (mobile)
   ======================================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 999;
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity var(--transition);
}

.sidebar-overlay.show {
  opacity: 1;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
  .empty-chart-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
    transition: transform var(--transition);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-overlay { display: block; }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .topbar { padding: 0 16px; }

  .mobile-menu-btn { display: flex; }

  .page-section { padding: 20px 16px 32px; }

  .stats-grid { grid-template-columns: 1fr 1fr; }

  .page-header { flex-direction: column; align-items: flex-start; }

  .page-title { font-size: 18px; }

  .sidebar-toggle { display: none; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar-username { display: none; }
}

/* ========================================
   SCROLLBAR
   ======================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--green-300); }

/* ========================================
   DASHBOARD – PHASE 2
   ======================================== */

/* Dashboard Header */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.dash-greeting {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dash-greeting-icon {
  font-size: 32px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

/* Overdue Banner */
.overdue-banner {
  background: linear-gradient(135deg, #7f1d1d, #991b1b);
  border: 1px solid rgba(255,100,100,0.25);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: white;
  box-shadow: 0 4px 20px rgba(153,27,27,0.3);
  animation: slideIn 0.4s ease;
  flex-wrap: wrap;
}

.overdue-banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
}

.overdue-banner-left i {
  font-size: 16px;
  color: #FCA5A5;
}

.overdue-banner-left strong {
  color: #FCA5A5;
}

.overdue-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #F87171;
  flex-shrink: 0;
  animation: overdueAnim 1.2s ease-in-out infinite;
}

@keyframes overdueAnim {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248,113,113,0.7); }
  50% { box-shadow: 0 0 0 8px rgba(248,113,113,0); }
}

/* Stat Card sparkline area */
.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-sparkline {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 90px;
  height: 50px;
  opacity: 0.4;
}

.stat-card.highlight-warn {
  border-color: rgba(245,158,11,0.4);
  background: linear-gradient(135deg, #fffbeb, #ffffff);
}

/* Button Danger */
.btn-danger {
  background: rgba(255,255,255,0.2);
  color: white;
  border: 1.5px solid rgba(255,255,255,0.3);
  backdrop-filter: blur(4px);
}

.btn-danger:hover {
  background: rgba(255,255,255,0.3);
  transform: translateY(-1px);
}

/* ========================================
   CHARTS ROW
   ======================================== */
.chart-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

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

.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}

.chart-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.chart-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.chart-canvas-wrap {
  position: relative;
  width: 100%;
}

.donut-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 180px;
}

.chart-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  flex-shrink: 0;
}

.chart-tab {
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.chart-tab.active {
  background: white;
  color: var(--green-700);
  box-shadow: var(--shadow-sm);
}

.chart-tab:hover:not(.active) {
  color: var(--text-primary);
}

/* Donut legend */
.segment-legend {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

.legend-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-pct {
  font-weight: 600;
  color: var(--text-primary);
}

/* ========================================
   BOTTOM ROW
   ======================================== */
.bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dash-card-header h3 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 7px;
}

.dash-card-header h3 i {
  color: var(--green-500);
  font-size: 13px;
}

.dash-card-link {
  font-size: 12px;
  color: var(--green-600);
  font-weight: 600;
  transition: color var(--transition-fast);
}

.dash-card-link:hover { color: var(--green-400); }

/* Follow Up List */
.followup-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fu-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card-alt);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.fu-item:hover {
  border-color: var(--green-200);
  background: var(--green-50);
}

.fu-item.overdue {
  border-color: rgba(239,68,68,0.3);
  background: #FFF5F5;
}

.fu-item.today {
  border-color: rgba(245,158,11,0.3);
  background: #FFFBEB;
}

.fu-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

.fu-dot.red { background: var(--danger); }
.fu-dot.yellow { background: var(--warning); }
.fu-dot.green { background: var(--success); }

.fu-body { flex: 1; min-width: 0; }

.fu-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fu-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.fu-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
}

.fu-tag.overdue { background: #FEE2E2; color: #B91C1C; }
.fu-tag.today { background: #FEF3C7; color: #92400E; }
.fu-tag.upcoming { background: var(--green-50); color: var(--green-700); }

/* Pipeline Snapshot */
.pipeline-snap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pipeline-stage {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stage-label {
  font-size: 12px;
  color: var(--text-secondary);
  width: 90px;
  flex-shrink: 0;
}

.stage-bar-wrap {
  flex: 1;
  height: 20px;
  background: var(--bg-card-alt);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border);
}

.stage-bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 1s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
}

.stage-count {
  font-size: 10.5px;
  font-weight: 700;
  color: white;
}

.stage-bar.new-lead { background: linear-gradient(90deg, #60A5FA, #3B82F6); }
.stage-bar.contacted { background: linear-gradient(90deg, #FCD34D, #F59E0B); }
.stage-bar.negotiation { background: linear-gradient(90deg, #C084FC, #8B5CF6); }
.stage-bar.closing { background: linear-gradient(90deg, #4ADE80, #16A34A); }

/* Activity Feed */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 1px;
}

.activity-icon.green { background: var(--green-50); color: var(--green-600); }
.activity-icon.blue  { background: #EFF6FF; color: #3B82F6; }
.activity-icon.yellow { background: #FFFBEB; color: #D97706; }
.activity-icon.red   { background: #FFF5F5; color: #DC2626; }
.activity-icon.purple { background: #F5F3FF; color: #7C3AED; }

.activity-body { flex: 1; min-width: 0; }

.activity-text {
  font-size: 12.5px;
  color: var(--text-primary);
  line-height: 1.4;
}

.activity-text strong { font-weight: 600; }

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ========================================
   RESPONSIVE – DASHBOARD ADDITIONS
   ======================================== */
@media (max-width: 1200px) {
  .chart-row {
    grid-template-columns: 1fr;
  }
  .bottom-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  .bottom-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .chart-row {
    grid-template-columns: 1fr;
  }
  .dash-header {
    flex-direction: column;
    align-items: flex-start;
  }
}


/* ========================================
   DATABASE PELANGGAN – PHASE 3
   ======================================== */

/* Mini Stats Bar */
.cust-stats-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  box-shadow: var(--shadow-sm);
}
.cust-stat-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: var(--radius-full);
  background: var(--bg-card-alt); border: 1px solid var(--border);
  font-size: 12.5px; cursor: pointer;
  transition: all var(--transition-fast);
}
.cust-stat-pill:hover { border-color: var(--green-300); background: var(--green-50); }
.cust-stat-pill i { font-size: 11px; }
.csp-num   { font-weight: 700; font-family: 'Poppins',sans-serif; font-size: 14px; color: var(--text-primary); }
.csp-label { color: var(--text-muted); font-size: 11.5px; }
.csp-divider { width:1px; height:24px; background: var(--border); margin: 0 4px; }
.cust-stat-pill.hot   { border-color:rgba(239,68,68,.25);  background:#FFF5F5; }
.cust-stat-pill.hot i { color:#EF4444; }
.cust-stat-pill.warm  { border-color:rgba(245,158,11,.25); background:#FFFBEB; }
.cust-stat-pill.warm i{ color:#F59E0B; }
.cust-stat-pill.cold  { border-color:rgba(59,130,246,.25); background:#EFF6FF; }
.cust-stat-pill.cold i{ color:#3B82F6; }
.cust-stat-pill.status-nl  { border-color:rgba(99,102,241,.2); }
.cust-stat-pill.status-fu  { border-color:rgba(245,158,11,.25); }
.cust-stat-pill.status-neg { border-color:rgba(139,92,246,.25); }
.cust-stat-pill.status-cl  { border-color:rgba(34,197,94,.25); }

/* Toolbar */
.cust-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.cust-search-wrap {
  flex: 1; min-width: 240px; position: relative;
  display: flex; align-items: center;
}
.cust-search-wrap > i {
  position: absolute; left: 13px; color: var(--text-muted);
  font-size: 14px; pointer-events: none;
}
.cust-search {
  width: 100%; height: 40px; padding: 0 36px 0 38px;
  border: 1.5px solid var(--border); border-radius: var(--radius-md);
  background: var(--bg-card); font-size: 13.5px;
  font-family: 'Inter',sans-serif; color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}
.cust-search:focus {
  border-color: var(--green-400);
  box-shadow: 0 0 0 3px rgba(76,175,80,.12);
}
.cust-search::placeholder { color: var(--text-muted); }
.cust-search-clear {
  position: absolute; right: 10px; color: var(--text-muted);
  font-size: 13px; transition: color var(--transition-fast);
}
.cust-search-clear:hover { color: var(--text-primary); }
.cust-filters { display: flex; gap: 8px; flex-wrap: wrap; }

.filter-select, .sort-select {
  height: 40px; padding: 0 28px 0 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-md);
  background: var(--bg-card); font-size: 13px;
  font-family: 'Inter',sans-serif; color: var(--text-secondary);
  cursor: pointer; outline: none;
  transition: border-color var(--transition-fast);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238FA98F' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.filter-select:focus, .sort-select:focus { border-color: var(--green-400); }

.cust-view-toggle {
  display: flex; gap: 4px;
  background: var(--bg-card-alt); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 4px;
}
.view-btn {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
}
.view-btn.active { background: white; color: var(--green-700); box-shadow: var(--shadow-sm); }
.view-btn:hover:not(.active) { color: var(--text-primary); }

.cust-meta-row {
  display: flex; align-items: center;
  justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.cust-count { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.cust-sort  { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); }

/* Table */
.cust-table-wrap {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm);
}
.cust-table { width: 100%; border-collapse: collapse; }
.cust-table thead { background: var(--bg-card-alt); border-bottom: 1px solid var(--border); }
.cust-table th {
  padding: 12px 14px; text-align: left;
  font-size: 11.5px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px; white-space: nowrap;
}
.cust-table th:first-child { width: 40px; text-align: center; }
.cust-table td {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text-primary); vertical-align: middle;
}
.cust-table tbody tr { transition: background var(--transition-fast); cursor: pointer; }
.cust-table tbody tr:hover { background: var(--green-50); }
.cust-table tbody tr:last-child td { border-bottom: none; }

.cust-name-cell { display: flex; align-items: center; gap: 10px; }
.cust-avatar-sm {
  width: 34px; height: 34px; border-radius: var(--radius-full);
  background: linear-gradient(135deg,var(--green-400),var(--green-600));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white;
  font-family: 'Poppins',sans-serif; flex-shrink: 0;
}
.cust-name-text { font-weight: 600; font-size: 13px; color: var(--text-primary); }
.cust-hp-text   { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

/* Status & Suhu chips */
.status-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.status-chip.new-lead    { background:#EFF6FF; color:#1D4ED8; border:1px solid #BFDBFE; }
.status-chip.follow-up   { background:#FEF9C3; color:#A16207; border:1px solid #FDE68A; }
.status-chip.negotiation { background:#F5F3FF; color:#6D28D9; border:1px solid #DDD6FE; }
.status-chip.closing     { background:#F0FDF4; color:#15803D; border:1px solid #BBF7D0; }
.status-chip.lost        { background:#FFF1F2; color:#BE123C; border:1px solid #FECDD3; }

.suhu-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--radius-full); font-size: 11px; font-weight: 600;
}
.suhu-chip.hot  { background:#FFF5F5; color:#C53030; border:1px solid #FED7D7; }
.suhu-chip.warm { background:#FFFBEB; color:#92400E; border:1px solid #FDE68A; }
.suhu-chip.cold { background:#EFF6FF; color:#1E40AF; border:1px solid #BFDBFE; }

.segmen-chip { font-size: 12px; color: var(--text-secondary); }

.tbl-actions { display: flex; gap:6px; }
.tbl-btn {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; border: 1px solid var(--border);
  background: white; color: var(--text-muted); transition: all var(--transition-fast);
}
.tbl-btn:hover     { border-color:var(--green-300); color:var(--green-600); background:var(--green-50); }
.tbl-btn.del:hover { border-color:#FECACA; color:#DC2626; background:#FFF5F5; }
.tbl-btn.wa:hover  { border-color:#86EFAC; color:#15803D; background:#F0FDF4; }

.cust-empty {
  padding: 60px 32px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.cust-empty-icon {
  width:72px; height:72px; background:var(--green-50);
  border-radius: var(--radius-xl);
  display:flex; align-items:center; justify-content:center;
  font-size:28px; color:var(--green-400); margin-bottom:4px;
}
.cust-empty h3 { font-size:16px; font-weight:700; color:var(--text-primary); }
.cust-empty p  { font-size:13px; color:var(--text-muted); max-width:300px; }

/* Card Grid */
.cust-card-grid {
  display: grid; grid-template-columns: repeat(auto-fill,minmax(280px,1fr)); gap: 16px;
}
.cust-card {
  background:var(--bg-card); border:1px solid var(--border);
  border-radius:var(--radius-lg); padding:18px; box-shadow:var(--shadow-sm);
  cursor:pointer; transition:all var(--transition);
  display:flex; flex-direction:column; gap:12px;
}
.cust-card:hover { transform:translateY(-3px); box-shadow:var(--shadow-md); border-color:var(--green-200); }
.cust-card-top { display:flex; align-items:flex-start; gap:12px; }
.cust-avatar-lg {
  width:46px; height:46px; border-radius:var(--radius-full);
  background:linear-gradient(135deg,var(--green-400),var(--green-600));
  display:flex; align-items:center; justify-content:center;
  font-size:18px; font-weight:700; color:white; font-family:'Poppins',sans-serif; flex-shrink:0;
}
.cust-card-name { font-weight:700; font-size:14px; color:var(--text-primary); }
.cust-card-biz  { font-size:12px; color:var(--text-muted); margin-top:2px; }
.cust-card-badges { display:flex; gap:6px; flex-wrap:wrap; }
.cust-card-meta { display:flex; flex-direction:column; gap:5px; }
.cust-card-meta-row {
  display:flex; align-items:center; gap:8px; font-size:12px; color:var(--text-muted);
}
.cust-card-meta-row i { width:14px; text-align:center; color:var(--green-400); }
.cust-card-footer {
  display:flex; justify-content:space-between; align-items:center;
  padding-top:10px; border-top:1px solid var(--border);
}
.cust-card-date    { font-size:11px; color:var(--text-muted); }
.cust-card-actions { display:flex; gap:6px; }

/* Modal */
.modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,.45);
  backdrop-filter:blur(4px); z-index:2000;
  display:flex; align-items:center; justify-content:center;
  padding:20px; opacity:0; pointer-events:none;
  transition:opacity .25s ease;
}
.modal-overlay.open { opacity:1; pointer-events:all; }
.modal-box {
  background:white; border-radius:var(--radius-xl);
  width:100%; max-width:680px; max-height:90vh;
  display:flex; flex-direction:column; box-shadow:0 24px 80px rgba(0,0,0,.2);
  transform:translateY(20px) scale(.97);
  transition:transform .25s cubic-bezier(.4,0,.2,1);
}
.modal-overlay.open .modal-box { transform:translateY(0) scale(1); }
.modal-header {
  padding:22px 24px 18px; border-bottom:1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; flex-shrink:0;
}
.modal-title-wrap { display:flex; align-items:center; gap:12px; }
.modal-icon {
  width:42px; height:42px; border-radius:var(--radius-md);
  background:linear-gradient(135deg,var(--green-400),var(--green-600));
  display:flex; align-items:center; justify-content:center;
  font-size:17px; color:white; box-shadow:var(--shadow-green);
}
.modal-title { font-size:17px; font-weight:700; color:var(--text-primary); }
.modal-sub   { font-size:12.5px; color:var(--text-muted); margin-top:1px; }
.modal-close {
  width:34px; height:34px; border-radius:var(--radius-sm);
  color:var(--text-muted); font-size:15px;
  display:flex; align-items:center; justify-content:center;
  transition:all var(--transition-fast);
}
.modal-close:hover { background:var(--green-50); color:var(--text-primary); }
.modal-body   { padding:22px 24px; overflow-y:auto; flex:1; }
.modal-footer {
  padding:16px 24px; border-top:1px solid var(--border);
  display:flex; justify-content:flex-end; gap:10px; flex-shrink:0;
}

/* Form */
.form-section-label {
  font-size:11px; font-weight:700; letter-spacing:1px;
  text-transform:uppercase; color:var(--text-muted);
  margin:18px 0 12px; padding-bottom:8px; border-bottom:1px solid var(--border);
}
.form-section-label:first-child { margin-top:0; }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.form-group { display:flex; flex-direction:column; gap:5px; }
.form-group label { font-size:13px; font-weight:600; color:var(--text-secondary); }
.form-group.required label::after { content:' *'; color:var(--danger); }
.optional { font-weight:400; color:var(--text-muted); font-size:11.5px; }
.form-group input:not([type=radio]),
.form-group select,
.form-group textarea {
  width:100%; padding:9px 12px;
  border:1.5px solid var(--border); border-radius:var(--radius-md);
  font-size:13.5px; font-family:'Inter',sans-serif; color:var(--text-primary);
  background:var(--bg-card); outline:none; resize:vertical;
  transition:border-color var(--transition-fast),box-shadow var(--transition-fast);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color:var(--green-400); box-shadow:0 0 0 3px rgba(76,175,80,.12); }
.form-group input.err, .form-group select.err { border-color:var(--danger); }
.form-err { font-size:11.5px; color:var(--danger); min-height:16px; }

.input-with-icon {
  display:flex; align-items:stretch;
  border:1.5px solid var(--border); border-radius:var(--radius-md);
  overflow:hidden; transition:border-color var(--transition-fast),box-shadow var(--transition-fast);
}
.input-with-icon:focus-within { border-color:var(--green-400); box-shadow:0 0 0 3px rgba(76,175,80,.12); }
.input-prefix {
  padding:0 12px; background:var(--bg-card-alt); font-size:13px;
  font-weight:600; color:var(--text-muted); border-right:1px solid var(--border);
  display:flex; align-items:center;
}
.input-with-icon input { border:none!important; box-shadow:none!important; flex:1; border-radius:0!important; }

/* Suhu Picker */
.suhu-picker { display:flex; gap:8px; }
.suhu-opt {
  flex:1; display:flex; align-items:center; justify-content:center; gap:6px;
  padding:8px 6px; border:1.5px solid var(--border); border-radius:var(--radius-md);
  cursor:pointer; font-size:13px; font-weight:600; user-select:none;
  transition:all var(--transition-fast);
}
.suhu-opt input { display:none; }
.suhu-opt.hot  { color:#C53030; }
.suhu-opt.warm { color:#92400E; }
.suhu-opt.cold { color:#1E40AF; }
.suhu-opt:has(input:checked).hot  { background:#FFF5F5; border-color:#FC8181; }
.suhu-opt:has(input:checked).warm { background:#FFFBEB; border-color:#FCD34D; }
.suhu-opt:has(input:checked).cold { background:#EFF6FF; border-color:#93C5FD; }
.suhu-opt:hover { border-color:var(--green-300); }

/* Tag input */
.tag-input-wrap {
  border:1.5px solid var(--border); border-radius:var(--radius-md);
  padding:6px 10px; display:flex; flex-wrap:wrap; gap:6px;
  align-items:center; min-height:44px; cursor:text; background:white;
  transition:border-color var(--transition-fast);
}
.tag-input-wrap:focus-within { border-color:var(--green-400); box-shadow:0 0 0 3px rgba(76,175,80,.12); }
.tag-input-wrap input { border:none!important; outline:none; font-size:13px; flex:1; min-width:100px; padding:2px 0!important; box-shadow:none!important; }
.tag-chip {
  display:inline-flex; align-items:center; gap:5px;
  background:var(--green-50); border:1px solid var(--green-200);
  color:var(--green-700); padding:2px 8px;
  border-radius:var(--radius-full); font-size:12px; font-weight:600;
}
.tag-chip-del { cursor:pointer; font-size:10px; color:var(--green-500); transition:color var(--transition-fast); }
.tag-chip-del:hover { color:var(--danger); }
.tag-suggestions { display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; }
.tag-sug {
  padding:3px 10px; border-radius:var(--radius-full); font-size:11.5px;
  font-weight:500; color:var(--text-muted); border:1px solid var(--border);
  cursor:pointer; transition:all var(--transition-fast);
}
.tag-sug:hover { background:var(--green-50); border-color:var(--green-300); color:var(--green-700); }

/* Detail Panel */
.detail-panel {
  position:fixed; top:0; right:0; width:360px; height:100vh;
  background:white; box-shadow:-8px 0 32px rgba(0,0,0,.14);
  z-index:1500; display:flex; flex-direction:column;
  transform:translateX(100%); transition:transform .3s cubic-bezier(.4,0,.2,1);
}
.detail-panel.open { transform:translateX(0); }
.detail-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,.3); z-index:1499;
  opacity:0; pointer-events:none; transition:opacity .3s ease; backdrop-filter:blur(2px);
}
.detail-overlay.show { opacity:1; pointer-events:all; }
.detail-header {
  padding:22px 20px 18px;
  background:linear-gradient(135deg,var(--green-800),var(--green-700));
  display:flex; align-items:flex-start; gap:14px; flex-shrink:0;
}
.detail-avatar {
  width:54px; height:54px; border-radius:var(--radius-full);
  background:rgba(255,255,255,.2); border:2px solid rgba(255,255,255,.3);
  display:flex; align-items:center; justify-content:center;
  font-size:22px; font-weight:700; color:white; font-family:'Poppins',sans-serif; flex-shrink:0;
}
.detail-info { flex:1; }
.detail-info h3 { font-size:15px; font-weight:700; color:white; line-height:1.3; }
.detail-info p  { font-size:12.5px; color:rgba(255,255,255,.7); margin-top:2px; }
.detail-badges  { display:flex; gap:6px; flex-wrap:wrap; margin-top:8px; }
.detail-close {
  width:30px; height:30px; border-radius:var(--radius-sm);
  background:rgba(255,255,255,.15); color:white; font-size:13px;
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0; transition:background var(--transition-fast);
}
.detail-close:hover { background:rgba(255,255,255,.25); }
.detail-body { flex:1; overflow-y:auto; padding:20px; display:flex; flex-direction:column; gap:16px; }
.dp-section { display:flex; flex-direction:column; gap:8px; }
.dp-section-title {
  font-size:10.5px; font-weight:700; letter-spacing:1px;
  text-transform:uppercase; color:var(--text-muted);
  padding-bottom:6px; border-bottom:1px solid var(--border);
}
.dp-row { display:flex; align-items:flex-start; gap:10px; font-size:13px; }
.dp-row i   { width:16px; text-align:center; color:var(--green-500); margin-top:2px; }
.dp-label   { color:var(--text-muted); min-width:90px; font-size:12px; }
.dp-val     { color:var(--text-primary); font-weight:500; flex:1; }
.dp-notes {
  background:var(--bg-card-alt); border:1px solid var(--border);
  border-radius:var(--radius-md); padding:12px;
  font-size:13px; color:var(--text-secondary); line-height:1.6;
}
.detail-footer { padding:16px 20px; border-top:1px solid var(--border); display:flex; gap:8px; flex-shrink:0; }

/* Responsive */
@media(max-width:768px) {
  .form-grid { grid-template-columns:1fr; }
  .cust-toolbar { flex-direction:column; align-items:stretch; }
  .cust-filters { flex-direction:column; }
  .detail-panel { width:100%; }
  .cust-stats-bar { gap:6px; padding:10px 12px; }
}
@media(max-width:480px) {
  .suhu-picker { flex-direction:column; }
}



/* ========================================
   FOLLOW UP MODULE
   ======================================== */

.fu-tabs {
  display: flex; gap: 8px; margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}
.fu-tab {
  padding: 8px 16px; border-radius: var(--radius-full);
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  background: var(--bg-card); border: 1px solid var(--border);
  transition: all var(--transition-fast);
}
.fu-tab:hover { background: var(--green-50); color: var(--green-600); }
.fu-tab.active {
  background: var(--green-600); color: white; border-color: var(--green-600);
  box-shadow: var(--shadow-sm);
}

.fu-page-list { display: flex; flex-direction: column; gap: 12px; }

.fup-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 20px;
  display: flex; align-items: flex-start; gap: 16px;
  box-shadow: var(--shadow-sm); transition: all var(--transition);
}
.fup-card:hover { box-shadow: var(--shadow-md); transform: translateX(2px); }

.fup-card.overdue { border-left-color: var(--danger); }
.fup-card.today   { border-left-color: var(--warning); }
.fup-card.upcoming{ border-left-color: var(--green-400); }

.fup-card.done {
  opacity: 0.6; border-left-color: var(--border);
}

.fup-check {
  font-size: 20px; color: var(--border-strong); cursor: pointer;
  transition: color var(--transition-fast); flex-shrink: 0; margin-top: 2px;
}
.fup-check:hover { color: var(--green-400); }
.fup-card.done .fup-check { color: var(--success); }

.fup-content { flex: 1; min-width: 0; }
.fup-card.done .fup-content { text-decoration: line-through; }

.fup-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 6px; flex-wrap: wrap;
}

.fup-cust {
  font-size: 14px; color: var(--text-primary);
  cursor: pointer; transition: color var(--transition-fast);
}
.fup-cust strong { color: var(--green-700); }
.fup-cust:hover strong { color: var(--green-500); text-decoration: underline; }

.fup-badges { display: flex; gap: 6px; }
.fup-badge {
  font-size: 10px; font-weight: 600; padding: 2px 8px;
  border-radius: var(--radius-full);
}
.badge-danger  { background: #FEE2E2; color: #DC2626; }
.badge-warning { background: #FEF3C7; color: #D97706; }
.badge-info    { background: #E0E7FF; color: #4F46E5; }

.fup-meta {
  font-size: 12.5px; color: var(--text-secondary);
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}

.fup-notes {
  font-size: 12.5px; color: var(--text-muted);
  background: var(--bg-base); padding: 8px 12px;
  border-radius: var(--radius-md); border: 1px dashed var(--border);
}

.fup-actions { display: flex; gap: 6px; margin-top: 4px; }
.text-danger  { color: var(--danger) !important; font-weight: 600; }
.text-warning { color: var(--warning) !important; font-weight: 600; }

/* ========================================
   KANBAN PIPELINE MODULE
   ======================================== */

.kanban-board-wrapper {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 24px;
}

.kanban-board {
  display: flex;
  gap: 16px;
  height: 100%;
  min-height: 500px;
  align-items: flex-start;
}

.knb-column {
  width: 320px;
  min-width: 320px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: 100%;
  box-shadow: var(--shadow-sm);
}

.knb-col-header {
  padding: 14px 16px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.knb-col-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.knb-col-count {
  font-size: 11px;
  font-weight: 700;
  background: white;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.knb-col-body {
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  transition: background var(--transition-fast);
}

.knb-col-body.drag-over {
  background: var(--green-50);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Kanban Cards */
.knb-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.knb-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--green-200);
}

.knb-card:active {
  cursor: grabbing;
}

.knb-card.dragging {
  opacity: 0.5;
  transform: scale(0.98);
}

.knb-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
}

.knb-card-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.knb-card-biz {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.knb-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.knb-tag {
  font-size: 10px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.knb-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: auto;
}

.knb-date {
  font-size: 11px;
  color: var(--text-muted);
}

/* ========================================
   TEMPLATES & AI MAGIC WRITER MODULE
   ======================================== */

.tpl-grid {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
  align-items: flex-start;
}

.tpl-panel-left {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.tpl-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tpl-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--bg-card-alt);
  transition: all var(--transition-fast);
}

.tpl-card:hover {
  border-color: var(--green-300);
}

.tpl-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tpl-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.tpl-seg {
  font-size: 10px;
  background: var(--green-50);
  color: var(--green-600);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.tpl-body {
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-base);
  padding: 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-family: monospace;
}

.tpl-acts {
  display: flex;
  gap: 12px;
}
.tpl-acts button {
  background: none; border: none; font-size: 12.5px;
  font-weight: 500; color: var(--green-600); cursor: pointer;
}
.tpl-acts button:hover { text-decoration: underline; }

/* AI BOX */
.ai-box {
  background: linear-gradient(135deg, #2E1A47 0%, #150C21 100%);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.ai-box label { color: rgba(255, 255, 255, 0.9); }
.ai-box input, .ai-box select, .ai-box textarea {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.2);
  color: white;
}
.ai-box input:focus, .ai-box select:focus, .ai-box textarea:focus {
  border-color: #A855F7;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

.ai-box-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  background: linear-gradient(to right, #A855F7, #EC4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-btn {
  background: linear-gradient(135deg, #9333ea, #db2777);
  border: none;
  color: white;
  box-shadow: 0 4px 15px rgba(219, 39, 119, 0.3);
}

.ai-btn:hover {
  background: linear-gradient(135deg, #a855f7, #f472b6);
  transform: translateY(-1px);
}

.ai-output-area {
  background: rgba(0,0,0,0.3);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(255,255,255,0.2);
}

@media(max-width:900px) {
  .tpl-grid { grid-template-columns: 1fr; }
}

/* ========================================
   ACTIVITY HISTORY MODULE
   ======================================== */
.act-sidebar {
  position: fixed; top: 0; right: -400px; width: 400px; max-width: 100vw; height: 100vh;
  background: var(--bg-card); z-index: 1000; transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -4px 0 24px rgba(0,0,0,0.1); display: flex; flex-direction: column;
}
.act-sidebar.open { right: 0; }
.act-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.4); z-index: 999; opacity: 0; pointer-events: none; transition: 0.3s; }
.act-overlay.show { opacity: 1; pointer-events: auto; }

.act-item { display: flex; gap: 16px; margin-bottom: 20px; }
.act-icon { 
  width: 36px; height: 36px; border-radius: 50%; background: #e0f2fe; color: #0ea5e9;
  display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0;
}
.act-content { flex: 1; border-bottom: 1px solid var(--border-light); padding-bottom: 12px; }
.act-item:last-child .act-content { border-bottom: none; }
.act-content .act-header { padding: 0; border: none; display: block; font-size: 13.5px; color: var(--text-primary); font-weight: 400; }
.act-content .act-header strong { font-weight: 600; color: var(--text-primary); }
.act-details { font-size: 13px; color: var(--text-secondary); margin-top: 4px; line-height: 1.4; }
.act-time { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* ========================================
   SETTINGS PAGE MODULE
   ======================================== */
.settings-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.settings-card-header {
  padding: 20px 24px;
  background: var(--bg-card-alt);
  border-bottom: 1px solid var(--border);
}

.settings-card-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-card-header h3 i {
  color: var(--primary);
}

.settings-card-header p {
  font-size: 12.5px;
  color: var(--text-secondary);
}

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

.setting-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.setting-tag-item {
  background: var(--bg-base);
  border: 1px solid var(--border-strong);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-primary);
  font-weight: 500;
}

.tag-del-btn {
  color: var(--text-muted);
  font-size: 12px;
  transition: color 0.1s;
}

.tag-del-btn:hover {
  color: var(--danger);
}

.settings-card .form-group label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: block;
}

.settings-card .form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: var(--bg-card-alt);
}

.settings-card .form-group input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

/* ========================================
   LOGIN SCREEN
   ======================================== */
#loginScreen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}
#loginScreen.hidden {
  display: none !important;
}
.login-box {
  background: white;
  width: 100%;
  max-width: 400px;
  padding: 40px 30px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  text-align: center;
}
.login-logo {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--green-400), var(--green-600));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  margin: 0 auto 20px;
  box-shadow: var(--shadow-green);
}
.login-title {
  font-family: 'Poppins', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 5px;
}
.login-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 30px;
}
.login-form {
  text-align: left;
}
.login-btn {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  margin-top: 10px;
}
.login-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 15px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  padding: 10px;
  border-radius: var(--radius-sm);
  display: none;
}
