/* 沧岚靖宇 · 山河无恙风格后台 */
@import url('../css/dark-mode.css');

:root {
  --font: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;

  --page: #f0f2f5;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --ink: #303133;
  --ink-muted: #606266;
  --ink-subtle: #909399;
  --accent: #409eff;
  --accent-hover: #337ecc;
  --accent-soft: #ecf5ff;
  --success: #67c23a;
  --warning: #e6a23c;
  --danger: #f56c6c;
  --purple: #9b59b6;
  --border: #ebeef5;
  --border-light: #f2f6fc;

  --sidebar-w: 220px;
  --sidebar-collapsed: 64px;
  --header-h: 50px;
  --tabs-h: 40px;

  --radius: 4px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.04);

  --el-color-primary: #409eff;
  --el-color-primary-light-3: #79bbff;
  --el-color-primary-light-5: #a0cfff;
  --el-color-primary-light-7: #c6e2ff;
  --el-color-primary-light-9: #ecf5ff;
  --el-color-primary-dark-2: #337ecc;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  background: var(--page);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  transition: width 0.2s ease;
  z-index: 10;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-logo {
  height: var(--header-h);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-logo-mark {
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.brand-logo {
  object-fit: contain;
  border-radius: 50%;
  flex-shrink: 0;
  display: block;
}

.brand-logo--sidebar {
  width: 32px;
  height: 32px;
}

.brand-logo--login {
  width: 96px;
  height: 96px;
}

.brand-logo--auth {
  width: 80px;
  height: 80px;
  margin: 0 auto 12px;
}

.brand-logo--console {
  width: 40px;
  height: 40px;
}

.sidebar-logo-text { overflow: hidden; }
.sidebar.collapsed .sidebar-logo-text { display: none; }

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

.menu-item {
  position: relative;
  padding: 0 16px;
  height: 46px;
  margin-bottom: 2px;
  cursor: pointer;
  color: var(--ink-muted);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: color 0.15s, background 0.15s;
}

.menu-item:hover { color: var(--accent); background: var(--accent-soft); }

.menu-item.active {
  color: var(--accent);
  background: var(--accent-soft);
}

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

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

.menu-icon svg { width: 18px; height: 18px; }

.sidebar.collapsed .menu-label,
.sidebar.collapsed .sidebar-agent-title,
.sidebar.collapsed .menu-link-text,
.sidebar.collapsed .menu-link-arrow,
.sidebar.collapsed .sidebar-footer span { display: none; }

.sidebar.collapsed .menu-item { justify-content: center; padding: 0; }
.sidebar.collapsed .menu-item.active::before { top: 0; bottom: 0; }

.sidebar-agent {
  padding: 8px 0 12px;
  border-top: 1px solid var(--border);
}

.sidebar-agent-title {
  padding: 8px 16px 4px;
  font-size: 12px;
  color: var(--ink-subtle);
}

.menu-item.menu-link { height: auto; min-height: 44px; padding-top: 8px; padding-bottom: 8px; }

.menu-link-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.3;
  overflow: hidden;
}

.menu-link-text small {
  font-size: 11px;
  color: var(--ink-subtle);
}

.menu-link-arrow { font-size: 12px; color: var(--ink-subtle); }

.menu-group { margin-bottom: 2px; }

.menu-group-head {
  user-select: none;
}

.menu-group-head .menu-label { flex: 1; }

.menu-group-arrow {
  width: 14px;
  height: 14px;
  color: var(--ink-subtle);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.menu-group-head.expanded .menu-group-arrow {
  transform: rotate(180deg);
}

.menu-sub {
  overflow: hidden;
}

.menu-sub-item {
  height: 40px;
  padding-left: 44px;
  font-size: 13px;
}

.menu-sub-item::before { display: none; }

.menu-sub-item.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.sidebar.collapsed .menu-group-arrow,
.sidebar.collapsed .menu-sub { display: none; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--ink-subtle);
}

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

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

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

.icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  color: var(--ink-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover { background: var(--page); color: var(--accent); }

.icon-btn svg { width: 18px; height: 18px; }

.header-breadcrumb {
  font-size: 13px;
  color: var(--ink-subtle);
  margin-left: 4px;
}

.header-breadcrumb strong { color: var(--ink); font-weight: 500; }

.user-dropdown {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s;
}

.user-dropdown:hover { background: var(--page); }

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.user-avatar.has-img,
.welcome-avatar.has-img,
.profile-avatar.has-img {
  background: var(--border-light);
}

.user-avatar img,
.welcome-avatar img,
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-chevron {
  width: 14px;
  height: 14px;
  color: var(--ink-subtle);
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  color: var(--ink-muted);
}

/* ── Header notifications ── */
.notify-btn {
  position: relative;
}

.notify-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
  pointer-events: none;
}

.notify-panel-inner {
  margin: -12px;
}

.notify-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
}

.notify-panel-head strong {
  font-size: 14px;
  color: var(--ink);
}

.notify-mark-read {
  border: none;
  background: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.notify-list {
  max-height: 280px;
  overflow-y: auto;
}

.notify-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.15s;
}

.notify-item:hover {
  background: var(--page);
}

.notify-item-title {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.4;
  margin-bottom: 4px;
}

.notify-item-meta {
  font-size: 11px;
  color: var(--ink-subtle);
}

.notify-empty {
  padding: 28px 14px;
  text-align: center;
  color: var(--ink-subtle);
  font-size: 13px;
}

.notify-panel-foot {
  padding: 10px 14px;
  border-top: 1px solid var(--border-light);
  text-align: center;
}

.notify-panel-foot button {
  border: none;
  background: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
}

/* ── Profile center ── */
.profile-layout {
  max-width: 880px;
}

.profile-card {
  overflow: hidden;
}

.profile-hero {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.profile-avatar-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 32px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border-light);
}

.profile-avatar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.profile-avatar-hint {
  margin: 0;
  text-align: center;
}

.profile-summary h3 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
}

.profile-summary p {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--ink-subtle);
}

.profile-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.profile-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-stat .label {
  font-size: 12px;
  color: var(--ink-subtle);
}

.profile-stat .value {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.profile-form {
  max-width: 520px;
}

@media (max-width: 768px) {
  .profile-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Tab bar ── */
.tab-bar {
  height: var(--tabs-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  padding: 0 12px;
  gap: 4px;
  overflow-x: auto;
  flex-shrink: 0;
}

.tab-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  min-width: 88px;
  height: 32px;
  font-size: 13px;
  color: var(--ink-muted);
  background: var(--page);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.tab-item:hover { color: var(--accent); }

.tab-item.active {
  color: var(--accent);
  background: var(--surface);
  border-color: var(--border);
  position: relative;
  z-index: 1;
}

.tab-close {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  color: var(--ink-subtle);
}

.tab-close:hover { background: var(--border); color: var(--danger); }

.content {
  flex: 1;
  overflow: auto;
  padding: 16px;
  background: var(--page);
}

/* ── Cards ── */
.box-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 24px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
}

/* ── Welcome banner ── */
.welcome-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 20px 24px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.welcome-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.welcome-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 22px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.welcome-text h3 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.welcome-text p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-subtle);
}

.welcome-notice {
  flex: 1;
  min-width: 200px;
  max-width: 480px;
  padding: 10px 14px;
  background: #fdf6ec;
  border: 1px solid #faecd8;
  border-radius: var(--radius);
  font-size: 13px;
  color: #e6a23c;
  line-height: 1.5;
}

/* ── Stat grid ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
}

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

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

.stat-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.badge-blue { background: #ecf5ff; color: #409eff; }
.badge-green { background: #f0f9eb; color: #67c23a; }
.badge-orange { background: #fdf6ec; color: #e6a23c; }
.badge-purple { background: #f4ecf7; color: #9b59b6; }
.badge-red { background: #fef0f0; color: #f56c6c; }
.badge-gray { background: #f4f4f5; color: #909399; }

.stat-value {
  font-size: 26px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

/* ── Dashboard bottom ── */
.dash-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 16px 20px;
  min-height: 280px;
}

.panel-head {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.timeline { position: relative; padding-left: 4px; }

.timeline-item {
  position: relative;
  padding: 0 0 20px 20px;
  border-left: 2px solid var(--border);
  margin-left: 6px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
}

.timeline-dot.pin { background: var(--danger); }
.timeline-dot.update { background: var(--accent); }
.timeline-dot.notice { background: var(--warning); }

.timeline-tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 2px;
  margin-right: 6px;
}

.tag-pin { background: #fef0f0; color: #f56c6c; }
.tag-update { background: #ecf5ff; color: #409eff; }
.tag-notice { background: #fdf6ec; color: #e6a23c; }

.timeline-title {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.5;
  margin-bottom: 4px;
}

.timeline-date {
  font-size: 12px;
  color: var(--ink-subtle);
}

.timeline-empty {
  text-align: center;
  padding: 40px 0;
  color: var(--ink-subtle);
  font-size: 13px;
}

.chart-wrap {
  height: 220px;
  display: flex;
  align-items: flex-end;
  padding-top: 8px;
}

.trend-chart {
  width: 100%;
  height: 100%;
}

.trend-chart polyline {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.trend-chart .area {
  fill: url(#chartGradient);
  opacity: 0.3;
}

.trend-chart circle {
  fill: var(--accent);
  stroke: #fff;
  stroke-width: 2;
}

.trend-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  color: var(--ink-subtle);
}

/* ── Login ── */
.login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--page);
  padding: 24px;
}

.login-box {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 36px 32px;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 24px;
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
}

.login-brand-name {
  margin: 14px 0 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-align: center;
  color: var(--ink);
}

.login-box h1:not(.login-brand-name) {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
}

.login-box .sub {
  text-align: center;
  color: var(--ink-subtle);
  font-size: 13px;
  margin-bottom: 24px;
}

.login-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-subtle);
}

.login-footer a { color: var(--accent); text-decoration: none; }
.login-footer a:hover { text-decoration: underline; }

/* legacy login split - portal */
.login-brand { display: none; }
.login-panel { width: 100%; display: flex; justify-content: center; }

/* ── Boot ── */
.boot-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--page);
}

.boot-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utilities ── */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
}

.meta { color: var(--ink-subtle); font-size: 13px; }

.page-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-wrap: wrap;
}

.page-toolbar h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.page-desc {
  margin: -8px 0 16px;
  font-size: 13px;
  color: var(--ink-subtle);
  line-height: 1.6;
}

.money { font-variant-numeric: tabular-nums; }

/* ── Tables ── */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.table-wrap .el-table {
  width: 100%;
  --el-table-border-color: var(--border);
}

.table-wrap .el-table .cell {
  line-height: 22px;
  padding: 0 8px;
  word-break: keep-all;
  overflow-wrap: normal;
}

.table-wrap .el-table td.el-table__cell,
.table-wrap .el-table th.el-table__cell {
  padding: 12px 8px;
  overflow: hidden;
}

.table-wrap .el-table__header th.el-table__cell .cell {
  white-space: nowrap;
}

.table-wrap .el-table__header th.el-table__cell {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--ink-muted);
  font-size: 13px;
}

/* 固定列宽表格（空数据时也保持布局） */
.table-wrap.table-fixed {
  min-height: 280px;
  overflow-x: auto;
}

.table-wrap.table-fixed .el-table {
  width: 100%;
}

.table-wrap.table-fixed .el-table table {
  table-layout: fixed !important;
  width: 100% !important;
}

.table-wrap.table-fixed .el-table .cell {
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-wrap.table-fixed .el-table th.el-table__cell,
.table-wrap.table-fixed .el-table td.el-table__cell {
  overflow: hidden;
}

.table-wrap.table-fixed .el-table__empty-block {
  min-height: 200px;
  width: 100% !important;
}

.table-wrap.table-fixed .el-table__empty-text {
  padding: 80px 0;
  color: var(--ink-subtle);
  font-size: 14px;
  white-space: nowrap;
}

/* 宽表格横向滚动（列宽总和超出容器时） */
.table-wrap.table-scroll {
  overflow-x: auto;
}

.table-wrap.table-scroll .el-table {
  min-width: 820px;
}

.table-wrap.table-scroll-wide .el-table {
  min-width: 1040px;
}

.table-wrap.table-scroll-api .el-table {
  min-width: 980px;
}

/* CSS Grid 表格 — 空数据时列也不会塌缩 */
.grid-table {
  min-width: var(--grid-table-min, 1070px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow-x: auto;
}

.grid-table-head,
.grid-table-row {
  display: grid;
  grid-template-columns: var(--grid-cols);
  align-items: stretch;
  min-width: var(--grid-table-min, 1070px);
}

.grid-table-head {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--ink-muted);
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.grid-table-head > div,
.grid-table-row > div {
  padding: 12px 10px;
  border-right: 1px solid var(--border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  min-height: 46px;
}

.grid-table-head > div:last-child,
.grid-table-row > div:last-child {
  border-right: none;
}

.grid-table-head .col-center,
.grid-table-row .col-center {
  justify-content: center;
  text-align: center;
}

.grid-table-row {
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.grid-table-row:nth-child(even) {
  background: var(--surface-2);
}

.grid-table-row:last-child {
  border-bottom: none;
}

.grid-table-empty {
  min-width: var(--grid-table-min, 1070px);
  text-align: center;
  color: var(--ink-subtle);
  font-size: 14px;
  padding: 72px 12px;
  border-top: 1px solid var(--border);
}

.grid-table .col-wrap-inner {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  word-break: break-word;
  line-height: 1.5;
  width: 100%;
}

.ann-grid-table {
  --grid-table-min: 1070px;
  --grid-cols: 70px 200px minmax(280px, 1fr) 90px 170px 140px;
}

/* 管理后台原生表格 — 空数据时也保持列宽 */
.admin-native-wrap {
  overflow-x: auto;
  min-height: 240px;
}

.admin-native-table {
  width: 100%;
  min-width: var(--table-min-width, 960px);
  table-layout: fixed;
}

.admin-native-table th,
.admin-native-table td {
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-native-table tbody tr:nth-child(even):not(:only-child) {
  background: var(--surface-2);
}

.admin-native-table .admin-table-empty {
  text-align: center;
  color: var(--ink-subtle);
  font-size: 14px;
  padding: 72px 12px;
  white-space: normal;
}

.admin-native-table .col-wrap-cell {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 系统错误日志 */
.error-log-wrap {
  overflow-x: auto;
  min-height: 280px;
}

.error-log-table {
  --table-min-width: 1404px;
  width: 1404px;
  min-width: 1404px;
  table-layout: fixed;
}

.error-log-table th,
.error-log-table td {
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.error-log-table tbody tr:nth-child(even):not(:only-child) {
  background: var(--surface-2);
}

.error-log-table .error-log-empty,
.error-log-table .admin-table-empty {
  text-align: center;
  color: var(--ink-subtle);
  font-size: 14px;
  padding: 72px 12px;
  white-space: normal;
}

.error-log-table .col-msg {
  max-width: 300px;
}

.error-probe-panel {
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.error-probe-panel .api-doc-pre {
  margin: 10px 0 0;
  max-height: 220px;
  overflow: auto;
}

.error-detail-dialog {
  width: min(720px, 92vw) !important;
  max-width: 720px;
}

.error-detail-dialog .el-message-box__message {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  max-height: 60vh;
  overflow: auto;
  text-align: left;
}

/* 表格内表单控件 */
.table-wrap .el-input-number {
  width: 120px;
}

.table-wrap .el-input-number .el-input__wrapper {
  padding-left: 8px;
  padding-right: 8px;
}

.cell-empty { color: var(--ink-subtle); }

.field-with-action {
  display: flex;
  gap: 8px;
  width: 100%;
}

.field-with-action .el-input { flex: 1; }

/* 全宽拉伸表格：列横排、贴边、随页面宽度伸缩 */
.table-wrap.table-stretch {
  width: 100%;
  max-width: 100%;
}

.table-wrap.table-stretch .el-table {
  width: 100% !important;
  max-width: 100%;
}

.table-wrap.table-stretch .el-table__inner-wrapper,
.table-wrap.table-stretch .el-table__header-wrapper,
.table-wrap.table-stretch .el-table__body-wrapper {
  width: 100% !important;
}

.table-wrap.table-stretch .el-table table {
  width: 100% !important;
  table-layout: fixed !important;
}

.table-wrap.table-stretch .el-table thead {
  display: table-header-group !important;
}

.table-wrap.table-stretch .el-table tbody {
  display: table-row-group !important;
}

.table-wrap.table-stretch .el-table tr {
  display: table-row !important;
}

.table-wrap.table-stretch .el-table th.el-table__cell,
.table-wrap.table-stretch .el-table td.el-table__cell {
  display: table-cell !important;
}

.table-wrap.table-stretch .el-table .cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-wrap.table-stretch .el-table .col-wrap .cell {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* 原生文档表格（接口状态码等） */
.data-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--surface);
}

.data-table th,
.data-table td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  line-height: 1.5;
}

.data-table thead th {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--ink-muted);
  white-space: nowrap;
}

.data-table .col-center { text-align: center; }

.data-table .col-body code {
  display: block;
  font-size: 11px;
  word-break: break-all;
  white-space: pre-wrap;
  color: var(--ink);
}

.table-wrap.table-plain {
  border: none;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

/* ── API 管理 ── */
.api-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.api-url {
  flex: 1;
  font-size: 13px;
  color: var(--accent);
  word-break: break-all;
}

.api-auth-box {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.api-auth-box code {
  margin-left: 12px;
  font-size: 13px;
  color: var(--ink);
}

.api-method {
  display: inline-block;
  min-width: 48px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.api-method.m-get { background: #ecf5ff; color: #409eff; }
.api-method.m-post { background: #f0f9eb; color: #67c23a; }
.api-method.m-put { background: #fdf6ec; color: #e6a23c; }
.api-method.m-delete { background: #fef0f0; color: #f56c6c; }
.api-method.m-hdr { background: #f4f4f5; color: #909399; }

#addDialog .el-dialog__body { max-height: 75vh; overflow: auto; }

.el-button--primary {
  --el-button-bg-color: var(--accent);
  --el-button-border-color: var(--accent);
  --el-button-hover-bg-color: var(--accent-hover);
  --el-button-hover-border-color: var(--accent-hover);
}

@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-bottom { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(var(--sidebar-w), 82vw) !important;
    transform: translateX(-100%);
    z-index: 1001;
    transition: transform 0.25s ease;
    box-shadow: none;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  }

  .sidebar.collapsed {
    width: min(var(--sidebar-w), 82vw) !important;
  }

  .sidebar.collapsed .menu-label,
  .sidebar.collapsed .sidebar-logo-text,
  .sidebar.collapsed .sidebar-footer span,
  .sidebar.collapsed .menu-group-arrow,
  .sidebar.collapsed .menu-sub {
    display: initial;
  }

  .sidebar.collapsed .menu-sub { display: block; }

  .mobile-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    -webkit-tap-highlight-color: transparent;
  }

  .main {
    width: 100%;
  }

  .header {
    position: relative;
    z-index: 2;
    padding: 0 10px;
  }

  .header-left {
    flex: 1;
    min-width: 0;
  }

  .header-breadcrumb {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 42vw;
  }

  .header-balance {
    display: none;
  }

  .icon-btn,
  .menu-toggle-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .user-chevron { display: none; }

  .content {
    padding: 12px;
  }

  .tab-bar {
    padding: 0 8px;
  }

  .tab-item {
    min-width: 72px;
    padding: 0 12px;
  }

  .stat-grid { grid-template-columns: 1fr; }
  .welcome-notice { max-width: none; }
  .user-name { display: none; }

  .box-card {
    padding: 16px;
  }

  .table-wrap.table-fixed .el-table {
    min-width: 640px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .boot-spinner { animation: none; border-top-color: var(--accent); }
}

/* ── Theme toggle ── */
.theme-float-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

/* ── Dark theme ── */
[data-theme="dark"] {
  --page: #0f0f0f;
  --surface: #1a1a1a;
  --surface-2: #242424;
  --ink: #e5e5e5;
  --ink-muted: #b8b8b8;
  --ink-subtle: #8a8a8a;
  --accent-soft: #1a3050;
  --border: #333333;
  --border-light: #2a2a2a;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.45), 0 4px 12px rgba(0, 0, 0, 0.25);

  color-scheme: dark;
}

[data-theme="dark"] .welcome-notice {
  background: #2b2111;
  border-color: #4a3a1a;
  color: #e6a23c;
}

[data-theme="dark"] .badge-blue { background: #1a3050; color: #79bbff; }
[data-theme="dark"] .badge-green { background: #1a3318; color: #85ce61; }
[data-theme="dark"] .badge-orange { background: #2b2111; color: #eebe77; }
[data-theme="dark"] .badge-purple { background: #2a1f33; color: #b37feb; }
[data-theme="dark"] .badge-red { background: #331818; color: #f89898; }
[data-theme="dark"] .badge-gray { background: #2a2a2a; color: #a8abb2; }

[data-theme="dark"] .tag-pin { background: #331818; color: #f89898; }
[data-theme="dark"] .tag-update { background: #1a3050; color: #79bbff; }
[data-theme="dark"] .tag-notice { background: #2b2111; color: #eebe77; }

[data-theme="dark"] .api-method.m-get { background: #1a3050; color: #79bbff; }
[data-theme="dark"] .api-method.m-post { background: #1a3318; color: #85ce61; }
[data-theme="dark"] .api-method.m-put { background: #2b2111; color: #eebe77; }
[data-theme="dark"] .api-method.m-delete { background: #331818; color: #f89898; }
[data-theme="dark"] .api-method.m-hdr { background: #2a2a2a; color: #a8abb2; }

[data-theme="dark"] .portal-api-pre,
[data-theme="dark"] .api-doc-pre {
  background: #0a0a0a;
  color: #d4d4d4;
  border: 1px solid var(--border);
}

[data-theme="dark"] .portal-api-section-head strong,
[data-theme="dark"] .api-doc-title,
[data-theme="dark"] .api-doc-section h4,
[data-theme="dark"] .api-doc-section-head h4 {
  color: var(--ink);
}

[data-theme="dark"] .api-docs-nav {
  background: var(--surface-2);
  border-color: var(--border);
}

[data-theme="dark"] .api-docs-nav-head {
  background: var(--surface);
  border-color: var(--border);
}

[data-theme="dark"] .api-docs-group-title,
[data-theme="dark"] .api-docs-item-meta,
[data-theme="dark"] .api-doc-sub,
[data-theme="dark"] .api-docs-empty {
  color: var(--ink-subtle);
}

[data-theme="dark"] .api-docs-item-name,
[data-theme="dark"] .api-doc-kv dd {
  color: var(--ink);
}

[data-theme="dark"] .api-docs-item:hover {
  background: var(--page);
}

[data-theme="dark"] .api-docs-item.active {
  background: var(--accent-soft);
}

[data-theme="dark"] .api-docs-content {
  background: var(--surface);
  border-color: var(--border);
}

[data-theme="dark"] .api-doc-url {
  background: var(--surface-2);
}

[data-theme="dark"] .api-doc-kv dt {
  color: var(--ink-muted);
}

[data-theme="dark"] .trend-chart circle {
  stroke: var(--surface);
}

[data-theme="dark"] .el-table {
  --el-table-bg-color: var(--surface);
  --el-table-tr-bg-color: var(--surface);
  --el-table-header-bg-color: var(--surface-2);
  --el-table-row-hover-bg-color: var(--surface-2);
  --el-table-text-color: var(--ink);
  --el-table-header-text-color: var(--ink-muted);
  --el-fill-color-blank: var(--surface);
}

[data-theme="dark"] .el-dialog,
[data-theme="dark"] .el-message-box {
  --el-dialog-bg-color: var(--surface);
  --el-bg-color: var(--surface);
}

[data-theme="dark"] .el-input__wrapper,
[data-theme="dark"] .el-textarea__inner,
[data-theme="dark"] .el-select__wrapper {
  background-color: var(--surface-2);
  box-shadow: 0 0 0 1px var(--border) inset;
}

[data-theme="dark"] .el-descriptions__body {
  background: var(--surface);
}

[data-theme="dark"] .el-descriptions__label {
  background: var(--surface-2);
  color: var(--ink-muted);
}

[data-theme="dark"] .el-descriptions__content {
  color: var(--ink);
}

[data-theme="dark"] .portal-api-meta {
  color: var(--ink-subtle) !important;
}

/* ── 全屏溯源水印 ── */
.security-watermark {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  pointer-events: none;
  user-select: none;
  background-repeat: repeat;
  background-size: 300px 200px;
  background-position: 0 0;
}
