:root {
  color-scheme: dark;
  --ink: #eeefed;
  --muted: #a3abad;
  --subtle: #788184;
  --line: #ffffff19;
  --paper: #111416;
  --panel: #191d20;
  --teal: #81d5cb;
  --amber: #e8b877;
  --error: #ed9b91;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; letter-spacing: 0; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, a { -webkit-tap-highlight-color: transparent; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; color: inherit; cursor: pointer; transition: color .15s ease, background-color .15s ease, border-color .15s ease; }
button:disabled { cursor: wait; opacity: .5; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--teal); outline-offset: 4px; }
.icon { display: block; flex: 0 0 auto; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#app { display: flex; flex-direction: column; height: 100svh; min-height: 790px; overflow: hidden; }

.topbar { display: flex; flex: 0 0 64px; align-items: center; gap: 32px; height: 64px; padding: 0 24px; background: #121517; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; white-space: nowrap; font-size: 25px; line-height: 1; }
.brand strong { font-weight: 720; }
.brand strong span, .fly-mark { color: var(--teal); }
.fly-mark .icon { width: 30px; height: 30px; stroke-width: 1.5; }
.edition { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.edition > span:first-child { color: var(--amber); font: 12px var(--mono); }
.edition > span + span { border-left: 1px solid var(--line); padding-left: 12px; }
.top-actions { display: flex; align-items: center; gap: 22px; margin-left: auto; }
.presence { color: var(--muted); font-size: 12px; white-space: nowrap; }
.presence::before { display: inline-block; width: 5px; height: 5px; margin: 0 8px 2px 0; background: var(--subtle); border-radius: 50%; content: ""; }
#app[data-connection="online"] .presence::before { background: var(--teal); }
#app[data-connection="offline"] .presence::before, #app[data-connection="error"] .presence::before { background: var(--amber); }
.top-actions button { height: 36px; padding: 0; border: 0; background: transparent; font-size: 13px; }
.top-actions button:hover { color: var(--teal); }
.project-links { display: inline-flex; align-items: center; gap: 5px; }
.project-link { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 42px; height: 32px; padding: 0 9px; border: 1px solid #ffffff21; border-radius: 6px; background: #0c1012; color: #d9e3e2; font: 11px/1 var(--mono); text-decoration: none; white-space: nowrap; transition: color .15s ease, background-color .15s ease, border-color .15s ease; }
.project-link .icon { width: 13px; height: 13px; }
.project-link > span { font-weight: 700; }
.project-link:hover { color: #eafffb; border-color: #81d5cb77; background: #81d5cb10; }
.project-link.is-pending { color: #7d8789; border-style: dashed; cursor: not-allowed; }
.project-link.is-pending small { color: #8f989a; font: 8px/1 var(--mono); text-transform: uppercase; }
.language-switch { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: #0c1012; }
.top-actions .language-switch button { min-width: 38px; height: 26px; padding: 0 8px; border-radius: 3px; color: var(--muted); font: 11px/1 var(--mono); }
.top-actions .language-switch button:hover { background: #ffffff0a; color: var(--ink); }
.top-actions .language-switch button.selected { background: #344245; color: #e5f8f4; box-shadow: inset 0 -1px var(--teal); }
.top-actions #resync { width: 36px; border: 1px solid var(--line); border-radius: 6px; }
.top-actions #resync:hover { border-color: #ffffff40; background: #ffffff09; }
.top-actions #about .icon { width: 15px; height: 15px; color: var(--muted); }

.stage { position: relative; flex: 1 0 600px; min-width: 0; min-height: 600px; overflow: hidden; isolation: isolate; background: #181c1e; }
.world { position: absolute; inset: 0; overflow: hidden; }
.world canvas { display: block; width: 100%; height: 100%; }
.grid-floor { display: none; }
.left-tools { position: absolute; z-index: 2; top: 24px; left: 24px; display: grid; gap: 8px; }
.left-tools button { flex-direction: column; gap: 5px; width: 54px; height: 58px; padding: 7px 0; border: 1px solid var(--line); border-radius: 6px; background: #1b2022ed; color: #c8d0d0; box-shadow: 0 2px 8px #0000000d; }
.left-tools .icon { width: 20px; height: 20px; }
.left-tools small { font-size: 11px; line-height: 1.2; }
.left-tools button:hover { color: var(--ink); border-color: #81d5cb66; background: #293438; }
.left-tools button:active { background: #354446; }
.mode-pill { position: absolute; z-index: 2; top: 24px; right: 24px; display: grid; gap: 4px; width: 360px; min-height: 62px; padding: 11px 15px; border: 1px solid var(--line); border-radius: 5px; background: #171c1fe8; overflow-wrap: anywhere; }
.mode-pill strong { display: flex; align-items: center; gap: 8px; color: var(--ink); font: 600 12px/1.3 var(--mono); }
.mode-pill strong::before { display: block; flex: 0 0 5px; width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }
.mode-pill span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.mode-pill[data-status="running"] strong, .mode-pill[data-status="waiting"] strong { color: var(--teal); }
.mode-pill[data-status="halted"] strong, .mode-pill[data-status="error"] strong { color: var(--error); }
.mode-pill[data-status="stale"] strong, .mode-pill[data-status="offline"] strong { color: var(--amber); }

.neural-telemetry { position: absolute; z-index: 3; top: 24px; left: 96px; width: min(460px, calc(100% - 504px)); min-width: 370px; padding: 17px; visibility: hidden; border: 1px solid #78d5ca38; border-radius: 8px; background: linear-gradient(145deg, #091418f2, #102025e8); box-shadow: 0 24px 80px #00000066, inset 0 1px #ffffff0c; opacity: 0; transform: translateY(10px) scale(.985); transform-origin: top left; pointer-events: none; transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s; }
.stage[data-camera="brain"] .neural-telemetry { visibility: visible; opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; transition-delay: 0s; }
.stage[data-camera="brain"] #brain-view { color: #e7fffa; border-color: #81d5cb88; background: #294044; box-shadow: inset 0 -2px var(--teal); }
.neural-heading { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.neural-heading small { display: block; color: #71878b; font: 10px/1.2 var(--mono); letter-spacing: .08em; }
.neural-heading h2 { margin: 5px 0 0; color: #edf5f2; font-size: 20px; line-height: 1.1; font-weight: 650; }
.neural-heading > strong { display: inline-flex; align-items: center; gap: 7px; max-width: 210px; padding: 5px 8px; border: 1px solid #ffffff1c; border-radius: 4px; color: #9daeb0; font: 10px/1.35 var(--mono); text-align: right; }
.neural-heading > strong::before { flex: 0 0 6px; width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.neural-heading > strong[data-stream-state="live"] { color: var(--teal); border-color: #81d5cb4d; background: #81d5cb0c; }
.neural-heading > strong[data-stream-state="recorded"] { color: #c3d0d1; }
.neural-heading > strong[data-stream-state="stale"], .neural-heading > strong[data-stream-state="offline"] { color: var(--amber); border-color: #e8b87740; background: #e8b8770b; }
#neural-trace { display: block; width: 100%; height: auto; margin-top: 14px; border: 1px solid #ffffff14; border-radius: 5px; background: #071015; }
.neural-stats { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 1px; margin-top: 11px; overflow: hidden; border: 1px solid #ffffff17; border-radius: 5px; background: #ffffff17; }
.neural-stats > div { min-width: 0; padding: 9px 10px; background: #0b1519e8; }
.neural-stats span { display: block; overflow: hidden; color: #768a8e; font-size: 10px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.neural-stats b { display: block; margin-top: 3px; overflow: hidden; color: #e7efec; font: 600 13px/1.25 var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.neural-telemetry > p { margin: 10px 2px 0; color: #718388; font-size: 10px; line-height: 1.45; }

.observe { position: absolute; z-index: 2; top: 102px; right: 24px; width: 360px; max-height: calc(100% - 216px); padding: 20px; overflow-x: hidden; overflow-y: auto; border: 1px solid #ffffff24; border-radius: 8px; background: linear-gradient(155deg, #1b2225f7, #111719f2); box-shadow: 0 20px 70px #0000004d; scrollbar-width: thin; scrollbar-color: #5b6568 transparent; }
.observe label { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; }
.broadcast-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.broadcast-heading label { color: var(--ink); font: 600 12px/1.4 var(--mono); text-transform: uppercase; }
.broadcast-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.recorded-badge { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 4px 7px; border: 1px solid #ed9b9155; border-radius: 4px; color: var(--error); font: 600 10px/1 var(--mono); }
.recorded-badge::before { width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }
.token-focus { margin-top: 18px; padding: 17px; border: 1px solid #ffffff1f; border-radius: 6px; background: #0e1417a6; }
.watching { margin: 0; color: var(--teal); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.observe h1 { margin: 8px 0 8px; font-size: clamp(28px, 2.4vw, 38px); font-weight: 720; letter-spacing: -.04em; line-height: 1.05; overflow-wrap: anywhere; }
.chain { margin: 0; color: var(--muted); font: 12px/1.5 var(--mono); overflow-wrap: anywhere; }
.gmgn-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 13px; color: #b6e6df; font-size: 11px; text-decoration: none; }
.gmgn-link[hidden] { display: none; }
.gmgn-link .icon { width: 13px; height: 13px; }
.gmgn-link:hover { color: var(--teal); }
.decision-card { display: grid; gap: 6px; margin-top: 12px; padding: 16px 17px; border: 1px solid #ffffff1f; border-radius: 6px; background: #ffffff08; }
.decision-card > span { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.decision-card > strong { color: var(--ink); font: 700 28px/1 var(--mono); letter-spacing: -.04em; }
.decision-card > small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.observe[data-action="buy"] .decision-card { border-color: #81d5cb66; background: #81d5cb0b; }
.observe[data-action="buy"] .decision-card > strong { color: var(--teal); }
.observe[data-action="sell"] .decision-card { border-color: #e8b87766; background: #e8b8770b; }
.observe[data-action="sell"] .decision-card > strong { color: var(--amber); }
.observe[data-action="wait"] .decision-card > strong { color: #d6dddc; }
.observe[data-action="blocked"] .decision-card > strong { color: var(--error); }
.quote-preview-card { margin-top: 12px; padding: 15px 16px; border: 1px solid #ffffff20; border-radius: 6px; background: linear-gradient(150deg, #0b1518d9, #11191cde); }
.quote-preview-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
.quote-preview-heading > span { text-transform: uppercase; }
.quote-preview-heading > b { max-width: 150px; color: var(--muted); font: 600 10px/1.4 var(--mono); text-align: right; overflow-wrap: anywhere; }
.quote-preview-card[data-quote-state="valid"] { border-color: #81d5cb66; box-shadow: inset 0 1px #81d5cb12; }
.quote-preview-card[data-quote-state="valid"] .quote-preview-heading > b { color: var(--teal); }
.quote-preview-card[data-quote-state="expired"] { border-color: #e8b8774d; }
.quote-preview-card[data-quote-state="expired"] .quote-preview-heading > b { color: var(--amber); }
.quote-preview-card[data-quote-state="blocked"] { border-color: #ed9b914d; }
.quote-preview-card[data-quote-state="blocked"] .quote-preview-heading > b { color: var(--error); }
.quote-preview-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 12px 0 0; overflow: hidden; border: 1px solid #ffffff17; border-radius: 5px; background: #ffffff17; }
.quote-preview-values > div { min-width: 0; padding: 9px 10px; background: #0c1417; }
.quote-preview-values dt { color: var(--subtle); font-size: 9px; line-height: 1.3; text-transform: uppercase; }
.quote-preview-values dd { min-width: 0; margin: 4px 0 0; color: #e2ebe8; font: 600 11px/1.35 var(--mono); overflow-wrap: anywhere; }
.quote-blockers { display: grid; gap: 4px; margin: 11px 0 0; color: var(--subtle); font-size: 9px; line-height: 1.4; }
.quote-blockers > span { text-transform: uppercase; }
.quote-blockers > strong { color: #b8c4c4; font: 500 10px/1.45 var(--mono); overflow-wrap: anywhere; }
.quote-only-badge { margin: 11px 0 0; padding-top: 10px; border-top: 1px solid #ffffff17; color: var(--amber); font: 600 10px/1.2 var(--mono); letter-spacing: .035em; }
.thinking { display: grid; gap: 8px; margin-top: 16px; padding: 15px 0 16px; border-bottom: 1px solid var(--line); font-size: 12px; line-height: 1.5; }
.thinking b { color: var(--ink); font-size: 13px; font-weight: 600; }
.thinking span { color: var(--muted); }
.thinking b, .thinking span { overflow-wrap: anywhere; }
.thinking span strong { color: #dce3e1; font: 500 12px var(--mono); }
.thinking progress { appearance: none; display: block; width: 100%; height: 3px; margin-top: 3px; border: 0; border-radius: 2px; overflow: hidden; background: #374043; color: var(--teal); }
.thinking progress::-webkit-progress-bar { background: #374043; }
.thinking progress::-webkit-progress-value { background: var(--teal); }
.thinking progress::-moz-progress-bar { background: var(--teal); }
.thinking progress[data-known="false"] { visibility: hidden; }
.state-details { display: grid; gap: 13px; margin: 17px 0 0; font-size: 12px; line-height: 1.5; }
.state-details > div { display: grid; grid-template-columns: minmax(79px, .85fr) minmax(0, 1.15fr); gap: 12px; }
.state-details dt { color: var(--muted); overflow-wrap: anywhere; }
.state-details dd { min-width: 0; margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.state-details a { color: #b6e6df; text-decoration: none; }
.state-details a:hover { color: var(--teal); text-decoration: underline; text-underline-offset: 3px; }
.waiting { margin: 17px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--amber); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.trade-proof { margin-top: 16px; padding: 16px 17px; border: 1px solid #ffffff20; border-radius: 6px; background: #0d1316a6; }
.trade-proof-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
.trade-proof-heading b { max-width: 145px; color: var(--muted); font: 500 10px/1.4 var(--mono); text-align: right; overflow-wrap: anywhere; }
.trade-proof[data-order-state="CONFIRMED"] .trade-proof-heading b { color: var(--teal); }
.trade-proof[data-order-state="FAILED"] .trade-proof-heading b { color: var(--error); }
.trade-proof > strong { display: block; margin-top: 13px; color: var(--ink); font: 700 24px/1 var(--mono); }
.trade-proof > p { margin: 8px 0 0; color: #c9d2d2; font: 11px/1.5 var(--mono); overflow-wrap: anywhere; }
.trade-proof > time { display: block; margin-top: 6px; color: var(--subtle); font: 10px/1.5 var(--mono); }
.proof-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.proof-actions button, .proof-actions a { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border: 1px solid #ffffff24; border-radius: 4px; background: #ffffff08; color: #cce5e1; font-size: 11px; text-decoration: none; }
.proof-actions button[hidden], .proof-actions a[hidden] { display: none; }
.proof-actions .icon { width: 13px; height: 13px; }
.proof-actions button:hover, .proof-actions a:hover { border-color: #81d5cb55; background: #81d5cb0b; color: var(--teal); }
.accounting-proof { margin-top: 12px; padding: 15px 16px; border: 1px solid #ffffff20; border-radius: 6px; background: linear-gradient(145deg, #10191be8, #0d1316e8); }
.accounting-proof-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.accounting-proof-heading b { max-width: 150px; color: var(--muted); font: 600 10px/1.4 var(--mono); text-align: right; overflow-wrap: anywhere; }
.accounting-proof > strong { display: block; margin-top: 11px; color: #dfe9e6; font: 700 21px/1.2 var(--mono); overflow-wrap: anywhere; }
.accounting-proof > p { margin: 7px 0 0; color: #9fadaf; font: 10px/1.5 var(--mono); overflow-wrap: anywhere; }
.accounting-proof > button { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; margin-top: 11px; padding: 0 9px; border: 1px solid #ffffff24; border-radius: 4px; background: #ffffff08; color: #cce5e1; font-size: 11px; }
.accounting-proof > button .icon { width: 13px; height: 13px; }
.accounting-proof > button:hover { border-color: #81d5cb55; background: #81d5cb0b; color: var(--teal); }
.accounting-proof[data-accounting-state="positive"] { border-color: #67c8be55; }
.accounting-proof[data-accounting-state="positive"] > strong, .accounting-proof[data-accounting-state="positive"] .accounting-proof-heading b { color: var(--teal); }
.accounting-proof[data-accounting-state="negative"] { border-color: #b8797055; }
.accounting-proof[data-accounting-state="negative"] > strong, .accounting-proof[data-accounting-state="negative"] .accounting-proof-heading b { color: #e8a59b; }
.accounting-proof[data-accounting-state="incomplete"] .accounting-proof-heading b { color: var(--amber); }
.technical-state { margin-top: 15px; }
.technical-state summary { color: var(--muted); font-size: 11px; cursor: pointer; }
.technical-state[open] summary { color: var(--ink); }

.live-log { position: absolute; z-index: 2; left: 24px; bottom: 118px; width: 326px; max-height: 170px; padding: 12px 13px; overflow: hidden; border: 1px solid #dce9e321; border-radius: 6px; background: #12191df5; color: #d5ddde; box-shadow: 0 6px 24px #00000024; pointer-events: none; }
.log-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding-bottom: 9px; margin-bottom: 9px; border-bottom: 1px solid #ffffff24; color: #e2e6e3; font-size: 12px; line-height: 1.4; }
.log-heading b { font-weight: 500; }
.log-heading span { max-width: 115px; margin-left: auto; color: #aebfc2; font-size: 11px; text-align: right; overflow-wrap: anywhere; }
.log-open { flex: 0 0 22px; width: 22px; height: 22px; margin: -2px -4px 0 -6px; padding: 0; border: 0; background: transparent; color: #c4d4d6; pointer-events: auto; }
.log-open .icon { width: 15px; height: 15px; }
.log-open:hover { color: var(--teal); }
.log-line { display: grid; grid-template-columns: 61px minmax(0, 1fr); gap: 10px; margin: 5px 0; font: 12px/1.5 var(--mono); }
.log-line time { color: #a4b1b3; }
.log-line span { min-width: 0; overflow-wrap: anywhere; }
.live-log .log-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state, .snapshot-note { margin: 10px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.snapshot-note { color: var(--amber); }
.camera { position: absolute; z-index: 3; bottom: 58px; left: 50%; display: flex; gap: 2px; max-width: calc(100% - 48px); padding: 4px; border: 1px solid #ffffff21; border-radius: 6px; background: #171c1ff2; transform: translateX(-50%); }
.camera button { height: 34px; min-width: 93px; padding: 0 13px; border: 0; border-radius: 3px; background: transparent; color: #a9b3b4; font-size: 12px; white-space: nowrap; }
.camera button:hover { color: var(--ink); background: #ffffff0b; }
.camera button.selected { color: var(--ink); background: #374346; box-shadow: inset 0 -2px var(--teal); }
.camera-number { color: var(--subtle); font: 11px var(--mono); }
.selected .camera-number { color: var(--teal); }
.stage-bottom { position: absolute; z-index: 2; bottom: 0; left: 24px; right: 24px; display: flex; align-items: center; gap: 16px; height: 48px; border-top: 1px solid var(--line); color: #b0babb; font-size: 12px; }
.stage-bottom b { margin-left: 9px; color: var(--ink); font: 500 12px var(--mono); }
.stage-bottom small { margin: 0 auto; color: #8b9698; font-size: 12px; }
.stage-bottom button { flex: 0 0 32px; width: 32px; height: 32px; padding: 0; margin-left: auto; border: 0; border-radius: 4px; background: transparent; color: #c6cfcf; }
.stage-bottom button:hover { color: var(--ink); background: #ffffff10; }
.chart-switch { display: flex; align-items: center; gap: 3px; margin: 0 auto; padding: 3px; border: 1px solid #ffffff1c; border-radius: 5px; background: #111719d9; }
.chart-switch small { margin: 0 7px; color: #829093; font: 10px var(--mono); text-transform: uppercase; }
.stage-bottom .chart-switch button { flex: 0 0 auto; width: auto; height: 26px; margin: 0; padding: 0 9px; color: #8f9b9d; font: 10px var(--mono); white-space: nowrap; }
.stage-bottom .chart-switch button:hover { color: var(--ink); }
.stage-bottom .chart-switch button.selected { background: #354346; color: #dff5f1; box-shadow: inset 0 -1px var(--teal); }

.tape { display: flex; flex: 0 0 auto; align-items: center; gap: 20px; min-height: 48px; padding: 10px 24px; border-block: 1px solid var(--line); background: #1a1e20; font-size: 12px; }
.tape-label { display: flex; flex: 0 0 auto; align-items: center; gap: 12px; padding-right: 20px; border-right: 1px solid var(--line); font-weight: 600; }
.tape-label small { color: var(--amber); font: 11px var(--mono); }
.run-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; min-width: 0; }
.run-summary > span { min-width: 0; color: var(--muted); overflow-wrap: anywhere; }
.run-summary b { margin-left: 8px; color: #d9dedd; font: 12px var(--mono); }
#snapshot-context { margin-left: auto; color: var(--muted); white-space: nowrap; }
.dock { display: flex; flex: 0 0 auto; align-items: center; gap: 24px; min-height: 78px; padding: 14px 24px; background: #121517; }
.dock > div { display: grid; gap: 4px; min-width: 0; max-width: 55%; }
#dock-status { color: var(--ink); font: 500 12px var(--mono); }
#dock-context { overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.dock nav { display: flex; flex: 0 0 auto; gap: 18px; margin-left: auto; }
.dock nav button { height: 36px; padding: 0 6px; border: 0; border-radius: 4px; background: transparent; color: #c0c9cb; font-size: 13px; }
.dock nav button .icon { width: 16px; height: 16px; color: #8e9c9e; }
.dock nav button:hover { background: #ffffff09; color: var(--ink); }
.dock nav button:hover .icon { color: var(--teal); }

dialog { width: 560px; max-width: calc(100% - 32px); max-height: calc(100svh - 40px); padding: 26px; overflow: auto; border: 1px solid #ffffff29; border-radius: 8px; background: #1b2023; color: var(--ink); box-shadow: 0 24px 90px #00000066; }
dialog::backdrop { background: #07090bc7; }
dialog > small { color: var(--teal); font: 12px var(--mono); }
dialog h2 { margin: 10px 36px 18px 0; font-size: 23px; font-weight: 600; line-height: 1.3; }
dialog p { color: #c0c8cb; font-size: 14px; line-height: 1.65; }
dialog .state-details { gap: 14px; font-size: 13px; }
dialog .state-details > div { grid-template-columns: minmax(104px, .8fr) minmax(0, 1.2fr); gap: 20px; }
dialog .close { float: right; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: transparent; color: #c9d1d2; }
dialog .close:hover { color: var(--ink); background: #ffffff0c; }
.detail-events { margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--line); }
.detail-events .log-line { margin: 10px 0; color: #d0d8d8; }
.detail-events time { color: var(--muted); }

.orders-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; min-height: 18px; padding: 0 4px; border: 1px solid #ffffff26; border-radius: 4px; color: var(--teal); font: 11px var(--mono); }
.orders-count[hidden] { display: none; }
#detail-dialog[data-panel="receipts"] { width: 620px; }
#detail-dialog[data-panel="accounting"] { width: 760px; }
.order-source { margin-bottom: 22px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.order-source-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #d3dcdd; font-size: 13px; }
.source-tag { padding: 3px 7px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font: 11px var(--mono); }
.source-tag[data-status="available"] { color: var(--teal); border-color: #60cdc533; background: #60cdc509; }
.source-tag[data-status="unavailable"] { color: var(--amber); border-color: #d6a65644; }
dialog p.source-time { margin: 8px 0 0; color: var(--muted); font: 11px/1.6 var(--mono); overflow-wrap: anywhere; }
dialog p.detail-note { margin: 18px 0; color: #aab9be; font-size: 12px; line-height: 1.65; }
dialog .detail-section-title { margin: 25px 0 17px; padding-top: 21px; border-top: 1px solid var(--line); color: #e2e8e7; font-size: 14px; font-weight: 500; }
dialog .order-source .snapshot-note, dialog .order-source .empty-state { margin: 10px 0 0; font-size: 12px; }
.receipt-list { display: grid; gap: 10px; margin-top: 22px; }
.receipt-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; width: 100%; min-width: 0; padding: 15px; border: 1px solid #ffffff20; border-radius: 6px; background: #12191c; color: var(--ink); text-align: left; }
.receipt-row:hover, .receipt-row:focus-visible { border-color: #67c8be80; background: #192529; }
.receipt-row:disabled { cursor: default; opacity: .7; }
.receipt-row-heading { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; }
.receipt-row-heading strong { font: 500 13px var(--mono); }
.receipt-pair { grid-column: 1 / -1; color: #c0cdce; font: 12px/1.6 var(--mono); overflow-wrap: anywhere; }
.receipt-row time { min-width: 0; color: var(--muted); font: 11px/1.5 var(--mono); overflow-wrap: anywhere; }
.receipt-open { align-self: end; color: #b4d7d1; font-size: 11px; white-space: nowrap; }
.order-state { display: inline-block; width: fit-content; margin: 0; padding: 4px 7px; border: 1px solid #ffffff20; border-radius: 4px; color: #c4cfd0; font: 11px/1.4 var(--mono); }
dialog > div > p.order-state { margin: 0 0 20px; font: 11px/1.4 var(--mono); }
.order-state[data-order-state="CONFIRMED"] { color: var(--teal); border-color: #67c8be55; background: #67c8be08; }
.order-state[data-order-state="SUBMISSION_UNKNOWN"], .order-state[data-order-state="PENDING"], .order-state[data-order-state="DISPATCHING"] { color: var(--amber); border-color: #d6a65644; }
.order-state[data-order-state="FAILED"] { color: #e8a59b; border-color: #b879703d; }
.receipt-back { margin: 0 0 20px; padding: 0; border: 0; background: transparent; color: #afd8d1; font-size: 12px; line-height: 2; }
.receipt-back:hover { color: var(--teal); }
.receipt-transaction { display: grid; gap: 9px; margin-top: 20px; font: 12px/1.6 var(--mono); }
.detail-label { color: var(--muted); font: 13px sans-serif; }
.transaction-link { color: #9ed9d0; text-decoration-color: #9ed9d04d; text-underline-offset: 3px; overflow-wrap: anywhere; }
.transaction-link:hover { color: #c6f3eb; }
.receipt-transaction small { color: var(--muted); font: 11px/1.5 var(--mono); }
.position-list { display: grid; gap: 0; }
.position-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(70px, .5fr); gap: 16px; padding: 15px 0; border-bottom: 1px solid var(--line); font: 12px/1.6 var(--mono); }
.position-token { min-width: 0; color: #bccbce; overflow-wrap: anywhere; }
.position-amount { min-width: 0; color: #e6eeea; text-align: right; overflow-wrap: anywhere; }
.accounting-token-list { display: grid; gap: 12px; margin-top: 20px; }
.accounting-token { padding: 16px; border: 1px solid #ffffff20; border-radius: 6px; background: #12191c; }
.accounting-token-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.accounting-token-heading a { min-width: 0; color: #bfe4de; font: 600 12px/1.5 var(--mono); text-decoration: none; overflow-wrap: anywhere; }
.accounting-token-heading a:hover { color: var(--teal); text-decoration: underline; text-underline-offset: 3px; }
.accounting-token-heading span { flex: 0 0 auto; color: var(--muted); font: 10px/1.4 var(--mono); }
.accounting-token .state-details { margin-top: 14px; }
.accounting-token > p { margin: 13px 0 0; color: #9fadaf; font: 10px/1.5 var(--mono); overflow-wrap: anywhere; }

@media (min-width: 1101px) {
  .stage[data-camera="character"] .live-log { left: 96px; top: 24px; bottom: auto; }
}

@media (max-width: 1100px) and (min-width: 761px) {
  .edition { display: none; }
  .top-actions { gap: 10px; }
  .mode-pill, .observe { right: 18px; width: 300px; }
  .neural-telemetry { left: 84px; width: min(410px, calc(100% - 420px)); min-width: 330px; }
  .live-log { top: 18px; left: 92px; bottom: auto; width: 286px; }
  .stage[data-camera="character"] .live-log { width: 244px; }
  .camera { left: calc(50% - 100px); }
  .camera button { min-width: 82px; padding: 0 9px; }
  .stage-bottom small { display: none; }
  .chart-switch { margin: 0 auto; }
  .chart-switch small { display: none; }
  .stage-bottom .chart-switch button { height: 27px; padding-inline: 8px; }
  .tape { gap: 16px; }
  .tape-label { padding-right: 16px; }
  #snapshot-context { display: none; }
}

@media (min-width: 761px) and (max-height: 820px) {
  #app { min-height: 650px; }
  .topbar { height: 56px; flex-basis: 56px; }
  .stage { flex: 1 1 auto; min-height: 460px; }
  .left-tools { top: 18px; gap: 6px; }
  .left-tools button { height: 48px; gap: 3px; }
  .left-tools small { font-size: 10px; }
  .mode-pill { top: 18px; }
  .neural-telemetry { top: 18px; width: min(420px, calc(100% - 504px)); padding: 13px; }
  .neural-heading h2 { font-size: 18px; }
  #neural-trace { margin-top: 10px; max-height: 118px; }
  .neural-stats { margin-top: 8px; }
  .neural-telemetry > p { margin-top: 7px; }
  .observe { top: 96px; max-height: calc(100% - 194px); }
  .camera { bottom: 54px; }
  .tape { min-height: 44px; padding-block: 8px; }
  .dock { min-height: 64px; padding-block: 10px; }
}

@media (max-width: 760px) {
  #app { height: auto; min-height: 100svh; overflow: visible; }
  #app:fullscreen { height: 100dvh; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
  .topbar { gap: 10px; padding: 0 16px; }
  .brand { gap: 8px; font-size: 23px; }
  .fly-mark .icon { width: 25px; height: 25px; }
  .edition, .presence { display: none; }
  .top-actions { gap: 6px; }
  .project-links { gap: 4px; }
  .project-link { min-width: 32px; width: 32px; padding: 0; }
  .project-link.is-pending small { display: none; }
  .top-actions .language-switch { order: -1; }
  .top-actions .language-switch button { min-width: 34px; padding-inline: 6px; }
  .top-actions #resync { width: 32px; height: 32px; }
  .top-actions #about { display: none; }
  .stage { display: flex; flex: none; flex-direction: column; min-height: 0; padding-top: 440px; overflow: visible; }
  .world { inset: 0 0 auto; height: 440px; }
  .left-tools { top: 77px; left: 12px; display: flex; gap: 6px; }
  .left-tools button { width: 38px; height: 36px; gap: 4px; padding: 0; }
  .left-tools .icon { width: 19px; height: 19px; }
  .left-tools small { display: none; }
  .mode-pill { top: 14px; left: 12px; right: 12px; width: auto; max-width: none; min-height: 51px; padding: 9px 12px; }
  .mode-pill span { font-size: 12px; }
  .neural-telemetry { top: 74px; left: 56px; right: 12px; width: auto; min-width: 0; max-height: 292px; padding: 12px; }
  .neural-heading { gap: 8px; }
  .neural-heading h2 { font-size: 17px; }
  .neural-heading > strong { max-width: 160px; padding: 4px 6px; font-size: 9px; }
  #neural-trace { margin-top: 10px; max-height: 112px; }
  .neural-stats { margin-top: 8px; }
  .neural-stats > div { padding: 7px; }
  .neural-stats span { font-size: 9px; }
  .neural-stats b { font-size: 11px; }
  .neural-telemetry > p { margin-top: 7px; font-size: 9px; line-height: 1.35; }
  .camera { top: 382px; bottom: auto; width: calc(100% - 24px); max-width: 420px; gap: 0; }
  .camera button { flex: 1; min-width: 0; height: 36px; padding: 0 5px; gap: 5px; font-size: 12px; }
  .camera-number { display: none; }
  .observe { position: relative; top: auto; right: auto; width: auto; max-height: none; margin: 0; padding: 24px 20px; overflow: visible; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: #1a1f22; }
  .observe label { font-size: 12px; }
  .token-focus { margin-top: 18px; }
  .watching { font-size: 13px; }
  .observe h1 { font-size: 34px; }
  .thinking { margin-top: 18px; font-size: 13px; }
  .quote-preview-card { padding: 16px; }
  .quote-preview-values dt { font-size: 10px; }
  .quote-preview-values dd { font-size: 12px; }
  .state-details { gap: 14px; font-size: 13px; }
  .state-details > div { grid-template-columns: minmax(110px, .85fr) minmax(0, 1.15fr); gap: 20px; }
  .waiting { font-size: 13px; }
  .live-log { position: relative; left: auto; bottom: auto; width: auto; max-height: 220px; padding: 20px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: #161b1e; box-shadow: none; }
  .log-heading { margin-bottom: 12px; font-size: 13px; }
  .log-line { margin: 7px 0; }
  .stage-bottom { position: relative; bottom: auto; left: auto; right: auto; height: auto; min-height: 48px; padding: 10px 16px; gap: 10px; background: #161b1e; }
  .stage-bottom > span { min-width: 0; }
  .stage-bottom small { display: none; }
  .stage-bottom b { margin-left: 5px; }
  .tape { align-items: start; flex-wrap: wrap; gap: 12px; padding: 16px; }
  .tape-label { width: 100%; padding: 0; border: 0; }
  .run-summary { display: grid; width: 100%; gap: 8px; }
  .run-summary > span { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; }
  .run-summary b { margin: 0; }
  #snapshot-context { width: 100%; margin: 0; white-space: normal; }
  .dock { min-height: 0; flex-wrap: wrap; gap: 14px; padding: 17px 16px 18px; }
  .dock > div { max-width: 100%; width: 100%; }
  .dock nav { justify-content: space-between; width: 100%; gap: 8px; margin-left: 0; padding-top: 10px; border-top: 1px solid var(--line); }
  .dock nav button { padding: 0; font-size: 12px; }
  dialog { max-width: calc(100% - 24px); padding: 20px; }
  dialog .state-details { font-size: 12px; }
  dialog .state-details > div { grid-template-columns: minmax(86px, .8fr) minmax(0, 1.2fr); gap: 15px; }
  .receipt-row { gap: 9px 8px; padding: 12px; }
  .receipt-row-heading { align-items: start; gap: 8px; }
  .receipt-row-heading .order-state { max-width: 180px; font-size: 10px; }
  .receipt-pair { font-size: 11px; }
  .position-row { grid-template-columns: minmax(0, 1fr); gap: 5px; }
  .position-amount { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
  .neural-telemetry { transition: none; }
}
