/* ============================================================
   BMT modern dashboard kit  (.dm-*)
   Shared by company / super-admin / teacher dashboards.
   ============================================================ */
:root {
  --dm-bg: #f4f6fb;
  --dm-card: #ffffff;
  --dm-ink: #1c2540;
  --dm-muted: #6b7694;
  --dm-line: #e8ecf5;
  --dm-brand: #5b5bf0;
  --dm-brand-2: #8b5cf6;
  --dm-ok: #10b981;
  --dm-warn: #f59e0b;
  --dm-bad: #ef4444;
  --dm-info: #0ea5e9;
  --dm-radius: 18px;
  --dm-shadow: 0 1px 2px rgba(28, 37, 64, .04), 0 8px 24px rgba(28, 37, 64, .06);
}

.dm-wrap { padding: 1.25rem 1.5rem 2.5rem; color: var(--dm-ink); }
.dm-wrap * { box-sizing: border-box; }
.dm-grid { display: grid; gap: 1.1rem; }
.dm-g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dm-g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dm-g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dm-g-7-5 { grid-template-columns: 7fr 5fr; }
.dm-g-8-4 { grid-template-columns: 8fr 4fr; }
.dm-mt { margin-top: 1.1rem; }
@media (max-width: 1199px) { .dm-g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dm-g-7-5, .dm-g-8-4, .dm-g3 { grid-template-columns: 1fr; } }
@media (max-width: 575px) { .dm-g4, .dm-g2 { grid-template-columns: 1fr; } .dm-wrap { padding: 1rem .75rem 2rem; } }

/* hero */
.dm-hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 1.6rem 1.8rem; color: #fff;
  background: linear-gradient(120deg, #4338ca 0%, #6d5bf0 45%, #a855f7 100%);
  box-shadow: 0 14px 34px rgba(91, 91, 240, .32);
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between;
}
.dm-hero::before, .dm-hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.1); }
.dm-hero::before { width: 260px; height: 260px; right: -60px; top: -110px; }
.dm-hero::after { width: 160px; height: 160px; right: 160px; bottom: -90px; }
.dm-hero > * { position: relative; z-index: 1; }
.dm-hero h2 { margin: 0; font-size: 1.55rem; font-weight: 700; color: #fff !important; }
.dm-hero p { margin: .25rem 0 0; opacity: .85; font-size: .9rem; }
.dm-hero-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.dm-btn {
  display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .95rem; border-radius: 12px;
  font-size: .8rem; font-weight: 600; border: 1px solid rgba(255,255,255,.35); color: #fff;
  background: rgba(255,255,255,.14); backdrop-filter: blur(6px); text-decoration: none; transition: .15s;
}
.dm-btn:hover { background: rgba(255,255,255,.28); color: #fff; }
.dm-btn.solid { background: #77d810; color: var(--dm-brand); border-color: #fff; }
.dm-btn.solid:hover { background: #eef; color: var(--dm-brand); }

/* card */
.dm-card { background: var(--dm-card); border-radius: var(--dm-radius); box-shadow: var(--dm-shadow); border: 1px solid var(--dm-line); min-width: 0; }
.dm-card-h { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.2rem .4rem; }
.dm-card-h h6 { margin: 0; font-size: .95rem; font-weight: 700; color: var(--dm-ink); }
.dm-card-h small { color: var(--dm-muted); font-size: .75rem; }
.dm-card-b { padding: .6rem 1.2rem 1.2rem; }
.dm-select {
  border: 1px solid var(--dm-line); background: #f8f9fe; color: var(--dm-ink); border-radius: 10px;
  padding: .3rem .6rem; font-size: .78rem; outline: none;
}

/* KPI tile */
.dm-kpi { position: relative; overflow: hidden; padding: 1.1rem 1.2rem; }
.dm-kpi-top { display: flex; justify-content: space-between; align-items: flex-start; }
.dm-kpi-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--dm-muted); }
.dm-kpi-value { font-size: 1.75rem; font-weight: 800; line-height: 1.15; margin: .25rem 0 .1rem; color: var(--dm-ink); }
.dm-kpi-ico {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-size: 1.1rem;
  box-shadow: 0 8px 18px rgba(0,0,0,.14);
}
.dm-kpi-foot { display: flex; align-items: center; gap: .5rem; font-size: .76rem; color: var(--dm-muted); margin-top: .35rem; }
.dm-kpi canvas { width: 100% !important; height: 46px !important; margin-top: .55rem; }
.g-indigo { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.g-rose   { background: linear-gradient(135deg, #f43f5e, #fb923c); }
.g-sky    { background: linear-gradient(135deg, #0ea5e9, #22d3ee); }
.g-amber  { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.g-emerald{ background: linear-gradient(135deg, #10b981, #34d399); }
.g-slate  { background: linear-gradient(135deg, #475569, #64748b); }

/* delta chip */
.dm-chip { display: inline-flex; align-items: center; gap: .2rem; padding: .08rem .5rem; border-radius: 99px; font-size: .72rem; font-weight: 700; }
.dm-chip.up { background: #dcfce7; color: #15803d; }
.dm-chip.down { background: #fee2e2; color: #b91c1c; }
.dm-chip.flat { background: #eef0f7; color: var(--dm-muted); }

/* monitor */
.dm-health { display: flex; align-items: center; gap: 1rem; padding: .4rem 0 1rem; }
.dm-ring { --p: 0; --c: var(--dm-ok); width: 92px; height: 92px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), #eceffa 0); position: relative; }
.dm-ring::before { content: ""; position: absolute; inset: 9px; background: var(--dm-card); border-radius: 50%; }
.dm-ring span { position: relative; font-weight: 800; font-size: 1.15rem; }
.dm-alerts { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.dm-alert { display: flex; gap: .7rem; padding: .65rem .8rem; border-radius: 12px; background: #f7f8fd; border-left: 4px solid var(--dm-info); font-size: .82rem; }
.dm-alert b { display: block; color: var(--dm-ink); }
.dm-alert span { color: var(--dm-muted); font-size: .76rem; }
.dm-alert.ok { border-color: var(--dm-ok); }
.dm-alert.warn { border-color: var(--dm-warn); background: #fffaf0; }
.dm-alert.bad { border-color: var(--dm-bad); background: #fff5f5; }
.dm-alert i { font-size: 1rem; margin-top: .1rem; }
.dm-alert.ok i { color: var(--dm-ok); } .dm-alert.warn i { color: var(--dm-warn); } .dm-alert.bad i { color: var(--dm-bad); } .dm-alert.info i { color: var(--dm-info); }

/* mini stats row */
.dm-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.dm-mini div { background: #f7f8fd; border-radius: 12px; padding: .6rem .75rem; }
.dm-mini small { display: block; color: var(--dm-muted); font-size: .68rem; text-transform: uppercase; font-weight: 700; letter-spacing: .05em; }
.dm-mini b { font-size: 1.05rem; }

/* tabs */
.dm-tabs { display: flex; gap: .35rem; padding: .3rem; background: #f1f3fb; border-radius: 12px; margin: .4rem 1.2rem .6rem; width: fit-content; max-width: calc(100% - 2.4rem); overflow-x: auto; }
.dm-tab { border: 0; background: transparent; padding: .38rem .8rem; border-radius: 9px; font-size: .78rem; font-weight: 600; color: var(--dm-muted); white-space: nowrap; cursor: pointer; }
.dm-tab.active { background: #fff; color: var(--dm-brand); box-shadow: 0 2px 8px rgba(28,37,64,.1); }
.dm-tab em { font-style: normal; margin-left: .3rem; background: var(--dm-brand); color: #fff; padding: 0 .4rem; border-radius: 99px; font-size: .68rem; }
.dm-pane.hidden { display: none; }

/* table */
.dm-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.dm-table th { text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--dm-muted); padding: .55rem .9rem; border-bottom: 1px solid var(--dm-line); white-space: nowrap; }
.dm-table td { padding: .65rem .9rem; border-bottom: 1px solid var(--dm-line); vertical-align: middle; }
.dm-table tr:last-child td { border-bottom: 0; }
.dm-table tbody tr:hover { background: #fafbff; }
.dm-scroll { overflow-x: auto; }
.dm-empty { text-align: center; color: var(--dm-muted); padding: 1.6rem 0; font-size: .85rem; }
.dm-avatar { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .85rem; flex: none; }

/* ranked list */
.dm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.dm-li { display: flex; align-items: center; gap: .8rem; padding: .65rem .8rem; background: #f7f8fd; border-radius: 14px; }
.dm-li .t { flex: 1; min-width: 0; }
.dm-li .t b { display: block; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-li .t small { color: var(--dm-muted); font-size: .72rem; }
.dm-li .v { font-weight: 700; font-size: .85rem; color: var(--dm-ok); text-align: right; }
.dm-rank { width: 26px; height: 26px; border-radius: 8px; background: #e9ebfb; color: var(--dm-brand); font-weight: 800; font-size: .75rem; display: grid; place-items: center; flex: none; }

/* progress */
.dm-bar { height: 8px; background: #eceffa; border-radius: 99px; overflow: hidden; }
.dm-bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--dm-brand), var(--dm-brand-2)); }
.dm-prow { margin-bottom: .9rem; }
.dm-prow .l { display: flex; justify-content: space-between; font-size: .78rem; margin-bottom: .3rem; color: var(--dm-muted); }
.dm-prow .l b { color: var(--dm-ink); }

.dm-chart { position: relative; height: 300px; }
.dm-chart.sm { height: 240px; }
.dm-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .35rem; }

/* ---------- dark mode (html.dark) ---------- */
html.dark {
  --dm-bg: #0f1424; --dm-card: #171d33; --dm-ink: #e8ecfa; --dm-muted: #94a0c4; --dm-line: #262e4a;
  --dm-shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
}
html.dark .dm-select { background: #1d2540; }
html.dark .dm-tabs { background: #1d2540; }
html.dark .dm-tab.active { background: #2a3355; color: #c7c9ff; }
html.dark .dm-table tbody tr:hover { background: #1b2340; }
html.dark .dm-li, html.dark .dm-mini div, html.dark .dm-alert { background: #1d2540; }
html.dark .dm-alert.warn { background: #2b2616; } html.dark .dm-alert.bad { background: #2d1b22; }
html.dark .dm-bar, html.dark .dm-ring { background-color: #262e4a; }
html.dark .dm-ring { background: conic-gradient(var(--c) calc(var(--p) * 1%), #262e4a 0); }
html.dark .dm-rank { background: #2a3355; color: #c7c9ff; }
html.dark .dm-chip.flat { background: #262e4a; }
html.dark .dm-chip.up { background: #12351f; color: #6ee7a0; } html.dark .dm-chip.down { background: #3a1a1f; color: #fca5a5; }

#leadRequests { scroll-margin-top: 90px; }
