:root {
  --primary: #409eff;
  --primary-deep: #337ecc;
  --primary-text-color: #212121;
  --secondary-text-color: #666666;
  --weak-border-color: #e5e5e5;
  --theme-color-level1: #ecf5ff;
  --theme-color-level6: var(--primary);
  --bg: #f3f5f7;
  --line: #dfe5ec;
  --text: #2f3a4a;
  --muted: #a8b2c1;
  --menu-hover-bg: #ecf5ff;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html,
body {
  width: 100%;
  min-width: 1000px;
  height: 100%;
  margin: 0;
}

body {
  overflow: auto;
  background: var(--bg);
  font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

button {
  font: inherit;
}

.erp-app {
  width: 100%;
  min-width: 1000px;
  height: 100vh;
  min-height: 676px;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background: var(--bg);
  border: 1px solid #dde3ea;
}

.topbar {
  width: 100%;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 8px;
  color: #ffffff;
  background: linear-gradient(180deg, #11a6ef 0%, var(--primary) 100%);
}

.topbar-left,
.topbar-right {
  height: 100%;
  display: flex;
  align-items: center;
}

.topbar-left {
  gap: 8px;
}

.topbar-right {
  gap: 8px;
  font-size: 12px;
}

.logo-box {
  width: 160px;
  height: 48px;
  flex: 0 0 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  color: #ffffff;
  font-size: 22px;
  font-weight: 600;
}

.logo-wrapper {
  width: 210px;
  flex: 0 0 210px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-trigger {
  position: relative;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin: 0 6px 0 2px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.menu-trigger::before,
.menu-trigger::after,
.menu-trigger span {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.96);
}

.menu-trigger::before {
  top: 3px;
}

.menu-trigger span {
  top: 8px;
}

.menu-trigger::after {
  top: 13px;
}

.menu-search {
  position: relative;
  z-index: 80;
  width: 310px;
  flex: 0 0 310px;
}

.search-box {
  width: 100%;
  height: 30px;
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 2px;
  color: #606266;
  background: #ffffff;
  font-size: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-box:focus-within,
.search-box.is-open {
  border-color: #5582f3;
  box-shadow: 0 0 0 1px rgba(85, 130, 243, 0.08);
}

.menu-search-input {
  min-width: 0;
  height: 100%;
  flex: 1;
  padding: 0 8px 0 12px;
  border: 0;
  outline: 0;
  color: #303133;
  background: transparent;
  font: inherit;
}

.menu-search-input::placeholder {
  color: #a8b0bd;
}

.menu-search-input::-webkit-search-cancel-button {
  display: none;
}

.menu-search-clear {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: #d3d7de;
  cursor: pointer;
}

.menu-search-clear[hidden] {
  display: none;
}

.menu-search-clear:hover,
.menu-search-clear:focus-visible {
  outline: 0;
  background: #aeb6c2;
}

.menu-search-clear svg {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2.4;
}

.menu-search-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 3px);
  z-index: 100;
  width: 100%;
  max-height: 350px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 2px;
  color: #606266;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(31, 42, 61, 0.16);
}

.menu-search-panel[hidden] {
  display: none;
}

.menu-search-summary {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 14px;
  color: #9aa2ae;
  background: #ffffff;
  font-size: 12px;
}

.menu-search-summary-left {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
}

.menu-search-summary-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  margin-right: 5px;
  fill: none;
  stroke: #9aa2ae;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

#menuSearchSummaryText {
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-search-total {
  flex: 0 0 auto;
  margin-left: 8px;
  white-space: nowrap;
}

.menu-search-total strong {
  color: #5582f3;
  font-weight: 400;
}

.menu-search-results {
  max-height: 314px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: #b8b8b8 transparent;
  scrollbar-width: thin;
}

.menu-search-results::-webkit-scrollbar {
  width: 6px;
}

.menu-search-results::-webkit-scrollbar-thumb {
  border-radius: 3px;
  background: #b8b8b8;
}

.menu-search-result {
  width: 100%;
  min-height: 60px;
  display: block;
  padding: 8px 14px 7px;
  border: 0;
  color: #606266;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
}

.menu-search-result:hover,
.menu-search-result:focus-visible,
.menu-search-result.is-active {
  outline: 0;
  background: #f4f4f4;
}

.menu-search-result-title {
  min-width: 0;
  display: flex;
  align-items: center;
  color: #606266;
  font-size: 14px;
  line-height: 20px;
}

.menu-search-result-icon {
  position: relative;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  margin-right: 5px;
  border-radius: 2px;
  background: #5582f3;
}

.menu-search-result-icon::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 3px;
  height: 3px;
  border-radius: 0.5px;
  background: #ffffff;
  box-shadow: 5px 0 0 rgba(255, 255, 255, 0.78), 0 5px 0 #ffffff, 5px 5px 0 #ffffff;
}

.menu-search-result-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-search-result-label mark {
  color: #5582f3;
  background: transparent;
  font-weight: 700;
}

.menu-search-result-path {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: #a0a7b2;
  font-size: 12px;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-search-result-separator {
  margin: 0 5px;
  color: #b3bac4;
}

.menu-search-empty {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a0a7b2;
  font-size: 12px;
}

.menu-search-empty[hidden] {
  display: none;
}

.top-icon {
  position: relative;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 12px;
  opacity: 0.96;
}

.top-icon.help-link {
  text-decoration: none;
}

.notify-badge {
  position: absolute;
  top: -6px;
  right: -9px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  color: #ffffff;
  background: #f05b5b;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  transform: scale(0.92);
}

.avatar-box {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.avatar-circle {
  position: relative;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 50%;
  background: linear-gradient(180deg, #d8eefc 0%, #a7d5f2 100%);
}

.avatar-circle::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6b8ca6;
}

.avatar-circle::after {
  content: "";
  position: absolute;
  left: 3px;
  bottom: 2px;
  width: 12px;
  height: 7px;
  border-radius: 7px 7px 3px 3px;
  background: #6b8ca6;
}

.user-name {
  color: #ffffff;
  white-space: nowrap;
}

.arrow-down {
  font-size: 10px;
  opacity: 0.9;
}

.layout {
  position: relative;
  height: calc(100vh - 56px);
  min-height: 620px;
  display: flex;
}

.sidebar {
  width: 210px;
  height: 100%;
  flex: 0 0 210px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: #ffffff;
  transition: width 0.18s ease, flex-basis 0.18s ease;
}

.menu-group {
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
}

.menu-section {
  margin: 1px 0;
}

.menu-item,
.submenu-item {
  position: relative;
  display: flex;
  align-items: center;
  border: 0;
  color: var(--primary-text-color);
  background: #ffffff;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  user-select: none;
}

.menu-item {
  width: 100%;
  height: 40px;
  gap: 9px;
  padding: 0 12px 0 16px;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.16s, background 0.16s;
}

.menu-item:hover,
.menu-item:focus-visible,
.submenu-item:hover,
.submenu-item:focus-visible {
  outline: 0;
  color: var(--theme-color-level6);
  background: var(--menu-hover-bg);
}

.menu-icon {
  position: relative;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.menu-icon::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 2px;
  background: #c7cfdd;
}

.menu-icon::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: #f8fafc;
}

.menu-label {
  min-width: 0;
  max-width: 136px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-arrow {
  width: 12px;
  height: 12px;
  min-width: 12px;
  margin-right: 10px;
  color: var(--primary-text-color);
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: color 0.16s;
  text-indent: -999px;
  overflow: hidden;
}

.menu-arrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-top: 1.4px solid currentColor;
  border-right: 1.4px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.18s ease, border-color 0.16s;
}

.menu-item.active .menu-arrow {
  color: var(--theme-color-level6);
}

.menu-section.open .menu-arrow::before {
  transform: rotate(135deg);
}

.menu-item.active {
  color: var(--theme-color-level6);
  background: var(--menu-hover-bg);
  font-weight: 600;
}

.menu-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary);
}

.menu-item.active .menu-icon::before {
  background: var(--theme-color-level6);
}

.submenu {
  max-height: 0;
  overflow: hidden;
  border: 0;
  background: #ffffff;
  transition: max-height 0.22s ease;
}

.menu-section.open .submenu {
  max-height: 560px;
}

.submenu-item {
  width: 100%;
  height: 40px;
  min-height: 40px;
  gap: 0;
  padding: 0 6px 0 42px;
  font-size: 14px;
}

.submenu-title {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.submenu-item.current {
  color: var(--theme-color-level6);
  background: var(--menu-hover-bg);
  font-weight: 400;
}

.sidebar.collapsed {
  width: 56px;
  flex-basis: 56px;
}

.sidebar.collapsed .menu-label,
.sidebar.collapsed .menu-arrow,
.sidebar.collapsed .submenu,
.sidebar.collapsed .sidebar-version {
  display: none;
}

.sidebar.collapsed .menu-item {
  width: 56px;
  justify-content: center;
  padding: 0;
}

.sidebar-version {
  padding: 9px 0 8px;
  border-top: 1px solid #edf1f5;
  color: #a7b1bf;
  background: #ffffff;
  font-size: 10px;
  text-align: center;
}

.third-menu-panel {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 30;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.third-menu-panel.hidden {
  display: none;
}

.third-menu-mask {
  position: absolute;
  left: 210px;
  top: 0;
  right: 0;
  bottom: 0;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.16);
  pointer-events: auto;
}

.sidebar.collapsed + .third-menu-panel .third-menu-mask {
  left: 56px;
}

.third-menu-shell {
  position: absolute;
  left: 210px;
  top: 0;
  bottom: 0;
  width: min(1080px, calc(100% - 210px));
  display: flex;
  border-left: 1px solid var(--weak-border-color);
  background: #ffffff;
  box-shadow: 8px 0 18px rgba(0, 0, 0, 0.08);
  pointer-events: auto;
}

.sidebar.collapsed + .third-menu-panel .third-menu-shell {
  left: 56px;
  width: min(1080px, calc(100% - 56px));
}

.third-menu-shell .content-middle {
  min-width: 500px;
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px 32px;
}

.third-menu-shell .menu-group-wrap {
  display: flex;
  flex-direction: column;
}

.third-menu-shell .menu-section-card {
  margin-bottom: 24px;
  scroll-margin-top: 12px;
}

.third-menu-shell .menu-top {
  height: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary-text-color);
  font-size: 16px;
  font-weight: 600;
}

.third-menu-shell .top-border {
  width: 3px;
  height: 16px;
  border-radius: 1px;
  background: var(--theme-color-level6);
}

.third-menu-shell .menu-content {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  gap: 6px 30px;
  padding: 10px 0 0 28px;
}

.third-menu-shell .menu-list-wrap {
  width: 100%;
  min-height: 28px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin: 0;
  padding: 4px 8px;
  border: 1px dashed #ffffff;
  color: var(--secondary-text-color);
  background: #ffffff;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  user-select: none;
}

.third-menu-shell .menu-list-wrap:hover,
.third-menu-shell .menu-list-wrap:focus-visible,
.third-menu-shell .menu-list-wrap.current,
.third-menu-shell .menu-list-wrap.selected {
  outline: 0;
  color: var(--theme-color-level6);
  background: var(--menu-hover-bg);
}

.third-menu-shell .menu-list-left {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
}

.third-menu-shell .menu-list-left .text {
  max-width: 178px;
  overflow: hidden;
  color: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.third-menu-shell .content-right {
  width: 148px;
  flex: 0 0 148px;
  border-left: 1px solid #e5e5e5;
  background: #ffffff;
}

.anchor-point-wrap,
.kd-anchor-wrapper {
  width: 148px;
  height: 100%;
}

.kd-anchor-wrapper {
  padding-top: 8px;
}

.kd-anchor {
  position: relative;
  padding-left: 12px;
}

.kd-anchor-line {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #e5e5e5;
}

.kd-anchor-line-slider {
  position: absolute;
  left: 0;
  top: 8px;
  width: 2px;
  height: 16px;
  background: var(--theme-color-level6);
  transition: top 0.18s ease;
}

.kd-anchor-link {
  height: 32px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: var(--primary-text-color);
  font-size: 14px;
  cursor: pointer;
}

.kd-anchor-link-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kd-anchor-link-active,
.kd-anchor-link-title-active {
  color: var(--theme-color-level6);
}

.content {
  position: relative;
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f7f8fa;
}

.workspace-tabs {
  width: 100%;
  height: 40px;
  flex: 0 0 40px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  border-bottom: 0;
  background: #ffffff;
  scrollbar-width: thin;
}

.workspace-tabs-nav {
  position: relative;
  z-index: 2;
  width: max-content;
  min-width: 100%;
  height: 40px;
  display: inline-flex;
  align-items: stretch;
  white-space: nowrap;
  border: 0;
  background: #ffffff;
}

.workspace-tabs-active-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 1;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: transform 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), width 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}

.workspace-tab {
  position: relative;
  z-index: 2;
  height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px 0 20px;
  border: 0;
  border-radius: 0;
  color: #303133;
  background: transparent;
  font-size: 14px;
  font-weight: 400;
  line-height: 40px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color 0.3s;
}

.workspace-tab:hover,
.workspace-tab:focus-visible,
.workspace-tab.active {
  outline: 0;
  color: var(--primary);
}

.workspace-tab-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-tab-close {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #c0c4cc;
  background: transparent;
  font-size: 12px;
  line-height: 14px;
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s, opacity 0.15s;
}

.workspace-tab-close::before {
  content: "×";
  transform: scale(0.9);
}

.workspace-tab:hover .workspace-tab-close,
.workspace-tab.active .workspace-tab-close,
.workspace-tab-close:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

.workspace-tab-close:hover,
.workspace-tab-close:focus-visible {
  outline: 0;
  color: #ffffff;
  background: #c0c4cc;
}

.page-stage {
  position: relative;
  width: 100%;
  min-height: 0;
  min-width: 780px;
  flex: 1;
  overflow: hidden;
  background: #ffffff;
}

.empty-view {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 20px 70px;
  color: #909399;
  text-align: center;
}

.empty-view[hidden],
.page-frame[hidden] {
  display: none;
}

.empty-icon {
  position: relative;
  width: 68px;
  height: 48px;
  margin-bottom: 18px;
  border: 2px solid #bedcf7;
  border-radius: 4px;
  background: #eef7ff;
}

.empty-icon::before {
  content: "";
  position: absolute;
  left: 8px;
  top: -10px;
  width: 26px;
  height: 12px;
  border: 2px solid #bedcf7;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: #eef7ff;
}

.empty-icon::after {
  content: "";
  position: absolute;
  left: 17px;
  right: 17px;
  bottom: 13px;
  height: 2px;
  background: #bedcf7;
  box-shadow: 0 -8px 0 #d5e9fa;
}

.empty-view h1 {
  margin: 0 0 9px;
  color: #4d5968;
  font-size: 18px;
  font-weight: 600;
}

.empty-view p {
  margin: 0;
  color: #909399;
  font-size: 13px;
}

.page-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

@media (max-width: 1160px) {
  .third-menu-shell .menu-content {
    grid-template-columns: repeat(2, 220px);
  }
}

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