/* ============================================================
   灵环控制台：主区域是环，下方目录网状图，右栏对象信息 + agent 面板
   ============================================================ */
.console-page .topbar { padding: 12px 0 10px; }
.shell.wide { width: calc(100% - 32px); max-width: none; }
.console-page .console { grid-template-columns: 1fr 440px; height: calc(100vh - 67px); }
.stage { display: grid; grid-template-rows: 1fr 236px; min-height: 0; }
.stage .map { min-height: 0; }
.under { display: grid; grid-template-columns: 1.35fr 1fr; border-top: 1px solid var(--hairline); min-height: 0; background: #08090c; }
.mesh-wrap { position: relative; border-right: 1px solid var(--hairline); min-height: 0; }
.mesh-wrap canvas { position: absolute; left: 0; right: 0; top: 26px; bottom: 0; width: 100%; height: calc(100% - 26px); }
.panel-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .16em; color: var(--accent); padding: 8px 14px 0; position: relative; z-index: 1; }
.panel-label .muted { letter-spacing: .04em; margin-left: 8px; }
.loops-wrap { overflow-y: auto; min-height: 0; }
.loop-list { display: grid; gap: 6px; padding: 10px 14px 14px; }
.loop-item { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; border: 1px solid var(--hairline); border-radius: 8px; padding: 7px 10px; cursor: pointer; background: var(--ink-0); transition: .15s; }
.loop-item:hover { border-color: var(--accent-line); }
.loop-item.active { border-color: var(--accent); background: var(--accent-dim); }
.loop-item b { font-family: var(--font-display); font-weight: 600; font-size: 14px; display: block; line-height: 1.3; }
.loop-item small { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }
.loop-item .delta { font-family: var(--font-mono); font-size: 12px; text-align: right; }
.delta.up { color: var(--matrix); } .delta.down { color: var(--bad); }
.minir { width: 26px; height: 26px; }
.zoom { position: absolute; right: 16px; top: 16px; display: grid; gap: 6px; z-index: 3; }
.zoom button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--hairline-strong); background: rgba(15,17,22,.85); color: var(--paper); cursor: pointer; font: 15px var(--font-mono); }
.zoom button:hover { border-color: var(--accent-line); color: var(--accent); }
.hud-stats { position: absolute; right: 62px; top: 16px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); text-align: right; line-height: 1.7; pointer-events: none; }
.hud-stats b { color: var(--accent); font-weight: 500; }
.legend b.hex { color: var(--accent); font-weight: 400; margin-right: 4px; }
.legend b.dotc { color: var(--paper); font-weight: 400; margin: 0 4px 0 6px; }
.right { border-left: 1px solid var(--hairline); background: var(--ink-1); display: flex; flex-direction: column; min-height: 0; }
.pane-top { flex: 1 1 50%; overflow-y: auto; padding: 18px 20px; border-bottom: 1px solid var(--hairline); min-height: 0; }
.pane-top h3, .drawer h3 { font-family: var(--font-mono); font-size: 12px; letter-spacing: .16em; color: var(--accent); margin: 0 0 10px; font-weight: 500; }
.obj-title { font-family: var(--font-display); font-size: 23px; margin: 0; line-height: 1.3; }
.obj-sub { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-bottom: 12px; word-break: break-all; }
.figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); border-radius: 10px; overflow: hidden; margin: 12px 0; }
.figures div { background: var(--ink-0); padding: 9px 10px; }
.figures span { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); letter-spacing: .08em; display: block; }
.figures b { font-family: var(--font-mono); font-size: 16px; font-weight: 500; color: var(--paper); }
.figures b.up { color: var(--matrix); } .figures b.down { color: var(--bad); }
.spark { width: 100%; height: 54px; display: block; margin: 6px 0 4px; }
.ledger { white-space: pre-wrap; font-family: var(--font-mono); font-size: 11.5px; color: var(--paper-soft); background: var(--ink-0); border: 1px solid var(--hairline); border-radius: 8px; padding: 10px; max-height: 220px; overflow: auto; margin: 8px 0 0; }
.entry { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 7px 0; border-bottom: 1px dashed var(--hairline); font-size: 13px; }
.entry .amt { font-family: var(--font-mono); color: var(--accent); text-align: right; }
.entry .note { color: var(--paper-soft); }
.entry .meta { grid-column: 1 / -1; font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }
/* 工牌 */
.badge-card { position: relative; border: 1px solid var(--accent-line); border-radius: 14px; padding: 18px 18px 14px; background: linear-gradient(160deg, rgba(111,227,196,.09), transparent 55%), var(--ink-0); overflow: hidden; }
.badge-card.carbon { border-color: rgba(236,233,225,.3); background: linear-gradient(160deg, rgba(236,233,225,.07), transparent 55%), var(--ink-0); }
.badge-card::after { content: ""; position: absolute; top: -1px; right: -1px; width: 30px; height: 30px; background: linear-gradient(225deg, var(--ink-1) 50%, transparent 50%); }
.badge-card .bid { font-family: var(--font-mono); font-size: 12px; letter-spacing: .2em; color: var(--accent); }
.badge-card.carbon .bid { color: var(--paper-soft); }
.badge-card h4 { font-family: var(--font-display); font-size: 24px; margin: 4px 0 2px; }
.badge-card .kind { font-family: var(--font-mono); font-size: 11px; color: var(--muted); letter-spacing: .1em; }
.badge-card .barcode { height: 22px; margin-top: 12px; opacity: .6; border-radius: 2px;
  background: repeating-linear-gradient(90deg, rgba(111,227,196,.55) 0 1px, transparent 1px 3px, rgba(111,227,196,.35) 3px 5px, transparent 5px 8px); }
.badge-card.carbon .barcode { background: repeating-linear-gradient(90deg, rgba(236,233,225,.5) 0 1px, transparent 1px 3px, rgba(236,233,225,.3) 3px 5px, transparent 5px 8px); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip { font-family: var(--font-mono); font-size: 11.5px; border: 1px solid var(--hairline-strong); border-radius: 999px; padding: 1px 9px; color: var(--paper-soft); }
.chip.on { border-color: rgba(88,192,138,.45); color: var(--ok); }
.chip.off { color: var(--faint); }
.chip.warn { border-color: rgba(224,168,62,.45); color: var(--warn); }
.chip.perm { border-color: var(--accent-line); color: var(--accent); }
/* agent 面板 */
.pane-agent { flex: 1 1 50%; display: flex; flex-direction: column; min-height: 280px; }
.agent-tabs { display: flex; border-bottom: 1px solid var(--hairline); }
.agent-tabs button { flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 10px 12px; font: 12px var(--font-mono); letter-spacing: .12em; cursor: pointer; display: flex; align-items: center; gap: 8px; justify-content: center; }
.agent-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); background: rgba(111,227,196,.03); }
.agent-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.agent-tools { display: flex; gap: 6px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--hairline); flex-wrap: wrap; }
.agent-tools .seg { margin: 0; }
.agent-tools select { width: auto; padding: 4px 8px; font-size: 12px; }
.agent-tools .btn-small { padding: 4px 10px; font-size: 12px; }
.seg { display: inline-flex; border: 1px solid var(--hairline-strong); border-radius: 999px; overflow: hidden; }
.seg button { background: none; border: 0; color: var(--muted); padding: 4px 11px; font: inherit; font-size: 12px; cursor: pointer; }
.seg button.active { background: var(--accent-dim); color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: 0 0 auto; display: inline-block; }
.dot.on { background: var(--accent); }
.dot.busy { background: var(--matrix); animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(61,255,154,.6); } 70% { box-shadow: 0 0 0 8px rgba(61,255,154,0); } }
.agentlog { flex: 1; overflow-y: auto; padding: 10px 14px; font-size: 13px; display: grid; gap: 7px; align-content: start; min-height: 0; }
.msg { border-radius: 8px; padding: 7px 10px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.msg.user { background: var(--accent-dim); border: 1px solid var(--accent-line); justify-self: end; max-width: 90%; }
.msg.agent { background: var(--ink-2); border: 1px solid var(--hairline); max-width: 97%; }
.msg.error { border-color: rgba(224,108,91,.45); color: #f0a497; }
.msg .who { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); display: block; margin-bottom: 2px; }
.msg .act { font-family: var(--font-mono); font-size: 11.5px; color: var(--matrix); display: block; }
.msg .act.no { color: var(--bad); }
.tool { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); padding-left: 10px; border-left: 2px solid var(--hairline-strong); white-space: pre-wrap; word-break: break-all; }
.tool::before { content: "▸ "; color: var(--accent); }
.evt { font-family: var(--font-mono); font-size: 11px; color: var(--faint); text-align: center; letter-spacing: .06em; }
.evt.done { color: var(--accent-deep); }
.agentform { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--hairline); align-items: flex-end; }
.agentform textarea { flex: 1; font-size: 13px; resize: none; line-height: 1.5; }
.drawer-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
.drawer { position: fixed; top: 0; left: 0; bottom: 0; width: min(460px, 94vw); background: var(--ink-1); border-right: 1px solid var(--hairline-strong); z-index: 41; overflow-y: auto; box-shadow: 30px 0 80px rgba(0,0,0,.5); }
.drawer .dhead { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--hairline); position: sticky; top: 0; background: var(--ink-1); z-index: 1; }
.drawer section { padding: 16px 20px; border-bottom: 1px solid var(--hairline); }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input { flex: 1; }
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 60; display: grid; place-items: center; }
.modal { width: min(440px, 92vw); border: 1px solid rgba(224,108,91,.45); border-radius: var(--radius-lg); background: var(--ink-1); padding: 24px; }
.modal h4 { font-family: var(--font-display); font-size: 20px; margin: 0 0 10px; }
.btn-danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 600; }
.btn-danger-solid:hover { background: #f07f6e; border-color: #f07f6e; color: #fff; }
.station-key { font-family: var(--font-display); font-size: 40px; line-height: 1; color: var(--accent); margin-right: 10px; }
@media (max-width: 1100px) { .console-page .console { grid-template-columns: 1fr 380px; } }
@media (max-width: 920px) {
  .console-page .console { grid-template-columns: 1fr; height: auto; }
  .stage { grid-template-rows: 64vh auto; }
  .under { grid-template-columns: 1fr; }
  .mesh-wrap { height: 260px; }
  .right { height: auto; }
  .pane-agent { height: 80vh; }
}
