/* 极简样式：结构布局 + 功能性颜色，原生控件与系统字体。
   视觉语言沿用同公司 FCN 工具（顶栏深墨、浅灰底、白卡描边、粘性药丸标签条）。 */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: #1f2733;
  background: #f4f6f9;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* 桌面端：内容区自身滚动，body 不滚动 */
}
h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 15px; margin: 0 0 8px; }
h3 { font-size: 17px; margin: 0 0 4px; }
h4 { font-size: 13.5px; margin: 0 0 6px; color: #3a4353; }
.muted { color: #7a8493; }
.small { font-size: 12.5px; }
.hidden { display: none !important; }
.mono { font-family: Consolas, "SF Mono", Menlo, monospace; }

input, select, button { font: inherit; }
button { padding: 4px 10px; border: 1px solid #c2cad6; border-radius: 4px; background: #f7f9fc; cursor: pointer; }
button:hover { background: #eef2f8; }
input[type=text], input[type=password] {
  width: 100%; min-width: 0; padding: 4px 6px;
  border: 1px solid #c2cad6; border-radius: 4px; background: #fff;
}

/* ── 顶栏 ─────────────────────────────────────────────────────────────────── */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 8px 16px; background: #1f2733; color: #fff; flex-wrap: wrap;
}
.topbar-title { cursor: pointer; }
.topbar-title strong { font-size: 15px; }
.topbar-title .muted { color: #b6c0d0; margin-left: 8px; font-size: 12px; }
.topbar-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.topbar-sep { color: rgba(255, 255, 255, 0.35); padding: 0 2px; user-select: none; }
#btn-logout { background: #c0392b; color: #fff; border-color: #c0392b; }
#btn-logout:hover { background: #a5311f; border-color: #a5311f; }

/* 数据新鲜度：各数据源的最后更新时间 */
.freshness { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 7px; font-size: 12px; color: #b6c0d0; }
.freshness b { color: #e8edf5; font-weight: 600; }
.freshness .warn { color: #ffc95c; }
.freshness .warn b { color: #ffc95c; }
.freshness .fsep { color: rgba(255, 255, 255, 0.3); }

.disclaimer {
  display: flex; align-items: flex-start; gap: 10px; background: #fff7e6;
  border-bottom: 1px solid #f0d9a8; color: #7a5a00; padding: 8px 16px;
  font-size: 13px; line-height: 1.55;
}
.disclaimer-text { flex: 1 1 auto; min-width: 0; }
.disclaimer.collapsed .disclaimer-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.disclaimer-toggle {
  flex: 0 0 auto; align-self: flex-start; white-space: nowrap;
  background: #fff; border: 1px solid #e0c98a; color: #7a5a00;
  border-radius: 4px; padding: 2px 8px; font-size: 12px;
}
.disclaimer-toggle:hover { background: #fdf3dc; }

/* ── 布局：单栏内容区（本看板无输入参数，不需要侧边栏）────────────────────── */
.layout { display: flex; align-items: stretch; padding: 14px; flex: 1 1 auto; min-height: 0; }
.content { flex: 1; min-width: 0; overflow-y: auto; height: 100%; position: relative; padding-right: 8px; }
#cards-wrap { display: flex; flex-direction: column; gap: 14px; }

/* 粘性标签导航 */
.tabbar {
  position: sticky; top: 0; z-index: 5; display: flex; gap: 4px; overflow-x: auto;
  background: #f4f6f9; padding: 6px 2px; border-bottom: 1px solid #e2e7ee;
}
.tabbar a {
  white-space: nowrap; padding: 5px 12px; border-radius: 14px; font-size: 14px;
  color: #5a6472; text-decoration: none; border: 1px solid transparent;
}
.tabbar a:hover { background: #e9eef6; }
.tabbar a.active { background: #274b9f; color: #fff; }

/* ── 卡片 ─────────────────────────────────────────────────────────────────── */
.card { background: #fff; border: 1px solid #e2e7ee; border-radius: 6px; padding: 14px; scroll-margin-top: 46px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-desc { color: #7a8493; font-size: 12.5px; line-height: 1.6; margin: 6px 0 0; }
.card-note { background: #f7f9fc; border-left: 3px solid #cfd8e6; padding: 6px 10px; margin: 10px 0 0; font-size: 12.5px; color: #5a6472; }

/* 结论卡（自动生成的文字） */
#card-commentary .commentary-text { line-height: 1.85; margin: 8px 0 0; white-space: pre-wrap; }
.auto-tag { display: inline-block; background: #eef5ff; border: 1px solid #cfe0fb; color: #274b9f; border-radius: 3px; padding: 0 6px; font-size: 11.5px; }

/* 指标数值瓦片 */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 12px 0 4px; }
.tile { border: 1px solid #e6eaf0; border-radius: 5px; padding: 8px 10px; background: #fcfdfe; }
.tile.emphasis { border-color: #5a82dc; border-width: 2px; padding: 7px 9px; }
.tile.stale { background: #fff7e6; border-color: #f0d9a8; }
.tile .t-name { font-size: 12.5px; color: #5a6472; line-height: 1.35; }
.tile .t-en { color: #98a2b0; }
.tile .t-val { font-size: 20px; font-weight: 600; margin: 2px 0 1px; letter-spacing: -0.2px; }
.tile .t-row { font-size: 12px; color: #7a8493; display: flex; flex-wrap: wrap; gap: 8px; }
.tile .t-pct { font-size: 12px; color: #7a8493; }
.up { color: #c0392b; }
.down { color: #2f9e5b; }
.flat { color: #7a8493; }

/* 图面（一张卡里的一张图） */
.pane { margin-top: 14px; }
.pane-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pane-title { font-size: 13.5px; font-weight: 600; color: #3a4353; }
.pane-hint { font-size: 12px; color: #98a2b0; }
canvas.chart { width: 100%; display: block; background: #fff; touch-action: pan-y; }
canvas.tall { height: 300px; }
canvas.mid { height: 210px; }
.legend { font-size: 12.5px; color: #5a6472; display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; }
.legend .sw { display: inline-block; width: 12px; height: 3px; vertical-align: middle; margin-right: 4px; }
.legend .leg-item { cursor: pointer; user-select: none; }
.legend .leg-item.off { opacity: 0.4; text-decoration: line-through; }
.legend .dash { height: 0; border-top: 3px dashed currentColor; background: none !important; }

/* ── 表格 ─────────────────────────────────────────────────────────────────── */
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { border: 1px solid #e6eaf0; padding: 5px 9px; text-align: right; }
th:first-child, td:first-child { text-align: left; }
thead th { background: #f4f6f9; font-weight: 600; }
.table-wrap { overflow-x: auto; }

/* 概率矩阵 */
.matrix td.cell { text-align: center; font-variant-numeric: tabular-nums; }
.matrix td.zero { color: #c8cfd9; }
.matrix .m-date { white-space: nowrap; }
.matrix .m-rate { font-variant-numeric: tabular-nums; white-space: nowrap; }
.matrix .m-method { font-size: 11px; color: #98a2b0; }
.matrix tr.next-meeting td { box-shadow: inset 0 0 0 9999px rgba(90, 130, 220, 0.06); }

/* 宏观日历 */
.cal-week + .cal-week { margin-top: 14px; }
.cal-week h4 { display: flex; gap: 8px; align-items: baseline; }
.cal-empty { color: #98a2b0; font-size: 13px; }
tr.is-today td { background: #fff8e6; }
tr.is-fomc td { background: #eef5ff; font-weight: 600; }
td.cal-time { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* 横幅：随内容滚动，【不要】做成 sticky —— 它会盖住同样 sticky 的标签条和卡片。
   另外给一个关闭按钮，看过就能收掉。 */
.banner-error, .banner-info {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 10px; border-radius: 6px; margin-bottom: 12px;
}
.banner-error { background: #fff2f0; border: 1px solid #ffccc7; color: #a8321f; }
.banner-info { background: #eef5ff; border: 1px solid #cfe0fb; color: #274b9f; }
.banner-body { flex: 1 1 auto; min-width: 0; }
.banner-close {
  flex: 0 0 auto; background: transparent; border: 0; color: inherit;
  font-size: 15px; line-height: 1.2; padding: 0 2px; cursor: pointer; opacity: 0.6;
}
.banner-close:hover { opacity: 1; background: transparent; }
.loading { padding: 40px; text-align: center; color: #7a8493; }

/* 页脚：数据来源与署名 */
.app-footer {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  flex-wrap: wrap; padding: 9px 16px; background: #fff;
  border-top: 1px solid #e2e7ee; color: #7a8493; font-size: 12px; line-height: 1.7;
}
.app-footer a { color: #5a6472; }
.footer-sources { flex: 1 1 420px; min-width: 0; }
.footer-sources b { color: #5a6472; font-weight: 600; }
.footer-author { flex: 0 0 auto; }
html.gate-checking .app-footer { display: none !important; }

/* ── 访问校验占位屏 ───────────────────────────────────────────────────────── */
#gate-splash {
  position: fixed; inset: 0; z-index: 2000; display: none;
  align-items: center; justify-content: center;
  background: linear-gradient(160deg, #1f2733, #0f1620); color: #cdd6e4; font-size: 15px;
}
html.gate-checking #gate-splash { display: flex; }
/* 校验中隐藏应用主体，避免「删元素即见」 */
html.gate-checking .topbar,
html.gate-checking .disclaimer,
html.gate-checking .layout { display: none !important; }

/* ── 独立登录页 ───────────────────────────────────────────────────────────── */
body.login-page { overflow: auto; background: #0f1620 linear-gradient(160deg, #1f2733, #0f1620) no-repeat fixed; }
.login-wrap { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box {
  width: min(92vw, 380px); background: #fff; border-radius: 12px;
  padding: 30px 30px 26px; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.login-lock { font-size: 34px; margin-bottom: 6px; }
.login-box h1 { font-size: 24px; margin: 0 0 6px; }
.login-sub1 { font-size: 18px; }
.login-sub2 { color: #7a8493; font-size: 13px; line-height: 1.6; margin: 0 0 12px; }
.login-warn { color: #b4462a; font-size: 13px; line-height: 1.6; margin: 0 0 18px; }
.login-field { display: block; text-align: left; margin-bottom: 12px; }
.login-field span { display: block; font-size: 13px; color: #5a6472; margin-bottom: 4px; }
.login-field input { width: 100%; padding: 10px 12px; font-size: 14px; }
.login-box button {
  width: 100%; padding: 11px; font-size: 16px; margin-top: 4px;
  background: #274b9f; color: #fff; border-color: #274b9f; letter-spacing: 2px;
}
.login-box button:hover { background: #1f3d84; }
.login-box button:disabled { background: #9aa8c8; border-color: #9aa8c8; cursor: default; }
.login-hint { margin-top: 14px; font-size: 13px; color: #7a8493; }
.login-error { margin-top: 8px; font-size: 13px; color: #c0392b; min-height: 18px; }
.login-author { margin-top: 16px; font-size: 13px; color: #7a8493; }
.login-author a { color: #5a6472; }

/* ── 窄屏 ─────────────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  body { overflow: auto; }
  .layout { padding: 10px; }
  .content { overflow: visible; height: auto; padding-right: 0; }
  canvas.tall { height: 240px; }
  canvas.mid { height: 180px; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .topbar { align-items: flex-start; }
}
