/* ============ DESIGN TOKENS — SIGMA ============ */
:root[data-theme="light"] {
  --bg-body: #F0F4F8;
  --bg-card: #FFFFFF;
  --bg-sidebar: #FFFFFF;
  --bg-hover: #F8FAFC;
  --bg-muted: #F1F5F9;
  --t-base: #1E293B;
  --t-muted: #64748B;
  --t-light: #94A3B8;
  --t-inverse: #FFFFFF;
  --border: #E4E8EF;
  --border-soft: #EEF1F5;
  --primary: #2563EB;
  --primary-light: #3B82F6;
  --primary-dark: #1D4ED8;
  --primary-soft: #EFF6FF;
  --success: #10B981;
  --success-soft: #ECFDF5;
  --warning: #F59E0B;
  --warning-soft: #FFFBEB;
  --danger: #EF4444;
  --danger-soft: #FEF2F2;
  --info: #0EA5E9;
  --info-soft: #F0F9FF;
  --purple: #8B5CF6;
  --purple-soft: #F5F3FF;
  --pink: #EC4899;
  --teal: #14B8A6;
  --orange: #F97316;
  --shadow-sm: 0 1px 2px 0 rgb(15 23 42 / 0.05);
  --shadow-card: 0 4px 6px -1px rgb(0 0 0 / 0.03), 0 2px 4px -2px rgb(0 0 0 / 0.03), 0 0 0 1px var(--border-soft);
  --overlay: rgba(240, 244, 248, 0.72);
}

:root[data-theme="dark"] {
  --bg-body: #0B1120;
  --bg-card: #141B2D;
  --bg-sidebar: #141B2D;
  --bg-hover: #1C2438;
  --bg-muted: #1A2237;
  --t-base: #F1F5F9;
  --t-muted: #94A3B8;
  --t-light: #64748B;
  --t-inverse: #0B1120;
  --border: #222C42;
  --border-soft: #1A2237;
  --primary: #60A5FA;
  --primary-light: #93C5FD;
  --primary-dark: #3B82F6;
  --primary-soft: #0F2847;
  --success: #34D399;
  --danger: #F87171;
  --info: #38BDF8;
  --shadow-card: 0 1px 3px 0 rgb(0 0 0 / 0.3);
  --overlay: rgba(11, 17, 32, 0.72);
}

/* ============ RESET + BASE ============ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Inter+Tight:wght@500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-body);
  color: var(--t-base);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ============ SHELL LAYOUT ============ */
.shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  height: 100vh;
  overflow: hidden;
}

.d-sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 22px 16px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  position: relative;
}

.d-topbar {
  height: 60px;
  min-height: 60px;
  max-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.2s ease, border-color 0.2s ease;
  box-sizing: border-box;
}

[data-shell-topbar] {
  flex-shrink: 0;
}

.content {
  padding: 24px 32px 32px 32px;
  flex: 1;
}

/* ============ ERROR PAGES ============ */
.error-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg-body);
  padding: 20px;
}

.error-card {
  background: var(--bg-card);
  padding: 48px;
  border-radius: 24px;
  box-shadow: var(--shadow-card);
  max-width: 560px;
  width: 100%;
  text-align: center;
  border: 1px solid var(--border);
}

.error-code {
  font-size: 140px;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 10px 0 20px;
}

.error-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}

.error-sub {
  color: var(--t-muted);
  margin-bottom: 32px;
  line-height: 1.6;
}

.error-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 32px;
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  transition: all 180ms ease;
  cursor: pointer;
  border: 0;
  font-family: inherit;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
}

.btn--primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn--ghost {
  background: var(--bg-muted);
  color: var(--t-base);
  border: 1px solid var(--border);
}

.btn--ghost:hover {
  background: var(--bg-hover);
}

.btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.btn--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--bg-muted);
  color: var(--t-muted);
  transition: all 180ms ease;
  cursor: pointer;
  border: 0;
}

.btn--icon:hover {
  background: var(--bg-hover);
  color: var(--primary);
}

.btn--icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* ============ GRID SYSTEM ============ */
.grid {
  display: flex;
  flex-wrap: wrap;
  margin: -12px;
  width: calc(100% + 24px);
}

[class*="col-"] {
  padding: 12px;
  flex: 0 0 100%;
  max-width: 100%;
}

@media (max-width: 992px) {
  html, body {
    overflow-x: hidden;
    height: auto !important;
    min-height: 100% !important;
  }

  .shell {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 100vh !important;
    overflow: visible !important;
  }

  .main {
    height: auto !important;
    min-height: 100vh !important;
    overflow: visible !important;
    overflow-y: visible !important;
    display: block !important;
    width: 100% !important;
    margin-left: 0 !important;
    flex: none !important;
  }

  .content {
    padding: 16px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .d-sidebar {
    display: none;
  }

  /* Mobile Sidebar Drawer Navigation */
  .has-drawer-open {
    overflow: hidden !important;
  }

  .has-drawer-open .d-sidebar {
    display: flex !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
    width: 270px !important;
    z-index: 10000 !important;
    background: var(--bg-sidebar);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3) !important;
    overflow-y: auto !important;
  }

  .drawer-backdrop {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    z-index: 9999 !important;
  }

  .d-topbar {
    padding: 0 16px;
    width: 100%;
    box-sizing: border-box;
  }

  /* Mobile Topbar Dropdowns (Notifikasi, Pesan, Profile) */
  .topbar-actions {
    position: static !important;
  }

  .dd-wrap {
    position: static !important;
  }

  .dd-menu {
    position: fixed !important;
    top: 62px !important;
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: calc(100vw - 24px) !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--border) !important;
    z-index: 99999 !important;
  }

  .dd-menu.dd-profile {
    min-width: 0 !important;
  }

  /* Mobile Dashboard Layout Fixes */
  .hero {
    padding: 16px 0 !important;
    min-height: unset !important;
    gap: 12px !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .hero-title {
    font-size: 18px !important;
  }

  .hero-sub {
    font-size: 12px !important;
  }

  .hero-actions {
    width: 100% !important;
    flex-wrap: wrap !important;
  }

  .hero-actions .btn {
    flex: 1 1 auto !important;
    justify-content: center !important;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
    margin-bottom: 16px !important;
  }

  .kpi-card {
    padding: 14px 14px 12px !important;
    gap: 8px !important;
  }

  .kpi-value {
    font-size: 24px !important;
  }

  .grid {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    margin-top: 16px !important;
    gap: 16px !important;
  }

  .col-12 {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin-top: 0 !important;
  }

  .col-12 > div {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  /* Hide empty spacer divs on mobile */
  .col-12 > div:empty {
    display: none !important;
  }

  .card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 16px !important;
    border-radius: 12px !important;
  }

  .card-head {
    padding: 12px 14px 4px !important;
    margin-bottom: 12px !important;
  }

  .card-body {
    padding: 12px 14px !important;
  }

  .chart-canvas-wrap {
    padding: 8px 12px !important;
  }

  .chart-meta-row {
    flex-wrap: wrap !important;
    gap: 12px !important;
    padding: 10px 14px !important;
  }
}

/* Touch-Scrollable Table Wrappers for Mobile Devices */
div[style*="overflow-x"],
.table-responsive,
.table-scroll {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-x pan-y !important;
}

@media (max-width: 992px) {
  div[style*="overflow-x"],
  .table-responsive,
  .table-scroll {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  table.data-table,
  table.table {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .filter-input,
  .card-head select,
  .card-head input {
    max-width: 100% !important;
    width: 100% !important;
  }
}

.dd-empty {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 24px 16px !important;
  text-align: center !important;
  color: var(--t-muted) !important;
  font-size: 13px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  gap: 8px !important;
}


@media (min-width: 768px) {
  .col-3 {
    flex: 0 0 25%;
    max-width: 25%;
  }

  .col-4 {
    flex: 0 0 33.333%;
    max-width: 33.333%;
  }

  .col-6 {
    flex: 0 0 50%;
    max-width: 50%;
  }

  .col-8 {
    flex: 0 0 66.666%;
    max-width: 66.666%;
  }

  .col-9 {
    flex: 0 0 75%;
    max-width: 75%;
  }

  .col-12 {
    flex: 0 0 100%;
    max-width: 100%;
  }
}


/* ============ CARDS ============ */
.card {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.card-head {
  padding: 12px 32px 2px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
}

.card-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.card-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--t-base);
  letter-spacing: -0.01em;
}

.card-body {
  padding: 10px 32px 32px;
}

/* ============ MODERN COMPONENTS ============ */
.data-toolbar {
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-card);
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--t-light);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 11px 16px 11px 44px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg-muted);
  font-size: 13.5px;
  transition: all 0.2s;
  color: var(--t-base);
}

.search-box input:focus {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.select-sm {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  font-size: 13px;
  font-weight: 600;
  color: var(--t-base);
  cursor: pointer;
  transition: all 0.2s;
}

.select-sm:hover {
  border-color: var(--primary);
  background: var(--bg-muted);
}

.data-toolbar-left,
.data-toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-scroll {
  overflow-x: auto;
  margin: 0;
  width: 100%;
}

.data-row:hover {
  background: var(--bg-hover);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-muted);
  color: var(--t-muted);
}

.badge.primary {
  background: var(--primary-soft);
  color: var(--primary);
}

.badge.success {
  background: var(--success-soft);
  color: var(--success);
}

.badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.data-cell-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
}

.data-cell-actions {
  display: flex;
  gap: 4px;
}

.input-icon {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-icon .ico {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--t-light);
  display: flex;
  pointer-events: none;
}

.input-icon .ico svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
}

.input-icon .input,
.input-icon .form-control {
  padding-left: 40px !important;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 11px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--t-base);
  font-size: 14px;
  font-family: inherit;
  transition: all 180ms ease;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.sort svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  margin-left: 4px;
  vertical-align: middle;
}

th.sorted-asc .sort svg {
  color: var(--primary);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .field.span-2 {
    grid-column: span 1;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field.span-2 {
  grid-column: span 2;
}


.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--t-muted);
}

.req {
  color: var(--danger);
  margin-left: 2px;
}

.section-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  font-weight: 700;
  color: var(--t-base);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 24px 0 16px;
}

.section-h .num {
  color: var(--t-light);
  font-weight: 400;
  font-family: 'JetBrains Mono', monospace;
}

.card-body form>.section-h:first-child {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* ============ FORMS ============ */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--t-muted);
  margin-bottom: 8px;
}

.form-control {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--t-base);
  font-size: 14px;
  font-family: inherit;
  transition: all 200ms cubic-bezier(.4, 0, .2, 1);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.form-control::placeholder {
  color: var(--t-light);
  opacity: 0.6;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* ============ TABLES ============ */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

.table th {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--t-light);
  letter-spacing: 0.14em;
  background: var(--bg-hover);
  text-align: left;
  font-weight: 500;
  white-space: nowrap;
}

.table td {
  font-size: 13px;
  white-space: nowrap;
}

.table th:first-child,
.table td:first-child {
  padding-left: 32px;
}

.table th:last-child,
.table td:last-child {
  padding-right: 32px;
}

.table tr:hover {
  background: var(--bg-hover);
}

/* ============ HERO SECTION ============ */
.hero {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0 16px 0;
  min-height: unset;
}

/* Both naming conventions treated identically */
.hero-text,
.hero-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.hero-sub {
  color: var(--t-muted);
  font-size: 13px;
  margin: 0;
  line-height: 1.4;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ============ UTILS ============ */
.accent {
  color: var(--primary);
}

.eyebrow {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t-light);
  line-height: 1.2;
}

.btn--sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
}

.alert {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  border-radius: 16px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 32px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  animation: slideIn 0.4s cubic-bezier(0, 0, 0.2, 1);
}

.alert svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  stroke-width: 2.5px;
}

.alert span {
  flex: 1;
  line-height: 1.5;
}

.alert--success {
  background: var(--success-soft);
  color: #065f46;
  border-color: #a7f3d0;
}

.alert--danger {
  background: var(--danger-soft);
  color: #991b1b;
  border-color: #fecaca;
}

.alert--warning {
  background: var(--warning-soft);
  color: #92400e;
  border-color: #fde68a;
}

.alert--info {
  background: var(--info-soft);
  color: #075985;
  border-color: #bae6fd;
}

@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

to {
  transform: translateY(0);
  opacity: 1;
}

/* ============ DATA TABLE (TEMPLATE) ============ */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  text-align: left;
  padding: 12px 14px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--t-light);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--t-base);
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background 140ms;
}

.data-table tbody tr:hover td {
  background: var(--bg-hover);
}

/* ============ PAGINATION ============ */
.data-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  margin-top: 0;
  border-top: 1px solid var(--border-soft);
  font-size: 12px;
  color: var(--t-muted);
}

.data-foot-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.data-foot-info .select {
  width: auto;
  padding: 6px 28px 6px 10px;
  font-size: 12px;
}

.pager {
  display: flex;
  gap: 4px;
  align-items: center;
}

.pager-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--t-muted);
  transition: background 160ms, color 160ms;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.pager-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--t-base);
}

.pager-btn.is-active {
  background: var(--primary);
  color: #fff;
}

.pager-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pager-btn svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 992px) {
  [data-shell-sidebar] {
    display: none;
  }

  .d-sidebar {
    left: -248px;
  }

  .main {
    margin-left: 0;
  }

  .d-topbar {
    padding: 0 16px;
  }

  .hero {
    flex-direction: column;
    align-items: stretch;
    padding: 16px 0;
    min-height: unset;
  }
}

/* ============ MODAL SYSTEM ============ */
.d-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  visibility: hidden;
  opacity: 0;
  transition: all 0.25s ease;
}

.d-modal.is-active {
  visibility: visible;
  opacity: 1;
}

.d-modal-bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.d-modal-content {
  position: relative;
  background: var(--bg-card);
  width: 100%;
  max-width: 600px;
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  transform: translateY(20px) scale(0.98);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.d-modal.is-active .d-modal-content {
  transform: translateY(0) scale(1);
}

.d-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.d-modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--t-base);
}

.d-modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(100vh - 180px);
}

.d-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: var(--bg-muted);
}

/* ============ KPI CARD ENHANCEMENTS ============ */
.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: relative;
  flex-wrap: nowrap;
}

.kpi-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.kpi-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--t-muted);
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

.kpi-pill {
  flex-shrink: 0;
  white-space: nowrap;
}

.kpi-value {
  font-size: clamp(20px, 2.2vw, 26px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--t-base);
  white-space: nowrap;
}