:root {
  --bt-bg: #f0f3f8;
  --bt-accent: #3b82f6;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  margin: 0;
  height: 100%;
  min-height: 100%;
}

body {
  background: var(--bt-bg);
  color: #1e293b;
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.18), transparent 42%),
    radial-gradient(circle at bottom left, rgba(14, 165, 233, 0.14), transparent 40%),
    linear-gradient(160deg, #e8eef8 0%, #f5f7fb 45%, #eef2f7 100%);
}

.login-card {
  width: min(420px, 100%);
}

.login-card .brand-title {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.login-card .brand-sub {
  margin: 0 0 22px;
  color: #64748b;
  font-size: 13px;
}

.app-shell {
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

.app-header {
  height: auto !important;
  padding: 0;
  background: #fff !important;
  border-bottom: 1px solid #e2e8f0;
}

.app-header-bar {
  display: grid;
  grid-template-columns: minmax(96px, 1fr) auto minmax(96px, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 20px;
  border-bottom: 1px solid #eef2f7;
}

.logo {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 96px;
  margin-right: 0;
  line-height: 1.2;
  justify-self: start;
  align-self: center;
}

.logo strong {
  color: #0f172a;
  font-size: 16px;
}

.logo span {
  color: #94a3b8;
  font-size: 11px;
}

.top-menu {
  --el-menu-horizontal-height: 34px;
  flex: 0 0 auto;
  min-width: 0;
  height: 34px !important;
  justify-self: center;
  align-self: center;
  display: flex !important;
  align-items: center !important;
  justify-content: center;
  border-bottom: none !important;
  background: transparent !important;
}

/* 顶栏菜单项压矮：选中高亮是小胶囊，并与顶栏垂直居中 */
.top-menu .el-menu-item,
.top-menu.el-menu--horizontal > .el-menu-item {
  height: 34px !important;
  line-height: 34px !important;
  margin: 0 2px !important;
  padding: 0 12px !important;
  border-radius: 8px !important;
  border-bottom: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center;
}

.top-menu .el-menu-item.is-active {
  border-bottom-color: transparent !important;
  color: var(--el-color-primary) !important;
}

.app-header-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  align-items: center;
  align-self: center;
  margin-left: 0;
  justify-self: end;
}

.theme-switch-btn {
  min-width: 96px;
}

.page-title {
  padding: 14px 22px 12px;
}

.page-title h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
}

.page-title .header-desc {
  margin: 2px 0 0;
  color: #64748b;
  font-size: 12px;
}

.app-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  /* 列表页内容距视口底部约 40px */
  padding: 18px 22px 40px;
}

/* 带 page-fill-card 的页面：主区不滚动，卡片铺满到底部留白 */
.app-main:has(.page-fill-card) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.page-fill-card.el-card {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: flex !important;
  flex-direction: column;
}

.page-fill-card > .el-card__body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page-fill-card .toolbar-row {
  flex: 0 0 auto;
}

.page-table-host {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.page-fill-card .table-footer {
  flex: 0 0 auto;
  margin-top: 12px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric-card .metric-label {
  color: #64748b;
  font-size: 13px;
}

.metric-card .metric-value {
  margin-top: 10px;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  color: #0f172a;
}

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.toolbar-row .el-input,
.toolbar-row .el-select {
  width: 220px;
}

.toolbar-row .threads-input,
.toolbar-row .page-size-input {
  width: 130px;
}

.virtual-list-card .el-card__body {
  display: flex;
  flex-direction: column;
  min-height: 560px;
}

.virtual-table-wrap {
  flex: 1;
  min-height: 420px;
  height: calc(100vh - 320px);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  position: relative;
}

/* AutoResizer must fill the wrap; otherwise height stays 0 and TableV2 never mounts */
.virtual-table-wrap .el-auto-resizer {
  width: 100%;
  height: 100%;
}

.mono {
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 12px;
}

.copy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  align-items: center;
  margin-top: 4px;
}

.copy-actions .el-button {
  padding: 0;
  height: auto;
  font-size: 12px;
}

.job-logs {
  max-height: 320px;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.job-logs li {
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 13px;
  line-height: 1.45;
}

.card-gap {
  margin-bottom: 14px;
}

/* 开通 Team：三列操作卡拉开间距，卡内勾选/按钮不贴死 */
.team-open-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  align-items: stretch;
}

/* 优惠码模式：左卡头 / 右开通 */
.team-open-action-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.team-open-action-grid > .el-card {
  min-width: 0;
}

.team-open-action-grid > .el-card .el-card__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.team-open-action-grid .el-checkbox {
  margin-right: 0;
  height: auto;
  align-items: flex-start;
}

.team-open-action-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.team-open-action-desc {
  margin: 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
}

.team-open-action-hint {
  margin: 0;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 1100px) {
  .team-open-action-grid {
    grid-template-columns: 1fr;
  }
}

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

.ops-toolbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ops-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.ops-label {
  color: #64748b;
  font-size: 13px;
  min-width: 96px;
}

.ops-log-card {
  min-height: calc(100vh - 320px);
}

.ops-log-split {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
  gap: 12px;
  align-items: stretch;
}

.ops-log-pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ops-log-pane-title {
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

.ops-log-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 460px);
  max-height: calc(100vh - 300px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #0b1220;
  color: #dbe7ff;
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
  scroll-behavior: auto;
}

@media (max-width: 1100px) {
  .ops-log-split {
    grid-template-columns: 1fr;
  }
  .ops-log-panel {
    min-height: 240px;
    max-height: 42vh;
  }
}

.ops-log-empty {
  color: #64748b;
  padding: 24px 8px;
}

.ops-log-line {
  flex: 0 0 auto;
  padding: 2px 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.ops-log-line:first-child {
  color: #f8fafc;
}

.mother-relogin-dialog.el-dialog {
  width: min(1040px, calc(100vw - 24px)) !important;
  margin-top: 3vh !important;
}

/* 弹窗 body 限高，空间列表在内部滚动，避免 16+ 空间被裁切且看不到滚动条 */
.mother-relogin-dialog .el-dialog__body {
  max-height: calc(100vh - 140px);
  overflow: hidden;
  padding-top: 10px;
  padding-bottom: 6px;
}

.mother-relogin-split {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(300px, 1.2fr);
  gap: 14px;
  height: calc(100vh - 160px);
  max-height: calc(100vh - 160px);
  min-height: min(480px, calc(100vh - 160px));
  overflow: hidden;
}

.mother-relogin-log-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.mother-relogin-log-title {
  margin-bottom: 8px;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
}

.mother-relogin-log-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 200px;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #0b1220;
  color: #dbe7ff;
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
}

.mother-relogin-log-empty {
  color: #64748b;
  padding: 24px 8px;
}

.mother-relogin-log-line {
  flex: 0 0 auto;
  padding: 2px 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.mother-relogin-log-line:first-child {
  color: #f8fafc;
}

.mother-relogin-main {
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mother-relogin-meta {
  margin: 0 0 10px;
  color: #334155;
  line-height: 1.6;
}

.mother-relogin-progress {
  color: #64748b;
  margin-left: 8px;
}

.mother-relogin-hint {
  margin: 0 0 12px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.55;
}

.mother-relogin-status {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  font-size: 13px;
}

.mother-relogin-spaces-head {
  flex: 0 0 auto;
  margin: 0 0 8px;
  color: #64748b;
  font-size: 12px;
}

/* 独立滚动容器：避免 el-radio-group 撑破弹窗导致底部空间看不见 */
.mother-relogin-spaces-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  scrollbar-gutter: stable;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.mother-relogin-spaces {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}

.mother-relogin-space-item {
  margin: 0 !important;
  height: auto !important;
  padding: 10px 12px !important;
  width: 100%;
}

.mother-relogin-space-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.4;
}

.mother-relogin-space-id {
  font-size: 12px;
  color: #64748b;
}

.mother-relogin-dialog .el-loading-text {
  font-family: Consolas, "Cascadia Mono", monospace !important;
  font-size: 14px !important;
  color: #0f172a !important;
  max-width: 280px;
  line-height: 1.5;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .mother-relogin-split {
    grid-template-columns: 1fr;
  }
}

.proxy-group-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
}

.proxy-group-item:hover {
  border-color: #93c5fd;
}

.proxy-group-item.active {
  border-color: #3b82f6;
  background: #eff6ff;
}

@media (max-width: 1100px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-main > div[style*="grid-template-columns:280px"] {
    grid-template-columns: 1fr !important;
  }

  .app-header-bar {
    display: flex;
    flex-wrap: wrap;
    padding: 8px 14px;
  }

  .logo {
    justify-self: auto;
  }

  .top-menu {
    order: 3;
    width: 100%;
    overflow-x: auto;
    justify-self: auto;
    justify-content: flex-start;
  }

  .app-header-actions {
    margin-left: auto;
    justify-self: auto;
  }
}

@media (max-width: 768px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .app-main {
    padding: 14px;
  }

  .page-title {
    padding: 12px 14px 8px;
  }

  .toolbar-row .el-input,
  .toolbar-row .el-select {
    width: 100%;
  }

  .app-header-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
}
