: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-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(230px, .76fr) minmax(390px, 1.65fr) minmax(300px, .98fr); gap: 14px; min-height: 660px; margin-top: 14px; }
.left-stack, .right-stack { display: flex; min-width: 0; flex-direction: column; gap: 14px; }
.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 { margin: 0; color: #c9e4eb; font-size: 11px; line-height: 1.6; }
.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; }
.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; }
.empty-device { display: flex; align-items: center; gap: 9px; padding: 15px 7px; color: #637e8c; font-size: 10px; }
.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; justify-content: flex-end; gap: 9px; margin-top: 20px; }

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: .75fr 1.25fr; }
  .right-panel { min-height: 390px; }
}
@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; }
  .todo-panel { min-height: 360px; }
  .right-panel { min-height: 480px; }
  .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; }
}
