/* Vertex Homes - Marketing MIS Dashboard
   Design tokens layered on top of Bootstrap 5. Neutral navy/slate
   corporate palette (placeholder until real brand colors are supplied). */

:root {
  --vx-navy-900: #0f172a;
  --vx-navy-800: #1e293b;
  --vx-navy-700: #334155;
  --vx-slate-500: #64748b;
  --vx-slate-200: #e2e8f0;
  --vx-slate-100: #f1f5f9;
  --vx-accent: #2563eb;
  --vx-accent-dark: #1d4ed8;
  --vx-success: #16a34a;
  --vx-danger: #dc2626;
  --vx-warning: #d97706;
  --vx-sidebar-width: 250px;
  --vx-topbar-height: 60px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background: var(--vx-slate-100);
  color: var(--vx-navy-900);
}

/* ---------- Auth / error pages ---------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--vx-navy-900), var(--vx-navy-700));
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 12px;
  padding: 2.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.auth-card .brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--vx-navy-900);
  margin-bottom: 0.25rem;
}

.auth-card .brand-sub {
  color: var(--vx-slate-500);
  font-size: 0.85rem;
  margin-bottom: 1.75rem;
}

.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--vx-slate-100);
}

.error-card {
  text-align: center;
}

.error-card h1 {
  font-size: 4rem;
  font-weight: 800;
  color: var(--vx-navy-800);
}

/* ---------- App shell ---------- */
.vx-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--vx-sidebar-width);
  background: var(--vx-navy-900);
  color: #fff;
  z-index: 1030;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, visibility 0.2s;
}

.vx-sidebar .brand {
  padding: 1.1rem 1.25rem;
  font-weight: 700;
  font-size: 1.05rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.vx-sidebar .brand small {
  display: block;
  font-weight: 400;
  font-size: 0.7rem;
  color: var(--vx-slate-200);
  opacity: 0.7;
}

.vx-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0;
}

.vx-sidebar-nav .nav-section {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--vx-slate-500);
  padding: 0.9rem 1.25rem 0.3rem;
}

.vx-sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.1rem 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 0.9rem;
}

.vx-sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.vx-sidebar-nav a.active {
  background: var(--vx-accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.vx-main {
  margin-left: var(--vx-sidebar-width);
  min-height: 100vh;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.2s ease;
}

.vx-topbar {
  height: var(--vx-topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--vx-slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.vx-topbar .page-title {
  font-weight: 600;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vx-topbar > :first-child {
  min-width: 0;
}

.vx-content {
  padding: 1.5rem;
  flex: 1;
}

/* Sidebar show/hide: the toggle is visible at every width. Desktop pushes
   the content (collapsed = full-width content); tablet/mobile slides the
   sidebar over the content with a backdrop. */
.vx-sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.vx-sidebar-backdrop {
  display: none;
}

@media (min-width: 992px) {
  body.vx-sidebar-collapsed .vx-sidebar {
    transform: translateX(-100%);
    visibility: hidden;
  }
  body.vx-sidebar-collapsed .vx-main {
    margin-left: 0;
  }
}

@media (max-width: 991.98px) {
  .vx-sidebar {
    transform: translateX(-100%);
    visibility: hidden;
    box-shadow: 0 0 24px rgba(15, 23, 42, 0.35);
  }
  .vx-sidebar.open {
    transform: translateX(0);
    visibility: visible;
  }
  .vx-main {
    margin-left: 0;
  }
  .vx-sidebar-backdrop.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1025;
  }
  body.vx-sidebar-open {
    overflow: hidden;
  }
}

@media (max-width: 575.98px) {
  .vx-topbar {
    padding: 0 0.75rem;
  }
  .vx-content {
    padding: 1rem 0.75rem;
  }
}

/* ---------- KPI cards ---------- */
.kpi-card {
  background: #fff;
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  border: 1px solid var(--vx-slate-200);
  height: 100%;
}

.kpi-card .kpi-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--vx-slate-500);
  font-weight: 600;
}

.kpi-card .kpi-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--vx-navy-900);
  line-height: 1.2;
  margin-top: 0.2rem;
}

.kpi-card .kpi-change {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.35rem;
}

.kpi-change.up { color: var(--vx-success); }
.kpi-change.down { color: var(--vx-danger); }
.kpi-change.na { color: var(--vx-slate-500); }

/* ---------- Filter bar ---------- */
.vx-filter-bar {
  background: #fff;
  border: 1px solid var(--vx-slate-200);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin-bottom: 1.25rem;
}

/* ---------- Status badges ---------- */
.status-badge {
  display: inline-block;
  padding: 0.25em 0.65em;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  text-transform: capitalize;
}

.status-draft { background: var(--vx-slate-200); color: var(--vx-navy-700); }
.status-submitted { background: #dbeafe; color: #1e40af; }
.status-approved { background: #dcfce7; color: #166534; }
.status-rejected { background: #fee2e2; color: #991b1b; }

/* ---------- Chart card ---------- */
.chart-card {
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--vx-slate-200);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.chart-card .chart-title {
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.chart-canvas-wrap {
  position: relative;
  height: 260px;
}

/* ---------- Tables ---------- */
.table-card {
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--vx-slate-200);
  padding: 0;
  overflow: hidden;
}

.table-card table {
  margin-bottom: 0;
}

.table-card thead th {
  background: var(--vx-slate-100);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--vx-slate-500);
  border-bottom-width: 1px;
}

/* ===========================================================
   Executive Overview redesign (scoped to .vx-eo-* classes so
   the other dashboard pages, which keep using .kpi-card /
   .chart-card / .table-card as before, are unaffected)
   =========================================================== */

:root {
  --vx-teal: #0d9488;
  --vx-teal-light: #ccfbf1;
  --vx-orange: #ea580c;
  --vx-orange-light: #ffedd5;
  --vx-purple: #7c3aed;
  --vx-purple-light: #ede9fe;
  --vx-blue-light: #dbeafe;
  --vx-red-light: #fee2e2;
}

.vx-eo-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.vx-eo-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--vx-navy-900);
  line-height: 1.2;
  margin: 0;
}

.vx-eo-subtitle {
  color: var(--vx-slate-500);
  font-size: 0.9rem;
  margin-top: 0.15rem;
}

.vx-eo-filters {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.vx-eo-filters .vx-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--vx-slate-500);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.2rem;
}

.vx-eo-filters select.form-select,
.vx-eo-filters .btn {
  min-width: 9.5rem;
}

.vx-eo-last-updated {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--vx-slate-500);
  font-size: 0.78rem;
  white-space: nowrap;
  padding-bottom: 0.4rem;
}

.vx-eo-last-updated strong {
  color: var(--vx-navy-800);
  font-weight: 600;
}

/* ---------- KPI cards (icon-circle style) ---------- */

.vx-kpi2-card {
  background: #fff;
  border: 1px solid var(--vx-slate-200);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  height: 100%;
}

.vx-kpi2-top {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.6rem;
}

.vx-kpi2-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.vx-kpi2-icon.blue   { background: var(--vx-blue-light);   color: var(--vx-accent); }
.vx-kpi2-icon.teal   { background: var(--vx-teal-light);   color: var(--vx-teal); }
.vx-kpi2-icon.orange { background: var(--vx-orange-light); color: var(--vx-orange); }
.vx-kpi2-icon.purple { background: var(--vx-purple-light); color: var(--vx-purple); }

.vx-kpi2-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--vx-slate-500);
}

.vx-kpi2-value {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--vx-navy-900);
  line-height: 1.1;
}

.vx-kpi2-delta {
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

.vx-kpi2-delta .pct {
  font-weight: 700;
}

.vx-kpi2-delta.up .pct { color: var(--vx-success); }
.vx-kpi2-delta.down .pct { color: var(--vx-danger); }
.vx-kpi2-delta.na .pct { color: var(--vx-slate-500); }

.vx-kpi2-delta .prev {
  color: var(--vx-slate-500);
  display: block;
  margin-top: 0.1rem;
}

/* ---------- Horizontal bar list (Project Wise Leads) ---------- */

.vx-barlist-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.vx-barlist-row:last-child {
  margin-bottom: 0;
}

.vx-barlist-label {
  width: 6.5rem;
  flex-shrink: 0;
  font-size: 0.82rem;
  color: var(--vx-navy-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vx-barlist-track {
  flex: 1;
  min-width: 0;
  background: var(--vx-slate-100);
  border-radius: 999px;
  height: 0.9rem;
  overflow: hidden;
}

.vx-barlist-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--vx-accent), #60a5fa);
}

.vx-barlist-value {
  width: 3rem;
  flex-shrink: 0;
  text-align: right;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--vx-navy-900);
}

/* ---------- Donut legend ---------- */

.vx-donut-layout {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.vx-donut-canvas-wrap {
  position: relative;
  width: 9.5rem;
  height: 9.5rem;
  flex-shrink: 0;
}

.vx-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.vx-donut-center .num {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--vx-navy-900);
  line-height: 1;
}

.vx-donut-center .lbl {
  font-size: 0.7rem;
  color: var(--vx-slate-500);
  margin-top: 0.15rem;
}

.vx-legend {
  flex: 1;
  min-width: 0;
}

.vx-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  padding: 0.28rem 0;
}

.vx-legend-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.vx-legend-name {
  flex: 1;
  color: var(--vx-navy-800);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vx-legend-pct {
  font-weight: 700;
  color: var(--vx-navy-900);
}

/* ---------- Conversion funnel ---------- */

.vx-funnel-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}

.vx-funnel-row:last-child {
  margin-bottom: 0;
}

.vx-funnel-label {
  width: 6.2rem;
  flex-shrink: 0;
  font-size: 0.82rem;
  color: var(--vx-navy-800);
}

.vx-funnel-track {
  flex: 1;
  background: var(--vx-slate-100);
  border-radius: 6px;
  height: 1.4rem;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.vx-funnel-fill {
  height: 100%;
  border-radius: 6px;
  display: flex;
  align-items: center;
  padding-left: 0.5rem;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  min-width: 2rem;
  transition: width 0.3s ease;
}

.vx-funnel-badge {
  width: 3.6rem;
  flex-shrink: 0;
  text-align: right;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--vx-slate-500);
}

/* ---------- Source Wise Performance table ---------- */

.vx-table-eo thead th {
  background: var(--vx-blue-light);
  color: var(--vx-navy-800);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border-bottom-width: 1px;
}

.vx-table-eo td, .vx-table-eo th {
  font-size: 0.83rem;
}

.vx-table-eo tfoot td {
  background: var(--vx-blue-light);
  font-weight: 700;
  color: var(--vx-navy-900);
  border-top: 2px solid var(--vx-accent);
}

.vx-table-eo .col-strong {
  font-weight: 700;
}

.vx-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(0, 1.7fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
  align-items: stretch;
}

@media (max-width: 1399.98px) {
  .vx-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 767.98px) {
  .vx-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Project Wise Leads bar list needs a full row on phones */
  .vx-kpi-grid > :last-child { grid-column: 1 / -1; }
}

@media (max-width: 991.98px) {
  .vx-eo-filters {
    width: 100%;
  }
  .vx-eo-filters .vx-field,
  .vx-eo-filters select.form-select {
    flex: 1 1 45%;
    min-width: 8rem;
  }
  .vx-donut-layout {
    flex-direction: column;
  }
}
