:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --page: #101714;
  --panel: #18221e;
  --panel-raised: #202c27;
  --line: #35443d;
  --text: #f3f7f4;
  --muted: #a7b5ad;
  --green: #56d69b;
  --green-dark: #143d2e;
  --red: #ff8178;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; margin: 0; }
body { background: var(--page); color: var(--text); font-size: 15px; line-height: 1.5; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible, canvas:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
a { color: inherit; text-decoration: none; }
svg { display: block; width: 20px; height: 20px; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; }
.loading-shell { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; color: var(--muted); }
.brand-mark { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 3px; border: 1px solid #43775f; border-radius: 12px; background: #173b2d; }
.brand-mark span { width: 5px; border-radius: 4px; background: var(--green); }
.brand-mark span:nth-child(1) { height: 13px; }
.brand-mark span:nth-child(2) { height: 20px; }
.brand-mark span:nth-child(3) { height: 16px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 18px; font-weight: 750; letter-spacing: -.045em; }
.brand-accent { color: var(--green); }

.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, .92fr) minmax(420px, 1.08fr); }
.login-aside { min-height: 100vh; padding: 36px clamp(28px, 6vw, 88px); display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; border-right: 1px solid var(--line); background: radial-gradient(ellipse at 12% 82%, #173629 0, transparent 50%), #141d19; }
.login-story { max-width: 560px; margin: auto 0; padding: 72px 0; }
.eyebrow { margin: 0 0 17px; color: var(--green); font-size: 11px; font-weight: 750; letter-spacing: .13em; }
.status-dot, .target-led, .online-led { display: inline-block; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgb(86 214 155 / 12%); }
.login-story .eyebrow { display: flex; align-items: center; gap: 10px; }
.login-story h1 { max-width: 540px; margin: 0; font-size: clamp(40px, 5vw, 68px); font-weight: 650; line-height: 1.08; letter-spacing: -.055em; }
.login-story h1 span { color: #a7b9ae; }
.login-copy { max-width: 420px; margin: 24px 0 0; color: var(--muted); font-size: 17px; line-height: 1.7; }
.login-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.login-foot > span:first-child { color: var(--green); font-weight: 700; letter-spacing: .08em; }
.foot-line { width: 34px; height: 1px; margin: 0 3px; background: #62736a; }
.login-main { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 30px 24px; }
.login-card { width: min(100%, 420px); padding: clamp(28px, 4vw, 42px); border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 24px 70px rgb(0 0 0 / 18%); }
.card-icon { width: 44px; height: 44px; display: grid; place-items: center; margin-bottom: 29px; border: 1px solid #397153; border-radius: 12px; background: var(--green-dark); color: var(--green); }
.login-card .eyebrow { margin-bottom: 6px; }
.login-card h2 { margin: 0; font-size: 28px; font-weight: 650; letter-spacing: -.04em; }
.muted { margin: 9px 0 25px; color: var(--muted); }
.login-card label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 650; }
.input-wrap { display: flex; min-height: 48px; border: 1px solid #53635b; border-radius: 9px; background: #111915; }
.input-wrap:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgb(86 214 155 / 13%); }
.input-wrap input { min-width: 0; flex: 1; padding: 0 14px; border: 0; outline: 0; background: transparent; color: var(--text); }
.input-wrap input:focus-visible { outline: 0; }
.input-wrap input::placeholder { color: #819088; }
.form-error { min-height: 21px; margin: 8px 0 5px; color: var(--red); font-size: 13px; }
.primary-button { width: 100%; min-height: 49px; display: flex; align-items: center; justify-content: space-between; padding: 0 15px 0 18px; border: 1px solid #69e0a9; border-radius: 9px; background: var(--green); color: #10271d; font-weight: 750; cursor: pointer; transition: background 160ms ease, opacity 160ms ease; }
.primary-button:hover { background: #78e9b5; }
.primary-button:disabled { opacity: .64; cursor: wait; }
.button-arrow { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; background: rgb(16 39 29 / 10%); }
.button-arrow svg { width: 17px; height: 17px; }
.login-note { margin: 15px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.main-foot { margin: 24px 0 0; color: #829188; font-size: 12px; }
.main-foot span { padding: 0 5px; color: var(--green); }

.operator-app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 27px; border-bottom: 1px solid var(--line); background: #141d19; }
.topbar-right { display: flex; align-items: center; gap: 15px; }
.server-pill { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.topbar-divider, .toolbar-separator, .statusbar-divider { width: 1px; height: 22px; background: var(--line); }
.user-name { font-size: 13px; font-weight: 650; }
.avatar { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid #477159; border-radius: 50%; background: #1d3b2b; color: var(--green); font-size: 13px; font-weight: 700; }
.icon-button, .toolbar-button { display: grid; place-items: center; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #bdc9c1; cursor: pointer; }
.icon-button { width: 38px; height: 38px; }
.icon-button:hover, .toolbar-button:hover { border-color: #506258; background: #2a3831; color: white; }
.icon-button svg { width: 19px; height: 19px; }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.rail { min-height: 0; display: flex; flex-direction: column; gap: 25px; padding: 25px 18px 17px; border-right: 1px solid var(--line); background: #141d19; }
.rail-label { margin: 0; color: #87958d; font-size: 10px; font-weight: 750; letter-spacing: .13em; }
.assignment-card { padding: 17px; border: 1px solid #3e5a49; border-radius: 12px; background: linear-gradient(145deg, #20362b, #19231d 78%); }
.assignment-top { display: flex; align-items: center; justify-content: space-between; }
.assignment-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 9px; background: #173e2d; color: var(--green); }
.assignment-icon svg { width: 19px; height: 19px; }
.assignment-state { display: inline-flex; align-items: center; gap: 8px; color: #b8d8c5; font-size: 9px; font-weight: 750; letter-spacing: .08em; }
.assignment-state .status-dot { width: 6px; height: 6px; box-shadow: none; }
.assignment-label { margin: 21px 0 3px; color: #9bad9f; font-size: 10px; font-weight: 700; letter-spacing: .1em; }
.assignment-card h1 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: -.025em; }
.assignment-subtitle { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.rail-section { display: grid; gap: 15px; }
.state-row { display: flex; align-items: center; gap: 11px; }
.state-icon { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid #3b4a42; border-radius: 9px; color: #bcc9c1; }
.state-icon svg { width: 17px; height: 17px; }
.state-row strong, .state-row small { display: block; }
.state-row strong { font-size: 12px; font-weight: 650; }
.state-row small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.status-dot.is-offline { background: #8a968f; box-shadow: none; }

.stage-area { min-width: 0; display: flex; flex-direction: column; gap: 17px; padding: clamp(20px, 3vw, 36px); }
.stage-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.stage-heading .eyebrow { margin-bottom: 5px; }
.stage-heading h2 { margin: 0; font-size: clamp(19px, 2vw, 24px); font-weight: 650; letter-spacing: -.035em; }
.heading-divider { padding: 0 4px; color: #66756c; font-weight: 400; }
.heading-muted { color: var(--muted); font-size: .82em; font-weight: 500; }
.target-label { max-width: 45%; display: flex; align-items: center; gap: 9px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; color: #d0d9d3; font-size: 12px; overflow-wrap: anywhere; }
.target-led { width: 7px; height: 7px; box-shadow: none; }
.setup-banner { padding: 12px 14px; border: 1px solid #695e38; border-radius: 9px; background: #2a271b; color: #e7dcb9; font-size: 13px; }
.setup-banner code { color: #fff0bc; }
.browser-panel { min-width: 0; flex: 1; display: flex; flex-direction: column; overflow: hidden; border: 1px solid #46564d; border-radius: 12px; background: #202924; box-shadow: 0 18px 50px rgb(0 0 0 / 18%); }
.browser-toolbar { min-height: 51px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid #3a4840; background: #1a221e; }
.window-dots { display: flex; gap: 5px; margin: 0 5px 0 2px; }
.window-dots span { width: 8px; height: 8px; border-radius: 50%; background: #68766d; }
.window-dots span:first-child { background: #dd8178; }
.window-dots span:nth-child(2) { background: #d6b76c; }
.window-dots span:nth-child(3) { background: #73c994; }
.toolbar-separator { height: 18px; margin: 0 4px; }
.toolbar-button { width: 31px; height: 31px; }
.toolbar-button svg { width: 17px; height: 17px; }
.address-display { min-width: 0; flex: 1; display: flex; align-items: center; gap: 9px; padding: 7px 11px; border: 1px solid #35443c; border-radius: 7px; background: #111815; color: #d8e0da; font-size: 12px; }
.address-lock { color: var(--green); }
.address-lock svg { width: 14px; height: 14px; }
#address-text { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.address-status { color: #9bb2a3; font-size: 9px; font-weight: 700; letter-spacing: .08em; white-space: nowrap; }
.browser-viewport { position: relative; min-height: 300px; flex: 1; overflow: hidden; background: #f6f7f5; }
#remote-canvas { width: 100%; height: 100%; min-height: 300px; display: block; object-fit: contain; cursor: default; touch-action: none; }
#keyboard-capture { position: absolute; width: 1px; height: 1px; left: 0; bottom: 0; padding: 0; border: 0; opacity: 0; resize: none; pointer-events: none; }
.remote-select-popup { position: absolute; z-index: 5; width: min(360px, calc(100% - 16px)); max-height: min(440px, calc(100% - 16px)); display: flex; flex-direction: column; gap: 8px; padding: 10px; overflow: hidden; border: 1px solid #cbd5ce; border-radius: 10px; background: #fff; color: #1c2821; box-shadow: 0 14px 42px rgb(0 0 0 / 28%); }
.remote-select-title { margin: 1px 3px 3px; font-size: 13px; font-weight: 700; }
.remote-select-options { display: grid; gap: 3px; min-height: 0; overflow: auto; }
.remote-select-option { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 10px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.remote-select-option:hover, .remote-select-option:focus-visible, .remote-select-option.is-selected { border-color: #a5d4b8; background: #e9f6ee; outline: none; }
.remote-select-option:disabled { color: #9aa59e; cursor: not-allowed; }
.remote-select-confirm { min-height: 36px; padding: 6px 12px; border: 1px solid #247d50; border-radius: 7px; background: #257d50; color: white; font-weight: 650; cursor: pointer; }
.stream-placeholder { position: absolute; z-index: 2; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #f6f7f5; color: #26332c; text-align: center; }
.stream-placeholder p { margin: 14px 0 3px; font-size: 15px; font-weight: 700; }
.stream-placeholder small { color: #647168; font-size: 12px; }
.stream-spinner { width: 27px; height: 27px; border: 2px solid #d3ddd6; border-top-color: #23784d; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.browser-statusbar { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 13px; border-top: 1px solid #3a4840; color: #aebbb3; font-size: 10px; }
.browser-statusbar > span, .statusbar-right { display: inline-flex; align-items: center; gap: 8px; }
.statusbar-right { gap: 11px; }
.audio-toggle { min-height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid #476153; border-radius: 7px; background: #1d2c24; color: #d9e8de; font-size: 10px; cursor: pointer; }
.audio-toggle:hover, .audio-toggle[aria-pressed="true"] { border-color: #56d69b; background: #1a3b2c; color: #78e9b5; }
.audio-toggle svg { width: 15px; height: 15px; }
.remote-audio { width: 132px; height: 30px; }
.statusbar-right .statusbar-divider { height: 13px; }
.browser-statusbar .online-led { width: 6px; height: 6px; }
.stage-foot { display: flex; justify-content: flex-end; gap: 12px; color: #9faca4; font-size: 11px; }
.stage-foot > span { display: inline-flex; align-items: center; gap: 7px; }
.stage-foot svg { width: 14px; height: 14px; color: var(--green); }
kbd { padding: 2px 6px; border: 1px solid #536259; border-radius: 4px; background: #222e27; color: #e1e8e3; font: inherit; }

@media (max-width: 900px) {
  .login-layout { grid-template-columns: minmax(270px, .78fr) minmax(380px, 1.22fr); }
  .login-aside { padding-inline: 30px; }
  .workspace { grid-template-columns: 225px minmax(0, 1fr); }
  .rail { padding-inline: 14px; }
  .stage-area { padding: 20px; }
  .address-status { display: none; }
}

@media (max-width: 680px) {
  .login-layout { display: flex; flex-direction: column; }
  .login-aside { min-height: auto; gap: 30px; padding: 20px 22px 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .login-story { margin: 0; padding: 22px 0 0; }
  .login-story .eyebrow { margin-bottom: 10px; }
  .login-story h1 { font-size: clamp(35px, 10vw, 49px); }
  .login-copy { margin-top: 13px; font-size: 15px; }
  .login-foot { font-size: 11px; }
  .login-main { min-height: auto; flex: 1; padding: 26px 18px 18px; }
  .login-card { padding: 25px 21px; }
  .card-icon { margin-bottom: 21px; }
  .main-foot { margin-top: 17px; text-align: center; }
  .topbar { min-height: 59px; padding: 0 15px; }
  .topbar-right { gap: 9px; }
  .server-pill { max-width: 112px; font-size: 10px; }
  .topbar-divider { display: none; }
  .user-name { max-width: 104px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
  .avatar { width: 29px; height: 29px; }
  .workspace { display: flex; flex-direction: column; }
  .rail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 12px; padding: 13px 15px; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail > .rail-label, .rail-section { display: none; }
  .assignment-card { padding: 10px 12px; }
  .assignment-icon { width: 29px; height: 29px; }
  .assignment-label { margin-top: 11px; font-size: 9px; }
  .assignment-card h1 { font-size: 15px; }
  .assignment-subtitle { font-size: 10px; }
  .stage-area { min-height: 0; flex: 1; gap: 12px; padding: 17px 12px 12px; }
  .stage-heading { align-items: start; flex-direction: column; gap: 9px; }
  .target-label { max-width: 100%; }
  .setup-banner { font-size: 12px; }
  .browser-panel { min-height: 390px; flex: 1; }
  .browser-toolbar { gap: 4px; padding-inline: 7px; }
  .window-dots { gap: 4px; margin-right: 2px; }
  .window-dots span { width: 6px; height: 6px; }
  .toolbar-separator { margin-inline: 2px; }
  .toolbar-button { width: 29px; height: 30px; }
  .address-display { gap: 6px; padding-inline: 8px; font-size: 10px; }
  .fullscreen-button { display: none; }
  .browser-viewport { min-height: 0; }
  #remote-canvas { min-height: 0; }
  .browser-statusbar { align-items: flex-start; flex-direction: column; gap: 4px; padding: 7px 10px; }
  .statusbar-right { width: 100%; justify-content: space-between; gap: 6px; font-size: 9px; }
  .remote-audio { width: 116px; }
  .stage-foot { align-items: flex-end; flex-direction: column; gap: 5px; padding: 0 2px; font-size: 10px; text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
