:root {
  --bg: #03070e;
  --bg-deep: #01030a;
  --panel: rgba(7, 16, 29, .79);
  --panel-soft: rgba(13, 28, 45, .62);
  --line: rgba(102, 196, 255, .17);
  --line-bright: rgba(110, 217, 255, .5);
  --cyan: #66e8ff;
  --cyan-soft: #54b7d1;
  --blue: #5e7cff;
  --violet: #a78bfa;
  --green: #6dffbf;
  --text: #e7f6ff;
  --muted: #7894a5;
  --warning: #ffd47a;
  --danger: #ff7592;
  --shadow: 0 22px 80px rgba(0, 0, 0, .45);
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  --sans: "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { overflow-x: hidden; color: var(--text); background: var(--bg-deep); font-family: var(--sans); }
body::before, body::after { position: fixed; z-index: -4; width: 48vw; height: 48vw; border-radius: 50%; content: ""; filter: blur(90px); opacity: .12; pointer-events: none; }
body::before { top: -22vw; left: -12vw; background: #12658f; }
body::after { right: -18vw; bottom: -22vw; background: #432984; }
button, input { font: inherit; }
button { cursor: pointer; }

.app-shell {
  position: relative;
  min-height: 100vh;
  padding: 22px clamp(14px, 3.6vw, 62px) 16px;
  background: linear-gradient(rgba(76, 157, 202, .025) 1px, transparent 1px), linear-gradient(90deg, rgba(76, 157, 202, .025) 1px, transparent 1px), radial-gradient(circle at 50% 43%, rgba(30, 103, 159, .13), transparent 38%), var(--bg);
  background-size: 42px 42px, 42px 42px, auto, auto;
}
.scanline { position: fixed; z-index: 20; inset: 0; background: linear-gradient(to bottom, transparent 0%, rgba(99, 211, 255, .025) 50%, transparent 100%); background-size: 100% 7px; mix-blend-mode: screen; opacity: .25; pointer-events: none; }
.ambient-noise { position: fixed; z-index: -1; inset: 0; opacity: .05; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E"); pointer-events: none; }

.auth-gate { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 18px; background: radial-gradient(circle at 50% 38%, rgba(18, 77, 119, .28), rgba(1, 4, 11, .97) 62%); backdrop-filter: blur(14px); }
.auth-gate.hidden { display: none; }
.auth-card { width: min(390px, 100%); padding: 30px; border: 1px solid rgba(102, 232, 255, .32); background: linear-gradient(145deg, rgba(14, 31, 51, .96), rgba(3, 10, 20, .96)); box-shadow: 0 0 70px rgba(0, 0, 0, .72), 0 0 35px rgba(62, 171, 215, .12); }
.auth-mark { margin: 0 auto 22px; }
.auth-card h1 { margin: 11px 0 7px; font-size: 25px; font-weight: 400; letter-spacing: .12em; }
.auth-card p { margin: 0 0 22px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.auth-card label { display: block; margin: 13px 0 6px; color: var(--cyan-soft); font-family: var(--mono); font-size: 9px; letter-spacing: .1em; }
.auth-card input { width: 100%; padding: 12px; border: 1px solid var(--line); outline: 0; color: var(--text); background: rgba(0, 0, 0, .24); }
.auth-card input:focus { border-color: var(--cyan); box-shadow: 0 0 18px rgba(102, 232, 255, .12); }
.auth-submit { width: 100%; margin-top: 20px; }
.auth-error { min-height: 20px; margin-top: 10px; color: var(--danger); font-size: 11px; }
.auth-footnote { margin-top: 20px; color: #5c8091; font-family: var(--mono); font-size: 8px; letter-spacing: .1em; text-align: center; }
.admin-dialog { max-width: 540px; }
.pairing-dialog { max-width: 440px; }
.pairing-code { margin: 22px 0 12px; color: var(--cyan); font-family: var(--mono); font-size: 34px; letter-spacing: .24em; text-align: center; text-shadow: 0 0 18px rgba(102, 232, 255, .55); }
.pairing-step { display: flex; flex-direction: column; gap: 9px; margin-top: 14px; }
.pairing-command { padding: 10px; border: 1px solid var(--line); color: #9bd7e6; background: rgba(0, 0, 0, .22); font-family: var(--mono); font-size: 10px; overflow-wrap: anywhere; }
.device-actions { display: flex; align-items: center; gap: 7px; }
.compact-button { padding: 6px 8px; font-size: 8px; }
.member-form-grid { display: grid; grid-template-columns: 105px 1fr; align-items: center; gap: 8px 10px; margin-top: 16px; }
.member-form-grid label { margin: 0; }
.member-form-grid input { width: 100%; padding: 9px; border: 1px solid var(--line); outline: 0; color: var(--text); background: rgba(0, 0, 0, .24); }
.admin-error { min-height: 20px; margin-top: 9px; color: var(--danger); font-size: 11px; }
.admin-user-list { display: flex; flex-direction: column; gap: 6px; max-height: 190px; overflow-y: auto; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.admin-user-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; padding: 7px; color: #cbe7f0; background: rgba(44, 91, 120, .12); font-size: 10px; }
.admin-user-row small { color: var(--muted); font-family: var(--mono); }

.topbar, .mission-strip, .environment-bar, .footer-bar { position: relative; z-index: 2; display: flex; align-items: center; border: 1px solid var(--line); background: linear-gradient(135deg, rgba(14, 30, 50, .8), rgba(3, 11, 23, .64)); box-shadow: var(--shadow), inset 0 1px rgba(255, 255, 255, .035); backdrop-filter: blur(16px); }
.topbar { justify-content: space-between; min-height: 78px; gap: 18px; padding: 14px 20px; clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px)); }
.brand-lockup { display: flex; align-items: center; gap: 14px; min-width: 260px; }
.brand-mark { position: relative; width: 34px; height: 34px; transform: rotate(45deg); }
.brand-mark span { position: absolute; border: 1px solid var(--cyan); box-shadow: 0 0 12px rgba(102, 232, 255, .5); }
.brand-mark span:nth-child(1) { inset: 7px; }
.brand-mark span:nth-child(2) { inset: 2px; opacity: .45; }
.brand-mark span:nth-child(3) { inset: 12px; background: var(--cyan); box-shadow: 0 0 18px var(--cyan); }
.brand-name { letter-spacing: .2em; font-size: 17px; font-weight: 600; }
.brand-name em { color: var(--cyan); font-style: normal; font-weight: 300; }
.brand-subtitle, .eyebrow, .clock-label, .footer-bar, .core-caption, .core-coordinates, .stage-metrics span, .panel-footnote, .scene-caption, .environment-signal, .focus-next span { font-family: var(--mono); }
.brand-subtitle { margin-top: 5px; color: var(--muted); font-size: 8px; letter-spacing: .18em; }
.location-chip { display: flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid rgba(102, 232, 255, .2); color: var(--cyan-soft); background: rgba(49, 123, 151, .1); font-family: var(--mono); font-size: 10px; letter-spacing: .08em; white-space: nowrap; }
.location-chip small { color: #55798a; font-size: 8px; letter-spacing: .03em; }
.location-pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.top-status { color: var(--cyan-soft); font-family: var(--mono); font-size: 10px; letter-spacing: .1em; white-space: nowrap; }
.account-badge { display: flex; align-items: center; gap: 7px; padding: 6px 8px; border: 1px solid rgba(109, 255, 191, .22); background: rgba(46, 118, 99, .1); font-family: var(--mono); font-size: 8px; white-space: nowrap; }
.account-name { color: #d9faff; }
.account-role { color: var(--green); }
.account-usage { color: #8ab2bf; }
.account-admin { padding: 4px 6px; border: 1px solid rgba(102, 232, 255, .3); color: var(--cyan); background: rgba(52, 137, 165, .12); font-family: var(--mono); font-size: 8px; }
.account-admin:hover { border-color: var(--cyan); background: rgba(52, 137, 165, .25); }
.status-dot, .mini-dot, .pulse-ring, .footer-mark { display: inline-block; border-radius: 50%; }
.status-dot { width: 7px; height: 7px; margin-right: 7px; background: var(--green); box-shadow: 0 0 12px var(--green); }
.status-divider { padding: 0 8px; color: #31546c; }
.mono { color: #8ebbd0; }
.clock-block { min-width: 140px; text-align: right; }
.clock-label { color: var(--muted); font-size: 9px; letter-spacing: .2em; }
.clock-value { margin-top: 2px; color: var(--cyan); font-family: var(--mono); font-size: 22px; letter-spacing: .08em; text-shadow: 0 0 18px rgba(102, 232, 255, .45); }
.clock-date { margin-top: 2px; color: var(--muted); font-size: 11px; }

.mission-strip { gap: 20px; min-height: 58px; margin-top: 14px; padding: 11px 15px 11px 20px; }
.mission-label { display: flex; min-width: 150px; flex-direction: column; gap: 4px; }
.eyebrow { color: var(--cyan-soft); font-size: 9px; letter-spacing: .14em; }
.mission-label strong { font-size: 13px; font-weight: 500; }
.progress-track { position: relative; flex: 1; height: 8px; overflow: hidden; border: 1px solid rgba(102, 232, 255, .25); background: rgba(0, 0, 0, .22); transform: skewX(-20deg); }
.progress-fill { width: 0; height: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan)); box-shadow: 0 0 18px var(--cyan); transition: width .35s ease; }
.progress-value { position: absolute; top: -21px; right: 0; color: var(--cyan); font-family: var(--mono); font-size: 10px; transform: skewX(20deg); }
.mission-meta { display: flex; align-items: center; gap: 7px; min-width: 110px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.pulse-ring { width: 7px; height: 7px; background: var(--green); box-shadow: 0 0 0 4px rgba(109, 255, 191, .1), 0 0 12px var(--green); }

.environment-bar { gap: 18px; min-height: 66px; margin-top: 14px; padding: 11px 16px 11px 20px; border-color: rgba(185, 148, 255, .18); background: linear-gradient(100deg, rgba(20, 29, 55, .83), rgba(7, 18, 31, .7)); }
.environment-copy { display: flex; min-width: 310px; flex-direction: column; gap: 4px; }
.environment-copy strong { color: #dceeff; font-family: var(--mono); font-size: 12px; letter-spacing: .1em; }
.environment-copy > span:last-child { color: var(--muted); font-size: 10px; }
.scene-toggle { display: flex; gap: 4px; margin-left: auto; padding: 3px; border: 1px solid var(--line); background: rgba(0, 0, 0, .16); }
.scene-button { padding: 7px 12px; border: 0; color: #7e9aab; background: transparent; font-family: var(--mono); font-size: 9px; letter-spacing: .08em; }
.scene-button:hover, .scene-button.active { color: var(--text); background: rgba(91, 176, 216, .2); box-shadow: inset 0 -1px var(--cyan), 0 0 15px rgba(102, 232, 255, .1); }
.gallery-controls { display: flex; align-items: center; gap: 5px; margin-left: 6px; padding: 3px; border: 1px solid var(--line); background: rgba(0, 0, 0, .16); font-family: var(--mono); font-size: 8px; }
.gallery-controls button { min-width: 22px; padding: 5px 6px; border: 0; color: var(--cyan-soft); background: transparent; font-family: var(--mono); font-size: 11px; }
.gallery-controls button:hover { color: var(--text); background: rgba(91, 176, 216, .2); }
.gallery-controls #galleryPause { min-width: 34px; color: #85a9b6; font-size: 8px; }
.gallery-controls span { min-width: 42px; color: #85a9b6; text-align: center; }
.environment-signal { display: flex; align-items: center; gap: 8px; color: #6797a8; font-size: 9px; white-space: nowrap; }
.signal-bars { display: flex; align-items: end; gap: 2px; height: 13px; }
.signal-bars i { display: block; width: 3px; background: var(--green); box-shadow: 0 0 6px var(--green); }
.signal-bars i:nth-child(1) { height: 4px; opacity: .45; }
.signal-bars i:nth-child(2) { height: 7px; opacity: .65; }
.signal-bars i:nth-child(3) { height: 10px; opacity: .8; }
.signal-bars i:nth-child(4) { height: 13px; }

.ghost-button, .primary-button, .icon-button { border: 1px solid var(--line-bright); color: var(--cyan); background: rgba(41, 112, 143, .12); transition: .2s ease; }
.ghost-button:hover, .primary-button:hover, .icon-button:hover { border-color: var(--cyan); background: rgba(62, 190, 225, .2); box-shadow: 0 0 20px rgba(102, 232, 255, .18); }
.ghost-button { padding: 10px 14px; }
.ghost-button.compact { padding: 7px 11px; font-size: 11px; white-space: nowrap; }
.primary-button { padding: 10px 15px; background: linear-gradient(135deg, rgba(72, 170, 211, .5), rgba(83, 101, 205, .45)); }

.dashboard-grid { display: grid; grid-template-columns: minmax(200px, .58fr) minmax(480px, 2.25fr) minmax(270px, .84fr); gap: 14px; min-height: 660px; margin-top: 14px; }
.left-stack, .right-stack { display: flex; min-width: 0; flex-direction: column; gap: 14px; }
/* 普通工作台：聊天承担 C 位，照片退到右侧；战斗模式使用独立布局，不继承这里的定位。 */
body:not([data-ui-mode="full-body"]) .left-stack { grid-column: 1; grid-row: 1; }
body:not([data-ui-mode="full-body"]) .right-stack { grid-column: 2; grid-row: 1; }
body:not([data-ui-mode="full-body"]) .core-stage { grid-column: 3; grid-row: 1; }
/* 右侧列二合一：环境图（平时）与任务视图（任务运行时）互斥显示，可折叠为细条。 */
.stage-photo-view { position: absolute; z-index: 0; inset: 0 0 auto 0; height: 45%; border-bottom: 1px solid rgba(86, 183, 226, .22); overflow: hidden; }
.stage-toggle { position: absolute; z-index: 6; top: 50%; right: 10px; width: 30px; height: 52px; transform: translateY(-50%); border: 1px solid rgba(102, 232, 255, .28); border-radius: 8px; color: var(--cyan); background: rgba(3, 13, 23, .72); font-size: 14px; cursor: pointer; }
.stage-toggle:hover { border-color: var(--cyan); background: rgba(24, 68, 92, .8); }
.stage-collapsed-label { display: none; position: absolute; z-index: 3; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #577d8d; font-family: var(--mono); font-size: 9px; letter-spacing: .32em; writing-mode: vertical-rl; }
.core-stage.is-collapsed .stage-collapsed-label { display: block; }
.core-stage.is-collapsed .stage-photo-view, .core-stage.is-collapsed .stage-status-panel, .core-stage.is-collapsed .stage-task-view { display: none; }
.core-stage.is-collapsed .stage-toggle { top: 12px; right: 50%; height: 30px; transform: translateX(50%); }
.stage-task-view { position: absolute; z-index: 5; inset: 0; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; padding: 22px 18px; background: linear-gradient(160deg, rgba(5, 16, 28, .94), rgba(2, 8, 16, .96)); }
.stage-task-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stage-task-status { padding: 4px 8px; border: 1px solid rgba(102, 232, 255, .3); border-radius: 999px; color: var(--cyan); font-family: var(--mono); font-size: 9px; letter-spacing: .08em; white-space: nowrap; }
.stage-task-status[data-status="completed"] { border-color: rgba(109, 255, 191, .42); color: var(--green); }
.stage-task-status[data-status="failed"], .stage-task-status[data-status="cancelled"] { border-color: rgba(255, 117, 146, .45); color: var(--danger); }
.stage-task-status[data-status="waiting_user"], .stage-task-status[data-status="waiting_device"] { border-color: rgba(255, 212, 122, .4); color: var(--warning); }
.stage-task-title { margin: 0; color: #e8fbff; font-size: 16px; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.stage-task-progress { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.stage-task-result { max-height: 220px; overflow-y: auto; padding: 10px 12px; border: 1px solid rgba(109, 255, 191, .22); background: rgba(12, 40, 30, .3); color: #bfe8d4; font-size: 11px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.stage-view-back { align-self: flex-start; margin-top: auto; }
.stage-status-panel { position: absolute; z-index: 1; top: 45%; right: 0; bottom: 0; left: 0; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; padding: 14px; background: rgba(4, 12, 22, .88); }
.stage-module { display: flex; flex-direction: column; gap: 9px; }
.stage-module-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stage-module-head strong { color: #dceef3; font-size: 12px; font-weight: 600; }
.stage-module-count { color: #6f91a0; font-family: var(--mono); font-size: 8px; }
.stage-check-list { display: flex; flex-direction: column; gap: 3px; margin: 0; padding: 0; list-style: none; }
.stage-check-item { display: grid; grid-template-columns: 15px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid rgba(130, 160, 175, .08); color: #b7cbd2; font-size: 10.5px; }
.stage-check-icon { display: grid; width: 15px; height: 15px; place-items: center; border: 1px solid rgba(130, 160, 175, .36); border-radius: 4px; color: transparent; font-size: 9px; }
.stage-check-item.is-done .stage-check-icon { border-color: rgba(109, 255, 191, .5); color: var(--green); background: rgba(46, 118, 99, .18); }
.stage-check-item.is-failed .stage-check-icon { border-color: rgba(255, 117, 146, .5); color: var(--danger); }
.stage-check-item.is-running .stage-check-icon { border-color: rgba(102, 232, 255, .5); color: var(--cyan); }
.stage-check-item.is-waiting .stage-check-icon { border-color: rgba(255, 212, 122, .5); color: var(--warning); }
.stage-check-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-check-meta { color: #6f91a0; font-family: var(--mono); font-size: 8px; white-space: nowrap; }
.stage-check-empty { padding: 8px 4px; color: #637e8c; font-size: 10px; }
.stage-env-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stage-env-grid > div { min-width: 0; padding: 7px 8px; border: 1px solid rgba(107, 186, 219, .14); background: rgba(10, 28, 42, .42); }
.stage-env-grid > div.stage-env-wide { grid-column: 1 / -1; }
.stage-env-grid span { display: block; color: #568094; font-size: 7.5px; letter-spacing: .12em; }
.stage-env-grid strong { display: block; margin-top: 4px; overflow: hidden; color: var(--cyan); font-family: var(--mono); font-size: 10px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.stage-task-badge { position: absolute; z-index: 6; right: 12px; bottom: 12px; padding: 7px 12px; border: 1px solid rgba(102, 232, 255, .5); border-radius: 999px; color: #051018; background: var(--cyan); font-family: var(--mono); font-size: 10px; letter-spacing: .06em; box-shadow: 0 0 20px rgba(102, 232, 255, .35); cursor: pointer; }
.stage-photo-view[hidden], .stage-task-view[hidden], .stage-task-badge[hidden], .stage-task-result[hidden] { display: none; }
body:not([data-ui-mode="full-body"]) .dashboard-grid:has(.core-stage.is-collapsed) { grid-template-columns: minmax(200px, .58fr) minmax(480px, 2.25fr) 48px; }
/* 普通工作台：聊天参照 Rovis 放大——消息区随视口放大且限制上限，输入框加高。 */
body:not([data-ui-mode="full-body"]) .chat-messages { max-height: min(62vh, 700px); }
body:not([data-ui-mode="full-body"]) .chat-form textarea#chatInput { min-height: 108px; }
/* 设备区移入右侧状态面板后的间距适配。 */
.stage-status-panel .normal-device-mount { flex: 0 0 auto; }
.stage-status-panel .device-section { margin-top: 0; }
.panel { position: relative; overflow: hidden; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.panel::before { position: absolute; top: 0; left: 0; width: 64px; height: 1px; content: ""; background: var(--cyan); box-shadow: 0 0 13px var(--cyan); }
.panel::after { position: absolute; right: 0; bottom: 0; width: 50px; height: 1px; content: ""; background: var(--violet); box-shadow: 0 0 12px var(--violet); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.panel-heading h2 { margin: 7px 0 0; font-size: 17px; font-weight: 400; letter-spacing: .08em; }
.compact-heading { align-items: center; }
.compact-heading h2 { font-size: 15px; }
.panel-count { color: var(--cyan); font-family: var(--mono); font-size: 20px; }

.focus-panel { flex: 0 0 auto; padding: 19px 16px 15px; border-color: rgba(167, 139, 250, .26); background: linear-gradient(145deg, rgba(29, 29, 68, .75), rgba(7, 16, 29, .82)); }
.focus-panel.focus-flash { animation: focusFlash .85s ease; }
@keyframes focusFlash { 0%, 100% { box-shadow: var(--shadow); } 40% { border-color: var(--warning); box-shadow: 0 0 35px rgba(255, 212, 122, .25), var(--shadow); } }
.brief-badge { padding: 4px 6px; border: 1px solid rgba(255, 212, 122, .32); color: var(--warning); font-family: var(--mono); font-size: 8px; letter-spacing: .08em; }
.focus-body { display: flex; gap: 11px; margin-top: 17px; }
.focus-icon { display: grid; flex: 0 0 28px; height: 28px; place-items: center; border: 1px solid var(--warning); color: var(--warning); font-family: var(--mono); box-shadow: 0 0 15px rgba(255, 212, 122, .18); }
.focus-body strong { display: block; color: #effbff; font-size: 13px; line-height: 1.4; }
.focus-body p { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.focus-next { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 16px; padding-top: 11px; border-top: 1px solid var(--line); }
.focus-next span { color: #6995a7; font-size: 8px; letter-spacing: .1em; }
.focus-next strong { color: var(--cyan); font-size: 11px; font-weight: 400; }

.todo-panel { display: flex; min-height: 0; flex: 1; flex-direction: column; padding: 21px 16px 14px; }
.todo-list { display: flex; flex: 1; min-height: 150px; flex-direction: column; gap: 8px; margin-top: 18px; overflow-y: auto; }
.todo-item { display: grid; grid-template-columns: 20px 1fr 20px; align-items: start; gap: 8px; padding: 10px 7px; border-left: 1px solid transparent; background: linear-gradient(90deg, rgba(78, 135, 173, .12), transparent); transition: .2s ease; }
.todo-item:hover { border-left-color: var(--cyan); background: rgba(92, 170, 207, .14); }
.todo-item.done { opacity: .48; }
.todo-item.done .todo-text { color: var(--muted); text-decoration: line-through; }
.todo-check { width: 16px; height: 16px; appearance: none; border: 1px solid var(--cyan-soft); background: transparent; cursor: pointer; }
.todo-check:checked { position: relative; border-color: var(--green); background: rgba(109, 255, 191, .3); }
.todo-check:checked::after { position: absolute; top: 0; left: 4px; content: "✓"; color: var(--green); font-size: 11px; }
.todo-text { color: #c7e1eb; font-size: 12px; line-height: 1.45; }
.todo-delete { border: 0; color: #5b8193; background: transparent; font-size: 16px; opacity: 0; }
.todo-item:hover .todo-delete { opacity: 1; }
.todo-form, .chat-form { display: flex; border: 1px solid var(--line); background: rgba(0, 0, 0, .16); }
.todo-form { margin-top: 13px; }
.todo-form input, .chat-form input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--text); background: transparent; }
.todo-form input { padding: 11px 9px; font-size: 12px; }
.todo-form button, .chat-form button { width: 40px; border: 0; color: var(--cyan); background: rgba(87, 181, 213, .12); font-size: 20px; }
.panel-footnote { display: flex; align-items: center; gap: 7px; margin-top: 11px; color: #638798; font-size: 8px; letter-spacing: .05em; }

.core-stage { position: relative; min-width: 0; min-height: 660px; overflow: hidden; border: 1px solid rgba(86, 183, 226, .28); background: #030913; box-shadow: var(--shadow), inset 0 0 80px rgba(48, 112, 183, .1); }
.photo-layer { position: absolute; z-index: 0; inset: -2%; background-position: center; background-size: cover; filter: saturate(.82) contrast(1.06); opacity: .78; transform: scale(1.04); transition: opacity .5s ease, filter .5s ease; }
.photo-layer.gallery-fade { animation: galleryFade .8s ease; }
@keyframes galleryFade { 0% { opacity: .18; transform: scale(1.06); } 100% { opacity: .78; transform: scale(1.04); } }
#spaceCanvas { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; mix-blend-mode: screen; opacity: .72; }
.city-overlay { position: absolute; z-index: 2; inset: 0; background: linear-gradient(180deg, rgba(4, 9, 18, .16), rgba(2, 6, 13, .2) 42%, rgba(2, 4, 10, .68)); pointer-events: none; }
.stage-vignette { position: absolute; z-index: 2; inset: 0; background: radial-gradient(circle at 50% 46%, transparent 0 20%, rgba(1, 5, 12, .14) 44%, rgba(1, 4, 11, .9) 100%); pointer-events: none; }
.scene-caption { position: absolute; z-index: 3; top: 17px; right: 18px; left: 18px; display: flex; justify-content: space-between; gap: 12px; color: rgba(172, 211, 226, .65); font-size: 8px; letter-spacing: .13em; }
.scene-caption span:nth-child(2) { overflow: hidden; color: #8aa6b4; text-overflow: ellipsis; white-space: nowrap; }
.scene-caption span:last-child { color: #5b7f91; }
.core-overlay { position: absolute; z-index: 3; inset: 0; display: flex; align-items: center; flex-direction: column; justify-content: center; pointer-events: none; }
.core-coordinates { position: absolute; top: 42px; color: #6f9bb1; font-size: 8px; letter-spacing: .18em; }
.core-radar { position: relative; width: min(350px, 63vw); aspect-ratio: 1; transform: perspective(600px) rotateX(57deg) rotateZ(-16deg); filter: drop-shadow(0 0 18px rgba(74, 180, 255, .45)); }
.radar-ring { position: absolute; inset: 0; border: 1px solid rgba(96, 213, 255, .34); border-radius: 50%; box-shadow: inset 0 0 28px rgba(82, 183, 255, .08); }
.ring-two { inset: 16%; border-color: rgba(167, 139, 250, .4); }
.ring-three { inset: 34%; border-color: rgba(103, 237, 255, .6); }
.radar-cross { position: absolute; background: linear-gradient(90deg, transparent, rgba(111, 225, 255, .5), transparent); }
.cross-x { top: 50%; left: -4%; width: 108%; height: 1px; }
.cross-y { top: -4%; left: 50%; width: 1px; height: 108%; background: linear-gradient(transparent, rgba(111, 225, 255, .5), transparent); }
.radar-sweep { position: absolute; top: -8%; left: 48%; width: 2px; height: 58%; transform-origin: 50% 100%; background: linear-gradient(to top, rgba(102, 232, 255, .8), transparent); box-shadow: 0 0 10px var(--cyan); animation: sweep 4.4s linear infinite; }
.core-orb { position: absolute; top: 50%; left: 50%; width: 82px; height: 82px; border: 1px solid rgba(137, 237, 255, .75); border-radius: 50%; background: radial-gradient(circle at 35% 30%, #eaffff, #5ddaff 12%, #2868aa 32%, rgba(13, 24, 66, .35) 64%, transparent 70%); box-shadow: 0 0 24px var(--cyan), 0 0 70px rgba(78, 99, 255, .65), inset 0 0 24px #baffff; transform: translate(-50%, -50%) rotateZ(16deg); animation: corePulse 3s ease-in-out infinite; }
.core-orb::before, .core-orb::after { position: absolute; content: ""; border: 1px solid rgba(119, 226, 255, .72); border-radius: 50%; }
.core-orb::before { inset: -13px 8px; transform: rotate(38deg); }
.core-orb::after { inset: 8px -13px; transform: rotate(-38deg); }
.core-orb span { position: absolute; inset: 27px; border: 1px solid white; border-radius: 50%; box-shadow: 0 0 13px white; }
.core-title { margin-top: 54px; color: #dffbff; font-family: var(--mono); font-size: 29px; letter-spacing: .45em; text-shadow: 0 0 22px var(--cyan); transform: translateX(.22em); }
.core-state { margin-top: 10px; color: var(--cyan); font-family: var(--mono); font-size: 12px; letter-spacing: .2em; }
.core-caption { margin-top: 11px; color: #658d9f; font-size: 8px; letter-spacing: .2em; }
.stage-metrics { position: absolute; z-index: 3; right: 18px; bottom: 17px; left: 18px; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); padding-top: 12px; }
.stage-metrics div { display: flex; flex-direction: column; gap: 5px; padding: 0 12px; border-right: 1px solid var(--line); }
.stage-metrics div:first-child { padding-left: 0; }
.stage-metrics div:last-child { border-right: 0; }
.stage-metrics span { color: #568094; font-size: 8px; letter-spacing: .13em; }
.stage-metrics strong { color: var(--cyan); font-family: var(--mono); font-size: 12px; font-weight: 400; }
@keyframes corePulse { 0%, 100% { transform: translate(-50%, -50%) scale(.96) rotateZ(16deg); } 50% { transform: translate(-50%, -50%) scale(1.07) rotateZ(16deg); } }
@keyframes sweep { to { transform: rotate(360deg); } }

.command-panel { flex: 0 0 auto; padding: 19px 16px 15px; border-color: rgba(102, 232, 255, .22); }
.live-label { display: flex; align-items: center; gap: 6px; color: var(--green); font-family: var(--mono); font-size: 9px; }
.live-label .mini-dot { width: 5px; height: 5px; background: var(--green); box-shadow: 0 0 8px var(--green); }
.quick-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.quick-action { display: grid; grid-template-columns: 27px 1fr; grid-template-rows: auto auto; column-gap: 8px; padding: 9px 8px; border: 1px solid rgba(107, 186, 219, .14); color: var(--text); text-align: left; background: linear-gradient(90deg, rgba(55, 119, 153, .17), rgba(23, 46, 68, .12)); transition: .2s ease; }
.quick-action:hover { border-color: var(--line-bright); background: rgba(69, 153, 190, .2); transform: translateX(3px); }
.quick-action span { grid-row: 1 / 3; color: var(--cyan); font-family: var(--mono); font-size: 10px; }
.quick-action strong { font-size: 11px; font-weight: 500; }
.quick-action small { margin-top: 3px; color: var(--muted); font-size: 9px; }

.right-panel { display: flex; min-height: 0; flex: 1; flex-direction: column; padding: 18px 15px 14px; }
.chat-section { display: flex; min-height: 300px; flex: 1; flex-direction: column; }
.chat-messages { display: flex; flex: 1; min-height: 100px; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; margin-top: 15px; padding-right: 3px; }
.chat-messages::-webkit-scrollbar { width: 3px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--cyan-soft); }
.message { padding: 9px 10px; border: 1px solid var(--line); background: rgba(27, 63, 86, .25); }
.user-message { align-self: flex-end; border-color: rgba(167, 139, 250, .32); background: rgba(96, 70, 152, .18); }
.message-tag { display: block; margin-bottom: 5px; color: var(--cyan-soft); font-family: var(--mono); font-size: 8px; letter-spacing: .12em; }
.user-message .message-tag { color: #b7a6ff; }
.message p, .message-body { margin: 0; color: #c9e4eb; font-size: 11px; line-height: 1.6; }
.message-body > :first-child { margin-top: 0; }
.message-body > :last-child { margin-bottom: 0; }
.message-body p { margin: 0 0 8px; }
.message-body h1, .message-body h2, .message-body h3 { margin: 0 0 8px; color: #e8fbff; font-size: 1.08em; }
.message-body ul, .message-body ol { margin: 0 0 8px; padding-left: 20px; }
.message-body li + li { margin-top: 3px; }
.message-body a { color: var(--cyan); }
.message-body blockquote { margin: 0 0 8px; padding-left: 10px; border-left: 2px solid var(--cyan-soft); color: #9fc3cc; }
.message-body pre { max-width: 100%; margin: 8px 0; padding: 10px; overflow-x: auto; border: 1px solid rgba(102, 232, 255, .18); background: rgba(2, 10, 18, .72); font-family: var(--mono); font-size: 10px; line-height: 1.55; }
.message-body code:not(pre code) { padding: 1px 4px; background: rgba(102, 232, 255, .1); color: #bdeff7; font-family: var(--mono); font-size: .92em; }
.message-body table { width: 100%; margin: 8px 0; border-collapse: collapse; font-size: 10px; }
.message-body th, .message-body td { padding: 4px 6px; border: 1px solid rgba(102, 232, 255, .16); text-align: left; }
.message-body th { color: #e8fbff; background: rgba(102, 232, 255, .08); }
.message-body .math-display { display: block; margin: 9px 0; overflow-x: auto; overflow-y: hidden; }
.message-body .math-fallback, .message-body .mermaid-fallback { display: block; white-space: pre-wrap; color: #f7c978; }
.message-body .mermaid-diagram { max-width: 100%; margin: 10px 0; overflow-x: auto; padding: 6px; border: 1px solid rgba(102, 232, 255, .16); background: rgba(2, 10, 18, .48); }
.message-body .mermaid-diagram svg { display: block; min-width: 260px; max-width: 100%; height: auto; }
.message-body .token.comment, .message-body .token.prolog, .message-body .token.doctype { color: #77949e; }
.message-body .token.keyword, .message-body .token.boolean, .message-body .token.number { color: #c2a6ff; }
.message-body .token.string, .message-body .token.char, .message-body .token.regex { color: #a9e6b4; }
.message-body .token.function, .message-body .token.class-name { color: #74dff5; }
.loop-trace { padding: 8px 10px; border-left: 2px solid var(--cyan); background: rgba(31, 86, 111, .14); color: #82b9c8; font-family: var(--mono); font-size: 8px; line-height: 1.7; }
.loop-trace .message-tag { margin-bottom: 3px; color: var(--cyan); }
.loop-trace-line { color: #86aeba; }
.command-suggestions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.command-suggestions button { padding: 5px 7px; border: 1px solid rgba(102, 232, 255, .18); color: #76afc0; background: rgba(39, 104, 131, .1); font-family: var(--mono); font-size: 8px; }
.command-suggestions button:hover { color: var(--cyan); border-color: var(--line-bright); }
.chat-form { margin-top: 9px; border-color: var(--line-bright); }
.chat-form input { padding: 11px; font-size: 11px; }
.target-device-picker { display: flex; min-width: 142px; flex-direction: column; justify-content: center; gap: 3px; padding: 4px 8px; border-right: 1px solid var(--line); color: var(--cyan-soft); font-family: var(--mono); font-size: 8px; letter-spacing: .05em; }
.target-device-picker select { max-width: 160px; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 10px; }
.target-device-picker option { color: #10202c; background: #dff6ff; }
.permission-mode-picker { display: flex; min-width: 150px; flex-direction: column; justify-content: center; gap: 3px; padding: 4px 8px; border-right: 1px solid var(--line); color: var(--cyan-soft); font-family: var(--mono); font-size: 8px; letter-spacing: .05em; }
.permission-mode-picker select { max-width: 170px; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 10px; }
.permission-mode-picker option { color: #10202c; background: #dff6ff; }
.permission-mode-picker select:disabled { opacity: .55; cursor: not-allowed; }
.permission-mode-picker small { max-width: 220px; color: #6f91a0; font-family: var(--sans); font-size: 7px; line-height: 1.25; letter-spacing: 0; }
.permission-mode-picker small[data-state="unavailable"] { color: #ffd27a; }
.sandbox-consent { display: flex; min-width: 182px; flex-direction: column; justify-content: center; gap: 2px; padding: 4px 8px; border-right: 1px solid var(--line); color: var(--cyan-soft); font-family: var(--mono); font-size: 8px; letter-spacing: .03em; }
.sandbox-consent input { flex: 0 0 auto; margin: 0 5px 0 0; accent-color: var(--cyan); }
.sandbox-consent span { display: inline-flex; align-items: center; color: var(--cyan); }
.sandbox-consent small { color: #6f91a0; font-size: 7px; line-height: 1.25; }
#experimentWorkspaceConsent[hidden] { display: none; }
.experiment-artifact-links { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--cyan-soft); font-size: 11px; }
.experiment-artifact-links a { color: var(--cyan); text-decoration: underline; }
.device-section { margin-top: 17px; padding-top: 16px; border-top: 1px solid var(--line); }
.icon-button { width: 28px; height: 28px; padding: 0; font-size: 17px; }
.device-actions .icon-button { flex: 0 0 auto; }
.device-list { margin-top: 11px; }
.device-card { display: flex; align-items: center; gap: 9px; padding: 9px 7px; border: 1px solid rgba(107, 186, 219, .12); background: rgba(44, 91, 120, .12); }
.device-avatar { display: grid; width: 29px; height: 29px; place-items: center; border: 1px solid var(--line-bright); color: var(--cyan); font-family: var(--mono); font-size: 12px; }
.device-info { min-width: 0; flex: 1; }
.device-name { overflow: hidden; color: #cbe7f0; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.device-detail { margin-top: 4px; overflow: hidden; color: var(--muted); font-family: var(--mono); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.device-state { color: var(--green); font-family: var(--mono); font-size: 9px; }
.device-state.offline { color: #718996; }
.device-state.revoked { color: var(--danger); }
.device-revoked { opacity: .7; }
.device-management { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; margin-left: 5px; }
.device-management-button { border: 1px solid rgba(102, 232, 255, .18); padding: 4px 5px; color: #84becd; background: rgba(39, 104, 131, .1); font-family: var(--mono); font-size: 7px; }
.device-management-button:hover { border-color: var(--cyan); color: var(--text); }
.device-management-button.danger { border-color: rgba(244, 120, 116, .25); color: #d99398; }
.device-management-button:disabled { opacity: .4; cursor: not-allowed; }
.empty-device { display: flex; align-items: center; gap: 9px; padding: 15px 7px; color: #637e8c; font-size: 10px; }
.device-onboarding { flex-direction: column; align-items: flex-start; gap: 9px; padding: 13px 8px; }
.device-onboarding .empty-icon { font-size: 20px; }
.device-onboarding-copy { display: flex; flex-direction: column; gap: 4px; }
.device-onboarding-copy strong { color: #cbe7f0; font-size: 11px; font-weight: 600; }
.device-onboarding-copy span { color: var(--muted); font-size: 9.5px; line-height: 1.55; }
.device-onboarding-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; }
.device-download-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 15px; border: 1px solid rgba(102, 232, 255, .5); border-radius: 8px; color: var(--cyan); background: rgba(41, 112, 143, .14); font-family: var(--sans); font-size: 12px; cursor: pointer; transition: .18s; }
.device-download-btn:hover { border-color: var(--cyan); background: rgba(62, 190, 225, .22); box-shadow: 0 0 16px rgba(102, 232, 255, .18); }
.device-secondary-link { padding: 0; border: 0; color: var(--cyan-soft); background: transparent; font-family: var(--sans); font-size: 9.5px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.device-secondary-link:hover { color: var(--cyan); }
.empty-icon { color: var(--cyan-soft); font-family: var(--mono); font-size: 22px; }

.footer-bar { justify-content: space-between; gap: 12px; min-height: 42px; margin-top: 14px; padding: 8px 13px; color: #638798; font-size: 8px; letter-spacing: .08em; }
.footer-mark { width: 6px; height: 6px; margin-right: 5px; background: var(--cyan); box-shadow: 0 0 9px var(--cyan); }
.footer-center { color: var(--cyan-soft); }
.footer-location { color: #527789; }
.footer-location span { color: var(--violet); padding: 0 5px; }
.footer-action { border: 0; color: var(--muted); background: transparent; font-family: var(--mono); font-size: 8px; }
.footer-action:hover { color: var(--cyan); }

.token-dialog { width: min(420px, calc(100vw - 30px)); border: 1px solid var(--line-bright); color: var(--text); background: #081525; box-shadow: 0 0 80px rgba(0, 0, 0, .8), 0 0 30px rgba(94, 124, 255, .18); }
.token-dialog::backdrop { background: rgba(1, 5, 12, .76); backdrop-filter: blur(5px); }
.token-dialog form { padding: 26px; }
.dialog-kicker { color: var(--cyan-soft); font-family: var(--mono); font-size: 9px; letter-spacing: .16em; }
.token-dialog h2 { margin: 10px 0 8px; font-weight: 400; }
.token-dialog p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.token-dialog label { display: block; margin-top: 20px; color: var(--cyan-soft); font-family: var(--mono); font-size: 9px; }
.token-dialog input { width: 100%; margin-top: 7px; padding: 12px; border: 1px solid var(--line); outline: 0; color: var(--text); background: rgba(0, 0, 0, .25); }
.token-dialog input:focus { border-color: var(--cyan); box-shadow: 0 0 18px rgba(102, 232, 255, .12); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.contract-dialog { width: min(620px, calc(100vw - 30px)); max-height: min(760px, calc(100vh - 30px)); overflow: auto; }
.contract-section { margin-top: 18px; padding: 12px; border: 1px solid rgba(107, 219, 239, .18); background: rgba(6, 19, 32, .65); }
.contract-section strong { display: block; color: var(--cyan-soft); font-family: var(--mono); font-size: 10px; letter-spacing: .08em; }
.contract-questions, .contract-acceptance { display: grid; gap: 8px; margin-top: 9px; color: var(--muted); font-size: 12px; }
.contract-question, .contract-criterion { padding: 8px 10px; border-left: 2px solid var(--cyan); background: rgba(102, 232, 255, .05); }
.contract-question-group { min-width: 0; margin: 0; padding: 9px 10px; border: 1px solid rgba(107, 219, 239, .14); background: rgba(0, 0, 0, .14); }
.contract-question-group legend { padding: 0 4px; color: var(--cyan-soft); font-size: 11px; }
.contract-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 7px; margin-top: 6px; }
.contract-option { display: flex; min-height: 36px; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid rgba(107, 219, 239, .16); background: rgba(7, 19, 29, .75); color: var(--muted); cursor: pointer; }
.contract-option:has(input:checked) { border-color: var(--cyan); color: var(--text); background: rgba(46, 146, 171, .18); }
.contract-option input { flex: 0 0 auto; width: 15px; height: 15px; margin: 0; accent-color: var(--cyan); }
.contract-question-required { margin-left: 6px; color: #ffd27a; font-size: 9px; }
.contract-question-status { margin-top: 10px; color: var(--muted); font-size: 11px; }
.contract-question-status[data-state="error"] { color: #ffaaa2; }

body[data-scene="rain"] .city-overlay { background: linear-gradient(180deg, rgba(5, 12, 25, .08), rgba(3, 14, 28, .25) 50%, rgba(0, 3, 10, .7)); }
body[data-scene="stars"] .city-overlay { opacity: .05; }
body[data-scene="stars"] .photo-layer { opacity: .66; filter: saturate(.72) contrast(1.12); }
body[data-scene="stars"] .core-orb { box-shadow: 0 0 24px var(--violet), 0 0 90px rgba(104, 96, 255, .75), inset 0 0 24px #e2d6ff; }

@media (max-width: 1240px) {
  .topbar { flex-wrap: wrap; }
  .location-chip { order: 4; }
  .dashboard-grid { grid-template-columns: 235px minmax(380px, 1fr); }
  .right-stack { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr); }
  .right-panel { min-height: 390px; }
  body:not([data-ui-mode="full-body"]) .left-stack { grid-column: 1; grid-row: 1; }
  body:not([data-ui-mode="full-body"]) .core-stage { grid-column: 2; grid-row: 1; }
  body:not([data-ui-mode="full-body"]) .right-stack { grid-column: 1 / -1; grid-row: 2; }
  body:not([data-ui-mode="full-body"]) .dashboard-grid:has(.core-stage.is-collapsed) { grid-template-columns: minmax(235px, 1fr) 48px; }
}
@media (max-width: 780px) {
  .app-shell { padding: 10px; }
  .topbar { align-items: flex-start; gap: 12px; padding: 13px; }
  .brand-lockup { min-width: 0; }
  .brand-subtitle { font-size: 7px; }
  .top-status { order: 5; width: 100%; }
  .account-badge { order: 4; margin-left: auto; }
  .location-chip { order: 3; margin-left: auto; }
  .clock-block { margin-left: auto; }
  .location-chip small { display: none; }
  .mission-strip { flex-wrap: wrap; gap: 11px; }
  .mission-label { min-width: 125px; }
  .progress-track { flex-basis: calc(100% - 145px); }
  .mission-meta { order: 3; }
  .environment-bar { align-items: flex-start; flex-wrap: wrap; }
  .environment-copy { min-width: 0; flex: 1 0 100%; }
  .scene-toggle { margin-left: 0; }
  .gallery-controls { margin-left: 0; }
  .environment-signal { margin-left: auto; }
  .dashboard-grid { display: flex; min-height: auto; flex-direction: column; }
  .core-stage { min-height: 510px; order: -1; }
  .left-stack, .right-stack { display: flex; }
  body:not([data-ui-mode="full-body"]) .right-stack { order: -1; }
  body:not([data-ui-mode="full-body"]) .core-stage { order: 0; }
  body:not([data-ui-mode="full-body"]) .left-stack { order: 1; }
  body:not([data-ui-mode="full-body"]) .core-stage.is-collapsed { min-height: 46px; height: 46px; }
  body:not([data-ui-mode="full-body"]) .core-stage.is-collapsed .stage-collapsed-label { writing-mode: horizontal-tb; top: 50%; left: 16px; transform: translateY(-50%); letter-spacing: .2em; }
  body:not([data-ui-mode="full-body"]) .core-stage.is-collapsed .stage-toggle { top: 50%; right: 10px; height: 30px; transform: translateY(-50%); }
  .todo-panel { min-height: 360px; }
  .right-panel { min-height: 480px; }
  .target-device-picker { min-width: 118px; }
  .target-device-picker select { max-width: 125px; }
  .permission-mode-picker { min-width: 132px; }
  .permission-mode-picker select { max-width: 145px; }
  .device-management { width: 100%; margin: 4px 0 0 38px; justify-content: flex-start; }
  .footer-bar { flex-wrap: wrap; }
  .footer-center { order: 4; width: 100%; }
}
@media (max-width: 460px) {
  .brand-name { font-size: 14px; }
  .clock-value { font-size: 18px; }
  .core-title { font-size: 24px; }
  .core-radar { width: min(295px, 78vw); }
  .stage-metrics { right: 10px; bottom: 11px; left: 10px; }
  .stage-metrics div { padding: 0 7px; }
  .scene-caption { font-size: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

.engine-mode-toggle {
  border: 1px solid rgba(113, 205, 231, .4);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--cyan, #8be3f2);
  background: rgba(8, 21, 34, .76);
  cursor: pointer;
  font: 600 10px/1.2 var(--mono, monospace);
  letter-spacing: .08em;
}
.engine-mode-toggle:disabled { opacity: .45; cursor: not-allowed; }
.normal-chat-mount { display: flex; min-height: 0; flex: 1; }
.normal-device-mount { flex: 0 0 auto; }
.battle-focus-view[hidden] { display: none; }
body[data-ui-mode="full-body"] { overflow: hidden; }
body[data-ui-mode="full-body"] .app-shell { min-height: 100vh; padding: 0; background: #020710; }
body[data-ui-mode="full-body"] .topbar,
body[data-ui-mode="full-body"] .mission-strip,
body[data-ui-mode="full-body"] .environment-bar,
body[data-ui-mode="full-body"] .dashboard-grid,
body[data-ui-mode="full-body"] .footer-bar { display: none; }
.battle-focus-view { position: fixed; z-index: 10; inset: 0; overflow: hidden; background: #020710; }
.battle-focus-view::before { position: absolute; z-index: 1; inset: 0; content: ""; background: radial-gradient(circle at 52% 34%, rgba(30, 100, 139, .1), transparent 38%), linear-gradient(110deg, rgba(1, 5, 12, .9), rgba(3, 12, 21, .68) 48%, rgba(1, 6, 14, .9)); pointer-events: none; }
.battle-background { position: absolute; z-index: 0; inset: -2%; background-position: center; background-size: cover; filter: saturate(.62) contrast(1.04) brightness(.48) blur(1px); opacity: .48; transform: scale(1.04); transition: background-image .5s ease; }
.battle-shell { position: relative; z-index: 2; display: flex; width: 100%; height: 100%; flex-direction: column; padding: clamp(10px, 1.3vw, 20px); }
.full-body-header { display: flex; flex: 0 0 auto; min-height: 56px; align-items: center; justify-content: space-between; gap: 18px; border: 1px solid rgba(107, 219, 239, .28); border-bottom-color: rgba(107, 219, 239, .16); border-radius: 14px 14px 0 0; padding: 10px 14px; color: #b9eff8; background: rgba(3, 13, 23, .62); box-shadow: 0 20px 60px rgba(0, 0, 0, .24); backdrop-filter: blur(16px); font: 600 10px/1.2 var(--mono, monospace); letter-spacing: .1em; }
.battle-brand, .battle-header-status, .battle-status-pill { display: flex; align-items: center; }
.battle-brand { gap: 10px; }
.battle-brand > div { display: grid; gap: 3px; }
.battle-brand strong { color: #f0bd78; font-size: 9px; letter-spacing: .16em; }
.battle-brand-orb { width: 19px; height: 19px; border: 1px solid var(--cyan); border-radius: 50%; background: radial-gradient(circle, #dcffff 0 12%, #4bc9e5 18%, rgba(43, 99, 153, .24) 48%, transparent 62%); box-shadow: 0 0 15px rgba(102, 232, 255, .5); }
.battle-header-status { gap: 10px; }
.battle-status-pill { gap: 7px; color: #9ed7b1; font-size: 9px; }
.battle-status-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }
.battle-usage { color: #7f9eab; font-size: 8px; letter-spacing: .05em; }
.battle-workspace { display: grid; min-height: 0; flex: 1; grid-template-columns: clamp(240px, 19vw, 310px) minmax(420px, 1fr) clamp(280px, 23vw, 360px); border: 1px solid rgba(107, 219, 239, .28); border-top: 0; border-radius: 0 0 14px 14px; background: rgba(3, 11, 20, .58); box-shadow: 0 24px 80px rgba(0, 0, 0, .34); backdrop-filter: blur(18px); }
.battle-task-rail, .battle-monitor, .battle-chat-mount { min-width: 0; min-height: 0; }
.battle-task-rail, .battle-monitor { display: flex; flex-direction: column; overflow-y: auto; }
.battle-chat-mount { display: flex; border-right: 1px solid rgba(107, 219, 239, .13); border-left: 1px solid rgba(107, 219, 239, .13); background: rgba(1, 7, 14, .32); }
.battle-module { padding: 16px; border-bottom: 1px solid rgba(107, 219, 239, .12); background: transparent; }
.battle-module-heading { display: flex; align-items: end; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.battle-module-heading strong { color: #cce5ec; font-size: 11px; font-weight: 500; }
.mission-panel { flex: 0 0 auto; }
.mission-panel h2 { margin: 8px 0; overflow: hidden; color: #f1f5f7; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; }
.mission-panel p { margin: 0 0 12px; color: #9fb4c0; font-size: 11px; line-height: 1.55; }
.mode-badge { display: inline-block; color: #f0bd78; font: 700 9px/1.2 var(--mono, monospace); letter-spacing: .12em; }
.task-queue-panel { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 8px; }
.task-queue-list { display: grid; min-height: 0; gap: 3px; overflow-y: auto; }
.task-queue-heading, .task-history-header, .task-history-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.task-queue-heading h2, .task-history-header h2 { margin: 3px 0 0; color: #dceef3; font-size: 14px; font-weight: 600; }
.task-filter-group { display: inline-flex; gap: 3px; padding: 2px; border: 1px solid rgba(130, 160, 175, .16); border-radius: 7px; background: rgba(2, 10, 18, .35); }
.task-filter { border: 0; border-radius: 5px; padding: 5px 8px; color: #78909c; background: transparent; font: 9px/1 var(--mono, monospace); cursor: pointer; }
.task-filter:hover, .task-filter.active { color: #dffaff; background: rgba(75, 178, 202, .18); }
.task-history-list { display: grid; gap: 3px; }
.task-queue-item { display: grid; grid-template-columns: 7px minmax(0, 1fr) auto; align-items: center; gap: 9px; min-height: 46px; width: 100%; border: 1px solid transparent; border-radius: 7px; padding: 7px 8px; text-align: left; color: #b7cbd2; background: rgba(10, 25, 36, .26); cursor: pointer; }
.task-queue-item:hover { background: rgba(22, 48, 62, .48); }
.task-queue-item.selected { border-color: rgba(123, 214, 235, .62); color: #e7fbff; background: rgba(27, 78, 94, .22); }
.task-status-dot { width: 6px; height: 6px; border-radius: 50%; background: #6e8490; box-shadow: 0 0 7px currentColor; }
.task-queue-item.status-completed .task-status-dot { color: #87d0a4; background: #87d0a4; }
.task-queue-item.status-failed .task-status-dot, .task-queue-item.status-cancelled .task-status-dot { color: #f47874; background: #f47874; }
.task-queue-item.status-running .task-status-dot, .task-queue-item.status-waiting_tool .task-status-dot { color: #7bd6eb; background: #7bd6eb; }
.task-queue-copy { display: grid; min-width: 0; gap: 3px; }
.task-queue-copy strong { overflow: hidden; color: inherit; font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.task-queue-copy small { color: #718995; font: 8px/1.2 var(--mono, monospace); }
.task-queue-outcome { display: grid; justify-items: end; gap: 3px; color: #90a9b4; font-size: 9px; white-space: nowrap; }
.status-failed .task-status-label, .status-cancelled .task-status-label { color: #ff9a95; }
.status-completed .task-status-label { color: #9ed7b1; }
.status-running .task-status-label, .status-waiting_tool .task-status-label { color: #9be9f5; }
.task-run-count { color: #718995; font: 8px/1 var(--mono, monospace); }
.task-queue-more { align-self: stretch; border: 0; border-top: 1px solid rgba(130, 160, 175, .12); padding: 9px 4px 1px; color: #73bfd0; background: transparent; font: 9px/1.2 var(--mono, monospace); text-align: right; cursor: pointer; }
.task-queue-more:hover { color: #d7f8fc; }
.task-queue-empty { padding: 18px 8px; color: #718995; font-size: 11px; text-align: center; }
.phase-panel { flex: 0 0 auto; }
.phase-track { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
.phase-item { overflow: hidden; border-bottom: 2px solid rgba(130, 160, 175, .2); padding: 7px 2px; color: #718894; background: rgba(15, 29, 41, .28); font-size: 9px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.phase-item.active { border-bottom-color: #7bd6eb; color: #d7f8fc; background: rgba(32, 104, 122, .24); }
.phase-item.done { border-bottom-color: #87d0a4; color: #a9d8b8; }
.timeline-panel { display: flex; min-height: 150px; flex: 1; flex-direction: column; }
.battle-timeline { display: grid; min-height: 0; gap: 4px; overflow-y: auto; }
.battle-timeline-item { padding: 7px 5px; border-bottom: 1px solid rgba(130, 160, 175, .1); color: #9fbac4; font: 9px/1.4 var(--mono, monospace); }
.task-control-panel { flex: 0 0 auto; }
.battle-progress { display: flex; align-items: baseline; justify-content: space-between; padding: 3px 0 10px; }
.battle-progress strong { color: #f0bd78; font: 700 24px/1 var(--mono, monospace); }
.battle-progress span { color: #8ea5b1; font-size: 10px; }
.battle-control-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.battle-control-actions .danger-button { grid-column: 1 / -1; }
.danger-button { border: 1px solid rgba(244, 120, 116, .48); border-radius: 7px; padding: 9px; color: #ffaaa4; background: rgba(100, 25, 28, .2); cursor: pointer; }
.danger-button:disabled, .ghost-button:disabled { opacity: .4; cursor: not-allowed; }
.battle-chat-mount .chat-section { width: 100%; min-height: 0; padding: clamp(16px, 2vw, 28px); }
.battle-chat-mount .panel-heading h2 { font-size: 18px; }
.battle-chat-mount .chat-messages { min-height: 0; max-height: none; margin-top: 18px; padding: 0 clamp(2px, 1vw, 12px) 14px; }
.battle-chat-mount .message { max-width: min(88%, 860px); padding: 12px 14px; background: rgba(12, 33, 47, .48); backdrop-filter: blur(8px); }
.battle-chat-mount .message p { font-size: 13px; line-height: 1.75; }
.battle-chat-mount .user-message { background: rgba(71, 55, 118, .34); }
.battle-chat-mount .command-suggestions { padding: 0 clamp(2px, 1vw, 12px); }
.battle-chat-mount .chat-form { position: sticky; bottom: 0; margin: 10px clamp(2px, 1vw, 12px) 0; border-color: rgba(102, 232, 255, .5); background: rgba(2, 10, 18, .78); box-shadow: 0 -16px 35px rgba(1, 5, 12, .28); backdrop-filter: blur(14px); }
.battle-chat-mount .chat-form textarea { padding: 12px 14px; font-size: 13px; }
.battle-device-mount { flex: 0 0 auto; }
.battle-device-mount .device-section { margin: 0; padding: 14px 16px 16px; border-top: 0; border-bottom: 1px solid rgba(107, 219, 239, .12); }
.battle-device-mount .device-list { max-height: 125px; overflow-y: auto; }
.battle-device-mount .device-card { padding: 7px 5px; background: rgba(25, 57, 76, .2); }
.task-history-dialog { position: fixed; inset: 0 0 0 auto; width: min(430px, 100vw); height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; border-left: 1px solid rgba(107, 219, 239, .35); color: #b7cbd2; background: #07131f; box-shadow: -24px 0 70px rgba(0, 0, 0, .55); }
.task-history-dialog::backdrop { background: rgba(1, 5, 12, .68); backdrop-filter: blur(3px); }
.task-history-shell { display: flex; flex-direction: column; gap: 12px; height: 100%; padding: 22px; }
.task-history-header { flex: 0 0 auto; }
.task-history-header .icon-button { align-self: flex-start; }
.task-history-count { color: #718995; font: 9px/1.2 var(--mono, monospace); }
.task-history-search { flex: 0 0 auto; width: 100%; border: 1px solid rgba(130, 160, 175, .25); border-radius: 7px; outline: 0; padding: 10px 12px; color: #dceef3; background: rgba(0, 0, 0, .22); }
.task-history-search:focus { border-color: rgba(123, 214, 235, .7); box-shadow: 0 0 18px rgba(102, 232, 255, .08); }
.task-history-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 3px; }
@media (max-width: 1080px) {
  .battle-workspace { grid-template-columns: 230px minmax(0, 1fr) 280px; }
  .battle-shell { padding: 8px; }
  .battle-module { padding: 12px; }
  .battle-chat-mount .chat-section { padding: 16px; }
}
@media (max-width: 900px) {
  body[data-ui-mode="full-body"] { overflow: auto; }
  .battle-focus-view { position: relative; min-height: 100vh; overflow: visible; }
  .battle-shell { min-height: 100vh; }
  .battle-workspace { flex: 1; grid-template-columns: minmax(210px, 250px) minmax(0, 1fr); grid-template-rows: minmax(580px, 1fr) auto; }
  .battle-monitor { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1.4fr 1fr; overflow: visible; border-top: 1px solid rgba(107, 219, 239, .13); }
  .battle-device-mount { grid-column: 1 / -1; }
  .battle-monitor .battle-module { border-right: 1px solid rgba(107, 219, 239, .1); }
}
@media (max-width: 680px) {
  .full-body-header { align-items: flex-start; flex-direction: column; }
  .battle-header-status { width: 100%; flex-wrap: wrap; }
  .battle-header-status .ghost-button { margin-left: auto; }
  .battle-workspace { display: flex; flex-direction: column; overflow: visible; }
  .battle-task-rail, .battle-monitor { overflow: visible; }
  .battle-chat-mount { min-height: 72vh; border: 1px solid rgba(107, 219, 239, .13); border-right: 0; border-left: 0; }
  .battle-monitor { display: flex; }
  .task-queue-list { max-height: 245px; }
  .battle-chat-mount .message { max-width: 94%; }
}

/* Conversation sessions */
.conversation-bar { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding: 9px 10px; border: 1px solid var(--line); background: rgba(10, 28, 42, .42); }
.conversation-bar-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.conversation-capabilities { margin-left: auto; color: #6f91a0; font-family: var(--mono); font-size: 8px; letter-spacing: .04em; }
.conversation-list { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.conversation-empty { color: #6f91a0; font-size: 10px; }
.conversation-item { display: inline-flex; align-items: center; gap: 2px; border: 1px solid rgba(102, 232, 255, .18); border-radius: 999px; padding: 2px 4px 2px 2px; background: rgba(8, 24, 38, .65); white-space: nowrap; }
.conversation-item.active { border-color: rgba(102, 232, 255, .6); box-shadow: 0 0 0 1px rgba(102, 232, 255, .22); }
.conversation-select { max-width: 180px; padding: 4px 8px; overflow: hidden; border: 0; color: #d7f3ff; background: transparent; font-size: 10px; text-overflow: ellipsis; cursor: pointer; }
.conversation-action { padding: 3px 5px; border: 0; border-radius: 999px; color: #6f91a0; background: transparent; font-size: 9px; cursor: pointer; }
.conversation-action:hover { color: #eaf9ff; background: rgba(102, 232, 255, .14); }
.conversation-action.danger { color: rgba(255, 154, 154, .85); }
.conversation-memory { margin-top: 8px; padding: 6px 10px; border: 1px dashed rgba(102, 232, 255, .18); color: #9fc3cc; font-size: 10px; }
.conversation-memory summary { cursor: pointer; letter-spacing: .05em; }
.conversation-memory-list { display: flex; flex-direction: column; gap: 6px; max-height: 140px; margin-top: 6px; overflow: auto; }
.conversation-memory-item strong { display: block; font-size: 10px; }
.conversation-memory-item p { margin: 2px 0 0; color: #82b9c8; font-size: 10px; }
.intent-override { display: flex; min-width: 86px; flex-direction: column; justify-content: center; gap: 3px; padding: 4px 8px; border-right: 1px solid var(--line); color: var(--cyan-soft); font-family: var(--mono); font-size: 8px; letter-spacing: .05em; }
.intent-override select { max-width: 110px; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 10px; }
.intent-override option { color: #10202c; background: #dff6ff; }
.approval-card { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; padding: 12px; border: 1px solid rgba(255, 196, 120, .45); border-radius: 4px; background: rgba(40, 28, 8, .42); }
.approval-card strong { color: #ffd9a0; }
.approval-card p { margin: 0; color: rgba(255, 228, 190, .86); font-size: 10px; line-height: 1.6; }
.approval-actions { display: flex; gap: 8px; }
.approval-actions button { width: auto; min-width: 92px; padding: 7px 12px; font-size: 11px; }
.delete-blockers { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; color: rgba(255, 154, 154, .9); font-size: 11px; }
.delete-blocker-item { padding: 6px 8px; border: 1px solid rgba(255, 154, 154, .3); border-radius: 8px; background: rgba(40, 12, 12, .4); }

/* Battle mode chat-first layout */
body[data-ui-mode="full-body"] .full-body-header { gap: 12px; font-size: 12px; letter-spacing: .04em; }
body[data-ui-mode="full-body"] .battle-workspace { position: relative; display: flex; min-width: 0; min-height: 0; flex: 1 1 auto; overflow: hidden; border: 1px solid rgba(107, 219, 239, .28); border-top: 0; border-radius: 0 0 14px 14px; background: rgba(3, 11, 20, .68); }
body[data-ui-mode="full-body"] .battle-task-entry { position: absolute; z-index: 12; inset: 0 auto 0 0; display: flex; width: 54px; justify-content: center; border-right: 1px solid rgba(107, 219, 239, .2); padding: 12px 5px; background: rgba(3, 13, 23, .86); }
body[data-ui-mode="full-body"] .battle-task-entry-button { display: flex; width: 42px; height: max-content; min-height: 72px; align-items: center; flex-direction: column; justify-content: center; gap: 8px; border: 1px solid rgba(107, 219, 239, .25); border-radius: 9px; color: #b9eff8; background: rgba(10, 31, 45, .85); cursor: pointer; }
body[data-ui-mode="full-body"] .battle-task-entry-button span:first-child { color: var(--cyan); font-size: 17px; }
body[data-ui-mode="full-body"] .battle-task-entry-button span:last-child { font-size: 11px; writing-mode: vertical-rl; }
body[data-ui-mode="full-body"] .battle-task-entry-button:hover,
body[data-ui-mode="full-body"] .battle-task-entry-button:focus-visible { border-color: var(--cyan); outline: 2px solid rgba(102, 232, 255, .28); outline-offset: 2px; }
body[data-ui-mode="full-body"] .battle-drawer-toggle { min-height: 34px; font-size: 11px; letter-spacing: .02em; }
body[data-ui-mode="full-body"] .battle-chat-mount { display: flex; min-width: 0; min-height: 0; flex: 1 1 auto; margin-left: 54px; overflow: hidden; border: 0; background: rgba(1, 7, 14, .24); }
body[data-ui-mode="full-body"] .battle-chat-mount .chat-section { display: flex; width: 100%; height: 100%; min-width: 0; min-height: 0; flex: 1 1 auto; flex-direction: column; overflow: hidden; padding: clamp(16px, 2vw, 30px); background: transparent; }
body[data-ui-mode="full-body"] .battle-chat-mount .panel-heading h2 { font-size: 20px; }
body[data-ui-mode="full-body"] .battle-chat-mount .live-label { display: none; }
body[data-ui-mode="full-body"] .battle-chat-mount .chat-messages { min-width: 0; min-height: 0; flex: 1 1 auto; max-height: none; margin-top: 16px; overflow: auto; overscroll-behavior: contain; padding: 0 10px 16px; }
body[data-ui-mode="full-body"] .battle-chat-mount .message { max-width: min(88%, 900px); padding: 14px 16px; }
body[data-ui-mode="full-body"] .battle-chat-mount .message p,
body[data-ui-mode="full-body"] .battle-chat-mount .message-body { font-size: 15px; line-height: 1.75; }
body[data-ui-mode="full-body"] .battle-chat-mount .command-suggestions { flex: 0 0 auto; padding: 0 10px; }
body[data-ui-mode="full-body"] .battle-chat-mount .conversation-memory { flex: 0 0 auto; margin-right: 10px; margin-left: 10px; }
/* Chat composer：多行输入 + 底部工具行（Rovis 风格布局，普通与战斗模式共用） */
.chat-form { display: flex; flex-direction: column; align-items: stretch; gap: 0; margin-top: 9px; border: 1px solid var(--line-bright); border-radius: 12px; background: rgba(2, 10, 18, .55); overflow: hidden; }
.chat-form textarea#chatInput { width: 100%; min-height: 72px; max-height: 200px; resize: none; border: 0; outline: 0; padding: 12px 14px; color: var(--text); background: transparent; font-family: inherit; font-size: 13px; line-height: 1.6; overflow-y: auto; }
.chat-form textarea#chatInput::placeholder { color: #5f7c8b; }
.chat-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border-top: 1px solid var(--line); background: rgba(0, 0, 0, .18); }
.chat-toolbar-options { display: flex; min-width: 0; flex: 1 1 auto; flex-wrap: wrap; align-items: center; }
.chat-toolbar-options .target-device-picker { min-width: 0; flex: 0 1 auto; }
.chat-toolbar-options .sandbox-consent { min-width: 0; flex: 0 1 auto; }
.chat-toolbar-options .intent-override { min-width: 0; flex: 0 1 auto; }
.chat-form .chat-send { flex: 0 0 auto; width: 40px; height: 40px; padding: 0; border: 1px solid rgba(102, 232, 255, .4); border-radius: 50%; color: #051018; background: var(--cyan); font-size: 17px; line-height: 1; box-shadow: 0 0 14px rgba(102, 232, 255, .25); cursor: pointer; }
.chat-form .chat-send:hover { background: #8ef0ff; }
.chat-form .chat-send:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 900px) {
  .chat-toolbar { flex-wrap: wrap; }
  .chat-toolbar-options { flex: 1 1 100%; }
  .chat-form .chat-send { margin-left: auto; }
}
body[data-ui-mode="full-body"] .battle-chat-mount .chat-form { display: flex; flex: 0 0 auto; flex-direction: column; gap: 0; margin: 10px 10px 0; border: 1px solid rgba(102, 232, 255, .5); border-radius: 14px; background: rgba(2, 10, 18, .9); box-shadow: 0 -12px 35px rgba(1, 5, 12, .28); overflow: hidden; }
body[data-ui-mode="full-body"] .battle-chat-mount .chat-form textarea#chatInput { min-height: 88px; padding: 14px 16px; font-size: 15px; }
body[data-ui-mode="full-body"] .battle-chat-mount .chat-form .chat-toolbar { padding: 8px 10px; border-top: 1px solid rgba(107, 219, 239, .16); background: rgba(0, 0, 0, .22); }
body[data-ui-mode="full-body"] .battle-chat-mount .chat-form .sandbox-consent { padding: 6px 9px; font-size: 10px; }
body[data-ui-mode="full-body"] .battle-chat-mount .chat-form .sandbox-consent small { font-size: 9px; line-height: 1.3; }
body[data-ui-mode="full-body"] .battle-chat-mount .chat-form .chat-send { width: 46px; height: 46px; font-size: 18px; }
body[data-ui-mode="full-body"] .battle-chat-mount .chat-form #experimentWorkspaceConsent[hidden] { display: none; }
body[data-ui-mode="full-body"] .battle-task-rail,
body[data-ui-mode="full-body"] .battle-monitor { position: absolute; z-index: 32; top: 0; bottom: 0; display: flex; width: min(420px, calc(100vw - 76px)); max-height: 100%; flex-direction: column; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; border: 1px solid rgba(107, 219, 239, .3); background: rgba(4, 16, 27, .98); box-shadow: 0 22px 70px rgba(0, 0, 0, .62); visibility: hidden; pointer-events: none; transition: transform .22s ease, visibility .22s ease; }
body[data-ui-mode="full-body"] .battle-task-rail { left: 0; transform: translateX(-104%); }
body[data-ui-mode="full-body"] .battle-monitor { right: 0; width: min(440px, calc(100vw - 76px)); transform: translateX(104%); }
body[data-ui-mode="full-body"] .battle-task-rail.is-open,
body[data-ui-mode="full-body"] .battle-monitor.is-open { visibility: visible; pointer-events: auto; transform: translateX(0); }
body[data-ui-mode="full-body"] .battle-task-rail.is-open { display: flex; }
body[data-ui-mode="full-body"] .battle-monitor.is-open { display: flex; }
body[data-ui-mode="full-body"] .battle-drawer-heading { position: sticky; z-index: 1; top: 0; display: flex; min-height: 54px; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid rgba(107, 219, 239, .18); padding: 10px 14px; background: rgba(4, 16, 27, .98); }
body[data-ui-mode="full-body"] .battle-drawer-heading h2 { margin: 0; color: #dffaff; font-size: 16px; font-weight: 500; }
body[data-ui-mode="full-body"] .battle-module { padding: 14px; }
body[data-ui-mode="full-body"] .battle-module-heading strong { font-size: 13px; }
body[data-ui-mode="full-body"] .battle-timeline-item { font-size: 11px; }
body[data-ui-mode="full-body"] .battle-task-rail .mission-panel h2 { overflow: visible; text-overflow: clip; white-space: normal; }
body[data-ui-mode="full-body"] #battleDrawerBackdrop { position: absolute; z-index: 30; inset: 0; border: 0; background: rgba(1, 5, 12, .62); backdrop-filter: blur(3px); }
body[data-ui-mode="full-body"] #battleDrawerBackdrop[hidden] { display: none; }
body[data-ui-mode="full-body"] .battle-status-pill { color: #c1d2d9; }
body[data-ui-mode="full-body"] .battle-status-pill[data-state="live"] { color: #a9e8c2; }
body[data-ui-mode="full-body"] .battle-status-pill[data-state="offline"] { color: #98a9b1; }
body[data-ui-mode="full-body"] .battle-status-pill[data-state="connecting"],
body[data-ui-mode="full-body"] .battle-status-pill[data-state="reconnecting"] { color: #f0d18f; }
body[data-ui-mode="full-body"] .battle-status-pill[data-state="stale"] { color: #f0a29a; }
body[data-ui-mode="full-body"] .battle-status-pill[data-state="live"] i { background: #87d0a4; box-shadow: 0 0 9px #87d0a4; }
body[data-ui-mode="full-body"] .battle-status-pill[data-state="offline"] i { background: #718996; box-shadow: none; }
body[data-ui-mode="full-body"] .battle-status-pill[data-state="connecting"] i,
body[data-ui-mode="full-body"] .battle-status-pill[data-state="reconnecting"] i { background: #f0bd78; box-shadow: 0 0 8px #f0bd78; }
body[data-ui-mode="full-body"] .battle-status-pill[data-state="stale"] i { background: #f47874; box-shadow: 0 0 8px #f47874; }
body[data-ui-mode="full-body"] .battle-task-status-label { display: inline-flex; align-items: center; margin-left: 6px; border: 1px solid rgba(152, 177, 189, .3); border-radius: 999px; padding: 3px 7px; color: #c1d2d9; background: rgba(0, 0, 0, .2); font-size: 10px; letter-spacing: 0; }
body[data-ui-mode="full-body"] .battle-task-status-label[data-status="running"],
body[data-ui-mode="full-body"] .battle-task-status-label[data-status="queued"],
body[data-ui-mode="full-body"] .battle-task-status-label[data-status="waiting_tool"] { border-color: rgba(123, 214, 235, .45); color: #a9eaf5; }
body[data-ui-mode="full-body"] .battle-task-status-label[data-status="completed"] { border-color: rgba(135, 208, 164, .42); color: #a9d8b8; }
body[data-ui-mode="full-body"] .battle-task-status-label[data-status="failed"],
body[data-ui-mode="full-body"] .battle-task-status-label[data-status="cancelled"] { border-color: rgba(244, 120, 116, .45); color: #ffaaa4; }
body[data-ui-mode="full-body"] .battle-task-status-label[data-status="paused"] { border-color: rgba(240, 189, 120, .45); color: #f0d18f; }
body[data-ui-mode="full-body"] .battle-workspace :focus-visible { outline: 2px solid #79e4f5; outline-offset: 2px; }

@media (max-width: 900px) {
  body[data-ui-mode="full-body"] .battle-workspace { display: flex; }
  body[data-ui-mode="full-body"] .battle-chat-mount { margin-left: 54px; }
  body[data-ui-mode="full-body"] .battle-task-rail,
  body[data-ui-mode="full-body"] .battle-monitor { width: min(420px, calc(100vw - 76px)); }
}

@media (max-width: 680px) {
  body[data-ui-mode="full-body"] { overflow: hidden; }
  body[data-ui-mode="full-body"] .battle-focus-view { position: fixed; inset: 0; min-height: 0; overflow: hidden; }
  body[data-ui-mode="full-body"] .battle-shell { width: 100%; height: 100dvh; min-height: 0; padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
  body[data-ui-mode="full-body"] .full-body-header { min-height: 92px; align-items: flex-start; flex-direction: column; gap: 8px; border-radius: 12px 12px 0 0; }
  body[data-ui-mode="full-body"] .battle-header-status { width: 100%; align-items: center; flex-wrap: wrap; gap: 7px; }
  body[data-ui-mode="full-body"] .battle-header-status .battle-drawer-toggle { margin-left: auto; }
  body[data-ui-mode="full-body"] .battle-workspace { display: flex; min-height: 0; flex: 1 1 auto; overflow: hidden; }
  body[data-ui-mode="full-body"] .battle-task-entry { width: 48px; padding: 8px 3px; }
  body[data-ui-mode="full-body"] .battle-task-entry-button { width: 40px; min-height: 66px; }
  body[data-ui-mode="full-body"] .battle-chat-mount { min-height: 0; margin-left: 48px; border: 0; }
  body[data-ui-mode="full-body"] .battle-chat-mount .chat-section { padding: 12px 8px 8px; }
  body[data-ui-mode="full-body"] .battle-chat-mount .panel-heading h2 { font-size: 17px; }
  body[data-ui-mode="full-body"] .battle-chat-mount .message { max-width: 96%; padding: 10px 11px; }
  body[data-ui-mode="full-body"] .battle-chat-mount .message p,
  body[data-ui-mode="full-body"] .battle-chat-mount .message-body { font-size: 14px; }
  body[data-ui-mode="full-body"] .battle-chat-mount .chat-form { margin: 8px 2px 2px; }
  body[data-ui-mode="full-body"] .battle-chat-mount .chat-form textarea#chatInput { min-height: 64px; padding: 10px 12px; font-size: 14px; }
  body[data-ui-mode="full-body"] .battle-chat-mount .chat-form .chat-toolbar-options { flex: 1 1 100%; }
  body[data-ui-mode="full-body"] .battle-chat-mount .chat-form .chat-send { width: 44px; height: 44px; margin-left: auto; }
  body[data-ui-mode="full-body"] .battle-task-rail,
  body[data-ui-mode="full-body"] .battle-monitor { position: fixed; z-index: 52; inset: 0; width: 100vw; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  body[data-ui-mode="full-body"] .battle-task-rail { transform: translateX(-101%); }
  body[data-ui-mode="full-body"] .battle-monitor { transform: translateX(101%); }
  body[data-ui-mode="full-body"] .battle-task-rail.is-open,
  body[data-ui-mode="full-body"] .battle-monitor.is-open { transform: translateX(0); }
  body[data-ui-mode="full-body"] #battleDrawerBackdrop { position: fixed; z-index: 50; inset: 0; }
  body[data-ui-mode="full-body"] .battle-drawer-heading { min-height: 56px; }
  body[data-ui-mode="full-body"] .timeline-panel { min-height: 160px; }
}
