/* Diamond ERP — Aurora Light + Command Center tables + dark mode */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ─── Light theme (Aurora) ─── */
:root,
[data-theme="light"] {
  --dm-primary: #1e2d6e;
  --dm-primary-hover: #162358;
  --dm-primary-soft: rgba(30, 45, 110, 0.09);
  --dm-primary-ring: rgba(30, 45, 110, 0.22);

  /* Solid fills — tabs, primary buttons, active pagination */
  --dm-accent: #1e2d6e;
  --dm-accent-hover: #162358;
  --dm-accent-text: #ffffff;
  --dm-link: #1e2d6e;

  --dm-bg: #f5f6f8;
  --dm-surface: #ffffff;
  --dm-surface-2: #f0f2f5;
  --dm-surface-3: #e8ebf0;
  --dm-border: #e4e7ec;
  --dm-border-strong: #d0d5dd;

  --dm-text: #101828;
  --dm-text-2: #344054;
  --dm-text-3: #667085;

  --dm-table-head: #f9fafb;
  --dm-table-row-hover: #f5f7fa;
  --dm-table-zebra: #fafbfc;

  --dm-success: #027a48;
  --dm-warning: #b54708;
  --dm-danger: #b42318;

  --dm-brand-accent: #e31e24;
  --dm-brand-accent-soft: rgba(227, 30, 36, 0.12);
  --dm-brand-accent-ring: rgba(227, 30, 36, 0.22);

  --dm-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --dm-shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --dm-overlay: rgba(255, 255, 255, 0.82);
  --dm-logo-filter: none;

  /* Chart series — Aurora navy ramp (light surfaces) */
  --dm-chart-1: #1e2d6e;
  --dm-chart-2: #2a3a7a;
  --dm-chart-3: #364888;
  --dm-chart-4: #425696;
  --dm-chart-5: #4e64a4;
  --dm-chart-6: #5a72b2;
  --dm-chart-7: #6b8cff;
  --dm-chart-8: #8499d4;

  /* Quote status donut (semantic) */
  --dm-chart-approved: #1e2d6e;
  --dm-chart-pending: #b54708;
  --dm-chart-rejected: #b42318;
  --dm-chart-modified: #667085;
  --dm-chart-grid: #e4e7ec;
  --dm-chart-tooltip-bg: #ffffff;

  /* Bar fills (distribution charts) */
  --dm-bar-1: #364888;
  --dm-bar-2: #425696;
  --dm-bar-3: #4e64a4;
  --dm-bar-4: #5a72b2;
  --dm-bar-5: #1e2d6e;
  --dm-bar-6: #2a3a7a;
  --dm-bar-7: #3d5494;
  --dm-bar-8: #4d64a4;
}

/* ─── Dark theme (Aurora Midnight — deep navy night, high visibility) ─── */
[data-theme="dark"] {
  /* Links & icons on dark surfaces — never use as button/tab fill */
  --dm-primary: #a8b8e0;
  --dm-primary-hover: #c2cff0;
  --dm-primary-soft: rgba(100, 125, 210, 0.14);
  --dm-primary-ring: rgba(130, 155, 220, 0.28);

  /* Solid fills — tabs, buttons, active chips (readable white text) */
  --dm-accent: #4a5faa;
  --dm-accent-hover: #5769b8;
  --dm-accent-text: #ffffff;
  --dm-link: #a8b8e0;

  --dm-primary-solid: #4a5faa;
  --dm-primary-solid-hover: #5769b8;

  --dm-bg: #070b16;
  --dm-surface: #0f1629;
  --dm-surface-2: #151f38;
  --dm-surface-3: #1c2848;
  --dm-border: rgba(130, 155, 210, 0.18);
  --dm-border-strong: rgba(155, 180, 235, 0.32);

  --dm-text: #f4f6fc;
  --dm-text-2: #c5d0eb;
  --dm-text-3: #8e9dc0;

  --dm-table-head: #121c34;
  --dm-table-row-hover: #1a2644;
  --dm-table-zebra: #0c1326;

  --dm-brand-accent: #f06b70;
  --dm-brand-accent-soft: rgba(240, 107, 112, 0.16);
  --dm-brand-accent-ring: rgba(240, 107, 112, 0.28);

  --dm-shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 2px 12px rgba(0, 0, 0, 0.45);
  --dm-shadow-md: 0 1px 0 rgba(255, 255, 255, 0.07) inset, 0 10px 32px rgba(0, 0, 0, 0.55);
  --dm-overlay: rgba(7, 11, 22, 0.85);
  --dm-logo-filter: brightness(0) invert(1);
  --dm-card-edge: rgba(255, 255, 255, 0.08);

  /* Donut / legend — clear separation on navy */
  --dm-chart-1: #eef2fc;
  --dm-chart-2: #d4dcf5;
  --dm-chart-3: #b8c5ef;
  --dm-chart-4: #9aabe6;
  --dm-chart-5: #7d92dc;
  --dm-chart-6: #637ad0;
  --dm-chart-7: #4f66b8;
  --dm-chart-8: #3f56a0;

  /* Quote status donut — vivid on dark surfaces */
  --dm-chart-approved: #9eb2f0;
  --dm-chart-pending: #f0a060;
  --dm-chart-rejected: #f06b70;
  --dm-chart-modified: #8e9dc0;
  --dm-chart-grid: rgba(130, 155, 210, 0.14);
  --dm-chart-tooltip-bg: #151f38;

  /* Distribution bars — vivid but not neon */
  --dm-bar-1: #8fa8e8;
  --dm-bar-2: #a3b6ed;
  --dm-bar-3: #7d97e0;
  --dm-bar-4: #92a9ea;
  --dm-bar-5: #6f8ad8;
  --dm-bar-6: #849de3;
  --dm-bar-7: #7890de;
  --dm-bar-8: #9eb2f0;
}

:root {
  --dm-font: 'Inter', system-ui, -apple-system, sans-serif;
  --dm-radius: 0.375rem;
  --dm-radius-lg: 0.5rem;

  --dm-sidebar-w: clamp(13.5rem, 16vw, 15.5rem);
  --dm-sidebar-collapsed: 3.5rem;
  --dm-sidebar-collapsed-item: 2.5rem;
  --dm-topbar-h: 3.25rem;
  --dm-content-pad: clamp(0.75rem, 2vw, 1.25rem);

  --dm-transition: 0.16s ease;
  color-scheme: light;
}

[data-theme="dark"] { color-scheme: dark; }

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

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--dm-font);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--dm-text);
  background: var(--dm-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background var(--dm-transition), color var(--dm-transition);
}

img { max-width: 100%; height: auto; }

/* ─── Shell ─── */
.dm-app { display: flex; min-height: 100vh; }

.dm-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 999;
  opacity: 0;
  transition: opacity var(--dm-transition);
}

.dm-sidebar-backdrop.is-open { display: block; opacity: 1; }

.dm-sidebar {
  width: var(--dm-sidebar-w);
  background: var(--dm-surface);
  border-right: 1px solid var(--dm-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  height: 100dvh;
  z-index: 1000;
  transition: transform var(--dm-transition), width 0.2s ease;
}

.dm-sidebar.collapsed { width: var(--dm-sidebar-collapsed); }

.dm-sidebar.collapsed .dm-nav-label {
  display: none;
}

.dm-sidebar.collapsed .dm-brand-logo {
  display: none;
}

.dm-sidebar.collapsed .dm-sidebar-header {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  width: 100%;
  min-height: auto;
  padding: 0.375rem 0.25rem 0.5rem;
  box-sizing: border-box;
}

.dm-sidebar.collapsed .dm-sidebar-toggle {
  order: 1;
  margin: 0;
  width: var(--dm-sidebar-collapsed-item);
  height: var(--dm-sidebar-collapsed-item);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dm-sidebar.collapsed .dm-sidebar-brand {
  order: 2;
  display: flex;
  justify-content: center;
  width: 100%;
}

.dm-sidebar.collapsed .dm-brand-icon {
  display: block;
  height: 2rem;
  width: 2rem;
  margin: 0 auto;
  object-fit: cover;
  flex: none;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12);
}

.dm-sidebar.collapsed .dm-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 0.25rem 0 0.75rem;
  gap: 0.1875rem;
  overflow-x: hidden;
  scrollbar-width: thin;
}

.dm-sidebar.collapsed .dm-nav::after {
  content: '';
  position: sticky;
  bottom: 0;
  display: block;
  width: 100%;
  height: 1.25rem;
  margin-top: -1.25rem;
  background: linear-gradient(180deg, transparent, var(--dm-surface) 85%);
  pointer-events: none;
  flex-shrink: 0;
}

.dm-sidebar.collapsed .dm-nav-section:first-child {
  display: none;
}

.dm-sidebar.collapsed .dm-nav-section:not(:first-child) {
  display: block;
  width: 1.5rem;
  height: 0;
  margin: 0.4375rem auto 0.25rem;
  padding: 0;
  border: none;
  border-top: 1px solid var(--dm-border);
  font-size: 0;
  line-height: 0;
  color: transparent;
  overflow: hidden;
  letter-spacing: 0;
  text-transform: none;
  font-weight: normal;
}

.dm-sidebar.collapsed a.dm-nav-link.nav-link {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: var(--dm-sidebar-collapsed-item);
  min-width: var(--dm-sidebar-collapsed-item);
  max-width: var(--dm-sidebar-collapsed-item);
  height: var(--dm-sidebar-collapsed-item);
  margin: 0;
  padding: 0;
  gap: 0;
  flex-shrink: 0;
  border-radius: 0.5rem;
  align-self: center;
}

.dm-sidebar.collapsed .dm-nav-link i {
  width: 1.125rem;
  min-width: 1.125rem;
  margin: 0;
  text-align: center;
  font-size: 0.875rem;
  line-height: 1;
}

.dm-sidebar.collapsed .dm-module-icon {
  width: 1.125rem;
  min-width: 1.125rem;
  height: 1.125rem;
  margin: 0;
}

.dm-sidebar.collapsed .dm-nav-link.active {
  background: var(--dm-surface-2);
  box-shadow: none;
}

.dm-sidebar.collapsed .dm-nav-link.active i {
  color: var(--dm-brand-accent);
}

.dm-sidebar-tooltip {
  position: fixed;
  z-index: 2000;
  padding: 0.375rem 0.625rem;
  border-radius: var(--dm-radius);
  background: var(--dm-text);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--dm-shadow-md);
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 0.12s ease;
}

.dm-sidebar-tooltip.is-visible {
  opacity: 1;
}

.dm-sidebar-tooltip::before {
  content: '';
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 0.3125rem solid transparent;
  border-right-color: var(--dm-text);
}

.dm-brand-logo {
  height: 1.625rem;
  width: auto;
  max-width: 8.5rem;
  object-fit: contain;
  min-width: 0;
  filter: var(--dm-logo-filter);
  transition: filter var(--dm-transition);
}

.dm-brand-icon {
  display: none;
  height: 1.25rem;
  width: 1.25rem;
  object-fit: cover;
  flex-shrink: 0;
  border-radius: 0.375rem;
}

.dm-sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  min-height: var(--dm-topbar-h);
  border-bottom: 1px solid var(--dm-border);
}

.dm-sidebar-brand {
  order: 1;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.dm-sidebar-toggle {
  order: 2;
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--dm-border);
  color: var(--dm-text-3);
  cursor: pointer;
  padding: 0.3rem 0.45rem;
  border-radius: var(--dm-radius);
  line-height: 1;
  flex-shrink: 0;
}

.dm-sidebar-toggle:hover { background: var(--dm-surface-2); color: var(--dm-text); }

.dm-nav {
  flex: 1;
  overflow: auto;
  padding: 0.5rem;
  -webkit-overflow-scrolling: touch;
}

.dm-nav-section {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--dm-text-3);
  padding: 0.875rem 0.5rem 0.35rem;
}

.dm-nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4375rem 0.5rem;
  border-radius: var(--dm-radius);
  color: var(--dm-text-2);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background var(--dm-transition), color var(--dm-transition);
}

.dm-nav-link i {
  width: 1.125rem;
  min-width: 1.125rem;
  text-align: center;
  font-size: 0.8125rem;
  line-height: 1;
  color: var(--dm-text-3);
  flex-shrink: 0;
}

.dm-module-icon {
  display: inline-block;
  width: 1.125rem;
  min-width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  background-color: var(--dm-text-3);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.dm-nav-link:hover .dm-module-icon {
  background-color: var(--dm-text);
}

.dm-nav-link.active .dm-module-icon {
  background-color: var(--dm-brand-accent);
}

.dm-nav-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

.dm-nav-link:hover {
  background: var(--dm-surface-2);
  color: var(--dm-text);
  text-decoration: none;
}

.dm-nav-link.active {
  background: var(--dm-surface-2);
  color: var(--dm-text-2);
}

.dm-nav-link.active .dm-nav-label {
  color: var(--dm-text-2);
}

.dm-nav-link.active i {
  color: var(--dm-brand-accent);
}

/* ─── Main ─── */
.dm-main {
  margin-left: var(--dm-sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  min-width: 0;
  transition: margin-left 0.2s ease;
}

.dm-main.collapsed { margin-left: var(--dm-sidebar-collapsed); }

.dm-topbar {
  height: var(--dm-topbar-h);
  background: var(--dm-surface);
  border-bottom: 1px solid var(--dm-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 var(--dm-content-pad);
  position: sticky;
  top: 0;
  z-index: 100;
}

.dm-topbar-left,
.dm-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
}

.dm-mobile-menu {
  display: none;
  background: transparent;
  border: 1px solid var(--dm-border);
  border-radius: var(--dm-radius);
  padding: 0.35rem 0.5rem;
  color: var(--dm-text-2);
  cursor: pointer;
}

.dm-topbar-dept {
  font-size: 0.8125rem;
  color: var(--dm-text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-topbar-dept strong { color: var(--dm-text); font-weight: 600; }

.dm-topbar-context {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.dm-topbar-title {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
}

.dm-topbar-title strong {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--dm-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-topbar-section {
  font-size: 0.6875rem;
  color: var(--dm-text-3);
  white-space: nowrap;
}

.dm-list-footer {
  padding: 0.75rem 0 0.25rem;
  border-top: 1px solid var(--dm-border);
  margin-top: 0.5rem;
}

.dm-list-empty {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 1.5rem;
  gap: 0.5rem;
}

.dm-list-empty.is-visible {
  display: flex;
}

.dm-list-empty__icon {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dm-surface-2);
  color: var(--dm-primary);
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.dm-list-empty__title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--dm-text);
}

.dm-list-empty__message {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  color: var(--dm-text-3);
  max-width: 22rem;
  line-height: 1.45;
}

/* Aurora checkboxes (tables, permission matrices) */
.dm-checkbox,
input.dm-checkbox,
input[type="checkbox"].dm-checkbox {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 1rem;
  height: 1rem;
  border: 1px solid var(--dm-border);
  border-radius: 3px;
  display: inline-block;
  position: relative;
  cursor: pointer;
  background: var(--dm-surface);
  vertical-align: middle;
  flex-shrink: 0;
}

.dm-checkbox:checked,
input.dm-checkbox:checked {
  background: var(--dm-primary);
  border-color: var(--dm-primary);
}

.dm-checkbox:checked::after,
input.dm-checkbox:checked::after {
  content: '';
  position: absolute;
  top: 42%;
  left: 50%;
  width: 0.3rem;
  height: 0.55rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

.dm-icon-btn--action {
  color: var(--dm-primary);
  border-color: var(--dm-border);
}

.dm-icon-btn--action:hover {
  background: var(--dm-surface-2);
  color: var(--dm-brand-accent);
}

/* Notification bell */
.dm-notify {
  position: relative;
}

.dm-notify__trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--dm-border);
  border-radius: var(--dm-radius);
  background: var(--dm-surface);
  color: var(--dm-text-2);
  cursor: pointer;
  font-size: 1rem;
}

.dm-notify__trigger:hover {
  color: var(--dm-primary);
  border-color: var(--dm-primary);
}

.dm-notify__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--dm-brand-accent);
  color: #fff;
  font-size: 0.5625rem;
  font-weight: 700;
  line-height: 1rem;
  text-align: center;
}

.dm-notify__panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 1200;
  width: min(22rem, calc(100vw - 2rem));
  background: var(--dm-surface);
  border: 1px solid var(--dm-border);
  border-radius: var(--dm-radius);
  box-shadow: var(--dm-shadow-md);
  overflow: hidden;
}

.dm-notify__panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--dm-border);
  font-size: 0.8125rem;
}

.dm-notify__mark-all {
  border: none;
  background: none;
  color: var(--dm-primary);
  font-size: 0.6875rem;
  cursor: pointer;
  padding: 0;
}

.dm-notify__list {
  max-height: 18rem;
  overflow-y: auto;
}

.dm-notify__empty {
  margin: 0;
  padding: 1.25rem 0.75rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--dm-text-3);
}

.dm-notify__item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: none;
  border-bottom: 1px solid var(--dm-border);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.dm-notify__item:hover {
  background: var(--dm-surface-2);
}

.dm-notify__item.is-unread {
  background: var(--dm-surface-2);
  border-left: 3px solid var(--dm-primary);
}

.dm-notify__item-icon {
  flex: 0 0 1.25rem;
  padding-top: 0.125rem;
}

.dm-notify__item-icon .dm-module-icon {
  width: 1.125rem;
  height: 1.125rem;
}

.dm-notify__item-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.125rem;
  min-width: 0;
  flex: 1;
}

.dm-notify-chip {
  display: inline-block;
  font-size: 0.5625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--dm-primary);
  background: var(--dm-primary-soft);
  border-radius: 999px;
  padding: 0.125rem 0.375rem;
  line-height: 1.2;
}

.dm-notify__item-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--dm-text);
}

.dm-notify__item-sub {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--dm-text-2);
  line-height: 1.35;
}

.dm-notify__item-msg {
  font-size: 0.6875rem;
  color: var(--dm-text-3);
  line-height: 1.4;
}

.dm-notify__item-time {
  font-size: 0.625rem;
  color: var(--dm-text-3);
}

.dm-notify__panel-foot {
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--dm-border);
  text-align: center;
  font-size: 0.6875rem;
}

.dm-notify__panel-foot a {
  color: var(--dm-primary);
  text-decoration: none;
}

.dm-inbox-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.dm-inbox-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dm-inbox-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--dm-border);
  border-radius: var(--dm-radius);
  background: var(--dm-surface);
  cursor: pointer;
}

.dm-inbox-item.is-unread {
  border-left: 3px solid var(--dm-primary);
  background: var(--dm-surface-2);
}

.dm-inbox-item__title {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
}

.dm-inbox-item__message {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  color: var(--dm-text-3);
  line-height: 1.45;
}

.dm-inbox-item__meta {
  margin: 0;
  font-size: 0.6875rem;
  color: var(--dm-text-3);
}

.dm-inbox-panel .dm-toolbar {
  border-bottom: none;
  padding-bottom: 0;
}

.dm-inbox-panel .dm-inbox-list {
  padding: 0.75rem;
}

/* System audit log (admin / superuser) */
.dm-audit-panel .dm-toolbar {
  border-bottom: 1px solid var(--dm-border);
  padding-bottom: 0.75rem;
}

.dm-audit-filters {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--dm-border);
  background: var(--dm-surface-2);
}

.dm-audit-filters__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr));
  gap: 0.625rem;
  margin-bottom: 0.625rem;
}

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

.dm-field__label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--dm-text-3);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dm-audit-filters__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dm-audit-action {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--dm-surface-3);
  color: var(--dm-text-2);
}

.dm-audit-action--view { background: color-mix(in srgb, var(--dm-primary) 12%, var(--dm-surface)); color: var(--dm-primary); }
.dm-audit-action--create { background: color-mix(in srgb, var(--dm-success) 14%, var(--dm-surface)); color: var(--dm-success); }
.dm-audit-action--edit { background: color-mix(in srgb, var(--dm-warning) 14%, var(--dm-surface)); color: var(--dm-warning); }
.dm-audit-action--delete { background: color-mix(in srgb, var(--dm-danger) 14%, var(--dm-surface)); color: var(--dm-danger); }
.dm-audit-action--export { background: color-mix(in srgb, var(--dm-chart-7) 18%, var(--dm-surface)); color: var(--dm-chart-1); }

.dm-audit-detail {
  max-width: 18rem;
  font-size: 0.8125rem;
  color: var(--dm-text-2);
  word-break: break-word;
}

.dm-audit-actor-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--dm-primary);
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dm-audit-actor-link:hover {
  color: var(--dm-brand-accent);
}

.dm-audit-actor-card__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--dm-border);
}

.dm-audit-actor-card__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--dm-radius-lg);
  background: var(--dm-brand-accent-soft);
  color: var(--dm-brand-accent);
  font-size: 1.125rem;
  flex-shrink: 0;
}

.dm-audit-actor-card__name {
  margin: 0 0 0.125rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--dm-text);
}

.dm-audit-actor-card__meta {
  margin: 0;
  font-size: 0.75rem;
  color: var(--dm-text-3);
}

.dm-audit-actor-card__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.625rem 1rem;
}

.dm-audit-actor-card__field label {
  display: block;
  margin-bottom: 0.125rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--dm-text-3);
}

.dm-audit-actor-card__field p {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--dm-text);
  word-break: break-word;
}

.dm-audit-actor-card__status {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
}

.dm-audit-actor-card__status.is-active {
  background: color-mix(in srgb, var(--dm-success) 14%, var(--dm-surface));
  color: var(--dm-success);
}

.dm-audit-actor-card__status.is-inactive {
  background: color-mix(in srgb, var(--dm-danger) 12%, var(--dm-surface));
  color: var(--dm-danger);
}

.dm-audit-actor-card__esignature {
  margin-top: 0.875rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--dm-border);
}

.dm-audit-actor-card__esignature img {
  max-height: 2.5rem;
  max-width: 8rem;
  object-fit: contain;
}

.dm-audit-actor-loading,
.dm-audit-actor-error {
  font-size: 0.875rem;
  color: var(--dm-text-2);
  text-align: center;
  padding: 1rem 0;
}

.dm-inbox-item__icon {
  flex: 0 0 1.5rem;
  padding-top: 0.125rem;
}

.dm-inbox-item__icon .dm-module-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.dm-inbox-item__main {
  flex: 1;
  min-width: 0;
}

.dm-inbox-item__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.25rem;
}

.dm-inbox-item__subtitle {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--dm-text-2);
}

.dm-inbox-item__go {
  flex-shrink: 0;
  align-self: center;
}

/* Theme toggle */
.dm-theme-toggle {
  display: inline-flex;
  padding: 2px;
  background: var(--dm-surface-2);
  border: 1px solid var(--dm-border);
  border-radius: var(--dm-radius);
  gap: 2px;
}

.dm-theme-toggle button {
  border: none;
  background: transparent;
  color: var(--dm-text-3);
  padding: 0.3rem 0.5rem;
  border-radius: calc(var(--dm-radius) - 2px);
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
  transition: background var(--dm-transition), color var(--dm-transition);
}

.dm-theme-toggle button.is-active {
  background: var(--dm-surface);
  color: var(--dm-primary);
  box-shadow: var(--dm-shadow-sm);
}

.dm-theme-toggle button:hover:not(.is-active) {
  color: var(--dm-text);
}

/* User menu */
.dm-user-menu .dm-user-menu__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: var(--dm-radius);
  font-size: 1.125rem;
  line-height: 1;
  border: 1px solid var(--dm-border);
  background: var(--dm-surface);
  color: var(--dm-brand-accent);
  box-shadow: none;
}

.dm-user-menu .dm-user-menu__trigger:hover,
.dm-user-menu .dm-user-menu__trigger:focus,
.dm-user-menu.show .dm-user-menu__trigger {
  background: var(--dm-brand-accent-soft);
  color: var(--dm-brand-accent);
  border-color: var(--dm-border-strong);
  box-shadow: none;
}

.dm-user-menu .dropdown-menu {
  background: var(--dm-surface);
  border: 1px solid var(--dm-border);
  border-radius: var(--dm-radius-lg);
  box-shadow: var(--dm-shadow-md);
  padding: 0.25rem;
  min-width: 11rem;
  margin-top: 0.375rem;
}

.dm-user-menu__name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--dm-text);
  padding: 0.5rem 0.75rem 0.375rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 14rem;
}

.dm-user-menu .dropdown-item {
  font-size: 0.8125rem;
  padding: 0.4375rem 0.625rem;
  border-radius: var(--dm-radius);
  color: var(--dm-text-2);
}

.dm-user-menu .dropdown-item:hover {
  background: var(--dm-surface-2);
  color: var(--dm-text);
}

.dm-content {
  padding: var(--dm-content-pad);
  flex: 1;
  width: 100%;
  min-width: 0;
}

.dm-footer {
  padding: 0.625rem var(--dm-content-pad);
  text-align: center;
  font-size: 0.6875rem;
  color: var(--dm-text-3);
  border-top: 1px solid var(--dm-border);
  background: var(--dm-surface);
}

.dm-footer a {
  color: var(--dm-primary);
  font-weight: 500;
  text-decoration: none;
}

.dm-footer a:hover {
  text-decoration: underline;
  color: var(--dm-primary-hover);
}

/* ─── Command Center data panel (toolbar + dense table + pagination) ─── */
.dm-data-panel {
  background: var(--dm-surface);
  border: 1px solid var(--dm-border);
  border-radius: var(--dm-radius-lg);
  box-shadow: var(--dm-shadow-sm);
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.dm-toolbar,
.dm-content > .d-flex.justify-content-between.my-3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0;
  background: var(--dm-surface);
  border-bottom: 1px solid var(--dm-border);
}

.dm-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  margin-left: auto;
}

.dm-toolbar-search {
  flex: 1 1 10rem;
  min-width: 0;
  max-width: 16rem;
}

.dm-toolbar-search .form-control { width: 100%; }

/* Toolbar stacks with table */
.dm-toolbar + .table-container,
.dm-content > .d-flex.justify-content-between.my-3 + .table-container {
  border: none;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
}

.dm-data-panel > .table-container {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.dm-data-panel > .dm-toolbar { border-bottom: 1px solid var(--dm-border); }

.dm-data-panel > .pagination,
.dm-data-panel > ul.pagination,
.dm-data-panel__footer,
.dm-data-panel > nav,
.dm-data-panel > .pagination-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0.4375rem 0.75rem;
  background: var(--dm-surface-2);
  border-top: 1px solid var(--dm-border);
  border-radius: 0;
}

.dm-data-panel__footer .pagination,
.pagination-container .pagination {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

.dm-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  margin: 0;
  background: var(--dm-surface-2);
  border-bottom: 1px solid var(--dm-border);
}

.dm-data-panel--nested {
  margin: 0.5rem 0.75rem 0.75rem;
  box-shadow: none;
}

.dm-dept-title {
  display: block;
  margin: 0;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--dm-text);
  background: var(--dm-surface-2);
  border-bottom: 1px solid var(--dm-border);
}

.dm-page-panel {
  max-width: 100%;
  padding: 0;
}

.dm-page-panel > .dm-role-selector {
  padding: 0.5rem 0.75rem;
  margin: 0 0 0.75rem;
  background: var(--dm-surface);
  border: 1px solid var(--dm-border);
  border-radius: var(--dm-radius-lg);
}

.dm-toolbar .btn-group.btn-group-toggle {
  flex-wrap: wrap;
  gap: 0.25rem;
}

.dm-toolbar .btn-custom {
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  height: auto;
  min-height: 1.75rem;
  line-height: 1.25;
  border-color: var(--dm-border);
  color: var(--dm-text-2);
  white-space: nowrap;
}

.dm-toolbar .btn-custom.active,
.dm-toolbar .btn-custom.active:hover,
.btn-group-toggle .btn-custom.active,
.btn-group-toggle .btn-custom.active:hover,
.btn-custom.active,
.btn-custom.active:hover,
label.btn-custom.active {
  background: var(--dm-accent);
  border-color: var(--dm-accent);
  color: var(--dm-accent-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.conversion-container.dm-data-panel .conversion-stats {
  padding: 0;
}

.conversion-container > .d-flex.justify-content-between,
.conversion-container > .dm-toolbar {
  margin-bottom: 0;
}

.conversion-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--dm-text);
}

/* ─── Dense tables (Option E) ─── */
.table-container,
.dm-table-wrap {
  width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--dm-surface);
}

.table {
  width: 100%;
  min-width: 48rem;
  margin-bottom: 0 !important;
  font-size: 0.75rem;
  background: var(--dm-surface);
  border-collapse: collapse;
}

.table thead th {
  background: var(--dm-table-head);
  color: var(--dm-text-2);
  font-weight: 600;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--dm-border-strong);
  border-top: none;
  padding: 0.375rem 0.5rem;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
  vertical-align: middle;
}

.table td {
  padding: 0.3125rem 0.5rem;
  color: var(--dm-text-2);
  border-color: var(--dm-border);
  vertical-align: middle;
  line-height: 1.35;
}

.table tbody tr:nth-child(even) { background: var(--dm-table-zebra); }

.table tbody tr:hover { background: var(--dm-table-row-hover); }

.table th, .table td { text-align: center; }

.table-bordered th,
.table-bordered td {
  border: 1px solid var(--dm-border);
}

.table-container a {
  color: var(--dm-primary);
  font-weight: 500;
  text-decoration: none;
}

.table-container a:hover { text-decoration: underline; }

.custom-table th,
.custom-table td {
  padding: 0.3125rem 0.5rem !important;
}

.icon-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

/* ─── Buttons ─── */
.btn {
  border-radius: var(--dm-radius);
  font-weight: 500;
  font-size: 0.75rem;
  padding: 0.375rem 0.75rem;
  box-shadow: none;
  transition: all var(--dm-transition);
  white-space: nowrap;
}

.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.6875rem; }

.btn-primary, .btn-success {
  background: var(--dm-accent);
  border-color: var(--dm-accent);
  color: var(--dm-accent-text);
}

.btn-primary:hover, .btn-primary:focus,
.btn-success:hover, .btn-success:focus {
  background: var(--dm-accent-hover);
  border-color: var(--dm-accent-hover);
  color: var(--dm-accent-text);
}

.btn-secondary, .btn-custom,
#bulkupload, #downloadFormat, #addUserButton {
  background: var(--dm-surface);
  border: 1px solid var(--dm-border-strong);
  color: var(--dm-text-2);
}

.btn-secondary:hover, .btn-custom:hover,
#bulkupload:hover, #downloadFormat:hover, #addUserButton:hover {
  background: var(--dm-surface-2);
  color: var(--dm-text);
}

.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

.btn-primary:disabled,
.btn-primary.disabled,
.btn-success:disabled,
.btn-success.disabled {
  background: var(--dm-accent);
  border-color: var(--dm-accent);
  color: var(--dm-accent-text);
}

.btn-secondary:disabled,
.btn-secondary.disabled,
.btn-custom:disabled,
.btn-custom.disabled {
  background: var(--dm-surface-2);
  border-color: var(--dm-border);
  color: var(--dm-text-3);
}

/* ─── Forms ─── */
.form-control, select.form-control, textarea.form-control,
.dm-input, select.dm-input, textarea.dm-input {
  font-family: var(--dm-font);
  font-size: 0.8125rem;
  width: 100%;
  max-width: 100%;
  min-height: 2.125rem;
  height: auto;
  border-radius: var(--dm-radius);
  border: 1px solid var(--dm-border-strong);
  background: var(--dm-surface);
  color: var(--dm-text);
  padding: 0.375rem 0.625rem;
}

.form-control:focus, textarea:focus, select:focus,
.dm-input:focus, select.dm-input:focus, textarea.dm-input:focus {
  outline: none !important;
  border-color: var(--dm-primary) !important;
  box-shadow: 0 0 0 2px var(--dm-primary-ring) !important;
}

.form-group label, label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--dm-text-2);
  margin-bottom: 0.25rem;
}

.heading-container {
  background: var(--dm-surface-2);
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--dm-border);
  border-radius: var(--dm-radius);
  margin: 0 0 0.75rem;
}

/* Pagination */
.pagination .page-item.active .page-link {
  background: var(--dm-primary);
  border-color: var(--dm-primary);
}

.page-link {
  color: var(--dm-text-2);
  border-color: var(--dm-border);
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  background: var(--dm-surface);
}

.page-link:hover {
  color: var(--dm-primary);
  background: var(--dm-primary-soft);
}

/* Modals */
.modal-content {
  background: var(--dm-surface);
  border: 1px solid var(--dm-border);
  border-radius: var(--dm-radius-lg);
  box-shadow: var(--dm-shadow-md);
  color: var(--dm-text);
}

.modal-header {
  background: var(--dm-surface);
  border-bottom: 1px solid var(--dm-border);
  padding: 0.75rem 1rem;
}

.modal-body { padding: 1rem; }

.modal-footer {
  border-top: 1px solid var(--dm-border);
  padding: 0.625rem 1rem;
}

.close { color: var(--dm-text-3); text-shadow: none; }

/* ─── Aurora popup (bulk upload, lightweight overlays) ─── */
.dm-popup {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.dm-popup.is-open { display: flex; }

.dm-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
  backdrop-filter: blur(2px);
}

[data-theme="dark"] .dm-popup__backdrop {
  background: rgba(0, 0, 0, 0.62);
}

.dm-popup__dialog {
  position: relative;
  z-index: 1;
  width: min(24rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: var(--dm-surface);
  border: 1px solid var(--dm-border);
  border-radius: var(--dm-radius-lg);
  box-shadow: var(--dm-shadow-md);
  color: var(--dm-text);
}

.dm-popup__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--dm-border);
  background: var(--dm-surface-2);
}

.dm-popup__header h5 {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--dm-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dm-popup__header h5 i {
  color: var(--dm-accent, var(--dm-primary));
  font-size: 0.9375rem;
}

.dm-popup__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: var(--dm-radius);
  background: transparent;
  color: var(--dm-text-3);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--dm-transition), color var(--dm-transition);
}

.dm-popup__close:hover {
  background: var(--dm-surface-3);
  color: var(--dm-text);
}

.dm-popup__body { padding: 1rem; }

.dm-popup__footer {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--dm-border);
  background: var(--dm-surface-2);
}

.dm-popup__dialog--wide {
  width: min(42rem, calc(100vw - 2rem));
}

.dm-popup__dialog--xl {
  width: min(72rem, calc(100vw - 2rem));
}

.dm-popup--nested {
  z-index: 1060;
}

/* ─── Confirmation dialog ─── */
.dm-confirm {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.dm-confirm.is-open {
  display: flex;
}

.dm-confirm__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 40, 0.5);
  backdrop-filter: blur(2px);
}

[data-theme="dark"] .dm-confirm__backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.dm-confirm__dialog {
  position: relative;
  z-index: 1;
  width: min(22rem, calc(100vw - 2rem));
  padding: 1.25rem 1.25rem 1rem;
  background: var(--dm-surface);
  border: 1px solid var(--dm-border);
  border-radius: var(--dm-radius-lg);
  box-shadow: var(--dm-shadow-md);
  color: var(--dm-text);
  text-align: center;
}

.dm-confirm__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  background: var(--dm-primary-soft);
  color: var(--dm-primary);
  font-size: 1.125rem;
}

.dm-confirm--danger .dm-confirm__icon {
  background: rgba(220, 53, 69, 0.12);
  color: #dc3545;
}

.dm-confirm__title {
  margin: 0 0 0.375rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--dm-text);
}

.dm-confirm__message {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--dm-text-2);
  white-space: pre-line;
}

.dm-confirm__footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.125rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--dm-border);
}

.dm-confirm__cancel,
.dm-confirm__confirm {
  min-width: 5.5rem;
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25;
}

.dm-confirm__cancel {
  background: var(--dm-surface);
  border: 1px solid var(--dm-border-strong);
  color: var(--dm-text-2);
}

.dm-confirm__cancel:hover,
.dm-confirm__cancel:focus {
  background: var(--dm-surface-2);
  border-color: var(--dm-border-strong);
  color: var(--dm-text);
}

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

.dm-confirm__confirm.btn-primary:hover,
.dm-confirm__confirm.btn-primary:focus {
  background: var(--dm-primary-hover);
  border-color: var(--dm-primary-hover);
  color: #fff;
}

.dm-confirm__confirm.btn-danger {
  background: #dc3545;
  border-color: #dc3545;
  color: #fff;
}

.dm-confirm__confirm.btn-danger:hover {
  background: #c82333;
  border-color: #bd2130;
  color: #fff;
}

.dm-user-form .form-group {
  margin-bottom: 0.625rem;
}

.dm-user-form .form-control,
.dm-user-form select.form-control {
  min-height: 2rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.8125rem;
}

.dm-user-form .row {
  margin-left: -0.375rem;
  margin-right: -0.375rem;
}

.dm-user-form .row > [class*="col-"] {
  padding-left: 0.375rem;
  padding-right: 0.375rem;
}

.dm-input-group-select {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.dm-input-group-select select,
.dm-input-group-select .form-control,
.dm-input-group-select .dm-combobox {
  flex: 1;
  min-width: 0;
}

.dm-input-group-select .btn {
  flex-shrink: 0;
}

.dm-phone-field .iti {
  display: block;
  width: 100%;
}

.dm-phone-field .iti__flag-container {
  z-index: 2;
}

.dm-field--inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dm-field--inline > label {
  margin-bottom: 0;
}

.dm-phone-field .iti input[type="tel"],
.dm-phone-field .dm-input {
  width: 100%;
  min-height: 2rem;
  height: 2rem;
  box-sizing: border-box;
  font-family: var(--dm-font);
  font-size: 0.8125rem;
  border-radius: var(--dm-radius);
  border: 1px solid var(--dm-border-strong);
  background: var(--dm-surface);
  color: var(--dm-text);
}

.dm-phone-field .iti input[type="tel"]:focus,
.dm-phone-field .dm-input:focus {
  outline: none;
  border-color: var(--dm-primary);
  box-shadow: 0 0 0 2px var(--dm-primary-ring);
}

.dm-phone-field .iti--separate-dial-code .iti__selected-flag {
  background: var(--dm-surface-2);
  border-right: 1px solid var(--dm-border);
  border-radius: var(--dm-radius) 0 0 var(--dm-radius);
}

.dm-form-section {
  margin-bottom: 1rem;
}

.dm-form-section:last-child {
  margin-bottom: 0;
}

.dm-form-section__title {
  margin: 0 0 0.625rem;
  padding-bottom: 0.375rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dm-text-3);
  border-bottom: 1px solid var(--dm-border);
}

.dm-name-row {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.dm-name-row__prefix {
  width: 4.75rem;
  flex-shrink: 0;
}

.dm-name-row > .dm-combobox--prefix {
  width: 4.75rem;
  flex: 0 0 4.75rem;
}

.dm-name-row__input {
  flex: 1;
  min-width: 0;
}

.dm-field-autofill {
  background: var(--dm-surface-2) !important;
  color: var(--dm-text-2);
}

.dm-field-autofill[readonly] {
  cursor: default;
}

.dm-form-hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.6875rem;
  color: var(--dm-text-3);
}

.dm-aurora-form .required,
.dm-user-form .required {
  color: var(--dm-danger);
  margin-left: 0.125rem;
}

.dm-popup__dialog--wide.dm-popup__dialog--form {
  width: min(52rem, calc(100vw - 2rem));
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 2rem);
  overflow: hidden;
}

.dm-popup__dialog--form form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.dm-popup__dialog--form .dm-popup__body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.dm-popup__dialog--form .dm-popup__footer {
  flex-shrink: 0;
}

/* Aurora form fields (use .dm-aurora-form — no Bootstrap form-group/form-control) */
.dm-aurora-form .dm-field,
.dm-user-form .dm-field {
  margin-bottom: 0.75rem;
}

.dm-aurora-form .dm-field:last-child,
.dm-aurora-form .dm-field--last,
.dm-user-form .dm-field:last-child,
.dm-user-form .dm-field--last {
  margin-bottom: 0;
}

.dm-aurora-form .dm-form-columns .dm-field--last,
.dm-user-form .dm-form-columns .dm-field--last {
  margin-bottom: 0;
}

.dm-aurora-form .dm-field > label,
.dm-user-form .dm-field > label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--dm-text-2);
}

.dm-aurora-form .dm-field > label.dm-file-tile,
.dm-user-form .dm-field > label.dm-file-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-bottom: 0;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  text-align: center;
}

.dm-aurora-form .dm-input,
.dm-aurora-form select.dm-input,
.dm-aurora-form textarea.dm-input,
.dm-user-form .dm-input,
.dm-user-form select.dm-input,
.dm-user-form textarea.dm-input {
  display: block;
  width: 100%;
  min-height: 2rem;
  padding: 0.375rem 0.625rem;
  font-family: var(--dm-font);
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--dm-text);
  background: var(--dm-surface);
  border: 1px solid var(--dm-border-strong);
  border-radius: var(--dm-radius);
  transition: border-color var(--dm-transition), box-shadow var(--dm-transition);
}

.dm-aurora-form .dm-input::placeholder,
.dm-user-form .dm-input::placeholder {
  color: var(--dm-text-3);
}

.dm-aurora-form .dm-input:focus,
.dm-aurora-form select.dm-input:focus,
.dm-aurora-form textarea.dm-input:focus,
.dm-user-form .dm-input:focus,
.dm-user-form select.dm-input:focus,
.dm-user-form textarea.dm-input:focus {
  outline: none;
  border-color: var(--dm-primary);
  box-shadow: 0 0 0 2px var(--dm-primary-ring);
}

.dm-aurora-form .dm-input:disabled,
.dm-aurora-form select.dm-input:disabled,
.dm-user-form .dm-input:disabled,
.dm-user-form select.dm-input:disabled {
  background: var(--dm-surface-2);
  color: var(--dm-text-3);
  cursor: not-allowed;
}

.dm-aurora-form textarea.dm-input,
.dm-user-form textarea.dm-input {
  min-height: 4.5rem;
  resize: vertical;
}

.dm-form-grid {
  display: grid;
  gap: 0.75rem;
}

.dm-form-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dm-form-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dm-form-grid--pincode {
  grid-template-columns: 9rem 1fr 1fr 1fr;
  align-items: start;
}

@media (max-width: 640px) {
  .dm-form-grid--2,
  .dm-form-grid--3,
  .dm-form-grid--pincode {
    grid-template-columns: 1fr;
  }
}

.dm-form-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 1.25rem;
  row-gap: 0;
  align-items: start;
}

.dm-form-columns__col {
  display: contents;
}

.dm-form-columns .dm-form-section__title {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.dm-aurora-form .dm-form-columns .dm-field,
.dm-user-form .dm-form-columns .dm-field {
  margin-bottom: 0.75rem;
  align-self: start;
}

.dm-aurora-form .dm-form-columns .dm-field > label,
.dm-user-form .dm-form-columns .dm-field > label {
  margin-bottom: 0.25rem;
  min-height: 1.05rem;
  line-height: 1.4;
}

.dm-aurora-form .dm-form-columns .dm-field > .error-message,
.dm-user-form .dm-form-columns .dm-field > .error-message,
.dm-aurora-form .dm-form-columns .dm-field > .invalid-feedback,
.dm-user-form .dm-form-columns .dm-field > .invalid-feedback {
  min-height: 1rem;
  margin-top: 0;
}

@media (max-width: 768px) {
  .dm-form-columns {
    grid-template-columns: 1fr;
  }

  .dm-form-columns__col {
    display: block;
  }
}

.dm-file-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 1.25rem 1rem;
  border: 1px dashed var(--dm-border-strong);
  border-radius: var(--dm-radius-lg);
  background: var(--dm-surface-2);
  color: var(--dm-text-2);
  font-size: 0.8125rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dm-transition), background var(--dm-transition);
}

.dm-file-drop:hover,
.dm-file-drop:focus-within {
  border-color: var(--dm-primary);
  background: var(--dm-primary-soft);
}

.dm-file-drop > i {
  font-size: 1.5rem;
  color: var(--dm-primary);
}

.dm-file-drop input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dm-file-drop__name {
  font-size: 0.75rem;
  color: var(--dm-text-3);
  word-break: break-all;
}

.dm-btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.dm-btn-icon i { font-size: 0.75rem; line-height: 1; }

.dm-toolbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid var(--dm-border-strong);
  border-radius: var(--dm-radius);
  background: var(--dm-surface);
  color: var(--dm-text-2);
  cursor: pointer;
  transition: background var(--dm-transition), color var(--dm-transition), border-color var(--dm-transition);
}

.dm-toolbar-icon-btn:hover {
  background: var(--dm-primary-soft);
  border-color: var(--dm-primary);
  color: var(--dm-primary);
}

.dm-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.dm-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--dm-text-3);
  cursor: pointer;
  transition: background var(--dm-transition), color var(--dm-transition), transform 0.12s ease;
}

.dm-icon-btn i { font-size: 0.8125rem; line-height: 1; }

.dm-icon-btn--edit { color: var(--dm-primary); }

.dm-icon-btn--edit:hover {
  background: var(--dm-primary-soft);
  color: var(--dm-primary-hover);
  transform: scale(1.08);
}

.dm-icon-btn--delete { color: var(--dm-danger); }

.dm-icon-btn--delete:hover {
  background: rgba(180, 35, 24, 0.12);
  color: #912018;
  transform: scale(1.08);
}

.custom-switch .custom-control-input:checked + .custom-control-label::before,
.checkbox-green:checked {
  background-color: var(--dm-accent);
  border-color: var(--dm-accent);
}

.required { color: var(--dm-danger); }
.dropdown-toggle::after { display: none; }

/* ─── Enquiry popup (simple) ─── */
.dm-popup__dialog--enquiry {
  width: min(52rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dm-popup__dialog--enquiry form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.dm-popup__dialog--enquiry .dm-popup__body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 1rem 1.25rem;
}

.dm-popup__dialog--enquiry .dm-popup__footer {
  flex-shrink: 0;
}

.dm-enquiry-modal-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--dm-border);
  background: var(--dm-surface-2);
  flex-shrink: 0;
}

.dm-enquiry-modal-head h5 {
  margin: 0;
  flex: 1;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--dm-text);
}

.dm-form-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.625rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid var(--dm-border);
}

.dm-form-section__head .dm-form-section__title {
  margin: 0;
  padding: 0;
  border: none;
}

.dm-enquiry-ref {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--dm-accent, var(--dm-primary));
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding: 0.25rem 0.625rem;
  background: var(--dm-primary-soft);
  border-radius: var(--dm-radius);
}

.dm-file-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  width: 100%;
  min-height: 5.5rem;
  padding: 0.875rem 0.625rem;
  border: 1px dashed var(--dm-border-strong);
  border-radius: var(--dm-radius-lg);
  background: var(--dm-surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dm-transition), background var(--dm-transition);
}

.dm-file-tile:hover,
.dm-file-tile:focus-within {
  border-color: var(--dm-accent, var(--dm-primary));
  background: var(--dm-primary-soft);
}

.dm-file-tile > i {
  display: block;
  font-size: 1.25rem;
  color: var(--dm-accent, var(--dm-primary));
}

.dm-file-tile__title {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--dm-text);
}

.dm-file-tile__name {
  display: block;
  font-size: 0.6875rem;
  color: var(--dm-text-2);
  word-break: break-word;
  max-width: 100%;
  line-height: 1.3;
}

.dm-file-tile__name.is-empty {
  display: none;
}

.dm-file-tile input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dm-file-tile__link {
  position: relative;
  z-index: 2;
  display: inline-block;
  margin-top: 0.375rem;
  font-size: 0.6875rem;
}

.dm-enquiry-workflow-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 2.25rem;
  padding: 0.375rem 0.625rem;
  border: 1px solid var(--dm-border);
  border-radius: var(--dm-radius);
  background: var(--dm-surface);
}

.dm-enquiry-workflow-row > label:first-child {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--dm-text-2);
}

.dm-form-section__notes {
  margin-top: 0.75rem;
}

.dm-quote-net {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--dm-surface-2);
  border: 1px solid var(--dm-border);
  border-radius: var(--dm-radius-lg);
}

.dm-quote-net__copy {
  min-width: 0;
}

.dm-quote-net__label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dm-text-3);
}

.dm-quote-net__hint {
  display: block;
  margin-top: 0.125rem;
  font-size: 0.75rem;
  color: var(--dm-text-3);
}

.dm-quote-net__value {
  flex-shrink: 0;
  min-width: 7rem;
  border: none;
  background: transparent;
  padding: 0;
  text-align: right;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--dm-accent, var(--dm-primary));
  font-variant-numeric: tabular-nums;
}

.dm-quote-net__value:focus {
  outline: none;
}

.dm-quote-net--total .dm-quote-net__label {
  font-size: 0.75rem;
}

.dm-quote-net--total .dm-quote-net__value {
  font-size: 1.1875rem;
}

.dm-quote-form .dm-field > textarea.dm-input {
  min-height: 2.5rem;
  resize: vertical;
}

[data-theme="dark"] .dm-quote-net {
  background: var(--dm-surface);
}

.dm-form-section > .dm-form-grid + .dm-form-grid {
  margin-top: 0.75rem;
}

.dm-field-label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--dm-text-2);
}

/* ─── Aurora combobox (custom searchable select) ─── */
.dm-combobox {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.dm-combobox-source {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  clip: rect(0, 0, 0, 0) !important;
}

.dm-aurora-form .dm-combobox__trigger,
.dm-user-form .dm-combobox__trigger {
  min-height: 2rem;
  font-size: 0.8125rem;
  padding: 0.375rem 1.75rem 0.375rem 0.625rem;
}

.dm-combobox__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 2rem;
  padding: 0.375rem 1.75rem 0.375rem 0.625rem;
  border: 1px solid var(--dm-border-strong);
  border-radius: var(--dm-radius);
  background: var(--dm-surface);
  color: var(--dm-text);
  font-size: 0.75rem;
  font-family: var(--dm-font);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dm-transition), box-shadow var(--dm-transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23667085' d='M2 3.5 5 7l3-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}

.dm-combobox__trigger.is-placeholder {
  color: var(--dm-text-3);
}

.dm-combobox__trigger:hover {
  border-color: var(--dm-primary);
  background-color: var(--dm-surface-2);
}

.dm-combobox.is-open .dm-combobox__trigger,
.dm-combobox__trigger:focus {
  outline: none;
  border-color: var(--dm-primary);
  box-shadow: 0 0 0 1px var(--dm-primary-ring);
}

.dm-combobox__menu {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  z-index: 1070;
  width: 100%;
  min-width: 10rem;
  background: var(--dm-surface);
  border: 1px solid var(--dm-border-strong);
  border-radius: var(--dm-radius);
  box-shadow: var(--dm-shadow-md);
  overflow: hidden;
}

.dm-combobox__menu:not([hidden]) {
  display: block;
}

.dm-combobox__menu.dm-combobox__menu--portal:not([hidden]) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dm-combobox__menu--portal .dm-combobox__list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.dm-combobox__search {
  display: block;
  width: calc(100% - 0.75rem);
  margin: 0.375rem;
  padding: 0.25rem 0.375rem;
  border: 1px solid var(--dm-border-strong);
  border-radius: var(--dm-radius);
  background: var(--dm-surface-2);
  color: var(--dm-text);
  font-size: 0.75rem;
  font-family: var(--dm-font);
}

.dm-combobox__search.is-hidden {
  display: none;
}

.dm-combobox__search:focus {
  outline: none;
  border-color: var(--dm-primary);
  box-shadow: 0 0 0 1px var(--dm-primary-ring);
}

.dm-combobox__list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  max-height: calc(1.625rem * 5);
  overflow-y: auto;
}

.dm-combobox__option {
  padding: 0.3125rem 0.5rem;
  font-size: 0.75rem;
  color: var(--dm-text-2);
  cursor: pointer;
  line-height: 1.25;
}

.dm-combobox__option:hover,
.dm-combobox__option.is-selected {
  background: var(--dm-primary-soft);
  color: var(--dm-primary);
}

.dm-combobox__option.is-selected {
  font-weight: 600;
}

.dm-combobox__option.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.dm-combobox__empty {
  padding: 0.5rem;
  font-size: 0.75rem;
  color: var(--dm-text-3);
  text-align: center;
}

.dm-combobox--role {
  width: 14rem;
  max-width: min(14rem, 100%);
}

.dm-combobox--compact {
  max-width: 8.5rem;
}

.dm-combobox--filter {
  width: 100%;
}

.dm-role-selector {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.dm-field-label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--dm-text-2);
  white-space: nowrap;
}

.dm-role-selector__controls {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex: 0 0 auto;
}

/* Loader */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--dm-overlay);
  backdrop-filter: blur(2px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}

.loading {
  display: flex;
  gap: 0.3rem;
  padding: 1rem 1.25rem;
  background: var(--dm-surface);
  border-radius: var(--dm-radius-lg);
  border: 1px solid var(--dm-border);
  box-shadow: var(--dm-shadow-md);
}

.loading span {
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: var(--dm-primary);
  animation: dm-bounce 1s ease-in-out infinite;
}

.loading span:nth-child(2) { animation-delay: 0.15s; }
.loading span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dm-bounce {
  0%, 80%, 100% { transform: scale(0.65); opacity: 0.45; }
  40% { transform: scale(1); opacity: 1; }
}

/* Page headers */
.dm-page-header, .dm-dash-header { margin-bottom: 1rem; }

.dm-page-title, .dm-dash-header h1 {
  font-size: clamp(1.0625rem, 2vw, 1.375rem);
  font-weight: 650;
  margin: 0;
  letter-spacing: -0.03em;
  color: var(--dm-text);
}

.dm-page-subtitle, .dm-dash-header p {
  margin: 0;
  color: var(--dm-text-3);
  font-size: 0.8125rem;
}

.dm-dash-header__eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dm-primary);
  opacity: 0.85;
}

.dm-dash-header--compact {
  align-items: center;
}

.dm-dash-header--compact .dm-dash-header__eyebrow {
  margin: 0;
}

.dm-dashboard--refined .dm-dash-header--compact {
  padding-bottom: 0.5rem;
}

.dm-dashboard--fit .dm-dash-header--compact {
  margin-bottom: 0;
}

.dm-dash-header__subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--dm-text-3);
  line-height: 1.45;
}

/* Dashboard cards — Aurora spacious */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

/* My pending work — per-module counts */
.dm-pending-work {
  margin-bottom: 0.75rem;
}

.dm-pending-work__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 11.5rem), 1fr));
  gap: 0.5rem;
  padding: 0.75rem;
}

.dm-pending-work__card {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.625rem;
  border: 1px solid var(--dm-border);
  background: var(--dm-surface-2);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.dm-pending-work__card:hover {
  border-color: var(--dm-border-strong);
  background: var(--dm-surface);
  box-shadow: var(--dm-shadow-sm);
  color: inherit;
  text-decoration: none;
}

.dm-pending-work__card--active {
  border-color: color-mix(in srgb, var(--dm-primary) 35%, var(--dm-border));
  background: color-mix(in srgb, var(--dm-primary-soft) 55%, var(--dm-surface-2));
}

.dm-pending-work__icon {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: var(--dm-surface);
  border: 1px solid var(--dm-border);
}

.dm-pending-work__icon img,
.dm-pending-work__icon svg {
  width: 1.125rem;
  height: 1.125rem;
}

.dm-pending-work__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.dm-pending-work__label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--dm-text);
  line-height: 1.2;
}

.dm-pending-work__hint {
  font-size: 0.6875rem;
  color: var(--dm-text-3);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-pending-work__count {
  flex-shrink: 0;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.375rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 700;
  background: var(--dm-primary);
  color: var(--dm-accent-text);
}

.dm-pending-work__count--zero {
  background: var(--dm-surface-3);
  color: var(--dm-text-3);
  font-weight: 600;
}

.dm-dashboard__body > .dm-pending-work + .dm-dash-sales-stack,
.dm-dashboard__body > .dm-pending-work + .dm-kpi-grid {
  margin-top: 0;
}


/* ─── Dashboard v2 — KPI cards ─── */
.dm-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.dm-kpi-card {
  --dm-kpi-accent: var(--dm-primary);
  --dm-kpi-accent-soft: var(--dm-primary-soft);
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.625rem;
  padding: 1rem 1rem 0.9375rem;
  background:
    linear-gradient(155deg, var(--dm-surface) 0%, color-mix(in srgb, var(--dm-surface-2) 55%, var(--dm-surface)) 100%);
  border: 1px solid color-mix(in srgb, var(--dm-border) 85%, transparent);
  border-radius: 0.875rem;
  box-shadow:
    0 1px 2px rgba(16, 24, 40, 0.04),
    0 8px 24px rgba(16, 24, 40, 0.04);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition:
    border-color 0.2s ease,
    box-shadow 0.25s ease,
    transform 0.25s ease;
  animation: dm-dash-rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  animation-delay: calc(var(--dm-kpi-delay, 0) * 0.06s);
}

.dm-kpi-card::before {
  content: '';
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--dm-kpi-accent) 0%, color-mix(in srgb, var(--dm-kpi-accent) 25%, transparent) 72%);
  opacity: 0.9;
  pointer-events: none;
}

.dm-kpi-card:nth-child(1) {
  --dm-kpi-accent: #1e2d6e;
  --dm-kpi-accent-soft: rgba(30, 45, 110, 0.1);
}

.dm-kpi-card:nth-child(2) {
  --dm-kpi-accent: #2f5f8f;
  --dm-kpi-accent-soft: rgba(47, 95, 143, 0.1);
}

.dm-kpi-card:nth-child(3) {
  --dm-kpi-accent: #027a48;
  --dm-kpi-accent-soft: rgba(2, 122, 72, 0.1);
}

.dm-kpi-card:nth-child(4) {
  --dm-kpi-accent: #5b4fc7;
  --dm-kpi-accent-soft: rgba(91, 79, 199, 0.1);
}

.dm-kpi-card:hover {
  border-color: color-mix(in srgb, var(--dm-kpi-accent) 28%, var(--dm-border));
  box-shadow:
    0 4px 12px rgba(16, 24, 40, 0.06),
    0 16px 36px rgba(16, 24, 40, 0.07);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}

.dm-kpi-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.1875rem;
  min-width: 0;
  padding-top: 0.125rem;
}

.dm-kpi-card__label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--dm-text-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dm-kpi-card__value {
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--dm-text);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  margin-top: 0.125rem;
}

.dm-kpi-card__meta {
  font-size: 0.6875rem;
  color: var(--dm-text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.25rem;
}

.dm-kpi-card__icon {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dm-kpi-accent-soft);
  color: var(--dm-kpi-accent);
  font-size: 0.9375rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.dm-trend-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  width: fit-content;
  margin-top: 0.375rem;
  padding: 0.1875rem 0.5rem;
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.3;
}

.dm-trend-pill i {
  font-size: 0.5625rem;
}

.dm-trend-pill__muted {
  font-weight: 500;
  opacity: 0.82;
}

.dm-trend-pill--up {
  color: #027a48;
  background: rgba(2, 122, 72, 0.09);
  border: 1px solid rgba(2, 122, 72, 0.14);
}

.dm-trend-pill--down {
  color: #b54708;
  background: rgba(181, 71, 8, 0.08);
  border: 1px solid rgba(181, 71, 8, 0.14);
}

/* Sales dashboard — locked single-viewport stack */
.dm-dash-sales-stack {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.5rem;
  min-height: 0;
  height: 100%;
}

.dm-dash-sales-stack:not(:has(.dm-dash-table)) {
  grid-template-rows: auto minmax(0, 1fr);
}

.dm-dash-sales-stack .dm-dash-charts {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.5rem;
  min-height: 0;
  height: 100%;
}

.dm-dash-panel--chart {
  min-height: 0;
  height: 100%;
}

.dm-dash-panel--chart .dm-panel__body--chart {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0.375rem 0.75rem 0.5rem;
}

.dm-dash-panel--chart .dm-panel__body--split.dm-panel__body--chart {
  display: grid;
  grid-template-columns: minmax(6.5rem, 40%) 1fr;
  gap: 0.5rem 0.75rem;
  align-items: center;
  min-height: 0;
  flex: 1;
}

.dm-chart-canvas-wrap--line {
  flex: 1;
  min-height: 0;
  height: 100%;
}

.dm-chart-canvas-wrap--donut.dm-donut-wrap {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  margin: 0 auto;
  aspect-ratio: unset;
}

.dm-dash-table--compact .dm-panel__header {
  padding: 0.4375rem 0.75rem;
}

.dm-dash-table--compact .dm-panel__title {
  font-size: 0.8125rem;
}

.dm-dash-table--compact .dm-panel__footer {
  padding: 0.25rem 0.625rem;
}

.dm-dash-table .table-container {
  overflow-y: auto;
  max-height: 100%;
}

/* ─── Dashboard v2 — panels ─── */
.dm-panel {
  background: var(--dm-surface);
  border: 1px solid color-mix(in srgb, var(--dm-border) 90%, transparent);
  border-radius: 0.875rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 10px 28px rgba(16, 24, 40, 0.04);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.dm-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid color-mix(in srgb, var(--dm-border) 75%, transparent);
  background: linear-gradient(180deg, var(--dm-surface) 0%, color-mix(in srgb, var(--dm-surface-2) 35%, var(--dm-surface)) 100%);
  flex-shrink: 0;
}

.dm-panel__title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--dm-text);
  letter-spacing: -0.02em;
}

.dm-panel__subtitle {
  margin: 0.1875rem 0 0;
  font-size: 0.6875rem;
  color: var(--dm-text-3);
  line-height: 1.4;
}

.dm-panel__link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--dm-primary);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.3125rem 0.625rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--dm-primary) 18%, var(--dm-border));
  background: color-mix(in srgb, var(--dm-primary-soft) 65%, var(--dm-surface));
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.dm-panel__link:hover {
  color: var(--dm-primary-hover);
  border-color: color-mix(in srgb, var(--dm-primary) 30%, var(--dm-border));
  background: var(--dm-primary-soft);
  text-decoration: none;
}

.dm-panel__search {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 13rem;
  margin: 0;
}

.dm-panel__search-icon {
  position: absolute;
  left: 0.625rem;
  font-size: 0.6875rem;
  color: var(--dm-text-3);
  pointer-events: none;
}

.dm-panel__search-input {
  width: 100%;
  padding: 0.375rem 0.625rem 0.375rem 1.75rem;
  font-size: 0.75rem;
  color: var(--dm-text);
  background: var(--dm-surface);
  border: 1px solid var(--dm-border);
  border-radius: 999px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dm-panel__search-input::placeholder {
  color: var(--dm-text-3);
}

.dm-panel__search-input:focus {
  border-color: color-mix(in srgb, var(--dm-primary) 35%, var(--dm-border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--dm-primary-soft) 80%, transparent);
}

.dm-panel__footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem 0.75rem;
  border-top: 1px solid var(--dm-border);
  background: var(--dm-surface-2);
}

.dm-panel__footer-link {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--dm-primary);
  text-decoration: none;
}

.dm-panel__footer-link:hover {
  color: var(--dm-primary-hover);
  text-decoration: underline;
}

.dm-panel__body {
  padding: 0.625rem 0.875rem 0.75rem;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.dm-panel__body--flush {
  padding: 0;
}

.dm-panel__body--split {
  display: grid;
  grid-template-columns: minmax(6.5rem, 38%) 1fr;
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.5rem 0.75rem 0.625rem;
}

.dm-dash-panels {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 0.75rem;
  min-height: 0;
}

/* Distribution bars (employees by dept) */
.dm-dist-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dm-dist-row__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.dm-dist-row__label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--dm-text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-dist-row__stat {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--dm-text-3);
  white-space: nowrap;
}

.dm-dist-row__track {
  height: 0.4375rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--dm-surface-2) 80%, var(--dm-border));
  overflow: hidden;
}

.dm-dist-row__fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  min-width: 0;
  background: linear-gradient(90deg, var(--dm-bar-1, var(--dm-primary)) 0%, color-mix(in srgb, var(--dm-bar-1, var(--dm-primary)) 70%, white) 100%);
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.dm-dist-footnote {
  margin: 0.5rem 0 0;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--dm-border);
  font-size: 0.6875rem;
  color: var(--dm-text-3);
}

.dm-dist-legend--inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem 0.875rem;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.dm-dist-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--dm-text-3);
  letter-spacing: 0.02em;
}

.dm-dist-legend__swatch {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.dm-dist-list--dual {
  gap: 0.4375rem;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
  padding-right: 0.125rem;
}

.dm-dist-row--dual .dm-dist-row__tracks {
  display: flex;
  flex-direction: column;
  gap: 0.1875rem;
}

.dm-dash-sales-stack .dm-dash-charts > .dm-panel:first-child .dm-panel__body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* Pipeline pulse — sales activity chart */
.dm-activity-panel {
  position: relative;
  gap: 0.375rem;
  background:
    radial-gradient(ellipse 90% 70% at 50% 0%, color-mix(in srgb, var(--dm-primary-soft) 80%, transparent), transparent 68%),
    var(--dm-surface);
}

.dm-activity-insights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.375rem;
  flex-shrink: 0;
}

.dm-activity-insight {
  display: flex;
  align-items: center;
  gap: 0.4375rem;
  padding: 0.4375rem 0.5rem;
  border-radius: 0.625rem;
  border: 1px solid color-mix(in srgb, var(--dm-border) 85%, transparent);
  background: color-mix(in srgb, var(--dm-surface) 92%, var(--dm-surface-2));
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  min-width: 0;
}

.dm-activity-insight__icon {
  flex-shrink: 0;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 0.4375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
}

.dm-activity-insight--customers .dm-activity-insight__icon {
  background: color-mix(in srgb, var(--dm-chart-1) 14%, var(--dm-surface));
  color: var(--dm-chart-1);
}

.dm-activity-insight--enquiries .dm-activity-insight__icon {
  background: color-mix(in srgb, var(--dm-chart-7) 16%, var(--dm-surface));
  color: var(--dm-chart-7);
}

.dm-activity-insight--peak {
  border-color: color-mix(in srgb, var(--dm-warning) 28%, var(--dm-border));
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--dm-warning) 6%, var(--dm-surface)),
    color-mix(in srgb, var(--dm-surface) 94%, var(--dm-surface-2))
  );
}

.dm-activity-insight--peak .dm-activity-insight__icon {
  background: color-mix(in srgb, var(--dm-warning) 12%, var(--dm-surface));
  color: var(--dm-warning);
}

.dm-activity-insight__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.dm-activity-insight__value {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--dm-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-activity-insight__label {
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dm-text-3);
}

.dm-activity-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  flex-shrink: 0;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--dm-text-3);
}

.dm-activity-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.dm-activity-legend__bar {
  display: inline-block;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 0.1875rem;
}

.dm-activity-legend__bar--customers {
  background: linear-gradient(180deg, var(--dm-chart-3), var(--dm-chart-1));
}

.dm-activity-legend__bar--enquiries {
  background: linear-gradient(180deg, var(--dm-chart-8), var(--dm-chart-7));
}

.dm-activity-legend__ratio {
  margin-left: auto;
  padding: 0.125rem 0.4375rem;
  border-radius: 999px;
  background: var(--dm-primary-soft);
  color: var(--dm-primary);
  font-size: 0.5625rem;
  letter-spacing: 0.02em;
}

.dm-chart-canvas-wrap--activity {
  flex: 1;
  min-height: 0;
}

/* Donut + legend */
.dm-donut-wrap {
  position: relative;
  width: 100%;
  min-height: 9rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dm-donut-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
}

.dm-legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  overflow: hidden;
}

.dm-legend-list__item {
  display: grid;
  grid-template-columns: 0.5rem 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3125rem 0.375rem;
  border-radius: 0.5rem;
  transition: background 0.15s ease;
}

.dm-legend-list__item:hover {
  background: color-mix(in srgb, var(--dm-surface-2) 70%, transparent);
}

.dm-legend-list__dot {
  width: 0.5625rem;
  height: 0.5625rem;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 12%, transparent);
}

.dm-legend-list__name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--dm-text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-legend-list__stat {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--dm-text-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.dm-legend-list__empty {
  font-size: 0.75rem;
  color: var(--dm-text-3);
}

.dm-panel-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.75rem 0.5rem;
  gap: 0.25rem;
}

.dm-panel-empty__icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--dm-primary-soft);
  color: var(--dm-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.dm-panel-empty__title {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--dm-text);
}

.dm-panel-empty__text {
  margin: 0 0 0.5rem;
  font-size: 0.6875rem;
  color: var(--dm-text-3);
  max-width: 14rem;
}

/* Status badges */
.dm-status {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.dm-status--active {
  background: rgba(2, 122, 72, 0.1);
  color: var(--dm-success);
}

.dm-status--inactive {
  background: var(--dm-surface-2);
  color: var(--dm-text-3);
}

.dm-status--neutral {
  background: var(--dm-surface-2);
  color: var(--dm-text-2);
}

.dm-status--warning {
  background: rgba(181, 71, 8, 0.12);
  color: var(--dm-warning, #b54708);
}

.dm-status--danger {
  background: rgba(180, 35, 24, 0.12);
  color: var(--dm-danger);
}

.dm-status--success {
  background: rgba(2, 122, 72, 0.1);
  color: var(--dm-success);
}

.dm-status--info {
  background: rgba(30, 45, 110, 0.1);
  color: var(--dm-primary);
}

/* Compact dashboard table */
.dm-table {
  width: 100%;
  border-collapse: collapse;
}

.dm-table tbody tr:hover td {
  background: var(--dm-table-row-hover);
}

.dm-table--compact thead th {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--dm-text-3);
  background: var(--dm-surface-2);
  border-top: none;
  padding: 0.375rem 0.625rem;
  white-space: nowrap;
}

.dm-table--compact tbody td {
  font-size: 0.75rem;
  padding: 0.4rem 0.625rem;
  vertical-align: middle;
  border-color: var(--dm-border);
  color: var(--dm-text-2);
}

.dm-table__mono {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--dm-text);
}

.dm-table-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.625rem;
  color: var(--dm-text-3);
  font-size: 0.75rem;
}

@keyframes dm-dash-rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.stat-card {
  background: var(--dm-surface);
  border: 1px solid var(--dm-border);
  border-radius: var(--dm-radius-lg);
  padding: 1rem;
  min-height: 6rem;
  box-shadow: var(--dm-shadow-sm);
}

.dm-stat-link { text-decoration: none; color: inherit; display: block; }

.stat-label {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--dm-text-3);
}

.stat-label .dm-module-icon {
  margin-right: 0.35rem;
  vertical-align: -0.2em;
  background-color: var(--dm-brand-accent);
}

.stat-value {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 700;
  color: var(--dm-text);
  margin: 0.375rem 0;
  line-height: 1.1;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: 0.75rem;
}

.dm-dashboard {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Single-viewport admin dashboard — no page scroll */
.dm-content:has(.dm-dashboard--fit) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 0.375rem;
  background:
    radial-gradient(ellipse 70% 55% at 100% -5%, rgba(30, 45, 110, 0.05), transparent 58%),
    radial-gradient(ellipse 55% 45% at 0% 100%, rgba(30, 45, 110, 0.04), transparent 52%),
    var(--dm-bg);
}

.dm-main:has(.dm-dashboard--fit) {
  overflow: hidden;
}

.dm-dashboard--fit {
  flex: 1;
  min-height: 0;
  gap: 0.75rem;
  height: calc(100dvh - var(--dm-topbar-h) - 2.125rem - 2 * var(--dm-content-pad));
  max-height: calc(100dvh - var(--dm-topbar-h) - 2.125rem - 2 * var(--dm-content-pad));
  overflow: hidden;
}

.dm-dashboard--refined .dm-dash-header {
  margin-bottom: 0;
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid color-mix(in srgb, var(--dm-border) 80%, transparent);
}

.dm-dashboard--fit .dm-dash-header {
  margin-bottom: 0;
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.dm-dash-header__meta {
  flex-shrink: 0;
  padding-bottom: 0.125rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.375rem;
}

.dm-dash-header__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--dm-text-2);
  padding: 0.3125rem 0.625rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--dm-surface) 88%, var(--dm-primary-soft));
  border: 1px solid color-mix(in srgb, var(--dm-primary) 14%, var(--dm-border));
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.dm-dash-header__chip .dm-module-icon {
  background-color: var(--dm-brand-accent);
}

.dm-dash-header__chip--role {
  color: var(--dm-text-3);
  background: var(--dm-surface-2);
  border-color: var(--dm-border);
  font-weight: 500;
}

.dm-dashboard--fit .dm-dash-header h1 {
  font-size: 1.125rem;
}

.dm-dashboard--fit .dm-dash-header__subtitle,
.dm-dashboard--fit .dm-dash-header p {
  font-size: 0.75rem;
}

.dm-dashboard__body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.5rem;
  overflow: hidden;
}

/* Sales: one stack fills the viewport (KPIs → charts → conversion table) */
.dm-dashboard__body:has(.dm-dash-sales-stack) {
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
}

.dm-dashboard--fit .dm-dash-kpis,
.dm-dashboard--fit .dm-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.625rem;
  margin-bottom: 0;
}

.dm-dashboard--fit .dm-dash-panels {
  min-height: 0;
  height: 100%;
  align-content: stretch;
  gap: 0.75rem;
}

.dm-dashboard--fit .dm-dash-panel {
  min-height: 0;
  height: 100%;
}

.dm-dashboard--fit .dm-dash-panel .dm-panel__body--split {
  align-items: center;
  min-height: 0;
}

.dm-dashboard--fit .dm-donut-wrap {
  max-width: min(100%, 11rem);
  max-height: 100%;
}

/* Sales fit — charts grow, conversion table pinned below */
.dm-dashboard--fit .dm-dash-sales-stack {
  gap: 0.4375rem;
}

.dm-dashboard--fit .dm-dash-sales-stack .dm-kpi-grid {
  gap: 0.4375rem;
}

.dm-dashboard--fit .dm-dash-sales-stack .dm-dash-charts {
  min-height: 0;
}

.dm-dashboard--fit .dm-dash-sales-stack .dm-dash-panel--chart .dm-panel__header {
  padding: 0.4375rem 0.75rem;
}

.dm-dashboard--fit .dm-dash-sales-stack .dm-dash-panel--chart .dm-panel__subtitle {
  display: none;
}

.dm-dashboard--fit .dm-dash-sales-stack .dm-dash-panel--activity .dm-panel__subtitle {
  display: none;
}

.dm-dashboard--fit .dm-dash-sales-stack .dm-activity-insights {
  gap: 0.3125rem;
}

.dm-dashboard--fit .dm-dash-sales-stack .dm-activity-insight {
  padding: 0.3125rem 0.4375rem;
}

.dm-dashboard--fit .dm-dash-sales-stack .dm-activity-insight__value {
  font-size: 0.75rem;
}

.dm-dashboard--fit .dm-dash-sales-stack .dm-activity-legend {
  margin-bottom: 0.125rem;
}

.dm-dashboard--fit .dm-dash-sales-stack .dm-chart-canvas-wrap {
  min-height: 0;
}

.dm-dashboard--fit .dm-dash-sales-stack .dm-dash-table {
  max-height: 10.25rem;
  min-height: 0;
  flex-shrink: 0;
}

.dm-dashboard--fit .dm-dash-sales-stack .dm-dash-table__body {
  min-height: 0;
  max-height: 5.25rem;
}

.dm-dashboard--fit .dm-dash-sales-stack .dm-dash-table .table-container {
  max-height: 5.25rem;
}

.dm-dashboard--fit .dm-dash-sales-stack .dm-dash-table__empty-row td {
  height: 4rem;
}

.dm-dashboard--fit .dm-dash-sales-stack .dm-dash-table .dm-table--compact tbody td,
.dm-dashboard--fit .dm-dash-sales-stack .dm-dash-table .dm-table--compact thead th {
  padding: 0.28rem 0.625rem;
}

.dm-dashboard--fit .dm-kpi-card {
  padding: 0.8125rem 0.875rem 0.75rem;
}

.dm-dashboard--fit .dm-kpi-card__value {
  font-size: 1.4375rem;
}

.dm-dashboard--fit .dm-kpi-card__icon {
  width: 2.25rem;
  height: 2.25rem;
  font-size: 0.875rem;
  border-radius: 0.625rem;
}

.dm-dashboard--fit .stat-card {
  padding: 0.5rem 0.625rem;
  min-height: 0;
}

.dm-dashboard--fit .stat-value {
  font-size: 1.375rem;
  margin: 0.2rem 0;
}

.dm-dashboard--fit .stat-label,
.dm-dashboard--fit .stat-total {
  font-size: 0.625rem;
}

.dm-dashboard--fit .dm-dash-charts {
  min-height: 0;
  height: 100%;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.75rem;
  align-items: stretch;
}

.dm-dashboard--fit .dm-chart-panel {
  min-height: 0;
}

.dm-dashboard--fit .chart-container {
  min-height: 0;
  height: 100%;
  padding: 0.5rem 0.625rem;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.dm-dashboard--fit .chart-title {
  font-size: 0.8125rem;
  margin-bottom: 0.375rem;
  flex-shrink: 0;
}

.dm-chart-canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}

.dm-chart-canvas-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-height: none;
}

.dm-chart-canvas-wrap--donut {
  display: flex;
  align-items: center;
  justify-content: center;
}

.dm-dashboard--fit .dm-dash-table {
  margin-bottom: 0;
  flex-shrink: 0;
  max-height: 11rem;
}

.dm-dashboard--fit .dm-dash-table .dm-panel__header {
  padding: 0.375rem 0.625rem;
}

.dm-dashboard--fit .dm-dash-table__body {
  min-height: 4.75rem;
}

.dm-dashboard--fit .dm-dash-table__empty-row td {
  height: 4.75rem;
  vertical-align: middle;
}

.dm-dashboard--fit .dm-dash-table .dm-table--compact tbody td,
.dm-dashboard--fit .dm-dash-table .dm-table--compact thead th {
  padding: 0.375rem 0.75rem;
}

.dm-dash-table .dm-table--compact tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--dm-surface-2) 45%, transparent);
}

.dm-dash-table .dm-table--compact tbody tr:hover td {
  background: var(--dm-table-row-hover);
}

.dm-dashboard--fit .dm-dash-table .dm-panel__footer {
  padding: 0.3rem 0.625rem;
}

.dm-chart-panel {
  min-height: 18rem;
}

.dm-chart-panel canvas {
  max-height: 16rem;
}

.dm-dashboard-modules {
  padding: 0.75rem 1rem 1rem;
}

.stat-card:hover,
a:hover .stat-card {
  border-color: var(--dm-primary-ring);
  box-shadow: var(--dm-shadow-md);
}

.stat-total {
  font-size: 0.6875rem;
  color: var(--dm-text-3);
}

.h-84 { min-height: 18rem; }

.chart-container, .conversion-container {
  background: var(--dm-surface);
  border: 1px solid var(--dm-border);
  border-radius: var(--dm-radius-lg);
  padding: 1rem;
  min-height: 16rem;
  box-shadow: var(--dm-shadow-sm);
}

.chart-title, .conversion-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.conversion-table { overflow-x: auto; }

.dm-conv-meter {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 6.5rem;
}

.dm-conv-meter__track {
  height: 0.375rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--dm-surface-2) 75%, var(--dm-border));
  overflow: hidden;
}

.dm-conv-meter__fill {
  display: block;
  height: 100%;
  max-width: 100%;
  border-radius: 999px;
  min-width: 0;
  background: linear-gradient(90deg, var(--dm-primary) 0%, color-mix(in srgb, var(--dm-chart-3) 80%, var(--dm-primary)) 100%);
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.dm-conv-meter__label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--dm-text-2);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.conversion-bar {
  background: var(--dm-primary);
  height: 1.125rem;
  border-radius: 0.2rem;
  min-width: 1.5rem;
  position: relative;
}

.conversion-bar span {
  position: absolute;
  right: 0.35rem;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1.125rem;
}

/* Design preview page */
.dm-design-preview__frame {
  padding: 1rem;
  background: var(--dm-surface-2);
  border-top: 1px solid var(--dm-border);
  overflow: auto;
}

.dm-design-preview__img {
  display: block;
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  border-radius: var(--dm-radius-lg);
  border: 1px solid var(--dm-border);
  box-shadow: var(--dm-shadow-md);
}

.dm-design-preview__notes {
  padding: 1rem;
  border-top: 1px solid var(--dm-border);
  font-size: 0.8125rem;
  color: var(--dm-text-2);
}

.dm-design-preview__notes p {
  margin-bottom: 0.5rem;
}

.dm-design-preview__notes code {
  font-size: 0.75rem;
  color: var(--dm-text);
  background: var(--dm-surface-2);
  padding: 0.125rem 0.375rem;
  border-radius: var(--dm-radius);
}

/* Auth */
.dm-login-page {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--dm-bg);
}

.dm-login-brand {
  background: linear-gradient(155deg, var(--dm-primary-hover), var(--dm-primary));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(2rem, 5vw, 4rem);
}

.dm-login-brand-inner { text-align: center; max-width: 22rem; }

.dm-login-brand .dm-brand-logo {
  height: clamp(2.25rem, 5vw, 3rem);
  margin: 0 auto 1.25rem;
  filter: brightness(0) invert(1);
}

.dm-login-brand h1 {
  color: #fff;
  font-size: clamp(1.125rem, 3vw, 1.5rem);
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.dm-login-brand p {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.875rem;
  margin: 0;
}

.dm-login-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  background: var(--dm-bg);
}

.dm-login-card { width: 100%; max-width: 22rem; }

.dm-login-card .dm-brand-logo {
  display: none;
  height: 2rem;
  margin: 0 auto 1rem;
  filter: var(--dm-logo-filter);
}

.dm-login-card h2 { font-size: 1.25rem; font-weight: 600; }

.dm-login-subtitle { color: var(--dm-text-3); font-size: 0.8125rem; margin-bottom: 1.25rem; }

.dm-login-panel .dm-theme-toggle { margin-bottom: 1rem; }

.dm-auth-footer {
  margin-top: 1.25rem;
  font-size: 0.6875rem;
  color: var(--dm-text-3);
  text-align: center;
}

/* Responsive */
@media (max-width: 1024px) {
  .dm-sidebar { transform: translateX(-100%); box-shadow: var(--dm-shadow-md); }
  .dm-sidebar.is-open { transform: translateX(0); }
  .dm-main, .dm-main.collapsed { margin-left: 0; }
  .dm-mobile-menu { display: inline-flex; align-items: center; }
  .dm-sidebar-toggle { display: none; }

  .dm-kpi-grid,
  .dm-dashboard--fit .dm-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dm-dash-charts,
  .dm-dashboard--fit .dm-dash-charts,
  .dm-dash-sales-stack .dm-dash-charts {
    grid-template-columns: 1fr;
  }

  .dm-activity-insights {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dm-dash-panel--chart .dm-panel__body--split.dm-panel__body--chart {
    grid-template-columns: minmax(8rem, 38%) 1fr;
  }
}

@media (max-width: 768px) {
  .dm-login-page { grid-template-columns: 1fr; }
  .dm-login-brand { display: none; }
  .dm-login-card .dm-brand-logo { display: block; }
  .dm-toolbar, .dm-content > .d-flex.justify-content-between.my-3 {
    flex-direction: column;
    align-items: stretch;
  }
  .dm-toolbar-actions { margin-left: 0; width: 100%; }
  .dm-toolbar-search { max-width: none; flex: 1 1 100%; }
  .table { min-width: 36rem; }
}

/* Bootstrap dark compat */
[data-theme="dark"] .dropdown-menu {
  background-color: var(--dm-surface);
  border-color: var(--dm-border);
}

[data-theme="dark"] .dropdown-item { color: var(--dm-text-2); }

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
  background-color: var(--dm-surface-2);
  color: var(--dm-text);
}

[data-theme="dark"] .dropdown-divider { border-color: var(--dm-border); }

[data-theme="dark"] .alert {
  background: var(--dm-surface-2);
  border-color: var(--dm-border);
  color: var(--dm-text);
}

[data-theme="dark"] .bg-light,
[data-theme="dark"] .table-light {
  background-color: var(--dm-surface-2) !important;
}

[data-theme="dark"] .text-muted { color: var(--dm-text-3) !important; }

/* ─── Aurora Midnight — shell & surfaces ─── */
[data-theme="dark"] body {
  background:
    radial-gradient(ellipse 100% 60% at 50% -15%, rgba(70, 95, 180, 0.2), transparent 58%),
    linear-gradient(180deg, #060a14 0%, #0a1020 45%, #070b16 100%);
}

[data-theme="dark"] .dm-sidebar {
  background: #0a0f1e;
  border-right-color: var(--dm-border);
}

[data-theme="dark"] .dm-topbar {
  background: rgba(12, 18, 36, 0.92);
  backdrop-filter: blur(10px);
  border-bottom-color: var(--dm-border);
}

[data-theme="dark"] .dm-footer {
  background: rgba(10, 15, 30, 0.95);
  border-top-color: var(--dm-border);
}

[data-theme="dark"] .dm-content:has(.dm-dashboard--fit) {
  background:
    radial-gradient(ellipse 70% 50% at 100% 0%, rgba(70, 95, 180, 0.12), transparent 55%),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(50, 70, 140, 0.08), transparent 50%),
    transparent;
}

[data-theme="dark"] .dm-content {
  background: transparent;
}

/* Elevated cards */
[data-theme="dark"] .dm-kpi-card,
[data-theme="dark"] .dm-panel,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .chart-container,
[data-theme="dark"] .dm-data-panel {
  background: var(--dm-surface);
  border-color: var(--dm-border);
  box-shadow: var(--dm-shadow-sm);
}

[data-theme="dark"] .dm-kpi-card {
  background: linear-gradient(155deg, var(--dm-surface) 0%, color-mix(in srgb, var(--dm-surface-2) 45%, var(--dm-surface)) 100%);
  border-color: var(--dm-border);
  box-shadow: var(--dm-shadow-sm);
}

[data-theme="dark"] .dm-kpi-card::before,
[data-theme="dark"] .dm-panel::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  border-radius: 0.875rem 0.875rem 0 0;
  background: var(--dm-card-edge);
  pointer-events: none;
}

[data-theme="dark"] .dm-kpi-card,
[data-theme="dark"] .dm-panel {
  position: relative;
}

[data-theme="dark"] .dm-kpi-card__icon {
  background: color-mix(in srgb, var(--dm-kpi-accent-soft) 120%, rgba(74, 95, 170, 0.18));
  border: 1px solid color-mix(in srgb, var(--dm-kpi-accent) 22%, transparent);
  color: var(--dm-link);
  box-shadow: none;
}

[data-theme="dark"] .dm-trend-pill--up {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.22);
}

[data-theme="dark"] .dm-trend-pill--down {
  color: #fdba74;
  background: rgba(251, 146, 60, 0.1);
  border-color: rgba(251, 146, 60, 0.2);
}

[data-theme="dark"] .dm-panel__header {
  background: linear-gradient(180deg, var(--dm-surface) 0%, color-mix(in srgb, var(--dm-surface-2) 55%, var(--dm-surface)) 100%);
}

[data-theme="dark"] .dm-panel__link {
  color: var(--dm-link);
  border-color: color-mix(in srgb, var(--dm-link) 22%, var(--dm-border));
  background: rgba(74, 95, 170, 0.12);
}

[data-theme="dark"] .dm-panel__search-input {
  background: var(--dm-surface-2);
  border-color: var(--dm-border);
  color: var(--dm-text);
}

[data-theme="dark"] .dm-panel__search-input:focus {
  border-color: color-mix(in srgb, var(--dm-link) 35%, var(--dm-border));
  box-shadow: 0 0 0 3px rgba(74, 95, 170, 0.2);
}

[data-theme="dark"] .dm-legend-list__item:hover {
  background: rgba(74, 95, 170, 0.1);
}

[data-theme="dark"] .dm-conv-meter__track {
  background: rgba(20, 30, 55, 0.9);
  border: 1px solid rgba(130, 155, 210, 0.1);
}

[data-theme="dark"] .dm-conv-meter__fill {
  background: linear-gradient(90deg, #5a72b2 0%, #8499d4 100%);
}

[data-theme="dark"] .dm-dashboard--refined .dm-dash-header {
  border-bottom-color: var(--dm-border);
}

[data-theme="dark"] .dm-activity-panel {
  background:
    radial-gradient(ellipse 90% 65% at 50% 0%, rgba(74, 95, 170, 0.18), transparent 65%),
    var(--dm-surface);
}

[data-theme="dark"] .dm-activity-insight {
  background: color-mix(in srgb, var(--dm-surface-2) 70%, var(--dm-surface));
  border-color: var(--dm-border);
}

[data-theme="dark"] .dm-activity-legend__ratio {
  background: rgba(74, 95, 170, 0.2);
  color: var(--dm-link);
}

/* Buttons */
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-success {
  background: linear-gradient(180deg, var(--dm-accent-hover) 0%, var(--dm-accent) 100%);
  border-color: rgba(130, 155, 220, 0.45);
  color: var(--dm-accent-text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] .btn-primary:focus,
[data-theme="dark"] .btn-success:hover,
[data-theme="dark"] .btn-success:focus {
  background: linear-gradient(180deg, #6274c4 0%, #4f62b4 100%);
  border-color: rgba(150, 175, 240, 0.5);
  color: var(--dm-accent-text);
}

[data-theme="dark"] .btn-group-toggle .btn-custom,
[data-theme="dark"] .dm-toolbar .btn-custom {
  background: var(--dm-surface-2);
  border-color: var(--dm-border);
  color: var(--dm-text-2);
}

[data-theme="dark"] .btn-group-toggle .btn-custom:hover,
[data-theme="dark"] .dm-toolbar .btn-custom:hover {
  background: var(--dm-surface-3);
  color: var(--dm-text);
  border-color: var(--dm-border-strong);
}

[data-theme="dark"] .btn-group-toggle .btn-custom.active,
[data-theme="dark"] .btn-group-toggle .btn-custom.active:hover,
[data-theme="dark"] .dm-toolbar .btn-custom.active,
[data-theme="dark"] .dm-toolbar .btn-custom.active:hover,
[data-theme="dark"] label.btn-custom.active {
  background: linear-gradient(180deg, var(--dm-accent-hover) 0%, var(--dm-accent) 100%);
  border-color: rgba(140, 165, 230, 0.5);
  color: var(--dm-accent-text);
  box-shadow: 0 0 0 1px rgba(100, 125, 210, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Navigation */
[data-theme="dark"] .dm-nav-link:hover {
  background: rgba(90, 110, 190, 0.12);
  color: var(--dm-text);
}

[data-theme="dark"] .dm-nav-link.active {
  background: rgba(255, 255, 255, 0.06);
  color: var(--dm-text-2);
  box-shadow: none;
}

[data-theme="dark"] .dm-nav-link.active .dm-nav-label {
  color: var(--dm-text-2);
}

[data-theme="dark"] .dm-nav-link.active i {
  color: var(--dm-brand-accent);
}

[data-theme="dark"] .dm-sidebar-tooltip {
  background: var(--dm-surface-3);
  color: var(--dm-text);
  border: 1px solid var(--dm-border);
}

[data-theme="dark"] .dm-sidebar-tooltip::before {
  border-right-color: var(--dm-surface-3);
}

[data-theme="dark"] .dm-sidebar.collapsed .dm-nav-link.active {
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

[data-theme="dark"] .dm-sidebar.collapsed .dm-nav-link.active i {
  color: var(--dm-brand-accent);
}

[data-theme="dark"] .dm-nav-section {
  color: var(--dm-text-3);
}

/* Dashboard KPI */
[data-theme="dark"] .dm-kpi-card:hover {
  border-color: var(--dm-border-strong);
  box-shadow: var(--dm-shadow-md);
}

[data-theme="dark"] .dm-kpi-card__icon {
  background: rgba(74, 95, 170, 0.22);
  border: 1px solid rgba(120, 145, 210, 0.28);
  color: var(--dm-link);
}

[data-theme="dark"] .dm-kpi-card__label {
  color: var(--dm-text-3);
}

[data-theme="dark"] .dm-kpi-card__value {
  color: var(--dm-text);
}

[data-theme="dark"] .dm-kpi-card__meta {
  color: var(--dm-text-2);
}

/* Panels & typography */
[data-theme="dark"] .dm-panel__title,
[data-theme="dark"] .dm-dash-header h1 {
  color: var(--dm-text);
}

[data-theme="dark"] .dm-panel__subtitle,
[data-theme="dark"] .dm-dash-header p,
[data-theme="dark"] .dm-dist-row__label,
[data-theme="dark"] .dm-legend-list__name {
  color: var(--dm-text-2);
}

[data-theme="dark"] .dm-panel__link,
[data-theme="dark"] .dm-panel__footer-link {
  color: var(--dm-link);
}

[data-theme="dark"] .dm-panel__link:hover,
[data-theme="dark"] .dm-panel__footer-link:hover {
  color: var(--dm-primary-hover);
}

[data-theme="dark"] .dm-panel__footer {
  background: var(--dm-surface-2);
  border-top: 1px solid var(--dm-border);
}

[data-theme="dark"] .dm-dist-row__stat,
[data-theme="dark"] .dm-legend-list__stat {
  color: var(--dm-text-2);
  font-weight: 600;
}

[data-theme="dark"] .dm-dist-row__track {
  background: rgba(20, 30, 55, 0.9);
  border: 1px solid rgba(130, 155, 210, 0.1);
}

[data-theme="dark"] .dm-dist-footnote {
  border-top-color: var(--dm-border);
  color: var(--dm-text-3);
}

[data-theme="dark"] .dm-dash-header__chip {
  background: rgba(90, 110, 196, 0.18);
  border-color: rgba(140, 165, 230, 0.25);
  color: var(--dm-text-2);
}

[data-theme="dark"] .dm-dash-header__chip--role {
  background: var(--dm-surface-2);
  border-color: var(--dm-border);
  color: var(--dm-text-3);
}

/* Tables */
[data-theme="dark"] .dm-table--compact thead th {
  background: var(--dm-table-head);
  color: var(--dm-text-2);
  border-color: var(--dm-border);
}

[data-theme="dark"] .dm-table--compact tbody td {
  color: var(--dm-text-2);
  border-color: var(--dm-border);
}

[data-theme="dark"] .dm-table__mono {
  color: var(--dm-text);
}

[data-theme="dark"] .dm-status--active {
  background: rgba(46, 180, 120, 0.18);
  color: #7ddeb8;
}

[data-theme="dark"] .dm-status--inactive {
  background: rgba(120, 135, 170, 0.15);
  color: var(--dm-text-3);
}

/* Chrome */
[data-theme="dark"] .dm-theme-toggle button.is-active {
  background: rgba(90, 110, 196, 0.28);
  color: var(--dm-primary);
}

[data-theme="dark"] .dm-footer a {
  color: var(--dm-text-2);
}

[data-theme="dark"] .dm-footer a:hover {
  color: var(--dm-link);
}

[data-theme="dark"] .dm-user-menu__trigger {
  border-color: var(--dm-border-strong);
  color: var(--dm-brand-accent);
}

[data-theme="dark"] .table thead th {
  color: var(--dm-text-2);
}

[data-theme="dark"] .table td {
  color: var(--dm-text-2);
}

[data-theme="dark"] .checkbox-green {
  border-color: var(--dm-border-strong);
  background: var(--dm-surface-2);
}

[data-theme="dark"] .checkbox-green:checked {
  background-color: var(--dm-accent);
  border-color: var(--dm-accent);
}

/* ─── Toast notifications ─── */
.dm-toast-stack {
  position: fixed;
  top: calc(var(--dm-topbar-h) + 0.75rem);
  right: clamp(0.75rem, 2vw, 1.25rem);
  z-index: 10050;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(22rem, calc(100vw - 1.5rem));
  pointer-events: none;
}

.dm-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.75rem 0.875rem;
  background: var(--dm-surface);
  border: 1px solid var(--dm-border);
  border-left: 3px solid var(--dm-primary);
  border-radius: var(--dm-radius-lg);
  box-shadow: var(--dm-shadow-md);
  animation: dm-toast-in 0.28s ease;
}

.dm-toast__icon {
  flex-shrink: 0;
  width: 1.125rem;
  margin-top: 0.1rem;
  font-size: 0.875rem;
  color: var(--dm-primary);
}

.dm-toast--success { border-left-color: var(--dm-success); }
.dm-toast--success .dm-toast__icon { color: var(--dm-success); }

.dm-toast--error { border-left-color: var(--dm-danger); }
.dm-toast--error .dm-toast__icon { color: var(--dm-danger); }

.dm-toast--warning { border-left-color: var(--dm-warning); }
.dm-toast--warning .dm-toast__icon { color: var(--dm-warning); }

.dm-toast--info { border-left-color: var(--dm-primary); }
.dm-toast--info .dm-toast__icon { color: var(--dm-primary); }

.dm-toast__body {
  flex: 1;
  min-width: 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--dm-text);
}

.dm-toast__close {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--dm-text-3);
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  cursor: pointer;
  border-radius: var(--dm-radius);
  line-height: 1;
  font-size: 1rem;
}

.dm-toast__close:hover {
  color: var(--dm-text);
  background: var(--dm-surface-2);
}

@keyframes dm-toast-in {
  from { opacity: 0; transform: translateX(0.75rem); }
  to { opacity: 1; transform: translateX(0); }
}

.dm-toast.is-leaving {
  animation: dm-toast-out 0.2s ease forwards;
}

@keyframes dm-toast-out {
  to { opacity: 0; transform: translateX(0.75rem); }
}
