/* ============================================================
   布局与组件样式
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: var(--fs-base);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ---------- Element Plus 主题覆盖 ---------- */
:root {
  --el-color-primary: var(--c-primary);
  --el-color-primary-light-3: #a294f5;
  --el-color-primary-light-5: #bcb0f8;
  --el-color-primary-light-7: #d6cdfb;
  --el-color-primary-light-8: #e3ddfc;
  --el-color-primary-light-9: var(--c-primary-light-2);
  --el-color-primary-dark-2: var(--c-primary-hover);
  --el-border-radius-base: var(--r-md);
  --el-font-size-base: var(--fs-base);
  --el-text-color-primary: var(--c-text);
  --el-text-color-regular: var(--c-text-2);
  --el-border-color-lighter: var(--c-border);
  --el-fill-color-light: var(--c-surface-2);
}

/* ---------- 登录页 ---------- */
.login-container {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #6a55e8 0%, #7c68f0 40%, #9d8bf5 100%);
  overflow: hidden;
}
.login-container::before,
.login-container::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .07);
}
.login-container::before { width: 520px; height: 520px; top: -180px; right: -140px; }
.login-container::after { width: 380px; height: 380px; bottom: -130px; left: -110px; }

.login-box {
  position: relative;
  z-index: 1;
  width: 880px;
  max-width: 92vw;
  min-height: 440px;
  display: flex;
  background: var(--c-surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-xl);
  overflow: hidden;
}
.login-left {
  flex: 1;
  position: relative;
  background: linear-gradient(145deg, #5b46d6 0%, #7c68f0 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 40px;
  color: #fff;
}
.login-left h2 { font-size: var(--fs-2xl); font-weight: 600; margin-bottom: 14px; letter-spacing: 1px; }
.login-left p { font-size: var(--fs-base); opacity: .82; line-height: 1.8; }
.login-left .feat { margin-top: 28px; display: flex; flex-direction: column; gap: 12px; }
.login-left .feat span { font-size: var(--fs-sm); opacity: .9; display: flex; align-items: center; gap: 8px; }
.login-left .feat span::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .85);
}
.login-right {
  width: 400px;
  padding: 56px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-right .title {
  font-size: var(--fs-xl);
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: 32px;
}
.login-right .field { margin-bottom: 20px; }
.login-right .field label {
  display: block;
  font-size: var(--fs-sm);
  color: var(--c-text-2);
  margin-bottom: 8px;
}
.login-right .el-input__inner { height: 42px; }
.login-right .submit { width: 100%; height: 42px; font-size: var(--fs-md); margin-top: 8px; }
.login-right .tip { margin-top: 18px; font-size: var(--fs-xs); color: var(--c-text-3); text-align: center; }

/* ---------- 后台框架 ---------- */
.layout { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  transition: width var(--dur) var(--ease);
  overflow: hidden;
}
.layout.collapsed .sidebar { width: var(--sidebar-collapsed-w); }

.sidebar-logo {
  height: var(--header-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface);
}
.sidebar-logo .mark {
  width: 34px; height: 34px;
  flex-shrink: 0;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--c-primary) 0%, #9d8bf5 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--fs-md);
}
.sidebar-logo .name {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.layout.collapsed .sidebar-logo .name { display: none; }

.sidebar-menu { flex: 1; overflow-y: auto; padding: 12px 0; }
.layout.collapsed .sidebar-menu { padding: 12px 0; }

.menu-group-title {
  padding: 14px 24px 8px;
  font-size: var(--fs-xs);
  color: var(--c-text-4);
  letter-spacing: .5px;
}
.layout.collapsed .menu-group-title { display: none; }

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 24px;
  color: var(--c-text);
  font-size: var(--fs-base);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  position: relative;
}
.menu-item:hover { background: var(--c-surface-2); color: var(--c-primary); }
.menu-item.active {
  background: var(--c-primary-light);
  color: var(--c-primary);
  font-weight: 500;
}
.menu-item .ico { width: 20px; flex-shrink: 0; display: flex; justify-content: center; font-size: 17px; }
.layout.collapsed .menu-item { padding: 0; justify-content: center; }
.layout.collapsed .menu-item .txt { display: none; }

.sidebar-foot {
  padding: 14px 24px;
  border-top: 1px solid var(--c-border);
  font-size: var(--fs-xs);
  color: var(--c-text-4);
}
.layout.collapsed .sidebar-foot { text-align: center; padding: 14px 0; }
.layout.collapsed .sidebar-foot .txt { display: none; }

/* ---------- 主区 ---------- */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.header {
  height: var(--header-h);
  flex-shrink: 0;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--content-pad);
  gap: var(--sp-4);
}
.header-left { display: flex; align-items: center; gap: var(--sp-4); }
.collapse-btn {
  width: 34px; height: 34px;
  border: none; background: transparent;
  border-radius: var(--r-md);
  color: var(--c-text-2);
  cursor: pointer;
  font-size: 19px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur) var(--ease);
}
.collapse-btn:hover { background: var(--c-surface-2); color: var(--c-primary); }
.header-title { font-size: var(--fs-lg); font-weight: 600; color: var(--c-text); }
.header-right { display: flex; align-items: center; gap: var(--sp-3); }
.header-right .item {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  color: var(--c-text-2);
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.header-right .item:hover { background: var(--c-surface-2); color: var(--c-primary); }
.header-right .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-primary) 0%, #9d8bf5 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-sm); font-weight: 600;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: var(--content-pad);
}
.content-inner { max-width: 1600px; margin: 0 auto; }

/* ---------- 页面标题 ---------- */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-5);
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.page-head h2 { font-size: var(--fs-xl); font-weight: 600; color: var(--c-text); margin-bottom: 6px; }
.page-head .desc { font-size: var(--fs-sm); color: var(--c-text-3); }
.page-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* ---------- 统计卡片 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 20px;
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.stat-card:hover { box-shadow: var(--sh-md); transform: translateY(-1px); }
.stat-card .label {
  font-size: var(--fs-sm);
  color: var(--c-text-3);
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.stat-card .value {
  font-size: var(--fs-2xl);
  font-weight: 600;
  color: var(--c-text);
  line-height: 1.2;
  font-family: var(--font-mono);
}
.stat-card .value .unit { font-size: var(--fs-md); font-weight: 400; color: var(--c-text-3); margin-left: 4px; }
.stat-card .foot { margin-top: 10px; font-size: var(--fs-xs); color: var(--c-text-3); }
.stat-card.accent { border-left: 3px solid var(--c-primary); }
.stat-card.success { border-left: 3px solid var(--c-success); }
.stat-card.warning { border-left: 3px solid var(--c-warning); }
.stat-card.danger { border-left: 3px solid var(--c-danger); }

/* ---------- 工具栏 ---------- */
.toolbar {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  margin-bottom: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.toolbar .el-input { width: 220px; }
.toolbar .el-select { width: 160px; }
.toolbar .spacer { flex: 1; }

/* 工具栏内的单选按钮组:选中态克制,与输入框同层级 */
.toolbar .el-radio-button__inner {
  padding: 7px 14px;
  font-size: var(--fs-base);
  border-color: var(--c-border-2);
  background: var(--c-surface);
  color: var(--c-text-2);
  box-shadow: none;
}
.toolbar .el-radio-button__original-radio:checked + .el-radio-button__inner {
  background: var(--c-primary-light);
  border-color: var(--c-primary-border);
  color: var(--c-primary);
  box-shadow: none;
}
.toolbar .el-radio-button:first-child .el-radio-button__inner { border-radius: var(--r-md) 0 0 var(--r-md); }
.toolbar .el-radio-button:last-child .el-radio-button__inner { border-radius: 0 var(--r-md) var(--r-md) 0; }
.toolbar .el-radio-button__inner:hover { color: var(--c-primary); }

/* ---------- 表格容器 ---------- */
.table-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.table-card .el-table { font-size: var(--fs-base); color: var(--c-text-2); }
.table-card .el-table th.el-table__cell {
  background: #f0f0f0;
  color: var(--c-text);
  font-weight: 700;
  font-size: var(--fs-base);
}
.table-card .el-table th.el-table__cell .cell { color: var(--c-text); }
.table-card .el-table td.el-table__cell { font-size: var(--fs-base); }
.table-card .el-table .el-table__row--striped td.el-table__cell { background: #fafafc; }
.table-card .el-table__row:hover > td.el-table__cell { background: var(--c-primary-light) !important; }
.table-card .el-table .cell { line-height: 1.5; }

.table-foot {
  display: flex;
  justify-content: flex-end;
  padding: var(--sp-4);
  border-top: 1px solid var(--c-border);
}

/* ---------- 单元格内的次级信息 ---------- */
.cell-main { color: var(--c-text); font-weight: 500; }
.cell-sub { color: var(--c-text-3); font-size: var(--fs-xs); margin-top: 3px; }
.mono { font-family: var(--font-mono); letter-spacing: .3px; }
.money { font-family: var(--font-mono); color: var(--c-danger); font-weight: 600; }
.money.in { color: var(--c-success); }

/* ---------- 操作按钮组 ---------- */
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions .el-button { margin: 0; }

/* ---------- 空状态 ---------- */
.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--c-text-3);
  font-size: var(--fs-sm);
}
.empty .ico { font-size: 44px; margin-bottom: 12px; opacity: .35; }

/* ---------- 弹窗内的表单 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- 生成结果 ---------- */
.gen-result {
  background: #f7f7fa;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  max-height: 300px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  line-height: 1.9;
  color: var(--c-text-2);
  word-break: break-all;
}

/* ---------- 详情描述列表 ---------- */
.desc-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 24px; }
.desc-list .item { display: flex; gap: 10px; font-size: var(--fs-base); }
.desc-list .item .k { color: var(--c-text-3); flex-shrink: 0; width: 88px; }
.desc-list .item .v { color: var(--c-text); word-break: break-all; }

/* ---------- 折线图 ---------- */
.chart-box { width: 100%; height: 260px; }
.chart-box svg { width: 100%; height: 100%; display: block; }

/* ---------- 标签 ---------- */
.tag-soft {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  font-weight: 500;
  border: 1px solid transparent;
}
.tag-soft.purple { background: var(--c-primary-light-2); color: var(--c-primary); border-color: var(--c-primary-border); }
.tag-soft.green { background: var(--c-success-bg); color: var(--c-success); border-color: var(--c-success-border); }
.tag-soft.orange { background: var(--c-warning-bg); color: var(--c-warning); border-color: var(--c-warning-border); }
.tag-soft.red { background: var(--c-danger-bg); color: var(--c-danger); border-color: var(--c-danger-border); }
.tag-soft.gray { background: #f4f4f5; color: var(--c-text-3); border-color: var(--c-border-2); }
.tag-soft.blue { background: var(--c-info-bg); color: var(--c-info); border-color: var(--c-info-border); }

/* ---------- 公告卡片 ---------- */
.notice-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-3);
}
.notice-card h3 { font-size: var(--fs-md); font-weight: 600; color: var(--c-text); margin-bottom: 10px; }
.notice-card .body { font-size: var(--fs-base); color: var(--c-text-2); line-height: 1.9; white-space: pre-wrap; }
.notice-card .meta { font-size: var(--fs-xs); color: var(--c-text-4); margin-top: 12px; }
.notice-card .body.clamped {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- 登录页适配小屏 ---------- */
@media (max-width: 720px) {
  .login-left { display: none; }
  .login-right { width: 100%; padding: 40px 28px; }
  .content { padding: var(--sp-4); }
  :root { --content-pad: 16px; }
  .desc-list, .form-grid { grid-template-columns: 1fr; }
}

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d0d4dc; border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: #b8bdc7; }
::-webkit-scrollbar-track { background: transparent; }
