/* Spatial structure: directory → globe → selected factory. */
.dashboard {
  --header-height: 80px;
  --rail-space: 320px;
  --detail-space: 0px;
  --surface-gap: 16px;
  background: #09131e;
}
.dashboard.detail-open { --detail-space: 360px; }
.dashboard.directory-collapsed { --rail-space: 16px; }
.topbar {
  height: var(--header-height); inset: 0 24px auto; gap: 24px;
  border-bottom: 0;
}
.brand-mark { font-size: 36px; }
.brand-name { font-size: 20px; }
.page-title { font-size: 19px; padding-left: 24px; letter-spacing: .04em; }
.page-title > span { font-size: 11px; margin-top: 5px; }
.directory-toggle { min-height: 40px; margin-left: 8px; padding: 0 12px; color: var(--muted); font-size: 12px; border-radius: 6px; }
.top-meta { gap: 16px; }
.workspace { inset: calc(var(--header-height) + 16px) 16px 16px; }
#globe, .edge-shade {
  top: calc(var(--header-height) + 16px); left: var(--rail-space); right: calc(var(--detail-space) + 16px); bottom: 16px;
  border-radius: 12px; overflow: hidden;
}
.edge-shade {
  background: linear-gradient(180deg, #050b135c, transparent 25%, transparent 60%, #050b13cc);
}
.directory {
  inset: 0 auto 0 0; width: 288px;
  background: #0d1c29; border-color: #bed9ea18; border-radius: 12px;
}
.directory-collapsed .directory { display: none; }
.directory-heading { padding: 20px 20px 12px; }
.directory-heading h1 { font-size: 19px; }
.directory-heading > span { font-size: 12px; }
.overview { gap: 20px; font-size: 12px; padding-bottom: 20px; }
.overview b { font-size: 14px; }
.search { height: 44px; margin-bottom: 12px; }
.search input { font-size: 13px; }
.filter-row { gap: 20px; }
.filter { height: 44px; font-size: 13px; }
.factory-list { min-height: 0; padding: 0 8px; overscroll-behavior: contain; }
.factory-row { padding: 14px 12px; }
.row-top strong { font-size: 15px; }
.row-location { font-size: 12px; margin-top: 6px; }
.row-bottom { margin-top: 10px; font-size: 11px; }
.factory-row.selected { background: #a7e6d613; }
.directory-foot { font-size: 11px; min-height: 44px; }
.region-nav {
  top: 4px; left: calc(var(--rail-space) + 8px); transform: none;
  padding: 4px; border-radius: 8px; background: #0b1824e8;
}
.region-nav button { min-height: 40px; min-width: 64px; font-size: 13px; padding: 0 16px; }
.view-caption { left: calc(var(--rail-space) + 16px); bottom: 112px; max-width: calc(100% - var(--rail-space) - 48px); }
.view-caption h2 { font-size: clamp(20px, 1.7vw, 28px); margin-bottom: 8px; }
.view-caption p { font-size: 12px; line-height: 1.8; }
.view-line { width: 28px; margin-bottom: 12px; }
.bottom-bar {
  left: calc(var(--rail-space) + 24px); right: calc(var(--detail-space) + 40px);
  bottom: 40px; height: auto; min-height: 44px;
  border: 0; gap: 16px; flex-wrap: wrap;
}
.view-info { gap: 12px; font-size: 11px; }
.map-controls { margin-left: auto; background: #0c1c29ed; padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; gap: 2px; }
.map-controls button { min-height: 40px; height: auto; padding: 0 12px; white-space: nowrap; }
.map-controls .zoom { width: 40px; min-width: 40px; }
.cesium-viewer-bottom { left: 12px !important; bottom: 8px !important; max-width: calc(100% - 24px); }
.cesium-credit-textContainer, .cesium-credit-logoContainer { font-size: 10px !important; }
.detail {
  top: 0; bottom: 0; right: 0; width: 344px; padding: 12px 24px 0;
  display: flex; flex-direction: column; overflow: hidden; border-radius: 12px; background: #0d1c29;
}
.detail-top, .detail > h2, .detail-meta, .detail-actions { flex-shrink: 0; }
.detail-top { font-size: 12px; gap: 12px; }
.detail h2 { font-size: 26px; margin: 8px 0 12px; overflow-wrap: anywhere; }
.detail-meta { gap: 8px; flex-wrap: wrap; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.status-label { font-size: 12px; }
#detail-coordinates { font-size: 11px; }
.detail-scroll { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #60788a60 transparent; overscroll-behavior: contain; margin-right: -12px; padding-right: 12px; }
.detail-person { margin-top: 0; border-top: 0; padding: 20px 0; justify-content: space-between; gap: 12px; }
.detail-person > span { font-size: 11px; }
.detail-person strong { font-size: 13px; }
.detail-section { margin-top: 24px; }
.detail-section h3 { font-size: 12px; }
.detail-section p { font-size: 14px; overflow-wrap: anywhere; }
.history-section li p { font-size: 12px; }
.history-section time { font-size: 11px; }
.history-section { padding-bottom: 24px; }
.detail-actions { margin: 0 -24px; padding: 16px 24px; border-top: 1px solid var(--line); background: #0f2130; }
.detail-actions .primary-button { min-height: 46px; }
.demo-note { font-size: 10px; margin-top: 10px; }
.cache-panel { right: 40px; bottom: 104px; max-height: calc(100dvh - 128px); overflow: auto; }
.loading { left: calc(var(--rail-space) + (100% - var(--rail-space) - var(--detail-space)) / 2); }
.notice { bottom: 106px; }

@media (min-width: 1800px) {
  .dashboard { --rail-space: 352px; }
  .dashboard.detail-open { --detail-space: 392px; }
  .directory { width: 320px; }
  .detail { width: 376px; }
  .factory-row { padding: 18px 16px; }
  .row-top strong { font-size: 16px; }
  .directory-heading h1 { font-size: 21px; }
}
@media (max-width: 1350px) {
  .view-info { display: none; }
  .bottom-bar { justify-content: flex-end; }
}
@media (min-width: 701px) and (max-width: 1100px) {
  .dashboard { --rail-space: 288px; }
  .directory { width: 256px; }
  .overview { gap: 12px; padding-left: 16px; }
  .region-nav button { padding: 0 12px; min-width: 56px; }
  .dashboard.detail-open { --rail-space: 16px; --detail-space: 344px; }
  .detail-open .directory-toggle { visibility: hidden; }
  .detail { width: 328px; }
  .detail-open .directory { display: none; }
  .detail-open .region-nav button { padding: 0 8px; min-width: 44px; }
  .detail-open .map-controls button { padding: 0 8px; }
  .detail-open .map-controls { flex-wrap: wrap; justify-content: flex-end; }
  .page-title { font-size: 17px; }
  .directory-toggle { margin-left: 0; }
}
@media (max-width: 700px) {
  .dashboard, .dashboard.detail-open, .dashboard.directory-collapsed { --header-height: 72px; --map-height: 420px; --rail-space: 0px; --detail-space: 0px; min-height: 100dvh; height: auto; overflow: auto; }
  .topbar { left: 16px; right: 16px; gap: 16px; }
  .brand-mark { font-size: 30px; }
  .brand-name { font-size: 16px; }
  .page-title { font-size: 15px; padding-left: 16px; }
  .top-meta { margin-left: auto; }
  .directory-toggle { display: none; }
  #globe, .edge-shade { top: var(--header-height); left: 0; right: 0; bottom: auto; height: var(--map-height); min-height: 0; border-radius: 0; }
  .workspace { position: relative; inset: auto; padding-top: calc(var(--header-height) + var(--map-height)); min-height: 0; }
  .directory, .directory-collapsed .directory { display: flex; position: relative; inset: auto; width: auto; margin: 0 12px 24px; max-height: none; }
  .detail-open .directory { display: none; }
  .factory-list { max-height: none; overflow: visible; padding: 0 8px; }
  .factory-row { padding: 16px 12px; }
  .directory-heading { padding: 20px 20px 12px; }
  .overview { padding-bottom: 16px; }
  .region-nav { position: absolute; top: calc(var(--header-height) + 12px); left: 16px; width: auto; max-width: calc(100vw - 32px); transform: none; }
  .region-nav button { font-size: 12px; min-width: 56px; padding: 0 12px; min-height: 40px; }
  .view-caption { top: calc(var(--header-height) + var(--map-height) - 184px); bottom: auto; left: 20px; max-width: calc(100% - 40px); }
  .view-caption h2 { font-size: 21px; }
  .view-caption p { font-size: 11px; max-width: 32ch; }
  .bottom-bar { position: absolute; top: calc(var(--header-height) + var(--map-height) - 84px); bottom: auto; left: 12px; right: 12px; height: 52px; padding: 0; background: none; }
  .map-controls { width: 100%; margin: 0; padding: 4px; gap: 0; justify-content: space-between; font-size: 11px; }
  .map-controls button { padding: 0 8px; }
  .map-controls > span { margin: 0 2px; }
  .map-controls #reset span { display: none; }
  .map-controls .zoom { min-width: 36px; width: 36px; }
  .detail { position: relative; inset: auto; width: auto; margin: 0 12px 24px; max-height: none; padding: 12px 20px 0; scroll-margin-top: 12px; }
  .detail-scroll { overflow: visible; margin: 0; padding: 0; }
  .detail-actions { margin: 0 -20px; padding: 16px 20px; }
  .detail-person { justify-content: flex-start; gap: 40px; }
  .cache-panel { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); width: calc(100% - 32px); max-height: calc(100dvh - 32px); }
  .loading { top: 240px; left: 50%; }
  .notice { position: fixed; bottom: 20px; }
  .cesium-viewer-bottom { left: 12px !important; bottom: 6px !important; }
}
@media (max-height: 650px) and (min-width: 701px) {
  .dashboard { --header-height: 64px; min-height: 450px; }
  .topbar .page-title > span { display: none; }
  .view-caption { bottom: 112px; }
  .view-caption h2 { font-size: 20px; }
  .directory-heading { padding-top: 16px; }
  .overview { padding-bottom: 12px; }
  .detail-person { padding: 12px 0; }
}

.height-control { position:absolute; z-index:8; top:calc(var(--header-height) + 84px); right:calc(var(--detail-space) + 40px); width:240px; padding:14px 16px 10px; border:1px solid var(--line); border-radius:8px; background:#0d1c29ed; }
.height-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; font-size:12px; color:#b7cddd; }
#camera-height-slider { display:block; width:100%; height:32px; margin:4px 0 0; accent-color:#9ae4d3; cursor:ew-resize; }
#camera-height-slider:focus-visible { outline:2px solid #9ae4d3; outline-offset:2px; }
.height-scale { display:flex; justify-content:space-between; gap:8px; font-size:10px; color:#a1b6c8; }
.presenting .height-control { display:none; }
@media(max-width:700px) {
  .height-control { top:140px; right:12px; width:204px; padding:10px 12px 8px; }
}
