/* Phone shell for NCR Lokator. Applied with body.phone-shell
   (mobile layout, or any narrow / touch screen). */

body.phone-shell {
  --phone-tab-h: calc(4.5rem + env(safe-area-inset-bottom, 0px));
  --phone-top-h: calc(3.25rem + env(safe-area-inset-top, 0px));
  --map-h: calc(100dvh - var(--phone-top-h) - var(--phone-tab-h));
  --app-chrome-h: calc(var(--phone-top-h) + var(--phone-tab-h));
  font-size: 16px;
}

body.phone-shell .app-nav {
  display: none;
}

body.phone-shell .phone-tabbar {
  display: flex;
}

.phone-tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1600;
  height: var(--phone-tab-h, calc(4.5rem + env(safe-area-inset-bottom, 0px)));
  padding: 0.2rem 0.5rem env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.08);
}

.phone-tab {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  min-width: var(--touch);
  min-height: var(--touch);
  margin: 0;
  padding: 0.2rem 0.1rem 0.35rem;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: var(--text-label);
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.phone-tab span {
  display: block;
  max-width: 100%;
  line-height: 1.05;
  text-align: center;
  white-space: normal;
}

.phone-tab svg {
  width: 1.35rem;
  height: 1.35rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.phone-tab.active {
  color: var(--accent);
  background: var(--accent-light);
}

.phone-tab[hidden] {
  display: none;
}

.task-manager-nav {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.task-manager-nav button {
  min-height: var(--touch-lg);
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.task-manager-nav button:hover,
.task-manager-nav button:focus-visible {
  border-color: var(--accent);
  background: var(--accent-light);
}

.admin-section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.75rem;
}

.admin-section-nav button {
  min-height: var(--touch);
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-muted);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.admin-section-nav button.active {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  color: #fff;
}

.intake-action-list,
.live-log-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.intake-action,
.live-log-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface2);
}

.intake-action h3,
.live-log-card h3,
.intake-subhead {
  margin: 0;
  font-size: 1.05rem;
}

.intake-action p,
.live-log-card p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

.intake-action-buttons,
.intake-close-form,
.training-log-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.45rem;
}

.intake-action-buttons .btn,
.intake-close-form .btn,
.training-log-form .btn,
.training-log-create > .btn,
.log-task-links .btn {
  width: 100%;
  min-height: 2.75rem;
}

.log-task-links {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.log-task-links .btn {
  text-align: left;
}

.log-editor-tabs {
  display: flex;
  gap: 0.45rem;
  position: sticky;
  top: 0;
  z-index: 4;
  margin-top: 0.75rem;
  padding: 0.35rem 0;
  background: var(--surface);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.log-editor-tab {
  flex: 1 0 auto;
  min-height: 2.75rem;
  min-width: 4.6rem;
  padding: 0 0.7rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.timeline-entry {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}

.timeline-entry p {
  margin: 0.2rem 0;
}

.system-activity {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.2rem 0.75rem 0.75rem;
}

.system-activity summary {
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  font-weight: 700;
  cursor: pointer;
}

.log-editor-tab.active {
  border-color: var(--accent);
  background: var(--accent-light);
}

.task-list-block {
  margin-top: 0.85rem;
}

.task-on-scene {
  border-color: #16a34a;
}

.owner-card {
  margin-top: 0.85rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.owner-card .btn {
  width: 100%;
  margin-top: 0.45rem;
}

.leaflet-div-icon.team-marker-wrap {
  background: transparent;
  border: 0;
}

.marker-callsign {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  color: #0f172a;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff;
  white-space: nowrap;
}

body.phone-shell #mappingMapView .map-team-panel {
  top: 0.45rem;
  right: 0.45rem;
  bottom: auto;
  left: auto;
  max-height: 14rem;
  z-index: 650;
}

body.phone-shell #mappingMapView.map-tools-on .map-team-panel {
  right: 5.25rem;
  max-width: min(200px, calc(100% - 15rem));
}

body.phone-shell #mappingMapView .map-team-panel.collapsed {
  max-height: none;
  overflow: hidden;
  width: auto;
  min-width: 0;
  max-width: 7.2rem;
}

body.phone-shell #mappingMapView .map-team-panel.collapsed .status-legend,
body.phone-shell #mappingMapView .map-team-panel.collapsed .map-team-list {
  display: none;
}

.log-editor-panel > .log-section:first-child {
  margin-top: 0.2rem;
  padding-top: 0;
  border-top: 0;
}

.intake-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-weight: 650;
}

.intake-field input,
.intake-field select,
.intake-field textarea {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-weight: 450;
}

.training-log-create {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.intake-subhead {
  margin-top: 1.15rem;
}

.task-log-chosen {
  margin-top: 0.85rem;
}

.task-log-chosen > .btn,
.log-section > .btn {
  width: 100%;
  min-height: 2.75rem;
}

.log-section {
  margin-top: 1.15rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.coord-extra {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 0.15rem 0.75rem 0.75rem;
}

.coord-extra summary {
  cursor: pointer;
  font-weight: 650;
  min-height: 2.75rem;
  display: flex;
  align-items: center;
}

.coord-extra .intake-field {
  margin-top: 0.45rem;
}

.coord-extra .btn {
  width: 100%;
  min-height: 2.75rem;
  margin-top: 0.55rem;
}

.log-master-map {
  height: 280px;
  margin-top: 0.45rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.task-now {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0 0 0.75rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.task-now h3 {
  margin: 0;
  font-size: 1.2rem;
}

.task-now-kicker {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}

.task-now-dog {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.35;
}

.task-now-caution {
  margin: 0;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  background: #fef2f2;
  color: #991b1b;
}

.task-now .btn {
  width: 100%;
  min-height: 2.75rem;
}

a.task-directions {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2.75rem;
  margin: 0.35rem 0 0.15rem;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
}

a.task-directions-quiet {
  display: block;
  margin: 0 0 0.15rem;
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.3;
}

.task-reports {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.task-report-sent {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 650;
}

.task-now .task-report-help {
  border-color: #c2410c;
  color: #9a3412;
  background: #fff7ed;
}

.task-now .task-quick-marker-menu {
  margin: 0;
}


.task-brief-kicker {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.task-brief-log {
  margin: 0.15rem 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.task-brief > h3,
.task-brief-head h3 {
  margin: 0.1rem 0 0;
  font-size: 1.15rem;
}

.task-inset-label {
  margin: 0.65rem 0 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.task-inset-map {
  height: 168px;
  margin-top: 0.35rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface2);
  pointer-events: none;
}

.task-inset-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.task-brief-grid {
  display: grid;
  grid-template-columns: 6.4rem 1fr;
  gap: 0.4rem 0.7rem;
  margin: 0.7rem 0 0;
}

.task-brief-grid dt {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.task-brief-grid dd {
  margin: 0;
}

.log-marker-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.log-marker-actions button {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-left-width: 6px;
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.log-marker-actions button.is-selected {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  background: var(--accent-light);
}

.log-marker-actions button[data-marker-heading="reported_sighting"],
.log-marker-actions button[data-task-marker="reported_sighting"] { border-left-color: #d97706; }
.log-marker-actions button[data-marker-heading="confirmed_sighting"],
.log-marker-actions button[data-task-marker="confirmed_sighting"] { border-left-color: #dc2626; }
.log-marker-actions button[data-marker-heading="wildlife_camera"],
.log-marker-actions button[data-task-marker="wildlife_camera"],
.log-marker-actions button[data-marker-heading="camera"],
.log-marker-actions button[data-task-marker="camera"] { border-left-color: var(--marker-camera, #0891b2); }
.log-marker-actions button[data-marker-heading="rvp"],
.log-marker-actions button[data-task-marker="rvp"] { border-left-color: var(--marker-rvp, #6B3FA0); }
.log-marker-actions button[data-marker-heading="intel"],
.log-marker-actions button[data-task-marker="intel"] { border-left-color: #2563eb; }
.log-marker-actions button[data-marker-heading="other"],
.log-marker-actions button[data-task-marker="other"] { border-left-color: #64748b; }

.log-marker-row {
  border-left-width: 6px;
}

.phone-badge {
  position: absolute;
  top: 0.15rem;
  right: calc(50% - 1.35rem);
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-style: normal;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.05rem;
  text-align: center;
}

.phone-sheet {
  position: fixed;
  inset: 0;
  z-index: 1700;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.phone-sheet[hidden] {
  display: none !important;
}

.phone-sheet-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: var(--overlay);
}

.phone-sheet-card {
  position: relative;
  width: min(40rem, 100%);
  max-height: min(78dvh, 640px);
  overflow: auto;
  background: var(--surface);
  color: var(--text);
  border-radius: 18px 18px 0 0;
  padding: 0.35rem 0.35rem calc(0.8rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.28);
}

body.phone-shell #phoneMoreSheet {
  bottom: var(--phone-tab-h);
}

body.phone-shell #phoneMoreSheet .phone-sheet-card {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - var(--phone-top-h) - var(--phone-tab-h) - 0.35rem);
  padding-bottom: 0.55rem;
  overflow: hidden;
}

body.phone-shell #phoneMoreSheet .phone-sheet-head {
  flex: 0 0 auto;
}

body.phone-shell #phoneMoreSheet .phone-sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-bottom: 0.35rem;
}

.phone-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.7rem 0.35rem;
}

.phone-sheet-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.phone-sheet-close {
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.phone-sheet-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.25rem 0.45rem 0.4rem;
}

.phone-sheet-item {
  width: 100%;
  min-height: var(--touch);
  text-align: left;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-muted);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  font-weight: 650;
  cursor: pointer;
}

.phone-sheet-danger {
  color: var(--danger);
  background: transparent;
}

.phone-sheet-lead {
  border-color: var(--accent);
}

.dispatcher-block h3 {
  margin: 1rem 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.dispatcher-roster {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  max-height: 14rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-muted);
}

.dispatcher-roster.team-roster-page {
  max-height: none;
}

.dispatcher-person {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.dispatcher-person:last-child {
  border-bottom: 0;
}

.dispatcher-person.is-offline {
  opacity: 0.72;
}

.dispatcher-person strong {
  font-weight: 700;
}

.dispatcher-jobs-track {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 0.15rem 0 0.35rem;
}

.dispatcher-job-card {
  flex: 0 0 13.5rem;
  scroll-snap-align: start;
  min-height: 4.4rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-muted);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dispatcher-job-card strong {
  display: block;
  margin-bottom: 0.2rem;
}

.dispatcher-jobs-empty {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

.dispatcher-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding-bottom: 0.25rem;
}

.dispatcher-quick button {
  flex: 0 0 auto;
  min-height: var(--touch);
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--accent-fill);
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.phone-sheet-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.phone-sheet-label {
  margin: 0.2rem 0.15rem 0;
  font-size: var(--text-label);
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--muted);
}

body.phone-shell .topbar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: calc(0.25rem + env(safe-area-inset-top, 0px)) 0.75rem 0.25rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  min-height: var(--phone-top-h);
}

body.phone-shell .topbar-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-align: left;
  padding: 0;
}

body.phone-shell .app-title {
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.phone-shell .beta-badge {
  font-size: 0.62rem;
}

body.phone-shell .brand-logo,
body.phone-shell .brand-logo-link,
body.phone-shell .topbar .brand-logo,
body.phone-shell .topbar .brand-logo-link {
  width: 32px;
  height: 32px;
}

body.phone-shell .topbar-create-job,
body.phone-shell #btnLogout,
body.phone-shell .view-mode-toggle {
  display: none;
}

body.phone-shell .topbar-meta {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 0.3rem;
}

body.phone-shell .notify-btn,
body.phone-shell .online-toggle,
body.phone-shell .topbar .btn,
body.phone-shell #btnChat {
  min-height: var(--touch);
  min-width: var(--touch);
  padding: 0.3rem 0.45rem;
  border-radius: 999px;
}

body.phone-shell .notify-popover,
body.phone-shell .online-popover {
  position: fixed;
  top: calc(var(--phone-top-h) + 0.35rem);
  left: max(0.5rem, env(safe-area-inset-left));
  right: max(0.5rem, env(safe-area-inset-right));
  width: auto;
  bottom: auto;
  max-height: min(22rem, calc(100dvh - var(--phone-top-h) - var(--phone-tab-h) - 0.75rem));
  z-index: 5;
}

.chat-overlay {
  position: fixed;
  z-index: 1550;
  top: 4.6rem;
  left: 0;
  right: 0;
  bottom: 0;
}

body.phone-shell .chat-overlay {
  top: var(--phone-top-h);
  bottom: var(--phone-tab-h);
}

.chat-overlay-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: rgba(15, 23, 42, 0.45);
}

.chat-overlay-card {
  position: absolute;
  top: 0.35rem;
  right: max(0.5rem, env(safe-area-inset-right));
  bottom: 0.5rem;
  width: min(36rem, calc(100% - 1rem));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

body.phone-shell .chat-overlay-card {
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.chat-overlay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-overlay-head h2 {
  margin: 0;
  font-size: 1rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}

.task-gate {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0.75rem;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  background: rgba(15, 23, 42, 0.72);
}

.task-gate-card {
  display: flex;
  flex-direction: column;
  width: min(36rem, 100%);
  max-height: min(88dvh, 40rem);
  overflow: hidden;
  background: var(--surface);
  color: var(--text);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.task-gate-dog {
  margin: 0.2rem 0 0;
  font-size: 1.2rem;
  font-weight: 750;
  line-height: 1.25;
}

.task-gate-marks {
  margin: 0.2rem 0 0;
  line-height: 1.35;
}

#taskGateCaution {
  max-height: 4.6rem;
  overflow: auto;
}

.task-gate-scroll {
  overflow: auto;
  min-height: 0;
  margin-top: 0.45rem;
}

.task-gate-card h2 {
  margin: 0.2rem 0 0.45rem;
  font-size: 1.25rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}

.task-gate-actions {
  display: flex;
  flex-shrink: 0;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.task-gate-actions .btn {
  flex: 1 1 0;
  min-height: 3.25rem;
  font-size: 1.05rem;
  font-weight: 700;
}

@media (orientation: landscape) {
  .phone-sheet-card {
    max-height: 92dvh;
  }
}

.task-roster {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.35rem 0 0.6rem;
}

.chat-overlay-card #panel-communications.panel.active {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  height: auto;
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

body.phone-shell .panels {
  padding: 0;
  margin-bottom: var(--phone-tab-h);
}

body.phone-shell .panel {
  margin: 0;
  border-radius: 0;
  box-shadow: none;
}

body.phone-shell .panel.scroll-panel.active {
  padding-bottom: 1.1rem;
}

body.phone-shell .panel.scroll-panel.active > .ops-panel.card,
body.phone-shell .panel.scroll-panel.active > .administration-panel,
body.phone-shell .panel.scroll-panel.active > .home-dashboard,
body.phone-shell .panel.scroll-panel.active > .account-panel,
body.phone-shell .panel.scroll-panel.active > .assignment-alert-banner {
  flex-shrink: 0;
}

body.phone-shell .home-dashboard,
body.phone-shell .scroll-panel.active > .card,
body.phone-shell .scroll-panel.active > .ops-panel.card,
body.phone-shell .scroll-panel.active > .assignment-alert-banner {
  width: min(40rem, 100%);
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
}

body.phone-shell .home-dashboard {
  padding: 0.75rem 0.75rem 1rem;
  gap: 0.7rem;
  flex-shrink: 0;
  min-height: min-content;
}

body.phone-shell .home-welcome-title {
  font-size: 1.45rem;
}

body.phone-shell .home-duty-actions,
body.phone-shell .home-widget-body .btn,
body.phone-shell .availability-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

body.phone-shell .home-duty-actions .btn,
body.phone-shell .home-widget-body > .btn {
  width: 100%;
  min-height: var(--touch-lg);
  font-size: 1rem;
}

body.phone-shell .ops-head {
  flex-direction: column;
  align-items: stretch;
}

body.phone-shell .ops-head .btn {
  width: 100%;
  min-height: var(--touch-lg);
  font-size: 1rem;
}

body.phone-shell .job-intake-item {
  flex-direction: column;
  align-items: stretch;
}

body.phone-shell .job-intake-item .btn,
body.phone-shell #jobIntakeFormLink {
  width: 100%;
  min-height: 2.75rem;
}

body.phone-shell #homeBookOnBtn,
body.phone-shell #taskGateAccept,
body.phone-shell .my-task-actions [data-task-scene="join"],
body.phone-shell .my-task-actions [data-task-report="help"],
body.phone-shell .task-now [data-task-scene="join"],
body.phone-shell .task-now [data-task-report="help"],
body.phone-shell .task-now .task-report-help {
  min-height: var(--touch-lg);
}

body.phone-shell .my-task-actions .btn {
  min-height: 2.75rem;
  flex: 1 1 9rem;
}

body.phone-shell .home-duty-field select,
body.phone-shell input,
body.phone-shell select,
body.phone-shell textarea {
  font-size: 16px;
  min-height: 2.75rem;
}

body.phone-shell .card h2,
body.phone-shell .ops-panel.card h2,
body.phone-shell .home-widget-head h2 {
  font-size: 1.05rem;
}

body.phone-shell .hint {
  font-size: 0.92rem;
  line-height: 1.4;
}

body.phone-shell #panel-mapping.panel.active,
body.phone-shell #mappingMapView.mapping-view.active {
  height: 100%;
  min-height: 0;
}

body.phone-shell #mappingMapView #map,
body.phone-shell #panel-mapping #map {
  min-height: 0;
  height: 100%;
  touch-action: none;
}

body.phone-shell .map-menu-toggle {
  top: auto;
  left: 0.65rem;
  bottom: 0.65rem;
  z-index: 680;
  min-height: 2.75rem;
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
}

body.phone-shell .map-menu-toggle.active {
  visibility: hidden;
  pointer-events: none;
}

body.phone-shell #mappingMapView .map-tools-menu {
  position: fixed;
  top: auto !important;
  left: 0;
  right: 0;
  bottom: var(--phone-tab-h);
  width: auto;
  max-height: calc(100dvh - var(--phone-top-h) - var(--phone-tab-h) - 0.25rem);
  margin: 0;
  border-radius: 16px 16px 0 0;
  z-index: 1400;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  touch-action: manipulation;
  padding-bottom: 0.35rem;
}

body.phone-shell #mappingMapView .map-tools-nav {
  flex-wrap: wrap;
  overflow: visible;
  touch-action: manipulation;
}

body.phone-shell #mappingMapView .map-tools-nav-btn {
  flex: 1 1 30%;
  min-width: 5.4rem;
  min-height: var(--touch);
  white-space: normal;
}

body.phone-shell #mappingMapView .map-tools-body {
  overflow-x: hidden;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(100dvh - var(--phone-top-h) - var(--phone-tab-h) - 8.75rem);
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

body.phone-shell .map-context-badge {
  top: 0.5rem;
  left: 0.45rem;
  right: auto;
  transform: none;
  max-width: calc(100% - 8.4rem);
  font-size: 0.68rem;
  padding: 0.28rem 0.55rem;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.phone-shell .map-quick-actions {
  top: 6.35rem;
  left: 0.45rem;
  right: 0.45rem;
  max-width: none;
  flex-direction: row;
}

body.phone-shell .leaflet-top {
  top: 2.6rem;
}

body.phone-shell .dispatch-toast-host {
  top: auto;
  bottom: calc(var(--phone-tab-h) + 0.45rem);
  left: 0.7rem;
  right: 0.7rem;
  max-width: none;
  z-index: 1550;
}

body.phone-shell #panel-communications.panel.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

body.phone-shell .sub-tabs {
  flex-shrink: 0;
  display: flex;
  gap: 0.35rem;
  padding: 0.5rem 0.65rem;
  overflow-x: auto;
}

body.phone-shell .sub-tab {
  flex: 1 1 0;
  min-height: var(--touch);
  border-radius: 999px;
}

body.phone-shell .comm-panel.active {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.phone-shell .chat-messages,
body.phone-shell .dm-messages {
  flex: 1;
  min-height: 0;
}

body.phone-shell .chat-form,
body.phone-shell .dm-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
  align-items: center;
  padding: 0.5rem 0.65rem 0.55rem;
  padding-bottom: 0.55rem;
}

body.phone-shell .chat-compose-tools,
body.phone-shell .dm-compose-tools {
  grid-column: 1 / -1;
}

body.phone-shell .chat-form input,
body.phone-shell .dm-form input {
  min-width: 0;
  width: 100%;
}

body.phone-shell .chat-form .btn,
body.phone-shell .dm-form .btn-primary {
  min-height: 2.75rem;
  min-width: 4.5rem;
}

body.phone-shell .comm-head {
  align-items: stretch;
  padding: 0.55rem 0.7rem 0.2rem;
}

body.phone-shell .channel-select,
body.phone-shell .channel-select select,
body.phone-shell .channel-select-wide select {
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

body.phone-shell .phone-tab.tab-alert-pulse {
  animation: phone-tab-pulse 0.9s ease-in-out 8;
}

@keyframes phone-tab-pulse {
  50% {
    background: #f59e0b;
    color: #1e293b;
  }
}

body.phone-shell .dm-layout {
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

body.phone-shell .dm-directory,
body.phone-shell .dm-folders {
  width: 100%;
  max-height: 34dvh;
  border-right: 0;
  border-bottom: 1px solid var(--border);
}

body.phone-shell dialog.dialog[open],
body.phone-shell dialog.job-dialog[open],
body.phone-shell dialog.dispatch-unit-dialog[open],
body.phone-shell dialog.user-action-dialog[open],
body.phone-shell dialog.my-task-detail-dialog[open],
body.phone-shell dialog.shift-detail-dialog[open] {
  width: 100%;
  max-width: min(40rem, 100%);
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 18px 18px 0 0;
  max-height: min(92dvh, calc(var(--app-vh, 100dvh) - 0.35rem));
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  top: auto;
}

body.phone-shell dialog.dialog form,
body.phone-shell dialog.job-dialog form,
body.phone-shell dialog form {
  max-height: min(86dvh, calc(var(--app-vh, 100dvh) - 1.5rem));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
}

body.phone-shell .dialog-actions,
body.phone-shell .job-form-actions {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.45rem;
}

body.phone-shell .dialog-actions .btn,
body.phone-shell .job-form-actions .btn {
  width: 100%;
  min-height: 2.85rem;
}

body.phone-shell .my-task-card .btn,
body.phone-shell .task-alert-row .btn,
body.phone-shell .ops-list .btn {
  min-height: 2.75rem;
}

body.phone-shell .info-grid {
  grid-template-columns: 1fr;
  font-size: 0.95rem;
  gap: 0.1rem 0;
}

body.phone-shell .info-grid dt {
  margin-top: 0.55rem;
}

body.phone-shell .info-grid dd {
  margin: 0;
  overflow-wrap: normal;
  word-break: normal;
}

body.phone-shell .administration-panel,
body.phone-shell .profile-form,
body.phone-shell .admin-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

body.phone-shell .profile-form label,
body.phone-shell .admin-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.92rem;
}

/* Sign-in and account recovery fill the phone. */
.login-page {
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  padding-top: env(safe-area-inset-top, 0px);
}

.login-page .login-card {
  width: 100%;
  max-width: 32rem;
  min-width: 0;
  margin: 0 auto;
  min-height: 100dvh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  box-sizing: border-box;
  padding: 1.35rem 1.1rem calc(1.6rem + env(safe-area-inset-bottom, 0px));
  overflow-wrap: break-word;
}

.login-page .login-logo {
  width: 4.5rem;
  height: 4.5rem;
}

.login-page .login-app-title {
  font-size: 1.55rem;
}

.login-page .login-tabs {
  width: 100%;
}

.login-page .login-tab {
  flex: 1 1 0;
  min-width: 0;
  min-height: 2.75rem;
  font-size: 0.82rem;
  line-height: 1.15;
  white-space: normal;
  padding: 0.35rem 0.2rem;
}

.login-page .login-form input,
.login-page .login-form select,
.login-page .login-form textarea {
  font-size: 16px;
  min-height: 3rem;
  width: 100%;
}

.login-page .login-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
  font-size: 0.92rem;
  font-weight: 650;
}

.login-page .btn-block,
.login-page .login-form .btn {
  min-height: 3rem;
  font-size: 1.02rem;
}

@media (min-width: 840px) {
  .login-page {
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
  }

  .login-page .login-card {
    min-height: 0;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
  }
}

body.phone-shell .task-gate-card h2 {
  font-size: 1.35rem;
}

body.phone-shell .account-tab {
  font-size: 0.84rem;
  padding: 0.35rem 0.2rem;
}

body.phone-shell .home-dashboard {
  gap: 0.55rem;
  padding-top: 0.4rem;
}

body.phone-shell .home-welcome-hero {
  padding: 0.7rem 0.85rem;
}

body.phone-shell .home-welcome-title {
  font-size: 1.2rem;
  margin-bottom: 0.15rem;
}

body.phone-shell .home-welcome-lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

body.phone-shell .home-status-grid {
  gap: 0.45rem 0.7rem;
}

body.phone-shell .home-status-grid strong {
  font-size: 1.05rem;
}

body.phone-shell .home-widget-duty-main {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}

body.phone-shell .home-duty-actions .btn {
  width: 100%;
  flex: 0 0 auto;
  min-height: var(--touch-lg);
}

body.phone-shell .task-list-block {
  margin-top: 0.55rem;
}

body.phone-shell .intake-subhead {
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

body.phone-shell .map-bottom-bar {
  right: 0.4rem;
  bottom: 0.45rem;
}

body.phone-shell #mappingMapView.map-tools-on .map-bottom-bar {
  right: 5.25rem;
}

body.phone-shell .map-menu-toggle {
  left: auto;
  right: 0.55rem;
}

body.phone-shell #map .leaflet-bottom.leaflet-right {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  margin: 0;
  width: auto;
  pointer-events: none;
}

body.phone-shell #map .leaflet-bottom.leaflet-right .leaflet-control {
  pointer-events: auto;
}

body.phone-shell #map .leaflet-control-zoom {
  position: absolute;
  top: 3.35rem;
  left: 0.45rem;
  margin: 0;
}

body.phone-shell .map-core-controls {
  top: 3.15rem;
  left: 3.35rem;
  flex-direction: row;
}

body.phone-shell #map .leaflet-control-attribution {
  position: absolute;
  top: auto;
  left: 0.45rem;
  right: auto;
  bottom: 3.6rem;
  margin: 0 !important;
  max-width: min(14rem, calc(100% - 6.2rem));
  text-align: left;
}

@media (orientation: landscape) {
  body.phone-shell .map-bottom-bar,
  body.phone-shell #mappingMapView.map-tools-on .map-bottom-bar {
    top: auto;
    left: 0.4rem;
    bottom: 0.35rem;
    width: auto;
    max-height: none;
    justify-content: flex-end;
  }

  body.phone-shell .map-bottom-row {
    flex-direction: row;
    flex-wrap: nowrap;
  }

  body.phone-shell .map-tool-switch {
    width: auto;
    height: auto;
    padding: 0.2rem 0.7rem 0.2rem 0.4rem;
  }

  body.phone-shell .map-tool-switch span {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
  }

  body.phone-shell #map .leaflet-control-zoom {
    top: 0.4rem;
    left: 0.4rem;
  }

  body.phone-shell .map-core-controls {
    top: 0.4rem;
    left: 3.25rem;
    right: auto;
    flex-direction: row;
  }

  body.phone-shell .map-quick-actions {
    top: 0.4rem;
    left: 8.6rem;
  }

  body.phone-shell .map-context-badge {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    max-width: calc(100% - 12rem);
  }

  body.phone-shell #mappingMapView .map-team-panel {
    top: 3.3rem;
  }

  body.phone-shell .map-bottom-bar {
    right: 0.4rem;
  }

  body.phone-shell #mappingMapView.map-tools-on .map-bottom-bar {
    right: 5.25rem;
  }

  body.phone-shell .map-menu-toggle {
    top: auto;
    bottom: 0.45rem;
    left: auto;
    right: 0.4rem;
  }

  body.phone-shell #map .leaflet-control-attribution,
  body.phone-shell #mappingMapView.map-tools-on #map .leaflet-control-attribution {
    top: auto;
    left: 0.45rem;
    right: auto;
    bottom: 3.6rem;
    max-width: min(14rem, calc(100% - 6.2rem));
  }
}

/* Phone polish for Home, My tasks, and Account. */
body.phone-shell #panel-home {
  background: var(--bg);
}

body.phone-shell #panel-home .home-dashboard {
  gap: 0.9rem;
  padding: 0.9rem 0.85rem 1.15rem;
}

body.phone-shell #panel-home .home-welcome-title {
  font-size: 1.55rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 0.25rem;
}

body.phone-shell #panel-home .home-welcome-lead {
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--muted);
}

body.phone-shell #panel-home .home-duty-central {
  max-width: none;
  margin: 0;
  padding: 0;
}

body.phone-shell #panel-home .home-duty-actions .btn {
  width: 100%;
  flex: 0 0 auto;
  min-height: var(--touch-lg);
  font-size: 1rem;
}

body.phone-shell #panel-mytasks,
body.phone-shell #panel-account {
  gap: 0.9rem;
  padding: 0.85rem 0.8rem 1rem;
  background: var(--bg);
}

body.phone-shell #panel-mytasks > .card,
body.phone-shell #panel-mytasks > .ops-panel.card,
body.phone-shell #panel-account .account-panel > .ops-panel.card {
  margin: 0;
}

body.phone-shell #panel-mytasks > .my-past-taskings-card {
  margin-top: 0.4rem;
}

body.phone-shell #panel-account .account-tabs {
  position: sticky;
  top: 0;
  z-index: 4;
  margin: 0 0 0.15rem;
  box-shadow: none;
}

body.phone-shell #panel-account .account-tab {
  min-height: var(--touch);
  padding: 0.4rem 0.15rem;
  font-size: 0.78rem;
  line-height: 1.15;
  white-space: nowrap;
}

body.phone-shell #panel-account .readiness-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.18rem;
}

body.phone-shell #panel-account .readiness-row strong,
body.phone-shell #panel-account .readiness-row span {
  text-align: left;
  font-size: 0.98rem;
}

body.phone-shell #panel-account .account-actions {
  flex-direction: column;
}

body.phone-shell #panel-account .account-actions .btn {
  flex: 0 0 auto;
  width: 100%;
}

body.phone-shell #panel-mytasks .my-task-actions {
  flex-direction: column;
}

body.phone-shell #panel-mytasks .my-task-actions .btn,
body.phone-shell #panel-mytasks .live-log-card > .btn,
body.phone-shell #panel-archive .live-log-card > .btn {
  width: 100%;
  flex: 0 0 auto;
}

@media (orientation: landscape) {
  body.phone-shell #panel-home .home-dashboard {
    gap: 0.4rem;
    padding-top: 0.3rem;
    padding-bottom: 0.4rem;
  }

  body.phone-shell #panel-home .home-welcome-hero {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.55rem;
    padding: 0;
  }

  body.phone-shell #panel-home .home-welcome-title {
    font-size: 1.08rem;
    margin: 0;
  }

  body.phone-shell #panel-home .home-welcome-lead {
    font-size: 0.84rem;
    margin: 0;
  }

  body.phone-shell #panel-home .home-status-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  body.phone-shell #panel-home .home-status-card .home-widget-head {
    margin-bottom: 0.35rem;
  }

  body.phone-shell #panel-home .home-status-grid > div {
    padding: 0.35rem 0.45rem 0.3rem;
  }

  body.phone-shell #panel-home .home-status-grid strong {
    margin-top: 0.08rem;
    font-size: 0.92rem;
    line-height: 1.15;
  }

  body.phone-shell #panel-home .home-status-card,
  body.phone-shell #panel-home .home-widget-duty,
  body.phone-shell #panel-home .home-manager-actions {
    padding: 0.5rem 0.65rem;
  }

  body.phone-shell #panel-home .home-duty-central {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  body.phone-shell #panel-home .home-widget-duty:has(#homeBookOffBtn:not([hidden])) {
    flex-direction: row;
    align-items: center;
    gap: 0.55rem;
  }

  body.phone-shell #panel-home .home-widget-duty:has(#homeBookOffBtn:not([hidden])) .home-widget-head {
    margin-bottom: 0;
    flex: 1 1 auto;
  }

  body.phone-shell #panel-home .home-widget-duty:has(#homeBookOffBtn:not([hidden])) .home-widget-body,
  body.phone-shell #panel-home .home-widget-duty:has(#homeBookOffBtn:not([hidden])) .home-duty-actions,
  body.phone-shell #panel-home .home-widget-duty:has(#homeBookOffBtn:not([hidden])) .home-duty-actions .btn {
    width: auto;
    flex: 0 0 auto;
    min-width: 8.75rem;
  }

  body.phone-shell #panel-home .home-manager-actions .home-widget-head {
    margin-bottom: 0.2rem;
  }

  body.phone-shell #panel-home .home-manager-actions .hint {
    margin-bottom: 0.25rem;
    font-size: 0.82rem;
  }

  body.phone-shell #panel-account .account-tab {
    font-size: 0.76rem;
    min-height: var(--touch);
  }
}

/* Mapping: drawing tools are a vertical strip on the right edge of the map. */
body.phone-shell .map-bottom-bar {
  left: 0.4rem;
  right: 0.4rem;
  bottom: 0.35rem;
  gap: 0.4rem;
}

body.phone-shell #mappingMapView.map-tools-on .map-bottom-bar {
  right: 5.25rem;
}

body.phone-shell #mappingMapView.map-tools-on .map-bottom-row {
  flex-wrap: nowrap;
  width: 100%;
  max-width: none;
  margin-left: 0;
  justify-content: flex-start;
}

body.phone-shell #mappingMapView.map-tools-on .map-draw-dock {
  top: 0.4rem;
  right: 0.35rem;
  bottom: 3.55rem;
  width: 4.65rem;
}

body.phone-shell .map-bottom-row {
  align-items: center;
}

body.phone-shell .map-tool-switch {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-start;
}

body.phone-shell #mappingMapView.map-tools-on .map-tool-switch {
  min-height: var(--touch);
  font-size: 0.8rem;
  box-shadow: none;
}

body.phone-shell .map-advanced-btn {
  min-height: 2.75rem;
  padding: 0.35rem 0.8rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

body.phone-shell #mappingMapView .map-tools-menu {
  bottom: var(--map-sheet-bottom, var(--phone-tab-h));
  max-height: calc(100dvh - var(--phone-top-h) - var(--map-sheet-bottom, var(--phone-tab-h)) - 0.35rem);
  border-radius: 16px;
}

body.phone-shell #mappingMapView .map-tools-body {
  max-height: none;
}

body.phone-shell .map-draw-dock .map-dock-btn {
  min-height: 2.75rem;
}

body.phone-shell .map-draw-dock-actions .btn {
  min-height: 2.75rem;
  flex: 0 0 auto;
  width: 100%;
}

@media (orientation: landscape) {
  body.phone-shell .map-bottom-bar {
    left: 0.4rem;
    right: 0.4rem;
    bottom: 0.3rem;
    max-height: none;
  }

  body.phone-shell #mappingMapView.map-tools-on .map-bottom-bar {
    right: 5.25rem;
  }

  body.phone-shell #mappingMapView.map-tools-on .map-draw-dock {
    top: 0.35rem;
    bottom: 3.45rem;
  }

  body.phone-shell #mappingMapView.map-tools-on .map-draw-dock-tools {
    display: flex;
    flex-direction: column;
  }

  body.phone-shell #mappingMapView.map-tools-on .map-bottom-row {
    width: 100%;
    max-width: none;
    margin-left: 0;
    justify-content: flex-start;
  }

  body.phone-shell #mappingMapView.map-tools-on .map-tool-switch {
    flex: 1 1 auto;
    width: auto;
  }

  body.phone-shell #mappingMapView.map-tools-on.is-drawing .map-draw-dock {
    display: flex;
    flex-direction: column;
  }

  body.phone-shell #map .leaflet-control-attribution,
  body.phone-shell #mappingMapView.map-tools-on #map .leaflet-control-attribution,
  body.phone-shell #mappingMapView.map-tools-on.is-drawing #map .leaflet-control-attribution {
    top: auto;
    left: 0.45rem;
    right: auto;
    bottom: 3.5rem;
    max-width: min(14rem, calc(100% - 6.2rem));
  }
}

body.phone-shell .map-ctx-backdrop:not([hidden]) {
  display: block;
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: var(--phone-tab-h);
  z-index: 1670;
  border: 0;
  padding: 0;
  background: var(--overlay, rgba(15, 23, 42, 0.45));
}

body.phone-shell #mapContextMenu {
  position: fixed;
  left: 0;
  right: 0;
  top: auto;
  bottom: var(--phone-tab-h);
  width: auto;
  min-width: 0;
  max-width: none;
  max-height: calc(100dvh - var(--phone-top-h) - var(--phone-tab-h) - 0.5rem);
  z-index: 1680;
  display: flex;
  flex-direction: column;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
}

body.phone-shell #mapContextMenu[hidden] {
  display: none !important;
}

body.phone-shell .map-ctx-head {
  cursor: default;
  touch-action: none;
}

body.phone-shell .map-ctx-scroll {
  overflow-y: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

body.phone-shell .map-layer-sheet {
  bottom: var(--phone-tab-h);
}

body.phone-shell .map-layer-card {
  max-height: calc(100dvh - var(--phone-top-h) - var(--phone-tab-h) - 0.5rem);
}

#nebliFeedSheet {
  z-index: 1760;
}

#nebliFeedSheet .phone-sheet-card {
  max-height: min(92dvh, 720px);
}

#nebliFeedSheet .phone-sheet-body {
  gap: 0.55rem;
}

.nebli-live {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  margin: 0.35rem 0 0.75rem;
}

.nebli-live .btn,
.nebli-live a.btn,
.nebli-pick {
  min-height: 2.75rem;
}

.nebli-pick {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  text-align: left;
}

.nebli-live-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0f172a;
  border-radius: 12px;
  overflow: hidden;
}

.nebli-live-stage iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #0f172a;
}

.drone-status {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--muted);
  font-weight: 700;
}

.drone-status::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: currentColor;
}

.drone-status[data-state="live"] {
  color: #166534;
  background: #dcfce7;
}

.drone-status[data-state="offline"] {
  color: #991b1b;
  background: #fee2e2;
}

.drone-status[data-state="unknown"] {
  color: #854d0e;
  background: #fef9c3;
}

body.phone-shell .search-picture-actions {
  flex-direction: column;
}

body.phone-shell .search-picture-actions .btn,
body.phone-shell .search-picture-actions .search-map-link {
  width: 100%;
}

body.phone-shell .map-gps-chip {
  top: auto;
  left: auto;
  right: 0.5rem;
  bottom: 3.4rem;
  transform: none;
  max-width: min(16rem, calc(100% - 7.5rem));
  overflow: hidden;
  text-overflow: ellipsis;
}

body.phone-shell #mappingMapView.map-tools-on .map-gps-chip {
  right: 5.4rem;
}

/* Dispatch board toolbar: keep a compact row, not the old stacked Dispatcher menu. */
.dispatch-toolbar {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0;
}

.dispatch-toolbar button {
  flex: 0 0 auto;
  min-height: var(--touch);
  width: auto;
  padding: 0 0.85rem;
  text-align: center;
}

#taskManagerHome .dispatch-title,
#taskManagerSection #taskManagerSectionTitle {
  text-transform: none;
  letter-spacing: -0.02em;
  font-size: 1.35rem;
  color: var(--text);
}

#taskManagerBack {
  width: auto;
  align-self: flex-start;
  min-height: var(--touch);
  text-align: left;
}


body.phone-shell .task-focus-actions {
  grid-template-columns: 1fr 1fr;
}

body.phone-shell .task-focus-bar .btn {
  font-size: 1rem;
}

body.phone-shell .search-picture-actions .btn {
  min-height: var(--touch);
}

body.phone-shell .route-recording-banner {
  bottom: calc(var(--phone-tab-h, 4.5rem) + 0.55rem);
  z-index: 1650;
}

body.phone-shell.task-focus-open .route-recording-banner {
  display: none;
}

body.phone-shell .task-focus-actions {
  grid-template-columns: 1fr 1fr;
}


/* Keep the offline banner clear of the phone notch. */
.ncr-offline-banner {
  padding-top: calc(0.65rem + env(safe-area-inset-top, 0px));
}


/* Incident Commander — phone log header and picker */
body.phone-shell .log-ic-header {
  margin: 0.5rem 0 0.9rem;
  padding: 0.85rem 0.95rem;
}
body.phone-shell .log-ic-header p {
  font-size: 1.08rem;
  line-height: 1.35;
}
body.phone-shell .log-ic-form {
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
}
body.phone-shell .log-ic-form select,
body.phone-shell .log-ic-form .btn {
  min-height: 3rem;
  width: 100%;
}
body.phone-shell .log-ic-line {
  font-size: 1.02rem;
}
