:root {
  --mdm-aside: #001529;
  --mdm-aside-text: #c9d1d9;
  --mdm-primary: #1677ff;
  --mdm-bg: #f0f2f5;
  --mdm-card: #ffffff;
  --mdm-line: #e5e6eb;
  --mdm-text: #1f2329;
  --mdm-muted: #86909c;
  --mdm-warn: #fff7e6;
  --mdm-header: 48px;
  --mdm-tags: 40px;
  --mdm-gap: 16px;
  --mdm-radius: 4px;
  --mdm-tree: 280px;
}

html, body, #app {
  height: 100%;
  margin: 0;
  color: var(--mdm-text);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  background: var(--mdm-bg);
}

.shell {
  height: 100%;
}

.aside {
  background: var(--mdm-aside);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.brand {
  height: var(--mdm-header);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.brand.mini {
  padding: 0;
  justify-content: center;
}

.logo {
  width: 28px;
  height: 28px;
  border-radius: var(--mdm-radius);
  background: var(--mdm-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.aside .el-menu {
  border-right: none;
  flex: 1;
  overflow: auto;
}

.aside .el-menu-item.is-active {
  background: var(--mdm-primary) !important;
}

.mdm-svg {
  width: 1em;
  height: 1em;
  display: block;
  fill: currentColor;
}

.main-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.header {
  height: var(--mdm-header);
  background: var(--mdm-card);
  border-bottom: 1px solid var(--mdm-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--mdm-gap);
}

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

.biz-date {
  color: var(--mdm-muted);
  font-size: 13px;
}

.tags-bar {
  height: var(--mdm-tags);
  background: #fafafa;
  border-bottom: 1px solid var(--mdm-line);
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 0 8px 0 12px;
  box-sizing: border-box;
}

.tags {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  overflow: hidden;
  padding-top: 6px;
}

.tags-ops {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  padding-left: 4px;
  border-left: 1px solid var(--mdm-line);
  margin: 6px 0;
}

.tag {
  appearance: none;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--mdm-muted);
  border-radius: 6px 6px 0 0;
  padding: 0 10px;
  height: 28px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px;
  line-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 160px;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}

.tag:hover {
  color: var(--mdm-text);
  background: rgba(0, 0, 0, 0.04);
}

.tag.on {
  color: var(--mdm-primary);
  background: var(--mdm-card);
  border-color: var(--mdm-line);
  font-weight: 600;
  box-shadow: inset 0 2px 0 var(--mdm-primary);
}

.tag-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-close {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-style: normal;
  font-size: 12px;
  line-height: 1;
  color: var(--mdm-muted);
  flex: none;
}

.tag-close:hover {
  color: #fff;
  background: #c0c4cc;
}

.tag.on .tag-close:hover {
  background: var(--mdm-primary);
}

.tags-more {
  color: var(--mdm-muted) !important;
  font-size: 13px;
  padding: 0 8px !important;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.tags-more:hover {
  color: var(--mdm-primary) !important;
}

.tags-dd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 140px;
}

.tags-dd-close {
  font-style: normal;
  color: var(--mdm-muted);
  font-size: 12px;
}

.tags-dd-close:hover {
  color: var(--mdm-primary);
}

.main {
  padding: var(--mdm-gap);
  overflow: auto;
  background: var(--mdm-bg);
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--mdm-gap);
  margin-bottom: 12px;
}

.page-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 26px;
}

.page-desc {
  margin-top: 4px;
  color: var(--mdm-muted);
  font-size: 13px;
  line-height: 20px;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex: none;
}

.page-card {
  background: var(--mdm-card);
  border: 1px solid var(--mdm-line);
  border-radius: var(--mdm-radius);
  padding: 16px;
  margin-bottom: var(--mdm-gap);
}

.page-card > .el-form.el-form--inline,
.page-card .sheet-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 4px 8px;
  margin-bottom: 0;
}

.page-card > .el-form.el-form--inline .el-form-item,
.page-card .sheet-form .el-form-item {
  margin-right: 0;
  margin-bottom: 8px;
  vertical-align: bottom;
}

.table-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.table-bar span {
  color: var(--mdm-muted);
  white-space: nowrap;
}

.table-bar-left,
.table-bar-right,
.sheet-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.sheet-tools {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 4px;
}

.sheet-tools .sheet-form {
  width: 100%;
}

.page-actions {
  flex-wrap: wrap;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: var(--mdm-gap);
}

.stat {
  background: var(--mdm-card);
  border: 1px solid var(--mdm-line);
  border-radius: var(--mdm-radius);
  padding: 14px 16px;
  cursor: pointer;
  border-top: 3px solid var(--mdm-primary);
}

.stat:hover {
  border-color: var(--mdm-primary);
}

.stat-label {
  color: var(--mdm-muted);
  font-size: 13px;
}

.stat-num {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
}

.split {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: var(--mdm-gap);
}

.split-tree {
  display: grid;
  grid-template-columns: var(--mdm-tree) 1fr;
  gap: var(--mdm-gap);
  align-items: start;
}

.chart {
  height: 280px;
}

.pager {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.profile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.record-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.record-card {
  border: 1px solid var(--mdm-line);
  border-radius: var(--mdm-radius);
  background: var(--mdm-card);
  padding: 12px;
  cursor: pointer;
}

.el-table tr.is-diff > td.el-table__cell {
  background: #fff1f0 !important;
}

.legend {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  color: var(--mdm-muted);
  font-size: 13px;
}

.legend-diff {
  color: #cf1322;
}

.legend-keep {
  color: var(--mdm-primary);
}

.el-dialog .el-radio.is-checked .el-radio__label {
  color: var(--mdm-primary);
  font-weight: 600;
}

@media (max-width: 1100px) {
  .stat-grid, .split {
    grid-template-columns: 1fr;
  }
}

.field-hint { color: #8c8c8c; font-size: 12px; line-height: 1.4; margin-top: 4px; }
.field-error { color: #cf1322; font-size: 12px; line-height: 1.4; margin-top: 4px; }
.el-form-item.is-error .field-hint { display: none; }

/* sheet-form item spacing handled above */

.print-dossier { display: none; }
.print-caption { margin: 12px 0 6px; font-weight: 600; }
.print-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.print-table th, .print-table td { border: 1px solid var(--mdm-line); padding: 4px 8px; text-align: left; font-size: 12px; }

@media print {
  body * { visibility: hidden; }
  .print-target, .print-target * { visibility: visible; }
  .print-target { position: absolute; left: 0; top: 0; width: 100%; background: #fff; }
  .print-target .el-button,
  .print-target .el-pagination,
  .print-target .sheet-form,
  .print-target .el-tabs { display: none !important; }
  .print-target .print-dossier { display: block !important; }
}


.row-ops,
.profile-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.row-ops .el-button,
.profile-actions .el-button {
  margin-left: 0 !important;
}

.el-form--inline .el-form-item__content {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}


/* professional empty states */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: #8c8c8c;
  background: linear-gradient(180deg, #fafafa 0%, #fff 100%);
  border: 1px dashed var(--mdm-line, #e5e7eb);
  border-radius: 8px;
  margin: 8px 0 16px;
}
.empty-state-title {
  font-size: 15px;
  font-weight: 600;
  color: #595959;
  margin-bottom: 6px;
}
.empty-state-desc {
  font-size: 13px;
  line-height: 1.6;
}
.el-table__empty-text {
  color: #8c8c8c;
}


.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 8px;
}
.quick-links .el-button {
  margin: 0;
}
.stat.warn .stat-num {
  color: #cf1322;
}


.table-toolbar {
  padding: 4px 0 2px;
  margin-bottom: 8px;
}

.table-meta {
  font-size: 13px;
  color: var(--mdm-muted);
}

.col-cfg {
  min-width: 180px;
  max-height: 320px;
  overflow: auto;
  padding: 8px 12px 10px;
}

.col-cfg-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 13px;
}

.col-cfg-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 13px;
  cursor: pointer;
}

.inherit-box {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px dashed #91caff;
  background: #f0f7ff;
  border-radius: 8px;
}

.inherit-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  color: #1677ff;
}

.inherit-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.page-card .el-table--small .el-table__cell {
  padding: 6px 8px;
}


.inherit-badge {
  margin-left: 6px;
  vertical-align: middle;
}

.inherit-hint {
  color: #1677ff;
}

.import-job-box {
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid #91caff;
  background: #f0f7ff;
  border-radius: 8px;
}

.import-job-list {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  background: #fafafa;
  border-radius: 8px;
}
