/* ── 基础 ───────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f6f6f4;
  --panel: #ffffff;
  --ink: #17181a;
  --ink2: #5d626c;
  --ink3: #9aa0aa;
  --line: #e7e7e3;
  --line2: #f1f1ed;
  --up: #c0392b;      /* 涨 · 红 */
  --down: #12855c;    /* 跌 · 绿 */
  --warn: #a8611a;
  --bad: #a32b1e;
  --ok: #166b47;
  --r: 12px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

html, body { background: var(--bg); color: var(--ink); }

body {
  font: 13px/1.6 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul { list-style: none; }

/* ── 顶栏 ───────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(246, 246, 244, .82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 1280px; margin: 0 auto; padding: 0 28px;
  height: 52px; display: flex; align-items: center; gap: 10px;
}
.brand { font-size: 13px; font-weight: 600; letter-spacing: -.01em; }
.live {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 3px rgba(22, 107, 71, .12); margin-left: 2px;
}
.topbar .spacer { flex: 1; }
.topbar .tmeta { font-size: 11.5px; color: var(--ink3); letter-spacing: .01em; }
.topbar .tmeta b { color: var(--ink2); font-weight: 500; }
.navlinks { display: flex; gap: 2px; margin-left: 8px; }
.navlinks a {
  font-size: 11.5px; color: var(--ink2); padding: 4px 9px; border-radius: 6px;
  transition: background .15s, color .15s;
}
.navlinks a:hover { background: #ebebe7; color: var(--ink); }

/* ── 容器 ───────────────────────────────────────────── */
.wrap { max-width: 1280px; margin: 0 auto; padding: 18px 28px 72px; }

/* ── 卡片 ───────────────────────────────────────────── */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 15px 17px 14px; display: flex; flex-direction: column; min-width: 0;
}
.card.plain { border: 0; background: none; padding: 0; }

.ch { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; min-height: 18px; }
.ch h2 { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; color: var(--ink); }
.ch .meta { margin-left: auto; font-size: 11px; color: var(--ink3); letter-spacing: .01em; white-space: nowrap; }
.ch .meta a:hover { color: var(--ink2); }

/* ── 网格 ───────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; }
.s3 { grid-column: span 3; } .s4 { grid-column: span 4; }
.s5 { grid-column: span 5; } .s6 { grid-column: span 6; }
.s7 { grid-column: span 7; } .s8 { grid-column: span 8; }
.s12 { grid-column: span 12; }
.mt12 { margin-top: 12px; }

/* ── Hero ───────────────────────────────────────────── */
.hero { padding: 20px 22px 0; }
.hero-top {
  display: grid; grid-template-columns: 190px 1fr 230px; gap: 30px; align-items: start;
}
.date-big { font-size: 27px; font-weight: 600; letter-spacing: -.035em; line-height: 1.15; }
.date-sub { font-size: 11.5px; color: var(--ink3); margin-top: 3px; letter-spacing: .02em; }

.blk-label {
  font-size: 10px; font-weight: 600; letter-spacing: .1em; color: var(--ink3);
  text-transform: uppercase; margin-bottom: 5px;
}
.train-name { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.train-name .min { font-size: 11.5px; color: var(--ink3); font-weight: 500; margin-left: 5px; letter-spacing: 0; }
.train-detail { font-size: 12px; color: var(--ink2); margin-top: 2px; max-width: 46ch; }

.prog-num { font-family: var(--mono); font-size: 15px; font-weight: 600; letter-spacing: -.02em; }
.prog-num small { font-size: 11px; color: var(--ink3); font-weight: 400; }
.prog-bar { height: 3px; background: #eaeae6; border-radius: 3px; margin-top: 7px; overflow: hidden; }
.prog-bar i { display: block; height: 100%; background: var(--ink); border-radius: 3px; transition: width .3s ease; }
.prog-cap { font-size: 11px; color: var(--ink3); margin-top: 6px; }

.todo-strip {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 0 13px;
  margin-top: 14px; border-top: 1px solid var(--line2);
}
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px 3px 7px;
  font-size: 12px; color: var(--ink); background: #fff; transition: .15s;
}
.chip:hover { border-color: #d6d6d0; }
.chip .cb { width: 14px; height: 14px; }
.chip.done { color: var(--ink3); background: #fafaf8; }
.chip.done .lbl { text-decoration: line-through; text-decoration-color: #d5d5cf; }
.chip .tag { margin-left: 1px; }

/* ── 勾选框 ─────────────────────────────────────────── */
.cb {
  flex: none; width: 15px; height: 15px; border: 1px solid #cdcdc7; border-radius: 4px;
  background: #fff; display: inline-grid; place-items: center; transition: .13s; cursor: pointer;
}
.cb svg { width: 9px; height: 9px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transition: opacity .1s; }
.cb:hover { border-color: var(--ink3); }
.cb.on { background: var(--ink); border-color: var(--ink); }
.cb.on svg { opacity: 1; }

/* ── 通用行 ─────────────────────────────────────────── */
.row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 0; border-top: 1px solid var(--line2); min-width: 0;
}
.row:first-child { border-top: 0; }
.row .lbl { min-width: 0; flex: 1; }
.row .lbl b { font-weight: 500; }
.row .sub { font-size: 11px; color: var(--ink3); }
.row.done .lbl { color: var(--ink3); text-decoration: line-through; text-decoration-color: #d8d8d2; }

.tag {
  font-size: 10.5px; line-height: 1.5; padding: 0 6px; border-radius: 4px;
  background: #f2f2ee; color: var(--ink2); letter-spacing: .02em; white-space: nowrap;
}
.tag.warn { background: #fbf1e4; color: var(--warn); }
.tag.bad { background: #fbeceb; color: var(--bad); }
.tag.ok { background: #eaf4ee; color: var(--ok); }
.tag.ink { background: #ececea; color: var(--ink); }
.tag.line { background: #fff; border: 1px solid var(--line); color: var(--ink3); }

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.up { color: var(--up); } .down { color: var(--down); } .muted { color: var(--ink3); }
.r { margin-left: auto; text-align: right; white-space: nowrap; }

/* ── 资金日历 ───────────────────────────────────────── */
.fin-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.fin-head {
  display: flex; align-items: baseline; gap: 6px; margin-bottom: 2px;
  font-size: 10px; letter-spacing: .1em; color: var(--ink3); font-weight: 600;
}
.fin-head .sum { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ink2); letter-spacing: 0; }
.fin-row { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-top: 1px solid var(--line2); }
.fin-row:first-of-type { border-top: 0; }
.fin-main { min-width: 0; flex: 1; }
.fin-main .who { font-size: 12.5px; font-weight: 500; }
.fin-main .what { font-size: 11px; color: var(--ink3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fin-amt { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; text-align: right; }
.fin-due { font-family: var(--mono); font-size: 11px; color: var(--ink3); text-align: right; min-width: 62px; }
.fin-due.soon { color: var(--warn); }
.fin-due.late { color: var(--bad); }

.recon {
  display: flex; align-items: center; gap: 9px; margin-top: 10px; padding: 9px 11px;
  border: 1px solid #f0e6d6; background: #fdf8f0; border-radius: 8px; font-size: 12px;
}
.recon b { font-weight: 600; }

/* ── 跟踪链接 ───────────────────────────────────────── */
.linkrow {
  display: flex; align-items: center; gap: 11px; padding: 11px 0;
  border-top: 1px solid var(--line2); transition: .15s;
}
.linkrow:first-of-type { border-top: 0; }
.linkrow:hover .lt { color: #000; }
.linkrow:hover .arw { transform: translate(2px, -2px); opacity: 1; }
.lt { font-size: 13px; font-weight: 500; }
.ls { font-size: 10.5px; color: var(--ink3); letter-spacing: .03em; text-transform: uppercase; }
.ln { font-size: 11px; color: var(--ink2); margin-top: 1px; }
.arw { margin-left: auto; color: var(--ink3); opacity: .6; transition: .18s; font-size: 13px; }

/* ── Sourcing ───────────────────────────────────────── */
.src-item { padding: 11px 0; border-top: 1px solid var(--line2); }
.src-item:first-child { border-top: 0; padding-top: 2px; }
.src-top { display: flex; align-items: center; gap: 7px; }
.src-client { font-size: 12.5px; font-weight: 600; letter-spacing: -.01em; }
.src-prod { font-size: 11.5px; color: var(--ink2); margin-top: 1px; }
.pipe { display: flex; gap: 3px; margin: 8px 0 6px; }
.pipe i { height: 3px; flex: 1; background: #ebebe7; border-radius: 2px; }
.pipe i.on { background: var(--ink); }
.pipe.closed i.on { background: #c9c9c3; }
.src-foot { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--ink3); }
.src-foot .nx { color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { font-size: 12px; color: var(--ink3); padding: 10px 0 6px; }

/* ── 美股 ───────────────────────────────────────────── */
.stocks { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line2); margin-top: 2px; }
.stock { padding: 9px 11px 8px; border-left: 1px solid var(--line2); min-width: 0; }
.stock:first-child { border-left: 0; padding-left: 0; }
.st-top { display: flex; align-items: baseline; gap: 5px; }
.tick { font-family: var(--mono); font-size: 10.5px; color: var(--ink3); letter-spacing: .02em; }
.chg { font-family: var(--mono); font-size: 10px; margin-left: auto; }
.st-price { font-family: var(--mono); font-size: 15.5px; font-weight: 600; letter-spacing: -.02em; margin-top: 3px; }
.spark { width: 100%; height: 20px; margin: 5px 0 4px; display: block; overflow: visible; }
.st-foot { display: flex; align-items: baseline; gap: 4px; font-size: 10px; color: var(--ink3); }
.st-foot .gap { margin-left: auto; font-family: var(--mono); }
.stock.hit { background: #fdf6f4; }
.stock.hit .st-price { color: var(--up); }
.hitflag { font-size: 9.5px; color: #fff; background: var(--up); border-radius: 3px; padding: 0 4px; letter-spacing: .04em; }

/* ── 标签页 ─────────────────────────────────────────── */
.tabs { display: inline-flex; align-self: flex-start; gap: 1px; background: #f1f1ed; padding: 2px; border-radius: 7px; }
.tab { font-size: 11.5px; padding: 3px 9px; border-radius: 5px; color: var(--ink2); letter-spacing: .01em; }
.tab.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.panel { display: none; }
.panel.on { display: block; }
.scroll { overflow-y: auto; max-height: 560px; margin-right: -8px; padding-right: 8px; }
.scroll::-webkit-scrollbar { width: 6px; }
.scroll::-webkit-scrollbar-thumb { background: #e2e2dc; border-radius: 3px; }
.scroll::-webkit-scrollbar-track { background: transparent; }

/* ── 新闻 ───────────────────────────────────────────── */
.news-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.col-cap { font-size: 10px; letter-spacing: .1em; color: var(--ink3); font-weight: 600; margin-bottom: 6px; }
.ni { display: flex; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line2); }
.ni:first-child { border-top: 0; }
.ni .idx { font-family: var(--mono); font-size: 10px; color: var(--ink3); padding-top: 2px; min-width: 12px; }
.ni .body { min-width: 0; }
.ni .t { font-size: 12.5px; font-weight: 500; line-height: 1.45; letter-spacing: -.005em; }
.ni a.t:hover { text-decoration: underline; text-decoration-color: #cfcfc9; text-underline-offset: 2px; }
.ni .m { font-size: 10.5px; color: var(--ink3); margin-top: 2px; }
.ni .s { font-size: 11.5px; color: var(--ink2); margin-top: 2px; line-height: 1.5; }

.article { padding: 2px 0; }
.art-head { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.art-title { font-size: 15px; font-weight: 600; letter-spacing: -.02em; line-height: 1.35; margin: 4px 0 3px; }
.art-meta { font-size: 10.5px; color: var(--ink3); margin-bottom: 9px; }
.art-body p { font-size: 12.5px; line-height: 1.72; color: #2c2f36; margin-bottom: 8px; }
.art-body p:last-child { margin-bottom: 0; }
.gloss { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line2); }
.gloss span { font-size: 10.5px; color: var(--ink2); background: #f6f6f2; border-radius: 4px; padding: 1px 6px; }
.gloss span i { font-style: normal; color: var(--ink2); }
.art-sep { border: 0; border-top: 1px solid var(--line2); margin: 14px 0; }

/* ── 例行 ───────────────────────────────────────────── */
.mrow { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line2); }
.mrow:first-child { border-top: 0; }
.mrow .t { font-size: 12px; }
.mrow .when { font-family: var(--mono); font-size: 10.5px; color: var(--ink3); margin-left: auto; }
.mrow.done .t { color: var(--ink3); text-decoration: line-through; text-decoration-color: #d8d8d2; }
.mrow.today .t { font-weight: 600; }

/* ── 多邻国 ─────────────────────────────────────────── */
.duo { display: flex; align-items: center; gap: 14px; }
.dots { display: flex; gap: 5px; margin-left: auto; }
.dots span {
  width: 17px; height: 17px; border-radius: 50%; background: #f1f1ed;
  display: grid; place-items: center; font-size: 8.5px; color: var(--ink3);
}
.dots span.on { background: var(--ok); color: #fff; }
.dots span.tdy { box-shadow: 0 0 0 1.5px var(--ok); }

/* ── 页脚 ───────────────────────────────────────────── */
.foot {
  margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line);
  display: flex; gap: 16px; flex-wrap: wrap; font-size: 11px; color: var(--ink3);
}
.foot .r { margin-left: auto; }

/* ── 响应式 ─────────────────────────────────────────── */
@media (max-width: 1080px) {
  .s3, .s4, .s5, .s6, .s7, .s8 { grid-column: span 12; }
  .stocks { grid-template-columns: repeat(4, 1fr); }
  .stock { border-left: 0; border-top: 1px solid var(--line2); padding-left: 0; }
  .stock:nth-child(-n+4) { border-top: 0; }
  .hero-top { grid-template-columns: 1fr 1fr; gap: 18px; }
  .hero-top > :last-child { grid-column: span 2; }
}
@media (max-width: 720px) {
  .wrap { padding: 14px 16px 56px; }
  .topbar-in { padding: 0 16px; }
  .navlinks { display: none; }
  .fin-cols, .news-cols { grid-template-columns: 1fr; gap: 14px; }
  .stocks { grid-template-columns: repeat(2, 1fr); }
  .stock:nth-child(-n+4) { border-top: 1px solid var(--line2); }
  .stock:nth-child(-n+2) { border-top: 0; }
  .hero-top { grid-template-columns: 1fr; }
  .hero-top > :last-child { grid-column: auto; }
}

/* ── 补充状态 ───────────────────────────────────────── */
html { scroll-behavior: smooth; }
.fin-row.done .who { color: var(--ink3); text-decoration: line-through; text-decoration-color: #d8d8d2; }
.fin-row.done .fin-amt { color: var(--ink3); }
.src-item .row:first-child { border-top: 0; }
section[id] { scroll-margin-top: 64px; }
.grid { align-items: stretch; }

/* ── 右列堆叠 ───────────────────────────────────────── */
.col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.scroll {
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 20px), transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 20px), transparent 100%);
}
@media (max-width: 1080px) { .col { grid-column: span 12; } }

/* ── 收款分周 / 已收款 ───────────────────────────────── */
.grp {
  display: flex; align-items: baseline; gap: 6px;
  font-size: 9.5px; letter-spacing: .09em; font-weight: 600; color: var(--ink3);
  margin: 9px 0 1px; padding-top: 7px; border-top: 1px solid var(--line2);
}
.grp:first-of-type { margin-top: 5px; padding-top: 0; border-top: 0; }
.grp > span { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--ink3); letter-spacing: 0; }
.grp.muted { color: #b7bcc4; }
.grp + .fin-row { border-top: 0; }
.tickmark {
  flex: none; width: 15px; height: 15px; display: grid; place-items: center;
  color: var(--ok); font-size: 11px; line-height: 1;
}

/* ── 添加到主屏幕后的安全区（刘海屏） ───────────────── */
@supports (padding: env(safe-area-inset-top)) {
  @media (max-width: 720px) {
    .topbar { padding-top: env(safe-area-inset-top); }
    .topbar-in {
      padding-left: calc(16px + env(safe-area-inset-left));
      padding-right: calc(16px + env(safe-area-inset-right));
    }
    .wrap {
      padding-left: calc(16px + env(safe-area-inset-left));
      padding-right: calc(16px + env(safe-area-inset-right));
      padding-bottom: calc(56px + env(safe-area-inset-bottom));
    }
  }
}
