:root {
  color-scheme: light;
  --erp-bg: #f5f7fb;
  --erp-surface: #ffffff;
  --erp-surface-soft: #f8fafc;
  --erp-surface-tint: #f1f5fb;
  --erp-line: #e7ebf2;
  --erp-line-strong: #d8deea;
  --erp-text: #162033;
  --erp-text-soft: #3e4a61;
  --erp-muted: #758097;
  --erp-primary: #165dff;
  --erp-primary-strong: #0f4ddd;
  --erp-primary-soft: #edf3ff;
  --erp-cyan: #00aeca;
  --erp-success: #00a870;
  --erp-warning: #ed940f;
  --erp-danger: #ef454f;
  --erp-radius-sm: 7px;
  --erp-radius: 10px;
  --erp-radius-lg: 14px;
  --erp-shadow-soft: 0 4px 16px rgba(37, 54, 88, 0.045);
  --bg: var(--erp-bg);
  --panel: var(--erp-surface);
  --panel-soft: var(--erp-surface-soft);
  --soft: var(--erp-surface-soft);
  --line: var(--erp-line);
  --text: var(--erp-text);
  --muted: var(--erp-muted);
  --brand: var(--erp-primary);
  --brand-2: var(--erp-primary-strong);
  --good: var(--erp-success);
  --warn: var(--erp-warning);
  --bad: var(--erp-danger);
  --shadow: var(--erp-shadow-soft);
  --radius: var(--erp-radius);
}

[hidden] {
  display: none !important;
}

html {
  background: var(--erp-bg);
}

#erpBootNotice {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 9999;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #f2c36b;
  border-radius: 8px;
  background: #fff9e9;
  color: #6e4b09;
  box-shadow: 0 8px 24px rgba(34, 43, 65, .14);
  font-size: 13px;
  transform: translateX(-50%);
}

#erpBootNotice button {
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid currentColor;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

body:not(.embed) {
  margin: 0 !important;
  padding: 0 !important;
  max-width: 100vw;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--erp-bg) !important;
  color: var(--erp-text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif !important;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body:not(.embed) .shell {
  width: 100%;
  max-width: none !important;
  min-height: 100vh;
  margin: 0 !important;
  display: grid !important;
  grid-template-columns: 240px minmax(0, 1fr) !important;
  gap: 0 !important;
  align-items: stretch !important;
}

body:not(.embed) .sidebar {
  position: sticky !important;
  inset: 0 auto auto 0;
  top: 0 !important;
  z-index: 30;
  width: 240px;
  height: 100vh;
  min-height: 100vh !important;
  max-height: 100vh !important;
  padding: 18px 14px 14px !important;
  display: flex !important;
  flex-direction: column;
  gap: 14px !important;
  overflow: hidden !important;
  background: var(--erp-surface) !important;
  border: 0 !important;
  border-right: 1px solid var(--erp-line) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

body:not(.embed) .brand {
  min-height: 66px;
  padding: 6px 6px 6px 10px;
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: space-between;
  gap: 8px !important;
  text-align: left !important;
}

.erp-brand-collapse {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--erp-muted);
  font-size: 18px;
  cursor: pointer;
}

.erp-brand-collapse:hover {
  background: var(--erp-primary-soft);
  color: var(--erp-primary);
}

.erp-brand-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.erp-release-version {
  margin-top: 3px;
  padding: 1px 5px;
  border: 1px solid #c9d8ff;
  border-radius: 999px;
  background: #edf3ff;
  color: #3567f6;
  font-size: 10px;
  line-height: 1.3;
  font-weight: 750;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

body:not(.embed) .brand h1 {
  margin: 0 !important;
  color: var(--erp-text);
  font-size: 20px !important;
  line-height: 1.25;
  font-weight: 760;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

body:not(.embed) .brand p {
  margin: 3px 0 0 !important;
  color: var(--erp-muted) !important;
  font-size: 11px !important;
  line-height: 1.3 !important;
  white-space: nowrap;
}

#globalNav {
  min-height: 0;
  display: flex !important;
  flex: 1 1 0% !important;
  flex-direction: column !important;
  gap: 12px;
  overflow: hidden !important;
}

.erp-nav-scroll {
  width: 100%;
  max-height: 100%;
  min-height: 0;
  flex: 1 1 0% !important;
  overflow-x: hidden;
  overflow-y: scroll !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: #8da2c3 #eef2f7;
}

.erp-nav-scroll::-webkit-scrollbar {
  width: 12px;
}

.erp-nav-scroll::-webkit-scrollbar-track {
  border-radius: 999px;
  background: #eef2f7;
}

.erp-nav-scroll::-webkit-scrollbar-thumb {
  min-height: 36px;
  border: 2px solid #eef2f7;
  border-radius: 999px;
  background: #8da2c3;
}

.erp-nav-scroll:hover::-webkit-scrollbar-thumb {
  background: #5f7fae;
}

.erp-nav {
  display: grid !important;
  gap: 4px !important;
  padding-right: 2px;
}

.erp-nav a,
.erp-nav button[data-nav-link],
.erp-session-tabs a,
.erp-search-results a,
.erp-user-menu a,
.erp-topbar a {
  text-decoration: none !important;
}

.erp-nav-group {
  display: grid !important;
  gap: 2px !important;
}

.erp-nav-title {
  width: 100%;
  height: 40px;
  padding: 0 10px !important;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: var(--erp-radius-sm);
  background: transparent;
  color: var(--erp-text-soft) !important;
  font-size: 13px !important;
  font-weight: 650 !important;
  text-align: left;
  cursor: pointer;
  transition: color 0.16s ease, background 0.16s ease;
}

.erp-nav-title:hover {
  background: var(--erp-surface-soft);
  color: var(--erp-primary) !important;
}

.erp-nav-group[data-current="true"] .erp-nav-title {
  background: var(--erp-primary);
  color: #fff !important;
  box-shadow: 0 7px 16px rgba(75, 99, 243, 0.22);
}

.erp-nav-group[data-current="true"] .erp-nav-title i:first-child,
.erp-nav-group[data-current="true"] .erp-nav-title .erp-nav-chevron {
  color: #fff !important;
}

.erp-nav-title i:first-child {
  color: var(--erp-muted);
  font-size: 17px;
}

.erp-nav-title .erp-nav-chevron {
  color: #a0a8b8;
  font-size: 15px;
  transition: transform 0.16s ease;
}

.erp-nav-group[data-open="true"] .erp-nav-title {
  color: var(--erp-text) !important;
}

.erp-nav-group[data-open="true"] .erp-nav-title i:first-child {
  color: var(--erp-primary);
}

.erp-nav-group[data-open="true"] .erp-nav-chevron {
  transform: rotate(180deg);
}

.erp-nav-items {
  display: grid !important;
  gap: 2px !important;
  padding: 3px 0 6px 12px;
}

.erp-nav-group[data-open="false"] .erp-nav-items {
  display: none !important;
}

.erp-nav a,
.erp-nav button[data-nav-link] {
  position: relative;
  min-height: 34px;
  padding: 8px 10px !important;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 0 !important;
  border-radius: var(--erp-radius-sm) !important;
  background: transparent !important;
  color: #5d667a !important;
  font-size: 12.5px !important;
  line-height: 1.35;
  text-align: left;
  transition: color 0.15s ease, background 0.15s ease;
  width: 100%;
  cursor: pointer;
}

.erp-nav a:hover,
.erp-nav button[data-nav-link]:hover {
  background: var(--erp-surface-soft) !important;
  color: var(--erp-primary) !important;
}

.erp-nav a > i,
.erp-nav button[data-nav-link] > i {
  color: #8792a9;
  font-size: 16px;
}

.erp-nav a:hover > i,
.erp-nav a.active > i,
.erp-nav button[data-nav-link]:hover > i,
.erp-nav button[data-nav-link].active > i {
  color: var(--erp-primary);
}

.erp-nav a.active,
.erp-nav button[data-nav-link].active {
  background: var(--erp-primary-soft) !important;
  color: var(--erp-primary-strong) !important;
  font-weight: 700 !important;
}

.erp-nav a.active::before,
.erp-nav button[data-nav-link].active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 99px;
  background: var(--erp-primary);
}

.erp-user-switch {
  order: 2;
  padding: 10px !important;
  display: grid !important;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 3px 9px !important;
  align-items: center;
  border: 1px solid var(--erp-line) !important;
  border-radius: var(--erp-radius) !important;
  background: var(--erp-surface-soft) !important;
}

.erp-user-avatar {
  grid-row: 1 / span 2;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #e5ecff;
  color: var(--erp-primary-strong);
  font-size: 16px;
}

.erp-user-switch label {
  display: none;
}

.erp-user-switch select {
  width: 100%;
  min-width: 0;
  padding: 0 22px 0 0 !important;
  border: 0 !important;
  background-color: transparent !important;
  color: var(--erp-text) !important;
  font-size: 12px;
  font-weight: 650;
  outline: none;
}

.erp-user-scope {
  overflow: hidden;
  color: var(--erp-muted) !important;
  font-size: 10.5px !important;
  line-height: 1.3 !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body:not(.embed) .main {
  min-width: 0;
  padding: 0 22px 32px !important;
  display: grid !important;
  align-content: start !important;
  gap: 16px !important;
}

.erp-topbar {
  position: sticky;
  top: 0;
  z-index: 24;
  min-height: 64px;
  margin: 0 -22px;
  padding: 0 22px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(240px, 360px) auto;
  align-items: center;
  gap: 18px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--erp-line);
  backdrop-filter: blur(12px);
}

.erp-topbar-leading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.erp-sidebar-toggle,
.erp-topbar-icon,
.erp-profile-trigger {
  border: 0;
  background: transparent;
  color: var(--erp-text-soft);
  cursor: pointer;
}

.erp-sidebar-toggle,
.erp-topbar-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  font-size: 19px;
}

.erp-sidebar-toggle:hover,
.erp-topbar-icon:hover,
.erp-profile-trigger:hover {
  background: var(--erp-surface-soft);
  color: var(--erp-primary);
}

.erp-topbar-title {
  overflow: hidden;
  color: var(--erp-text);
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.erp-global-search {
  position: relative;
  min-width: 0;
}

.erp-global-search > i {
  position: absolute;
  left: 13px;
  top: 50%;
  z-index: 1;
  color: #9099ab;
  font-size: 17px;
  transform: translateY(-50%);
  pointer-events: none;
}

.erp-global-search input {
  width: 100%;
  height: 38px;
  padding: 0 38px !important;
  border: 1px solid var(--erp-line-strong) !important;
  border-radius: 10px !important;
  background: var(--erp-surface-soft) !important;
  color: var(--erp-text) !important;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.erp-global-search input:focus {
  border-color: #9bb3ff !important;
  background: #fff !important;
  box-shadow: 0 0 0 3px rgba(53, 103, 246, 0.11);
}

.erp-global-search kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  padding: 2px 5px;
  border: 1px solid var(--erp-line);
  border-radius: 5px;
  background: #fff;
  color: var(--erp-muted);
  font: 10px/1.2 inherit;
  transform: translateY(-50%);
  pointer-events: none;
}

.erp-search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  z-index: 70;
  max-height: 360px;
  padding: 6px;
  overflow: auto;
  border: 1px solid var(--erp-line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(27, 38, 67, 0.16);
}

.erp-search-results[hidden] {
  display: none;
}

.erp-search-result {
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border-radius: 8px;
  color: var(--erp-text-soft) !important;
  font-size: 12px;
}

.erp-search-result:hover,
.erp-search-result:focus {
  background: var(--erp-primary-soft);
  color: var(--erp-primary-strong) !important;
  outline: none;
}

.erp-search-empty {
  padding: 18px 12px;
  color: var(--erp-muted);
  font-size: 12px;
  text-align: center;
}

.erp-topbar-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.erp-notification-link {
  position: relative;
  display: inline-flex;
}

.erp-notification-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--erp-danger);
}

.erp-profile {
  position: relative;
}

.erp-profile-trigger {
  min-height: 40px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 9px;
}

.erp-profile-trigger .erp-user-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
}

.erp-profile-name {
  max-width: 112px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.erp-profile-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 72;
  width: 260px;
  padding: 8px;
  border: 1px solid var(--erp-line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(27, 38, 67, 0.16);
}

.erp-profile-menu[hidden] {
  display: none;
}

.erp-profile-summary {
  padding: 8px 9px 10px;
  border-bottom: 1px solid var(--erp-line);
}

.erp-profile-summary strong,
.erp-profile-summary span {
  display: block;
}

.erp-profile-summary strong {
  color: var(--erp-text);
  font-size: 13px;
}

.erp-profile-summary span {
  margin-top: 4px;
  color: var(--erp-muted);
  font-size: 11px;
  line-height: 1.45;
}

.erp-profile-switch {
  padding: 10px 9px 11px;
  border-bottom: 1px solid var(--erp-line);
}

.erp-profile-switch label {
  display: block;
  margin-bottom: 6px;
  color: var(--erp-muted);
  font-size: 11px;
  font-weight: 650;
}

.erp-profile-switch .erp-select-button {
  height: 36px !important;
  min-height: 36px !important;
  background: var(--erp-surface-soft) !important;
}

.erp-profile-menu a {
  margin-top: 6px;
  padding: 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 8px;
  color: var(--erp-text-soft) !important;
  font-size: 12px;
}

.erp-profile-menu a:hover {
  background: var(--erp-surface-soft);
  color: var(--erp-primary) !important;
}

body:not(.embed) .header,
body:not(.embed) .panel {
  border-color: var(--erp-line) !important;
  border-radius: var(--erp-radius) !important;
  background: var(--erp-surface) !important;
  box-shadow: none !important;
}

body:not(.embed) .header {
  padding: 24px 26px !important;
}

body:not(.embed) .panel {
  padding: 18px !important;
}

body:not(.embed) .header h2 {
  color: var(--erp-text);
  font-size: 26px !important;
  font-weight: 750;
  letter-spacing: -0.02em;
}

body:not(.embed) .erp-visual-header {
  position: sticky;
  top: calc(var(--erp-topbar-height, 64px) + var(--erp-session-tabs-height, 0px));
  z-index: 23;
  min-height: 104px;
  padding: 22px 26px !important;
  padding-right: min(46vw, 760px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 20px !important;
  overflow: hidden;
  isolation: isolate;
  background-color: #f7fbff !important;
  background-image:
    linear-gradient(90deg, rgba(250, 252, 255, 1) 0%, rgba(244, 249, 255, .98) 24%, rgba(236, 245, 255, .95) 50%, rgba(244, 249, 255, .98) 76%, rgba(250, 252, 255, 1) 100%) !important;
  background-repeat: no-repeat !important;
  background-position: center center !important;
  background-size: 100% 100% !important;
  border-color: var(--erp-module-line, #e0e7f5) !important;
  box-shadow: 0 10px 24px rgba(31, 51, 89, .07) !important;
  -webkit-backdrop-filter: blur(12px) saturate(115%);
  backdrop-filter: blur(12px) saturate(115%);
}

body:not(.embed) .erp-visual-header::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: min(780px, 56vw);
  transform: translateX(-50%);
  z-index: 0;
  pointer-events: none;
  opacity: .86;
  mix-blend-mode: multiply;
  background-image: var(--erp-module-art);
  background-repeat: no-repeat;
  background-position: center center;
  background-size: auto 96%;
  -webkit-mask-image:
    linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, .16) 18%, #000 38%, #000 62%, rgba(0, 0, 0, .16) 82%, transparent 100%);
  mask-image:
    linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, .16) 18%, #000 38%, #000 62%, rgba(0, 0, 0, .16) 82%, transparent 100%);
}

body:not(.embed) .erp-visual-header::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 255, 255, .44), rgba(255, 255, 255, 0) 34%, rgba(255, 255, 255, 0) 66%, rgba(255, 255, 255, .44));
}

body[data-erp-module="workbench"] {
  --erp-module-art: url("/erp/assets/ui/modules/workbench-cutout.png");
  --erp-module-line: #e4e1fb;
}

body[data-erp-module="funds"] {
  --erp-module-art: url("/erp/assets/ui/modules/funds-cutout.png");
  --erp-module-line: #dce9f8;
}

body[data-erp-module="reconciliation"] {
  --erp-module-art: url("/erp/assets/ui/modules/reconciliation-cutout.png");
  --erp-module-line: #d8ecee;
}

body[data-erp-module="orders"] {
  --erp-module-art: url("/erp/assets/ui/modules/orders-cutout.png");
  --erp-module-line: #e1e5f8;
}

body[data-erp-module="inventory"] {
  --erp-module-art: url("/erp/assets/ui/modules/inventory-cutout.png");
  --erp-module-line: #d9ece9;
}

body[data-erp-module="tax"] {
  --erp-module-art: url("/erp/assets/ui/modules/tax-cutout.png");
  --erp-module-line: #e1e7f3;
}

body[data-erp-module="analytics"] {
  --erp-module-art: url("/erp/assets/ui/modules/analytics-cutout.png");
  --erp-module-line: #e5e1f8;
}

body[data-erp-module="system"] {
  --erp-module-art: url("/erp/assets/ui/modules/system-cutout.png");
  --erp-module-line: #dfe5ee;
}

body:not(.embed) .erp-visual-header-large {
  min-height: 156px;
  padding: 26px 30px !important;
  padding-right: min(46vw, 760px) !important;
}

body:not(.embed) .erp-visual-header-compact {
  min-height: 104px;
}

body:not(.embed) .erp-visual-header > :not(.actions):not(.toolbar):not(.mode-tabs):not(.erp-page-actions) {
  position: relative;
  z-index: 1;
  max-width: min(620px, 46%);
  padding-right: 12px;
}

body:not(.embed) .erp-visual-header h2 {
  margin: 0 !important;
  color: #17254b;
  font-size: 24px !important;
}

body:not(.embed) .erp-visual-header p {
  margin: 7px 0 0 !important;
  max-width: 620px;
  color: #63708a !important;
  font-size: 13px !important;
  line-height: 1.65 !important;
}

body:not(.embed) .erp-visual-header > .actions,
body:not(.embed) .erp-visual-header > .toolbar,
body:not(.embed) .erp-visual-header > .mode-tabs,
body:not(.embed) .erp-visual-header > .erp-page-actions {
  position: absolute;
  top: 50%;
  right: 26px;
  transform: translateY(-50%);
  z-index: 2;
  width: max-content;
  max-width: min(42%, 680px);
  margin-left: 0 !important;
  padding: 0;
  display: inline-flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  align-self: center;
  justify-content: flex-end !important;
  overflow: visible;
  scrollbar-width: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

body:not(.embed) .erp-visual-header > .actions::-webkit-scrollbar,
body:not(.embed) .erp-visual-header > .toolbar::-webkit-scrollbar,
body:not(.embed) .erp-visual-header > .mode-tabs::-webkit-scrollbar,
body:not(.embed) .erp-visual-header > .erp-page-actions::-webkit-scrollbar {
  display: none;
}

body:not(.embed) .erp-visual-header > .actions > button,
body:not(.embed) .erp-visual-header > .actions > a,
body:not(.embed) .erp-visual-header > .toolbar > button,
body:not(.embed) .erp-visual-header > .toolbar > a,
body:not(.embed) .erp-visual-header > .mode-tabs > button,
body:not(.embed) .erp-visual-header > .mode-tabs > a,
body:not(.embed) .erp-visual-header > .erp-page-actions > button,
body:not(.embed) .erp-visual-header > .erp-page-actions > a {
  flex: 0 0 auto !important;
  min-height: 38px !important;
  padding: 0 13px !important;
}

body:not(.embed) .erp-visual-header > .actions > .primary,
body:not(.embed) .erp-visual-header > .actions > .btn.primary,
body:not(.embed) .erp-visual-header > .toolbar > .primary,
body:not(.embed) .erp-visual-header > .toolbar > .btn.primary,
body:not(.embed) .erp-visual-header > .erp-page-actions > .primary,
body:not(.embed) .erp-visual-header > .erp-page-actions > .btn.primary {
  order: 10;
  box-shadow: 0 10px 22px rgba(15, 98, 254, .18) !important;
}

body:not(.embed) .erp-visual-header > .actions > .ghost,
body:not(.embed) .erp-visual-header > .actions > .btn:not(.primary),
body:not(.embed) .erp-visual-header > .actions > .mini,
body:not(.embed) .erp-visual-header > .toolbar > .ghost,
body:not(.embed) .erp-visual-header > .toolbar > .btn:not(.primary),
body:not(.embed) .erp-visual-header > .toolbar > .mini,
body:not(.embed) .erp-visual-header > .erp-page-actions > .ghost,
body:not(.embed) .erp-visual-header > .erp-page-actions > .btn:not(.primary),
body:not(.embed) .erp-visual-header > .erp-page-actions > .mini {
  order: 20;
}

body:not(.embed) .erp-page-action-bar {
  position: sticky;
  top: calc(var(--erp-topbar-height, 64px) + var(--erp-session-tabs-height, 0px));
  z-index: 44;
  max-width: 100%;
  min-height: 50px;
  margin-top: 8px;
  margin-bottom: 4px;
  padding: 7px 0;
  display: flex !important;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  border: 0;
  border-bottom: 1px solid rgba(214, 224, 240, .72);
  border-radius: 0;
  background: linear-gradient(180deg, rgba(245, 248, 253, .98), rgba(245, 248, 253, .94));
  box-shadow: 0 8px 18px rgba(33, 47, 78, .05);
  -webkit-backdrop-filter: blur(10px) saturate(112%);
  backdrop-filter: blur(10px) saturate(112%);
}

body:not(.embed) .erp-page-action-bar .actions,
body:not(.embed) .erp-page-action-bar .toolbar,
body:not(.embed) .erp-page-action-bar .mode-tabs,
body:not(.embed) .erp-page-action-bar .erp-page-actions {
  max-width: 100%;
  margin: 0 !important;
  padding: 5px;
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px !important;
  width: auto !important;
  border: 1px solid rgba(205, 216, 233, .88);
  border-radius: 14px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 8px 20px rgba(28, 45, 78, .06);
}

body:not(.embed) .erp-page-action-bar::before {
  content: none;
}

body:not(.embed) .erp-page-action-bar .primary {
  order: 10;
}

body:not(.embed) .erp-page-action-bar .ghost,
body:not(.embed) .erp-page-action-bar .btn:not(.primary),
body:not(.embed) .erp-page-action-bar .mini,
body:not(.embed) .erp-page-action-bar .mode-tab {
  order: 20;
}

body:not(.embed) .erp-page-action-bar:empty {
  display: none !important;
}

body:not(.embed) .erp-page-action-bar[hidden] {
  display: none !important;
}

body:not(.embed) .erp-page-action-bar:not(:has(button, a, input, select)) {
  display: none !important;
}

body:not(.embed) .main > .stats:empty,
body:not(.embed) .main > .panel:empty,
body:not(.embed) .main > .config-check:empty {
  display: none !important;
}

.erp-kpi-strip {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)) !important;
  gap: 12px !important;
}

.erp-kpi-card {
  position: relative;
  min-height: 108px;
  padding: 18px !important;
  display: grid !important;
  align-content: center;
  gap: 5px !important;
  overflow: hidden;
  border: 1px solid var(--erp-line) !important;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: var(--erp-shadow-soft);
}

.erp-kpi-card .label {
  color: #667087 !important;
  font-size: 12px !important;
}

.erp-kpi-card > span:first-child:not(.erp-kpi-icon) {
  color: #77839a !important;
  font-size: 12px !important;
  font-weight: 650 !important;
}

.erp-kpi-card .value {
  margin-top: 2px !important;
  color: #18213a;
  font-size: 25px !important;
  font-weight: 760 !important;
}

.erp-kpi-card > strong {
  display: block;
  margin-top: 6px;
  color: #172033 !important;
  font-size: 24px !important;
  line-height: 1.15 !important;
  font-weight: 780 !important;
  letter-spacing: -0.03em;
}

.erp-kpi-icon {
  position: absolute;
  top: 50%;
  right: 18px;
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 22px;
  transform: translateY(-50%);
}

.erp-kpi-icon-1 { background: #eaf0ff; color: #3567f6; }
.erp-kpi-icon-2 { background: #e5faf7; color: #11a994; }
.erp-kpi-icon-3 { background: #fff3df; color: #ed941b; }
.erp-kpi-icon-4 { background: #eeeaff; color: #755ce6; }

.erp-sidebar-note {
  display: none !important;
}

body:not(.embed) .header p,
body:not(.embed) .tiny,
body:not(.embed) .hint,
body:not(.embed) .muted {
  color: var(--erp-muted) !important;
}

body:not(.embed) button,
body:not(.embed) input,
body:not(.embed) select,
body:not(.embed) textarea {
  font-family: inherit;
}

body:not(.embed) button:focus-visible,
body:not(.embed) a:focus-visible,
body:not(.embed) input:focus-visible,
body:not(.embed) select:focus-visible,
body:not(.embed) textarea:focus-visible {
  outline: 3px solid rgba(53, 103, 246, 0.2);
  outline-offset: 2px;
}

body:not(.embed) .primary,
body:not(.embed) .btn.primary,
body:not(.embed) a.primary,
body:not(.embed) button.primary {
  border-color: var(--erp-primary) !important;
  background: var(--erp-primary) !important;
  color: #fff !important;
  box-shadow: 0 5px 12px rgba(22, 93, 255, 0.24);
}

body:not(.embed) .primary:hover,
body:not(.embed) .btn.primary:hover,
body:not(.embed) a.primary:hover,
body:not(.embed) button.primary:hover {
  border-color: var(--erp-primary-strong) !important;
  background: var(--erp-primary-strong) !important;
}

body:not(.embed) .ghost,
body:not(.embed) .btn,
body:not(.embed) .mini {
  border-color: #c9d2e1 !important;
  background: #fff !important;
  color: #334057 !important;
  box-shadow: 0 1px 2px rgba(30, 45, 74, .04);
}

body:not(.embed) .ghost:hover,
body:not(.embed) .btn:hover,
body:not(.embed) .mini:hover {
  border-color: #82a4ff !important;
  background: #f4f7ff !important;
  color: var(--erp-primary-strong) !important;
}

body:not(.embed) .danger,
body:not(.embed) .btn.danger,
body:not(.embed) button.danger {
  border-color: #fecaca !important;
  background: #fff7f7 !important;
  color: #b4232d !important;
}

body:not(.embed) .danger:hover,
body:not(.embed) .btn.danger:hover,
body:not(.embed) button.danger:hover {
  border-color: #f59aa1 !important;
  background: #fff0f1 !important;
  color: #9f1d27 !important;
}

body:not(.embed) input,
body:not(.embed) select,
body:not(.embed) textarea {
  border-color: var(--erp-line-strong) !important;
}

/* Shared business form system */
body:not(.embed) .form-grid,
body:not(.embed) .form,
body:not(.embed) .form2,
body:not(.embed) .manual-grid,
body:not(.embed) .import-grid,
body:not(.embed) .filters {
  column-gap: 16px !important;
  row-gap: 14px !important;
}

body:not(.embed) .field {
  min-width: 0;
  gap: 7px !important;
}

body:not(.embed) .field > label,
body:not(.embed) .field > .label {
  color: #63708a !important;
  font-size: 12px !important;
  line-height: 1.35;
  font-weight: 620;
}

body:not(.embed) .field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
body:not(.embed) .field select,
body:not(.embed) .actions input,
body:not(.embed) .filters input,
body:not(.embed) .filters select {
  width: 100%;
  height: 42px;
  min-height: 42px;
  padding: 0 12px !important;
  border: 1px solid var(--erp-line-strong) !important;
  border-radius: 8px !important;
  background-color: #fff !important;
  color: var(--erp-text) !important;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: none !important;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

body:not(.embed) .field select,
body:not(.embed) .filters select {
  display: block;
  min-width: 0;
  padding-right: 34px !important;
  line-height: normal;
  text-overflow: ellipsis;
  vertical-align: middle;
}

body:not(.embed) select option {
  min-height: 32px;
  padding: 7px 10px;
  background: #fff;
  color: var(--erp-text);
  line-height: 1.45;
}

body:not(.embed) select.erp-select-native {
  position: absolute !important;
  width: 1px !important;
  min-width: 1px !important;
  height: 1px !important;
  min-height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.erp-select-control {
  position: relative;
  width: 100%;
  min-width: 0;
}

.erp-select-control[hidden] {
  display: none !important;
}

.erp-select-control {
  display: block;
}

body:not(.embed) .erp-select-input {
  width: 100%;
  height: 42px;
  min-height: 42px;
  min-width: 0;
  padding: 0 10px 0 12px !important;
  border: 1px solid var(--erp-line-strong) !important;
  border-radius: 8px !important;
  background: #fff !important;
  color: var(--erp-text) !important;
  box-shadow: none !important;
  font-size: 13px;
  font-weight: 400;
  text-align: left;
}

body:not(.embed) .erp-select-input:hover {
  border-color: #9bb5f8 !important;
  background: #fff !important;
}

body:not(.embed) .erp-select-input:focus,
body:not(.embed) .erp-select-input[aria-expanded="true"] {
  border-color: #6f98ff !important;
  outline: none;
  box-shadow: 0 0 0 3px rgba(22, 93, 255, .11) !important;
}

body:not(.embed) .erp-select-input:disabled {
  border-color: #e5e9f0 !important;
  background: #f6f7fa !important;
  color: #98a1b2 !important;
  cursor: not-allowed;
}

.erp-select-menu {
  position: fixed;
  z-index: 280;
  padding: 5px;
  overflow: auto;
  border: 1px solid #cfd7e5;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(24, 38, 65, .18);
  scrollbar-width: thin;
}

.erp-select-option {
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  display: block;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: #fff;
  color: #303c52;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.35;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.erp-select-search {
  width: calc(100% - 12px);
  margin: 6px;
  padding: 8px 10px;
  border: 1px solid var(--erp-line);
  border-radius: 7px;
  background: #fff;
  color: var(--erp-text);
}

.erp-select-option:hover,
.erp-select-option:focus {
  outline: none;
  background: #f1f5ff;
  color: var(--erp-primary-strong);
}

.erp-select-option[aria-selected="true"] {
  background: var(--erp-primary);
  color: #fff;
}

.erp-select-option:disabled {
  color: #a0a8b7;
  background: #f8f9fb;
  cursor: not-allowed;
}

.erp-session-tabs {
  position: sticky;
  top: var(--erp-topbar-height, 64px);
  z-index: 50;
  min-width: 0;
  min-height: 42px;
  margin-top: 0;
  padding: 7px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--erp-line);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 18px rgba(35, 52, 86, 0.04);
}

body.embed .erp-session-tabs {
  display: none !important;
}

.erp-session-tabs-list {
  min-width: 0;
  padding-bottom: 1px;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
}

.erp-session-tabs-toggle {
  display: none;
}

.erp-session-tabs-list::-webkit-scrollbar {
  display: none;
}

.erp-session-tab {
  min-width: 108px;
  max-width: 196px;
  height: 30px;
  display: inline-grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--erp-muted);
  cursor: grab;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.erp-session-tab:hover {
  border-color: var(--erp-line);
  background: var(--erp-surface);
  color: var(--erp-text-soft);
}

.erp-session-tab.dragging {
  opacity: .58;
  cursor: grabbing;
}

.erp-session-tab.drag-over {
  border-color: var(--erp-primary);
  box-shadow: 0 0 0 2px rgba(53, 103, 246, .12);
}

.erp-session-tab.active {
  border-color: #d7e1ff;
  background: var(--erp-primary-soft);
  color: var(--erp-primary-strong);
  font-weight: 700;
}

.erp-session-tab-link {
  min-width: 0;
  padding: 0 5px 0 10px;
  overflow: hidden;
  color: inherit;
  font-size: 12px;
  line-height: 28px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.erp-session-tab-close {
  width: 24px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font-size: 15px;
  line-height: 1;
  opacity: .72;
}

.erp-session-tab-close:hover {
  background: rgba(53, 103, 246, .09);
  opacity: 1;
}

.erp-session-tabs-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.erp-session-tabs-actions button {
  min-height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--erp-muted);
  font-size: 11px;
  white-space: nowrap;
}

.erp-session-tabs-actions button:hover {
  background: var(--erp-surface);
  color: var(--erp-primary);
}

body.erp-modal-open:not(.embed) .erp-topbar,
body.erp-modal-open:not(.embed) .erp-session-tabs {
  position: relative;
  z-index: 3200;
  pointer-events: auto;
}

body.erp-modal-open:not(.embed) .erp-session-tabs {
  margin-left: -22px;
  margin-right: -22px;
  padding-left: 22px;
  padding-right: 22px;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
}

.erp-modal-minimize-btn {
  margin-left: auto;
}

.erp-modal-minimize-btn + button {
  margin-left: 8px;
}

.erp-modal-dock {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 3600;
  display: grid;
  gap: 8px;
  width: min(320px, calc(100vw - 36px));
  pointer-events: none;
}

.erp-modal-dock[hidden] {
  display: none;
}

.erp-modal-dock-item {
  width: 100%;
  min-height: 52px;
  padding: 9px 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid #c8d7ff;
  border-radius: 10px;
  background: #fff;
  color: var(--erp-text);
  box-shadow: 0 16px 36px rgba(15, 23, 42, .18);
  cursor: pointer;
  pointer-events: auto;
}

.erp-modal-dock-item span {
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--erp-primary-soft);
  color: var(--erp-primary-strong);
  font-size: 12px;
  font-weight: 700;
}

.erp-modal-dock-item strong {
  overflow: hidden;
  font-size: 13px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body:not(.embed) .field input[type="file"] {
  min-height: 42px;
  padding: 7px 10px !important;
  border: 1px dashed #cbd4e3 !important;
  border-radius: 8px !important;
  background: #fafcff !important;
}

body:not(.embed) .field .erp-file-upload {
  width: 100%;
  min-width: 0;
}

body:not(.embed) .field .erp-file-upload > input[type="file"],
body:not(.embed) .erp-file-upload > input[type="file"] {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-width: 1px !important;
  min-height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  white-space: nowrap !important;
}

body:not(.embed) .field .erp-file-drop {
  min-height: 68px;
}

body:not(.embed) .field textarea {
  width: 100%;
  min-height: 96px;
  padding: 11px 12px !important;
  border: 1px solid var(--erp-line-strong) !important;
  border-radius: 8px !important;
  background: #fff !important;
  color: var(--erp-text) !important;
  font-size: 13px;
  line-height: 1.55;
  box-shadow: none !important;
  resize: vertical;
}

body:not(.embed) .field input:not([type="checkbox"]):not([type="radio"]):focus,
body:not(.embed) .field select:focus,
body:not(.embed) .field textarea:focus {
  border-color: #6f98ff !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(22, 93, 255, .11) !important;
}

body:not(.embed) .field input:disabled,
body:not(.embed) .field select:disabled,
body:not(.embed) .field textarea:disabled,
body:not(.embed) .field input[readonly] {
  border-color: #e5e9f0 !important;
  background: #f6f7fa !important;
  color: #98a1b2 !important;
}

body:not(.embed) .hint,
body:not(.embed) .subhint,
body:not(.embed) .tiny {
  color: var(--erp-muted) !important;
  font-size: 11.5px !important;
  line-height: 1.55 !important;
}

body:not(.embed) .erp-form-section-title {
  grid-column: 1 / -1;
  margin: 8px -2px 0;
  padding: 13px 14px 11px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid var(--erp-line);
  color: #25334e;
  font-size: 14px;
  font-weight: 720;
}

body:not(.embed) .erp-form-section-title:first-child {
  margin-top: -4px;
}

body:not(.embed) .erp-form-section-title i {
  color: var(--erp-primary);
  font-size: 17px;
}

body:not(.embed) .erp-purpose-path {
  margin-top: 2px;
  padding: 10px 12px;
  border: 1px solid #dce7ff;
  border-radius: 8px;
  background: #f6f9ff;
  color: #49617f;
  font-size: 12px;
  line-height: 1.5;
}

body:not(.embed) .checks,
body:not(.embed) .check-row {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
}

body:not(.embed) .checks label,
body:not(.embed) label.check-pill,
body:not(.embed) .check-row label {
  width: auto !important;
  min-width: 116px;
  min-height: 40px;
  padding: 0 12px !important;
  display: inline-flex !important;
  flex: 0 0 auto !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  border: 1px solid var(--erp-line-strong) !important;
  border-radius: 8px !important;
  background: #fff !important;
  color: var(--erp-text-soft) !important;
  font-size: 12px !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

body:not(.embed) .checks label:hover,
body:not(.embed) label.check-pill:hover,
body:not(.embed) .check-row label:hover {
  border-color: #9ab7ff !important;
  background: #f8fbff !important;
}

body:not(.embed) .checks label:has(input:checked),
body:not(.embed) label.check-pill:has(input:checked),
body:not(.embed) .check-row label:has(input:checked) {
  border-color: #6d96ff !important;
  background: var(--erp-primary-soft) !important;
  color: var(--erp-primary-strong) !important;
  box-shadow: inset 0 0 0 1px rgba(22, 93, 255, .05);
}

body:not(.embed) .checks input[type="checkbox"],
body:not(.embed) label.check-pill input[type="checkbox"],
body:not(.embed) .check-row input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  margin: 0 !important;
  padding: 0 !important;
  accent-color: var(--erp-primary);
}

body:not(.embed) .preview {
  gap: 10px !important;
}

body:not(.embed) .preview-box,
body:not(.embed) .note,
body:not(.embed) .guard-card,
body:not(.embed) .order-preview {
  padding: 12px 13px !important;
  border: 1px solid #e3e8f1 !important;
  border-radius: 8px !important;
  background: #f8fafc !important;
  box-shadow: none !important;
}

body:not(.embed) .preview-box:nth-child(1) {
  border-left: 3px solid var(--erp-primary) !important;
  background: #f6f9ff !important;
}

body:not(.embed) .preview-box:nth-child(2) {
  border-left: 3px solid var(--erp-warning) !important;
  background: #fffaf2 !important;
}

body:not(.embed) .preview-box:nth-child(3) {
  border-left: 3px solid var(--erp-cyan) !important;
  background: #f3fbfd !important;
}

body:not(.embed) .grid > .panel:last-child .preview {
  position: sticky;
  top: 82px;
}

body:not(.embed) .panel > h3 {
  margin-bottom: 16px !important;
  color: #26334b;
  font-size: 16px !important;
  font-weight: 720;
}

body:not(.embed) .primary,
body:not(.embed) .ghost,
body:not(.embed) .danger,
body:not(.embed) .btn,
body:not(.embed) .mini,
body:not(.embed) button.mini {
  min-height: 38px;
  padding: 8px 14px !important;
  border-radius: 8px !important;
  font-size: 13px;
  font-weight: 620;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none !important;
  cursor: pointer;
}

/* Shared modal contract. Legacy pages may keep their old class names for
   page-specific sizing, but only these explicit classes control the overlay. */
body.erp-modal-open {
  overflow: hidden !important;
}

body:not(.embed) .erp-modal-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 140 !important;
  padding: 24px !important;
  overflow: auto !important;
  background: rgba(20, 31, 52, .42) !important;
  overscroll-behavior: contain;
}

body:not(.embed) .erp-modal-backdrop.show {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

body:not(.embed) .erp-modal-dialog {
  width: min(920px, calc(100vw - 48px)) !important;
  max-width: calc(100vw - 48px) !important;
  max-height: calc(100vh - 48px) !important;
  margin: auto !important;
  overflow: auto !important;
  overscroll-behavior: contain;
  border: 1px solid var(--erp-line-strong) !important;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: 0 24px 70px rgba(18, 29, 50, .24) !important;
}

body:not(.embed) .erp-modal-dialog .dialog-actions,
body:not(.embed) .erp-modal-dialog .modal-actions {
  position: sticky;
  bottom: -18px;
  z-index: 4;
  margin-top: 16px !important;
  padding: 12px 0 0;
  border-top: 1px solid var(--erp-line);
  background: #fff;
}

body:not(.embed) .erp-modal-dialog .dialog-actions .primary,
body:not(.embed) .erp-modal-dialog .modal-actions .primary {
  min-width: 72px;
}

@media (max-width: 767px) {
  body:not(.embed) .erp-modal-backdrop {
    padding: 0 !important;
    align-items: flex-end !important;
  }

  body:not(.embed) .erp-modal-dialog {
    width: 100% !important;
    max-width: 100% !important;
    max-height: min(92dvh, 920px) !important;
    margin: auto 0 0 !important;
    border-radius: 16px 16px 0 0 !important;
  }

  body:not(.embed) .erp-modal-dialog .form-grid,
  body:not(.embed) .erp-modal-dialog .modal-form,
  body:not(.embed) .erp-modal-dialog .form2 {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body:not(.embed) .erp-modal-dialog .dialog-actions,
  body:not(.embed) .erp-modal-dialog .modal-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    bottom: -18px;
  }

  body:not(.embed) .erp-modal-dialog .dialog-actions > button,
  body:not(.embed) .erp-modal-dialog .modal-actions > button {
    width: 100%;
    min-height: 44px;
  }

  .erp-modal-dock {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }
}

body:not(.embed) .badge,
body:not(.embed) .status,
body:not(.embed) .chip {
  border-radius: 6px !important;
  font-weight: 620;
}

body:not(.embed) .table-wrap {
  border-color: var(--erp-line) !important;
  border-radius: 8px !important;
}

body:not(.embed) th {
  height: 42px;
  padding-top: 9px !important;
  padding-bottom: 9px !important;
  background: #f7f9fc !important;
}

body:not(.embed) td {
  border-color: #edf0f5 !important;
}

body:not(.embed) table {
  color: var(--erp-text-soft);
}

body:not(.embed) th {
  color: var(--erp-muted);
  font-weight: 650;
}

/* Shared module polish for newly added ERP pages */
body:not(.embed) .main > .stats,
body:not(.embed) .panel > .stats,
body:not(.embed) .stats:not(.erp-user-stats):not(.erp-kpi-strip) {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)) !important;
  gap: 12px !important;
  align-items: stretch !important;
}

body:not(.embed) .stats:not(.erp-user-stats):not(.erp-kpi-strip) .stat {
  position: relative;
  min-height: 86px;
  padding: 15px 16px !important;
  display: grid !important;
  align-content: center;
  gap: 7px !important;
  overflow: hidden;
  border: 1px solid var(--erp-line) !important;
  border-radius: 12px !important;
  background:
    radial-gradient(circle at right 20px top 18px, rgba(22, 93, 255, .10), transparent 36px),
    #fff !important;
  box-shadow: 0 6px 18px rgba(35, 52, 86, .05) !important;
}

body:not(.embed) .stats:not(.erp-user-stats):not(.erp-kpi-strip) .stat::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(22, 93, 255, .86), rgba(0, 174, 202, .68));
  opacity: .72;
}

body:not(.embed) .stat .label,
body:not(.embed) .stat label {
  color: var(--erp-muted) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
}

body:not(.embed) .stat .value {
  color: var(--erp-text) !important;
  font-size: 24px !important;
  line-height: 1.15 !important;
  font-weight: 780 !important;
  letter-spacing: -0.03em;
}

body:not(.embed) .tabs {
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px !important;
  align-items: center;
  padding: 4px !important;
  border: 1px solid rgba(216, 222, 234, .82) !important;
  border-radius: 12px !important;
  background: rgba(247, 249, 252, .72) !important;
}

body:not(.embed) .tab {
  min-height: 36px !important;
  padding: 8px 13px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent !important;
  border-radius: 9px !important;
  background: transparent !important;
  color: var(--erp-text-soft) !important;
  font-size: 13px !important;
  font-weight: 650 !important;
  text-decoration: none !important;
  cursor: pointer;
}

body:not(.embed) .tab:hover {
  border-color: #c9d7ff !important;
  background: #fff !important;
  color: var(--erp-primary) !important;
}

body:not(.embed) .tab.active,
body:not(.embed) .tab[aria-selected="true"] {
  border-color: rgba(22, 93, 255, .18) !important;
  background: var(--erp-primary-soft) !important;
  color: var(--erp-primary) !important;
  box-shadow: 0 4px 12px rgba(22, 93, 255, .09);
}

body:not(.embed) .section-head,
body:not(.embed) .panel-title,
body:not(.embed) .subhead,
body:not(.embed) .modal-head {
  color: var(--erp-text) !important;
}

body:not(.embed) .section-head,
body:not(.embed) .panel-title,
body:not(.embed) .subhead {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px !important;
  border-bottom: 1px solid var(--erp-line) !important;
  font-size: 16px !important;
  font-weight: 740 !important;
}

body:not(.embed) .work,
body:not(.embed) .workbench,
body:not(.embed) .grid,
body:not(.embed) .section-grid,
body:not(.embed) .process-grid,
body:not(.embed) .flow-grid,
body:not(.embed) .submit-grid {
  gap: 14px !important;
}

body:not(.embed) .section-card,
body:not(.embed) .flow-card,
body:not(.embed) .process-card,
body:not(.embed) .trace-card,
body:not(.embed) .candidate-card,
body:not(.embed) .order-card,
body:not(.embed) .card,
body:not(.embed) .record,
body:not(.embed) .review-row,
body:not(.embed) .payroll-row,
body:not(.embed) .net-row,
body:not(.embed) .ledger-row,
body:not(.embed) .manual-row,
body:not(.embed) .batch,
body:not(.embed) .item,
body:not(.embed) .linked-item,
body:not(.embed) .online-row,
body:not(.embed) .mapping-card {
  border: 1px solid var(--erp-line) !important;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: 0 4px 14px rgba(31, 45, 75, .045) !important;
}

body:not(.embed) .section-card:hover,
body:not(.embed) .flow-card:hover,
body:not(.embed) .candidate-card:hover,
body:not(.embed) .order-card:hover,
body:not(.embed) .card:hover,
body:not(.embed) .batch:hover {
  border-color: #c8d6ff !important;
  box-shadow: 0 8px 22px rgba(22, 93, 255, .075) !important;
}

body:not(.embed) .selected,
body:not(.embed) .active.batch,
body:not(.embed) .flow-card.selected,
body:not(.embed) .candidate-card.selected,
body:not(.embed) .order-card.selected,
body:not(.embed) .card.selected {
  border-color: rgba(22, 93, 255, .42) !important;
  background: linear-gradient(180deg, #fff, #f7faff) !important;
  box-shadow: 0 0 0 3px rgba(22, 93, 255, .08) !important;
}

body:not(.embed) .empty,
body:not(.embed) .notice,
body:not(.embed) .info,
body:not(.embed) .scope-note,
body:not(.embed) .section-note,
body:not(.embed) .result-box,
body:not(.embed) .import-result {
  border: 1px solid #dbe5f5 !important;
  border-radius: 10px !important;
  background: #f7faff !important;
  color: #61708a !important;
}

body:not(.embed) .badge.good,
body:not(.embed) .status.good,
body:not(.embed) .good.badge {
  background: #eaf8f2 !important;
  color: #087c5a !important;
}

body:not(.embed) .badge.warn,
body:not(.embed) .status.warn,
body:not(.embed) .warn.badge {
  background: #fff4df !important;
  color: #9a5b00 !important;
}

body:not(.embed) .badge.bad,
body:not(.embed) .status.bad,
body:not(.embed) .bad.badge {
  background: #fff0f1 !important;
  color: #ba2530 !important;
}

body:not(.embed) .table-wrap,
body:not(.embed) .list-scroll {
  max-width: 100%;
  overflow: auto;
  background: #fff !important;
  scrollbar-width: thin;
  scrollbar-color: #dce2ef transparent;
}

body:not(.embed) .table-wrap table {
  min-width: 720px;
}

body:not(.embed) .money,
body:not(.embed) .online-money,
body:not(.embed) .flow-amount {
  color: var(--erp-text) !important;
  font-variant-numeric: tabular-nums;
  font-weight: 740 !important;
}

body:not(.embed) .meta,
body:not(.embed) .sub,
body:not(.embed) .tiny,
body:not(.embed) .mini {
  color: var(--erp-muted) !important;
}

/* ERP product-system v2: page templates, states and flow polish */
body:not(.embed) .main > .header + .panel,
body:not(.embed) .main > .header + .stats,
body:not(.embed) .main > .erp-kpi-strip {
  margin-top: -2px;
}

body:not(.embed) .header .actions,
body:not(.embed) .panel .actions,
body:not(.embed) .section-head .actions {
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px !important;
  align-items: center;
  justify-content: flex-end;
}

body:not(.embed) .filters {
  width: 100%;
  max-width: 100%;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
  padding: 14px !important;
  border: 1px solid var(--erp-line) !important;
  border-radius: 12px !important;
  background: #fff !important;
}

body:not(.embed) .main,
body:not(.embed) .panel,
body:not(.embed) .mode-section,
body:not(.embed) .erp-page-action-bar,
body:not(.embed) .erp-kpi-strip,
body:not(.embed) .stats {
  min-width: 0 !important;
}

body:not(.embed) .main > *,
body:not(.embed) .mode-section > *,
body:not(.embed) .panel > * {
  max-width: 100%;
}

body:not(.embed) .filters::before {
  content: "筛选";
  grid-column: 1 / -1;
  color: var(--erp-text);
  font-size: 14px;
  font-weight: 760;
}

body:not(.embed) .filters:has(> .field:first-child)::before {
  margin-bottom: -2px;
}

body:not(.embed) .filters.monthly-filter-row::before {
  display: none;
}

body:not(.embed) .filters.monthly-filter-row {
  padding-top: 0;
}

body[data-page="monthlySettlements"] .legacy-close-detail {
  display: none;
}

body[data-page="monthlySettlements"].business-focus .legacy-close-detail.business-checks {
  display: block;
}

body:not(.embed) .filters .erp-filter-toggle {
  align-self: end;
  min-height: 42px;
  gap: 6px;
  border: 1px solid var(--erp-line-strong) !important;
  border-radius: 8px !important;
  background: #fff !important;
  color: var(--erp-text) !important;
  box-shadow: none !important;
  font-weight: 500;
}

body:not(.embed) .filters .erp-filter-toggle:hover,
body:not(.embed) .filters .erp-filter-toggle:focus-visible {
  border-color: #6f98ff !important;
  background: #fff !important;
  box-shadow: 0 0 0 3px rgba(22, 93, 255, .10) !important;
}

body:not(.embed) .filters .erp-filter-toggle span {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--erp-primary-soft);
  color: var(--erp-primary);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body:not(.embed) .erp-filter-advanced-field[hidden] {
  display: none !important;
}

body:not(.embed) .erp-filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--erp-line);
}

body:not(.embed) .erp-filter-chips[hidden] {
  display: none !important;
}

body:not(.embed) .erp-filter-chip,
body:not(.embed) .erp-filter-clear {
  min-height: 30px;
  border-radius: 999px;
  border: 1px solid #cfe0ff;
  background: rgba(239, 246, 255, .9);
  color: var(--erp-primary);
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  box-shadow: none;
}

body:not(.embed) .erp-filter-chip:hover,
body:not(.embed) .erp-filter-clear:hover {
  border-color: #9db8f9;
  background: #eaf2ff;
}

body:not(.embed) .erp-filter-clear {
  border-color: transparent;
  background: transparent;
  color: var(--erp-muted);
}

body:not(.embed) .erp-filter-clear:hover {
  background: var(--erp-surface-tint);
  color: var(--erp-primary);
}

.erp-risk-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, .32);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.erp-risk-backdrop[hidden] {
  display: none !important;
}

.erp-risk-dialog {
  width: min(520px, 100%);
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(255, 180, 76, .38);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .98), rgba(255, 250, 242, .96));
  box-shadow: 0 24px 70px rgba(15, 23, 42, .22);
}

.erp-risk-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff2d8;
  color: #d97706;
  font-size: 26px;
}

.erp-risk-kicker {
  margin: 0 0 4px;
  color: #b45309;
  font-size: 12px;
  font-weight: 760;
}

.erp-risk-dialog h3 {
  margin: 0;
  color: var(--erp-text);
  font-size: 18px;
}

.erp-risk-dialog p {
  margin: 8px 0 0;
  color: var(--erp-text-soft);
  line-height: 1.6;
}

.erp-risk-note {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed #f0c982;
  border-radius: 10px;
  background: rgba(255, 251, 235, .75);
  color: #7c5b19;
  font-size: 13px;
  line-height: 1.55;
}

.erp-risk-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

body.erp-risk-open {
  overflow: hidden;
}

.erp-confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, .34);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.erp-confirm-backdrop[hidden] {
  display: none !important;
}

.erp-confirm-dialog {
  width: min(560px, calc(100vw - 48px));
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 16px;
  padding: 22px;
  border: 1px solid rgba(190, 205, 232, .9);
  border-radius: 18px;
  background:
    radial-gradient(circle at 42px 42px, rgba(22, 93, 255, .08), transparent 120px),
    linear-gradient(145deg, rgba(255, 255, 255, .98), rgba(248, 251, 255, .96));
  box-shadow: 0 28px 80px rgba(15, 23, 42, .22);
}

.erp-confirm-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: var(--erp-primary);
  background: linear-gradient(135deg, rgba(22, 93, 255, .12), rgba(45, 212, 191, .10));
  font-size: 24px;
}

.erp-confirm-kicker {
  margin: 0 0 4px !important;
  color: #51617d !important;
  font-size: 12px !important;
  font-weight: 800;
}

.erp-confirm-dialog h3 {
  margin: 0 !important;
  color: #14213d;
  font-size: 20px !important;
  line-height: 1.35;
}

.erp-confirm-details {
  margin-top: 14px;
  display: grid;
  overflow: hidden;
  border: 1px solid #dbe7fb;
  border-radius: 14px;
  background: rgba(247, 251, 255, .86);
}

.erp-confirm-row {
  min-height: 38px;
  padding: 9px 12px;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid #e5eefb;
}

.erp-confirm-row:last-child {
  border-bottom: 0;
}

.erp-confirm-row span {
  color: #64748b;
  font-size: 12px;
}

.erp-confirm-row strong {
  min-width: 0;
  color: #16213a;
  font-size: 13px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.erp-confirm-note {
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px dashed #cbdaf5;
  border-radius: 12px;
  background: rgba(255, 255, 255, .72);
}

.erp-confirm-note p {
  margin: 0 !important;
  color: #52627e !important;
  font-size: 13px !important;
  line-height: 1.7 !important;
}

.erp-confirm-note p + p {
  margin-top: 6px !important;
}

.erp-confirm-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

body.erp-confirm-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .erp-confirm-dialog {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .erp-confirm-row {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .erp-confirm-actions {
    flex-direction: column-reverse;
  }

  .erp-confirm-actions > button {
    width: 100%;
  }
}

body:not(.embed) .erp-feedback {
  position: relative;
  border-radius: 12px !important;
  border: 1px solid var(--erp-line) !important;
  padding: 11px 14px 11px 40px !important;
  line-height: 1.55;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .055);
}

body:not(.embed) .erp-feedback::before {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: "remixicon";
  font-size: 18px;
}

body:not(.embed) .erp-feedback[data-feedback-tone="ok"] {
  border-color: #bcebd8 !important;
  background: #f0fdf7 !important;
  color: #14533b !important;
}

body:not(.embed) .erp-feedback[data-feedback-tone="ok"]::before {
  content: "\eb80";
  color: var(--erp-success);
}

body:not(.embed) .erp-feedback[data-feedback-tone="info"] {
  border-color: #cfe0ff !important;
  background: #f2f7ff !important;
  color: #1d3d76 !important;
}

body:not(.embed) .erp-feedback[data-feedback-tone="info"]::before {
  content: "\ee59";
  color: var(--erp-primary);
}

body:not(.embed) .erp-feedback[data-feedback-tone="warn"] {
  border-color: #f2d391 !important;
  background: #fffbeb !important;
  color: #7c4c04 !important;
}

body:not(.embed) .erp-feedback[data-feedback-tone="warn"]::before {
  content: "\eca0";
  color: var(--erp-warning);
}

body:not(.embed) .erp-feedback[data-feedback-tone="bad"] {
  border-color: #fecaca !important;
  background: #fff1f2 !important;
  color: #7f1d1d !important;
}

body:not(.embed) .erp-feedback[data-feedback-tone="bad"]::before {
  content: "\eb99";
  color: var(--erp-danger);
}

.erp-global-feedback {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 2300;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 36px));
  pointer-events: none;
}

.erp-global-feedback-item {
  pointer-events: auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding-left: 14px !important;
}

.erp-global-feedback-item::before {
  content: none !important;
}

.erp-global-feedback-item i {
  font-size: 18px;
}

.erp-global-feedback-item a {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

body:not(.embed) .erp-import-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 14px 0;
  border: 1px solid var(--erp-line);
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(180deg, #fff, #f8fbff);
}

body:not(.embed) .erp-import-step {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 8px;
  row-gap: 3px;
  padding: 13px 14px;
  border-right: 1px solid var(--erp-line);
}

body:not(.embed) .erp-import-step:last-child {
  border-right: 0;
}

body:not(.embed) .erp-import-step span {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--erp-primary-soft);
  color: var(--erp-primary);
  font-size: 12px;
  font-weight: 800;
}

body:not(.embed) .erp-import-step strong {
  align-self: center;
  color: var(--erp-text);
  font-size: 13px;
}

body:not(.embed) .erp-import-step em {
  grid-column: 2;
  color: var(--erp-muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.5;
}

body:not(.embed) .field.required > label::after,
body:not(.embed) label.required::after,
body:not(.embed) .required > .label::after,
body:not(.embed) .field.required > span:first-child::after {
  content: " *";
  color: var(--erp-danger);
  font-size: 14px;
  font-weight: 700;
}

body:not(.embed) input[aria-invalid="true"],
body:not(.embed) select[aria-invalid="true"],
body:not(.embed) textarea[aria-invalid="true"],
body:not(.embed) .is-error input,
body:not(.embed) .is-error select,
body:not(.embed) .is-error textarea {
  border-color: #f2a3a8 !important;
  background: #fff8f8 !important;
  box-shadow: 0 0 0 3px rgba(239, 69, 79, .10) !important;
}

body:not(.embed) .error,
body:not(.embed) .field-error {
  color: #ba2530 !important;
  font-size: 12px !important;
  line-height: 1.45;
}

body:not(.embed) .loading,
body:not(.embed) .skeleton,
body:not(.embed) [data-loading="true"] {
  position: relative;
  overflow: hidden;
  color: transparent !important;
  background: #f2f6fc !important;
  border-radius: 8px !important;
}

body.dashboard-page:not(.embed) .dashboard-status.loading {
  color: inherit !important;
  background: #eef4ff !important;
  border-radius: 10px !important;
}

body.dashboard-page:not(.embed) .dashboard-status.loading::after {
  display: none !important;
}

body:not(.embed) .loading::after,
body:not(.embed) .skeleton::after,
body:not(.embed) [data-loading="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .75), transparent);
  transform: translateX(-100%);
  animation: erp-skeleton 1.2s infinite;
}

@keyframes erp-skeleton {
  to { transform: translateX(100%); }
}

body:not(.embed) .empty {
  min-height: 88px;
  padding: 18px !important;
  display: grid !important;
  align-content: center;
  gap: 10px;
  text-align: left;
}

body:not(.embed) table td.empty,
body:not(.embed) table th.empty,
body:not(.embed) table .empty {
  min-height: 0 !important;
  padding: 18px 12px !important;
  display: table-cell !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #718096 !important;
  text-align: center !important;
}

body:not(.embed) table td.empty > .erp-table-empty-state,
body:not(.embed) table td[colspan] > .erp-table-empty-state,
body:not(.embed) table th.empty > .erp-table-empty-state,
body:not(.embed) table th[colspan] > .erp-table-empty-state,
body:not(.embed) table td[colspan] > .empty.erp-table-empty-state {
  position: sticky !important;
  left: 0 !important;
  width: var(--erp-empty-visible-width, 100%) !important;
  max-width: var(--erp-empty-visible-width, 100%) !important;
  min-height: 128px !important;
  margin: 0 !important;
  padding: 24px 18px !important;
  display: grid !important;
  place-items: center !important;
  justify-content: center !important;
  align-content: center !important;
  gap: 10px !important;
  box-sizing: border-box !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #63728a !important;
  text-align: center !important;
}

body:not(.embed) table td.empty > .erp-table-empty-state .empty-actions,
body:not(.embed) table td[colspan] > .erp-table-empty-state .empty-actions,
body:not(.embed) table th.empty > .erp-table-empty-state .empty-actions,
body:not(.embed) table th[colspan] > .erp-table-empty-state .empty-actions {
  justify-content: center !important;
}

body.dashboard-page:not(.embed) .dashboard-empty {
  min-height: 0 !important;
  padding: 28px 10px !important;
  display: block !important;
  border: 0 !important;
  background: transparent !important;
  text-align: center !important;
}

body.dashboard-page:not(.embed) .chart-wrap,
body.dashboard-page:not(.embed) #trendChart {
  max-width: 100%;
  overflow: hidden;
}

body.dashboard-page:not(.embed) #trendChart.erp-chart {
  height: 190px !important;
  min-height: 190px !important;
  margin-bottom: 8px;
}

body.dashboard-page:not(.embed) #trendChart .erp-chart__canvas-wrap {
  height: 190px !important;
  min-height: 190px !important;
}

body.dashboard-page:not(.embed) #trendChart .erp-chart__state--loading,
body.dashboard-page:not(.embed) #trendChart .erp-chart__state--empty,
body.dashboard-page:not(.embed) #trendChart .erp-chart__state--error {
  min-height: 0 !important;
  padding: 18px !important;
}

body.dashboard-page:not(.embed) .chart-wrap .dashboard-empty,
body.dashboard-page:not(.embed) #trendChart .dashboard-empty {
  height: 100%;
  min-height: 0 !important;
  display: grid !important;
  place-items: center;
}

body:not(.embed) .erp-empty-action {
  width: max-content;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid #bfd0ec;
  border-radius: 8px;
  background: #fff;
  color: #2858bd;
  font-size: 12px;
  font-weight: 680;
  cursor: pointer;
}

body:not(.embed) .danger,
body:not(.embed) button.danger {
  border-color: #f2b2b6 !important;
  background: #fff5f5 !important;
  color: #ba2530 !important;
}

body:not(.embed) button.danger:hover {
  border-color: #ef454f !important;
  background: #fff0f1 !important;
}

body:not(.embed) .layout-master-detail,
body:not(.embed) .workbench,
body:not(.embed) .sku-workbench {
  display: grid !important;
  grid-template-columns: minmax(280px, .9fr) minmax(0, 1.4fr);
  gap: 14px !important;
  align-items: start;
}

body:not(.embed) .list-panel,
body:not(.embed) .trace-panel,
body:not(.embed) .detail,
body:not(.embed) .submit-form,
body:not(.embed) .config-check,
body:not(.embed) .result-box {
  border: 1px solid var(--erp-line) !important;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: 0 4px 14px rgba(31, 45, 75, .045) !important;
}

body:not(.embed) .modal-actions,
body:not(.embed) .sticky-actions,
body:not(.embed) .form-actions:not(.erp-inline-actions) {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: 14px -18px -18px;
  padding: 12px 18px;
  display: flex !important;
  justify-content: flex-end;
  gap: 8px !important;
  border-top: 1px solid var(--erp-line);
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

body:not(.embed) .chart-card,
body:not(.embed) .erp-chart-card,
body:not(.embed) [data-chart] {
  min-height: 260px;
  border: 1px solid var(--erp-line) !important;
  border-radius: 12px !important;
  background: #fff !important;
}

body:not(.embed) .erp-state-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

body:not(.embed) .badge,
body:not(.embed) .status,
body:not(.embed) .chip {
  min-height: 24px;
  padding: 3px 8px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

body:not(.embed) .badge::before,
body:not(.embed) .status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: .72;
}

@media (max-width: 1199px) {
  body:not(.embed) .layout-master-detail,
  body:not(.embed) .workbench,
  body:not(.embed) .sku-workbench {
    grid-template-columns: 1fr;
  }

  body:not(.embed) .filters {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)) !important;
  }
}

@media (max-width: 767px) {
  body:not(.embed) .header .actions,
  body:not(.embed) .panel .actions,
  body:not(.embed) .section-head .actions,
  body:not(.embed) .modal-actions,
  body:not(.embed) .sticky-actions,
  body:not(.embed) .form-actions:not(.erp-inline-actions) {
    width: auto;
  }

  body:not(.embed) .modal-actions,
  body:not(.embed) .sticky-actions,
  body:not(.embed) .form-actions:not(.erp-inline-actions) {
    margin-right: -18px;
    margin-left: -18px;
  }

  body:not(.embed) .modal-actions > *,
  body:not(.embed) .sticky-actions > *,
  body:not(.embed) .form-actions:not(.erp-inline-actions) > * {
    flex: 1 1 0;
  }

  body:not(.embed) .table-wrap {
    margin-right: -4px;
    margin-left: -4px;
  }
}

.erp-mobile-overlay {
  display: none;
}

body.erp-sidebar-collapsed:not(.embed) .shell {
  grid-template-columns: 80px minmax(0, 1fr) !important;
}

body.erp-sidebar-collapsed:not(.embed) .sidebar {
  width: 80px;
  padding-right: 10px !important;
  padding-left: 10px !important;
}

body.erp-sidebar-collapsed .erp-brand-copy,
body.erp-sidebar-collapsed .erp-nav-title span,
body.erp-sidebar-collapsed .erp-nav-chevron,
body.erp-sidebar-collapsed .erp-nav-items,
body.erp-sidebar-collapsed .erp-user-switch select,
body.erp-sidebar-collapsed .erp-user-scope {
  display: none !important;
}

body.erp-sidebar-collapsed .brand {
  padding: 0;
  justify-content: center;
}

body.erp-sidebar-collapsed .erp-nav-title {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 0 !important;
}

body.erp-sidebar-collapsed .erp-user-switch {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 8px !important;
}

@media (max-width: 1199px) {
  body:not(.embed) .shell {
    grid-template-columns: 1fr !important;
  }

  body:not(.embed) .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0;
    z-index: 90;
    width: 248px;
    transform: translateX(-102%);
    transition: transform 0.2s ease;
  }

  body.erp-mobile-nav-open:not(.embed) .sidebar {
    transform: translateX(0);
  }

  .erp-mobile-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: block;
    border: 0;
    background: rgba(18, 27, 46, 0.36);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.erp-mobile-nav-open .erp-mobile-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  body:not(.embed) .main {
    padding: 0 16px 24px !important;
  }

  .erp-topbar {
    margin: 0 -16px;
    padding: 0 16px;
    grid-template-columns: minmax(120px, 1fr) minmax(180px, 320px) auto;
  }

  .erp-profile-name {
    display: none;
  }

  body:not(.embed) .erp-visual-header {
    background-position: 58% center !important;
  }

  body:not(.embed) .erp-visual-header > :not(.actions) {
    max-width: 58%;
  }

  body:not(.embed) .erp-visual-header > .actions {
    max-width: 58%;
  }

  .erp-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body:not(.embed) .form-grid,
  body:not(.embed) .form,
  body:not(.embed) .form2,
  body:not(.embed) .manual-grid,
  body:not(.embed) .import-grid,
  body:not(.embed) .filters {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)) !important;
  }

  .erp-session-tabs {
    position: sticky;
    top: var(--erp-topbar-height, 64px);
    min-height: 48px;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .erp-session-tabs-toggle {
    width: min(100%, 360px);
    min-height: 40px;
    padding: 0 12px;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--erp-line);
    border-radius: 8px;
    background: var(--erp-surface);
    color: var(--erp-text-soft);
    text-align: left;
  }

  .erp-session-tabs-toggle span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .erp-session-tabs-toggle i:last-child {
    transition: transform .15s ease;
  }

  .erp-session-tabs.is-open .erp-session-tabs-toggle i:last-child {
    transform: rotate(180deg);
  }

  .erp-session-tabs-list {
    position: absolute;
    top: 50px;
    left: 0;
    z-index: 70;
    width: min(360px, calc(100vw - 32px));
    max-height: min(60vh, 420px);
    padding: 6px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    overflow-y: auto;
    border: 1px solid var(--erp-line);
    border-radius: 10px;
    background: var(--erp-surface);
    box-shadow: 0 14px 34px rgba(24, 38, 65, .16);
  }

  .erp-session-tabs.is-open .erp-session-tabs-list {
    display: flex;
  }

  .erp-session-tab {
    width: 100%;
    max-width: none;
    min-height: 40px;
  }
}

@media (max-width: 767px) {
  .erp-topbar {
    min-height: 58px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .erp-global-search {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-bottom: 10px;
  }

  .erp-topbar-title {
    font-size: 14px;
  }

  body:not(.embed) .main {
    gap: 12px !important;
  }

  body:not(.embed) .erp-visual-header,
  body:not(.embed) .erp-visual-header-large,
  body:not(.embed) .erp-visual-header-compact {
    min-height: 128px;
    padding: 18px !important;
    align-items: flex-start !important;
    background-position: 66% center !important;
  }

  body:not(.embed) .erp-visual-header > :not(.actions) {
    max-width: 72%;
  }

  body:not(.embed) .erp-visual-header > .actions {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: auto;
    max-width: calc(100% - 24px);
  }

  body:not(.embed) .erp-visual-header p {
    display: none;
  }

  body:not(.embed) .checks label,
  body:not(.embed) label.check-pill,
  body:not(.embed) .check-row label {
    min-width: 0;
  }

  .erp-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .erp-kpi-card {
    min-height: 96px;
    padding: 14px !important;
  }

  .erp-kpi-card .value {
    font-size: 21px !important;
  }

  .erp-kpi-icon {
    right: 12px;
    width: 38px;
    height: 38px;
    font-size: 18px;
  }

  body:not(.embed) select:not(.erp-select-native) {
    width: 100%;
    min-height: 44px;
  }

  .erp-session-tabs-actions {
    display: none;
  }

  .erp-session-tabs-toggle,
  body:not(.embed) .erp-nav a,
  body:not(.embed) .erp-nav button[data-nav-link],
  body:not(.embed) .erp-topbar button,
  body:not(.embed) .actions button,
  body:not(.embed) .actions a {
    min-height: 44px;
  }
}

/* Pagination is rebuilt after every data request. Keep its page-size control
   native and compact so dynamic rendering cannot close a custom popup. */
body:not(.embed) .erp-pagination {
  display: flex !important;
  flex-flow: row wrap !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  width: 100%;
  margin-top: 14px;
}

body:not(.embed) .erp-pagination > button,
body:not(.embed) .erp-pagination > span,
body:not(.embed) .erp-pagination > select.erp-page-size {
  flex: 0 0 auto !important;
  width: auto !important;
  margin: 0 !important;
}

body:not(.embed) .erp-page-size-options {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--erp-line-strong);
  border-radius: 9px;
  background: #f8faff;
}

body:not(.embed) .erp-page-size-options > button {
  min-width: 48px;
  height: 32px;
  min-height: 32px;
  padding: 0 10px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body:not(.embed) .erp-page-size-options > button.active {
  background: var(--erp-primary) !important;
  color: #fff !important;
}

body:not(.embed) .erp-pagination > select.erp-page-size {
  min-width: 112px !important;
  max-width: 140px;
  height: 38px;
  min-height: 38px;
  padding: 0 32px 0 12px !important;
  border: 1px solid var(--erp-line-strong) !important;
  border-radius: 8px !important;
  background-color: #fff !important;
  color: var(--erp-text) !important;
  cursor: pointer;
}

@media (max-width: 520px) {
  body:not(.embed) .erp-pagination {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, auto));
  }

  body:not(.embed) .erp-pagination > select.erp-page-size {
    justify-self: end;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
