:root {
  --bg: #05070c;
  --bg2: #080b13;
  --panel: rgba(255, 255, 255, 0.028);
  --panel-2: rgba(255, 255, 255, 0.055);
  --stroke: rgba(255, 255, 255, 0.075);
  --stroke-2: rgba(255, 255, 255, 0.14);
  --txt: #e8eef8;
  --txt-2: #9aa8bd;
  --txt-3: #5f6d82;
  --c1: #35e2ff;
  --c2: #9b8cff;
  --c3: #3ee6a4;
  --c4: #ffc061;
  --c5: #ff7aa8;
  --wb: #35e2ff;
  --dsh: #a48bff;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 12% -8%, rgba(53, 226, 255, 0.10), transparent 60%),
    radial-gradient(900px 500px at 88% 0%, rgba(155, 140, 255, 0.10), transparent 62%),
    radial-gradient(700px 500px at 50% 110%, rgba(62, 230, 164, 0.055), transparent 60%),
    linear-gradient(180deg, #06080e 0%, #05070c 40%, #04060a 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 78%);
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 1560px;
  margin: 0 auto;
  padding: 18px 22px 34px;
}

/* ---------------- topbar ---------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 6px 4px 16px;
}

.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }

.logo {
  width: 42px; height: 42px;
  border-radius: 13px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, rgba(53, 226, 255, 0.20), rgba(155, 140, 255, 0.16));
  border: 1px solid rgba(53, 226, 255, 0.32);
  box-shadow: 0 0 22px rgba(53, 226, 255, 0.18), inset 0 0 18px rgba(53, 226, 255, 0.07);
  flex: none;
}
.logo svg { width: 24px; height: 24px; }

h1 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0.16em;
  font-weight: 650;
  font-family: var(--mono);
}
.brand small {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--txt-3);
  letter-spacing: 0.06em;
}

.engines { display: flex; gap: 8px; margin-left: auto; }
.engine-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 11px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  font-size: 11.5px;
  color: var(--txt-2);
  white-space: nowrap;
}
.engine-pill b { color: var(--txt); font-weight: 600; letter-spacing: 0.02em; }
.engine-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--txt-3); flex: none; }
.engine-pill.on .dot { background: var(--c3); box-shadow: 0 0 9px var(--c3); animation: pulse 2.2s infinite; }
.engine-pill .mono { font-family: var(--mono); font-size: 10.5px; color: var(--txt-3); }
.engine-pill .en-short { display: none; }

.toolbar { display: flex; align-items: center; gap: 10px; }

.seg {
  display: flex;
  padding: 3px;
  gap: 2px;
  border-radius: 11px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.025);
}
.seg button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--txt-3);
  font-family: var(--sans);
  font-size: 11.5px;
  padding: 6px 11px;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.22s;
}
.seg button:hover { color: var(--txt-2); }
.seg button.on {
  color: #05121a;
  background: linear-gradient(180deg, #6deaff, #2fd3f2);
  font-weight: 650;
  box-shadow: 0 3px 14px rgba(53, 226, 255, 0.28);
}

.live-badge {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--c3);
  padding: 7px 11px;
  border-radius: 10px;
  border: 1px solid rgba(62, 230, 164, 0.24);
  background: rgba(62, 230, 164, 0.06);
}
.live-badge i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--c3);
  box-shadow: 0 0 10px var(--c3);
  animation: pulse 1.6s infinite;
}
.live-badge stale { color: var(--txt-3); }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.75); } }

/* ---------------- kpi ---------------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.kpi {
  position: relative;
  overflow: hidden;
  padding: 13px 15px 16px;
  border-radius: 15px;
  border: 1px solid var(--stroke);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.014));
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.kpi::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(120px 60px at 12% 0%, var(--glow, rgba(53, 226, 255, 0.16)), transparent 70%);
  pointer-events: none;
}
.kpi .k-label {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--txt-3);
  text-transform: uppercase;
  display: flex; align-items: center; gap: 6px;
}
.kpi .k-label em { font-style: normal; color: var(--txt-3); font-family: var(--mono); letter-spacing: 0; }
.kpi .k-value {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 7px 0 2px;
  line-height: 1.05;
  display: flex; align-items: baseline; gap: 5px;
}
.kpi .k-value span { font-size: 12px; color: var(--txt-3); font-weight: 400; }
.kpi .k-sub { font-size: 10.5px; color: var(--txt-3); font-family: var(--mono); }
.kpi .k-sub b { color: var(--txt-2); font-weight: 500; }
.kpi .delta { font-family: var(--mono); font-size: 10.5px; }
.kpi .delta.up { color: var(--c3); }
.kpi .delta.down { color: var(--c5); }
.kpi canvas { position: absolute; right: 0; bottom: 0; width: 100%; height: 30px; opacity: 0.8; z-index: 0; }
.kpi .k-label, .kpi .k-value, .kpi .k-sub { position: relative; z-index: 1; }

/* ---------------- 设备连接条 ---------------- */
.conn-bar {
  display: flex; align-items: center; gap: 20px;
  padding: 11px 16px; margin-bottom: 12px;
  border-radius: 14px;
  border: 1px solid rgba(62, 230, 164, 0.16);
  background: linear-gradient(100deg, rgba(62,230,164,.055), rgba(53,226,255,.035) 45%, rgba(155,140,255,.035));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.conn-lead { display: flex; align-items: center; gap: 11px; min-width: 0; }
.conn-ico {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  color: var(--c3);
  background: rgba(62,230,164,.10);
  border: 1px solid rgba(62,230,164,.24);
}
.conn-ico svg { width: 17px; height: 17px; }
.conn-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.conn-txt b { font-size: 11.5px; letter-spacing: 0.04em; color: var(--txt); }
.conn-txt span { font-size: 10px; color: var(--txt-3); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn-mid { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.conn-node { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--txt-2); font-family: var(--mono); white-space: nowrap; }
.cn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--txt-3); flex: none; }
.cn-dot.on { box-shadow: 0 0 9px currentColor; }
.cn-dot.local { background: var(--c1); color: var(--c1); }
.cn-dot.relay { background: var(--c3); color: var(--c3); }
.cn-dot.device { background: var(--c2); color: var(--c2); }
.conn-line { width: 42px; height: 1px; background: rgba(255,255,255,.14); position: relative; overflow: hidden; }
.flow-dot { position: absolute; top: -1px; left: 0; width: 5px; height: 3px; border-radius: 2px; background: var(--c3); box-shadow: 0 0 6px var(--c3); animation: connflow 2.2s linear infinite; }
@keyframes connflow { from { left: -6px; } to { left: 44px; } }
.conn-meta { font-family: var(--mono); font-size: 10px; color: var(--txt-3); white-space: nowrap; }

/* ---------------- grid / cards ---------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
}

.card {
  position: relative;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.085);
  background: linear-gradient(168deg, rgba(255, 255, 255, 0.062), rgba(255, 255, 255, 0.016));
  backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  padding: 14px 16px 15px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute; top: 0; left: 14%; right: 14%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(53, 226, 255, 0.45), rgba(155, 140, 255, 0.35), transparent);
  opacity: 0.55;
}

.c-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.c-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--txt);
  display: flex; align-items: center; gap: 7px;
}
.c-title i { width: 5px; height: 5px; border-radius: 50%; background: var(--c1); box-shadow: 0 0 8px var(--c1); }
.c-note { font-size: 10px; color: var(--txt-3); font-family: var(--mono); letter-spacing: 0.02em; }
.c-head .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.span3 { grid-column: span 3; }
.span4 { grid-column: span 4; }
.span5 { grid-column: span 5; }
.span6 { grid-column: span 6; }
.span7 { grid-column: span 7; }
.span8 { grid-column: span 8; }
.span12 { grid-column: span 12; }
.row2 { grid-row: span 2; }

.h-180 { height: 184px; }
.h-210 { height: 214px; }
.h-240 { height: 244px; }
.h-300 { height: 308px; }
.h-360 { height: 372px; }

/* ---------------- flow (topology) ---------------- */
#flowWrap { flex: 1; min-height: 0; position: relative; }
#flowSvg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.flow-legend {
  display: flex; gap: 14px; font-size: 10px; color: var(--txt-3); font-family: var(--mono);
  padding-top: 4px;
}
.flow-legend span { display: flex; align-items: center; gap: 5px; }
.flow-legend b { width: 14px; height: 2px; border-radius: 2px; display: inline-block; }

/* ---------------- live stream ---------------- */
.live-list { flex: 1; overflow: hidden; display: flex; flex-direction: column; gap: 5px; min-height: 0; }
.live-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.022);
  border: 1px solid rgba(255, 255, 255, 0.045);
  font-size: 11px;
  animation: slidein 0.45s cubic-bezier(0.2, 0.9, 0.2, 1);
}
@keyframes slidein { from { opacity: 0; transform: translateY(-7px); } to { opacity: 1; transform: none; } }
.live-row .tag {
  font-family: var(--mono); font-size: 9px; padding: 2px 5px; border-radius: 5px; letter-spacing: 0.04em; flex: none;
}
.live-row .tag.wb { color: #7beeff; background: rgba(53, 226, 255, 0.12); border: 1px solid rgba(53, 226, 255, 0.2); }
.live-row .tag.dsh { color: #c3b6ff; background: rgba(155, 140, 255, 0.13); border: 1px solid rgba(155, 140, 255, 0.22); }
.live-row .kind { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.live-row .kind.tool { background: var(--c1); box-shadow: 0 0 7px var(--c1); }
.live-row .kind.think { background: var(--c2); box-shadow: 0 0 7px var(--c2); }
.live-row .kind.result { background: var(--txt-3); }
.live-row .nm { color: var(--txt-2); font-family: var(--mono); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-row .tm { margin-left: auto; font-family: var(--mono); font-size: 9.5px; color: var(--txt-3); flex: none; }

/* ---------------- charts ---------------- */
.chart-wrap { position: relative; flex: 1; min-height: 0; }
.chart-wrap canvas { display: block; width: 100%; height: 100%; }

.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 10.5px; color: var(--txt-2); margin-top: 8px; }
.legend .li { display: flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 10px; }
.legend .li b { width: 8px; height: 8px; border-radius: 3px; }

.tooltip {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(8, 12, 20, 0.94);
  border: 1px solid var(--stroke-2);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--txt);
  line-height: 1.65;
  opacity: 0;
  transform: translate(-50%, -118%);
  transition: opacity 0.14s;
  white-space: nowrap;
}
.tooltip.on { opacity: 1; }
.tooltip .tt-t { color: var(--txt-3); font-size: 9.5px; letter-spacing: 0.06em; }
.tooltip .tt-r { display: flex; align-items: center; gap: 6px; }
.tooltip .tt-r b { width: 6px; height: 6px; border-radius: 2px; }
.tooltip .tt-r span { color: var(--txt-2); }
.tooltip .tt-r em { margin-left: auto; font-style: normal; padding-left: 12px; }

/* ---------------- tools bars ---------------- */
.bars { display: flex; flex-direction: column; gap: 7px; flex: 1; justify-content: center; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 44px; align-items: center; gap: 9px; }
.bar-row .bn { font-family: var(--mono); font-size: 10.5px; color: var(--txt-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.045); overflow: hidden; position: relative; }
.bar-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, rgba(53, 226, 255, 0.55), #35e2ff);
  box-shadow: 0 0 12px rgba(53, 226, 255, 0.35);
  width: 0;
  transition: width 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.bar-fill.dsh { background: linear-gradient(90deg, rgba(155, 140, 255, 0.55), #a48bff); box-shadow: 0 0 12px rgba(155, 140, 255, 0.35); }
.bar-fill.mix { background: linear-gradient(90deg, rgba(53, 226, 255, 0.5), #35e2ff 55%, #a48bff); box-shadow: 0 0 12px rgba(128, 180, 255, 0.3); }
.bar-row .bv { font-family: var(--mono); font-size: 10px; color: var(--txt-3); text-align: right; }

/* ---------------- heatmap ---------------- */
.heat { display: grid; grid-template-columns: 18px repeat(24, minmax(0, 1fr)); grid-template-rows: 11px repeat(7, minmax(0, 1fr)); gap: 2px; flex: 1; min-height: 0; }
.heat .hl { font-family: var(--mono); font-size: 8.5px; color: var(--txt-3); display: flex; align-items: center; }
.heat .hh { font-family: var(--mono); font-size: 7.5px; color: var(--txt-3); text-align: center; display: flex; align-items: center; justify-content: center; }
.heat .cell {
  border-radius: 3px;
  height: 100%;
  background: rgba(255, 255, 255, 0.035);
  transition: transform 0.15s, box-shadow 0.15s;
  min-height: 8px;
}
.heat .cell:hover { transform: scale(1.35); box-shadow: 0 0 10px rgba(53, 226, 255, 0.6); position: relative; z-index: 3; }
.heat-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-family: var(--mono); font-size: 9px; color: var(--txt-3); }
.heat-scale { display: flex; gap: 2px; margin-left: auto; }
.heat-scale i { width: 11px; height: 8px; border-radius: 2px; display: block; }

/* ---------------- pressure ---------------- */
.press { display: flex; flex-direction: column; gap: 8px; flex: 1; justify-content: center; overflow: hidden; }
.press-row .pt { display: flex; align-items: center; gap: 7px; font-size: 10.5px; color: var(--txt-2); margin-bottom: 3px; }
.press-row .pt .tn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.press-row .pt .pv { margin-left: auto; font-family: var(--mono); font-size: 9.5px; color: var(--txt-3); flex: none; }
.press-track { height: 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.05); overflow: hidden; }
.press-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #35e2ff, #3ee6a4); transition: width 1s cubic-bezier(0.16, 1, 0.3, 1); }
.press-fill.warn { background: linear-gradient(90deg, #ffc061, #ff7aa8); }
.press-empty { color: var(--txt-3); font-size: 10.5px; }

/* ---------------- sessions table ---------------- */
.table { width: 100%; border-collapse: collapse; font-size: 11px; }
.table th {
  text-align: left; font-weight: 500; color: var(--txt-3);
  font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0 8px 7px; border-bottom: 1px solid var(--stroke);
  white-space: nowrap;
}
.table td { padding: 7px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.035); color: var(--txt-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: rgba(255, 255, 255, 0.026); }
.table .t-title { color: var(--txt); max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .num { font-family: var(--mono); font-size: 10.5px; text-align: right; color: var(--txt-2); white-space: nowrap; }
.table .num.hi { color: var(--c1); }
.eng { font-family: var(--mono); font-size: 9px; padding: 2px 5px; border-radius: 5px; letter-spacing: 0.04em; }
.eng.wb { color: #7beeff; background: rgba(53, 226, 255, 0.12); }
.eng.dsh { color: #c3b6ff; background: rgba(155, 140, 255, 0.13); }
.live-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--c3); box-shadow: 0 0 7px var(--c3); margin-left: 5px; animation: pulse 1.8s infinite; }
.toolchips { display: flex; gap: 3px; }
.toolchips em { font-style: normal; font-family: var(--mono); font-size: 8.5px; color: var(--txt-3); background: rgba(255, 255, 255, 0.05); padding: 1px 4px; border-radius: 4px; }

/* ---------------- context breakdown ---------------- */
.ctx-bar { display: flex; height: 22px; border-radius: 7px; overflow: hidden; background: rgba(255, 255, 255, 0.04); gap: 1px; }
.ctx-seg { height: 100%; transition: width 1s cubic-bezier(0.16, 1, 0.3, 1); min-width: 2px; }
.ctx-meta { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; color: var(--txt-3); margin-top: 9px; }
.ctx-list { display: flex; flex-direction: column; gap: 6px; margin-top: 11px; }
.ctx-list .ci { display: grid; grid-template-columns: 64px 1fr 78px; align-items: center; gap: 8px; font-family: var(--mono); font-size: 10px; color: var(--txt-2); }
.ctx-list .ci span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-list .ci i { height: 5px; border-radius: 3px; background: rgba(255,255,255,.06); overflow: hidden; display: block; }
.ctx-list .ci i u { display: block; height: 100%; border-radius: 3px; }
.ctx-list .ci em { font-style: normal; color: var(--txt-3); font-size: 9.5px; text-align: right; }
.ctx-bar { height: 26px; }

/* ---------------- footer ---------------- */
.foot {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: 16px; padding: 12px 4px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-family: var(--mono); font-size: 9.5px; color: var(--txt-3); letter-spacing: 0.02em;
}
.foot span b { color: var(--txt-2); font-weight: 500; }
.foot .sep { color: rgba(255, 255, 255, 0.12); }

/* ---------------- loading ---------------- */
.skeleton { color: var(--txt-3); font-family: var(--mono); font-size: 10.5px; display: grid; place-items: center; flex: 1; letter-spacing: 0.1em; }

/* ==================== 响应式适配 ==================== */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .span8, .span7, .span5 { grid-column: span 12; }
  .span4, .span3 { grid-column: span 6; }
  .row2 { grid-row: auto; }
  .h-360 { height: 340px; }
}

@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; gap: 12px; padding-bottom: 14px; }
  .brand { flex: 1 1 100%; }
  .engines { order: 3; margin-left: 0; flex: 1 1 100%; flex-wrap: wrap; gap: 6px; }
  .engine-pill { flex: 1 1 calc(50% - 3px); min-width: 0; justify-content: center; padding: 7px 8px; }
  .engine-pill .mono { display: none; }
  .engine-pill .en-full { display: none; }
  .engine-pill .en-short { display: inline; }
  .toolbar { margin-left: auto; }
}

@media (max-width: 760px) {
  .app { padding: 14px 12px 28px; }
  html, body { overflow-x: hidden; }

  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .kpi { padding: 11px 12px 14px; }
  .kpi .k-value { font-size: 22px; }
  .kpi .k-label { font-size: 9px; letter-spacing: 0.08em; }
  .kpi .k-label em { display: none; }
  .kpi canvas { height: 24px; }

  .grid { gap: 9px; }
  .span4, .span3 { grid-column: span 12; }
  .card { padding: 12px 12px 13px; }

  .h-360 { height: 300px; }
  .h-240 { height: 232px; }
  .h-210 { height: 208px; }
  .h-300 { height: 288px; }

  h1 { font-size: 15px; letter-spacing: 0.12em; }
  .brand small { font-size: 10px; }
  .logo { width: 38px; height: 38px; }

  .seg button { padding: 6px 9px; font-size: 11px; }
  .live-badge { padding: 6px 9px; }

  /* 拓扑：窄屏下改成横向滚动，保证节点可读 */
  #flowWrap { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
  #flowSvg { position: relative; inset: auto; width: 760px; height: 100%; min-width: 760px; }
  .flow-legend { flex-wrap: wrap; gap: 8px 12px; font-size: 9px; }
  .flow-legend span:last-child { display: none; }

  .live-row { padding: 5px 7px; font-size: 10.5px; }

  /* 工具排行：名称列收窄 */
  .bar-row { grid-template-columns: 76px 1fr 38px; gap: 7px; }
  .bar-row .bn { font-size: 9.5px; }

  /* 热力图：固定最小宽 + 横向滚动，避免24列挤成一团 */
  .heat { min-width: 520px; }
  .heat-wrap-bottom { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* 会话表格：横向滚动，锁定在卡片内 */
  .card .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; flex: 1; min-height: 0; }
  .table { min-width: 640px; }

  .ctx-list .ci { grid-template-columns: 58px 1fr 66px; gap: 6px; font-size: 9px; }
  .ctx-top { gap: 6px; }
  .ctx-top .ct-v { font-size: 13px; }

  .foot { gap: 8px; font-size: 9px; }
  .foot .sep { display: none; }

  .conn-bar { flex-wrap: wrap; gap: 10px 12px; padding: 10px 12px; }
  .conn-lead { flex: 1 1 100%; }
  .conn-mid { margin-left: 0; flex: 1 1 auto; }
  .conn-line { width: 26px; }
  .flow-dot { animation: connflow-sm 2.2s linear infinite; }
  @keyframes connflow-sm { from { left: -6px; } to { left: 28px; } }
  .conn-meta { flex: 1 1 100%; }
}

@media (max-width: 400px) {
  .kpi .k-value { font-size: 20px; }
  .seg button { padding: 5px 7px; font-size: 10px; }
  .engine-pill { font-size: 10px; }
}

/* 上下文摘要 */
.ctx-top { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.ctx-top div { display: flex; flex-direction: column; gap: 2px; }
.ctx-top .ct-v { font-family: var(--mono); font-size: 15px; color: #eaf4ff; font-weight: 600; }
.ctx-top .ct-l { font-size: 9px; letter-spacing: 0.08em; color: var(--txt-3); }
.radar-legend { display: flex; gap: 9px; align-items: center; }
.radar-legend span { display: flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 9.5px; color: var(--txt-2); }
.radar-legend b { width: 7px; height: 7px; border-radius: 50%; }
