/* 多账户策略工具 — 与 MWordStar 配色联动，支持深色模式 */
.strategy-tool-page {
  --st-accent: #20c997;
  --st-accent-soft: rgba(32, 201, 151, 0.12);
  --st-surface: #fff;
  --st-surface-2: #f4f6f8;
  --st-surface-inset: #fafbfc;
  --st-border: rgba(0, 0, 0, 0.08);
  --st-divider: #e9ecef;
  --st-text: #212529;
  --st-text-muted: #6c757d;
  --st-text-label: #495057;
  --st-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --st-radius: 10px;
  --st-input-bg: #fff;
  --st-input-color: #212529;
  --st-input-border: #ced4da;
}

.primary-color .strategy-tool-page { --st-accent: #007bff; --st-accent-soft: rgba(0, 123, 255, 0.12); }
.info-color .strategy-tool-page { --st-accent: #17a2b8; --st-accent-soft: rgba(23, 162, 184, 0.12); }
.success-color .strategy-tool-page { --st-accent: #28a745; --st-accent-soft: rgba(40, 167, 69, 0.12); }

.dark-color .strategy-tool-page {
  --st-accent: #3dd6b5;
  --st-accent-soft: rgba(61, 214, 181, 0.15);
  --st-surface: #2a2a2a;
  --st-surface-2: #232323;
  --st-surface-inset: #1e1e1e;
  --st-border: hsla(0, 0%, 100%, 0.1);
  --st-divider: hsla(0, 0%, 100%, 0.12);
  --st-text: hsla(0, 0%, 100%, 0.92);
  --st-text-muted: hsla(0, 0%, 100%, 0.55);
  --st-text-label: hsla(0, 0%, 100%, 0.78);
  --st-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  --st-input-bg: #121212;
  --st-input-color: hsla(0, 0%, 100%, 0.9);
  --st-input-border: hsla(0, 0%, 100%, 0.22);
}

.strategy-tool-page .content-area > .mwordstar-block {
  margin-bottom: 0;
}

/* ---------- 页头 ---------- */
.strategy-tool-page .st-page-intro {
  border-bottom: 1px solid var(--st-divider);
}

.strategy-tool-page .st-page-intro .entry-title {
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--st-text);
}

.strategy-tool-page .st-page-desc {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--st-text-muted) !important;
}

.dark-color .strategy-tool-page .st-page-intro .entry-title {
  color: hsla(0, 0%, 100%, 0.95);
}

/* ---------- 顶栏工具条 ---------- */
.st-toolbar-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  background: var(--st-surface-2);
  border: 1px solid var(--st-border);
  border-radius: var(--st-radius);
}

.st-toolbar-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.st-btn-icon {
  font-weight: 700;
  margin-right: 0.15rem;
}

.st-count-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--st-accent);
  background: var(--st-accent-soft);
  border-radius: 999px;
}

/* ---------- 账户卡片 ---------- */
.st-accounts-wrap {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.st-account-card {
  border: 1px solid var(--st-border);
  border-radius: var(--st-radius);
  background: var(--st-surface);
  box-shadow: var(--st-shadow);
  overflow: hidden;
  color: var(--st-text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.st-account-card::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--st-accent), transparent);
}

.st-account-card.st-invalid {
  border-color: #dc3545;
  box-shadow: 0 0 0 1px rgba(220, 53, 69, 0.25);
}

.st-account-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 1.15rem;
  background: var(--st-surface-2);
  border-bottom: 1px solid var(--st-divider);
}

.st-account-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.st-account-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  background: var(--st-accent);
  border-radius: 8px;
  flex-shrink: 0;
}

.st-account-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--st-text);
}

.st-remove-account {
  color: #dc3545 !important;
  font-weight: 500;
  text-decoration: none !important;
  padding: 0.15rem 0.5rem !important;
}

.st-remove-account:hover {
  color: #c82333 !important;
  text-decoration: underline !important;
}

.st-account-body {
  padding: 1.15rem;
}

.st-field {
  margin-bottom: 1.1rem;
}

.st-field:last-child {
  margin-bottom: 0;
}

.st-field label,
.st-field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.02em;
  margin-bottom: 0.4rem;
  color: var(--st-text-label);
}

/* ---------- 操盘方案胶囊 ---------- */
.st-plan-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.st-plan-pill {
  margin: 0;
  cursor: pointer;
}

.st-plan-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.st-plan-pill span {
  display: block;
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--st-text);
  background: var(--st-surface-inset);
  border: 1px solid var(--st-border);
  border-radius: 999px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.st-plan-pill:hover span {
  border-color: var(--st-accent);
}

.st-plan-pill input:checked + span {
  color: #fff;
  background: var(--st-accent);
  border-color: var(--st-accent);
  box-shadow: 0 2px 8px var(--st-accent-soft);
}

/* ---------- 策略表格 ---------- */
.st-rows-block {
  margin-top: 0.25rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--st-divider);
}

.st-table-wrap {
  border: 1px solid var(--st-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--st-surface-inset);
}

.st-rows-table {
  width: 100%;
  font-size: 0.875rem;
  margin-bottom: 0 !important;
  color: var(--st-text);
}

.st-rows-table thead th {
  padding: 0.55rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.03em;
  color: var(--st-text-label);
  background: var(--st-surface-2);
  border-color: var(--st-divider) !important;
  white-space: nowrap;
}

.st-rows-table tbody td {
  padding: 0.5rem 0.45rem;
  vertical-align: middle;
  border-color: var(--st-divider) !important;
}

.st-rows-table .form-control-sm {
  min-width: 5.5rem;
  font-size: 0.85rem;
  border-radius: 6px;
}

.st-col-action,
.st-row-actions {
  width: 2.5rem;
  text-align: center;
}

.st-del-row {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  line-height: 1;
  font-size: 1.1rem;
  border-radius: 6px !important;
  color: var(--st-text-muted) !important;
  background: var(--st-surface-2) !important;
  border: 1px solid var(--st-border) !important;
}

.st-del-row:hover:not(:disabled) {
  color: #dc3545 !important;
  border-color: #dc3545 !important;
  background: rgba(220, 53, 69, 0.08) !important;
}

/* ---------- 表单控件 ---------- */
.strategy-tool-page .form-control,
.strategy-tool-page select.form-control {
  background-color: var(--st-input-bg);
  color: var(--st-input-color);
  border-color: var(--st-input-border);
}

.strategy-tool-page .form-control:focus,
.strategy-tool-page select.form-control:focus {
  border-color: var(--st-accent);
  box-shadow: 0 0 0 0.2rem var(--st-accent-soft);
}

.st-account-errors {
  margin: 0.85rem 0 0;
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  color: #dc3545;
  background: rgba(220, 53, 69, 0.08);
  border: 1px solid rgba(220, 53, 69, 0.25);
  border-radius: 8px;
  list-style: none;
}

.st-account-errors li + li {
  margin-top: 0.25rem;
}

.st-empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  background: var(--st-surface-2);
  border: 1px dashed var(--st-border);
  border-radius: var(--st-radius);
}

.st-empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--st-text);
}

/* ---------- 导出 / 预览面板 ---------- */
.st-panel {
  margin-top: 1.25rem;
  padding: 1rem 1.15rem;
  background: var(--st-surface);
  border: 1px solid var(--st-border);
  border-radius: var(--st-radius);
  box-shadow: var(--st-shadow);
  color: var(--st-text);
}

.st-panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--st-text);
  margin-bottom: 0.75rem;
}

.st-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--st-divider);
}

.st-panel-head .st-panel-title {
  margin-bottom: 0;
}

.st-panel-hint {
  color: var(--st-text-muted) !important;
}

.st-actions-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.st-actions-btns .btn {
  font-weight: 500;
}

.st-status-msg {
  margin-top: 0.65rem !important;
  min-height: 1.25em;
  color: var(--st-text-muted) !important;
}

#st-status-msg.st-ok {
  color: #28a745 !important;
}

#st-status-msg.st-err {
  color: #dc3545 !important;
}

.st-preview-body {
  min-height: 140px;
  max-height: 70vh;
  overflow: auto;
  padding: 1rem;
  background: var(--st-surface-inset);
  border: 1px solid var(--st-border);
  border-radius: 8px;
}

.st-preview-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  text-align: center;
  color: var(--st-text-muted);
  font-size: 0.9rem;
}

.st-preview-panel .st-preview-body.post-content {
  font-size: 0.95rem;
}

/* ---------- 深色：主按钮必须高对比（避免与背景融在一起） ---------- */
.dark-color .strategy-tool-page #st-add-account.btn-primary,
.dark-color .strategy-tool-page .st-toolbar-panel .btn-primary {
  color: #fff !important;
  background-color: var(--st-accent) !important;
  border-color: var(--st-accent) !important;
  box-shadow: 0 2px 10px var(--st-accent-soft);
}

.dark-color .strategy-tool-page #st-add-account.btn-primary:hover:not(:disabled),
.dark-color .strategy-tool-page .st-toolbar-panel .btn-primary:hover:not(:disabled) {
  color: #fff !important;
  filter: brightness(1.1);
}

.dark-color .strategy-tool-page #st-add-account.btn-primary:disabled {
  opacity: 0.55;
  color: #fff !important;
}

.dark-color .strategy-tool-page #st-generate.btn-success,
.dark-color .strategy-tool-page .st-actions-btns .btn-success {
  color: #fff !important;
  background-color: #2ebe6b !important;
  border-color: #2ebe6b !important;
  box-shadow: 0 2px 12px rgba(46, 190, 107, 0.45);
}

.dark-color .strategy-tool-page #st-generate.btn-success:hover:not(:disabled),
.dark-color .strategy-tool-page .st-actions-btns .btn-success:hover:not(:disabled) {
  color: #fff !important;
  background-color: #27a85c !important;
  border-color: #27a85c !important;
}

.dark-color .strategy-tool-page .btn-outline-secondary {
  color: hsla(0, 0%, 100%, 0.85);
  border-color: hsla(0, 0%, 100%, 0.4);
  background-color: transparent;
}

.dark-color .strategy-tool-page .btn-outline-secondary:hover {
  color: #212529;
  background-color: #f8f9fa;
  border-color: #f8f9fa;
}

.dark-color .strategy-tool-page .btn-outline-primary {
  color: #7ec8ff;
  border-color: #7ec8ff;
  background-color: transparent;
}

.dark-color .strategy-tool-page .btn-outline-primary:hover:not(:disabled) {
  color: #fff !important;
  background-color: #007bff !important;
  border-color: #007bff !important;
}

.dark-color .strategy-tool-page .btn-outline-primary:disabled {
  opacity: 0.45;
  color: hsla(0, 0%, 100%, 0.35) !important;
  border-color: hsla(0, 0%, 100%, 0.2) !important;
}

.dark-color .strategy-tool-page .strategy-tool-preview .post-content,
.dark-color .strategy-tool-page .st-preview-panel .post-content {
  --md-text: hsla(0, 0%, 100%, 0.87);
  --md-text-muted: hsla(0, 0%, 100%, 0.6);
  --md-heading: hsla(0, 0%, 100%, 0.95);
  --md-border: hsla(0, 0%, 100%, 0.15);
  --md-code-bg: #2d2d2d;
  --md-table-stripe: #2d2d2d;
}

/* ---------- 响应式：小屏表格卡片化 ---------- */
@media (max-width: 767.98px) {
  .st-toolbar-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .st-toolbar-panel #st-reset-all {
    width: 100%;
  }

  .st-plan-pill span {
    font-size: 0.8rem;
    padding: 0.4rem 0.65rem;
  }

  .st-rows-table thead {
    display: none;
  }

  .st-rows-table tbody tr {
    display: block;
    padding: 0.65rem;
    margin-bottom: 0.5rem;
    background: var(--st-surface);
    border: 1px solid var(--st-border);
    border-radius: 8px;
  }

  .st-rows-table tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border: none !important;
  }

  .st-rows-table tbody td::before {
    content: attr(data-label);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--st-text-label);
    flex-shrink: 0;
  }

  .st-rows-table tbody td.st-row-actions {
    justify-content: flex-end;
    padding-top: 0.5rem;
  }

  .st-rows-table tbody td.st-row-actions::before {
    display: none;
  }

  .st-rows-table .form-control-sm {
    flex: 1;
    min-width: 0;
  }

  .st-table-wrap {
    border: none;
    background: transparent;
  }

  .st-actions-btns .btn {
    flex: 1 1 auto;
    min-width: calc(50% - 0.25rem);
  }
}

@media (min-width: 992px) {
  .strategy-tool-page .sidebar {
    margin-top: 0;
  }

  .st-preview-body {
    max-height: 55vh;
  }
}
