:root {
  color-scheme: dark;
  --bg: #000;
  --surface: #0b1210;
  --surface-2: #101816;
  --surface-3: #050807;
  --line: #1a2622;
  --line-strong: #2b3d36;
  --text: #edf7f1;
  --muted: #8aa18f;
  --muted-2: #5f7468;
  --green: #17ff6a;
  --green-soft: rgba(23, 255, 106, 0.1);
  --cyan: #00e5ff;
  --cyan-soft: rgba(0, 229, 255, 0.1);
  --warn: #ffbf3c;
  --warn-soft: rgba(255, 191, 60, 0.1);
  --danger: #ff4b4b;
  --danger-soft: rgba(255, 75, 75, 0.13);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.topbar {
  height: 56px;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  background: #020504;
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #07100c;
}

.brand-logo img {
  width: 25px;
  height: 25px;
}

.brand-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.brand-mark {
  color: var(--green);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-tagline {
  max-width: 330px;
  color: #dce9df;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub,
.agency-badge {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.agency-badge {
  max-width: 220px;
  color: var(--cyan);
  border: 1px solid #164e55;
  border-radius: 8px;
  padding: 5px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.select-pill,
.status-pill {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #070c0b;
  padding: 0 9px;
  color: var(--muted);
  white-space: nowrap;
  font-size: 11px;
  font-weight: 900;
}

.select-pill select {
  min-width: 112px;
  border: 0;
  color: var(--text);
  background: transparent;
  outline: 0;
  font-weight: 900;
}

.select-pill select option {
  background: #07100e;
  color: var(--text);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 10px rgba(255, 75, 75, 0.55);
}

.dot.ok {
  background: var(--green);
  box-shadow: 0 0 12px rgba(23, 255, 106, 0.58);
}

.dot.bad {
  background: var(--danger);
}

.client-shell {
  width: min(1320px, 100%);
  height: calc(100vh - 164px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(360px, 460px) minmax(360px, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(214px, 0.44fr);
  grid-template-areas:
    "radio map"
    "ops map";
  gap: 8px;
  padding: 8px;
}

.panel {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.auth-panel {
  grid-area: radio;
  display: flex;
  flex-direction: column;
}

.map-panel {
  grid-area: map;
  position: relative;
  min-width: 0;
  background: #080d0c;
}

.ops-panel {
  grid-area: ops;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, 0.52fr);
  grid-template-rows: minmax(0, 1fr) minmax(86px, 0.42fr);
}

.panel-head,
.mini-head {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.panel-head h1 {
  margin: 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.login-card,
.roster-scope,
.selected-card {
  border-bottom: 1px solid var(--line);
  padding: 10px;
}

.login-card {
  background: #050907;
}

.roster-scope {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.selected-card {
  background: #070d0b;
}

.mobile-action-bar {
  display: none;
}

.selected-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.selected-head h2 {
  margin: 4px 0 0;
}

.login-row,
.provisioning-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  margin-bottom: 7px;
}

.operator-auth .login-row {
  grid-template-columns: minmax(90px, 1fr) minmax(76px, 0.8fr) auto;
}

.provisioning-row.hidden,
.operator-auth.hidden {
  display: none;
}

.qr-scanner {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #020504;
  padding: 8px;
  margin-bottom: 8px;
}

.qr-scanner video {
  width: 100%;
  max-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #000;
  object-fit: cover;
}

.qr-scanner-status {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #020504;
  color: var(--text);
  padding: 0 10px;
  outline: 0;
}

input:focus,
select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.08);
}

.button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 0 11px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.button:hover:not(:disabled) {
  border-color: var(--cyan);
  color: var(--text);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.button.primary {
  color: var(--green);
  border-color: rgba(23, 255, 106, 0.42);
  background: rgba(23, 255, 106, 0.06);
}

.button.warn {
  color: var(--warn);
  border-color: rgba(255, 191, 60, 0.45);
  background: var(--warn-soft);
}

.button.danger {
  color: var(--danger);
  border-color: rgba(255, 75, 75, 0.46);
  background: var(--danger-soft);
}

.button.compact {
  min-height: 30px;
  padding: 0 9px;
  font-size: 11px;
}

#mobileMessagesButton {
  position: relative;
}

#mobileMessagesButton.has-badge::after {
  content: attr(data-badge);
  position: absolute;
  top: -7px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--warn);
  color: #050807;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px #030605;
}

.button.full-width {
  width: 100%;
}

.login-status {
  min-height: 22px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.login-status.ok {
  color: var(--green);
}

.login-status.warn {
  color: var(--warn);
}

.login-status.bad {
  color: var(--danger);
}

.unit-list,
.message-list {
  min-height: 0;
  overflow: auto;
}

.unit-list {
  flex: 1;
}

.unit-row {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 56px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 7px 10px;
  text-align: left;
  cursor: pointer;
}

.unit-row.selected {
  background: var(--green-soft);
  box-shadow: inset 4px 0 0 var(--green);
}

.unit-row.emergency {
  box-shadow: inset 4px 0 0 var(--danger);
}

.target-toggle {
  min-height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.unit-row.selected .target-toggle {
  border-color: var(--green);
  color: var(--green);
}

.unit-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.unit-copy strong,
.selected-card h2 {
  min-width: 0;
  overflow-wrap: anywhere;
}

.unit-copy strong {
  font-size: 13px;
}

.unit-copy small,
.selected-meta,
.eyebrow,
.empty-state {
  color: var(--muted);
  font-size: 11px;
}

.empty-state {
  padding: 16px 12px;
}

.selected-card h2 {
  margin: 5px 0;
  font-size: 16px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 10px;
}

#map {
  width: 100%;
  height: 100%;
  background: #111816;
  filter: saturate(0.7) brightness(0.78);
}

.hud {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 24px));
  min-height: 130px;
  display: grid;
  align-content: center;
  gap: 4px;
  justify-items: start;
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.82);
  box-shadow: var(--shadow);
  padding: 13px 15px;
  text-align: left;
  z-index: 450;
}

.hud span,
.hud small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.hud strong {
  width: 100%;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  overflow-wrap: anywhere;
}

.alert-banner {
  position: absolute;
  top: 152px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 451;
  width: min(420px, calc(100% - 24px));
  border: 1px solid var(--warn);
  border-radius: 8px;
  background: rgba(8, 8, 6, 0.94);
  color: var(--warn);
  padding: 10px 14px;
  font-weight: 900;
  text-transform: uppercase;
  text-align: center;
}

.alert-banner.bad {
  border-color: var(--danger);
  color: var(--danger);
}

.map-toggles {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 7px;
  z-index: 452;
}

.map-toggle {
  min-width: 88px;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(3, 6, 5, 0.9);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.map-toggle.on {
  color: var(--green);
  border-color: rgba(23, 255, 106, 0.42);
}

.map-label {
  border: 0 !important;
  background: transparent !important;
  color: #b8f278 !important;
  box-shadow: none !important;
  font-weight: 900;
  text-shadow: 0 1px 2px #000;
}

.map-label.self {
  color: var(--green) !important;
}

.comms-pane,
.alert-pane,
.log-pane {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.comms-pane {
  grid-row: 1 / -1;
}

.tool-close {
  display: none;
}

.alert-pane,
.log-pane {
  border-right: 0;
}

.compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  padding: 8px;
  border-top: 1px solid var(--line);
}

.compose-target {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  min-width: 0;
}

.message-row,
.alert-row,
.log-row {
  display: grid;
  grid-template-columns: 58px 72px minmax(0, 1fr);
  gap: 7px;
  align-items: baseline;
  min-height: 38px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
}

.message-row.private {
  border-left: 3px solid var(--warn);
  background: rgba(255, 191, 60, 0.08);
}

.message-reply {
  grid-column: 3;
  justify-self: start;
  width: max-content;
}

.alert-row {
  border-left: 3px solid var(--warn);
}

.log-row.warn,
.alert-row.warn {
  border-left-color: var(--warn);
}

.log-row.bad,
.alert-row.bad {
  border-left-color: var(--danger);
}

.message-row span,
.alert-row span,
.log-row span {
  color: var(--muted-2);
  font-size: 10px;
}

.message-row strong,
.alert-row strong,
.log-row strong {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.message-row p,
.alert-row p,
.log-row p {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 11px;
}

.ptt-dock {
  height: 108px;
  width: min(820px, calc(100% - 16px));
  display: grid;
  grid-template-columns: minmax(120px, 0.2fr) minmax(230px, 1fr) minmax(120px, 0.2fr);
  gap: 8px;
  align-items: stretch;
  margin: 0 auto 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #030605;
  box-shadow: var(--shadow);
}

.ptt-button {
  min-height: 90px;
  border: 2px solid rgba(255, 75, 75, 0.74);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(95, 22, 22, 0.92), rgba(46, 10, 10, 0.96));
  color: #ffd3d3;
  font-size: 18px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: none;
  user-select: none;
}

.ptt-button.active {
  background: linear-gradient(180deg, rgba(196, 43, 43, 0.95), rgba(108, 21, 21, 0.98));
  color: #fff;
  box-shadow: 0 0 24px rgba(255, 75, 75, 0.28);
}

.ptt-button:disabled {
  opacity: 0.46;
  cursor: not-allowed;
}

.ptt-dock > .button {
  min-height: 90px;
}

.audio-sink {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  pointer-events: none;
}

.operator-locked .agency-badge,
.operator-locked #channelControl,
.operator-locked #mediaPill,
.operator-locked #e2eePill,
.operator-locked .operator-scope,
.operator-locked .ptt-dock,
.operator-locked .ops-panel,
.operator-locked .map-panel {
  display: none !important;
}

.operator-locked .topbar {
  grid-template-columns: minmax(200px, 1fr) auto;
}

.operator-locked .client-shell {
  height: calc(100vh - 56px);
  width: min(460px, 100%);
  grid-template-columns: 1fr;
  grid-template-rows: auto;
  grid-template-areas: "radio";
  align-content: start;
  padding-top: 18px;
}

.operator-locked .auth-panel {
  max-height: none;
  box-shadow: var(--shadow);
}

@media (max-width: 980px) {
  body {
    overflow: auto;
    padding-bottom: calc(118px + env(safe-area-inset-bottom, 0px));
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 900;
    height: auto;
    min-height: 56px;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .brand-sub,
  .brand-tagline,
  .agency-badge {
    display: none;
  }

  .topbar-controls {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .select-pill,
  .status-pill {
    min-height: 34px;
  }

  .client-shell,
  .operator-locked .client-shell {
    height: auto;
    min-height: 0;
    width: 100%;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas:
      "radio"
      "map"
      "ops";
    padding: 6px;
  }

  .auth-panel {
    min-height: 480px;
  }

  .map-panel,
  .operator-locked .map-panel {
    min-height: 260px;
    height: 260px;
  }

  .hud {
    top: 10px;
    min-height: 104px;
    padding: 11px 12px;
  }

  .hud strong {
    font-size: 22px;
  }

  .alert-banner {
    top: 126px;
  }

  .map-toggles {
    left: 10px;
    right: 10px;
    bottom: 10px;
    justify-content: space-between;
  }

  .map-toggle {
    min-width: 0;
    flex: 1;
  }

  .ops-panel {
    min-height: 420px;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(220px, 1fr) 130px 150px;
  }

  .comms-pane,
  .alert-pane,
  .log-pane {
    border-right: 0;
  }

  .ptt-dock {
    position: fixed;
    z-index: 920;
    left: 6px;
    right: 6px;
    bottom: 6px;
    width: auto;
    height: 108px;
    grid-template-columns: 88px minmax(0, 1fr) 88px;
  }

  .ptt-button,
  .ptt-dock > .button {
    min-height: 88px;
  }

  .ptt-button {
    font-size: 15px;
  }

  .operator-auth .login-row,
  .login-row,
  .provisioning-row {
    grid-template-columns: 1fr;
  }

  .operator-auth .login-row {
    grid-template-columns: 1fr 1fr;
  }

  .operator-auth .login-row .button {
    grid-column: 1 / -1;
  }

  body[data-operator-state="authenticated"] {
    background: #020403;
  }

  body[data-operator-state="authenticated"] .topbar {
    position: static;
    gap: 6px;
    padding: 8px 10px;
  }

  body[data-operator-state="authenticated"] .brand {
    min-height: 34px;
  }

  body[data-operator-state="authenticated"] .brand-logo {
    width: 32px;
    height: 32px;
  }

  body[data-operator-state="authenticated"] .brand-logo img {
    width: 22px;
    height: 22px;
  }

  body[data-operator-state="authenticated"] .brand-mark {
    font-size: 14px;
  }

  body[data-operator-state="authenticated"] .topbar-controls {
    display: grid;
    grid-template-columns: minmax(126px, 1fr) minmax(64px, auto) minmax(64px, auto);
    gap: 6px;
    overflow: visible;
  }

  body[data-operator-state="authenticated"] .select-pill,
  body[data-operator-state="authenticated"] .status-pill {
    min-height: 34px;
    padding: 0 8px;
    font-size: 10px;
    border-radius: 8px;
  }

  body[data-operator-state="authenticated"] .select-pill select {
    min-width: 0;
    width: 100%;
  }

  body[data-operator-state="authenticated"] #controlQos,
  body[data-operator-state="authenticated"] #mediaQos,
  body[data-operator-state="authenticated"] .media-e2ee {
    display: none;
  }

  body[data-operator-state="authenticated"] .client-shell {
    grid-template-areas:
      "map"
      "radio";
    gap: 8px;
    padding: 8px;
    padding-bottom: 6px;
  }

  body[data-operator-state="authenticated"] .map-panel {
    min-height: 236px;
    height: min(34vh, 290px);
    border-color: rgba(23, 255, 106, 0.24);
    box-shadow: inset 4px 0 0 var(--green);
    background:
      radial-gradient(circle at 82% 18%, rgba(23, 255, 106, 0.12), transparent 30%),
      linear-gradient(180deg, #0b1110, #020403 72%);
  }

  body[data-operator-state="authenticated"] #map {
    display: none;
  }

  body[data-operator-state="authenticated"] .hud {
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    min-height: 0;
    transform: none;
    align-content: center;
    justify-items: start;
    border-left-width: 5px;
    background: rgba(0, 0, 0, 0.78);
    padding: 16px 18px;
  }

  body[data-operator-state="authenticated"] .hud strong {
    font-size: clamp(30px, 12vw, 48px);
    line-height: 0.92;
  }

  body[data-operator-state="authenticated"] .hud span,
  body[data-operator-state="authenticated"] .hud small {
    font-size: 11px;
  }

  body[data-operator-state="authenticated"] .alert-banner {
    top: auto;
    bottom: 14px;
    width: calc(100% - 24px);
  }

  body[data-operator-state="authenticated"] .map-toggles,
  body[data-operator-state="authenticated"] .ops-panel,
  body[data-operator-state="authenticated"] .login-card,
  body[data-operator-state="authenticated"] .auth-panel > .panel-head {
    display: none;
  }

  body[data-operator-state="authenticated"] .auth-panel {
    min-height: 0;
    background: transparent;
    border: 0;
    overflow: visible;
  }

  body[data-operator-state="authenticated"] .roster-scope {
    max-height: 184px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
  }

  body[data-operator-state="authenticated"] .roster-scope .mini-head {
    min-height: 36px;
    padding: 7px 10px;
  }

  body[data-operator-state="authenticated"] .unit-row {
    min-height: 48px;
    grid-template-columns: 40px minmax(0, 1fr);
    padding: 6px 10px;
  }

  body[data-operator-state="authenticated"] .unit-copy strong {
    font-size: 13px;
  }

  body[data-operator-state="authenticated"] .unit-copy small {
    font-size: 10px;
  }

  body[data-operator-state="authenticated"] .selected-card {
    margin-top: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  body[data-operator-state="authenticated"] .action-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  body[data-operator-state="authenticated"] .action-grid .button {
    min-height: 36px;
    padding: 0 5px;
    font-size: 10px;
  }
}

@media (max-width: 520px) {
  .brand-logo {
    width: 34px;
    height: 34px;
  }

  .brand-mark {
    font-size: 13px;
  }

  .status-pill {
    font-size: 10px;
  }

  .client-shell {
    gap: 6px;
  }

  .panel {
    border-radius: 6px;
  }

  .message-row,
  .alert-row,
  .log-row {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .message-row p,
  .alert-row p,
  .log-row p {
    grid-column: 1 / -1;
  }

  .ptt-dock {
    grid-template-columns: 72px minmax(0, 1fr) 72px;
    gap: 6px;
    padding: 6px;
  }

  .ptt-dock > .button {
    padding: 0 6px;
    font-size: 10px;
  }

  body[data-operator-state="authenticated"] {
    padding-bottom: calc(116px + env(safe-area-inset-bottom, 0px));
  }

  body[data-operator-state="authenticated"] .topbar {
    padding: 8px;
  }

  body[data-operator-state="authenticated"] .topbar-controls {
    grid-template-columns: minmax(118px, 1fr) 58px 58px;
  }

  body[data-operator-state="authenticated"] .status-pill {
    justify-content: center;
    gap: 5px;
  }

  body[data-operator-state="authenticated"] .status-pill span:nth-child(2) {
    max-width: 28px;
    overflow: hidden;
  }

  body[data-operator-state="authenticated"] .client-shell {
    padding: 6px;
  }

  body[data-operator-state="authenticated"] .map-panel {
    height: min(33vh, 250px);
    min-height: 214px;
  }

  body[data-operator-state="authenticated"] .hud {
    padding: 14px;
  }

  body[data-operator-state="authenticated"] .roster-scope {
    max-height: 166px;
  }

  body[data-operator-state="authenticated"] .unit-row {
    min-height: 44px;
  }

  body[data-operator-state="authenticated"] .ptt-dock {
    height: 104px;
    grid-template-columns: 68px minmax(0, 1fr) 68px;
  }

  body[data-operator-state="authenticated"] .ptt-button,
  body[data-operator-state="authenticated"] .ptt-dock > .button {
    min-height: 90px;
  }

  body[data-operator-state="authenticated"] .ptt-button {
    font-size: 16px;
  }
}

@media (max-width: 980px) {
  body[data-operator-state="authenticated"] {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
    padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  }

  body[data-operator-state="authenticated"] .client-shell {
    height: calc(100dvh - 104px - 124px - env(safe-area-inset-bottom, 0px));
    min-height: 0;
    grid-template-areas:
      "map"
      "radio";
    grid-template-rows: auto minmax(0, 1fr);
    gap: 6px;
    overflow: hidden;
  }

  body[data-operator-state="authenticated"] .map-panel {
    height: 142px;
    min-height: 128px;
    border-color: rgba(23, 255, 106, 0.32);
    box-shadow: inset 4px 0 0 var(--green);
  }

  body[data-operator-state="authenticated"] .hud {
    inset: 0;
    width: auto;
    min-height: 0;
    transform: none;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 16px 18px 16px 20px;
  }

  body[data-operator-state="authenticated"] .hud strong {
    font-size: clamp(26px, 10vw, 40px);
    line-height: 0.95;
  }

  body[data-operator-state="authenticated"] .auth-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }

  body[data-operator-state="authenticated"] .mobile-action-bar {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin: 0 0 6px;
  }

  body[data-operator-state="authenticated"] .mobile-action-bar .button {
    min-height: 34px;
    padding: 0 5px;
    font-size: 10px;
  }

  body[data-operator-state="authenticated"] .roster-scope {
    flex: 1 1 auto;
    max-height: none;
    min-height: 96px;
  }

  body[data-operator-state="authenticated"] .unit-list {
    min-height: 0;
    overflow: auto;
  }

  body[data-operator-state="authenticated"] .selected-card {
    flex: 0 0 auto;
    margin-top: 6px;
    padding: 8px;
  }

  body[data-operator-state="authenticated"] .selected-head {
    align-items: center;
  }

  body[data-operator-state="authenticated"] .selected-card h2 {
    margin: 2px 0 0;
    font-size: 14px;
  }

  body[data-operator-state="authenticated"] .selected-meta {
    margin-top: 3px;
    font-size: 10px;
  }

  body[data-operator-state="authenticated"] .action-grid {
    gap: 6px;
    margin-top: 7px;
  }

  body[data-operator-state="authenticated"][data-tool-modal="map"] .map-panel {
    position: fixed;
    z-index: 1000;
    inset: 62px 8px calc(114px + env(safe-area-inset-bottom, 0px));
    height: auto;
    min-height: 0;
    border-color: rgba(23, 255, 106, 0.42);
    box-shadow: var(--shadow);
  }

  body[data-operator-state="authenticated"][data-tool-modal="map"] #map {
    display: block;
  }

  body[data-operator-state="authenticated"][data-tool-modal="map"] .hud {
    top: 12px;
    left: 12px;
    right: auto;
    bottom: auto;
    width: min(270px, calc(100% - 72px));
    min-height: 48px;
    border: 1px solid rgba(23, 255, 106, 0.28);
    border-left: 4px solid var(--green);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.78);
    padding: 8px 10px;
    pointer-events: none;
  }

  body[data-operator-state="authenticated"][data-tool-modal="map"] .hud strong {
    font-size: 16px;
    line-height: 1;
  }

  body[data-operator-state="authenticated"][data-tool-modal="map"] .hud small {
    display: none;
  }

  body[data-operator-state="authenticated"][data-tool-modal="map"] .map-toggles {
    display: flex;
  }

  body[data-operator-state="authenticated"][data-tool-modal="map"] #mapModalCloseButton {
    display: inline-grid;
    place-items: center;
    position: absolute;
    z-index: 1002;
    top: 10px;
    right: 10px;
    background: rgba(3, 6, 5, 0.92);
  }

  body[data-operator-state="authenticated"][data-tool-modal="messages"] #messagesModalCloseButton {
    display: inline-grid;
    place-items: center;
  }

  body[data-operator-state="authenticated"][data-tool-modal="messages"] .ops-panel {
    display: grid;
    position: fixed;
    z-index: 1000;
    inset: 62px 8px calc(114px + env(safe-area-inset-bottom, 0px));
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    border-color: rgba(0, 229, 255, 0.34);
    box-shadow: var(--shadow);
    background: var(--surface);
  }

  body[data-operator-state="authenticated"][data-tool-modal="messages"] .comms-pane {
    min-height: 0;
    border: 0;
  }

  body[data-operator-state="authenticated"][data-tool-modal="messages"] .alert-pane,
  body[data-operator-state="authenticated"][data-tool-modal="messages"] .log-pane {
    display: none;
  }

  body[data-operator-state="authenticated"][data-tool-modal="messages"] .message-row {
    min-height: 50px;
  }
}

@media (max-width: 520px) {
  body[data-operator-state="authenticated"] {
    padding-bottom: calc(106px + env(safe-area-inset-bottom, 0px));
  }

  body[data-operator-state="authenticated"] .client-shell {
    height: calc(100dvh - 102px - 126px - env(safe-area-inset-bottom, 0px));
  }

  body[data-operator-state="authenticated"] .map-panel {
    height: 132px;
    min-height: 122px;
  }

  body[data-operator-state="authenticated"] .hud {
    padding: 13px 14px 13px 17px;
  }

  body[data-operator-state="authenticated"] .hud strong {
    font-size: clamp(25px, 9vw, 36px);
  }

  body[data-operator-state="authenticated"] .hud span,
  body[data-operator-state="authenticated"] .hud small {
    font-size: 10px;
  }

  body[data-operator-state="authenticated"] .roster-scope .mini-head {
    min-height: 34px;
  }

  body[data-operator-state="authenticated"] .unit-row {
    min-height: 42px;
    grid-template-columns: 38px minmax(0, 1fr);
  }

  body[data-operator-state="authenticated"] .target-toggle {
    min-height: 28px;
    font-size: 9px;
  }

  body[data-operator-state="authenticated"] .selected-meta {
    display: none;
  }

  body[data-operator-state="authenticated"] .selected-card h2 {
    font-size: 13px;
  }

  body[data-operator-state="authenticated"] #selectedClearButton {
    min-height: 30px;
    padding: 0 7px;
    font-size: 9px;
  }

  body[data-operator-state="authenticated"] .action-grid .button {
    min-height: 32px;
    font-size: 9px;
  }

  body[data-operator-state="authenticated"][data-tool-modal="map"] .map-panel,
  body[data-operator-state="authenticated"][data-tool-modal="messages"] .ops-panel {
    inset: 58px 6px calc(108px + env(safe-area-inset-bottom, 0px));
  }
}
