/* ============================================
   TarikSolutions – White Theme Dashboard CSS
   ============================================ */

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

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:        #7C3AED;
  --primary-hover:  #6D28D9;
  --primary-light:  #EDE9FE;
  --primary-ring:   rgba(124,58,237,.3);
  --bg-page:        #F8FAFC;
  --bg-card:        #FFFFFF;
  --border:         #E2E8F0;
  --border-light:   #F1F5F9;
  --text-primary:   #0F172A;
  --text-secondary: #475569;
  --text-muted:     #94A3B8;
  --sidebar-w:      256px;
  --header-h:       64px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:      0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:      0 8px 24px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.06);
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      16px;
  --radius-xl:      20px;
  --transition:     all .2s cubic-bezier(.4,0,.2,1);
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Animations only fire inside the main content — sidebar is excluded */
.app-sidebar .animate-up,
.app-sidebar .animate-left,
.app-sidebar .animate-scale,
.app-sidebar .animate-fade,
.sidebar-mobile .animate-up,
.sidebar-mobile .animate-left,
.sidebar-mobile .animate-scale,
.sidebar-mobile .animate-fade {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ===== KEYFRAMES ===== */
@keyframes fadeIn    { from { opacity:0 } to { opacity:1 } }
@keyframes slideUp   { from { opacity:0; transform:translateY(18px) } to { opacity:1; transform:translateY(0) } }
@keyframes slideDown { from { opacity:0; transform:translateY(-12px) } to { opacity:1; transform:translateY(0) } }
@keyframes slideLeft { from { opacity:0; transform:translateX(-20px) } to { opacity:1; transform:translateX(0) } }
@keyframes scaleIn   { from { opacity:0; transform:scale(.95) } to { opacity:1; transform:scale(1) } }
@keyframes shimmer {
  0%   { background-position: -400px 0 }
  100% { background-position: 400px 0 }
}
@keyframes spin      { to { transform:rotate(360deg) } }
@keyframes pulseRing {
  0%   { transform:scale(.8); opacity:1 }
  100% { transform:scale(2.2); opacity:0 }
}
@keyframes bounceIn {
  0%   { transform:scale(.3); opacity:0 }
  50%  { transform:scale(1.05) }
  70%  { transform:scale(.95) }
  100% { transform:scale(1); opacity:1 }
}

/* ===== ANIMATION UTILITIES ===== */
.animate-fade   { animation: fadeIn .3s ease-out both }
.animate-up     { animation: slideUp .4s ease-out both }
.animate-down   { animation: slideDown .3s ease-out both }
.animate-left   { animation: slideLeft .35s ease-out both }
.animate-scale  { animation: scaleIn .3s ease-out both }
.animate-spin   { animation: spin 1s linear infinite }

.delay-50  { animation-delay: .05s }
.delay-100 { animation-delay: .10s }
.delay-150 { animation-delay: .15s }
.delay-200 { animation-delay: .20s }
.delay-250 { animation-delay: .25s }
.delay-300 { animation-delay: .30s }
.delay-350 { animation-delay: .35s }
.delay-400 { animation-delay: .40s }

/* ===== HEADER ===== */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(255,255,255,.97);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  z-index: 50;
  display: flex;
  align-items: center;
  padding: 0 1.25rem 0 1rem;
  gap: .75rem;
  box-shadow: 0 1px 0 var(--border), 0 2px 8px rgba(0,0,0,.04);
  transition: var(--transition);
}

.header-logo { height: 36px; width: auto; }

.header-logo-text {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.header-right {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}
.header-divider {
  width: 1px;
  height: 22px;
  background: var(--border);
  flex-shrink: 0;
  margin: 0 .125rem;
}

.header-spacer { flex: 1; }

.header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  height: 38px;
  padding: 0 .75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.header-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.header-btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.header-btn.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

/* Notification bell */
.notif-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.notif-btn:hover { background: var(--primary-light); color: var(--primary); }
.notif-badge {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: #EF4444;
  border-radius: 50%;
  border: 2px solid white;
}
.notif-badge::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%) scale(.8);
  width: 100%; height: 100%;
  background: #EF4444;
  border-radius: 50%;
  animation: pulseRing 1.6s ease-out infinite;
}

/* Company selector */
.company-selector {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .4rem .75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: var(--transition);
  min-width: 190px;
  max-width: 260px;
  user-select: none;
}
.company-selector:hover { border-color: var(--primary); background: var(--primary-light); }
.company-avatar {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), #8B5CF6);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: .6875rem; font-weight: 700;
  flex-shrink: 0; letter-spacing: .02em;
  box-shadow: 0 2px 6px rgba(124,58,237,.25);
}
.company-info { min-width: 0; flex: 1; }
.company-name  { font-size: .8125rem; font-weight: 600; color: var(--text-primary); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; line-height: 1.3; }
.company-sub   { display: none; }
.company-leads { display: none; }
.plan-line {
  display: flex; align-items: center; gap: 4px;
  font-size: .72rem; color: var(--text-muted); margin-top: 1px;
}
.plan-badge {
  display: inline-flex; align-items: center;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: .65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  line-height: 1.6;
}
.plan-badge.free {
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  color: #64748b;
}
.plan-badge.pro {
  background: linear-gradient(90deg, #92400e, #d97706, #fbbf24, #f59e0b, #d97706, #92400e);
  background-size: 250% auto;
  border: none;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
  box-shadow: 0 1px 6px rgba(245,158,11,.45);
  animation: goldShimmer 2.5s linear infinite;
}
.plan-badge.premium {
  background: linear-gradient(90deg, #3730a3, #7C3AED, #a855f7, #7C3AED, #3730a3);
  background-size: 250% auto;
  border: none;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.2);
  box-shadow: 0 1px 6px rgba(124,58,237,.4);
  animation: goldShimmer 2.5s linear infinite;
}
@keyframes goldShimmer {
  0%   { background-position: 0% center; }
  100% { background-position: 250% center; }
}

/* User avatar */
.user-avatar-btn {
  display: flex; align-items: center; gap: .375rem;
  padding: .25rem .5rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}
.user-avatar-btn:hover { background: var(--primary-light); }
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #8B5CF6);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
  border: 2px solid white;
  box-shadow: 0 0 0 2px var(--border);
  flex-shrink: 0;
}

/* ===== SIDEBAR ===== */
.app-sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 40;
  transition: width .3s cubic-bezier(.4,0,.2,1);
}
.app-sidebar.collapsed { width: 64px; }
.app-sidebar.collapsed .nav-label { opacity: 0; width: 0; overflow: hidden; }
.app-sidebar.collapsed .company-selector { justify-content: center; max-width: 48px; }
.app-sidebar.collapsed .company-info { display: none; }

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 1rem .625rem .5rem; }
.sidebar-nav ul { list-style: none; display: flex; flex-direction: column; gap: .125rem; }

.nav-item a, .nav-item button {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .5rem .75rem;
  border-radius: var(--radius-md);
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
  width: 100%;
  border: none; background: transparent; cursor: pointer;
  text-align: left;
  white-space: nowrap;
}
.nav-item a:hover, .nav-item button:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.nav-item a.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--primary);
}
.nav-item .nav-icon {
  flex-shrink: 0;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
}
.nav-label { transition: opacity .2s ease, width .3s ease; overflow: hidden; }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: .5rem .625rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* Mobile sidebar overlay */
.sidebar-mobile {
  position: fixed;
  top: var(--header-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  z-index: 9999;
  transform: translateX(-100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.sidebar-mobile.open { transform: translateX(0); }
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 9998;
  backdrop-filter: blur(2px);
  animation: fadeIn .2s ease;
}
.sidebar-overlay.show { display: block; }

/* ===== MAIN LAYOUT ===== */
.app-wrapper {
  padding-top: var(--header-h);
  min-height: 100vh;
  overflow-x: hidden;
}
.app-content {
  margin-left: var(--sidebar-w);
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  padding: 1.5rem 1.5rem 3rem;
  transition: margin-left .3s cubic-bezier(.4,0,.2,1);
}
/* Collapsed sidebar — shrink the content margin too */
.app-sidebar.collapsed ~ * .app-content,
body.sidebar-collapsed .app-content { margin-left: 64px; }

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.card-icon svg { width: 20px; height: 20px; }

.kpi-value  { font-size: 1.75rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.2; margin: .75rem 0 .25rem; }
.kpi-label  { font-size: .8125rem; font-weight: 500; color: var(--text-muted); }

/* KPI Color Themes */
.icon-blue    { background: #EFF6FF; color: #2563EB; }
.icon-emerald { background: #ECFDF5; color: #059669; }
.icon-purple  { background: #F5F3FF; color: #7C3AED; }
.icon-indigo  { background: #EEF2FF; color: #4F46E5; }
.icon-sky     { background: #F0F9FF; color: #0284C7; }
.icon-green   { background: #F0FDF4; color: #16A34A; }
.icon-orange  { background: #FFF7ED; color: #EA580C; }
.icon-pink    { background: #FDF2F8; color: #DB2777; }
.icon-red     { background: #FEF2F2; color: #DC2626; }

.kpi-blue    { color: #2563EB; }
.kpi-emerald { color: #059669; }
.kpi-green   { color: #16A34A; }
.kpi-red     { color: #DC2626; }

/* ===== SECTION HEADER ===== */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}
.section-title {
  font-size: 1rem; font-weight: 600;
  color: var(--text-primary);
}

/* ===== FILTERS CARD ===== */
.filters-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}
.filter-label {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: .375rem;
}
.filter-input {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: .875rem;
  background: var(--bg-page);
  color: var(--text-primary);
  transition: var(--transition);
  font-family: inherit;
}
.filter-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
  background: white;
}

/* ===== TABS ===== */
.tabs {
  display: inline-flex;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 3px;
  gap: 2px;
}
.tab-btn {
  padding: .5rem 1.25rem;
  border-radius: calc(var(--radius-lg) - 3px);
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: none; background: transparent; cursor: pointer;
  transition: var(--transition);
}
.tab-btn.active {
  background: white;
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.tab-btn:hover:not(.active) { color: var(--text-primary); }

/* ===== TOGGLE SWITCH ===== */
.toggle-wrap { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; }
.toggle {
  position: relative;
  width: 44px; height: 24px;
  flex-shrink: 0;
}
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0;
  background: #CBD5E1;
  border-radius: 24px;
  transition: background .25s cubic-bezier(.4,0,.2,1);
}
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  transition: transform .25s cubic-bezier(.4,0,.2,1), box-shadow .2s;
}
.toggle input:checked ~ .toggle-track  { background: var(--primary); }
.toggle input:checked ~ .toggle-thumb { transform: translateX(20px); box-shadow: 0 1px 6px rgba(124,58,237,.4); }
.toggle input:focus  ~ .toggle-track  { box-shadow: 0 0 0 3px var(--primary-ring); }

/* ===== CUSTOM CHECKBOX ===== */
.checkbox-custom {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: white;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  flex-shrink: 0;
}
.checkbox-custom:checked {
  background: var(--primary);
  border-color: var(--primary);
}
.checkbox-custom:checked::after {
  content: '';
  position: absolute;
  left: 4px; top: 1px;
  width: 5px; height: 9px;
  border: 2px solid white;
  border-top: none; border-left: none;
  transform: rotate(45deg);
  animation: bounceIn .2s ease;
}
.checkbox-custom:focus { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.checkbox-custom:hover:not(:checked) { border-color: var(--primary); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .5rem 1rem;
  border-radius: var(--radius-md);
  font-size: .875rem; font-weight: 600;
  cursor: pointer; border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  font-family: inherit;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); box-shadow: 0 4px 14px rgba(124,58,237,.35); }
.btn-secondary { background: white; color: var(--text-secondary); border-color: var(--border); }
.btn-secondary:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.btn-danger  { background: #FEF2F2; color: #DC2626; border-color: #FECACA; }
.btn-danger:hover  { background: #DC2626; color: white; border-color: #DC2626; }
.btn-sm { padding: .375rem .75rem; font-size: .8125rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-icon { width: 38px; height: 38px; padding: 0; }
.btn-loading { pointer-events: none; opacity: .7; }
.btn-loading::after {
  content: '';
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-left: .25rem;
}

/* ===== ALERTS / FLASH ===== */
.alert {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .875rem 1rem;
  border-radius: var(--radius-md);
  font-size: .875rem;
  animation: slideDown .3s ease-out both;
  margin-bottom: 1.25rem;
}
.alert-success { background: #F0FDF4; border: 1px solid #BBF7D0; color: #15803D; }
.alert-error   { background: #FEF2F2; border: 1px solid #FECACA; color: #B91C1C; }
.alert-warning { background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E; }
.alert-info    { background: #EFF6FF; border: 1px solid #BFDBFE; color: #1D4ED8; }

.subscription-banner {
  display: flex; align-items: center; gap: 1rem;
  padding: .875rem 1.25rem;
  background: linear-gradient(135deg, #FFF7ED 0%, #FEF3C7 100%);
  border: 1px solid #FDE68A;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  animation: slideDown .4s ease-out both;
}
.subscription-banner svg { color: #D97706; flex-shrink: 0; }

/* ===== TABLE ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.data-table thead th {
  text-align: left;
  padding: .625rem .875rem;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background .15s;
}
.data-table tbody tr:hover { background: var(--primary-light); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody td { padding: .75rem .875rem; color: var(--text-secondary); vertical-align: middle; }
.data-table tbody td:first-child { color: var(--text-primary); font-weight: 500; }

/* ===== BADGE ===== */
.badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .2rem .625rem;
  border-radius: 99px;
  font-size: .75rem; font-weight: 600;
}
.badge-green   { background: #DCFCE7; color: #15803D; }
.badge-red     { background: #FEE2E2; color: #B91C1C; }
.badge-yellow  { background: #FEF9C3; color: #92400E; }
.badge-blue    { background: #DBEAFE; color: #1D4ED8; }
.badge-purple  { background: #EDE9FE; color: #6D28D9; }

/* ===== FORM INPUTS ===== */
.form-group { display: flex; flex-direction: column; gap: .375rem; }
.form-label { font-size: .8125rem; font-weight: 600; color: var(--text-secondary); }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: .5625rem .875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: .875rem;
  background: white;
  color: var(--text-primary);
  transition: var(--transition);
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.form-input::placeholder { color: var(--text-muted); }
.form-error { font-size: .8125rem; color: #DC2626; margin-top: .25rem; }

/* ===== CHARTS ===== */
.chart-container {
  position: relative;
  height: 280px;
  width: 100%;
}

/* ===== SKELETON ===== */
.skeleton {
  background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-md);
}
.skeleton-text  { height: 14px; border-radius: 4px; }
.skeleton-title { height: 20px; border-radius: 4px; }
.skeleton-kpi   { height: 32px; width: 50%; border-radius: 6px; }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}
.page-title-wrap { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.page-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.page-title { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }

/* ===== GRADIENT BUTTONS (special CTAs) ===== */
.btn-gradient-orange {
  background: linear-gradient(135deg, #EA580C, #F97316, #FB923C);
  color: white; border: none;
  box-shadow: 0 4px 14px rgba(234,88,12,.3);
  overflow: hidden;
  position: relative;
}
.btn-gradient-orange::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.2) 50%, rgba(255,255,255,0) 100%);
  transform: translateX(-100%);
  transition: transform .8s ease;
}
.btn-gradient-orange:hover::before { transform: translateX(100%); }
.btn-gradient-orange:hover { box-shadow: 0 6px 20px rgba(234,88,12,.45); }

.btn-gradient-purple {
  background: linear-gradient(135deg, #7C3AED, #8B5CF6, #EC4899);
  color: white; border: none;
  box-shadow: 0 4px 14px rgba(124,58,237,.3);
  overflow: hidden;
  position: relative;
}
.btn-gradient-purple::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.2) 50%, rgba(255,255,255,0) 100%);
  transform: translateX(-100%);
  transition: transform .8s ease;
}
.btn-gradient-purple:hover::before { transform: translateX(100%); }
.btn-gradient-purple:hover { box-shadow: 0 6px 20px rgba(124,58,237,.45); }

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(4px);
  z-index: 9990;
  display: none; align-items: center; justify-content: center;
  animation: fadeIn .2s ease;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn .25s ease;
  margin: 1rem;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem;
}
.modal-title { font-size: 1.125rem; font-weight: 700; color: var(--text-primary); }
.modal-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: none; background: var(--bg-page); cursor: pointer;
  color: var(--text-muted); transition: var(--transition);
}
.modal-close:hover { background: #FEE2E2; color: #DC2626; }

/* ===== REFRESH INDICATOR ===== */
.refresh-btn svg.spinning { animation: spin .8s linear infinite; }

/* ===== COMING SOON ===== */
.coming-soon-wrap {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 60vh; gap: 1.5rem; text-align: center; padding: 2rem;
}
.coming-soon-icon {
  width: 80px; height: 80px;
  border-radius: 24px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  animation: bounceIn .5s ease;
}
.coming-soon-icon svg { width: 40px; height: 40px; }
.coming-soon-title { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); }
.coming-soon-text  { font-size: 1rem; color: var(--text-muted); max-width: 340px; }

/* ===== AUTH LAYOUT ===== */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #F8FAFC 0%, #EDE9FE 50%, #F8FAFC 100%);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.auth-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124,58,237,.12) 0%, transparent 70%);
  top: -200px; right: -150px;
  pointer-events: none;
}
.auth-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(236,72,153,.1) 0%, transparent 70%);
  bottom: -100px; left: -100px;
  pointer-events: none;
}
.auth-card {
  background: white;
  border-radius: 24px;
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,.1), 0 4px 16px rgba(0,0,0,.06);
  border: 1px solid rgba(255,255,255,.8);
  animation: scaleIn .4s ease-out;
  position: relative; z-index: 1;
}
.auth-logo {
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 2rem;
}
.auth-title { font-size: 1.625rem; font-weight: 800; color: var(--text-primary); margin-bottom: .375rem; }
.auth-sub   { font-size: .9375rem; color: var(--text-muted); margin-bottom: 2rem; }

/* ===== DROPDOWN ===== */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  overflow: hidden;
  animation: slideDown .2s ease-out;
  display: none;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: .625rem;
  padding: .625rem 1rem;
  font-size: .875rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background .15s;
  border: none; background: none; width: 100%; text-align: left;
}
.dropdown-item:hover { background: var(--primary-light); color: var(--primary); }
.dropdown-item.danger:hover { background: #FEF2F2; color: #DC2626; }
.dropdown-divider { height: 1px; background: var(--border); margin: .25rem 0; }

/* ===== GRID ===== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

/* Form grids — collapse to 1 column on mobile */
.form-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

/* ===== RESPONSIVE ===== */

/* Large desktop: 4-col → 2-col */
@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* Tablet landscape: hide desktop sidebar, show hamburger */
@media (max-width: 1024px) {
  .app-sidebar { display: none; }
  .app-content { padding: 1rem 1rem 3rem; margin-left: 0 !important; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* Tablet portrait & large phone */
@media (max-width: 768px) {
  /* Keep KPIs 2-col on mobile — 1-col is too cramped */
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); gap: 1rem; }

  .app-content { padding: .875rem .875rem 3rem; }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: .75rem;
    padding: 1rem;
  }
  .page-header > div:last-child { width: 100%; }
  .page-header > div:last-child .btn { flex: 1; justify-content: center; }

  .kpi-value { font-size: 1.375rem; }
  .kpi-label { font-size: .75rem; }
  .card      { padding: 1.125rem; }

  .filters-card { padding: 1rem; }
  .filters-card .form-group:last-child { flex-direction: row; }

  .section-header { flex-wrap: wrap; gap: .75rem; }
  .section-title  { font-size: .9375rem; }

  .chart-container { height: 220px; }

  .auth-card {
    padding: 1.75rem 1.25rem;
    border-radius: 18px;
  }
  .auth-card > form [style*="grid-template-columns: 1fr 1fr"] {
    display: flex !important;
    flex-direction: column !important;
  }

  .data-table thead { display: none; }
  .data-table tbody tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: .625rem;
    padding: .625rem;
  }
  .data-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .3rem .25rem;
    border-bottom: none;
    font-size: .8125rem;
  }
  .data-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-right: .5rem;
    flex-shrink: 0;
  }

  .modal { padding: 1.5rem 1.25rem; margin: .5rem; }
  .modal-header { margin-bottom: 1.25rem; }

  .tabs { width: 100%; }
  .tab-btn { flex: 1; text-align: center; padding: .5rem .625rem; font-size: .8125rem; }

  .page-icon { display: none; }
  .page-title { font-size: 1.125rem; }

  .subscription-banner { flex-wrap: wrap; }
  .subscription-banner a { width: 100%; text-align: center; justify-content: center; }
}

/* Small phones */
@media (max-width: 480px) {
  :root { --header-h: 56px; }

  .app-content { padding: .75rem .75rem 3rem; }

  .grid-4 { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
  .grid-2, .grid-3 { gap: .75rem; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; gap: .75rem; }

  .kpi-value  { font-size: 1.25rem; }
  .card       { padding: 1rem; border-radius: var(--radius-lg); }
  .card-icon  { width: 36px; height: 36px; }

  .header-logo-text  { font-size: 1.125rem; }
  .notif-btn         { width: 36px; height: 36px; }
  .user-avatar       { width: 30px; height: 30px; font-size: .7rem; }
  .user-avatar-btn > i { display: none; }

  .company-selector  { display: none !important; }

  .chart-container   { height: 190px; }

  .auth-page { padding: .875rem; }
  .auth-card { padding: 1.5rem 1rem; }
  .auth-title { font-size: 1.375rem; }
  .auth-sub   { font-size: .875rem; }

  .modal {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    margin: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 92vh;
    padding: 1.5rem 1.25rem 2rem;
  }
  .modal-backdrop { align-items: flex-end; }

  .btn-lg { padding: .625rem 1.25rem; font-size: .9375rem; }

  .filters-card { padding: .875rem; }

  .page-header { padding: .875rem; border-radius: var(--radius-lg); }

  .section-header { margin-bottom: 1rem; }
}
