/* Reset & base */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: #262626;
  background: #f5f7fa;
}

#app {
  height: 100%;
}

.layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Body */
.body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 200px;
  background: #1677ff;
  flex-shrink: 0;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: width 0.25s ease;
  position: relative;
}

.sidebar.collapsed {
  width: 64px;
}

.menu {
  display: flex;
  flex-direction: column;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
}

.menu-item:hover,
.menu-item.active {
  background: rgba(0, 0, 0, 0.15);
  color: #fff;
  font-weight: 500;
}

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

.sidebar.collapsed .menu-item svg {
  margin: 0;
}

.sidebar-toggle {
  height: 44px;
  width: 100%;
  background: rgba(0, 0, 0, 0.12);
  border: none;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.sidebar-toggle:hover {
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
}

/* Main */
.main {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
  background: #f5f7fa;
}

.card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.search-card {
  padding: 18px 24px;
  margin-bottom: 16px;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.form-label {
  color: #262626;
  font-weight: 500;
}

.form-input {
  width: 220px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  outline: none;
  font-size: 14px;
  color: #262626;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  border-color: #1677ff;
  box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.15);
}

.form-input::placeholder {
  color: #bfbfbf;
}

/* Buttons */
.btn {
  height: 34px;
  padding: 0 16px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.btn-primary {
  background: #1677ff;
  color: #fff;
  border-color: #1677ff;
}

.btn-primary:hover {
  background: #4096ff;
  border-color: #4096ff;
}

.btn-default {
  background: #fff;
  color: #595959;
  border-color: #d9d9d9;
}

.btn-default:hover {
  color: #1677ff;
  border-color: #1677ff;
}

/* Table */
.table-card {
  padding: 18px 24px 16px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table thead th {
  background: #fafafa;
  color: #262626;
  font-weight: 500;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
}

.data-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  color: #595959;
  white-space: nowrap;
}

.data-table tbody tr:hover td {
  background: #fafafa;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.text-ellipsis {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
}

/* 版本线状态列（§5.29）：版本号与草稿标签同行，版本号用等宽字体保证列对齐 */
.vs-cell {
  white-space: nowrap;
}
.vs-no {
  margin-right: 6px;
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 13px;
  color: #262626;
}

.status-success {
  color: #52c41a;
  background: #f6ffed;
  border: 1px solid #b7eb8f;
}

.status-warning {
  color: #fa8c16;
  background: #fff7e6;
  border: 1px solid #ffd591;
}

.status-default {
  color: #8c8c8c;
  background: #fafafa;
  border: 1px solid #d9d9d9;
}

.status-danger {
  color: #f5222d;
  background: #fff1f0;
  border: 1px solid #ffa39e;
}

/* Toggle switch */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #bfbfbf;
  transition: 0.2s;
  border-radius: 22px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}

.switch input:checked + .slider {
  background-color: #1677ff;
}

.switch input:checked + .slider:before {
  transform: translateX(18px);
}

/* Actions */
.actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.action-link {
  background: none;
  border: none;
  color: #1677ff;
  cursor: pointer;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
}

.action-link:hover {
  color: #4096ff;
  text-decoration: underline;
}

.action-link.danger {
  color: #ff4d4f;
}

.action-link.danger:hover {
  color: #ff7875;
}

.action-link.primary {
  font-weight: 500;
}

/* Pagination */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
  color: #595959;
  font-size: 14px;
}

.page-size select {
  height: 32px;
  padding: 0 8px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  outline: none;
  background: #fff;
  cursor: pointer;
}

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #d9d9d9;
  background: #fff;
  color: #595959;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
  color: #1677ff;
  border-color: #1677ff;
}

.page-btn.active {
  background: #1677ff;
  color: #fff;
  border-color: #1677ff;
}

.page-btn:disabled {
  color: #bfbfbf;
  cursor: not-allowed;
}

.page-btn.ellipsis {
  border-color: transparent;
  cursor: default;
}

.jump {
  display: flex;
  align-items: center;
  gap: 8px;
}

.jump input {
  width: 48px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  outline: none;
  text-align: center;
}

.jump input:focus {
  border-color: #1677ff;
  box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.15);
}

/* Toast */
.toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  z-index: 1000;
}

.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: #d9d9d9;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #bfbfbf;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* 用户悬浮导航菜单 */
.user-menu { position: relative; }
.user-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 170px;
  padding: 14px 8px 8px;
  background: transparent;
  border: none;
  box-shadow: none;
  z-index: 1000;
}
.user-dropdown::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 14px;
}
.user-dropdown::after {
  content: "";
  position: absolute;
  top: 14px; left: 8px; right: 8px; bottom: 8px;
  background: #fff;
  border: 1px solid #f0f0f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15,45,110,0.12);
  z-index: 0;
}
.user-menu:hover .user-dropdown { display: block; }
.user-dropdown .dropdown-item {
  position: relative;
  z-index: 1;
  display: block;
  padding: 9px 14px;
  color: #334155;
  font-size: 15px;
  text-decoration: none;
  border-radius: 6px;
  white-space: nowrap;
}
.user-dropdown .dropdown-item:hover { background: #f1f5f9; color: #1677ff; }
.user-dropdown .dropdown-divider { position: relative; z-index: 1; height: 1px; background: #f0f0f0; margin: 6px 6px; }
.user-dropdown .dropdown-item-danger { color: #e11d48; }
.user-dropdown .dropdown-item-danger:hover { background: #fef2f2; color: #be123c; }

/* ===== 新增/编辑平台弹窗 ===== */
.platform-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.platform-dialog {
  width: 960px;
  max-width: calc(100vw - 48px);
  max-height: 90vh;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.platform-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid #f0f0f0;
}
.platform-dialog-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
}
.platform-close {
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
}
.platform-close:hover { background: #f1f5f9; color: #475569; }

.platform-dialog-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

/* 步骤条 */
.p-stepbar {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
}
.p-step {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #94a3b8;
  font-size: 14px;
}
.p-step-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #eef2f7;
  color: #94a3b8;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 13px;
  transition: all .2s;
}
.p-step.active { color: #1677ff; }
.p-step.active .p-step-num { background: #1677ff; color: #fff; }
.p-step.done { color: #16a34a; }
.p-step.done .p-step-num { background: #dcfce7; color: #16a34a; }
.p-step-line {
  width: 80px; height: 2px; background: #e5e7eb; margin: 0 14px;
}

.p-section { display: flex; flex-direction: column; gap: 16px; }
.p-field { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.p-field label { font-size: 13px; color: #475569; font-weight: 500; }
.p-field .req { color: #ef4444; margin-right: 2px; }
.p-field-row { display: flex; gap: 16px; }
.p-field-row .p-field { flex: 1; }
.p-hint { margin: 4px 0 0; font-size: 12px; color: #94a3b8; }

.p-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; height: 38px; }
.p-switch input { display: none; }
.p-switch-slider {
  width: 42px; height: 22px; background: #cbd5e1; border-radius: 22px; position: relative; transition: .2s;
}
.p-switch-slider::before {
  content: ""; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.p-switch input:checked + .p-switch-slider { background: #1677ff; }
.p-switch input:checked + .p-switch-slider::before { transform: translateX(20px); }
.p-switch-text { font-size: 13px; color: #475569; }

/* 维度 Tab */
.p-tabs { display: flex; gap: 4px; border-bottom: 1px solid #f0f0f0; margin-bottom: 16px; flex-wrap: wrap; }
.p-tab {
  border: none; background: transparent; padding: 9px 14px; font-size: 14px;
  color: #64748b; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.p-tab:hover { color: #1677ff; }
.p-tab.on { color: #1677ff; border-bottom-color: #1677ff; font-weight: 600; }

.p-dim { display: flex; flex-direction: column; gap: 10px; }
.p-chip-list { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; padding-right: 4px; }
.p-chip-grid { flex-wrap: wrap; flex-direction: row; }
.p-chip-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.p-chip-input { flex: 1; min-width: 0; }
.p-chip-grid .p-chip-input { flex: 0 0 120px; }
.p-chip-sub { flex: 0 0 260px; }
.p-amt { flex: 0 0 120px !important; }
.p-mon { flex: 0 0 120px !important; }
.p-num { flex: 0 0 140px; }
.p-unit { color: #94a3b8; font-size: 13px; white-space: nowrap; }
.p-btn-danger {
  border: 1px solid #fecaca; background: #fef2f2; color: #dc2626;
  padding: 7px 12px; border-radius: 8px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.p-btn-danger:hover { background: #fee2e2; }
.p-add-btn { align-self: flex-start; }

.p-block {
  border: 1px solid #f0f0f0; border-radius: 10px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px; background: #fafbfc;
}
.p-block-head { display: flex; gap: 8px; align-items: center; }

.p-rule-box {
  border: 1px solid #f0f0f0; border-radius: 10px; padding: 12px;
  display: flex; flex-direction: column; gap: 8px; background: #fafbfc;
}
.p-formula { margin: 0; font-size: 13px; color: #334155; line-height: 1.6; }
.p-error { margin: 0; font-size: 12px; color: #dc2626; }

.p-check-sm { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: #475569; white-space: nowrap; cursor: pointer; }
.p-check-line { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #334155; cursor: pointer; }
.p-inline { display: flex; align-items: center; gap: 8px; }
.p-inline-wrap { flex-wrap: wrap; gap: 8px 14px; }
.p-textarea { resize: vertical; min-height: 70px; font-family: inherit; }

.platform-dialog-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 24px; border-top: 1px solid #f0f0f0; background: #fafbfc;
}
.fade-enter-active, .fade-leave-active { transition: opacity .2s; }
.fade-enter-from, .fade-leave-to { opacity: 0; }

/* 弹窗内输入框（限定作用域，不影响列表页搜索框） */
.platform-dialog .form-input,
.platform-dialog input.form-input {
  height: 34px; padding: 0 11px; border: 1px solid #d9d9d9; border-radius: 8px;
  font-size: 13px; outline: none; transition: border-color .2s, box-shadow .2s; width: auto;
}
.platform-dialog .form-input:focus,
.platform-dialog input.form-input:focus { border-color: #1677ff; box-shadow: 0 0 0 3px rgba(22,119,255,.12); }
.platform-dialog textarea.form-input { height: auto; padding: 8px 11px; }