: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);
}

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;
  min-height: 100vh;
  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: 44px;
  padding: 0 6px 0 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;
}

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;
  flex: 1;
  flex-direction: column;
  gap: 12px;
}

.erp-nav-scroll {
  min-height: 0;
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #dce2ef transparent;
}

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

.erp-nav a,
.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 {
  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;
}

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

.erp-nav a > i {
  color: #8792a9;
  font-size: 16px;
}

.erp-nav a:hover > i,
.erp-nav a.active > i {
  color: var(--erp-primary);
}

.erp-nav a.active {
  background: var(--erp-primary-soft) !important;
  color: var(--erp-primary-strong) !important;
  font-weight: 700 !important;
}

.erp-nav a.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: relative;
  min-height: 104px;
  padding: 22px 26px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 20px !important;
  overflow: hidden;
  background-color: #f7f9fe !important;
  background-image: var(--erp-module-art) !important;
  background-repeat: no-repeat !important;
  background-position: center right !important;
  background-size: cover !important;
  border-color: var(--erp-module-line, #e0e7f5) !important;
  box-shadow: none !important;
}

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

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

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

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

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

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

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

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

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

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

body:not(.embed) .erp-visual-header > :not(.actions) {
  position: relative;
  z-index: 1;
  max-width: 48%;
}

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;
}

body:not(.embed) .erp-visual-header > .actions {
  position: relative;
  z-index: 2;
  width: max-content;
  max-width: 58%;
  margin-left: auto;
  padding: 5px;
  display: inline-flex !important;
  flex-wrap: nowrap !important;
  gap: 6px !important;
  align-self: flex-end;
  justify-content: flex-end !important;
  overflow-x: auto;
  scrollbar-width: none;
  border: 1px solid rgba(108, 128, 185, .24);
  border-radius: 12px;
  background: rgba(247, 249, 255, .58);
  box-shadow:
    0 8px 24px rgba(42, 58, 102, .10),
    inset 0 1px 0 rgba(255, 255, 255, .72);
  -webkit-backdrop-filter: blur(16px) saturate(125%);
  backdrop-filter: blur(16px) saturate(125%);
}

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

body:not(.embed) .erp-visual-header > .actions > button,
body:not(.embed) .erp-visual-header > .actions > a {
  flex: 0 0 auto !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 .value {
  margin-top: 2px !important;
  color: #18213a;
  font-size: 25px !important;
  font-weight: 760 !important;
}

.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 {
  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 {
  border-color: var(--erp-primary-strong) !important;
  background: var(--erp-primary-strong) !important;
}

body:not(.embed) .ghost {
  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 {
  border-color: #82a4ff !important;
  background: #f4f7ff !important;
  color: var(--erp-primary-strong) !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;
}

body:not(.embed) .erp-select-button {
  width: 100%;
  height: 42px;
  min-height: 42px;
  padding: 0 10px 0 12px !important;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  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;
  cursor: pointer;
}

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

body:not(.embed) .erp-select-button:focus,
body:not(.embed) .erp-select-button[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-button:disabled {
  border-color: #e5e9f0 !important;
  background: #f6f7fa !important;
  color: #98a1b2 !important;
  cursor: not-allowed;
}

.erp-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.erp-select-button > i {
  color: #657189;
  font-size: 17px;
  transition: transform .15s ease;
}

.erp-select-button[aria-expanded="true"] > i {
  transform: rotate(180deg);
}

.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-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 {
  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;
  border-bottom: 1px solid var(--erp-line);
}

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 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) button.mini {
  min-height: 38px;
  padding: 8px 14px !important;
  border-radius: 8px !important;
  font-size: 13px;
  font-weight: 620;
}

/* 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;
}

.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: relative;
    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-topbar button,
  body:not(.embed) .actions button,
  body:not(.embed) .actions a {
    min-height: 44px;
  }
}

@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;
  }
}
