/* EC 欧线数据罗盘 — 共享样式（钢蓝金融终端风，参照 scfi-app 的克制配色） */
:root {
  --surface: #fcfcfb;
  --surface-2: #f4f4f2;
  --card: #ffffff;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #8a8984;
  --hair: #e4e3df;
  --accent: #2350a8;

  /* 数据系列（dataviz 校验通过的参考调色板前缀） */
  --s1: #2a78d6;  /* SCFIS / 系列1 */
  --s2: #1baf7a;  /* SCFI  / 系列2 */
  --s3: #eda100;  /* 系列3 */
  --s4: #008300;  /* 系列4 */
  --s5: #4a3aa7;  /* 系列5 */

  /* 涨跌语义（中国市场：涨红跌绿） */
  --up: #e34948;
  --down: #008300;
  --warn: #eda100;
  --bad: #e34948;

  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font: 14px/1.7 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--surface); color: var(--ink);
  letter-spacing: .01em;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 10px 20px; background: #13233f; color: #fff;
  position: sticky; top: 0; z-index: 1000;
}
.topbar .brand { font-weight: 700; font-size: 16px; letter-spacing: .5px; }
.topbar .brand small { font-weight: 400; opacity: .65; margin-left: 8px; font-size: 12px; }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a {
  color: #c9d4e8; padding: 5px 14px; border-radius: 6px; font-size: 13px;
}
.topbar nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.topbar nav a.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.topbar .asof { margin-left: auto; font-size: 12px; opacity: .6; font-family: var(--mono); }

/* ---------- 布局 ---------- */
.wrap { max-width: 1320px; margin: 0 auto; padding: 26px 28px 72px; }
.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid > * { min-width: 0; }  /* 防止长内容把等分列撑爆 */
@media (max-width: 980px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border: 1px solid var(--hair); border-radius: var(--radius);
  padding: 20px 22px;
}
.card h2 {
  font-size: 15.5px; margin-bottom: 10px; display: flex; align-items: baseline; gap: 10px;
}
.card h2 .sub { font-size: 12px; color: var(--ink-3); font-weight: 400; line-height: 1.6; }
.card .src { font-size: 11px; color: var(--ink-3); margin-top: 12px; line-height: 1.6; }

.section-title { font-size: 17.5px; font-weight: 700; margin: 38px 0 16px; display: flex; align-items: baseline; gap: 10px; }
.section-title .sub { font-size: 12px; color: var(--ink-3); font-weight: 400; }

/* ---------- 统计块 ---------- */
.tiles { display: flex; gap: 16px; flex-wrap: wrap; }
.tile {
  flex: 1; min-width: 150px; background: var(--card); border: 1px solid var(--hair);
  border-radius: var(--radius); padding: 16px 18px;
}
.tile .k { font-size: 12.5px; color: var(--ink); font-weight: 700; }
.tile .k small { font-weight: 400; color: var(--ink-3); }
.tile .v { font-size: 24px; font-weight: 800; font-family: var(--mono); margin-top: 2px; }
.tile .v small { font-size: 12px; font-weight: 400; color: var(--ink-3); }
.tile .d { font-size: 12px; margin-top: 2px; color: var(--ink-3); }
.tile .d.up { color: var(--up); } .tile .d.down { color: var(--down); }

/* ---------- 徽标 chips ---------- */
.chip {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 11px; line-height: 1.6; background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--hair); white-space: nowrap;
}
.chip.up { background: #fdeceb; color: #a02c22; border-color: #f3c8c4; }
.chip.down { background: #e8f4e8; color: #0e5c0e; border-color: #c5e2c5; }
.chip.warn { background: #fdf3dd; color: #8a5c00; border-color: #f0dcae; }
.chip.info { background: #e9f0fb; color: #2350a8; border-color: #c9d9f2; }
.chip.mock { background: #f3eefe; color: #58379c; border-color: #ddd0f5; }

/* ---------- 图表 ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .axis text { font: 10.5px var(--mono); fill: var(--ink-3); }
.chart .grid-line { stroke: var(--hair); stroke-width: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin: 6px 2px 0; }
.legend .it { display: flex; align-items: center; gap: 5px; }
.legend .sw { width: 14px; height: 3px; border-radius: 2px; }
.legend .sw.box { height: 10px; border-radius: 2px; }
/* 折线图图例悬浮于图表右上角，不打断图下方的交互动线 */
.chart > .legend {
  position: absolute; top: 4px; right: 14px; margin: 0;
  background: rgba(252, 252, 251, .92); border: 1px solid var(--hair);
  border-radius: 6px; padding: 3px 10px; pointer-events: none;
}

#tooltip {
  position: fixed; z-index: 2000; pointer-events: none; display: none;
  background: #1d2b45; color: #fff; border-radius: 6px; padding: 7px 10px;
  font-size: 12px; line-height: 1.5; max-width: 320px; box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
#tooltip .tt-d { font-family: var(--mono); opacity: .75; font-size: 11px; }
#tooltip .tt-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
#tooltip .tt-row .sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }
#tooltip .tt-row b { font-family: var(--mono); margin-left: auto; padding-left: 12px; }

.range-btns { display: inline-flex; gap: 2px; margin-left: auto; }
.range-btns button {
  border: 1px solid var(--hair); background: var(--card); color: var(--ink-2);
  font-size: 12px; padding: 2px 10px; cursor: pointer;
}
.range-btns button:first-child { border-radius: 6px 0 0 6px; }
.range-btns button:last-child { border-radius: 0 6px 6px 0; }
.range-btns button.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 公告标记字形 */
.ev-glyph { cursor: pointer; }
.ev-glyph:hover { opacity: .75; }

/* ---------- 表格 ---------- */
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th {
  text-align: left; font-weight: 600; color: var(--ink-2); font-size: 11.5px;
  border-bottom: 1px solid var(--hair); padding: 7px 10px; white-space: nowrap;
  position: sticky; top: 0; background: var(--card); z-index: 1;
  box-shadow: 0 1px 0 var(--hair);
}
table.data td { padding: 8px 10px; border-bottom: 1px solid var(--surface-2); vertical-align: top; line-height: 1.65; }
table.data td.num { font-family: var(--mono); text-align: right; white-space: nowrap; }
table.data .mono { font-family: var(--mono); white-space: nowrap; }
table.data .ellip { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; vertical-align: bottom; }
table.data .dim { color: var(--ink-3); }
table.data th.r, table.data td.r { text-align: right; }
table.data tr:hover td { background: #f7f9fd; }
.scroll-y { overflow-y: auto; }
/* 堆叠柱：悬停整列轻提亮 */
.chart svg rect.hover-col:hover { fill: rgba(19, 35, 63, .045); }
/* 通用：图例移出绘图区，静态置于图表顶部（多序列窄图防遮挡） */
.chart.legend-top { display: flex; flex-direction: column; }
.chart.legend-top > .legend { position: static; order: -1; align-self: center;
  background: none; border: 0; box-shadow: none; padding: 0 0 4px;
  font-size: 11px; gap: 12px; flex-wrap: wrap; justify-content: center; }
.chart.legend-top > .legend .sw { width: 12px; height: 3px; }
.chart.legend-top > svg { flex: 1; min-height: 0; }

/* ---------- 事件时间线 ---------- */
.evline { border-left: 2px solid var(--hair); margin-left: 6px; padding-left: 16px; }
.evline .ev {
  position: relative; padding: 6px 0 10px;
}
.evline .ev:before {
  content: ""; position: absolute; left: -21px; top: 12px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--ink-3);
}
.evline .ev.sev-WARN:before { background: var(--warn); }
.evline .ev.sev-DISRUPT:before { background: var(--bad); }
.evline .ev .meta { font-size: 11.5px; color: var(--ink-3); font-family: var(--mono); }
.evline .ev .txt { margin-top: 1px; }

/* ---------- 过滤条 ---------- */
.filterbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filterbar .fbtn {
  border: 1px solid var(--hair); background: var(--card); border-radius: 999px;
  padding: 3px 12px; font-size: 12.5px; cursor: pointer; color: var(--ink-2);
}
.filterbar .fbtn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- 公告流（单行紧凑式） ---------- */
.feed-item {
  display: flex; align-items: baseline; gap: 8px; padding: 9px 0;
  border-bottom: 1px dashed var(--hair); font-size: 13px; line-height: 1.7;
}
.feed-item:last-child { border-bottom: 0; }
.feed-item .m { color: var(--ink-3); font-size: 11.5px; font-family: var(--mono); flex: none; }
.feed-item .chip { flex: none; }
.feed-item a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 运价日历（窄列双行式） ---------- */
.cal-item { padding: 10px 0; border-bottom: 1px dashed var(--hair); font-size: 13px; }
.cal-item:last-child { border-bottom: 0; }
.cal-item .hd { display: flex; align-items: baseline; gap: 7px; flex-wrap: nowrap; }
.cal-item .hd .num { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.cal-item .prices { font-family: var(--mono); font-size: 12px; margin-top: 5px; color: var(--ink); line-height: 1.7; }

/* ---------- 公告明细面板 ---------- */
.ann-detail { border-top: 2px solid var(--accent); background: #f7f9fd; border-radius: 0 0 8px 8px; padding: 10px 14px; margin-top: 8px; }
.ann-detail .hd { font-size: 12.5px; font-weight: 700; margin-bottom: 6px; }
.ann-item { padding: 6px 0; border-bottom: 1px dashed var(--hair); font-size: 12.5px; }
.ann-item:last-child { border-bottom: 0; }
.ann-item .m { color: var(--ink-3); font-size: 11.5px; font-family: var(--mono); margin-right: 6px; }

/* ---------- 情绪 ---------- */
.gauge { margin: 10px 0 4px; }
.gauge .bar { position: relative; height: 10px; border-radius: 6px;
  background: linear-gradient(90deg, #008300 0%, #9ec7a0 30%, #d9d9d4 50%, #eba9a2 70%, #e34948 100%); }
.gauge .pin { position: absolute; top: -4px; width: 4px; height: 18px; background: var(--ink); border-radius: 2px; transform: translateX(-50%); }
.gauge .lab { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--ink-3); margin-top: 3px; }

.art { padding: 12px 0; border-bottom: 1px dashed var(--hair); font-size: 13px; line-height: 1.75; }
.art:last-child { border-bottom: 0; }
.art .why { color: var(--ink-2); font-size: 12.5px; margin-top: 4px; }
.art .m { font-size: 11px; color: var(--ink-3); font-family: var(--mono); margin-top: 3px; }

/* ---------- 地图页 ---------- */
.map-layout { display: flex; height: calc(100vh - 46px); }
#map { flex: 1; }
.map-side {
  width: 280px; flex: none; background: var(--card); border-left: 1px solid var(--hair);
  overflow-y: auto; padding: 14px;
}
.map-side h3 { font-size: 13px; margin: 14px 0 6px; color: var(--ink-2); }
.map-side h3:first-child { margin-top: 0; }
.lrow { display: flex; align-items: center; gap: 7px; padding: 3px 0; font-size: 12.5px; cursor: pointer; user-select: none; }
.lrow input { accent-color: var(--accent); }
.lrow .sw { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.lrow .n { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.ship-icon svg { overflow: visible; }
/* 航行船：CSS 边框三角（12×16，参考 vessel-schedule/map_demo.html 的尺寸手感）
 * 注：不加 drop-shadow 滤镜——129 个带滤镜元素在缩放动画中每帧重光栅化，Safari 上明显掉帧 */
.ship-icon .tri { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-bottom: 16px solid currentColor; transform-origin: 50% 60%; }
/* 停泊船：亮色圆点 + 白圈 */
.ship-icon .moor { width: 11px; height: 11px; border-radius: 50%; background: currentColor;
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.leaflet-popup-content { font-size: 12.5px; line-height: 1.6; }
.leaflet-popup-content b { font-size: 13px; }
.pop-kv { font-family: var(--mono); font-size: 11.5px; color: #444; }

.disclaimer { font-size: 11px; color: var(--ink-3); margin-top: 30px; border-top: 1px solid var(--hair); padding-top: 10px; }

/* ---------- 首页驾驶舱（地图居中 + 左右栏 + 底栏，均可收起） ---------- */
.cockpit { height: calc(100vh - 46px); display: flex; flex-direction: column; background: var(--surface); }
.cockpit-mid { flex: 1; display: flex; min-height: 0; }
/* 中间列：地图在上、价格底栏在下——底栏不横穿左右侧栏 */
.cockpit-center { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cockpit #map { flex: 1; min-width: 0; min-height: 0; }

.rail { width: 304px; flex: none; background: var(--card); display: flex; overflow: hidden;
  transition: width .22s ease; position: relative; z-index: 500; }
.rail-l { border-right: 1px solid var(--hair); }
.rail-r { border-left: 1px solid var(--hair); }
.rail.collapsed { width: 36px; }
.rail-inner { display: flex; flex-direction: column; width: 304px; flex: none; }
.rail.collapsed .rail-inner { display: none; }
.rail-tab { display: none; }
.rail.collapsed .rail-tab { display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 36px; height: 100%; writing-mode: vertical-rl; cursor: pointer; border: 0;
  background: var(--card); color: var(--ink); font-weight: 700; font-size: 13.5px; letter-spacing: 2px; }
.rail.collapsed .rail-tab:hover { background: var(--surface-2); }

.rail-head { display: flex; align-items: center; gap: 8px; padding: 11px 13px;
  border-bottom: 1px solid var(--hair); font-weight: 700; font-size: 14.5px; flex: none; }
.rail-head .px { margin-left: auto; }
/* 栏体：统一段落节奏（区块间距一致，靠内容充实填满，不做弹性拉伸） */
.rail-body { padding: 14px 14px 20px; overflow-y: auto; flex: 1;
  display: flex; flex-direction: column; gap: 20px; }
.rail-body > * { flex: none; }
.px, .dock-x { border: 1px solid var(--hair); background: var(--surface-2); border-radius: 6px;
  cursor: pointer; font-size: 11.5px; padding: 2px 9px; color: var(--ink-2); flex: none; }
.px:hover, .dock-x:hover { background: #e9e9e6; }

/* 栏内核心读数：方向 + 幅度一眼可读 */
.rail-hero { border: 1px solid var(--hair); border-radius: var(--radius); padding: 12px 14px;
  margin-bottom: 8px; background: var(--card); }
.rail-hero .k { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.rail-hero .v { font-size: 25px; font-weight: 800; font-family: var(--mono); line-height: 1.3; }
.rail-hero .v small { font-size: 12px; font-weight: 400; color: var(--ink-3); }
.rail-hero .d { font-size: 12.5px; font-weight: 600; margin-top: 1px; }
.rail-hero .d.up { color: var(--up); } .rail-hero .d.down { color: var(--down); }
.rail-hero .d .arrow { font-size: 14px; }
.rail-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--ink-2);
  padding: 2px 2px 10px; }
.rail-facts b { font-family: var(--mono); }
.rail-facts .up { color: var(--up); } .rail-facts .down { color: var(--down); }
/* 样本口径说明：低调的浅底注释块 */
.rail-note { font-size: 11px; line-height: 1.7; color: var(--ink-3);
  background: var(--surface-2); border-radius: 6px; padding: 8px 11px; }
.rail-note b { color: var(--ink-2); font-family: var(--mono); font-weight: 600; }
/* 典型样本路径清单 */
.path-item { padding: 6px 0; border-bottom: 1px dashed var(--hair); font-size: 12px; line-height: 1.5; }
.path-item:last-child { border-bottom: 0; }
.path-item .rt { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.path-item .rt .co { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.path-item .rt .to { color: var(--ink-3); flex: none; }
.path-item .rt .dest { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; }
.path-item .bar-row { display: flex; align-items: center; gap: 7px; margin-top: 2px; }
.path-item .track { flex: 1; height: 8px; background: var(--surface-2); border-radius: 3px; }
.path-item .fill { display: block; height: 8px; border-radius: 3px; background: var(--s1); min-width: 2px; }
.path-item .n { font-family: var(--mono); font-size: 11px; color: var(--ink-2); flex: none; }
.rail-sec { margin: 0; }
/* 图表区吸收整栏剩余高度：高窗口下图表自动变高，矮窗口保持基准不溢出 */
.rail-sec.grow { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.rail-sec.grow .chart { flex: 1; min-height: 0; }
.rail-sec.grow .chart.legend-top > svg { flex: 1; min-height: 0; height: auto; }
.rail-h2 { font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px; }
.rail-more { display: inline-block; margin-top: 8px; font-size: 12px; }
.mini-ev { font-size: 12px; padding: 10px 0; border-bottom: 1px dashed var(--hair);
  line-height: 1.55; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-ev:last-child { border-bottom: 0; }
.mini-ev.past { opacity: .5; }
/* 事件时间线上的"快照日"分割线 */
.ev-today { display: flex; align-items: center; gap: 8px; padding: 6px 0;
  font-size: 10.5px; color: var(--ink-3); font-family: var(--mono); white-space: nowrap; }
.ev-today::before, .ev-today::after { content: ""; flex: 1; border-top: 1px solid var(--hair); }
.mini-ev .m { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
.indbar { display: flex; align-items: center; gap: 7px; padding: 2.5px 0; font-size: 11.5px; }
.indbar .nm { width: 92px; flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.indbar .track { flex: 1; height: 12px; background: var(--surface-2); border-radius: 3px; }
.indbar .fill { display: block; height: 12px; border-radius: 3px; background: var(--s1); min-width: 2px; }
.indbar .pv { width: 40px; flex: none; text-align: right; font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }

/* 底栏：价格 + 情绪 */
.dock { flex: none; background: var(--card); border-top: 1px solid var(--hair); overflow: hidden;
  height: 250px; transition: height .22s ease; }
.dock.collapsed { height: 34px; }
.dock-tab { display: none; }
.dock.collapsed .dock-tab { display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 34px;
  padding: 0 16px; cursor: pointer; border: 0; background: var(--card); color: var(--ink);
  font-weight: 700; font-size: 13.5px; }
.dock.collapsed .dock-tab:hover { background: var(--surface-2); }
.dock.collapsed .dock-inner { display: none; }
.dock-inner { height: 100%; display: flex; flex-direction: column; }
.dock-head { display: flex; align-items: center; gap: 8px; padding: 8px 16px; flex: none;
  border-bottom: 1px solid var(--hair); font-weight: 700; font-size: 14px; position: relative; }
/* 收起按钮居中：抽屉把手式 */
.dock-head .dock-x { position: absolute; left: 50%; transform: translateX(-50%); margin-left: 0; }
.dock-body { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 10px 20px 12px; min-height: 0; }
/* 底栏 KPI：无边框通栏读数，竖细线分隔，按内容取宽不裁切 */
.dock-kpi { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 0; flex: none; padding: 2px 2px 4px; }
.dock-kpi .kp { flex: 0 0 auto; display: flex; align-items: baseline; gap: 8px; white-space: nowrap; padding: 0 20px; }
.dock-kpi .kp:first-child { padding-left: 2px; }
.dock-kpi .kp + .kp { border-left: 1px solid var(--hair); }
.dock-kpi .kp .k { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.dock-kpi .kp .k small { font-weight: 400; color: var(--ink-3); }
.dock-kpi .kp .v { font-size: 16px; font-weight: 800; font-family: var(--mono); }
.dock-kpi .kp .v small { font-size: 11px; font-weight: 400; color: var(--ink-3); }
.dock-kpi .kp .d { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.dock-kpi .kp .d.up { color: var(--up); } .dock-kpi .kp .d.down { color: var(--down); }
.dock-chart { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.dock-chart .rail-h2 { display: flex; align-items: baseline; }
.dock-chart .chart { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.dock-chart .chart svg { flex: 1; min-height: 0; height: auto; }
/* 图例悬浮于绘图区内部右上角（半透明底），不占图表外空间 */
.dock-chart .chart > .legend { position: absolute; top: 2px; right: 52px;
  width: max-content; background: rgba(255, 255, 255, .88); border: 0; box-shadow: none;
  padding: 2px 10px; border-radius: 4px; font-size: 11px; gap: 14px; white-space: nowrap; }
.dock-chart .chart > .legend .sw { width: 12px; height: 3px; }
@media (max-width: 900px) {
  .rail { width: 250px; } .rail-inner { width: 250px; }
}
