/* chaogu web 样式：纯 CSS，无外部资源依赖 */
:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --text: #1c1e26;
  --text-muted: #6b7080;
  --border: #e3e5ec;
  --brand: #4b3fe3;
  --brand-soft: #eef0ff;
  --up: #d83a3a;      /* A股习惯：红涨 */
  --down: #1a9e5c;    /* 绿跌 */
  --warn: #b2710a;
  --danger-bg: #fff3f2;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15161c; --surface: #1e2028; --text: #e6e7ee; --text-muted: #9aa0b0;
    --border: #2e313c; --brand: #8a82ff; --brand-soft: #262350;
    --up: #ff6b6b; --down: #34c983; --warn: #e0a84f; --danger-bg: #3a2020;
  }
}
* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: clip; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.6 "SF Pro Text", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
a { color: var(--brand); text-decoration: none; }

/* 导航 */
.topnav {
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; min-height: 56px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 17px; white-space: nowrap; }
.brand .ver { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.navlinks { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.navlinks a {
  padding: 6px 12px; border-radius: 8px; color: var(--text-muted); font-weight: 500;
  white-space: nowrap;
}
.navlinks a:hover { background: var(--brand-soft); color: var(--brand); }
.navlinks a.active { background: var(--brand-soft); color: var(--brand); }
.navuser { display: flex; align-items: center; gap: 12px; color: var(--text-muted); }
.logout { font-size: 13px; }

.container { max-width: 1240px; margin: 24px auto; padding: 0 20px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 24px 0 10px; }
.sub { font-size: 14px; color: var(--text-muted); font-weight: 400; }
.hint { color: var(--text-muted); font-size: 13px; }

/* 卡片/表格 */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
}
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; min-width: 900px; }
.grid th, .grid td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.grid th { background: var(--bg); font-size: 12px; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.grid tr:last-child td { border-bottom: none; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, Consolas, monospace; white-space: nowrap; }
.strong { font-weight: 700; }
.cell-small { font-size: 12.5px; color: var(--text-muted); white-space: normal; }
.cell-reason { font-size: 12.5px; min-width: 140px; max-width: 240px; }
.nowrap { white-space: nowrap; }
.up { color: var(--up); }
.down { color: var(--down); }
.center { text-align: center; padding: 36px; }
.empty {
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 48px; text-align: center; color: var(--text-muted);
}

/* 标签 */
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px; margin: 2px 3px 2px 0;
  font-size: 12px; background: var(--bg); border: 1px solid var(--border); color: var(--text-muted);
}
.tag-pattern { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.tag-pos { color: var(--down); border-color: var(--down); }
.tag-top { color: var(--up); border-color: var(--up); background: var(--danger-bg); }
.tag-pass { color: var(--down); border-color: var(--down); }
.tag-nopass { color: var(--warn); border-color: var(--warn); }
.tag-done { color: var(--down); border-color: var(--down); }
.tag-pending { color: var(--brand); border-color: var(--brand); }
.tag-failed { color: var(--up); border-color: var(--up); }
.big { font-size: 15px; padding: 8px 18px; }

/* 横幅 */
.banner { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; font-size: 13.5px; border: 1px solid; }
.banner-danger { color: var(--up); border-color: var(--up); background: var(--danger-bg); }
.banner-warn { color: var(--warn); border-color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.banner-info { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.banner-ok { color: var(--down); border-color: var(--down); }

/* 结论/指标 */
.verdict { border-radius: var(--radius); padding: 16px 20px; margin-bottom: 16px; font-weight: 600; font-size: 15px; border: 1px solid; }
.verdict-pass { color: var(--down); border-color: var(--down); background: color-mix(in srgb, var(--down) 8%, transparent); }
.verdict-nopass { color: var(--warn); border-color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, transparent); }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 8px; }
.metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.metric-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.metric-value { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric-hit { border-color: var(--down); }

/* 信号/计划/条件 */
.signal-box .signal-row { display: flex; gap: 14px; padding: 8px 0; align-items: flex-start; }
.signal-label { flex: 0 0 150px; font-weight: 600; font-size: 13px; }
.plan-label { display: inline-block; width: 84px; color: var(--text-muted); }
.plan-box p { margin: 6px 0; }
.fail-box { color: var(--up); }
.fail-box ul { margin: 8px 0 0; padding-left: 20px; }
.mini-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.mini-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); font-size: 13px; }

/* 表单 */
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form input[type=text], .input-code { flex: 0 0 220px; }
.inline-form .input-name { flex: 1 1 180px; }
.auth-card {
  max-width: 380px; margin: 60px auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; padding: 28px;
}
.auth-card h1 { font-size: 19px; margin-bottom: 18px; }
.auth-form label { display: block; margin: 12px 0 6px; font-size: 13px; color: var(--text-muted); }
.auth-form input, .auth-form select {
  width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 14px;
}
.auth-alt { margin-top: 14px; font-size: 13px; color: var(--text-muted); text-align: center; }
input[type=text], input[type=password], select {
  padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 14px;
}

/* 按钮 */
.btn {
  display: inline-block; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13.5px; cursor: pointer;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { opacity: .9; color: #fff; }
.btn-mini { padding: 4px 10px; font-size: 12px; }
.btn-danger { color: var(--up); }
.btn-danger:hover { border-color: var(--up); color: var(--up); }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.actions form { display: inline; }

/* 其他 */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 13.5px; border: 1px solid; }
.flash-ok { color: var(--down); border-color: var(--down); }
.flash-error { color: var(--up); border-color: var(--up); background: var(--danger-bg); }
.disclaimer, .tips {
  margin-top: 18px; padding: 12px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 12.5px;
}
code { background: var(--bg); padding: 1px 6px; border-radius: 4px; font-size: 12px; }

/* 持仓盯盘（二期/三期） */
.tag-armed { color: var(--warn); border-color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.section-title { font-size: 15px; margin: 22px 0 10px; }
.pos-form { margin: 0; }
.pos-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px 14px; margin-bottom: 12px; }
.pos-fields label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-muted); }
.pos-fields input { width: 100%; box-sizing: border-box; padding: 8px 10px; }
.grid-wide { min-width: 880px; }

/* 窄屏（手机） */
@media (max-width: 560px) {
  .topnav { gap: 10px; padding: 8px 12px; }
  .brand { font-size: 15px; }
  .brand .ver { display: none; }
  .navuser { font-size: 13px; gap: 8px; white-space: nowrap; }
  .navlinks { gap: 2px; }
  .navlinks a { padding: 6px 8px; font-size: 12.5px; }
  .container { margin: 14px auto; padding: 0 12px; }
  h1 { font-size: 19px; }
  .grid { min-width: 720px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .metric { padding: 10px 12px; }
  .metric-value { font-size: 16px; }
  /* 自选股录入表单：每项独占一行，方便点按 */
  .inline-form input[type=text], .input-code,
  .inline-form .input-name { flex: 1 1 100%; }
  /* 日期切换栏纵向堆叠 */
  .date-picker { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
  .date-picker select { max-width: 200px; }
  /* 信号行：标签在上、内容在下，标签区允许收缩换行 */
  .signal-box .signal-row { flex-direction: column; gap: 4px; }
  .signal-label { flex: none; }
  .signal-row > * { min-width: 0; }
  .auth-card { margin: 28px 12px; padding: 22px; }
  /* 手机端隐藏推荐表低优先级列，减少横向滑动 */
  .col-hide-m { display: none; }
  .grid { min-width: 0; }
  .grid th, .grid td { padding: 7px 8px; }
}
