:root {
  --bg-main: #f5f5f7;
  --bg-card: #ffffff;
  --bg-card-sub: #fbfbfd;
  --bg-input: #fbfbfd;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-focus: #0071e3;
  --text-main: #1d1d1f;
  --text-dim: #86868b;
  --text-muted: #86868b;
  --accent-cyan: #0071e3;
  --accent-blue: #0071e3;
  --accent-green: #34c759;
  --accent-red: #ff3b30;
  --accent-yellow: #ff9500;
  --apple-blue: #0071e3;
  --apple-green: #34c759;
  --apple-red: #ff3b30;
  --apple-orange: #ff9500;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 6px 10px;
  gap: 6px;
}

/* Apple Header - Compact Layout */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 12px;
  min-height: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-area h1 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.logo-area h1 span {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-dim);
  margin-left: 4px;
}

/* Header Center Command Controls (最上方全局操作中心) */
.header-center-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.025);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-sm);
  padding: 2px 10px;
  min-height: 28px;
  height: 28px;
  font-size: 11px;
  flex-shrink: 0;
}

.header-center-controls .status-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  flex-wrap: nowrap;
}

.radar-dot {
  width: 10px;
  height: 10px;
  background-color: var(--accent-blue);
  border-radius: 50%;
  position: relative;
  box-shadow: 0 0 6px rgba(0, 113, 227, 0.4);
}

.radar-dot::after {
  content: "";
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border: 1.5px solid var(--accent-blue);
  border-radius: 50%;
  animation: radar-pulse 2s infinite ease-out;
}

@keyframes radar-pulse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2.4); opacity: 0; }
}

.nav-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
}

.nav-tab-btn {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  border-radius: 6px;
  border: none;
  background: transparent;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
}

.nav-tab-btn:hover {
  color: var(--text-main);
}

.nav-tab-btn.active {
  background: #ffffff;
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 980px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-connected {
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.badge-disconnected {
  color: var(--text-dim);
}

.badge-idle {
  color: var(--accent-blue);
}

.badge-broadcasting {
  background: rgba(52, 199, 89, 0.1);
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.badge-info {
  color: var(--text-main);
}

/* Card & Layout - Compact Proportion */
.card, .panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 8px 10px;
  gap: 6px;
}

.card-header, .card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-color);
}

.card-header h2, .card-title span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

/* Apple Buttons: Sleek & Compact 32px ~ 36px */
.btn, .action-btn, .btn-apple {
  height: 34px;
  min-height: 34px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  padding: 0 12px;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  user-select: none;
}

.btn:disabled, .action-btn:disabled, .btn-apple:disabled, button:disabled {
  opacity: 0.45;
  cursor: not-allowed !important;
  box-shadow: none !important;
  pointer-events: auto;
}

.btn-primary, .btn-apple-primary {
  background: var(--accent-blue);
  color: #ffffff;
}

.btn-primary:hover, .btn-apple-primary:hover {
  background: #0077ed;
  box-shadow: 0 2px 10px rgba(0, 113, 227, 0.3);
}

.btn-danger, .btn-apple-danger {
  background: var(--accent-red);
  color: #ffffff;
}

.btn-danger:hover, .btn-apple-danger:hover {
  background: #e03227;
}

.btn-secondary, .btn-sub, .btn-apple-sub {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover, .btn-sub:hover, .btn-apple-sub:hover {
  background: rgba(0, 0, 0, 0.09);
}

.btn-success {
  background: rgba(52, 199, 89, 0.15);
  color: var(--accent-green);
  border: 1px solid var(--accent-green);
}

.btn-success:hover {
  background: var(--accent-green);
  color: #ffffff;
}

/* Inputs */
input[type="text"], input[type="number"], select, textarea {
  background: var(--bg-card-sub);
  border: 1px solid #d2d2d7;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
  transition: all 0.2s ease;
  font-family: inherit;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
  background: #ffffff;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

th {
  background: #fafafa;
  color: var(--text-dim);
  padding: 8px 12px;
  position: sticky;
  top: 0;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  z-index: 2;
}

td {
  padding: 7px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  color: var(--text-main);
}

tr:hover {
  background: rgba(0, 113, 227, 0.03);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 980px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* Resizers for Map Modules and Workspace Panels */
.resizer-h {
  height: 16px;
  background: transparent;
  cursor: row-resize;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  z-index: 30;
  margin: -6px 0;
  touch-action: none;
  flex-shrink: 0;
}

.resizer-h::after {
  content: "";
  width: 48px;
  height: 4px;
  border-radius: 980px;
  background: rgba(0, 0, 0, 0.22);
  transition: all 0.2s ease;
  pointer-events: none;
}

.resizer-h:hover::after, .resizer-h.resizing::after {
  background: var(--accent-blue);
  width: 72px;
  height: 5px;
}

body.resizing-active {
  user-select: none !important;
  cursor: row-resize !important;
}

body.resizing-active.resizing-col {
  cursor: col-resize !important;
}

body.resizing-active .leaflet-container,
body.resizing-active iframe {
  pointer-events: none !important;
}

.resizer-v {
  width: 8px;
  background: transparent;
  cursor: ew-resize;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  z-index: 25;
  margin: 0 -2px;
  touch-action: none;
  flex-shrink: 0;
}

.resizer-v::after {
  content: "";
  width: 4px;
  height: 44px;
  border-radius: 980px;
  background: rgba(0, 0, 0, 0.18);
  transition: all 0.2s ease;
}

.resizer-v:hover::after, .resizer-v.resizing::after {
  background: var(--accent-blue);
  height: 64px;
  width: 5px;
}

.map-resize-handle-corner {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  user-select: none;
  touch-action: none;
  transition: all 0.15s ease;
}

.map-resize-handle-corner::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid #8e8e93;
  border-bottom: 2px solid #8e8e93;
}

.map-resize-handle-corner:hover {
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.3);
}

.map-resize-handle-corner:hover::after {
  border-color: var(--accent-blue);
}

/* Apple Style Map Floating Location Button (悬浮当前位置定位按钮) */
.map-locate-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 500;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent-blue);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  user-select: none;
  transition: all 0.2s ease;
}

.map-locate-btn:hover {
  background: #ffffff;
  border-color: var(--accent-blue);
  box-shadow: 0 3px 10px rgba(0, 113, 227, 0.2);
}

.map-locate-btn.locating {
  opacity: 0.7;
  cursor: wait;
}

/* 蓝色脉冲当前位置光晕 */
.current-location-pulse {
  width: 20px;
  height: 20px;
  position: relative;
  cursor: pointer;
}

.current-location-pulse::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 113, 227, 0.35);
  animation: locPulse 2s infinite ease-out;
}

.current-location-pulse::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #0071e3;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

@keyframes locPulse {
  0% {
    transform: scale(0.6);
    opacity: 0.9;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* Layout & Components for Apple Pro Workspace (Shared between Portable Workshop & Hedge Console) */
.portable-grid {
  flex: 1;
  display: grid;
  grid-template-columns: var(--col-left-w, 310px) 1fr var(--col-right-w, 340px);
  gap: 6px;
  min-height: 0;
  overflow: hidden;
}

.col-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  overflow: hidden;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.field-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.center-top-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  min-height: 28px;
  height: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  gap: 6px;
  flex-shrink: 0;
  font-size: 11px;
}

.status-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  flex-wrap: nowrap;
}

.status-num {
  font-weight: 700;
  color: var(--accent-blue);
  font-size: 12px;
}

.precision-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 980px;
  font-size: 10px;
  font-weight: 500;
  line-height: 16px;
  white-space: nowrap;
}

.precision-pill.good {
  background: rgba(52, 199, 89, 0.12);
  border: 1px solid rgba(52, 199, 89, 0.4);
  color: #1b7a36;
}

.precision-pill.warn {
  background: rgba(255, 149, 0, 0.12);
  border: 1px solid rgba(255, 149, 0, 0.4);
  color: #b25000;
}

.snap-mini-btn {
  background: transparent;
  border: none;
  color: var(--accent-blue);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  font-size: 10px;
  margin-left: 2px;
}

.precision-banner {
  background: rgba(52, 199, 89, 0.12);
  border: 1px solid var(--accent-green);
  color: #1b7a36;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  margin: 3px 0;
}

.table-card {
  flex: 1;
  min-height: 110px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.table-scroll {
  flex: 1;
  overflow-y: auto;
}

.app-main {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.left-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  overflow: hidden;
}

.right-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  overflow: hidden;
}

.map-card {
  flex: 1.1;
  min-height: 160px;
  display: flex;
  flex-direction: column;
}

#map-view, #portableMap, #probeMap {
  flex: none;
  min-height: 100px;
  height: var(--map-height, 220px);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  z-index: 1;
  position: relative;
}

.search-box-wrapper {
  position: relative;
  width: 320px;
}

.search-box {
  display: flex;
  gap: 6px;
}

.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 100;
  max-height: 220px;
  overflow-y: auto;
  display: none;
}

.search-dropdown-item {
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.search-dropdown-item:hover {
  background: rgba(0, 113, 227, 0.05);
  color: var(--accent-blue);
}

.precision-banner {
  background: rgba(52, 199, 89, 0.12);
  border: 1px solid var(--accent-green);
  color: #28a745;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin: 6px 0;
}

.coord-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.coord-input-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.coord-input-group label {
  color: var(--text-dim);
  font-weight: 500;
}

.coord-input-group input, .coord-input-group select {
  width: auto;
  height: 38px;
  padding: 4px 8px;
}

.btn-fav {
  background: rgba(255, 149, 0, 0.15);
  color: #ff9500;
  border: 1px solid #ff9500;
}

.btn-fav:hover {
  background: #ff9500;
  color: #ffffff;
}

.table-card {
  flex: 1;
  min-height: 180px;
  display: flex;
  flex-direction: column;
}

.table-actions {
  display: flex;
  gap: 6px;
}

.btn-sm {
  height: 28px;
  min-height: 28px;
  padding: 0 10px;
  font-size: 11px;
  border-radius: 6px;
}

.table-container {
  flex: 1;
  overflow-y: auto;
}

.control-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.port-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-connect {
  flex: 1;
  background: rgba(0, 113, 227, 0.1);
  color: var(--accent-blue);
  border: 1px solid var(--accent-blue);
}

.btn-connect:hover {
  background: var(--accent-blue);
  color: #ffffff;
}

.baud-tag {
  font-size: 11px;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.04);
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.action-buttons .btn {
  flex: 1;
  height: 40px;
}

.btn-warning {
  background: rgba(255, 149, 0, 0.15);
  color: #ff9500;
  border: 1px solid #ff9500;
}

.btn-warning:hover {
  background: #ff9500;
  color: #ffffff;
}

.stats-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg-card-sub);
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-dim);
}

.stat-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.fav-card {
  height: 160px;
  display: flex;
  flex-direction: column;
}

.fav-list-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.fav-item:hover {
  border-color: rgba(0, 113, 227, 0.3);
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.fav-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.fav-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fav-coords {
  font-size: 11px;
  color: var(--text-dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.fav-btns {
  display: flex;
  align-items: center;
  gap: 4px;
}

.terminal-card {
  flex: 1;
  min-height: 160px;
  display: flex;
  flex-direction: column;
}

.terminal-body {
  flex: 1;
  background: #1c1c1e;
  color: #d1d1d6;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  overflow-y: auto;
  line-height: 1.4;
}

.terminal-footer {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.terminal-footer input {
  flex: 1;
  height: 36px;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 400px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-dim);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.modal-coords-tip {
  font-size: 11px;
  color: var(--text-dim);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* ============================================================
   Mobile Phone Responsive Adaptation (iOS / Android / Small Screen)
   ============================================================ */
@media (max-width: 900px) {
  html, body {
    height: auto !important;
    min-height: 100vh !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .app-container {
    height: auto !important;
    min-height: 100vh !important;
    padding: 8px !important;
    gap: 10px !important;
    overflow: visible !important;
  }

  /* Header Mobile */
  .app-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    padding: 10px !important;
    min-height: auto !important;
    height: auto !important;
  }

  /* 移动端隐藏所有拖拽分割栏 */
  .resizer-v, .resizer-h, [id*="Resizer"], [id*="resizer"] {
    display: none !important;
  }

  .logo-area {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .logo-area h1 {
    display: flex;
    align-items: center;
    font-size: 15px;
  }

  .header-center-controls {
    width: 100% !important;
    justify-content: space-between !important;
    height: auto !important;
    min-height: 32px !important;
    padding: 4px 8px !important;
  }

  .nav-tabs {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 9px;
    padding: 3px;
  }

  .nav-tab-btn {
    flex: 1 !important;
    text-align: center !important;
    justify-content: center !important;
    padding: 8px 4px !important;
    font-size: 12px !important;
  }

  .header-badges {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
  }

  .header-badges .badge {
    flex: 1 1 calc(50% - 6px) !important;
    justify-content: center !important;
    padding: 6px 8px !important;
    font-size: 11px !important;
    min-height: 34px !important;
  }

  /* Portable Page Grid -> Stacking on Mobile */
  .portable-grid {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    overflow: visible !important;
    gap: 12px !important;
  }

  .col-panel {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    overflow: visible !important;
    gap: 10px !important;
  }

  #portableMap {
    height: 300px !important;
    min-height: 280px !important;
    width: 100% !important;
    flex: none !important;
    border-radius: var(--radius-md) !important;
  }

  .center-top-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .status-group {
    flex-wrap: wrap !important;
    gap: 10px !important;
    justify-content: space-between !important;
  }

  .center-top-bar > div:last-child {
    display: flex !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .center-top-bar > div:last-child .btn {
    flex: 1 !important;
  }

  .table-card {
    height: 340px !important;
    min-height: 260px !important;
    flex: none !important;
  }

  .table-scroll {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 520px !important;
  }

  .archive-column-card {
    height: auto !important;
    max-height: 520px !important;
    flex: none !important;
  }

  .archive-btn-row {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 4px !important;
  }

  .archive-btn {
    height: 36px !important;
    font-size: 11px !important;
  }

  /* Probe Page Mobile */
  .probe-main-layout {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    overflow: visible !important;
    gap: 12px !important;
  }

  #probeMap {
    height: 300px !important;
    min-height: 280px !important;
    width: 100% !important;
    flex: none !important;
  }

  .color-legend-bar {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .table-container {
    height: 320px !important;
    min-height: 240px !important;
    flex: none !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  table.probe-table {
    min-width: 600px !important;
  }

  /* Console Main Page Mobile */
  .app-main {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    overflow: visible !important;
    gap: 12px !important;
  }

  .left-panel, .right-panel {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    overflow: visible !important;
    gap: 10px !important;
  }

  #map-view {
    height: 300px !important;
    min-height: 280px !important;
    width: 100% !important;
    flex: none !important;
    border-radius: var(--radius-md) !important;
  }

  .search-box-wrapper {
    width: 100% !important;
  }

  .coord-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .coord-toolbar .btn, .coord-input-group {
    width: 100% !important;
  }

  .coord-input-group input, .coord-input-group select {
    flex: 1 !important;
    width: 100% !important;
  }

  /* Touch Buttons */
  .btn, .action-btn, .btn-apple {
    min-height: 44px !important;
    font-size: 13px !important;
  }
}

/* ============================================================
   Compact Vertical Scaling for Laptops & Screens under 850px
   Eliminates bottom content cut-off and scales down top layout
   ============================================================ */
@media (max-height: 850px) and (min-width: 901px) {
  .app-container {
    padding: 4px 8px;
    gap: 4px;
  }
  .app-header {
    min-height: 34px;
    height: 34px;
    padding: 2px 10px;
  }
  .logo-area h1 {
    font-size: 12px;
  }
  .nav-tab-btn, .badge {
    padding: 2px 6px;
    font-size: 10px;
  }
  .center-top-bar {
    min-height: 28px;
    height: 28px;
    padding: 2px 8px;
  }
  .card, .panel-card {
    padding: 6px 8px;
    gap: 4px;
  }
  #map-view, #portableMap, #probeMap {
    height: var(--map-height, 200px);
    min-height: 100px;
  }
  .compact-terminal, .terminal-box {
    height: 70px !important;
    min-height: 50px !important;
  }
  .table-card, .table-container {
    min-height: 100px !important;
  }
}

@media (max-height: 680px) {
  html, body {
    height: auto !important;
    overflow-y: auto !important;
  }
  .app-container {
    height: auto !important;
    min-height: 100vh;
  }
  #map-view, #portableMap, #probeMap {
    height: var(--map-height, 180px);
    min-height: 90px;
  }
}

/* ==========================================
   地图档案点位微调横幅与交互标记 (Apple 极简风格, 0 Emoji)
   ========================================== */
.map-edit-banner {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 113, 227, 0.35);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  font-size: 12px;
  animation: slideDownFade 0.2s ease-out;
}

@keyframes slideDownFade {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.map-edit-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.map-edit-badge {
  font-weight: 600;
  color: var(--accent-blue);
  background: rgba(0, 113, 227, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
}

.map-edit-coords {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 600;
  color: var(--accent-blue);
}

.map-edit-tip {
  color: var(--text-dim);
  font-size: 11px;
}

.map-edit-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* 档案编辑专用准星拖拽图标 */
.edit-crosshair-container {
  background: transparent !important;
  border: none !important;
}

.edit-crosshair-icon {
  position: relative;
  width: 32px;
  height: 32px;
  cursor: grab;
}

.edit-crosshair-icon:active {
  cursor: grabbing;
}

.edit-crosshair-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  transform: translate(-50%, -50%);
  background: #0071e3;
  border: 2.5px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #0071e3, 0 3px 8px rgba(0, 0, 0, 0.35);
}

.edit-crosshair-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  transform: translate(-50%, -50%);
  border: 1.5px dashed #0071e3;
  border-radius: 50%;
  animation: rotateCrosshair 8s linear infinite;
}

@keyframes rotateCrosshair {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.highlight-field {
  border-color: var(--accent-green) !important;
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.25) !important;
  transition: all 0.3s ease;
}
