/* ===== 基础变量 ===== */
:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-hover: #475569;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-hover: #0ea5e9;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --border: rgba(148, 163, 184, 0.2);
  --radius: 8px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --sidebar-width: 280px;
  --header-height: 64px;
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ===== 顶部工具栏 ===== */
.top-bar {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  box-shadow: var(--shadow);
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand .logo {
  font-size: 28px;
}

.brand h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.brand small {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.tool-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tool-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}

.tool-btn.active {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
  font-weight: 600;
}

.tool-btn.danger {
  border-color: rgba(239, 68, 68, 0.4);
}

.tool-btn.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--danger);
}

.tool-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  margin: 0 4px;
}

/* ===== 主容器 ===== */
.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===== 侧边栏通用（桌面端悬浮抽屉） ===== */
.left-sidebar,
.right-sidebar {
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 50;
  transform: translateX(calc(-100% + 14px));
  transition: transform 0.25s ease;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
}

.left-sidebar:hover,
.left-sidebar:focus-within {
  transform: translateX(0);
}

.right-sidebar {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 1px solid var(--border);
  transform: translateX(calc(100% - 14px));
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.25);
}

.right-sidebar:hover,
.right-sidebar:focus-within {
  transform: translateX(0);
}

/* 扩展 hover 触发区：隐藏时仍在地图边缘留一条可触发条 */
.left-sidebar::before,
.right-sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 24px;
  z-index: -1;
}

.left-sidebar::before {
  right: -24px;
}

.right-sidebar::before {
  left: -24px;
}

/* 提示条：侧边栏缩回时显示在边缘 */
.left-sidebar::after,
.right-sidebar::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 4px;
  height: 40px;
  margin-top: -20px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.left-sidebar::after {
  right: 5px;
}

.right-sidebar::after {
  left: 5px;
}

.left-sidebar:hover::after,
.right-sidebar:hover::after,
.left-sidebar:focus-within::after,
.right-sidebar:focus-within::after {
  opacity: 0;
}

.panel {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.panel h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===== 统计面板 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 6px;
}

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

/* 部门筛选模式：统计面板部门标签 + 清除按钮 */
.stats-dept-tag.hidden,
.btn-clear-dept.hidden {
  display: none;
}

.stats-dept-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--bg-hover);
  padding: 2px 8px;
  border-radius: 10px;
  vertical-align: middle;
}

.btn-clear-dept {
  width: 100%;
  margin-top: 10px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-clear-dept:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--bg-hover);
}

/* 图例：部门筛选激活高亮 */
.legend-item.active-dept {
  background: var(--bg-hover);
  border: 1px solid var(--accent);
}

.legend-item.active-dept .legend-name {
  color: var(--accent);
  font-weight: 600;
}

/* ===== 楼层筛选面板 ===== */
.floor-panel {
  padding: 14px 16px;
}

.floor-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.floor-select {
  width: 100%;
  padding: 7px 12px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: var(--bg-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 10px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%23ffffff' d='M6 8L1 3h10z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.3);
}

.floor-select:hover {
  opacity: 0.9;
}

.floor-select:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.4);
}

.floor-select option {
  background: #000000;
  color: #ffffff;
  font-weight: 500;
}

.floor-info {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.floor-info #floor-count {
  color: var(--accent);
  font-weight: 600;
}

/* ===== 搜索面板 ===== */
.search-panel input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

.search-panel input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.search-results {
  margin-top: 10px;
  max-height: 220px;
  overflow-y: auto;
}

.result-item {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.result-item:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.result-item .result-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.result-item .result-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.result-item .result-dept {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

/* ===== 图例面板 ===== */
.legend-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.15s ease;
}

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

.legend-locate {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.legend-locate .legend-name {
  cursor: pointer;
  transition: color 0.15s ease;
}

.legend-locate:hover .legend-name {
  color: var(--accent);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* 工位状态图例说明（双色圆点：外圈=状态色 / 内圈=部门色） */
.legend-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 11px;
  color: var(--text-secondary);
  padding: 8px 6px;
  margin-bottom: 8px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: var(--bg-hover);
}

.legend-status .legend-dot {
  width: 10px;
  height: 10px;
  margin-right: 3px;
}

.legend-status .legend-hint {
  width: 100%;
  font-size: 10px;
  opacity: 0.75;
}

.legend-toggle {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 24px;
  height: 24px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  opacity: 0.6;
}

.legend-toggle:hover {
  opacity: 1;
  background: var(--bg-hover);
  border-color: var(--accent);
}

.legend-item.hidden-dept {
  opacity: 0.4;
}

.legend-item.hidden-dept .legend-name {
  text-decoration: line-through;
}

/* ===== 显示设置 ===== */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.toggle-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* ===== 地图容器 ===== */
.map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-wrapper {
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: grab;
  position: relative;
}

.map-wrapper:active {
  cursor: grabbing;
}

.map-wrapper.add-mode {
  cursor: crosshair;
}

.map-wrapper.edit-mode {
  cursor: pointer;
}

.map-transform {
  position: absolute;
  transform-origin: 0 0;
  transition: transform 0.1s ease-out;
  will-change: transform;
}

.floor-plan {
  display: block;
  max-width: none;
  max-height: none;
  user-select: none;
  pointer-events: none;
  filter: invert(1) contrast(1.2);
}

.light-bg .floor-plan {
  filter: none;
}

.desk-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 2526px;
  height: 1785px;
  overflow: visible;
  pointer-events: all;
}

.desk-marker {
  cursor: pointer;
  transition: all 0.15s ease;
}

.desk-marker:hover {
  stroke: #fff;
  stroke-width: 2px;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.6));
}

.desk-marker.selected {
  stroke: #fff;
  stroke-width: 3px;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.8));
}

.desk-marker.matched {
  animation: pulse 1s ease-in-out infinite;
}

.desk-marker.hidden {
  display: none;
}

.desk-label {
  font-size: 10px;
  fill: rgba(255, 255, 255, 0.9);
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  user-select: none;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.light-bg .desk-label {
  fill: rgba(0, 0, 0, 0.85);
  text-shadow: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 搜索匹配的下指箭头定位标记 */
.desk-locator {
  animation: locator-bounce 1s ease-in-out infinite;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  pointer-events: none;
}

@keyframes locator-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
}

.map-controls {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 50;
}

.map-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.mode-badge {
  position: absolute;
  left: 16px;
  top: 16px;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  z-index: 50;
  box-shadow: var(--shadow);
}

/* ===== 详情面板 ===== */
.detail-empty {
  text-align: center;
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.detail-content.hidden {
  display: none;
}

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

.detail-code {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

.detail-status {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
}

.status-occupied { background: rgba(34, 197, 94, 0.2); color: var(--success); }
.status-vacant { background: rgba(148, 163, 184, 0.2); color: var(--text-muted); }
.status-maintenance { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.status-reserved { background: rgba(245, 158, 11, 0.2); color: var(--warning); }

.detail-row {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  width: 60px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.detail-value {
  color: var(--text-primary);
  word-break: break-all;
}

/* ===== 编辑面板 ===== */
.edit-panel {
  border: 1px solid var(--accent);
  background: rgba(56, 189, 248, 0.05);
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

/* 修复下拉选项看不清：白字黑底 */
.form-group select option {
  background: #000000;
  color: #ffffff;
  padding: 8px 11px;
  font-weight: 500;
}

.form-row {
  display: flex;
  gap: 10px;
}

.form-group.half {
  flex: 1;
  margin-bottom: 0;
}

.form-group input[type="range"] {
  padding: 0;
  margin: 8px 0;
}

.range-value {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.btn-primary,
.btn-secondary,
.btn-danger {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  flex: 1;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.4);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-danger.full,
.btn-secondary.full {
  width: 100%;
  margin-bottom: 8px;
}

/* ===== Tooltip ===== */
.tooltip {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  max-width: 260px;
  backdrop-filter: blur(8px);
}

.tooltip.hidden {
  display: none;
}

/* ===== Toast 通知 ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 2000;
  background: var(--bg-secondary, #1e293b);
  color: var(--text-primary, #f1f5f9);
  border: 1px solid var(--border, #334155);
  border-left: 4px solid var(--accent, #3b82f6);
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  max-width: 90vw;
}

.toast.hidden {
  display: none;
}

.toast.toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.tooltip-code {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.tooltip-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.tooltip-dept {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.tooltip-status {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  margin-top: 4px;
}

/* ===== 弹窗 ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 90%;
  max-width: 560px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

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

.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  max-height: 70vh;
  font-size: 13px;
  line-height: 1.7;
}

.modal-body p {
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.modal-body ul {
  margin-left: 18px;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.modal-body li {
  margin-bottom: 8px;
}

.modal-body input[type="file"] {
  width: 100%;
  padding: 10px 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.modal-body textarea {
  width: 100%;
  padding: 12px;
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: monospace;
  font-size: 12px;
  resize: vertical;
}

/* ===== 导入预览 ===== */
.import-preview {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-primary);
  padding: 12px;
  max-height: 300px;
  overflow: auto;
}

.import-preview.hidden {
  display: none;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.preview-table th {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 6px 8px;
  text-align: left;
  border: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.preview-table td {
  padding: 5px 8px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ===== 部门管理弹窗 ===== */
.dept-form {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}

.dept-form .form-group {
  margin-bottom: 0;
}

.dept-form input[type="color"] {
  height: 38px;
  padding: 2px;
  cursor: pointer;
}

.dept-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.dept-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background 0.15s ease;
}

.dept-item:hover {
  background: var(--bg-tertiary);
}

.dept-color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.dept-info {
  flex: 1;
  min-width: 0;
}

.dept-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dept-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

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

.dept-actions button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.dept-actions button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-hover);
}

/* ===== 响应式（手机端详细适配见文件末尾） ===== */
@media (max-width: 1200px) {
  .left-sidebar,
  .right-sidebar {
    width: 240px;
  }
}

/* 注：max-width: 900px 的 column 布局已被文件末尾的抽屉式方案取代 */

/* ===== 登录页面 ===== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-overlay.hidden {
  display: none;
}

.login-box {
  width: 400px;
  max-width: 90vw;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-brand .logo {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

.login-brand h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.login-brand p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 1px;
}

.login-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 4px;
}

.login-tab {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.login-tab.active {
  background: var(--accent);
  color: var(--bg-primary);
}

.login-form.hidden {
  display: none;
}

.login-btn {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  margin-top: 8px;
}

.login-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 16px;
}

/* ===== 飞书授权登录 ===== */
.feishu-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #3370ff;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s ease;
}

.feishu-login-btn:hover {
  background: #2b5fd9;
}

.feishu-login-btn svg {
  flex-shrink: 0;
}

.login-error {
  text-align: center;
  font-size: 13px;
  color: #ef4444;
  margin-top: 12px;
  line-height: 1.5;
}

/* ===== 用户信息 ===== */
.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.role-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 10px;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent);
}

.role-badge.employee {
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-muted);
}

#user-name {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* ===== 角色控制 ===== */
body.role-employee .admin-only {
  display: none !important;
}

body.role-employee .edit-panel {
  display: none !important;
}

/* 三端口权限：super-only 仅总管理员可见，emp-only 仅员工可见 */
body:not(.role-superadmin) .super-only {
  display: none !important;
}

body:not(.role-employee) .emp-only {
  display: none !important;
}

/* ===== 管理员后台弹窗 ===== */
.modal-lg {
  max-width: 800px;
}

.dash-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.dash-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.dash-card-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.dash-card-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.dash-card-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.dash-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.dash-table th {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 8px 10px;
  text-align: left;
  position: sticky;
  top: 0;
  white-space: nowrap;
}

.dash-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  color: var(--text-secondary);
}

.dash-table tr:hover td {
  background: var(--bg-tertiary);
}

.dash-table .color-cell {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  display: inline-block;
}

.dash-bar-cell {
  width: 120px;
}

.dash-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  overflow: hidden;
}

.dash-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.dash-status-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dash-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-status-label {
  width: 80px;
  font-size: 12px;
  color: var(--text-secondary);
}

.dash-status-track {
  flex: 1;
  height: 20px;
  background: var(--bg-primary);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.dash-status-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.dash-status-count {
  width: 60px;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ===== 飞书同步 ===== */
.feishu-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

.feishu-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.feishu-status-dot.active {
  background: var(--success);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

.feishu-status-dot.syncing {
  background: var(--warning);
  animation: pulse 1s ease-in-out infinite;
}

.feishu-status-dot.error {
  background: var(--danger);
}

.field-mapping {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.mapping-row .map-feishu {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 12px;
}

.mapping-row .map-arrow {
  color: var(--text-muted);
  font-size: 14px;
}

.mapping-row .map-target {
  width: 80px;
  font-size: 12px;
  color: var(--text-secondary);
  text-align: right;
  flex-shrink: 0;
}

.feishu-sync-log {
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-secondary);
  max-height: 150px;
  overflow-y: auto;
  font-family: monospace;
}

.feishu-sync-log.hidden {
  display: none;
}

/* ===== 部门员工迁移面板 ===== */
.dept-reassign-panel {
  margin-top: 14px;
  padding: 16px;
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius);
  animation: slideDown 0.2s ease-out;
}

.dept-reassign-panel.hidden {
  display: none;
}

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

.reassign-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.reassign-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--danger);
  margin: 0;
  padding: 0;
  border: none;
}

.reassign-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.reassign-close:hover {
  color: var(--text-primary);
}

.reassign-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.6;
}

.reassign-desc strong {
  color: var(--danger);
  font-size: 15px;
}

.reassign-emp-list-wrap {
  margin: 12px 0;
}

.reassign-emp-list-title {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.reassign-emp-list {
  max-height: 140px;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.reassign-emp-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.reassign-emp-chip .chip-arrow {
  color: var(--text-muted);
  font-size: 10px;
}

.reassign-emp-chip .chip-target {
  color: var(--accent);
  font-weight: 600;
}

#reassign-target-dept {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

#reassign-target-dept:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

/* ===== 飞书绑定指南 ===== */
.feishu-guide {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-primary);
}

.guide-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.guide-toggle:hover {
  background: var(--bg-tertiary);
}

.guide-toggle-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.guide-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.guide-arrow.expanded {
  transform: rotate(90deg);
}

.guide-content {
  padding: 0 14px 14px;
  border-top: 1px solid var(--border);
}

.guide-content.hidden {
  display: none;
}

.guide-step {
  display: flex;
  gap: 12px;
  margin-top: 14px;
}

.guide-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg-primary);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.guide-step-body {
  flex: 1;
  min-width: 0;
}

.guide-step-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.guide-step-body p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.6;
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin: 8px 0;
  border-radius: 4px;
  overflow: hidden;
}

.guide-table th {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 6px 8px;
  text-align: left;
  white-space: nowrap;
}

.guide-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.guide-table tr:last-child td {
  border-bottom: none;
}

.guide-code {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 11px;
  color: var(--text-secondary);
  word-break: break-all;
  margin: 6px 0;
}

.guide-code .hl {
  color: var(--warning);
  font-weight: 600;
}

.guide-link {
  color: var(--accent);
  text-decoration: none;
}

.guide-link:hover {
  text-decoration: underline;
}

.guide-perm-list {
  margin: 6px 0;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.guide-perm-item {
  font-size: 12px;
  color: var(--success);
  padding: 2px 0;
}

.guide-step-body code {
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  color: var(--warning);
  font-family: "Consolas", "Monaco", monospace;
}

/* ===== 换工位弹窗 ===== */
.change-current-info {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
}

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

.change-info-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.change-desk-search-wrap {
  margin-bottom: 8px;
}

.change-desk-search-wrap input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
}

.change-desk-list {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
}

.change-desk-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  transition: background 0.15s;
}

.change-desk-item:last-child {
  border-bottom: none;
}

.change-desk-item:hover {
  background: rgba(59, 130, 246, 0.1);
}

.change-desk-item.selected {
  background: rgba(59, 130, 246, 0.2);
  border-left: 3px solid var(--accent);
}

.change-desk-code {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.change-desk-empty {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 14px;
}

.change-desk-action {
  margin-top: 8px;
}

.change-desk-action .btn-primary {
  font-size: 14px;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s;
}

.change-desk-action .btn-primary:hover {
  background: #2563eb;
}

/* 认领工位弹窗 */
#claim-desk-modal .modal-body .form-group {
  margin-bottom: 14px;
}

#claim-desk-modal .form-group label {
  font-size: 13px;
  color: #666;
  margin-bottom: 4px;
  display: block;
}

#claim-desk-modal .form-group input,
#claim-desk-modal .form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #334155;
  border-radius: 6px;
  font-size: 14px;
  background: #0f172a;
  color: #f8fafc;
  color-scheme: dark;
  transition: border-color 0.2s;
}

#claim-desk-modal .form-group select option {
  background: #000000;
  color: #ffffff;
}

#claim-desk-modal .form-group input::placeholder {
  color: #94a3b8;
}

#claim-emp-name {
  border-color: #10b981;
}

/* ===== 自定义下拉框（黑底白字）===== */
.custom-select {
  position: relative;
  width: 100%;
}
.custom-select-trigger {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #334155;
  border-radius: 6px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.custom-select-trigger:hover {
  border-color: #10b981;
}
.custom-select-arrow {
  font-size: 12px;
  color: #94a3b8;
  flex-shrink: 0;
  margin-left: 8px;
}
.custom-select-options {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: #000000;
  border: 1px solid #334155;
  border-radius: 6px;
  z-index: 1000;
  margin-top: 2px;
}
.custom-select-options.open {
  display: block;
}
.custom-select-option {
  padding: 8px 12px;
  color: #ffffff;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.1s;
}
.custom-select-option:hover {
  background: #1a1a1a;
}
.custom-select-option.selected {
  background: #10b981;
  color: #ffffff;
}

#claim-desk-modal .btn-primary {
  background: #10b981;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s;
  font-size: 14px;
  padding: 10px 20px;
}

#claim-desk-modal .btn-primary:hover:not(:disabled) {
  background: #059669;
}

#claim-desk-modal .btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
}

#claim-desk-modal .btn-secondary {
  background: #f5f5f5;
  color: #666;
  border: 1px solid #ddd;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  padding: 10px 20px;
  transition: background 0.2s;
}

#claim-desk-modal .btn-secondary:hover {
  background: #e5e5e5;
}

/* ===================================================================
   移动端适配（手机 / 平板竖屏）
   1. .mobile-only 类元素默认隐藏，<=768px 才显示
   2. 汉堡菜单按钮、详情按钮控制侧边栏抽屉
   3. 工具栏折叠只保留核心按钮
   4. 侧边栏变为从左/右滑入的抽屉
   5. 地图占满剩余空间
   6. 弹窗接近全屏
   =================================================================== */

.mobile-only {
  display: none !important;
}

.btn-menu {
  font-size: 20px;
  padding: 6px 10px;
  line-height: 1;
}

.btn-detail {
  font-size: 18px;
  padding: 6px 10px;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 768px) {
  /* 顶部工具栏 */
  .mobile-only {
    display: flex !important;
  }

  .top-bar {
    padding: 0 10px;
    gap: 6px;
  }

  .brand {
    gap: 6px;
    flex: 1;
    min-width: 0;
  }

  .brand .logo {
    font-size: 22px;
  }

  .brand-text h1 {
    font-size: 15px;
  }

  .brand-text small {
    display: none;
  }

  /* 工具栏：只保留 浏览 / 重置视图 / 帮助 / 用户区；admin 按钮折叠进左侧栏 */
  .toolbar {
    gap: 4px;
    flex: 0 0 auto;
  }

  .tool-btn {
    padding: 6px 8px;
    font-size: 12px;
    gap: 3px;
  }

  .tool-btn .btn-label {
    display: none; /* 手机端只显示图标 */
  }

  .tool-btn.active .btn-label,
  #btn-logout .btn-label {
    display: none;
  }

  .divider {
    margin: 0 2px;
    height: 22px;
  }

  /* 手机端隐藏：模板/导入/导出/部门/统计后台/飞书同步/删除/添加/编辑（这些归入汉堡菜单的折叠区）
     但是 admin 用户也需要能操作，所以我们让 toolbar 滚动而不是隐藏 */
  .toolbar {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    max-width: 100%;
  }

  .toolbar::-webkit-scrollbar {
    display: none;
  }

  .user-info {
    gap: 4px;
  }

  .user-info #user-name {
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
  }

  /* 主容器：保持 flex row，但侧边栏变成抽屉 */
  .main-container {
    flex-direction: row;
    overflow: visible;
  }

  /* 左侧栏：抽屉式，从左滑入 */
  .left-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: 85vw;
    max-width: 320px;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    border-right: 1px solid var(--border);
  }

  .left-sidebar.open {
    transform: translateX(0);
  }

  /* 右侧栏：抽屉式，从右滑入 */
  .right-sidebar {
    position: fixed;
    top: var(--header-height);
    right: 0;
    bottom: 0;
    width: 85vw;
    max-width: 320px;
    z-index: 300;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    border-left: 1px solid var(--border);
  }

  .right-sidebar.open {
    transform: translateX(0);
  }

  /* 移动端禁用桌面 hover 触发条与提示条 */
  .left-sidebar::before,
  .right-sidebar::before,
  .left-sidebar::after,
  .right-sidebar::after {
    display: none;
  }

  /* 地图区：占满剩余空间 */
  .map-container {
    flex: 1;
    height: calc(100vh - var(--header-height));
  }

  /* 地图控制按钮变大方便触屏 */
  .map-controls {
    bottom: 16px;
    right: 16px;
  }

  .map-btn {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }

  /* 模式徽章 */
  .mode-badge {
    top: 12px;
    left: 12px;
    font-size: 11px;
    padding: 4px 10px;
  }

  /* 弹窗接近全屏 */
  .modal {
    padding: 0;
  }

  .modal-content {
    max-width: 100vw !important;
    width: 100vw !important;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }

  .modal-lg {
    max-width: 100vw !important;
  }

  .modal-body {
    padding: 14px;
  }

  /* 统计卡片 */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .stat-value {
    font-size: 18px;
  }

  /* 搜索结果 */
  .search-results {
    max-height: 40vh;
  }

  /* 详情面板表单 */
  .form-row {
    flex-direction: column;
  }

  .form-group.half {
    width: 100%;
  }

  /* 表格横向滚动 */
  .dash-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .dash-table {
    min-width: 500px;
  }

  .dash-overview {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }

  /* 登录框 */
  .login-box {
    width: 92vw;
    padding: 28px 20px;
  }

  .login-brand .logo {
    font-size: 40px;
  }

  .login-brand h1 {
    font-size: 18px;
  }

  /* 工位编号文字在小屏上更小 */
  .desk-marker text {
    font-size: 10px;
  }
}

/* 平板竖屏（769px~1024px）：侧边栏变窄，地图更大 */
@media (min-width: 769px) and (max-width: 1024px) {
  .left-sidebar,
  .right-sidebar {
    width: 220px;
  }

  .tool-btn .btn-label {
    font-size: 12px;
  }
}

/* ===== 全屏模式（平面图全屏） ===== */

/* 应用内 CSS 全屏：隐藏顶部栏和侧边栏，让地图占满整个视口 */
body.fs-mode {
  /* 不改变 body 布局，但隐藏主要 UI */
}

body.fs-mode .top-bar,
body.fs-mode .left-sidebar,
body.fs-mode .right-sidebar,
body.fs-mode #btn-detail {
  display: none !important;
}

body.fs-mode .main-container {
  flex: 1;
  height: 100vh;
}

/* 浏览器原生全屏：让背景纯净 */
.map-container:fullscreen,
.map-container:-webkit-full-screen {
  background: #000;
  width: 100vw;
  height: 100vh;
}

.map-container:fullscreen .map-controls,
.map-container:-webkit-full-screen .map-controls {
  right: 24px;
  bottom: 24px;
}

/* 浮动退出全屏按钮（仅在全屏模式下显示） */
.fs-exit {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(20, 20, 25, 0.78);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: all 0.15s ease;
}

.fs-exit:hover {
  background: rgba(40, 40, 50, 0.92);
  border-color: rgba(255, 255, 255, 0.32);
  transform: translateY(-1px);
}

.fs-exit:active {
  transform: translateY(0);
}

.fs-exit-icon {
  font-size: 16px;
  line-height: 1;
}

.fs-exit-hint {
  font-size: 11px;
  opacity: 0.7;
  margin-left: 4px;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

body.fs-mode .fs-exit {
  display: inline-flex;
}

/* 全屏按钮激活样式 */
.tool-btn.fs-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.tool-btn.fs-active:hover {
  background: var(--accent-hover, var(--accent));
  color: #fff;
}

/* 全屏模式下隐藏侧边栏过渡（避免生硬） */
body.fs-mode .top-bar,
body.fs-mode .left-sidebar,
body.fs-mode .right-sidebar {
  pointer-events: none;
}

/* 侧边栏展开时，地图控件自动避让 */
.left-sidebar:hover ~ .map-container .mode-badge,
.left-sidebar:focus-within ~ .map-container .mode-badge {
  left: calc(var(--sidebar-width) + 16px);
}

.right-sidebar:hover ~ .map-container .map-controls,
.right-sidebar:focus-within ~ .map-container .map-controls {
  right: calc(var(--sidebar-width) + 16px);
}


