.crew-nav {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  min-height: 62px;
  align-items: center;
  gap: clamp(16px, 3vw, 42px);
  padding-inline: clamp(12px, 2vw, 35px);
  color: #f0eadf;
  background: #141e30;
  border-bottom: 1px solid #43516a;
}

.crew-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-block: 5px;
  white-space: nowrap;
  font: 400 clamp(.92rem, 2vw, 1.55rem)/1 var(--pixel);
  letter-spacing: -.04em;
}

.crew-brand img { flex: none; width: 29px; height: 29px; }
.crew-nav nav { display: flex; align-items: center; gap: clamp(4px, 1.2vw, 16px); }
.crew-nav nav a { display: grid; place-items: center; min-height: 36px; padding: 4px 9px; border: 1px solid transparent; color: #cbd7e9; font: 400 13px/1.2 var(--pixel); letter-spacing: -.025em; white-space: nowrap; }
.crew-nav nav a:hover { border-color: #43516a; background: #1b2941; color: #f0eadf; }
.crew-nav nav a[aria-current] { border-color: #8f744f; background: #2d2926; color: var(--accent); }
.crew-nav nav a:focus-visible, .crew-nav .crew-brand:focus-visible { outline-offset: 0; }
.crew-utility { display: flex; align-items: center; min-width: 0; gap: clamp(5px, 1vw, 12px); margin-left: auto; }
.nav-ca { display: inline-flex; align-items: center; gap: 6px; min-width: 0; min-height: 35px; padding: 5px 8px; color: #d5dce9; background: #19253b; border: 1px solid #43516a; }
.nav-ca strong { flex: none; font: 400 12px/1 var(--pixel); color: var(--accent); }
.nav-ca span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 11px/1.35 var(--mono); }
.nav-ca svg { flex: none; width: 13px; height: 13px; }
.nav-ca:hover { border-color: var(--accent); }
.wallet-nav { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; min-height: 35px; color: var(--accent); background: #19253b; border: 1px solid #8f744f; font: 700 11px/1.35 var(--mono); white-space: nowrap; }
.wallet-nav:hover { background: #342b26; }
.wallet-nav svg { width: 15px; height: 15px; }
body[data-view='menu'] .crew-nav { display: none; }
.frame { display: block; min-height: calc(100dvh - 62px); }
.frame :is(.rail, .mast) { display: none; }
.frame .shell { min-height: inherit; }
body[data-view='office'] .app-error { top: 70px; }

.office-screen { display: block; padding: 0; min-height: auto; background: #141e30; }
.office-screen .office-content { width: 100%; max-width: none; border: 0; box-shadow: none; }
.office-screen .office-layout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(235px, 24vw, 370px); align-items: start; background: #141e30; border-bottom: 1px solid #43516a; }
.office-screen.has-comms .office-layout { grid-template-columns: minmax(0, 1fr) clamp(320px, 32vw, 420px); }
.office-scene { position: sticky; top: 62px; width: 100%; max-width: max(320px, calc((100dvh - 124px) * 16 / 9)); justify-self: center; }
.office-floor { overflow: clip; }
.office-screen #office-art { aspect-ratio: 16/9; }
.office-footer { min-height: 43px; background: #141e30; color: #c9d3e1; border-top: 1px solid #43516a; padding-inline: clamp(12px, 2vw, 27px); }
.office-footer strong { color: #eee8db; margin-right: 5px; font: 650 13px/1.4 var(--display); }
.office-footer > div { flex-wrap: wrap; }
.office-footer .office-lamp { background: #d6aa64; }

.crew-hotspots { position: absolute; inset: 0; pointer-events: none; }
.crew-hotspot {
  position: absolute;
  left: var(--walker-x, -10%);
  top: var(--walker-y, -10%);
  transform: translateX(-50%);
  width: 7%;
  height: 15%;
  z-index: 1;
  border: 0;
  text-align: center;
  cursor: pointer;
  pointer-events: auto;
}
.crew-hotspot span { position: absolute; left: 50%; top: 0; transform: translate(-50%, calc(-100% - 2px - var(--crew-label-lift, 0px))); display: inline-flex; align-items: center; gap: 4px; padding: 2px 5px; color: #f2ede4; background: #121b2b; border: 1px solid #71809b; box-shadow: 1px 2px 0 #141823b3; font: 10px/1.3 var(--mono); white-space: nowrap; }
.crew-hotspot span::before { content: ''; width: 4px; height: 4px; flex: none; background: var(--crew-role, #b7c9df); }
.crew-hotspot span::after { position: absolute; left: 50%; top: 100%; width: 1px; height: var(--crew-label-lift, 0px); background: #8898b1; content: ''; }
.crew-hotspot:is(:hover, .is-current) { z-index: 2; }
.crew-hotspot:is(:hover, .is-current) span { border-color: var(--crew-role); color: white; }

.crew-sidebar { display: flex; min-width: 0; min-height: 100%; align-self: stretch; flex-direction: column; gap: 12px; padding: 15px clamp(9px, 1.15vw, 16px); border-left: 1px solid #43516a; background: #141e30; }
.crew-roster-head { display: flex; align-items: center; gap: 9px; padding: 0 4px 11px; border-bottom: 1px solid #394962; }
.crew-roster-head h2 { font: 400 17px/1.2 var(--pixel); letter-spacing: -.035em; }
.crew-roster-head svg { width: 22px; height: 22px; color: #bac7d8; }
.crew-roster { display: grid; gap: 7px; }
.crew-member { min-width: 0; display: grid; grid-template-columns: 43px minmax(0, 1fr) auto; align-items: center; gap: 8px 11px; min-height: 58px; padding: 4px 9px; border: 1px solid #3e506d; border-radius: 3px; background: #19253b; }
.crew-member:hover { background: #23324a; border-color: #7d8ea5; }
.crew-member[aria-current] { border-color: #a48862; box-shadow: inset 2px 0 var(--accent); background: #202c43; }
.crew-member canvas { width: 43px; height: 43px; image-rendering: pixelated; }
.crew-member strong { display: block; color: #f3ede0; font-size: 16px; line-height: 1.2; }
.crew-member small { display: block; color: var(--crew-role, #b7c9df); font-size: 12px; line-height: 1.35; margin-top: 2px; }
:is(.crew-member, .crew-hotspot)[data-crew='cupsey'] { --crew-role: #f4c978; }
:is(.crew-member, .crew-hotspot)[data-crew='dylan'] { --crew-role: #88d6bc; }
:is(.crew-member, .crew-hotspot)[data-crew='tara'] { --crew-role: #e3a5bb; }
:is(.crew-member, .crew-hotspot)[data-crew='adam'] { --crew-role: #c3b7ef; }
:is(.crew-member, .crew-hotspot)[data-crew='diplomat'] { --crew-role: #88cfdb; }
.crew-presence { display: inline-flex; align-items: center; gap: 5px; color: #b2bdce; font: 10px/1.3 var(--mono); white-space: nowrap; }
.crew-presence::before { content: ''; flex: none; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.crew-presence[data-status='available'] { color: #a9e2c6; }
.crew-presence[data-status='working'] { color: var(--accent); }
.crew-message-button { display: flex; justify-content: center; align-items: center; gap: 9px; min-height: 40px; margin-top: auto; padding: 6px; border: 1px solid #b69260; border-radius: 3px; color: var(--accent); font-weight: 650; }
.crew-message-button:hover { background: #382e23; }
.crew-message-button svg { width: 17px; height: 17px; }
.has-comms .crew-sidebar { min-height: 0; max-height: calc(100dvh - 62px); overflow-y: auto; gap: 9px; scrollbar-color: var(--rule) var(--well); }
.has-comms .crew-message-button { display: none; }
.has-comms .crew-roster { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.has-comms .crew-sidebar .crew-member { position: relative; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 3px; min-height: 55px; padding: 4px 2px; }
.has-comms .crew-sidebar .crew-member canvas { width: 28px; height: 28px; }
.has-comms .crew-sidebar .crew-member strong { font-size: 11px; text-align: center; overflow-wrap: anywhere; }
.has-comms .crew-sidebar .crew-member small { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.has-comms .crew-sidebar .crew-presence { position: absolute; top: 5px; right: 4px; font-size: 0; }
.office-screen .office-dock { min-width: 0; background: #19263b; border: 1px solid #43516a; margin-bottom: 2px; }
.office-screen .dock-header { background: #21324d; border-bottom: 1px solid #43516a; }
.office-screen .is-docked.agent-grid { padding: 6px; }
.office-screen .is-docked .prompt-list > button { min-height: 28px; }
.office-screen .is-docked .thread { min-height: clamp(90px, 18dvh, 156px); max-height: clamp(128px, 28dvh, 350px); }
.conversation-header .comms-avatar { display: grid; place-items: center; }
.comms-avatar canvas { width: 30px; height: 30px; image-rendering: pixelated; }
.desk-crew-roster { display: grid; gap: 5px; padding: 8px; }
.desk-crew-roster .crew-member { grid-template-columns: 31px minmax(0, 1fr); gap: 7px; min-height: 43px; padding: 4px 7px; }
.desk-crew-roster .crew-member canvas { width: 31px; height: 31px; }
.desk-crew-roster .crew-member strong { font-size: 13px; }
.desk-crew-roster .crew-member small { font-size: 11px; }
.comms-brief { display: grid; gap: 6px; padding: 9px 13px; border-bottom: 1px solid var(--line); background: var(--surface); }
.comms-brief > p { font-size: 12px; line-height: 1.45; color: #d0d8e7; overflow-wrap: anywhere; }
.comms-brief .comms-launch { color: var(--muted-accent); font: 11px/1.4 var(--mono); }
.comms-brief .dock-launch-picker { border: 0; padding: 1px 0 0; }
.comms-empty-actions { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.footer > a:hover { color: var(--accent); text-decoration: underline; }

@media (min-width: 701px) and (min-height: 640px) {
  .has-comms .crew-sidebar { height: calc(100dvh - 62px); }
  .office-screen .office-dock,
  #office-comms-slot,
  .office-screen .is-docked.agent-grid,
  .office-screen .is-docked .conversation {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
  }
  .office-screen .is-docked :is(.conversation-header, .comms-brief, #agent-compose) { flex: none; }
  .office-screen .is-docked .thread { flex: 1; min-height: 72px; max-height: none; }
  .office-screen .is-docked .agent-evidence { flex: none; max-height: min(16dvh, 160px); overflow: auto; }
}

@media (max-width: 850px) {
  .crew-nav { gap: 13px; }
  .crew-nav nav { gap: 4px; }
  .crew-nav nav a { padding-inline: 5px; font-size: 12px; }
  .crew-network { font-size: 10px; }
  .crew-presence { font-size: 0; }
}

@media (max-width: 700px) {
  .nav-ca span { display: none; }
  .nav-ca { padding-inline: 5px; }
  .crew-nav { flex-wrap: wrap; gap: 2px 10px; min-height: 74px; padding-top: 4px; }
  .crew-nav nav { display: grid; order: 3; flex-basis: 100%; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; padding-bottom: 4px; }
  .crew-nav nav a { min-height: 32px; padding-inline: 2px; font-size: clamp(10px, 3vw, 12px); }
  .crew-utility { order: 2; }
  .crew-brand img { width: 25px; height: 25px; }
  .office-screen .office-layout, .office-screen.has-comms .office-layout { grid-template-columns: minmax(0, 1fr); }
  .office-scene { position: static; max-width: none; }
  .office-screen .crew-sidebar { border-left: 0; border-top: 1px solid #43516a; padding: 11px; }
  .has-comms .crew-sidebar { max-height: none; overflow: visible; }
  .crew-roster { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .crew-roster-head h2 { font-size: 17px; }
  .crew-sidebar .crew-member { grid-template-columns: 28px minmax(0, 1fr) auto; min-height: 44px; padding: 3px 7px; gap: 6px; }
  .crew-sidebar .crew-member canvas { width: 28px; height: 28px; }
  .crew-member strong { font-size: 13px; }
  .crew-member small { font-size: 11px; }
  .office-floor .crew-hotspot { width: 10%; height: 18%; }
  .crew-hotspot span { padding: 1px 3px; gap: 3px; font-size: 9px; }
}

@media (max-width: 500px) {
  .crew-utility .crew-network { display: none; }
  .wallet-nav { padding-inline: 6px; min-height: 31px; font-size: 10px; }
}

@media (max-width: 565px) {
  .desk-crew-roster { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
