.dm-root {
  --sidebar-w: 230px;
  --sidebar-bg: #0f1623;
  --body-bg: #f5f6fa;
  --white: #ffffff;
  --border: #e8ecf2;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --blue: #2563eb;
  --blue-light: #eff4ff;
  --blue-mid: #dbeafe;
  --green: #059669;
  --green-light: #ecfdf5;
  --rose: #e11d48;
  --rose-light: #fff1f2;
  --amber: #d97706;
  --amber-light: #fffbeb;
  --violet: #7c3aed;
  --violet-light: #f5f3ff;
  --teal: #0d9488;
  --teal-light: #f0fdfa;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --radius: 14px;

  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--body-bg);
  color: var(--text-primary);
  display: flex;
  min-height: 600px; /* Reduced from min-height: 100vh since it's a mockup */
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  text-align: left; /* Ensure it doesn't inherit centering from parent */
}

.dm-root * { box-sizing: border-box; }

/* SIDEBAR */
.dm-root .sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: absolute; /* Changed from fixed to absolute to scope within dm-root */
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow: hidden; /* Remove scroll */
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  color: #ffffff; /* Make text white for dark background */
}
.dm-root .sidebar,
.dm-root .sidebar *,
.dm-root aside.sidebar,
.dm-root aside.sidebar *,
.dm-root aside#dm-sidebar,
.dm-root aside#dm-sidebar * {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}
.dm-root .sidebar a,
.dm-root .sidebar a *,
.dm-root aside.sidebar a,
.dm-root aside.sidebar a *,
.dm-root aside#dm-sidebar a,
.dm-root aside#dm-sidebar a * {
  color: #ffffff !important;
  text-decoration: none !important;
  -webkit-text-fill-color: #ffffff !important;
}
.dm-root .sidebar .nav-item.dim,
.dm-root .sidebar .nav-item.dim * {
  color: rgba(255, 255, 255, 0.6) !important;
}
.dm-root .sidebar .nav-item.dim:hover,
.dm-root .sidebar .nav-item.dim:hover * {
  color: #ffffff !important;
}
.dm-root .sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.dm-root .logo-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--blue), #1d4ed8);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(37,99,235,.45); flex-shrink: 0;
}
.dm-root .logo-text { font-weight: 700; font-size: 16px; color: #ffffff; letter-spacing: -.01em; }
.dm-root .logo-mark svg { width: 20px; height: 20px; stroke: white; fill: none; stroke-width: 2.5; }

.dm-root .nav-section { padding: 22px 14px 0; }
.dm-root .nav-label { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #ffffff; padding: 0 12px 12px; }
.dm-root .nav-item,
.dm-root a.nav-item,
.dm-root a.nav-item:link,
.dm-root a.nav-item:visited {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; margin-bottom: 2px;
  font-size: 13.5px; font-weight: 500; color: #ffffff;
  cursor: pointer; text-decoration: none; transition: all .2s;
}
.dm-root .nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7; stroke: currentColor; fill: none; }
.dm-root .nav-item:hover { background: rgba(255,255,255,0.08); color: #ffffff; }
.dm-root .nav-item:hover svg { opacity: 1; }
.dm-root .nav-item.active { background: var(--blue); color: #ffffff; font-weight: 600; box-shadow: 0 4px 12px rgba(37,99,235,0.25); }
.dm-root .nav-item.active svg { opacity: 1; }

/* Make specific lists light gray (Billing + Finance sections) */
.dm-root .sidebar .nav-item.dim,
.dm-root .sidebar a.nav-item.dim:link,
.dm-root .sidebar a.nav-item.dim:visited { color: rgba(255,255,255,0.6); }
.dm-root .sidebar .nav-item.dim:hover { color: #ffffff; }

/* MAIN */
.dm-root .main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100%; width: 100%; }

/* TOPBAR */
.dm-root .topbar {
  height: 62px; background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.dm-root .topbar-left { display: flex; align-items: center; gap: 14px; }
.dm-root .hamburger { display: none; background: none; border: none; cursor: pointer; color: var(--text-secondary); padding: 4px; }

.dm-root .search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--body-bg); border: 1.5px solid var(--border);
  border-radius: 9px; padding: 6px 10px; width: 220px;
  height: 34px;
  transition: border-color .15s;
}
.dm-root .search-bar:focus-within { border-color: var(--blue); background: #fff; }
.dm-root .search-bar input { background: none; border: none; outline: none; font-family: inherit; font-size: 13px; color: var(--text-primary); width: 100%; }
.dm-root .search-bar input::placeholder { color: var(--text-muted); }

.dm-root .topbar-right { display: flex; align-items: center; gap: 10px; }
.dm-root .top-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--body-bg); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 6px 12px;
  font-size: 12.5px; font-weight: 500; color: var(--text-secondary); cursor: pointer;
}
.dm-root .pill-dot { width: 7px; height: 7px; border-radius: 50%; background: #10b981; }
.dm-root .icon-btn {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--body-bg); border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative; color: var(--text-secondary);
  transition: border-color .15s;
}
.dm-root .icon-btn:hover { border-color: #c8d0e0; }
.dm-root .notif-dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--rose);
  border: 1.5px solid var(--white);
}
.dm-root .avatar-wrap { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 2px 4px; flex-shrink: 0; }
.dm-root .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: white;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}
.dm-root .avatar-info { display: flex; flex-direction: column; }
.dm-root .avatar-name { font-size: 13px; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.dm-root .avatar-role { font-size: 11px; color: var(--text-muted); }

/* CONTENT */
.dm-root .content { padding: 28px; flex: 1; overflow: hidden; }

.dm-root .page-head { margin-bottom: 24px; }
.dm-root .page-head h1 { font-size: 21px; font-weight: 800; color: var(--text-primary); letter-spacing: -.03em; border: none; margin: 0; padding: 0; }
.dm-root .page-head p { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }

/* KPI GRID */
.dm-root .kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.dm-root .kpi {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
  cursor: default;
  animation: dm-fadeUp .4s ease both;
}
.dm-root .kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.dm-root .kpi-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.dm-root .kpi-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.dm-root .kpi-icon--blue-light { background: var(--blue-light); }
.dm-root .kpi-icon--rose-light { background: var(--rose-light); }
.dm-root .kpi-icon--violet-light { background: var(--violet-light); }
.dm-root .kpi-dots { font-size: 14px; color: var(--text-muted); letter-spacing: .1em; cursor: pointer; line-height: 1; }
.dm-root .kpi-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 5px; }
.dm-root .kpi-value { font-size: 22px; font-weight: 800; color: var(--text-primary); letter-spacing: -.03em; line-height: 1; }
.dm-root .kpi-foot { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.dm-root .kpi-tag {
  padding: 2px 7px; border-radius: 20px; font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 3px;
}
.dm-root .up { background: #ecfdf5; color: #059669; }
.dm-root .down { background: #fff1f2; color: #e11d48; }
.dm-root .neutral { background: #f3f4f6; color: #6b7280; }
.dm-root .kpi-foot-text { font-size: 11px; color: var(--text-muted); }

/* CHARTS */
.dm-root .section-row { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 20px; }

.dm-root .card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  animation: dm-fadeUp .42s ease both;
}
.dm-root .card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.dm-root .card-title { font-size: 14.5px; font-weight: 700; color: var(--text-primary); }
.dm-root .card-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.dm-root .card-btn {
  font-size: 12px; font-weight: 600; color: var(--blue);
  padding: 4px 10px; background: var(--blue-light); border-radius: 6px; cursor: pointer;
}
.dm-root .legend-row { display: flex; gap: 14px; flex-wrap: wrap; }
.dm-root .legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.dm-root .l-dot { width: 8px; height: 8px; border-radius: 50%; }
.dm-root .l-dot--blue { background: var(--blue); }
.dm-root .l-dot--rose { background: var(--rose); }
.dm-root .l-dot--green { background: var(--green); }

/* DONUT */
.dm-root .donut-wrap { position: relative; width: 150px; height: 150px; margin: 0 auto 16px; }
.dm-root .donut-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); text-align: center; }
.dm-root .donut-center .dc-val { font-size: 20px; font-weight: 800; color: var(--text-primary); }
.dm-root .donut-center .dc-lbl { font-size: 11px; color: var(--text-muted); }
.dm-root .split-list { display: flex; flex-direction: column; gap: 10px; }
.dm-root .split-row { display: flex; align-items: center; gap: 8px; }
.dm-root .split-name { font-size: 12px; font-weight: 500; width: 88px; flex-shrink: 0; }
.dm-root .split-track { flex: 1; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.dm-root .split-bar { height: 100%; border-radius: 3px; }
.dm-root .split-val { font-size: 12px; font-weight: 600; color: var(--text-primary); width: 48px; text-align: right; }

/* BOTTOM */
.dm-root .bottom-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 16px; }

/* TABLE */
.dm-root .tbl-wrap { overflow-x: auto; }
.dm-root table { width: 100%; border-collapse: collapse; background: transparent; }
.dm-root thead th {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); padding: 0 10px 10px; text-align: left;
  border-bottom: 1.5px solid var(--border);
}
.dm-root tbody tr { transition: background .12s; cursor: default; }
.dm-root tbody tr:hover { background: #f8f9fc; }
.dm-root tbody td { padding: 10px 10px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-primary); }
.dm-root tbody tr:last-child td { border-bottom: none; }
.dm-root .t-name { font-weight: 600; color: var(--text-primary); }
.dm-root .t-id { font-size: 11px; color: var(--text-muted); }
.dm-root .t-amount { font-weight: 700; font-size: 13.5px; }
.dm-root .badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.dm-root .badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; }
.dm-root .b-paid { background: #ecfdf5; color: #059669; } .dm-root .b-paid::before { background: #059669; }
.dm-root .b-pending { background: #fffbeb; color: #d97706; } .dm-root .b-pending::before { background: #d97706; }
.dm-root .b-overdue { background: #fff1f2; color: #e11d48; } .dm-root .b-overdue::before { background: #e11d48; }

/* ACTIVITY */
.dm-root .act-list { display: flex; flex-direction: column; }
.dm-root .act-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.dm-root .act-item:last-child { border-bottom: none; }
.dm-root .act-icon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.dm-root .act-text { font-size: 12.5px; font-weight: 500; line-height: 1.4; color: var(--text-primary); }
.dm-root .act-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* RESPONSIVE */
.dm-root .overlay { display: none; position: absolute; inset: 0; background: rgba(0,0,0,.4); z-index: 199; }
.dm-root .overlay.open { display: block; }

@media (max-width: 1280px) {
  .dm-root .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .dm-root .section-row { grid-template-columns: 1fr; }
  .dm-root .bottom-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 960px) {
  .dm-root .bottom-row { grid-template-columns: 1fr; }
  .dm-root .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .dm-root .sidebar { transform: translateX(-100%); }
  .dm-root .sidebar.open { transform: translateX(0); }
  .dm-root .main { margin-left: 0; }
  .dm-root .hamburger { display: flex; }
  .dm-root .search-bar { width: 200px; }
  .dm-root .avatar-info { display: none; }
  .dm-root .content { padding: 16px; }
}
@media (max-width: 480px) {
  .dm-root .kpi-grid { grid-template-columns: 1fr 1fr; }
  .dm-root .search-bar { width: 150px; }
  .dm-root .top-pill { display: none; }
}

@keyframes dm-fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dm-root .kpi:nth-child(1) { animation-delay: .04s } .dm-root .kpi:nth-child(2) { animation-delay: .08s }
.dm-root .kpi:nth-child(3) { animation-delay: .12s } .dm-root .kpi:nth-child(4) { animation-delay: .16s }
.dm-root .kpi:nth-child(5) { animation-delay: .20s } .dm-root .kpi:nth-child(6) { animation-delay: .24s }
