/* ================================================================
   WhatsApp Business Portal — Theme v4
   Color palette: Deep indigo + Emerald green + Warm amber accents
================================================================ */
:root {
  /* Primary: rich indigo-violet */
  --primary:        #4f46e5;
  --primary-dark:   #3730a3;
  --primary-light:  #ede9fe;
  --primary-xlight: #f5f3ff;

  /* Success: emerald */
  --success:        #059669;
  --success-mid:    #10b981;
  --success-light:  #d1fae5;

  /* Danger: rose */
  --danger:         #dc2626;
  --danger-mid:     #ef4444;
  --danger-light:   #fee2e2;

  /* Warning: amber */
  --warning:        #d97706;
  --warning-mid:    #f59e0b;
  --warning-light:  #fef3c7;

  /* Info: sky */
  --info:           #0284c7;
  --info-light:     #e0f2fe;

  /* WhatsApp */
  --wa:             #25D366;
  --wa-dark:        #128C7E;
  --wa-bg:          #e5ddd5;

  /* Neutral */
  --dark:           #0f172a;
  --heading:        #1e293b;
  --body-text:      #374151;
  --muted:          #6b7280;
  --placeholder:    #9ca3af;
  --border:         #e5e7eb;
  --border-dark:    #d1d5db;
  --bg:             #f9fafb;
  --card:           #ffffff;
  --subtle:         #f3f4f6;

  --font:      'DM Sans', system-ui, sans-serif;
  --font-head: 'Sora', system-ui, sans-serif;

  --sh0: 0 1px 2px rgba(0,0,0,.05);
  --sh1: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --sh2: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --sh3: 0 10px 24px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.06);
  --sh4: 0 20px 48px rgba(0,0,0,.14), 0 8px 16px rgba(0,0,0,.08);

  --r4:  4px;  --r6:  6px;  --r8:  8px;
  --r10: 10px; --r12: 12px; --r16: 16px;

  --header-h: 58px;
  --nav-h:    46px;

  /* Legacy compat */
  --brand-green: #25D366;
  --accent-blue: #4f46e5;
  --gray: #6b7280;
  --gray-light: #f3f4f6;
  --white: #fff;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--body-text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
input, select, textarea, button { font-family: inherit; }

/* ================================================================
   LOGIN PAGE
================================================================ */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }

.login-left {
  background: linear-gradient(160deg, #1e1b4b 0%, #312e81 35%, #064e3b 100%);
  padding: 60px 56px;
  display: flex; flex-direction: column; justify-content: center;
  position: relative; overflow: hidden; color: #fff;
}
.login-left::before {
  content: ''; position: absolute; width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(16,185,129,.15) 0%, transparent 65%);
  top: -120px; right: -120px; pointer-events: none;
}
.login-left::after {
  content: ''; position: absolute; width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(139,92,246,.12) 0%, transparent 65%);
  bottom: -80px; left: -60px; pointer-events: none;
}
.login-left .brand-logo {
  font-family: var(--font-head); font-size: 2rem; font-weight: 800;
  color: #fff; margin-bottom: 6px; display: flex; align-items: center; gap: 10px;
}
.login-left .brand-logo .logo-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--wa), var(--wa-dark));
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  box-shadow: 0 4px 16px rgba(37,211,102,.4);
}
.login-left .brand-tagline { font-size: .9rem; color: rgba(255,255,255,.55); margin-bottom: 52px; }
.feature-list { display: flex; flex-direction: column; gap: 16px; }
.feature-item { display: flex; align-items: center; gap: 14px; font-size: .88rem; color: rgba(255,255,255,.85); }
.feature-item .fi {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  background: rgba(16,185,129,.15); border: 1px solid rgba(16,185,129,.3);
  color: var(--wa); display: flex; align-items: center; justify-content: center;
}

.login-right {
  background: var(--card); display: flex;
  align-items: center; justify-content: center; padding: 48px 44px;
}
.login-form-wrapper { width: 100%; max-width: 420px; }
.login-form-wrapper h2 {
  font-family: var(--font-head); font-size: 1.75rem; font-weight: 700;
  color: var(--heading); margin-bottom: 6px;
}
.login-form-wrapper > p { color: var(--muted); font-size: .875rem; margin-bottom: 30px; }

.alert { padding: 11px 15px; border-radius: var(--r8); font-size: .85rem; font-weight: 500; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.alert-danger  { background: var(--danger-light);  color: var(--danger);  border: 1px solid #fca5a5; }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #6ee7b7; }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #fcd34d; }

.input-group { display: flex; align-items: stretch; }
.input-group .form-control { flex: 1; border-radius: 0; border-left: none; }
.input-group-prefix, .input-group-suffix {
  padding: 9px 12px; background: var(--subtle);
  border: 1.5px solid var(--border); color: var(--muted);
  display: flex; align-items: center;
}
.input-group-prefix { border-right: none; border-radius: var(--r6) 0 0 var(--r6); }
.input-group-suffix { border-left: none; border-radius: 0 var(--r6) var(--r6) 0; cursor: pointer; }
.w-100  { width: 100%; justify-content: center; }
.btn-lg { padding: 12px 24px; font-size: .95rem; }

/* ================================================================
   BRAND BAR
================================================================ */
.brand-bar {
  height: var(--header-h); background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 1000;
  box-shadow: var(--sh1);
}
.brand-logo { display: flex; align-items: center; gap: 10px; }
.brand-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 17px; box-shadow: 0 2px 8px rgba(79,70,229,.4);
}
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 15px; color: var(--primary); }

.brand-actions { display: flex; align-items: center; gap: 10px; }
.top-btn {
  padding: 6px 14px; border-radius: var(--r6);
  border: 1.5px solid var(--primary); color: var(--primary);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: all .18s; background: transparent;
  display: inline-flex; align-items: center; gap: 5px;
}
.top-btn:hover { background: var(--primary); color: #fff; }
.top-btn.green { border-color: var(--success-mid); color: var(--success); }
.top-btn.green:hover { background: var(--success-mid); color: #fff; }
.top-date-badge {
  padding: 5px 12px; border-radius: var(--r6);
  border: 1.5px solid var(--border-dark); font-size: 12.5px; font-weight: 500;
  color: var(--body-text); display: inline-flex; align-items: center; gap: 5px;
}
.top-balance {
  padding: 5px 14px; border-radius: var(--r6);
  background: var(--primary-light); color: var(--primary);
  font-weight: 700; font-size: 14px;
  display: inline-flex; align-items: center; gap: 4px;
}
.wallet-badge {
  width: 34px; height: 34px; border-radius: var(--r6);
  border: 1.5px solid var(--primary); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.timezone-badge {
  padding: 5px 12px; border-radius: var(--r6);
  border: 1.5px solid var(--border-dark); font-size: 12px; font-weight: 500; color: var(--body-text);
}
.user-profile-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; border-radius: var(--r8); cursor: pointer;
  position: relative; transition: background .18s;
}
.user-profile-btn:hover { background: var(--subtle); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.user-info { display: flex; flex-direction: column; }
.user-name { font-weight: 600; font-size: 13px; color: var(--heading); line-height: 1.2; }
.user-role { font-size: 11px; color: var(--muted); }
.profile-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0; width: 190px;
  background: var(--card); border-radius: var(--r10);
  border: 1px solid var(--border); box-shadow: var(--sh3);
  z-index: 1100; display: none; flex-direction: column;
  overflow: hidden; padding: 4px 0;
}
.profile-dropdown.open { display: flex; }
.profile-dropdown a {
  padding: 9px 16px; font-size: 13px; color: var(--body-text);
  display: flex; align-items: center; gap: 9px; transition: background .14s;
}
.profile-dropdown a:hover { background: var(--subtle); color: var(--primary); }
.pd-divider { height: 1px; background: var(--border); margin: 3px 0; }

/* ================================================================
   MAIN NAV
================================================================ */
.main-nav {
  height: var(--nav-h); background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 28px; display: flex; align-items: stretch;
  position: sticky; top: var(--header-h); z-index: 999;
}
.nav-list { display: flex; list-style: none; align-items: stretch; }
.nav-item { position: relative; }
.nav-link {
  display: flex; align-items: center; gap: 6px;
  padding: 0 15px; font-size: 13px; font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap;
  transition: color .18s, border-color .18s; height: 100%;
}
.nav-link:hover { color: var(--primary); }
.nav-item.active > .nav-link { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.chev { font-size: 10px; margin-left: 1px; transition: transform .2s; }
.nav-item.has-dropdown:hover .chev { transform: rotate(180deg); }
.nav-item.has-dropdown:hover > .nav-link { color: var(--primary); }
.dropdown-menu {
  position: absolute; top: 100%; left: 0; min-width: 210px;
  background: var(--card); border: 1px solid var(--border);
  border-top: 2px solid var(--primary);
  border-radius: 0 0 var(--r10) var(--r10);
  box-shadow: var(--sh3); z-index: 998;
  display: none; flex-direction: column; padding: 5px 0;
}
.nav-item.has-dropdown:hover .dropdown-menu { display: flex; }
.dropdown-menu li { list-style: none; }
.dropdown-menu a {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 18px; font-size: 13px; color: var(--body-text);
  transition: background .14s, color .14s;
}
.dropdown-menu a:hover { background: var(--primary-xlight); color: var(--primary); }
.dropdown-menu a .fa-angle-right { color: var(--muted); font-size: 11px; }
.dropdown-menu a:hover .fa-angle-right { color: var(--primary); }

/* ================================================================
   PAGE LAYOUT
================================================================ */
.page-wrapper { padding: 22px 28px; max-width: 1440px; margin: 0 auto; }
.flash-container { padding: 0 28px; }
.flash-msg {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-radius: var(--r8);
  margin: 8px 0; font-size: 13.5px; font-weight: 500; position: relative;
}
.flash-msg button { position: absolute; right: 12px; background: none; border: none; font-size: 18px; cursor: pointer; color: inherit; opacity: .5; }
.flash-msg button:hover { opacity: 1; }
.flash-success { background: var(--success-light); color: var(--success); border: 1px solid #6ee7b7; }
.flash-danger  { background: var(--danger-light);  color: var(--danger);  border: 1px solid #fca5a5; }
.flash-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #fcd34d; }
.flash-info    { background: var(--info-light);    color: var(--info);    border: 1px solid #7dd3fc; }

.page-header { margin-bottom: 22px; }
.breadcrumb { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--border-dark); }
.breadcrumb .current { color: var(--heading); font-weight: 600; }
.page-title { font-family: var(--font-head); font-size: 21px; font-weight: 700; color: var(--heading); letter-spacing: -.02em; }

/* ================================================================
   STAT CARDS
================================================================ */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stats-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px; padding-left: 2px;
}
.stat-card {
  background: var(--card); border-radius: var(--r12); border: 1px solid var(--border);
  padding: 18px 20px 18px 24px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--sh1); position: relative; overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.stat-card:hover { box-shadow: var(--sh2); transform: translateY(-1px); }
.stat-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; border-radius: 4px 0 0 4px;
}
.stat-card.s-green::before  { background: var(--success-mid); }
.stat-card.s-blue::before   { background: var(--primary); }
.stat-card.s-red::before    { background: var(--danger-mid); }
.stat-card.s-yellow::before { background: var(--warning-mid); }
.stat-card:not([class*="s-"])::before { background: var(--primary); }
.stat-content { flex: 1; min-width: 0; }
.stat-label { font-size: 12.5px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.stat-value { font-family: var(--font-head); font-size: 26px; font-weight: 700; color: var(--heading); line-height: 1; letter-spacing: -.02em; }
.stat-change { font-size: 12px; margin-top: 5px; font-weight: 500; display: flex; align-items: center; gap: 3px; }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }
.stat-icon { width: 46px; height: 46px; border-radius: var(--r8); display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0; margin-left: 12px; }
.stat-icon.green  { background: var(--success-light); color: var(--success); }
.stat-icon.red    { background: var(--danger-light);  color: var(--danger); }
.stat-icon.blue   { background: var(--primary-light); color: var(--primary); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }

/* ================================================================
   CARDS
================================================================ */
.card {
  background: var(--card); border-radius: var(--r12); border: 1px solid var(--border);
  box-shadow: var(--sh1); overflow: hidden; margin-bottom: 20px;
}
.card-header {
  padding: 13px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--subtle);
}
.card-title { font-family: var(--font-head); font-size: 14px; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 7px; }
.card-body { padding: 20px; }
.chart-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 20px; }
.chart-card { background: var(--card); border-radius: var(--r12); border: 1px solid var(--border); padding: 18px 20px; box-shadow: var(--sh1); }
.chart-title { font-family: var(--font-head); font-size: 13.5px; font-weight: 700; color: var(--heading); margin-bottom: 16px; text-align: center; }

/* ================================================================
   FILTER SECTION
================================================================ */
.filter-section {
  background: var(--card); border-radius: var(--r12); border: 1px solid var(--border);
  padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--sh1);
}
.filter-title { color: var(--primary); font-weight: 700; font-size: 14px; margin-bottom: 14px; display: flex; align-items: center; gap: 7px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 13px; margin-bottom: 14px; }
.filter-actions { display: flex; gap: 9px; flex-wrap: wrap; }

/* ================================================================
   FORMS
================================================================ */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--heading); margin-bottom: 5px; }
.form-label small { font-weight: 400; color: var(--muted); }
.form-control, .form-select {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: var(--r6);
  font-size: 13.5px; font-family: var(--font); color: var(--heading);
  background: var(--card); transition: border-color .18s, box-shadow .18s; line-height: 1.4;
}
.form-control:focus, .form-select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.form-control::placeholder { color: var(--placeholder); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-control[disabled], .form-control[readonly] { background: var(--subtle); color: var(--muted); cursor: not-allowed; }

/* ================================================================
   BUTTONS
================================================================ */
.btn {
  padding: 8px 20px; border-radius: var(--r6); border: none;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .18s; font-family: var(--font); line-height: 1; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary  { background: var(--primary);     color: #fff; }
.btn-primary:hover  { background: var(--primary-dark); }
.btn-success  { background: var(--success-mid); color: #fff; }
.btn-success:hover  { background: var(--success); }
.btn-danger   { background: var(--danger-mid);  color: #fff; }
.btn-danger:hover   { background: var(--danger); }
.btn-warning  { background: var(--warning-mid); color: #fff; }
.btn-warning:hover  { background: var(--warning); }
.btn-info     { background: var(--info);        color: #fff; }
.btn-secondary{ background: var(--muted);       color: #fff; }
.btn-outline  { background: transparent; border: 1.5px solid var(--border); color: var(--muted); }
.btn-outline:hover  { border-color: var(--primary); color: var(--primary); background: var(--primary-xlight); }
.btn-light    { background: var(--subtle); border: 1px solid var(--border); color: var(--body-text); }
.btn-light:hover    { background: var(--border); }
.btn-sm   { padding: 5px 13px; font-size: 12px; }
.btn-lg   { padding: 12px 26px; font-size: 15px; }
.btn-icon { padding: 6px 10px; }
.btn-block{ width: 100%; justify-content: center; }

/* ================================================================
   TABLES
================================================================ */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table thead th {
  background: var(--subtle); padding: 11px 14px;
  text-align: left; font-weight: 700; font-size: 12.5px;
  color: var(--heading); border-bottom: 2px solid var(--border); white-space: nowrap;
}
table tbody tr { border-bottom: 1px solid var(--border); transition: background .12s; }
table tbody tr:last-child { border-bottom: none; }
table tbody tr:hover { background: var(--subtle); }
table tbody td { padding: 11px 14px; color: var(--body-text); vertical-align: middle; }
table tbody td code { background: var(--subtle); padding: 2px 7px; border-radius: 4px; font-size: 12px; color: var(--primary); border: 1px solid var(--border); }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--muted) !important; }

/* ================================================================
   BADGES
================================================================ */
.badge {
  padding: 3px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
}
.badge-success   { background: var(--success-light); color: var(--success); }
.badge-danger    { background: var(--danger-light);  color: var(--danger); }
.badge-warning   { background: var(--warning-light); color: var(--warning); }
.badge-info      { background: var(--info-light);    color: var(--info); }
.badge-primary   { background: var(--primary-light); color: var(--primary); }
.badge-secondary { background: var(--subtle); border: 1px solid var(--border); color: var(--muted); }

/* ================================================================
   MODALS
================================================================ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,.6); z-index: 2000;
  align-items: center; justify-content: center;
  padding: 16px; backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card); border-radius: var(--r16); width: 100%; max-width: 620px;
  max-height: 92vh; overflow-y: auto; box-shadow: var(--sh4);
  animation: modalIn .25s cubic-bezier(.4,0,.2,1);
}
.modal-lg { max-width: 900px; }
@keyframes modalIn { from { opacity:0; transform:translateY(20px) scale(.97); } to { opacity:1; transform:translateY(0) scale(1); } }
.modal-header {
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--subtle); border-radius: var(--r16) var(--r16) 0 0;
  position: sticky; top: 0; z-index: 1;
}
.modal-title { font-family: var(--font-head); font-size: 15px; font-weight: 700; color: var(--heading); display: flex; align-items: center; gap: 8px; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); padding: 2px 6px; border-radius: 4px; transition: all .15s; line-height: 1; }
.modal-close:hover { color: var(--danger); background: var(--danger-light); }
.modal-body { padding: 24px; }
.modal-footer { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; background: var(--subtle); border-radius: 0 0 var(--r16) var(--r16); position: sticky; bottom: 0; z-index: 1; }

/* ================================================================
   PROGRESS
================================================================ */
.progress { height: 7px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 99px; background: var(--primary); transition: width .4s ease; }
.progress-bar.success { background: var(--success-mid); }
.progress-bar.danger  { background: var(--danger-mid); }

/* ================================================================
   EXPORT BUTTONS
================================================================ */
.export-btns { display: flex; gap: 6px; padding: 12px 20px 0; flex-wrap: wrap; }
.export-btn {
  padding: 5px 14px; border: 1.5px solid var(--border); border-radius: var(--r6);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  background: var(--card); color: var(--muted); transition: all .18s; font-family: var(--font);
}
.export-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-xlight); }

/* ================================================================
   CHAT UI
================================================================ */
.chat-container { display: grid; grid-template-columns: 300px 1fr; border: 1px solid var(--border); border-radius: var(--r12); overflow: hidden; background: var(--card); height: calc(100vh - 200px); min-height: 400px; box-shadow: var(--sh1); }
.chat-sidebar { border-right: 1px solid var(--border); overflow-y: auto; background: var(--subtle); }
.chat-search { padding: 12px; border-bottom: 1px solid var(--border); background: var(--card); }
.chat-item { padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background .14s; }
.chat-item:hover, .chat-item.active { background: var(--primary-xlight); border-left: 3px solid var(--primary); }
.chat-item-name { font-weight: 700; font-size: 13.5px; color: var(--heading); }
.chat-item-preview { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.chat-main { display: flex; flex-direction: column; }
.chat-header { padding: 13px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; background: var(--card); }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; background: #f0f4f8; display: flex; flex-direction: column; gap: 12px; }
.msg-bubble { max-width: 65%; padding: 10px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; }
.msg-bubble.out { background: var(--primary); color: #fff; align-self: flex-end; border-bottom-right-radius: 2px; }
.msg-bubble.in  { background: var(--card); color: var(--body-text); align-self: flex-start; border-bottom-left-radius: 2px; box-shadow: var(--sh1); }
.msg-time { font-size: 11px; opacity: .6; margin-top: 4px; }
.chat-input { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 10px; background: var(--card); }
.chat-input .form-control { flex: 1; }

/* ================================================================
   WHATSAPP PREVIEW
================================================================ */
.wa-preview-wrap { background: var(--wa-bg); border-radius: var(--r12); padding: 20px; min-height: 200px; }
.wa-bubble { background: #fff; border-radius: 0 10px 10px 10px; padding: 10px 14px; max-width: 85%; box-shadow: 0 1px 3px rgba(0,0,0,.12); font-size: 13.5px; line-height: 1.6; color: #111; }
.wa-bubble .wa-header { font-weight: 700; margin-bottom: 5px; }
.wa-bubble .wa-footer { font-size: 11.5px; color: #667781; margin-top: 6px; padding-top: 6px; border-top: 1px solid #f0f0f0; }
.wa-bubble .wa-time { font-size: 10px; color: #667781; text-align: right; margin-top: 4px; }
.wa-bubble .wa-btn { background: #f0f2f5; border-radius: 6px; padding: 8px; text-align: center; margin-top: 8px; color: var(--wa-dark); font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 5px; }

/* ================================================================
   PAGINATION
================================================================ */
.pagination { display: flex; gap: 4px; align-items: center; justify-content: center; padding: 16px; }
.page-link { padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--r6); font-size: 13px; color: var(--muted); transition: all .18s; cursor: pointer; }
.page-link:hover, .page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ================================================================
   UTILITY
================================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.d-flex { display: flex; } .align-center { align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.mb-0 { margin-bottom: 0 !important; } .mb-16 { margin-bottom: 16px; } .mt-16 { margin-top: 16px; }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger)  !important; }
.text-warning { color: var(--warning) !important; }
.text-info    { color: var(--info)    !important; }
.text-dark    { color: var(--heading) !important; }

.page-footer { text-align: center; padding: 16px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--border); margin-top: 28px; }
.page-footer a { color: var(--primary); font-weight: 600; }

/* Legacy class compat */
.filter-panel, .filter-section { background: var(--card); border-radius: var(--r12); border: 1px solid var(--border); padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--sh1); }
.form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px,1fr)); gap: 13px; margin-bottom: 14px; }
.filter-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.table-wrapper { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table thead th { background: var(--subtle); padding: 11px 14px; text-align: left; font-weight: 700; font-size: 12.5px; color: var(--heading); border-bottom: 2px solid var(--border); white-space: nowrap; }
.data-table tbody tr { border-bottom: 1px solid var(--border); transition: background .12s; }
.data-table tbody tr:hover { background: var(--subtle); }
.data-table tbody td { padding: 11px 14px; color: var(--body-text); vertical-align: middle; }
.action-btns { display: flex; gap: 5px; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: .2; }
.page-btn { padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--r6); font-size: 13px; color: var(--muted); transition: all .18s; }
.page-btn:hover, .page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-info { font-size: 13px; color: var(--muted); margin-right: 8px; }
.checkbox-col { width: 36px; }
.modal.modal-lg { max-width: 900px; }
.hidden { display: none !important; }
.mt-2 { margin-top: 8px; }
.fw-semi { font-weight: 600; }
.form-text { font-size: 12px; color: var(--muted); margin-top: 4px; }
.required { color: var(--danger); }
.btn-secondary { background: var(--muted); color: #fff; }

/* ================================================================
   RESPONSIVE
================================================================ */
@media (max-width: 1024px) { .chart-grid { grid-template-columns: 1fr; } .stats-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 768px) {
  .brand-name { display: none; } .main-nav { padding: 0 8px; overflow-x: auto; } .nav-link { padding: 0 12px; font-size: 12.5px; }
  .page-wrapper, .flash-container { padding-left: 16px; padding-right: 16px; }
  .chat-container { grid-template-columns: 1fr; } .filter-grid, .form-row { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr; } .login-page { grid-template-columns: 1fr; }
  .login-left { display: none; } .filter-grid, .form-row { grid-template-columns: 1fr; }
}

/* ================================================================
   TABS
================================================================ */
.tab-nav {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  gap: 0;
}
.tab-btn {
  padding: 10px 20px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: color .18s, border-color .18s;
  font-family: var(--font);
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ================================================================
   SEND MESSAGE PAGE SPECIFIC
================================================================ */
.wa-chat-bubble {
  background: #dcf8c6;
  border-radius: 10px 10px 0 10px;
  padding: 12px 14px;
  max-width: 300px;
  margin-left: auto;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  font-size: 13.5px;
  line-height: 1.55;
}

/* ================================================================
   TEMPLATE CARD GRID (for template list view)
================================================================ */
.tpl-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r12);
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
  box-shadow: var(--sh1);
}
.tpl-card:hover { box-shadow: var(--sh2); transform: translateY(-2px); }
.tpl-card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tpl-card-body { padding: 14px 16px; }
.tpl-preview {
  background: var(--wa-bg);
  border-radius: var(--r8);
  padding: 12px;
  margin-top: 10px;
  font-size: 12.5px;
  line-height: 1.55;
}
.tpl-preview-bubble {
  background: #fff;
  border-radius: 0 8px 8px 8px;
  padding: 8px 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.1);
  font-size: 12.5px;
}

/* ================================================================
   RATE CARDS
================================================================ */
.rate-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ================================================================
   INFO / WARNING BOXES
================================================================ */
.info-banner {
  background: var(--primary-xlight);
  border: 1px solid var(--primary-light);
  border-left: 4px solid var(--primary);
  border-radius: var(--r8);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--body-text);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.info-banner i { color: var(--primary); margin-top: 1px; flex-shrink: 0; }

.warn-banner {
  background: var(--warning-light);
  border: 1px solid #fcd34d;
  border-left: 4px solid var(--warning-mid);
  border-radius: var(--r8);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--body-text);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 16px;
}

/* ================================================================
   DASHBOARD CHART SECTION
================================================================ */
.chart-toggle {
  display: flex;
  gap: 4px;
}
.chart-toggle button {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r6);
  font-size: 12px;
  font-weight: 600;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font);
  transition: all .15s;
}
.chart-toggle button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ================================================================
   ACCOUNT STATUS INDICATORS
================================================================ */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
}
.status-dot.green  { background: var(--success-mid); }
.status-dot.red    { background: var(--danger-mid); }
.status-dot.yellow { background: var(--warning-mid); }
.status-dot.gray   { background: var(--muted); }
