/* ============================================================
   BimaSphere – CIC Insurance Group
   Master Stylesheet
   ============================================================ */

:root {
  --primary: #1a5276;
  --primary-light: #2980b9;
  --primary-dark: #154360;
  --accent: #e67e22;
  --accent-light: #f0a500;
  --success: #27ae60;
  --danger: #e74c3c;
  --warning: #f39c12;
  --info: #2980b9;
  --purple: #8e44ad;
  --teal: #16a085;
  --sidebar-width: 260px;
  --sidebar-collapsed: 64px;
  --topbar-height: 60px;
  --bg: #f0f2f5;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #2d3748;
  --text-muted: #718096;
  --text-light: #a0aec0;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --radius: 8px;
  --radius-lg: 12px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: var(--font); color: var(--text); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-body { background: var(--bg); }

.login-bg {
  display: flex;
  min-height: 100vh;
}

.login-card {
  width: 440px;
  min-width: 440px;
  background: var(--card);
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 4px 0 24px rgba(0,0,0,0.08);
  z-index: 2;
}

.login-info-panel {
  flex: 1;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: white;
}

.info-content h1 { font-size: 2rem; font-weight: 700; margin-bottom: 16px; line-height: 1.3; }
.info-content > p { font-size: 1.05rem; opacity: 0.85; margin-bottom: 32px; }

.login-features { list-style: none; margin-bottom: 32px; }
.login-features li { padding: 8px 0; display: flex; align-items: center; gap: 12px; font-size: 0.95rem; opacity: 0.9; }
.login-features li i { color: #52be80; font-size: 1rem; }

.login-entities { display: flex; flex-wrap: wrap; gap: 8px; }
.login-entities span {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
}

.login-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 32px; }
.logo-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1.4rem;
}
.logo-text { display: flex; flex-direction: column; }
.logo-main { font-size: 1.5rem; font-weight: 700; color: var(--primary); letter-spacing: -0.5px; }
.logo-sub { font-size: 0.78rem; color: var(--text-muted); letter-spacing: 0.5px; text-transform: uppercase; }

.login-title { font-size: 1.35rem; font-weight: 600; margin-bottom: 6px; }
.login-desc { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 28px; }

.login-form .form-group { margin-bottom: 18px; }
.login-form label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-control {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem; font-family: var(--font);
  color: var(--text); background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(41,128,185,0.15); }
select.form-control { cursor: pointer; }

.input-icon-wrap { position: relative; }
.input-icon-wrap .form-control { padding-right: 42px; }
.input-icon { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); cursor: pointer; color: var(--text-muted); }

.login-options { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; cursor: pointer; }
.forgot-link { font-size: 0.875rem; color: var(--primary-light); text-decoration: none; }
.forgot-link:hover { text-decoration: underline; }

.login-demo-hint {
  margin-top: 20px; padding: 10px 14px;
  background: #ebf5fb; border-radius: var(--radius);
  font-size: 0.82rem; color: var(--primary);
  display: flex; align-items: center; gap: 8px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 500; font-family: var(--font);
  cursor: pointer; border: none; text-decoration: none;
  transition: all 0.2s; line-height: 1.4;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: #cf6d17; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #1e8449; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c0392b; }
.btn-warning { background: var(--warning); color: white; }
.btn-outline { background: white; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 22px; font-size: 0.95rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { padding: 8px; border-radius: var(--radius); }

/* ============================================================
   ALERTS
   ============================================================ */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 0.875rem; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.alert-error { background: #fdf2f2; color: #c0392b; border-left: 3px solid var(--danger); }
.alert-success { background: #f0fff4; color: #1e8449; border-left: 3px solid var(--success); }
.alert-warning { background: #fffbeb; color: #b7770d; border-left: 3px solid var(--warning); }
.alert-info { background: #ebf5fb; color: var(--primary); border-left: 3px solid var(--info); }

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--primary-dark);
  color: white;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  transition: width 0.3s ease;
  z-index: 100;
}

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

.sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  gap: 12px;
  flex-shrink: 0;
}

.sidebar-brand .brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: white; flex-shrink: 0;
}

.sidebar-brand .brand-name {
  font-size: 1.15rem; font-weight: 700; white-space: nowrap;
  overflow: hidden; opacity: 1; transition: opacity 0.2s;
}
.sidebar.collapsed .brand-name { opacity: 0; width: 0; overflow: hidden; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

.nav-section-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.35);
  padding: 12px 20px 4px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.2s;
}
.sidebar.collapsed .nav-section-label { opacity: 0; }

.nav-item {
  position: relative;
}

.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  white-space: nowrap;
  user-select: none;
}
.nav-link:hover { color: white; background: rgba(255,255,255,0.07); }
.nav-link.active { color: white; background: rgba(255,255,255,0.12); border-left-color: var(--accent); }
.nav-link .nav-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-link .nav-label { flex: 1; overflow: hidden; transition: opacity 0.2s; }
.sidebar.collapsed .nav-label { opacity: 0; width: 0; }
.nav-link .nav-arrow { font-size: 0.7rem; transition: transform 0.2s; flex-shrink: 0; }
.nav-link .nav-arrow.open { transform: rotate(90deg); }
.nav-link .nav-badge {
  background: var(--accent); color: white;
  font-size: 0.68rem; padding: 2px 6px; border-radius: 10px;
  font-weight: 600; flex-shrink: 0;
}
.sidebar.collapsed .nav-badge { display: none; }

.nav-submenu {
  background: rgba(0,0,0,0.15);
  max-height: 0; overflow: hidden;
  transition: max-height 0.3s ease;
}
.nav-submenu.open { max-height: 500px; }
.sidebar.collapsed .nav-submenu { display: none; }

.nav-sub-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 20px 8px 48px;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.nav-sub-link:hover { color: white; background: rgba(255,255,255,0.05); }
.nav-sub-link.active { color: white; background: rgba(255,255,255,0.08); }
.nav-sub-link::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,0.35); flex-shrink: 0; }
.nav-sub-link.active::before { background: var(--accent); }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}
.sidebar-user:hover { background: rgba(255,255,255,0.07); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: white;
  flex-shrink: 0;
}
.user-info { overflow: hidden; flex: 1; }
.user-name { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.73rem; color: rgba(255,255,255,0.5); white-space: nowrap; }
.sidebar.collapsed .user-info { display: none; }

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  height: var(--topbar-height);
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  z-index: 50;
}

.topbar-toggle {
  width: 36px; height: 36px;
  background: none; border: none;
  cursor: pointer; color: var(--text-muted);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
  transition: all 0.15s;
}
.topbar-toggle:hover { background: var(--bg); color: var(--text); }

.topbar-breadcrumb {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  font-size: 0.875rem; color: var(--text-muted);
  overflow: hidden;
}
.breadcrumb-item { white-space: nowrap; }
.breadcrumb-item.active { color: var(--text); font-weight: 500; }
.breadcrumb-sep { color: var(--text-light); }

.topbar-search {
  display: flex; align-items: center;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 20px; padding: 6px 14px;
  gap: 8px; transition: border-color 0.2s;
}
.topbar-search:focus-within { border-color: var(--primary-light); background: white; }
.topbar-search i { color: var(--text-muted); font-size: 0.85rem; }
.topbar-search input {
  background: none; border: none; outline: none;
  font-size: 0.875rem; color: var(--text); width: 200px;
  font-family: var(--font);
}

.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.topbar-btn {
  width: 36px; height: 36px;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; position: relative; transition: all 0.15s;
}
.topbar-btn:hover { background: var(--bg); color: var(--text); }
.topbar-badge {
  position: absolute; top: 4px; right: 4px;
  width: 16px; height: 16px;
  background: var(--danger); color: white;
  border-radius: 50%; font-size: 0.62rem;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; border: 2px solid white;
}

.topbar-divider { width: 1px; height: 28px; background: var(--border); }

.topbar-user {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; padding: 6px 10px;
  border-radius: var(--radius); transition: background 0.15s;
}
.topbar-user:hover { background: var(--bg); }
.topbar-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: white;
}
.topbar-user-name { font-size: 0.875rem; font-weight: 500; color: var(--text); }
.topbar-user-role { font-size: 0.75rem; color: var(--text-muted); }

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.page-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header-left { flex: 1; }
.page-title { font-size: 1.4rem; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.page-subtitle { font-size: 0.875rem; color: var(--text-muted); }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.card-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--bg); }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex; align-items: flex-start; gap: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.stat-icon.blue { background: #ebf5fb; color: var(--primary); }
.stat-icon.green { background: #eafaf1; color: var(--success); }
.stat-icon.orange { background: #fef9e7; color: var(--warning); }
.stat-icon.red { background: #fdf2f2; color: var(--danger); }
.stat-icon.purple { background: #f5eef8; color: var(--purple); }
.stat-icon.teal { background: #e8f8f5; color: var(--teal); }

.stat-info { flex: 1; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; }
.stat-trend { font-size: 0.78rem; display: flex; align-items: center; gap: 4px; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }
.stat-trend.neutral { color: var(--text-muted); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--bg); }
th {
  padding: 10px 14px; text-align: left;
  font-size: 0.78rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
td {
  padding: 12px 14px; font-size: 0.875rem;
  border-bottom: 1px solid var(--border); color: var(--text);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

/* ============================================================
   BADGES & TAGS
   ============================================================ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600; white-space: nowrap;
}
.badge-success { background: #eafaf1; color: #1e8449; }
.badge-danger { background: #fdf2f2; color: #c0392b; }
.badge-warning { background: #fffbeb; color: #b7770d; }
.badge-info { background: #ebf5fb; color: var(--primary); }
.badge-purple { background: #f5eef8; color: var(--purple); }
.badge-teal { background: #e8f8f5; color: var(--teal); }
.badge-gray { background: #f5f5f5; color: #666; }
.badge-orange { background: #fef0e7; color: #b94a00; }

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex; border-bottom: 2px solid var(--border);
  margin-bottom: 20px; gap: 0;
  overflow-x: auto;
}
.tab-btn {
  padding: 10px 20px; background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  font-size: 0.875rem; font-weight: 500; color: var(--text-muted);
  cursor: pointer; white-space: nowrap; font-family: var(--font);
  transition: all 0.15s;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ============================================================
   FORMS
   ============================================================ */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-group .form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
textarea.form-control { resize: vertical; min-height: 100px; }

/* ============================================================
   SEARCH & FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.search-input-wrap {
  display: flex; align-items: center;
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 8px 14px; gap: 8px;
  flex: 1; min-width: 220px; max-width: 380px;
  transition: border-color 0.2s;
}
.search-input-wrap:focus-within { border-color: var(--primary-light); }
.search-input-wrap i { color: var(--text-muted); font-size: 0.9rem; }
.search-input-wrap input { border: none; outline: none; width: 100%; font-size: 0.875rem; font-family: var(--font); background: none; }
.filter-select { padding: 8px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 0.875rem; font-family: var(--font); background: white; color: var(--text); cursor: pointer; }
.filter-select:focus { outline: none; border-color: var(--primary-light); }

/* ============================================================
   PROGRESS
   ============================================================ */
.progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 3px; transition: width 0.6s ease; }
.progress-bar.blue { background: var(--primary-light); }
.progress-bar.green { background: var(--success); }
.progress-bar.orange { background: var(--warning); }
.progress-bar.red { background: var(--danger); }

/* ============================================================
   PIPELINE / KANBAN
   ============================================================ */
.pipeline-board {
  display: flex; gap: 16px; overflow-x: auto;
  padding-bottom: 16px; align-items: flex-start;
}
.pipeline-col {
  min-width: 240px; width: 240px;
  background: var(--bg); border-radius: var(--radius-lg);
  padding: 12px;
}
.pipeline-col-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.pipeline-col-title { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.pipeline-count {
  background: var(--border); padding: 2px 8px;
  border-radius: 10px; font-size: 0.75rem; color: var(--text-muted); font-weight: 600;
}
.pipeline-card {
  background: white; border-radius: var(--radius);
  border: 1px solid var(--border); padding: 12px;
  margin-bottom: 10px; box-shadow: var(--shadow);
  cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
}
.pipeline-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.pipeline-card-title { font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; }
.pipeline-card-meta { font-size: 0.78rem; color: var(--text-muted); display: flex; flex-direction: column; gap: 3px; }

/* ============================================================
   TIMELINE
   ============================================================ */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-dot {
  position: absolute; left: -24px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--card); background: var(--primary-light);
}
.timeline-dot.success { background: var(--success); }
.timeline-dot.danger { background: var(--danger); }
.timeline-dot.warning { background: var(--warning); }
.timeline-title { font-size: 0.875rem; font-weight: 600; margin-bottom: 3px; }
.timeline-time { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 6px; }
.timeline-body { font-size: 0.82rem; color: var(--text-muted); }

/* ============================================================
   GRID LAYOUTS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

/* ============================================================
   CHAT / COMMUNICATION
   ============================================================ */
.chat-layout { display: flex; height: calc(100vh - 140px); gap: 16px; }
.chat-list { width: 300px; flex-shrink: 0; background: var(--card); border-radius: var(--radius-lg); border: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.chat-window { flex: 1; background: var(--card); border-radius: var(--radius-lg); border: 1px solid var(--border); display: flex; flex-direction: column; }
.chat-list-header, .chat-window-header { padding: 16px; border-bottom: 1px solid var(--border); }
.chat-items { flex: 1; overflow-y: auto; }
.chat-item { padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; }
.chat-item:hover, .chat-item.active { background: #f0f7ff; }
.chat-item-name { font-size: 0.875rem; font-weight: 600; margin-bottom: 3px; display: flex; justify-content: space-between; }
.chat-item-preview { font-size: 0.78rem; color: var(--text-muted); }
.chat-item-time { font-size: 0.72rem; color: var(--text-light); }
.chat-messages { flex: 1; padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.chat-msg { max-width: 70%; }
.chat-msg.in { align-self: flex-start; }
.chat-msg.out { align-self: flex-end; }
.chat-bubble { padding: 10px 14px; border-radius: 14px; font-size: 0.875rem; }
.chat-msg.in .chat-bubble { background: var(--bg); border-radius: 14px 14px 14px 0; }
.chat-msg.out .chat-bubble { background: var(--primary); color: white; border-radius: 14px 14px 0 14px; }
.chat-msg-time { font-size: 0.72rem; color: var(--text-light); margin-top: 4px; }
.chat-input-area { padding: 16px; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: flex-end; }
.chat-input-area textarea { flex: 1; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 20px; resize: none; min-height: 42px; max-height: 120px; font-family: var(--font); font-size: 0.875rem; outline: none; }
.chat-input-area textarea:focus { border-color: var(--primary-light); }

/* ============================================================
   CALENDAR
   ============================================================ */
.mini-calendar { width: 100%; }
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day-label { text-align: center; font-size: 0.72rem; font-weight: 600; color: var(--text-muted); padding: 4px; }
.cal-day { text-align: center; padding: 7px 4px; font-size: 0.82rem; border-radius: 6px; cursor: pointer; transition: background 0.15s; }
.cal-day:hover { background: var(--bg); }
.cal-day.today { background: var(--primary); color: white; font-weight: 700; }
.cal-day.has-event { font-weight: 600; position: relative; }
.cal-day.has-event::after { content: ''; position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.cal-day.other-month { color: var(--text-light); }

/* ============================================================
   CHART PLACEHOLDER
   ============================================================ */
.chart-placeholder {
  background: linear-gradient(135deg, #f8fafc, #edf2f7);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 12px;
  color: var(--text-muted); font-size: 0.875rem;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px;
  text-align: center;
}
.empty-state i { font-size: 3rem; color: var(--text-light); margin-bottom: 16px; }
.empty-state h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); font-size: 0.875rem; max-width: 340px; margin-bottom: 20px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4); backdrop-filter: blur(2px);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  background: white; border-radius: var(--radius-lg);
  width: 100%; max-width: 560px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 1rem; font-weight: 600; }
.modal-close { width: 30px; height: 30px; background: none; border: none; cursor: pointer; color: var(--text-muted); border-radius: 6px; display: flex; align-items: center; justify-content: center; transition: background 0.15s; }
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 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; }

/* ============================================================
   NOTIFICATION DROPDOWN
   ============================================================ */
.notif-dropdown {
  position: absolute; top: 48px; right: -10px;
  width: 360px; background: white;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  box-shadow: var(--shadow-md); z-index: 200;
  overflow: hidden;
}
.notif-header { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; display: flex; gap: 12px; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: #f0f7ff; }
.notif-icon-wrap { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-text { flex: 1; }
.notif-title { font-size: 0.85rem; font-weight: 500; margin-bottom: 2px; }
.notif-desc { font-size: 0.78rem; color: var(--text-muted); }
.notif-time { font-size: 0.72rem; color: var(--text-light); margin-top: 3px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .login-bg { flex-direction: column; }
  .login-card { width: 100%; min-width: unset; padding: 32px 24px; }
  .login-info-panel { display: none; }
  .sidebar { position: fixed; left: -260px; transition: left 0.3s; }
  .sidebar.mobile-open { left: 0; }
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .chat-layout { flex-direction: column; }
  .chat-list { width: 100%; height: 200px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
}

/* ============================================================
   UTILITY
   ============================================================ */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mb-0 { margin-bottom: 0 !important; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 700; color: white;
  flex-shrink: 0;
}
.avatar.sm { width: 28px; height: 28px; font-size: 0.7rem; }
.avatar.lg { width: 48px; height: 48px; font-size: 1rem; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   DONUT CHART (CSS-based)
   ============================================================ */
.donut-chart-wrap { display: flex; align-items: center; gap: 20px; }
.donut { width: 100px; height: 100px; border-radius: 50%; flex-shrink: 0; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ============================================================
   BAR CHART (inline bars)
   ============================================================ */
.bar-list { display: flex; flex-direction: column; gap: 12px; }
.bar-item { }
.bar-label { display: flex; justify-content: space-between; font-size: 0.82rem; margin-bottom: 4px; }
.bar-label .bar-val { font-weight: 600; }
.bar-track { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; transition: width 1s ease; }

/* Quick access card */
.quick-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px;
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; gap: 14px;
}
.quick-card:hover { border-color: var(--primary-light); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.quick-card-icon { width: 40px; height: 40px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.quick-card-info .quick-card-title { font-size: 0.875rem; font-weight: 600; margin-bottom: 2px; }
.quick-card-info .quick-card-desc { font-size: 0.78rem; color: var(--text-muted); }

/* ============================================================
   AI / MARKETING MODULE STYLES
   ============================================================ */

/* AI Score Rings */
.ai-score-ring {
  width: 80px; height: 80px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; font-size: 1.4rem; font-weight: 800;
  flex-shrink: 0;
}
.ai-score-ring.hot  { background: linear-gradient(135deg,#ff4e50,#f9d423); color:white; }
.ai-score-ring.warm { background: linear-gradient(135deg,#f0a500,#f9d423); color:white; }
.ai-score-ring.cold { background: linear-gradient(135deg,#2980b9,#6dd5fa); color:white; }

/* Social post card */
.social-post-card {
  background: white; border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  margin-bottom: 14px; transition: box-shadow 0.2s;
}
.social-post-card:hover { box-shadow: var(--shadow-md); }
.social-platform-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 700;
}
.platform-facebook  { background:#e8f0fe; color:#1877f2; }
.platform-twitter   { background:#e8f5fd; color:#1da1f2; }
.platform-linkedin  { background:#e8f0f7; color:#0a66c2; }
.platform-instagram { background:#fce8f3; color:#e1306c; }
.platform-whatsapp  { background:#e8f8ee; color:#25d366; }
.platform-tiktok    { background:#f0e8fe; color:#6e00ff; }

/* AI typing indicator */
.ai-typing {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; background: var(--bg); border-radius: var(--radius);
  font-size: 0.82rem; color: var(--text-muted);
}
.ai-typing-dots { display:flex; gap:4px; }
.ai-typing-dots span {
  width:6px; height:6px; border-radius:50%;
  background: var(--primary-light);
  animation: bounce 1.2s infinite;
}
.ai-typing-dots span:nth-child(2) { animation-delay:.2s; }
.ai-typing-dots span:nth-child(3) { animation-delay:.4s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-6px)} }

/* AI suggestion card */
.ai-suggestion {
  background: linear-gradient(135deg,#ebf5fb,#f0fff4);
  border: 1px solid #bee3f8; border-left: 3px solid var(--primary-light);
  border-radius: var(--radius); padding: 12px 14px;
  margin-bottom: 10px; font-size: 0.875rem;
  position: relative;
}
.ai-suggestion-label {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--primary); margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}

/* Score bar gradient */
.score-bar { height: 10px; border-radius: 5px; overflow: hidden; background: var(--border); }
.score-fill-hot  { background: linear-gradient(90deg,#f9d423,#ff4e50); }
.score-fill-warm { background: linear-gradient(90deg,#f9d423,#f0a500); }
.score-fill-cold { background: linear-gradient(90deg,#6dd5fa,#2980b9); }

/* Social comment thread */
.comment-thread { border-left: 3px solid var(--border); padding-left: 14px; margin-top: 10px; }
.comment-item { padding: 8px 0; border-bottom: 1px solid var(--bg); }
.comment-item:last-child { border-bottom: none; }
.comment-author { font-size: 0.8rem; font-weight: 600; }
.comment-text { font-size: 0.82rem; color: var(--text-muted); margin: 3px 0; }
.comment-meta  { font-size: 0.72rem; color: var(--text-light); display:flex; gap:10px; }

/* Chatbot flow node */
.flow-canvas { background: #f8fafc; border: 1.5px dashed var(--border); border-radius: var(--radius-lg); padding: 24px; min-height: 300px; position: relative; }
.flow-node {
  background: white; border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 10px 14px;
  font-size: 0.82rem; display: inline-flex; align-items: center; gap: 8px;
  box-shadow: var(--shadow); cursor: pointer; margin: 6px;
  transition: all 0.15s;
}
.flow-node:hover { border-color: var(--primary-light); box-shadow: var(--shadow-md); }
.flow-node.trigger  { border-color: var(--success); background: #eafaf1; }
.flow-node.action   { border-color: var(--primary-light); background: #ebf5fb; }
.flow-node.condition{ border-color: var(--warning); background: #fffbeb; }
.flow-node.end      { border-color: var(--danger); background: #fdf2f2; }

/* Campaign timeline */
.campaign-step {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.campaign-step:last-child { border-bottom: none; }
.campaign-step-num {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
}
.campaign-step-body { flex: 1; }
.campaign-step-title { font-size: 0.875rem; font-weight: 600; margin-bottom: 3px; }
.campaign-step-detail { font-size: 0.78rem; color: var(--text-muted); }

/* Propensity gauge */
.propensity-card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
  text-align: center; transition: transform 0.2s;
}
.propensity-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.propensity-score {
  font-size: 2.4rem; font-weight: 800; line-height: 1;
  margin: 8px 0 4px;
}
.propensity-label { font-size: 0.78rem; color: var(--text-muted); }

/* AI glow effect for AI-powered elements */
.ai-powered {
  position: relative;
  border: 1.5px solid transparent;
  background: linear-gradient(white, white) padding-box,
              linear-gradient(135deg, #667eea, #764ba2) border-box;
  border-radius: var(--radius-lg);
}
.ai-powered-badge {
  position: absolute; top: -10px; right: 12px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white; font-size: 0.65rem; font-weight: 700;
  padding: 2px 8px; border-radius: 10px; text-transform: uppercase;
  letter-spacing: 0.5px;
}
