* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #2F3597;
  --primary-light: #eef0fb;
  --primary-hover: #252b7a;
  --sidebar-bg: #fff;
  --rail-bg: #1e2240;
  --border: #e8e8e8;
  --text: #333;
  --text-secondary: #666;
  --text-muted: #999;
  --white: #fff;
  --orange: #fa8c16;
  --success: #52c41a;
  --warning: #faad14;
  --danger: #ff4d4f;
  --info: #1890ff;
  --page-bg: #f0f2f5;
  --label-bg: #fafafa;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--page-bg);
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* 左侧图标栏（对齐现网） */
.icon-rail {
  width: 56px;
  background: var(--rail-bg);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 4px;
  z-index: 2;
}

.icon-rail .rail-logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: linear-gradient(135deg, #f5a623 50%, var(--primary) 50%);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.icon-rail .rail-item {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.55);
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
}

.icon-rail .rail-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.icon-rail .rail-item.active { background: var(--primary); color: #fff; }

.sidebar {
  width: 180px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.logo-icon { display: none; }

.sidebar-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.nav-item { display: none; }
.nav-icon { display: none; }

.nav-group-title {
  padding: 14px 16px 6px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-sub-item {
  display: block;
  padding: 9px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  position: relative;
  transition: color 0.15s, background 0.15s;
}

.nav-sub-item:hover {
  color: var(--primary);
  background: var(--primary-light);
  text-decoration: none;
}

.nav-sub-item.active {
  color: var(--primary);
  font-weight: 500;
  background: var(--primary-light);
}

.nav-sub-item.active::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  background: var(--primary);
  border-radius: 2px 0 0 2px;
}

.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--page-bg);
}

.top-header {
  height: 56px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.header-search {
  display: flex;
  align-items: center;
  background: #f5f5f5;
  border-radius: 4px;
  padding: 6px 12px;
  width: 280px;
  gap: 8px;
  color: var(--text-muted);
}

.header-search input {
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  font-size: 13px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-select {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.page-content {
  flex: 1;
  padding: 16px 24px 24px;
  overflow: auto;
}

.page-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.filter-bar {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px 20px 6px;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 16px;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.filter-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.filter-select, .filter-input {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 13px;
  min-width: 140px;
  height: 32px;
  color: var(--text);
  background: var(--white);
}

.filter-input { min-width: 160px; }

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-left: auto;
  margin-bottom: 8px;
  padding-top: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 16px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
  gap: 4px;
  height: 32px;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-default {
  background: var(--white);
  color: var(--text);
  border-color: var(--border);
}
.btn-default:hover { border-color: var(--primary); color: var(--primary); }

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  padding: 0 4px;
  cursor: pointer;
  font-size: 13px;
  height: auto;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }
.btn-lg { padding: 8px 24px; font-size: 14px; height: auto; }
.btn-sm { padding: 2px 10px; font-size: 12px; height: 28px; }

.table-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.table-card.table-scroll { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: #fafafa;
  padding: 11px 12px;
  text-align: left;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafafa; }

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 2px;
  font-size: 12px;
  line-height: 20px;
}
.tag-default { background: #f5f5f5; color: var(--text-secondary); }
.tag-blue { background: #e6f7ff; color: #1890ff; }
.tag-green { background: #f6ffed; color: #52c41a; }
.tag-orange { background: #fff7e6; color: #fa8c16; }
.tag-red { background: #fff1f0; color: #ff4d4f; }
.tag-purple { background: #f9f0ff; color: #722ed1; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 16px;
  gap: 8px;
  border-top: 1px solid var(--border);
}
.page-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.page-btn.active {
  border-color: var(--primary);
  color: var(--primary);
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}
.detail-header .page-title { margin-bottom: 0; }

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.info-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px 20px;
}

.info-card-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  position: relative;
  padding-left: 10px;
}
.info-card-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 2px;
  width: 3px;
  height: 14px;
  background: var(--primary);
  border-radius: 1px;
}

.info-row {
  display: flex;
  margin-bottom: 10px;
  font-size: 13px;
}
.info-label {
  width: 120px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.info-value { color: var(--text); }

.stats-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  margin-bottom: 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.stat-card {
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 14px 16px;
  text-align: left;
}
.stat-card:last-child { border-right: none; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.stat-value { font-size: 16px; font-weight: 600; color: var(--text); }
.stat-value.highlight { color: var(--primary); }

.section-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
  position: relative;
  padding-left: 10px;
}
.section-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 3px;
  width: 3px;
  height: 14px;
  background: var(--primary);
  border-radius: 1px;
}

.footer-actions {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 20px;
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--white);
  border-radius: 4px;
  width: 640px;
  max-width: 90vw;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}
.modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header-actions { display: flex; align-items: center; gap: 8px; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.modal.modal-wide { width: 92vw; max-width: 960px; }

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; color: var(--text); margin-bottom: 6px; }
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
}
.form-textarea { min-height: 80px; resize: vertical; }
.form-readonly {
  background: #fafafa;
  padding: 12px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
}
.form-readonly-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
}
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-item { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.upload-area {
  border: 1px dashed var(--border);
  border-radius: 4px;
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
}
.upload-area:hover { border-color: var(--primary); color: var(--primary); }
.modal-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.font-medium { font-weight: 500; }
.diff-negative { color: var(--danger); }
.diff-positive { color: var(--success); }
.diff-zero { color: var(--text-muted); }

/* 现网键值表 */
.legacy-detail-wrap {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 0 20px;
  margin-bottom: 12px;
}
.legacy-kv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.legacy-kv-table th {
  width: 160px;
  background: var(--label-bg);
  color: var(--text-secondary);
  font-weight: normal;
  text-align: left;
  padding: 12px 16px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.legacy-kv-table td {
  padding: 12px 16px;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--white);
}
.legacy-section-title {
  font-size: 14px;
  font-weight: 600;
  padding: 16px 20px 12px;
  color: var(--text);
  position: relative;
  padding-left: 30px;
}
.legacy-section-title::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 19px;
  width: 3px;
  height: 14px;
  background: var(--primary);
  border-radius: 1px;
}
.legacy-status-line {
  padding: 16px 20px 8px;
  font-size: 14px;
}
.legacy-status-line .ok { color: var(--success); font-weight: 500; }
.legacy-status-line .wait { color: var(--warning); font-weight: 500; }

/* Index */
.index-page {
  max-width: 960px;
  margin: 48px auto;
  padding: 32px 40px;
  background: white;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.index-page h1 { font-size: 22px; margin-bottom: 8px; color: var(--primary); }
.index-page > p { color: var(--text-secondary); margin-bottom: 24px; }
.index-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.index-card {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
}
.index-card:hover { border-color: var(--primary); }
.index-card h3 { font-size: 15px; margin-bottom: 6px; }
.index-card p { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.index-card .links { display: flex; flex-direction: column; gap: 4px; }
.index-card .links a { font-size: 13px; }

/* 兼容旧组件 */
.timeline { position: relative; padding-left: 4px; }
.timeline-item { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 18px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: white;
  flex-shrink: 0;
  margin-top: 2px;
  z-index: 1;
}
.timeline-item.done .timeline-dot { border-color: var(--primary); background: var(--primary); }
.timeline-item.active .timeline-dot {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px var(--primary-light);
}
.timeline-content { flex: 1; }
.timeline-title { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.timeline-meta { font-size: 12px; color: var(--text-muted); }

.period-adjust-notice {
  background: #fff7e6;
  border: 1px solid #ffd591;
  border-radius: 4px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #d46b08;
  line-height: 1.6;
}

.period-diff-preview {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--primary-light);
  border: 1px solid #d6daf5;
  border-radius: 4px;
}
.period-diff-preview-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 10px;
}
.period-diff-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 16px;
  font-size: 12px;
}
.period-diff-item {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
}
.period-diff-item strong { color: var(--text); font-weight: 600; }

.bill-detail-top { margin-bottom: 16px; }
.bill-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.bill-detail-back:hover { color: var(--primary); text-decoration: none; }
.bill-detail-title {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}
.bill-detail-meta {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.bill-detail-toolbar {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.bill-section-label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

.export-columns-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.export-column-tag {
  display: inline-block;
  padding: 4px 10px;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.process-banner {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px 20px;
  margin-bottom: 16px;
}
.process-steps { display: flex; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.process-step { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.process-step .step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}
.process-arrow { margin: 0 8px; color: var(--text-muted); font-size: 12px; }
.process-rules { font-size: 12px; color: var(--text-muted); line-height: 1.8; }
.process-rules li { margin-left: 16px; }
