/* 交易复盘助手 · 网站版全局样式（浅色） */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #185fa5;
  --up: #c7352e;    /* A股：盈红 */
  --down: #0d7a4e;  /* A股：亏绿 */
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 顶部导航 */
.nav {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.nav-inner {
  max-width: 960px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; height: 52px; gap: 24px;
}
.nav .brand { font-size: 16px; font-weight: 500; color: var(--text); }
.nav .brand:hover { text-decoration: none; }
.nav a.link { color: var(--muted); font-size: 14px; }
.nav a.link.active { color: var(--primary); font-weight: 500; }
.nav .spacer { flex: 1; }
.nav .user-badge { color: var(--muted); font-size: 13px; }

/* 导航链接组（桌面横向；汉堡在移动端显示） */
.nav-links { display: flex; align-items: center; gap: 24px; flex: 1; }
.nav-links .spacer { flex: 1; }
.nav-burger { display: none; } /* 桌面隐藏汉堡 */

/* 主容器 */
.container { max-width: 960px; margin: 24px auto; padding: 0 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 { font-size: 16px; font-weight: 500; margin-bottom: 14px; }
.card h3 { font-size: 14px; font-weight: 500; margin: 14px 0 8px; }

/* 按钮 */
.btn {
  display: inline-block; border: 1px solid var(--border);
  background: #fff; color: var(--text);
  padding: 8px 18px; border-radius: 8px; cursor: pointer;
  font-size: 14px; line-height: 1.5;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #0c447c; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.danger { color: var(--up); border-color: var(--up); }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; background: #fff; color: var(--text);
}
.input:focus { outline: none; border-color: var(--primary); }
.check { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; color: var(--muted); }
.check input { margin-top: 3px; }

/* 指标卡 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }

/* 看板「全部」视图：每日复盘卡片网格 */
.day-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.day-card { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.day-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(24,95,165,.12); }
.day-card .dc-date { font-size: 12px; color: var(--muted); }
.day-card .dc-profit { font-size: 16px; font-weight: 600; margin: 4px 0 2px; }
.day-card .dc-sub { font-size: 12px; color: var(--muted); }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px;
}
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font-size: 20px; font-weight: 500; margin-top: 4px; }
.up { color: var(--up); }
.down { color: var(--down); }

/* 图表 */
.chart-box { width: 100%; height: 300px; }
.chart-box.small { height: 220px; }

/* 历史列表 */
.history-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 10px; background: #fff; cursor: pointer;
}
.history-item:hover { border-color: var(--primary); }
.history-item .date { width: 110px; font-size: 13px; }
.history-item .main { flex: 1; }
.history-item .pill {
  display: inline-block; font-size: 12px; color: var(--muted);
  background: var(--bg); border-radius: 6px; padding: 1px 8px; margin-right: 6px;
}
/* 指标 pill 颜色标记（对齐小程序 盈红/亏绿 约定） */
.history-item .pill.pill-trade { color: var(--primary); background: #e8f1fb; }
.history-item .pill.win-good { color: var(--up); background: #fceae9; }
.history-item .pill.win-bad { color: var(--down); background: #e7f4ec; }
.history-item .pill.streak-up { color: var(--up); background: #fceae9; }
.history-item .pill.streak-down { color: var(--down); background: #e7f4ec; }
.history-item .profit { font-size: 16px; font-weight: 500; min-width: 90px; text-align: right; }

/* 云端历史面板 */
.cloud-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.cloud-modal { background: #fff; border-radius: 14px; width: min(460px, 92vw); max-height: 82vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.cloud-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 500; }
.cloud-close { border: none; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
.cloud-body { padding: 8px 16px 16px; overflow: auto; }
.cloud-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.cloud-row:last-child { border-bottom: none; }
.cloud-info { display: flex; flex-direction: column; }
.cloud-info .muted { color: var(--muted); font-size: 12px; margin-top: 2px; }
.cloud-row .profit { margin-left: auto; font-weight: 500; }
.cloud-mask .loading { color: var(--muted); padding: 12px 0; }
.cloud-mask .empty { color: var(--muted); padding: 20px 0; text-align: center; }

/* 提示条 */
.msg { padding: 10px 14px; border-radius: 8px; margin: 12px 0; font-size: 13px; display: none; }
.msg.ok { display: block; background: #eaf3de; color: #3b6d11; }
.msg.err { display: block; background: #fcebeb; color: #a32d2d; }
.msg.info { display: block; background: #e6f1fb; color: #185fa5; }

/* 表格 */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
table.tbl th { color: var(--muted); font-weight: 500; background: #fafafa; }

/* 空态/加载 */
.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 13px; }
.loading { text-align: center; color: var(--muted); padding: 30px 0; font-size: 13px; }

/* 个人中心 */
.member-card {
  border-radius: 12px; padding: 20px; color: #fff; margin-bottom: 16px;
  background: linear-gradient(135deg, #185fa5, #378add);
}
.member-card .big { font-size: 22px; font-weight: 500; margin-top: 6px; }
.member-card .sub { opacity: .9; font-size: 13px; margin-top: 4px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.plan { border: 1px solid var(--border); border-radius: 10px; padding: 16px; text-align: center; background: #fff; }
.plan .p-name { font-size: 15px; font-weight: 500; }
.plan .p-price { font-size: 24px; font-weight: 500; margin: 8px 0; }
.plan .p-sub { font-size: 12px; color: var(--muted); margin-bottom: 12px; }

.docs h2 { font-size: 18px; font-weight: 500; margin-bottom: 12px; }
.docs h3 { font-size: 15px; font-weight: 500; margin: 16px 0 6px; }
.docs p { margin: 6px 0; color: #374151; }
.docs li { margin: 4px 0 4px 20px; color: #374151; }

/* 关键结论 */
.conclusion, #conclusion { font-size: 13px; line-height: 1.9; }
.concl-line { color: #374151; }
.concl-line:first-child { font-weight: 500; }

/* 分证券汇总 · 实战明细（按卖出日分组） */
table.stock-byday tr.grp-head td {
  background: #f3f5f9; font-weight: 600; color: #1f2937;
  border-top: 2px solid var(--border);
}
table.stock-byday tr.sub-head th {
  font-size: 12px; color: var(--muted); background: #fafafa; padding: 5px 10px;
}
table.stock-byday .s-name { font-weight: 500; }
table.stock-byday .s-code { color: var(--muted); font-size: 12px; font-weight: normal; }

/* 主笔明细（逐笔紧凑表） */
table.trades-compact .s-name { font-weight: 500; }
table.trades-compact .s-code { color: var(--muted); font-size: 12px; font-weight: normal; }
.more-tip, .note-tip { font-size: 12px; color: var(--muted); margin-top: 8px; }
.more-tip a { color: var(--primary); }

/* 交易纪律 */
#discipline { font-size: 13px; }
.disc-main { font-weight: 500; color: #1f2937; }
.disc-line { color: #374151; line-height: 1.9; }
.disc-line.disc-current { color: var(--down); }
.disc-line.disc-current.up { color: var(--up); }
.disc-row { display: flex; gap: 12px; margin-top: 10px; }
.disc-item { flex: 1; background: #f7f8fb; border-radius: 10px; padding: 12px; text-align: center; }
.disc-num { font-size: 20px; font-weight: 600; }
.disc-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* 操作总结 */
.note-input {
  width: 100%; min-height: 84px; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 13px; font-family: inherit; resize: vertical; box-sizing: border-box;
}
.note-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; }

/* 动作行（回看板 / 逐笔明细等） */
.action-row { display: flex; gap: 12px; }
.btn.ghost { background: #fff; border: 1px solid var(--border); color: #374151; text-align: center; text-decoration: none; }
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); }
.flex1 { flex: 1; }

/* 卡片标题（对齐小程序 card-title） */
.card-title { font-size: 15px; font-weight: 600; color: #1f2937; margin-bottom: 10px; }

/* 底部双入口（对齐小程序 dashboard 的「主笔明细 / 分证券汇总」action-row） */
.entry-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 18px; position: relative;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  text-decoration: none; color: #1f2937; transition: border-color .15s, box-shadow .15s;
}
.entry-card:hover { border-color: var(--primary); box-shadow: 0 2px 10px rgba(24,95,165,.12); }
.entry-title { font-size: 17px; font-weight: 600; }
.entry-sub { font-size: 12px; color: var(--muted); }
.entry-arrow { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--primary); font-size: 20px; }


/* 标签 */
.tag-up { color: var(--up); font-size: 11px; border: 1px solid var(--up); border-radius: 4px; padding: 0 4px; }

/* 期初持仓编辑行 */
.pos-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.pos-head { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.pos-head span { display: inline-block; }

/* ===== 移动端适配（≤720px） ===== */
@media (max-width: 720px) {
  /* 导航：折叠为汉堡菜单（纯 CSS，checkbox hack） */
  .nav-inner { flex-wrap: wrap; height: auto; min-height: 52px; padding: 10px 16px; gap: 8px; }
  .nav-burger {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 32px; margin-left: auto;
    font-size: 20px; color: var(--text); cursor: pointer; border-radius: 6px;
  }
  .nav-burger:hover { background: var(--bg); }
  .nav-links {
    display: none; width: 100%; flex-direction: column; align-items: stretch;
    gap: 0; padding-top: 4px;
  }
  .nav-toggle:checked ~ .nav-links { display: flex; }
  .nav-links a.link {
    display: block; padding: 11px 4px; font-size: 15px;
    border-bottom: 1px solid var(--border);
  }
  .nav-links .spacer { display: none; }
  .nav-links .user-badge { padding: 11px 4px 4px; }
  .nav-links a.link[href="/user.html"] { border-bottom: none; }

  /* 表格：横向滚动防溢出（8 列明细表等） */
  .tbl { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .tbl td, .tbl th { white-space: nowrap; }

  /* 双列卡片栅格降为单列（汇总页 Top10 等） */
  [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }

  /* 顶部操作行换行对齐 */
  .action-row { flex-wrap: wrap; }
  .action-row .flex1 { flex: 1 1 100%; }

  /* 指标卡 4 列 → 2 列 */
  .stat-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* 日期卡 4 列 → 2 列 */
  .day-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* 日历格缩小 */
  .cal-cell { padding: 6px 8px; min-height: 52px; }
}

/* ===== 骨架屏（加载占位） ===== */
.skeleton { border-radius: 8px; background: linear-gradient(90deg, var(--bg) 25%, #e8edf2 37%, var(--bg) 63%); background-size: 400% 100%; animation: sk-shimmer 1.3s ease infinite; }
@keyframes sk-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.sk-list .sk-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.sk-list .sk-item:last-child { border-bottom: none; }
.sk-line { height: 14px; border-radius: 4px; }
.sk-line.w60 { width: 60px; } .sk-line.w80 { width: 80px; } .sk-line.w120 { width: 120px; } .sk-line.flex1 { flex: 1; }
.sk-metric { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.sk-metric .sk-m { height: 64px; }
@media (max-width: 720px) { .sk-metric { grid-template-columns: repeat(2, 1fr); } }

/* 永久版套餐高亮 */
.plan.plan-hot { border-color: var(--primary); background: #f4f9ff; }
.plan.plan-hot .p-name { color: var(--primary); }
.plan.plan-hot .p-price { color: var(--primary); }

/* 日历格提款标记（对齐小程序） */
.cal-cell .wd { font-size: 11px; color: var(--primary); margin-top: 2px; white-space: nowrap; }
.cal-summary .sum-num.primary { color: var(--primary); }

/* 看板底部双按钮（对齐小程序「逐笔明细 / 分证券汇总」btn-ghost） */
.btn-ghost {
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 12px 10px; border-radius: 10px; cursor: pointer;
  font-size: 15px; font-weight: 500; text-align: center;
  transition: border-color .15s, color .15s, box-shadow .15s;
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); box-shadow: 0 2px 10px rgba(24,95,165,.12); }
