/* 左右布局的策略组外壳，以及管理登录 / 状态页 */
body.shell-body, body.shell-page {
  margin: 0;
  min-height: 100vh;
  background: #f4f1ea;
  color: #1f1b16;
  font-family: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.shell-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: #1f3b4d;
  color: #fff;
}
.shell-brand { font-weight: 700; }
.shell-nav { display: flex; gap: 12px; align-items: center; }
.shell-nav a { color: #fff; }
body.shell-body {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.shell-body .shell-top { flex: 0 0 auto; }
.shell-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 0;
  flex: 1 1 auto;
  height: auto;
  overflow: hidden;
}
.group-sidebar {
  background: #fff;
  border-right: 1px solid #d9d0c4;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}
.group-sidebar h2 { margin: 0 0 8px; font-size: 16px; }
.group-totals {
  flex: 0 0 auto;
  border: 1px solid #e4ddd3;
  border-radius: 8px;
  padding: 8px;
  background: #faf8f4;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.group-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
}
.group-total-row strong { font-variant-numeric: tabular-nums; }
.group-total-row strong.pos { color: #067647; }
.group-total-row strong.neg { color: #b42318; }
.group-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; min-height: 0; overflow: auto; }
.group-item {
  border: 1px solid #e4ddd3;
  border-radius: 8px;
  padding: 8px;
  background: #faf8f4;
  cursor: pointer;
}
.group-item.active { border-color: #1f3b4d; background: #e8f0f4; }
.group-item .group-name { font-weight: 600; }
.group-item .group-pnl {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}
.group-item .group-pnl span { color: #6b6258; }
.group-item .group-pnl strong { font-variant-numeric: tabular-nums; margin-left: 4px; }
.group-item .group-pnl strong.pos { color: #067647; }
.group-item .group-pnl strong.neg { color: #b42318; }
.group-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.group-flags span {
  font-size: 12px;
  background: #eee;
  border-radius: 999px;
  padding: 1px 6px;
}
.group-flags .on { background: #d7f0d7; }
.group-flags .warn { background: #fbe3c6; }
.group-create { display: flex; flex-direction: column; gap: 6px; }
.group-create input { padding: 6px 8px; }
.workspace {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#group-workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#group-workspace .top,
#group-workspace .bottom-tabs { flex: 0 0 auto; }
#group-workspace .bottom {
  flex: 1 1 auto;
  min-height: 0;
}
#group-workspace .strategy-form { flex: 0 0 auto; }
#group-workspace .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
#group-workspace .tab-pane {
  flex: 1 1 auto;
  min-height: 0;
}
.workspace.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b6258;
  padding: 32px;
}
.restart-note { padding: 12px 16px 0; color: #6b6258; font-size: 13px; }
.login-box {
  max-width: 420px;
  margin: 12vh auto;
  background: #fff;
  padding: 28px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
}
.login-box form { display: flex; flex-direction: column; gap: 12px; }
.login-box label { display: flex; flex-direction: column; gap: 4px; }
.status-main { padding: 20px 24px; }
.status-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.status-card { background: #fff; padding: 16px; border-radius: 10px; }
.group-sidebar-toggle {
  flex: 0 0 auto;
  width: 100%;
  text-align: center;
}

.shell-layout.is-group-sidebar-collapsed {
  grid-template-columns: 48px 1fr;
}

.shell-layout.is-group-sidebar-collapsed .group-sidebar {
  padding: 8px 2px;
  gap: 0;
  overflow: hidden;
}

.shell-layout.is-group-sidebar-collapsed .group-sidebar > h2,
.shell-layout.is-group-sidebar-collapsed #group-create-form,
.shell-layout.is-group-sidebar-collapsed #group-totals,
.shell-layout.is-group-sidebar-collapsed #group-list {
  display: none;
}

.shell-layout.is-group-sidebar-collapsed .group-sidebar-toggle {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 0.2em;
  width: 100%;
  min-width: 40px;
  box-sizing: border-box;
  padding: 12px 0;
  white-space: nowrap;
  line-height: 1.3;
}

@media (max-width: 960px) {
  .shell-layout,
  .shell-layout.is-group-sidebar-collapsed {
    grid-template-columns: 1fr;
  }
}

.admin-password-success {
  position: fixed;
  top: 56px;
  right: 16px;
  background: #1f3b4d;
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  z-index: 30;
  box-shadow: 0 8px 24px rgba(0,0,0,.16);
}

.shell-toast {
  position: fixed;
  top: 56px;
  right: 16px;
  background: #1f3b4d;
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  z-index: 30;
  box-shadow: 0 8px 24px rgba(0,0,0,.16);
}
