:root {
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --border-color: #cbd5e1;
  --brand-primary: #1e40af;
  --brand-primary-hover: #1d4ed8;
  --brand-accent: #d97706;
  --brand-accent-hover: #b45309;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #2563eb;
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --glass-bg: rgba(255, 255, 255, 0.92);
  --glass-border: rgba(255, 255, 255, 0.3);
  --font-marathi: 'Mukta', 'Noto Sans Devanagari', sans-serif;
  --font-heading: 'Mukta', 'Noto Sans Devanagari', sans-serif;
  --font-english: 'Outfit', sans-serif;
}

[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-surface: #1e293b;
  --bg-surface-elevated: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #e2e8f0;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --brand-primary: #60a5fa;
  --brand-primary-hover: #93c5fd;
  --brand-accent: #fbbf24;
  --brand-accent-hover: #f59e0b;
  --info: #38bdf8;
  --glass-bg: rgba(30, 41, 59, 0.92);
  --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
  font-family: var(--font-marathi);
  font-size: 1.12rem;
  line-height: 1.75;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-primary);
}

h1 { font-size: 2.1rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.45rem; }
h4 { font-size: 1.25rem; }

p { font-size: 1.1rem; line-height: 1.7; color: var(--text-secondary); }

a { color: var(--brand-primary); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--brand-primary-hover); }

/* NAVBAR & RESPONSIVE TOGGLE MENU */
.navbar {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.navbar-brand { display: flex; align-items: center; gap: 0.75rem; }
.navbar-logo {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 1.3rem;
}
.navbar-title { font-size: 1.45rem; font-weight: 800; color: var(--text-primary); margin: 0; }

.mobile-nav-toggle {
  display: none;
  background: var(--brand-primary);
  color: #ffffff !important;
  border: none;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}

.navbar-menu { display: flex; align-items: center; gap: 1rem; }
.nav-link { color: var(--text-secondary); font-weight: 600; font-size: 1.05rem; padding: 0.4rem 0.8rem; border-radius: 6px; transition: all 0.2s ease; }
.nav-link:hover, .nav-link.active { background: var(--bg-surface-elevated); color: var(--brand-primary); }

.btn-primary {
  background-color: var(--brand-primary);
  color: #ffffff !important;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.btn-primary:hover { background-color: var(--brand-primary-hover); transform: translateY(-2px); }

.btn-accent {
  background-color: var(--brand-accent);
  color: #ffffff !important;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1.05rem;
  border: none;
  cursor: pointer;
}

.theme-toggle-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}

/* NEWS TICKER */
.news-ticker-bar {
  background: linear-gradient(90deg, #1e40af, #3b82f6);
  color: #ffffff;
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  overflow: hidden;
}
.news-ticker-label {
  background: #ef4444; color: #fff; font-weight: 800; padding: 0.25rem 0.65rem; border-radius: 4px; font-size: 0.9rem; white-space: nowrap; animation: pulse 2s infinite;
}
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.7; } 100% { opacity: 1; } }
.news-ticker-content { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* CONTAINER & CARDS */
.container { max-width: 1200px; margin: 0 auto; padding: 1.75rem 1.25rem; width: 100%; flex: 1; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.5rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 1.5rem; }

.card-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
}
.card-box:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.card-img { width: 100%; height: 220px; object-fit: cover; border-radius: 10px; margin-bottom: 1rem; }
.card-title { font-size: 1.35rem; font-weight: 700; color: var(--text-primary); margin-bottom: 0.6rem; line-height: 1.4; }
.card-desc { font-size: 1.08rem; color: var(--text-secondary); margin-bottom: 1.2rem; flex: 1; line-height: 1.65; }

.badge {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
}

.footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 2.25rem 1.5rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-top: auto;
}

/* RESPONSIVE MEDIA QUERIES */
@media (max-width: 768px) {
  body { font-size: 1.05rem; }
  .navbar { padding: 0.75rem 1rem; }
  .mobile-nav-toggle { display: inline-flex; align-items: center; }
  .navbar-menu {
    display: none;
    flex-direction: column;
    width: 100%;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    margin-top: 0.75rem;
  }
  .navbar-menu.active { display: flex !important; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* CRM PANEL & HIGH CONTRAST TYPOGRAPHY RULES */
.crm-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.crm-panel h1, .crm-panel h2, .crm-panel h3, .crm-panel h4 {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .crm-panel h1, 
[data-theme="dark"] .crm-panel h2, 
[data-theme="dark"] .crm-panel h3, 
[data-theme="dark"] .crm-panel h4 {
  color: #38bdf8 !important;
}

.crm-table, .data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.crm-table th, .data-table th {
  background: #0f172a !important;
  color: #38bdf8 !important;
  font-weight: 800 !important;
  padding: 1rem !important;
  text-align: left;
  border-bottom: 2px solid #334155;
  font-size: 0.98rem;
}

.crm-table td, .data-table td {
  padding: 1rem !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border-color);
  font-size: 1rem;
}

[data-theme="dark"] .crm-table td, 
[data-theme="dark"] .data-table td {
  color: #f8fafc !important;
  border-bottom: 1px solid #334155 !important;
}

/* ============================================================
   ENTERPRISE SAAS DASHBOARD & SIDEBAR LAYOUT ENGINE
   ============================================================ */

.crm-body {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-primary);
  margin: 0;
  padding: 0;
}

.crm-sidebar {
  width: 275px;
  min-width: 275px;
  background: #0f172a;
  color: #f8fafc;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #1e293b;
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.2);
  z-index: 100;
  box-sizing: border-box;
}

.crm-content {
  flex: 1;
  min-width: 0;
  padding: 2rem;
  background-color: var(--bg-primary);
  box-sizing: border-box;
  overflow-x: hidden;
}

.crm-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  border-radius: 14px;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.sidebar-section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  font-weight: 800;
  margin: 1.25rem 0 0.5rem 0.5rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  color: #cbd5e1 !important;
  text-decoration: none;
  font-size: 0.98rem;
  font-weight: 600;
  border-radius: 10px;
  margin-bottom: 0.25rem;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.sidebar-link:hover {
  background: #1e293b;
  color: #ffffff !important;
  border-color: #334155;
  transform: translateX(3px);
}

.sidebar-link.active {
  background: linear-gradient(135deg, #0ea5e9, #0284c7) !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
  border-color: #38bdf8;
}

/* Primary Create Ad Link */
.sidebar-link.create-ad-btn {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  margin: 0.5rem 0;
}

.sidebar-link.create-ad-btn:hover {
  background: linear-gradient(135deg, #059669, #047857) !important;
}

/* HIGH-CONTRAST KPI ANALYTICS TILES */
.kpi-tile-views {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid #0284c7;
  border-radius: 14px;
  padding: 1.25rem;
  text-align: center;
}
.kpi-tile-views .kpi-num { color: #0284c7 !important; font-size: 2.2rem; font-weight: 900; }
.kpi-tile-views .kpi-lbl { color: #0369a1 !important; font-size: 0.95rem; font-weight: 800; }

[data-theme="dark"] .kpi-tile-views { background: rgba(56, 189, 248, 0.12); border-color: #38bdf8; }
[data-theme="dark"] .kpi-tile-views .kpi-num { color: #38bdf8 !important; }
[data-theme="dark"] .kpi-tile-views .kpi-lbl { color: #bae6fd !important; }

.kpi-tile-calls {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid #059669;
  border-radius: 14px;
  padding: 1.25rem;
  text-align: center;
}
.kpi-tile-calls .kpi-num { color: #059669 !important; font-size: 2.2rem; font-weight: 900; }
.kpi-tile-calls .kpi-lbl { color: #047857 !important; font-size: 0.95rem; font-weight: 800; }

[data-theme="dark"] .kpi-tile-calls { background: rgba(16, 185, 129, 0.12); border-color: #10b981; }
[data-theme="dark"] .kpi-tile-calls .kpi-num { color: #34d399 !important; }
[data-theme="dark"] .kpi-tile-calls .kpi-lbl { color: #a7f3d0 !important; }

.kpi-tile-whatsapp {
  background: rgba(37, 211, 102, 0.08);
  border: 1px solid #16a34a;
  border-radius: 14px;
  padding: 1.25rem;
  text-align: center;
}
.kpi-tile-whatsapp .kpi-num { color: #16a34a !important; font-size: 2.2rem; font-weight: 900; }
.kpi-tile-whatsapp .kpi-lbl { color: #15803d !important; font-size: 0.95rem; font-weight: 800; }

[data-theme="dark"] .kpi-tile-whatsapp { background: rgba(37, 211, 102, 0.12); border-color: #25d366; }
[data-theme="dark"] .kpi-tile-whatsapp .kpi-num { color: #4ade80 !important; }
[data-theme="dark"] .kpi-tile-whatsapp .kpi-lbl { color: #bbf7d0 !important; }

.kpi-tile-maps {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid #d97706;
  border-radius: 14px;
  padding: 1.25rem;
  text-align: center;
}
.kpi-tile-maps .kpi-num { color: #d97706 !important; font-size: 2.2rem; font-weight: 900; }
.kpi-tile-maps .kpi-lbl { color: #b45309 !important; font-size: 0.95rem; font-weight: 800; }

[data-theme="dark"] .kpi-tile-maps { background: rgba(245, 158, 11, 0.12); border-color: #f59e0b; }
[data-theme="dark"] .kpi-tile-maps .kpi-num { color: #fbbf24 !important; }
[data-theme="dark"] .kpi-tile-maps .kpi-lbl { color: #fef3c7 !important; }

/* MOBILE RESPONSIVE SIDEBAR */
@media (max-width: 900px) {
  .crm-body { flex-direction: column; }
  .crm-sidebar {
    width: 100%;
    min-width: 100%;
    height: auto;
    min-height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid #1e293b;
  }
  .crm-content { padding: 1.25rem 0.85rem; }
}

/* REFINED ENTERPRISE FORM CONTROLS & BUTTONS */
.form-control, input[type="text"], input[type="number"], input[type="email"], input[type="password"], input[type="tel"], select, textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.form-control:focus, input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 800;
  border-radius: 10px;
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #ffffff;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.4);
}

/* ============================================================
   ENTERPRISE UNIFIED SAAS SYSTEM CLASSES
   ============================================================ */
html, body {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary);
  font-family: var(--font-marathi);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  height: 100%;
}

.crm-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background-color: var(--bg-primary);
}

.crm-sidebar {
  width: 300px;
  height: 100vh;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 999;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.25rem 1rem;
  box-sizing: border-box;
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.crm-sidebar nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.crm-sidebar nav::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.crm-sidebar-footer {
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: auto;
}

.crm-content {
  margin-left: 300px;
  flex: 1;
  padding: 1rem 1.25rem !important;
  width: calc(100% - 300px);
  box-sizing: border-box;
  height: 100vh !important;
  max-height: 100vh !important;
  overflow-y: auto !important;
  background-color: var(--bg-primary);
}

.crm-panel, .form-box, .kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem 1.25rem !important;
  box-shadow: var(--shadow-md);
  margin-bottom: 1rem !important;
}

/* GLOBAL FORM DESIGN UNIFORMITY (MATCHING MY-CARD FORM) */
input[type="text"],
input[type="number"],
input[type="tel"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="file"],
input[type="search"],
select,
textarea,
.form-control {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  border: 1px solid #334155 !important;
  border-radius: 8px !important;
  padding: 0.5rem 0.85rem !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  font-family: inherit !important;
  min-height: 40px !important;
  box-sizing: border-box !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="file"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus,
.form-control:focus {
  outline: none !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2) !important;
  background-color: #0f172a !important;
  color: #ffffff !important;
}

/* FORM LABELS UNIFORMITY */
label {
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  color: #e2e8f0 !important;
  margin-bottom: 0.35rem !important;
  display: block !important;
  line-height: 1.3 !important;
}

.grid-2-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem !important;
  margin-bottom: 0.75rem !important;
}

.form-group {
  margin-bottom: 0.6rem !important;
}

.card-box {
  padding: 0.75rem 1rem !important;
  margin-bottom: 0.65rem !important;
  border-radius: 10px !important;
}

.banner-card-green {
  background: linear-gradient(135deg, #064e3b 0%, #047857 100%);
  border: 1px solid #10b981;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  color: #ffffff;
}

.banner-card-vip {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e3a8a 100%);
  border: 1px solid #4338ca;
  border-radius: 14px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  color: #ffffff;
  box-shadow: var(--shadow-lg);
}

@media (max-width: 991px) {
  .crm-sidebar {
    transform: translateX(-100%);
    width: 280px;
  }
  .crm-sidebar.active {
    transform: translateX(0);
  }
  .crm-content {
    margin-left: 0;
    width: 100%;
    padding: 0.75rem 1rem !important;
  }
}

/* WIZARD MULTI-STEP TAB CONTROL */
.wizard-stepper {
  display: flex;
  gap: 0.5rem !important;
  margin-bottom: 1rem !important;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.5rem !important;
  flex-wrap: wrap;
}

.wizard-tab-btn {
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: 8px !important;
  padding: 0.45rem 0.9rem !important;
  font-weight: 800;
  font-size: 0.85rem !important;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* CUSTOM SLEEK DARK SCROLLBAR FOR CRM */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: #0b0f17;
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: #38bdf8;
}

/* HIDE BROWSER NUMBER SPIN ARROWS */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}

/* INPUT PREFIX ADDON GROUP */
.input-addon-group {
  display: flex;
  align-items: center;
  width: 100%;
}

.input-prefix {
  background: #1e293b;
  color: #38bdf8;
  border: 1px solid #334155;
  border-right: none;
  padding: 0.45rem 0.75rem;
  font-weight: 900;
  font-size: 1.1rem;
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
}

.input-with-prefix {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  flex: 1;
}

.wizard-tab-btn.active-wizard-tab {
  background: #0ea5e9 !important;
  color: #ffffff !important;
  border-color: #0ea5e9 !important;
  box-shadow: 0 3px 10px rgba(14, 165, 233, 0.3);
}