:root {
  --dmec-primary: #2563eb;
  --dmec-accent: #f97316;
  --dmec-ink: #0f172a;
  --dmec-muted: #64748b;
  --dmec-line: #e2e8f0;
  --dmec-soft: #f8fafc;
  --dmec-card: rgba(255, 255, 255, .92);
  --dmec-shadow: 0 18px 45px rgba(15, 23, 42, .09);
}

body {
  font-family: "Sarabun", "Source Sans Pro", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, .12), transparent 32rem),
    radial-gradient(circle at top right, rgba(249, 115, 22, .12), transparent 30rem),
    #eef2f7;
  color: var(--dmec-ink);
}

.content-wrapper {
  background: transparent;
}

.dmec-page {
  padding-bottom: 24px;
}

.dmec-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(239, 246, 255, .92));
  box-shadow: 0 12px 30px rgba(15, 23, 42, .07);
}

.dmec-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(37, 99, 235, .55), rgba(249, 115, 22, .42), rgba(20, 184, 166, .28));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.dmec-hero-title {
  font-size: clamp(1.28rem, 2.2vw, 1.8rem);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.18;
}

.dmec-hero-subtitle {
  color: var(--dmec-muted);
  font-size: .9rem;
}

.dmec-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--dmec-line);
  border-radius: 999px;
  padding: 6px 12px;
  background: #fff;
  color: #334155;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
}

.dmec-kpi-card,
.dmec-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, .92);
  border-radius: 16px;
  background: var(--dmec-card);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .075);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.dmec-kpi-card:hover,
.dmec-panel:hover {
  transform: translateY(-3px);
  border-color: rgba(37, 99, 235, .28);
  box-shadow: 0 22px 48px rgba(15, 23, 42, .12);
}

.dmec-kpi-card::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -48px;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: var(--kpi-glow, rgba(37, 99, 235, .12));
}

.dmec-kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--kpi-color, var(--dmec-primary));
  box-shadow: 0 12px 22px rgba(37, 99, 235, .22);
}

.dmec-kpi-label {
  color: var(--dmec-muted);
  font-weight: 700;
  margin: 0;
}

.dmec-kpi-value {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1;
  font-weight: 900;
  margin: 10px 0 0;
}

.dmec-kpi-note {
  color: var(--dmec-muted);
  font-size: .9rem;
}

.dmec-chart-box {
  position: relative;
  height: 330px;
}

.dmec-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 0;
}

.dmec-panel-title {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0;
}

.dmec-panel-title i {
  color: var(--dmec-primary);
}

.dmec-panel-body {
  padding: 18px 20px 20px;
}

.dmec-table {
  margin: 0;
}

.dmec-table thead th {
  border-top: 0;
  color: #475569;
  background: #f8fafc;
  font-size: .86rem;
  white-space: nowrap;
}

.dmec-table td {
  vertical-align: middle;
}

.dmec-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 800;
  background: #eff6ff;
  color: var(--dmec-primary);
}

.dmec-count-badge.danger {
  background: #fff1f2;
  color: #e11d48;
}

.dmec-count-badge.success {
  background: #ecfdf5;
  color: #059669;
}

.dmec-fade-up {
  animation: dmecFadeUp .45s ease both;
}

.dmec-delay-1 { animation-delay: .04s; }
.dmec-delay-2 { animation-delay: .08s; }
.dmec-delay-3 { animation-delay: .12s; }
.dmec-delay-4 { animation-delay: .16s; }
.dmec-delay-5 { animation-delay: .20s; }

@keyframes dmecFadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 767.98px) {
  .dmec-hero,
  .dmec-kpi-card,
  .dmec-panel {
    border-radius: 14px;
  }

  .dmec-chart-box {
    height: 280px;
  }

  .dmec-panel-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
