/* PENDULUM LAB · light theme, dense information layout */
:root {
  --bg: #f2f5fa; --panel: #ffffff; --panel2: #f8fafd; --line: #e4e9f2; --line2: #d5dce8;
  --ink: #0f172a; --ink2: #334155; --muted: #64748b; --faint: #94a3b8;
  --pri: #4f46e5; --pri2: #6366f1; --pri-soft: #eef0ff; --cyan: #0891b2; --cyan-soft: #e6f6fa;
  --amber: #d97706; --amber-soft: #fff5e6; --rose: #e11d48; --rose-soft: #ffeef2; --green: #059669; --green-soft: #e8f8f1; --violet: #7c3aed;
  --grid: #edf1f7; --axis: #a3afc2;
  --r: 12px; --r2: 8px;
  --sh: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px rgba(15, 23, 42, .045);
  --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { font: 13px/1.45 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- top bar */
.top { height: 50px; display: flex; align-items: center; gap: 14px; padding: 0 14px; background: rgba(255, 255, 255, .86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); position: relative; z-index: 5; }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.logo { width: 30px; height: 30px; border-radius: 9px; background: conic-gradient(from 200deg, var(--pri), var(--cyan), var(--violet), var(--pri)); display: grid; place-items: center; box-shadow: 0 4px 14px rgba(79, 70, 229, .35); }
.logo svg { width: 18px; height: 18px; }
.brand b { font-size: 14px; letter-spacing: .3px; white-space: nowrap; }
.brand small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; }
.missions-tabs { display: flex; gap: 2px; background: var(--panel2); border: 1px solid var(--line); padding: 3px; border-radius: 10px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; justify-content: center; }
.missions-tabs button { border: 0; background: transparent; padding: 4px 8px; border-radius: 7px; cursor: pointer; white-space: nowrap; color: var(--ink2); font-size: 12px; position: relative; transition: color .2s, background .2s; }
.missions-tabs button .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--line2); margin-right: 6px; vertical-align: 1px; transition: background .3s; }
.missions-tabs button.done .dot { background: var(--green); }
.missions-tabs button.active { color: var(--pri); background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .1); font-weight: 600; }
.top .spacer { flex: 1; }
.pills { display: flex; gap: 6px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 99px; background: #fff; cursor: pointer; white-space: nowrap; font-size: 12px; transition: border-color .2s, box-shadow .2s; }
.pill:hover { border-color: var(--line2); box-shadow: 0 2px 8px rgba(15, 23, 42, .06); }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.pill.on i { background: var(--green); box-shadow: 0 0 0 3px rgba(5, 150, 105, .15); animation: breathe 2.4s infinite; }
.pill.warn i { background: var(--amber); }
.pill.busy i { background: var(--pri); animation: blink .8s infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 6px rgba(5, 150, 105, .05); } }
@keyframes blink { 50% { opacity: .3; } }

/* ---------------------------------------------------------------- layout */
.layout { display: grid; grid-template-columns: 300px minmax(0, 1fr) 390px; gap: 10px; padding: 10px; height: calc(100vh - 50px); }
.col { min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.col.scroll { overflow-y: auto; scrollbar-width: thin; padding-right: 2px; overscroll-behavior: contain; }
.col.scroll > .panel { flex: none; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); min-height: 0; }
.ph { display: flex; align-items: center; gap: 8px; padding: 8px 11px 6px; border-bottom: 1px solid var(--line); }
.panel.collapsible > .ph { cursor: pointer; user-select: none; }
.panel.collapsible > .ph .chev { font-size: 10px; color: var(--muted); transition: transform .25s var(--ease); margin-left: 2px; }
.panel.folded > .ph { border-bottom-color: transparent; }
.panel.folded > .ph .chev { transform: rotate(-90deg); }
.panel.folded > .pb { display: none; }
.ph h3 { margin: 0; font-size: 12.5px; font-weight: 650; letter-spacing: .2px; display: flex; align-items: center; gap: 6px; }
.ph h3 svg { width: 15px; height: 15px; color: var(--pri); }
.ph .act { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.pb { padding: 8px 11px; }

/* ---------------------------------------------------------------- controls */
.ctl { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1px 6px; padding: 2px 0; border-radius: 8px; transition: background .4s; position: relative; }
.ctl label { font-size: 11.5px; color: var(--ink2); display: flex; align-items: center; gap: 4px; }
.ctl .val { display: flex; align-items: baseline; gap: 3px; }
.ctl .val input { width: 58px; text-align: right; border: 1px solid transparent; background: var(--panel2); border-radius: 6px; padding: 1px 5px; font-family: var(--mono); font-size: 12px; font-weight: 600; transition: border-color .2s; }
.ctl .val input:focus { outline: 0; border-color: var(--pri2); background: #fff; }
.ctl .val span { font-size: 10.5px; color: var(--muted); min-width: 24px; }
.ctl input[type=range] { grid-column: 1 / -1; }
.ctl.ai-touch { background: linear-gradient(90deg, var(--pri-soft), transparent); animation: aiTouch 1.6s var(--ease); }
.ctl.ai-touch::after { content: "AI"; position: absolute; right: -2px; top: -4px; font-size: 9px; font-weight: 700; color: #fff; background: var(--pri); border-radius: 5px; padding: 0 4px; animation: fadeOut 1.8s forwards; }
@keyframes aiTouch { 0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, .4); } 40% { box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); } 100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); } }
@keyframes fadeOut { 70% { opacity: 1; } 100% { opacity: 0; } }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 14px; background: transparent; cursor: pointer; --p: 50%; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--pri) var(--p), var(--line) var(--p)); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--pri) var(--p), var(--line) var(--p)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: #fff; border: 2px solid var(--pri); box-shadow: 0 1px 4px rgba(79, 70, 229, .35); transition: transform .15s; }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--pri); }
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.25); }
.group-t { font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: .8px; margin: 5px 0 1px; display: flex; align-items: center; gap: 6px; }
.group-t::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.presets { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: var(--r2); border: 1px solid var(--line2); background: #fff; cursor: pointer; font-size: 12.5px; font-weight: 550; white-space: nowrap; transition: transform .12s, box-shadow .2s, background .2s, border-color .2s; user-select: none; }
.btn:hover { border-color: var(--axis); box-shadow: 0 2px 8px rgba(15, 23, 42, .07); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn svg { width: 14px; height: 14px; }
.btn.pri { background: linear-gradient(180deg, var(--pri2), var(--pri)); color: #fff; border-color: var(--pri); box-shadow: 0 3px 10px rgba(79, 70, 229, .28); }
.btn.pri:hover { box-shadow: 0 5px 16px rgba(79, 70, 229, .38); }
.btn.cyan { background: var(--cyan-soft); border-color: #a5dce8; color: #0e7490; }
.btn.amber { background: var(--amber-soft); border-color: #f5cf95; color: #b45309; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel2); box-shadow: none; }
.btn.sm { height: 25px; padding: 0 8px; font-size: 11.5px; border-radius: 7px; }
.btn.icon { width: 28px; padding: 0; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 2px 9px; font-size: 11.5px; cursor: pointer; transition: all .2s; }
.chip:hover { border-color: var(--pri2); color: var(--pri); }
.chip.on { background: var(--pri); color: #fff; border-color: var(--pri); }
.seg { display: inline-flex; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: none; padding: 2px 8px; font-size: 11px; border-radius: 6px; cursor: pointer; color: var(--muted); font-family: var(--mono); }
.seg button.on { background: #fff; color: var(--pri); box-shadow: 0 1px 2px rgba(15, 23, 42, .1); font-weight: 600; }
.toggle { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ink2); cursor: pointer; user-select: none; }
.toggle input { display: none; }
.toggle i { width: 26px; height: 15px; border-radius: 99px; background: var(--line2); position: relative; transition: background .2s; }
.toggle i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 11px; height: 11px; border-radius: 50%; background: #fff; transition: transform .25s var(--ease); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.toggle input:checked + i { background: var(--pri); }
.toggle input:checked + i::after { transform: translateX(11px); }
textarea, input.text { width: 100%; border: 1px solid var(--line2); border-radius: var(--r2); padding: 7px 9px; background: #fff; resize: vertical; transition: border-color .2s, box-shadow .2s; }
textarea:focus, input.text:focus { outline: 0; border-color: var(--pri2); box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }
select { border: 1px solid var(--line2); border-radius: 7px; padding: 3px 6px; background: #fff; font-size: 12px; }

/* ---------------------------------------------------------------- mission card */
.mission h4 { margin: 0 0 4px; font-size: 13.5px; }
.mission p { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.steps li { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; border-radius: 8px; background: var(--panel2); font-size: 12px; transition: background .3s; }
.steps li .ck { flex: none; width: 17px; height: 17px; border-radius: 50%; border: 1.5px solid var(--line2); display: grid; place-items: center; font-size: 10px; color: #fff; transition: all .35s var(--ease); margin-top: 1px; }
.steps li.done { background: var(--green-soft); }
.steps li.done .ck { background: var(--green); border-color: var(--green); transform: scale(1.05); }
.steps li.cur { background: var(--pri-soft); }
.steps li.cur .ck { border-color: var(--pri); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
.steps li small { display: block; color: var(--muted); font-size: 11px; }
.progress { height: 5px; border-radius: 9px; background: var(--line); overflow: hidden; margin: 8px 0 2px; }
.progress b { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--pri), var(--cyan)); border-radius: 9px; transition: width .7s var(--ease); }

/* ---------------------------------------------------------------- center */
.stage { flex: 1; min-height: 240px; position: relative; overflow: hidden; }
.stage canvas.scene { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.hud { position: absolute; left: 10px; top: 10px; display: grid; grid-template-columns: repeat(3, auto); gap: 6px; pointer-events: none; }
.kpi { background: rgba(255, 255, 255, .86); backdrop-filter: blur(6px); border: 1px solid var(--line); border-radius: 9px; padding: 4px 9px; min-width: 88px; }
.kpi small { display: block; font-size: 10px; color: var(--muted); letter-spacing: .3px; }
.kpi b { font-family: var(--mono); font-size: 14.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.kpi b em { font-style: normal; font-size: 10.5px; color: var(--muted); font-weight: 500; margin-left: 2px; }
.kpi.accent b { color: var(--pri); }
.stage-tools { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.stage-tools .box { background: rgba(255, 255, 255, .9); border: 1px solid var(--line); border-radius: 10px; padding: 4px 7px; display: grid; gap: 3px; }
.stage-bottom { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stage-bottom .btn { box-shadow: 0 2px 8px rgba(15, 23, 42, .06); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 99px; font-size: 10.5px; font-weight: 600; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); }
.badge.pri { background: var(--pri-soft); color: var(--pri); border-color: #d9dcff; }
.badge.green { background: var(--green-soft); color: var(--green); border-color: #bfe9d6; }
.badge.amber { background: var(--amber-soft); color: #b45309; border-color: #f5d9a8; }
.badge.rose { background: var(--rose-soft); color: var(--rose); border-color: #fbc6d3; }
.badge.cyan { background: var(--cyan-soft); color: #0e7490; border-color: #b2e2ec; }
.synthetic-tag { position: absolute; right: 152px; top: 10px; left: auto; transform: none; pointer-events: none; white-space: nowrap; }
.planet-badge { position: absolute; right: 152px; top: 10px; left: auto; transform: none; pointer-events: none; background: rgba(255, 255, 255, .88); backdrop-filter: blur(6px); white-space: nowrap; }
.telemetry { display: flex; align-items: center; justify-content: space-between; gap: 4px 7px; padding: 5px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--sh); flex: none; flex-wrap: wrap; font-size: 11px; }
.tel-item { display: inline-flex; align-items: baseline; gap: 3px; white-space: nowrap; }
.tel-item small { color: var(--muted); font-size: 10px; }
.tel-item b { font-family: var(--mono); font-size: 11.5px; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.tel-item.hi b { color: var(--pri); }
.tel-sep { width: 1px; height: 14px; background: var(--line); flex: none; }

.charts { display: grid; grid-template-columns: 1.25fr 1fr 1.35fr; gap: 10px; height: 214px; flex: none; }
.chart-card { display: flex; flex-direction: column; min-width: 0; }
.chart-card .ph { padding: 6px 10px 5px; }
.chart-card canvas { flex: 1; width: 100%; min-height: 0; display: block; }
.chart-card .foot { padding: 3px 10px 6px; font-size: 11px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; min-height: 22px; }
.chart-card .foot b { color: var(--ink); font-family: var(--mono); font-weight: 600; }

.drawer { flex: none; max-height: 210px; display: flex; flex-direction: column; transition: max-height .4s var(--ease); }
.drawer.closed { max-height: 37px; overflow: hidden; }
.table-wrap { overflow: auto; flex: 1; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th, td { padding: 3.5px 5px; text-align: right; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th { position: sticky; top: 0; background: var(--panel2); color: var(--muted); font-weight: 600; z-index: 1; }
td:first-child, th:first-child { text-align: left; }
td { font-family: var(--mono); font-variant-numeric: tabular-nums; }
tr.new td { animation: rowIn 1.2s var(--ease); }
@keyframes rowIn { from { background: var(--pri-soft); } to { background: transparent; } }

/* ---------------------------------------------------------------- AI panel */
.ai-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; gap: 2px; padding: 6px 6px 0; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; justify-content: center; border: 0; background: none; padding: 7px 4px 8px; cursor: pointer; color: var(--muted); font-size: 12px; position: relative; white-space: nowrap; display: flex; align-items: center; gap: 3px; }
.tabs button svg { width: 14px; height: 14px; }
.tabs button.on { color: var(--pri); font-weight: 600; }
.tabs button.on::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--pri); animation: grow .3s var(--ease); }
.tabs button .n { background: var(--rose); color: #fff; border-radius: 99px; font-size: 9.5px; padding: 0 5px; line-height: 15px; }
@keyframes grow { from { transform: scaleX(.2); opacity: 0; } }
.tab-body { flex: 1; min-height: 0; display: none; flex-direction: column; }
.tab-body.on { display: flex; animation: rise .3s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.feed { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; scroll-behavior: smooth; }
.msg { max-width: 92%; animation: rise .35s var(--ease); }
.msg .bubble { padding: 8px 10px; border-radius: 12px; font-size: 12.8px; line-height: 1.55; }
.msg.user { align-self: flex-end; }
.msg.user .bubble { background: var(--pri); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai .bubble { background: var(--panel2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.peer .bubble { background: var(--cyan-soft); border: 1px solid #b2e2ec; }
.msg .meta { font-size: 10.5px; color: var(--faint); margin: 3px 4px 0; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.msg.user .meta { justify-content: flex-end; }
.msg .ask { margin-top: 6px; padding: 6px 8px; border-left: 3px solid var(--amber); background: var(--amber-soft); border-radius: 0 8px 8px 0; font-size: 12px; color: #92400e; }
.acts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.act-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 2px 7px; border-radius: 6px; background: #fff; border: 1px solid #d9dcff; color: var(--pri); font-family: var(--mono); opacity: 0; animation: chipIn .4s var(--ease) forwards; }
.act-chip.done::before { content: "✓"; color: var(--green); font-weight: 700; }
@keyframes chipIn { from { opacity: 0; transform: translateY(4px) scale(.9); } to { opacity: 1; transform: none; } }
.cites { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }
.cite { font-size: 10.5px; padding: 1px 6px; border-radius: 5px; background: var(--green-soft); color: var(--green); cursor: help; }
.pipeline { display: flex; gap: 0; align-items: center; padding: 6px 10px; border-top: 1px solid var(--line); background: var(--panel2); font-size: 10.5px; color: var(--faint); overflow-x: auto; scrollbar-width: none; }
.pipeline span { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 6px; white-space: nowrap; transition: all .3s; }
.pipeline span::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line2); transition: background .3s; }
.pipeline span.run { color: var(--pri); background: var(--pri-soft); }
.pipeline span.run::before { background: var(--pri); animation: blink .6s infinite; }
.pipeline span.ok { color: var(--green); }
.pipeline span.ok::before { background: var(--green); }
.pipeline span.warn { color: var(--amber); }
.pipeline span.warn::before { background: var(--amber); }
.pipeline i { width: 10px; height: 1px; background: var(--line2); flex: none; }
.composer { padding: 8px 10px 10px; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.composer .row { display: flex; gap: 6px; }
.composer textarea { min-height: 38px; max-height: 96px; height: 38px; overflow: hidden; line-height: 1.4; resize: none; }
.suggest { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.suggest button { flex: none; border: 1px dashed var(--line2); background: #fff; border-radius: 99px; padding: 2px 9px; font-size: 11.5px; cursor: pointer; color: var(--ink2); transition: all .2s; }
.suggest button:hover { border-color: var(--pri2); color: var(--pri); border-style: solid; }
.thinking { display: inline-flex; gap: 3px; padding: 10px 12px; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--pri2); animation: bounce 1s infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; } .thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-5px); opacity: 1; } }

.card { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 9px 10px; animation: rise .35s var(--ease); }
.card + .card { margin-top: 8px; }
.card h5 { margin: 0 0 5px; font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.card .kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 11.5px; }
.card .kv dt { color: var(--muted); }
.card .kv dd { margin: 0; font-family: var(--mono); }
.scroll-y { overflow-y: auto; flex: 1; padding: 10px; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 38px; gap: 6px; align-items: center; font-size: 11px; margin: 3px 0; }
.bar-row .bar { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; }
.bar-row .bar b { display: block; height: 100%; border-radius: 6px; background: var(--amber); width: 0; transition: width .8s var(--ease); }
.bar-row.top .bar b { background: var(--rose); }
.plan-vals { display: flex; flex-wrap: wrap; gap: 3px; margin: 6px 0; }
.plan-vals span { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 5px; background: var(--panel2); border: 1px solid var(--line); transition: all .3s; }
.plan-vals span.run { background: var(--pri); color: #fff; border-color: var(--pri); transform: scale(1.08); }
.plan-vals span.ok { background: var(--green-soft); border-color: #bfe9d6; color: var(--green); }
.score-big { font-size: 34px; font-weight: 750; font-family: var(--mono); background: linear-gradient(135deg, var(--pri), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; }
.radar { width: 100%; height: 190px; display: block; }
.bench table td, .bench table th { padding: 3px 5px; font-size: 11px; }
.bench .best { color: var(--green); font-weight: 700; }
.lat-chart { height: 90px; width: 100%; display: block; }
.kpi-grid-4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-bottom: 8px; }
.kpi-mini { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.kpi-mini small { display: block; font-size: 10px; color: var(--muted); }
.kpi-mini b { font-family: var(--mono); font-size: 12.5px; font-weight: 650; color: var(--pri); }
.notice { font-size: 11.5px; padding: 7px 9px; border-radius: 8px; background: var(--amber-soft); color: #92400e; border: 1px solid #f5d9a8; }
.notice.info { background: var(--pri-soft); color: #3730a3; border-color: #d9dcff; }
.notice.ok { background: var(--green-soft); color: #065f46; border-color: #bfe9d6; }

/* ---------------------------------------------------------------- modal & toast */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .32); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 50; animation: fadeIn .2s; padding: 14px; }
.modal.hidden { display: none; }
.modal .dlg { background: #fff; border-radius: 16px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 30px 80px rgba(15, 23, 42, .25); animation: pop .3s var(--ease); }
.modal .dlg .ph { padding: 12px 16px; }
.modal .dlg .pb { padding: 14px 16px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.toasts { position: fixed; top: 56px; left: 50%; transform: translateX(-50%); display: grid; gap: 6px; z-index: 60; pointer-events: none; justify-items: center; }
.toast { background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 10px; font-size: 12.5px; box-shadow: 0 10px 30px rgba(15, 23, 42, .25); animation: toastDown .3s var(--ease); max-width: 380px; pointer-events: auto; }
.toast.ok { background: #065f46; } .toast.warn { background: #92400e; }
@keyframes toastDown { from { opacity: 0; transform: translateY(-12px); } }
.qr { display: block; margin: 6px auto; width: 168px; height: 168px; image-rendering: pixelated; border-radius: 8px; border: 1px solid var(--line); }
.members { display: grid; gap: 4px; }
.member { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 8px; background: var(--panel2); font-size: 12px; }
.member .av { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; }
.member .on { width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-left: auto; }
.member .off { width: 7px; height: 7px; border-radius: 50%; background: var(--line2); margin-left: auto; }

/* sensor big view */
.sensor-live { height: 120px; width: 100%; display: block; border-radius: 8px; background: var(--panel2); }
.big-rec { width: 100%; height: 46px; font-size: 15px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #fff; }
.recording .rec-dot { animation: blink .7s infinite; }

/* ---------------------------------------------------------------- mobile */
.mnav { display: none; }
@media (max-width: 1280px) { .layout { grid-template-columns: 272px minmax(0, 1fr) 350px; } .charts { grid-template-columns: 1fr 1fr; height: 310px; } .charts .chart-card:last-child { grid-column: 1 / -1; } }
@media (max-width: 1120px) {
  html, body { overflow: auto; height: auto; }
  .top { height: 48px; gap: 8px; padding: 0 10px; position: sticky; top: 0; }
  .brand small, .missions-tabs { display: none; }
  .pill .lbl { display: none; }
  .layout { display: block; height: auto; padding: 8px 8px 70px; }
  .col { display: none; }
  .col.mshow { display: flex; }
  .stage { height: 50vh; min-height: 290px; flex: none; }
  .telemetry { justify-content: flex-start; gap: 6px 12px; padding: 6px 10px; }
  .tel-sep { display: none; }
  .charts { grid-template-columns: 1fr; height: auto; }
  .chart-card { height: 210px; }
  .charts .chart-card:last-child { grid-column: auto; }
  .ai-panel { flex: none; height: calc(100vh - 126px); height: calc(100dvh - 126px); }
  .hud { grid-template-columns: repeat(3, auto); gap: 4px; left: 6px; top: 6px; }
  .kpi { min-width: 0; padding: 2px 6px; }
  .kpi b { font-size: 12px; }
  .kpi small { font-size: 9px; }
  .planet-badge, .synthetic-tag { left: auto; right: 6px; top: 6px; transform: none; font-size: 9.5px; padding: 1px 6px; }
  .stage-tools { top: 28px; bottom: auto; right: 6px; }
  .stage-tools .box { padding: 3px 4px; }
  .stage-tools .seg button { padding: 2px 5px; font-size: 10px; }
  .stage-tools .box:first-child { display: none; }
  .bench table th, .bench table td { padding: 3px 2px; font-size: 10px; }
  .bench table td:first-child, .bench table th:first-child { max-width: 92px; overflow: hidden; text-overflow: ellipsis; }
  .stage-bottom { left: 6px; right: 6px; bottom: 6px; gap: 4px; }
  .stage-bottom .btn { height: 30px; padding: 0 9px; }
  #watchInfo { display: none; }
  .composer .suggest { flex-wrap: nowrap; }
  .mnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 58px; background: rgba(255, 255, 255, .95); backdrop-filter: blur(10px); border-top: 1px solid var(--line); z-index: 20; padding-bottom: env(safe-area-inset-bottom); }
  .mnav button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10.5px; color: var(--muted); }
  .mnav button svg { width: 20px; height: 20px; }
  .mnav button.on { color: var(--pri); }
  .mobile-missions { display: flex !important; }
}
@media (max-width: 1120px) and (min-width: 720px) {
  .charts { grid-template-columns: 1fr 1fr; }
  .charts .chart-card:last-child { grid-column: 1 / -1; }
}
@media (max-width: 1120px) and (max-height: 480px) {
  .top { height: 40px; }
  .mobile-missions { padding-bottom: 4px; }
  .mobile-missions .chip { padding: 2px 9px; font-size: 11px; }
  .layout { padding: 4px 8px 52px; }
  .stage { height: calc(100vh - 128px); height: calc(100dvh - 128px); min-height: 210px; }
  .ai-panel { height: calc(100vh - 96px); height: calc(100dvh - 96px); }
  .mnav { height: 44px; }
  .mnav button { flex-direction: row; gap: 5px; font-size: 11.5px; }
}
@media (max-width: 400px) {
  .hud { gap: 3px; left: 4px; top: 4px; }
  .kpi { padding: 2px 4px; }
  .kpi b { font-size: 11px; }
  .kpi small { font-size: 8.5px; }
  .planet-badge, .synthetic-tag { right: 4px; top: 4px; font-size: 9px; padding: 1px 5px; }
  .stage-tools { right: 4px; top: 24px; }
  .stage-tools .seg button { padding: 1px 4px; font-size: 9.5px; }
  .bench table th, .bench table td { padding: 2.5px 1.5px; font-size: 9.2px; }
  .bench table td:first-child, .bench table th:first-child { max-width: 72px; }
}
.mobile-missions { display: none; gap: 4px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.mobile-missions .chip { flex: none; white-space: nowrap; padding: 4px 11px; }
.mobile-missions .chip .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--line2); margin-right: 5px; vertical-align: 1px; }
.mobile-missions .chip.done .dot { background: var(--green); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
