/**
 * 景策基金全天候睿波策略管理系统 — 统一主题
 * 部署个性化：仅需修改下方 :root 变量，全站页面同步换肤。
 * 可选：替换 static/tech-bg.svg 作为背景图。
 */
:root {
  /* 背景 */
  --theme-bg: #050a12;
  --theme-bg-gradient-end: #151d2a;
  --theme-overlay-top: rgba(5, 10, 18, 0.55);
  --theme-overlay-mid: rgba(5, 15, 35, 0.85);
  --theme-overlay-bottom: rgba(3, 8, 16, 0.92);
  --theme-modal-scrim: rgba(0, 0, 0, 0.65);

  /* 面板与边框 */
  --theme-panel: rgba(12, 24, 42, 0.72);
  --theme-panel-soft: rgba(12, 24, 42, 0.55);
  --theme-panel-solid: #1a2332;
  --theme-panel-input: rgba(15, 23, 42, 0.8);
  --theme-panel-input-solid: #0f1826;
  --theme-border: rgba(56, 189, 248, 0.18);
  --theme-border-strong: rgba(56, 189, 248, 0.25);
  --theme-border-muted: rgba(148, 163, 184, 0.35);

  /* 文字 */
  --theme-text: #e8f0ff;
  --theme-text-soft: #e2e8f0;
  --theme-text-heading: #f1f5f9;
  --theme-muted: #94a3b8;
  --theme-muted-dim: #64748b;
  --theme-link: #93c5fd;
  --theme-link-hover: #bae6fd;
  --theme-heading-accent: #bae6fd;

  /* 品牌强调色 */
  --theme-accent: #38bdf8;
  --theme-accent-dim: #0ea5e9;
  --theme-accent-deep: #2563eb;
  --theme-accent-glow: rgba(56, 189, 248, 0.28);
  --theme-accent-bg: rgba(14, 165, 233, 0.25);
  --theme-title-gradient: linear-gradient(90deg, #e0f2fe, #7dd3fc, #38bdf8);

  /* 状态色 */
  --theme-danger: #f07178;
  --theme-danger-text: #fecaca;
  --theme-danger-bg: rgba(127, 29, 29, 0.35);
  --theme-danger-border: rgba(248, 113, 113, 0.45);
  --theme-ok: #86efac;
  --theme-ok-bg: rgba(127, 217, 98, 0.12);
  --theme-warn-active: #fbbf24;
  --theme-warn-active-bg: rgba(251, 191, 36, 0.12);

  /* 按钮 */
  --theme-btn-primary: linear-gradient(180deg, #0ea5e9, #0284c7);
  --theme-btn-primary-alt: linear-gradient(180deg, #3b82f6, #2563eb);
  --theme-btn-secondary-bg: rgba(15, 35, 65, 0.55);
  --theme-btn-secondary-border: rgba(148, 163, 184, 0.35);
  --theme-btn-danger: linear-gradient(135deg, #b91c1c, #991b1b);
  --theme-btn-disabled-bg: rgba(51, 65, 85, 0.55);
  --theme-btn-disabled-text: #64748b;

  /* 圆角与阴影 */
  --theme-radius-sm: 6px;
  --theme-radius-md: 8px;
  --theme-radius-lg: 12px;
  --theme-radius-xl: 14px;
  --theme-radius-2xl: 16px;
  --theme-shadow-panel: 0 8px 32px rgba(0, 0, 0, 0.28);
  --theme-shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.5);

  /* 兼容旧模板变量名（勿删，便于 page-local CSS 继续引用） */
  --bg: var(--theme-bg);
  --panel: var(--theme-panel-solid);
  --border: #2d3a4d;
  --text: var(--theme-text);
  --muted: var(--theme-muted);
  --accent: #3d8bfd;
  --accent-dim: #2a6bc4;
  --danger: var(--theme-danger);
  --ok: #7fd962;
}

/* ========== 基础 ========== */
*, *::before, *::after { box-sizing: border-box; }

body.theme-page {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--theme-text);
  line-height: 1.5;
}

body.theme-bg-image {
  background: var(--theme-bg) url("tech-bg.svg") center/cover no-repeat fixed;
}

body.theme-bg-gradient {
  background: linear-gradient(160deg, var(--theme-bg) 0%, var(--theme-bg-gradient-end) 100%);
}

body.theme-bg-plain {
  background: var(--theme-bg);
}

.overlay {
  min-height: 100vh;
  background: linear-gradient(
    180deg,
    var(--theme-overlay-top) 0%,
    var(--theme-overlay-mid) 50%,
    var(--theme-overlay-bottom) 100%
  );
}

.overlay--center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.overlay--pad {
  padding: 1rem 1.25rem 2.5rem;
}

.overlay--pad-lg {
  padding: 2rem 1.25rem 3rem;
}

.shell { max-width: 1280px; margin: 0 auto; display: flex; flex-direction: column; gap: 0.85rem; }
.shell--narrow { max-width: 960px; }
.shell--home { max-width: 720px; }

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.wrap--wide { max-width: 1200px; }
.wrap.view-holdings { max-width: 1320px; }
.wrap--admin { max-width: 960px; padding: 1.5rem 1rem 3rem; }

.page-shell {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.page-shell--products {
  max-width: 960px;
}

/* ========== 导航 ========== */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-radius: var(--theme-radius-lg);
  background: var(--theme-panel);
  border: 1px solid var(--theme-border);
}

.top-nav a {
  color: var(--theme-accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.top-nav a:hover { text-decoration: underline; }

.top-nav-center {
  flex: 1;
  text-align: center;
  font-weight: 600;
  color: var(--theme-text-soft);
  font-size: 0.95rem;
}

.top-nav-date { color: var(--theme-muted); font-size: 0.88rem; }

.user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  font-size: 0.88rem;
  color: var(--theme-muted);
}

.user-bar-left,
.user-bar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
}

.user-bar .profile-link {
  color: var(--theme-link);
  text-decoration: none;
  font-size: 0.82rem;
}

.user-bar .profile-link:hover {
  color: var(--theme-link-hover);
  text-decoration: underline;
}

.user-bar .who { color: var(--theme-text-soft); font-weight: 600; }

.user-bar .role-pill {
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.2);
  color: var(--theme-link);
  font-size: 0.78rem;
}

.user-bar .btn-logout,
.btn-logout {
  padding: 0.35rem 0.85rem;
  border-radius: var(--theme-radius-md);
  border: 1px solid var(--theme-border-muted);
  background: var(--theme-panel-input);
  color: var(--theme-text-soft);
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
}

.user-bar .btn-logout:hover,
.btn-logout:hover {
  border-color: var(--theme-danger-border);
  color: var(--theme-danger-text);
}

a.back,
.entry-back-link,
.btn-link {
  color: var(--theme-accent);
  text-decoration: none;
  font-size: 0.9rem;
}

a.back:hover,
.entry-back-link:hover,
.btn-link:hover {
  text-decoration: underline;
  color: var(--theme-accent-dim);
}

.entry-back-link { font-size: 0.78rem; color: var(--theme-muted); }

/* ========== 面板 ========== */
.panel {
  border-radius: var(--theme-radius-xl);
  background: var(--theme-panel);
  border: 1px solid var(--theme-border);
  padding: 1rem 1.15rem;
}

.panel--soft {
  background: var(--theme-panel-soft);
  border-color: rgba(56, 189, 248, 0.14);
  box-shadow: var(--theme-shadow-panel), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.panel-head {
  margin: 0;
  padding: 0.65rem 1.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-align: center;
  color: var(--theme-muted);
  border-bottom: 1px solid rgba(56, 189, 248, 0.1);
}

.panel-head--intro {
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.65;
  white-space: pre-line;
}

.panel-body { padding: 1.25rem; }
.panel-body--compact { padding: 0.65rem 1rem; }

.panel h2,
.panel-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--theme-heading-accent);
}

.panel-title {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--theme-muted);
}

/* ========== 卡片（登录等） ========== */
.card {
  width: 100%;
  max-width: 420px;
  padding: 2rem 1.75rem 1.75rem;
  border-radius: var(--theme-radius-2xl);
  background: var(--theme-panel);
  border: 1px solid rgba(56, 189, 248, 0.2);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.brand {
  text-align: center;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: var(--theme-link);
  margin-bottom: 0.35rem;
}

h1, .page-title {
  font-weight: 600;
  font-size: 1.2rem;
  margin: 0 0 1.25rem;
  color: var(--theme-text-heading);
}

.page-title { font-size: 1.5rem; margin: 0 0 0.25rem; letter-spacing: 0.02em; }

.title {
  margin: 0;
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.35;
  background: var(--theme-title-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sub {
  color: var(--theme-muted);
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
}

/* ========== 表单 ========== */
label,
.form-row label {
  display: block;
  font-size: 0.82rem;
  color: var(--theme-muted);
  margin-bottom: 0.35rem;
}

label.flex-col {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.88rem;
}

input,
select,
textarea,
.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: var(--theme-radius-md);
  border: 1px solid rgba(45, 58, 77, 0.95);
  background: var(--theme-panel-input-solid);
  color: var(--theme-text);
  font-family: inherit;
  font-size: 0.95rem;
}

.form-row input,
.form-row select,
.form-row textarea {
  padding: 0.45rem 0.55rem;
  font-size: 0.88rem;
  border-color: var(--theme-border-muted);
  background: var(--theme-panel-input);
}

input:focus,
select:focus,
textarea:focus,
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.75);
  box-shadow: 0 0 0 2px rgba(61, 139, 253, 0.2);
}

input:disabled,
.form-row input:disabled { opacity: 0.65; }

textarea { min-height: 72px; resize: vertical; font-family: inherit; }
.form-row textarea { min-height: 70px; }

.form-row { margin-bottom: 0.65rem; }
.form-hint { font-size: 0.82rem; color: var(--theme-muted); margin: 0 0 0.75rem; line-height: 1.55; }
.form-err, .msg.err { color: var(--theme-danger-text); font-size: 0.82rem; min-height: 1.2em; }
.form-ok, .msg.ok { color: var(--theme-ok); font-size: 0.82rem; min-height: 1.2em; }
.hint { font-size: 0.75rem; color: var(--theme-muted); }

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--theme-radius-md);
  margin: 0 0 1.25rem;
  padding: 1rem 1rem 0.5rem;
}

legend {
  padding: 0 0.5rem;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem 1.25rem;
}

/* ========== 按钮 ========== */
button {
  cursor: pointer;
  font-family: inherit;
}

button.action,
.btn-primary,
button[type="submit"]:not(.btn-cancel):not(.btn-cancel-entry) {
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: var(--theme-btn-primary);
  color: #fff;
  border-radius: var(--theme-radius-md);
  padding: 0.45rem 0.85rem;
  font-size: 0.84rem;
  font-weight: 600;
}

button.action:hover,
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }

button.action.secondary,
.btn-ghost,
button[type="reset"],
button.btn-cancel,
button.btn-cancel-entry {
  background: var(--theme-btn-secondary-bg);
  color: #cbd5e1;
  border: 1px solid var(--theme-btn-secondary-border);
  border-radius: var(--theme-radius-md);
  padding: 0.45rem 0.85rem;
  font-size: 0.84rem;
  font-weight: 600;
}

button.action.danger,
.btn-danger {
  background: var(--theme-btn-danger);
  border-color: var(--theme-danger-border);
  color: #fff;
}

button.action.danger:disabled,
button.action.secondary:disabled,
button.action:disabled,
.btn-primary:disabled {
  background: var(--theme-btn-disabled-bg);
  border-color: rgba(100, 116, 139, 0.35);
  color: var(--theme-btn-disabled-text);
  cursor: not-allowed;
  opacity: 0.72;
}

button.action.small { padding: 0.3rem 0.55rem; font-size: 0.78rem; }

.btn {
  padding: 0.55rem 1.1rem;
  border-radius: var(--theme-radius-md);
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.btn-update { background: var(--accent); color: #fff; }
.btn-update:hover { background: var(--accent-dim); }

.toolbar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.65rem; }
.btn-row, .actions { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.actions { gap: 0.75rem; margin-top: 0.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }

.link-action {
  background: none;
  border: none;
  padding: 0;
  color: var(--theme-muted);
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-action:hover { color: var(--theme-danger-text); }
.link-action:disabled { opacity: 0.45; cursor: not-allowed; text-decoration: none; }

/* ========== 表格 ========== */
table.data-table,
table.quotes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

table.data-table th,
table.data-table td {
  border: 1px solid rgba(56, 189, 248, 0.12);
  padding: 0.4rem 0.45rem;
  text-align: left;
}

table.data-table th {
  background: rgba(15, 35, 65, 0.55);
  color: var(--theme-link);
  font-weight: 600;
}

table.data-table td { color: var(--theme-text-soft); }

table.data-table td.cell-alert {
  color: var(--theme-danger-text);
  font-weight: 700;
  background: rgba(127, 29, 29, 0.28);
}

/* 现存结构：Current Price <= Ki Price 且 Is_Ki==0 时整行突出 */
table.data-table tr.row-ki-alert td {
  color: var(--theme-danger-text);
  font-weight: 700;
  background: rgba(127, 29, 29, 0.22);
}

/* 现存结构：期货合约距当前年月 ≤1 个月时 Structural Element 用警示色着重显示 */
table.data-table td.cell-delivery-risk .delivery-risk-text {
  color: var(--theme-warn-active);
  font-weight: inherit;
  cursor: help;
}

table.data-table tr.row-ki-alert td.cell-delivery-risk .delivery-risk-text {
  color: var(--theme-warn-active);
}

table.data-table th.sortable-th { cursor: pointer; user-select: none; }
table.data-table th.sortable-th:hover { color: var(--theme-link-hover); }
table.data-table th.sort-active { color: var(--theme-warn-active); }

.data-table-wrap { overflow-x: auto; margin-top: 0.5rem; }

.user-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; }

/* ========== 标签页 ========== */
.tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }

.tab-btn {
  border: 1px solid rgba(56, 189, 248, 0.25);
  background: rgba(15, 35, 65, 0.45);
  color: #cbd5e1;
  border-radius: var(--theme-radius-md);
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  font-family: inherit;
}

.tab-btn.active {
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.55);
  background: var(--theme-warn-active-bg);
}

a.tab-btn {
  text-decoration: none;
  display: inline-block;
  line-height: inherit;
}

a.tab-btn:hover {
  color: #e0f2fe;
  border-color: rgba(96, 165, 250, 0.55);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ========== 弹窗 ========== */
.modal-backdrop,
.backdrop {
  position: fixed;
  inset: 0;
  background: var(--theme-modal-scrim);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-backdrop.is-open,
.modal-backdrop.open,
.modal-backdrop.show,
.backdrop.show { display: flex; }

.modal {
  background: var(--theme-panel-solid);
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-xl);
  padding: 1.25rem;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--theme-shadow-modal);
}

.modal h2,
.modal h3 {
  margin: 0 0 1rem;
  color: var(--theme-text-soft);
  font-size: 1rem;
}

.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }

.toast-modal .modal { text-align: center; max-width: 360px; }

.form-select-list {
  width: 100%;
  padding: 0.35rem 0.45rem;
  border-radius: var(--theme-radius-md);
  border: 1px solid var(--theme-border-muted);
  background: var(--theme-panel-input);
  color: var(--theme-text-soft);
  font-family: inherit;
  font-size: 0.88rem;
  max-height: 220px;
  overflow-y: auto;
}

/* ========== 消息与占位 ========== */
.msg {
  min-height: 1.25em;
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
}

.msg-block {
  display: none;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--theme-radius-md);
  font-size: 0.9rem;
}

.msg-block.show { display: block; white-space: pre-wrap; }

.err,
.err-box,
.err-banner,
.err-page {
  padding: 0.75rem 1rem;
  border-radius: var(--theme-radius-md);
  background: var(--theme-danger-bg);
  border: 1px solid var(--theme-danger-border);
  color: var(--theme-danger-text);
  font-size: 0.88rem;
}

.placeholder,
.empty {
  color: var(--theme-muted);
  font-size: 0.9rem;
  padding: 2rem;
  text-align: center;
}

.empty { padding: 1.25rem; }

.page-foot {
  margin: 0;
  padding: 0.5rem 0;
  font-size: 0.78rem;
  text-align: center;
  color: var(--theme-muted-dim);
}

.pager {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
  color: var(--theme-muted);
  font-size: 0.82rem;
}

.hidden { display: none !important; }

/* ========== 录入/行情页表单容器 ========== */
form.data-form,
form.entry-form {
  background: var(--theme-panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--theme-radius-lg);
  padding: 1.5rem 1.5rem 1.25rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

section.product {
  margin-bottom: 1.5rem;
  background: var(--theme-panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--theme-radius-lg);
  padding: 1rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

section.product h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-left: auto;
}

/* ========== 表格排序图标 ========== */
table.data-table th.sortable-th .sort-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.35rem;
  min-width: 1.2em;
  height: 1.2em;
  padding: 0 0.18em;
  border-radius: 4px;
  font-size: 0.68em;
  line-height: 1;
  vertical-align: middle;
  color: var(--theme-accent);
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.45);
  box-shadow: 0 0 6px var(--theme-accent-glow);
}

table.data-table th.sortable-th:hover .sort-icon {
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.32);
  border-color: rgba(125, 211, 252, 0.6);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.45);
}

table.data-table th.sortable-th.sort-active .sort-icon {
  color: #fde68a;
  background: rgba(251, 191, 36, 0.28);
  border-color: rgba(251, 191, 36, 0.65);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
}

table.data-table th.sortable-th.sort-active:hover .sort-icon {
  color: var(--theme-warn-active);
  background: rgba(251, 191, 36, 0.38);
  border-color: rgba(251, 191, 36, 0.75);
}

/* ========== 录入页表单（snowball 等） ========== */
.wrap > form {
  background: var(--theme-panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--theme-radius-lg);
  padding: 1.5rem 1.5rem 1.25rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.wrap form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: var(--theme-muted);
}

.wrap form label .req { color: var(--theme-danger); font-weight: 600; }

.wrap form input,
.wrap form select,
.wrap form textarea {
  background: #121a26;
  border: 1px solid var(--border);
  border-radius: var(--theme-radius-sm);
  color: var(--theme-text);
  padding: 0.55rem 0.65rem;
  font-size: 0.95rem;
}

.wrap form input:focus,
.wrap form select:focus,
.wrap form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(61, 139, 253, 0.2);
}

.wrap form button[type="submit"] {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--theme-radius-md);
  padding: 0.65rem 1.35rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.wrap form button[type="submit"]:hover { background: var(--accent-dim); }

.wrap form button[type="reset"],
.wrap form button.btn-cancel-entry {
  background: transparent;
  color: var(--theme-muted);
  border: 1px solid var(--border);
}

.wrap form button.btn-cancel-entry:hover {
  border-color: var(--theme-danger);
  color: var(--theme-danger);
}

.grid label.full-row { grid-column: 1 / -1; }

.grid label.full-row textarea {
  width: 100%;
  min-height: calc(72px + 1.5em);
}

/* ========== 弹窗扩展（录入/登录） ========== */
.modal p {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #cbd5e1;
}

.modal .file-list {
  font-size: 0.8rem;
  color: var(--theme-link);
  margin: 0.5rem 0 1rem;
  word-break: break-all;
}

.modal pre {
  margin: 0;
  padding: 1rem 1.25rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.88rem;
  color: var(--theme-text);
}

.modal h2 {
  margin: 0;
  padding: 1rem 1.25rem;
  font-size: 1.1rem;
  border-bottom: 1px solid var(--border);
}

.modal .btns {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 0 1.25rem 1.25rem;
}

.modal .btns button { padding: 0.5rem 1.1rem; }

.modal .btns.instr-actions {
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.65rem;
}

.modal .btns.instr-actions button {
  flex: 0 0 15%;
  width: 15%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.45rem 0.2rem;
  font-size: 0.78rem;
  text-align: center;
  white-space: nowrap;
  border-radius: var(--theme-radius-md);
}

#closeStructureBackdrop .btns button,
#backdrop .btns button {
  border-radius: var(--theme-radius-md);
}

.btn-cancel { background: #2a3545; color: var(--theme-text); }
.btn-ok { background: var(--theme-ok); color: #0d1a0d; }

.modal .form-body { padding: 1rem 1.25rem; }

.modal .form-body label {
  display: block;
  font-size: 0.82rem;
  color: var(--theme-muted);
  margin: 0 0 0.35rem;
}

.modal .form-body input {
  width: 100%;
  margin-bottom: 0.85rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--theme-radius-md);
  border: 1px solid var(--border);
  background: var(--theme-panel-input-solid);
  color: var(--theme-text);
  font-size: 0.92rem;
}

.modal .form-hint {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  color: #fde68a;
  line-height: 1.5;
}

.modal .form-err {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  color: #fca5a5;
  min-height: 1.2em;
}

.msg.err.show,
.msg.err:not(:empty) {
  display: block;
  background: rgba(240, 113, 120, 0.15);
  border: 1px solid var(--theme-danger);
  color: #ffb4b8;
}

.msg.ok.show,
.msg.ok:not(:empty) {
  display: block;
  background: var(--theme-ok-bg);
  border: 1px solid var(--theme-ok);
  color: #b8e6a8;
}

.btn-secondary {
  background: rgba(30, 41, 59, 0.9);
  color: var(--theme-text-soft);
  border: 1px solid rgba(71, 85, 105, 0.8);
}

/* ========== 登录页 ========== */
.page-login h1 { text-align: center; }

.page-login input {
  margin-bottom: 1rem;
  padding: 0.6rem 0.75rem;
}

.page-login button[type="submit"] {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  border: none;
  background: var(--theme-btn-primary-alt);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
}

.page-login button[type="submit"]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.page-login .hint {
  margin-top: 1rem;
  text-align: center;
  white-space: pre-line;
}

.page-login .modal-actions button { flex: 1; }

.page-login .modal {
  max-width: 440px;
  padding: 1.5rem 1.35rem 1.25rem;
  background: rgba(12, 24, 42, 0.96);
  border-color: rgba(56, 189, 248, 0.28);
}

/* ========== 首页弹窗 ========== */
.modal-box {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: auto;
  background: rgba(15, 26, 42, 0.97);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: var(--theme-radius-xl);
  box-shadow: var(--theme-shadow-modal);
  text-align: left;
  color: var(--theme-text);
}

.modal-box h2 {
  margin: 0;
  padding: 1rem 1.25rem;
  font-size: 1.05rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(59, 130, 246, 0.25);
}

.modal-body { padding: 1rem 1.25rem 1.25rem; }

.modal-body .hint {
  font-size: 0.8rem;
  color: var(--theme-muted);
  margin: 0 0 1rem;
  line-height: 1.5;
}

.modal-body .db-meta {
  font-size: 0.82rem;
  color: #cbd5e1;
  margin: 0 0 1rem;
  padding: 0.65rem 0.75rem;
  background: rgba(5, 12, 24, 0.55);
  border-radius: var(--theme-radius-md);
  border: 1px solid rgba(45, 58, 77, 0.6);
  line-height: 1.5;
}

.modal-body label {
  display: block;
  font-size: 0.82rem;
  color: var(--theme-muted);
  margin-bottom: 0.35rem;
}

.modal-body input[type="text"],
.modal-body input[type="password"],
.modal-body select {
  width: 100%;
  margin-bottom: 0.9rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--theme-radius-md);
  border: 1px solid rgba(45, 58, 77, 0.9);
  background: var(--theme-panel-input-solid);
  color: var(--theme-text);
  font-size: 0.95rem;
}

.modal-body input:focus { outline: none; border-color: rgba(59, 130, 246, 0.75); }

.modal-actions .btn-cancel {
  background: transparent;
  color: var(--theme-muted);
  border: 1px solid rgba(71, 85, 105, 0.8);
}

.modal-actions .btn-submit {
  background: var(--theme-btn-primary-alt);
  color: #fff;
  font-weight: 600;
}

.modal-actions .btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.modal-msg {
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
  min-height: 1.25em;
}

.modal-msg.err { color: #fca5a5; }
.modal-msg.ok { color: var(--theme-ok); }
.modal-msg.warn { color: #fde68a; }
.hint.warn { color: #fde68a; }

/* ========== 行情配置 ========== */
.btn-fetch-quotes {
  background: #243044;
  color: var(--theme-text);
  border: 1px solid var(--border);
  border-radius: var(--theme-radius-md);
  padding: 0.65rem 1.35rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.btn-fetch-quotes:hover {
  background: #2c3c55;
  border-color: rgba(61, 139, 253, 0.45);
}

.btn-fetch-quotes:disabled { opacity: 0.55; cursor: not-allowed; }

.date-strip {
  margin-bottom: 1.5rem;
  padding: 0.75rem 0.85rem 0.8rem;
  background: #121a26;
  border: 1px solid var(--border);
  border-radius: var(--theme-radius-md);
}

.date-strip-hint {
  font-size: 0.75rem;
  color: var(--theme-muted);
  margin: 0 0 0.5rem;
  line-height: 1.45;
}

section.product h2 code {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--theme-muted);
  margin-left: 0.35rem;
}

/* ========== 对冲管理页 ========== */
.hedge-page h1 { color: #7dd3fc; font-size: 1.35rem; margin: 0 0 0.5rem; }

.hedge-page .sub { color: var(--theme-muted); font-size: 0.88rem; margin-bottom: 1.25rem; }

.hedge-page .top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.hedge-page .product {
  margin-bottom: 1.25rem;
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(15, 26, 42, 0.85);
}

.hedge-page .product h2 {
  margin: 0;
  padding: 0.55rem 0.85rem;
  font-size: 0.95rem;
  background: rgba(30, 58, 95, 0.5);
  border-bottom: 1px solid rgba(59, 130, 246, 0.25);
}

.hedge-page .product h2 code { font-size: 0.82rem; color: var(--theme-link); }

.hedge-page table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }

.hedge-page th,
.hedge-page td {
  padding: 0.4rem 0.65rem;
  border-bottom: 1px solid rgba(45, 58, 77, 0.8);
  text-align: left;
}

.hedge-page th {
  color: var(--theme-muted);
  font-weight: 600;
  background: rgba(5, 12, 24, 0.5);
}

.hedge-page tr:last-child td { border-bottom: none; }

.hedge-page .col-id { color: var(--theme-accent); font-weight: 600; }

.hedge-page .status-panel {
  margin-top: 0.75rem;
  margin-bottom: 1.35rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(59, 130, 246, 0.35);
  background: rgba(5, 12, 24, 0.65);
}

.hedge-page .status-panel h3 { margin: 0 0 0.5rem; font-size: 0.95rem; color: #7dd3fc; }

.hedge-page .status-meta { font-size: 0.8rem; color: var(--theme-muted); margin-bottom: 0.45rem; }

.hedge-page .status-sync {
  font-size: 0.72rem;
  color: var(--theme-muted-dim);
  margin: 0 0 0.65rem;
  font-family: ui-monospace, Consolas, monospace;
}

.hedge-page .status-panel.is-running {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.12);
}

.hedge-page .status-panel.is-running .status-log {
  max-height: min(52vh, 420px);
  border-color: rgba(56, 189, 248, 0.35);
}

.hedge-page .status-pulse {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--theme-accent);
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
  min-height: 1.5em;
}

.hedge-page .status-pulse[hidden] { display: none !important; }

.hedge-page .status-csv-wrap { margin-top: 0.35rem; }
.hedge-page .status-csv-wrap[hidden] { display: none !important; }

.hedge-page .status-csv-wrap h4 {
  margin: 0 0 0.45rem;
  font-size: 0.88rem;
  color: var(--theme-ok);
  font-weight: 600;
}

.hedge-page .status-csv-wrap ul {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.8rem;
  line-height: 1.55;
  color: #cbd5e1;
  font-family: ui-monospace, Consolas, monospace;
  word-break: break-all;
}

.hedge-page .status-log {
  max-height: 280px;
  overflow: auto;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: #cbd5e1;
  font-family: ui-monospace, Consolas, monospace;
  background: #0a1018;
  padding: 0.55rem 0.65rem;
  border-radius: var(--theme-radius-sm);
  border: 1px solid #1e293b;
}

.hedge-page .empty { color: var(--theme-muted-dim); padding: 0.5rem 0.85rem; font-size: 0.85rem; }

.hedge-page .btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.hedge-page .btn-ghost {
  background: transparent;
  color: var(--theme-muted);
  border: 1px solid #475569;
}
