/* =========================================================
   360 工程時序紀錄管理系統 - 專業工程圖台響應式樣式表
   ========================================================= */

:root {
  --bg-dark: #0f172a;
  --bg-panel: #1e293b;
  --bg-panel-hover: #293548;
  --bg-canvas: #0b1120;
  --border: #334155;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #f59e0b;
  --accent-hover: #d97706;
  --emerald: #10b981;
  --danger: #ef4444;
  --pin-scale: 1;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Microsoft JhengHei", "PingFang TC", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text-main);
  -webkit-tap-highlight-color: transparent;
}

body.readonly-mode .admin-only {
  display: none !important;
}

.hidden {
  display: none !important;
}

/* ---------- 頂部導覽列 ---------- */
.topbar {
  height: 56px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  gap: 10px;
  z-index: 30;
}

.topbar-left, .topbar-center, .topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 6px;
}

.brand-badge {
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  padding: 5px 8px;
  border-radius: 7px;
  letter-spacing: 0.5px;
}

.brand-titles {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.mode-pill {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 99px;
  width: fit-content;
  margin-top: 2px;
}

.mode-pill.admin {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.mode-pill.readonly {
  background: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ctrl-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.ctrl-select, .ctrl-input, .ctrl-textarea, .ctrl-input-sm {
  background: #0f172a;
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.ctrl-select:focus, .ctrl-input:focus, .ctrl-textarea:focus {
  border-color: var(--primary);
}

.ctrl-input-sm {
  padding: 3px 7px;
  font-size: 12px;
}

.segmented {
  display: inline-flex;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}

.seg-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.seg-btn.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* ---------- 通用按鈕 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 6px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-xs { padding: 4px 8px; font-size: 12px; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-lg { padding: 10px 18px; font-size: 14px; }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-accent {
  background: var(--accent);
  color: #111827;
}
.btn-accent:hover { background: var(--accent-hover); color: #fff; }

.btn-outline {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.45);
  color: #93c5fd;
}
.btn-outline:hover { background: rgba(59, 130, 246, 0.22); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border);
  color: var(--text-main);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.13); }

.btn-danger-ghost {
  background: transparent;
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}
.btn-danger-ghost:hover { background: rgba(239, 68, 68, 0.2); }

.btn-icon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.btn-icon:hover { background: rgba(255, 255, 255, 0.16); }

/* ---------- 主工作區佈局 ---------- */
.workspace {
  display: flex;
  height: calc(100vh - 56px);
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* ---------- 左側樓層欄 ---------- */
.floor-sidebar {
  width: 185px;
  flex-shrink: 0;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.sidebar-header {
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.floor-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.floor-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 11px;
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid transparent;
  color: var(--text-main);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.14s;
}

.floor-item:hover {
  background: var(--bg-panel-hover);
}

.floor-item.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--primary);
  color: #fff;
}

.floor-name {
  font-weight: 700;
  font-size: 14px;
}

.floor-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
}

.f-count {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  padding: 1px 6px;
  border-radius: 99px;
}

.floor-item.active .f-count {
  background: var(--primary);
  color: #fff;
}

.sidebar-legend {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.legend-title {
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 2px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
}

.dot-sample {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
  border: 1.5px solid #fff;
}
.dot-sample.pano { background: #10b981; }
.dot-sample.multi { background: #f59e0b; }
.dot-sample.single { background: #3b82f6; }

.legend-hint {
  margin-top: 4px;
  font-size: 11px;
  color: #64748b;
}

/* ---------- 中央平面圖區 ---------- */
.map-stage {
  flex: 1;
  position: relative;
  background: var(--bg-canvas);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.map-toolbar {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 15;
  background: rgba(30, 41, 59, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.tool-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
  color: var(--text-main);
  padding: 5px 9px;
  border-radius: 5px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.tool-btn:hover { background: rgba(255, 255, 255, 0.15); }
.tool-btn.active {
  background: var(--accent);
  color: #111827;
  font-weight: 700;
}

.tool-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 2px;
}

.pin-scale-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 0 4px;
}
.pin-scale-wrap input[type="range"] {
  width: 68px;
  accent-color: var(--primary);
}

.action-banner {
  position: absolute;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 16;
  background: rgba(245, 158, 11, 0.95);
  color: #111827;
  font-weight: 700;
  font-size: 13px;
  padding: 7px 16px;
  border-radius: 99px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.map-viewport {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.map-viewport.grabbing {
  cursor: grabbing;
}

.map-viewport.crosshair {
  cursor: crosshair;
}

.map-canvas {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  background: #fff;
  user-select: none;
}

#floorImage {
  display: block;
  max-width: none;
  pointer-events: none;
  user-select: none;
}

.pins-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pins-layer.hidden-pins {
  opacity: 0.08;
}

/* ---------- 平面圖測站圓點 ---------- */
.map-pin {
  position: absolute;
  transform: translate(-50%, -50%) scale(var(--pin-scale));
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 800;
  color: #fff;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  z-index: 2;
}

.map-pin.single {
  background: #2563eb;
}

.map-pin.multi {
  background: #f59e0b;
  color: #111827;
  border-color: #1e293b;
}

.map-pin.pano {
  background: #10b981;
  color: #052e16;
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.35), 0 2px 6px rgba(0,0,0,0.6);
}

.map-pin:hover {
  transform: translate(-50%, -50%) scale(calc(var(--pin-scale) * 1.38));
  z-index: 10;
}

.map-pin.selected {
  transform: translate(-50%, -50%) scale(calc(var(--pin-scale) * 1.48));
  box-shadow: 0 0 0 4px #ef4444, 0 4px 12px rgba(0, 0, 0, 0.8);
  z-index: 12;
}

.map-pin.merge-target {
  transform: translate(-50%, -50%) scale(calc(var(--pin-scale) * 1.72)) !important;
  box-shadow: 0 0 0 5px #f59e0b, 0 0 18px rgba(245, 158, 11, 0.95) !important;
  z-index: 18 !important;
}

.map-pin.dimmed {
  opacity: 0.16;
  filter: grayscale(0.8);
}

/* ---------- 底部批次待配點照片匣 ---------- */
.photo-tray {
  background: rgba(15, 23, 42, 0.96);
  border-top: 2px solid var(--primary);
  padding: 8px 12px;
  z-index: 18;
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 165px;
}

.tray-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.tray-title {
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tray-tip {
  color: #93c5fd;
  font-size: 12px;
}

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

.tray-date-label {
  font-size: 12px;
  color: var(--text-muted);
}

.tray-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tray-card {
  flex-shrink: 0;
  width: 148px;
  background: var(--bg-panel);
  border: 2px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.tray-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.4);
}

.tray-card img {
  width: 100%;
  height: 62px;
  object-fit: cover;
  display: block;
}

.tray-card-meta {
  padding: 4px 6px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tray-card-date {
  color: #34d399;
  font-weight: 700;
  font-size: 10.5px;
}

/* ---------- 拖放上傳遮罩 ---------- */
.drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.86);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.drop-box {
  border: 3px dashed var(--primary);
  border-radius: 16px;
  padding: 36px 48px;
  text-align: center;
  background: rgba(30, 41, 59, 0.9);
}

.drop-icon { font-size: 46px; margin-bottom: 10px; }
.drop-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.drop-sub { font-size: 13px; color: var(--text-muted); }

/* ---------- 右側測站時序抽屜 (桌機預設 1:1 等寬 + 自由拖拉分隔條) ---------- */
.station-drawer {
  position: relative;
  width: var(--drawer-width, calc((100vw - 185px) * 0.5));
  min-width: 340px;
  max-width: calc(100vw - 280px);
  flex-shrink: 0;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 25;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.45);
}

.drawer-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -5px;
  width: 10px;
  cursor: col-resize;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: none;
}

.drawer-resizer::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 4px;
  width: 2px;
  background: transparent;
  transition: background 0.15s;
}

.drawer-resizer:hover::before,
.drawer-resizer.dragging::before {
  background: var(--primary);
}

.resizer-grip {
  position: relative;
  background: #334155;
  color: #cbd5e1;
  border: 1px solid #475569;
  border-radius: 99px;
  font-size: 11px;
  line-height: 1;
  padding: 8px 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.drawer-resizer:hover .resizer-grip,
.drawer-resizer.dragging .resizer-grip {
  background: var(--primary);
  border-color: #60a5fa;
  color: #fff;
}

.drawer-header {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.drawer-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.station-code-badge {
  background: rgba(59, 130, 246, 0.22);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.4);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  white-space: nowrap;
}

.station-name-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 700;
  padding: 4px 6px;
  border-radius: 5px;
  font-family: inherit;
}
.station-name-input:not([readonly]):hover,
.station-name-input:not([readonly]):focus {
  background: #0f172a;
  border-color: var(--border);
  outline: none;
}

.drawer-header-btns {
  display: flex;
  gap: 5px;
}

/* 時間軸列 */
.timeline-bar {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.45);
}

.timeline-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.section-caption {
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
}

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

.timeline-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 3px;
}

.tl-tab {
  flex-shrink: 0;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text-muted);
  font-family: inherit;
  text-align: left;
  transition: all 0.14s;
}

.tl-tab:hover {
  border-color: #64748b;
  color: var(--text-main);
}

.tl-tab.active {
  background: rgba(59, 130, 246, 0.22);
  border-color: var(--primary);
  color: #fff;
}

.tl-date {
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
}

.tl-stage {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-tab.active .tl-stage {
  color: #bfdbfe;
}

/* 360 檢視容器 */
.viewer-container {
  flex: 1;
  min-height: 250px;
  position: relative;
  background: #050811;
  display: flex;
  flex-direction: column;
}

.pano-viewer-wrap {
  width: 100%;
  height: 100%;
  flex: 1;
  position: relative;
}

.pano-container {
  width: 100%;
  height: 100%;
}

.pano-float-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 10;
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}
.pano-float-btn:hover { background: var(--primary); }

.external-viewer-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ext-card {
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 20px;
  text-align: center;
  max-width: 360px;
  width: 100%;
}

.ext-icon { font-size: 36px; margin-bottom: 8px; }
.ext-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.ext-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }
.ext-open-btn { width: 100%; }

/* 紀錄屬性與備註欄 */
.record-meta-box {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
}

.meta-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px;
}

.meta-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-field label {
  font-size: 11.5px;
  color: var(--text-muted);
}

.ctrl-textarea {
  resize: none;
}

.admin-record-footer {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.footer-danger-group {
  display: flex;
  gap: 6px;
}

/* ---------- 雙視窗跨時序同步比對模態框 ---------- */
.compare-modal {
  position: fixed;
  inset: 0;
  background: #050811;
  z-index: 80;
  display: flex;
  flex-direction: column;
}

.compare-topbar {
  height: 54px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.compare-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
}

.compare-sub {
  color: #93c5fd;
  font-size: 13px;
}

.compare-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sync-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #fde68a;
  cursor: pointer;
}

.compare-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  background: var(--border);
}

.compare-pane {
  background: #090d16;
  display: flex;
  flex-direction: column;
  position: relative;
}

.compare-pane-bar {
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.pane-tag {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
}
.pane-tag.early { background: rgba(59, 130, 246, 0.25); color: #93c5fd; }
.pane-tag.late { background: rgba(16, 185, 129, 0.25); color: #6ee7b7; }

.compare-pano-box {
  flex: 1;
  width: 100%;
  height: 100%;
}

/* ---------- 通用 Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 17, 0.76);
  backdrop-filter: blur(4px);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 { font-size: 16px; }

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  font-size: 13.5px;
  line-height: 1.6;
}

.form-block {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-block label {
  font-size: 12.5px;
  font-weight: 600;
  color: #cbd5e1;
}

.info-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.code-line {
  font-family: Consolas, monospace;
  background: #090d16;
  color: #38bdf8;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  word-break: break-all;
  margin-top: 6px;
  border: 1px solid #1e293b;
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--primary);
  color: #fff;
  padding: 9px 16px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* ---------- 手機版響應式最佳化 ---------- */
@media (max-width: 900px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 6px;
  }
  .brand-name { font-size: 13px; }
  .ctrl-label { display: none; }

  .workspace {
    flex-direction: column;
    height: calc(100vh - 92px);
  }

  .floor-sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-header, .sidebar-legend {
    display: none;
  }
  .floor-list {
    flex-direction: row;
    overflow-x: auto;
    padding: 6px 8px;
  }
  .floor-item {
    padding: 6px 12px;
    flex-shrink: 0;
    gap: 6px;
  }

  .pin-scale-wrap { display: none; }

  .station-drawer {
    position: fixed;
    inset: auto 0 0 0;
    width: 100% !important;
    min-width: 0;
    max-width: 100vw;
    height: 76vh;
    border-left: none;
    border-top: 2px solid var(--primary);
    border-radius: 14px 14px 0 0;
  }

  .drawer-resizer,
  .desktop-only-btn {
    display: none !important;
  }

  .compare-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
}
