/**
 * PyGWalker Visual Exploration & Shelves Stylesheet
 * Graphic Walker inspired Tableau-like interaction for Data Atoms Studio
 */

/* 頂部官方入口指示條 (Anti-AI-slop: 沉穩純色錨定，取消漸層) */
.portal-top-bar {
  flex-shrink: 0;
  background: #0f172a;
  color: #f8fafc;
  padding: 8px 24px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.portal-top-bar a {
  color: #f8fafc;
  text-decoration: none;
  font-weight: 600;
}

/* ==========================================================================
   Topbar Tools Dropdown Menu (方案 A - 精簡一級 + 下拉式工具箱)
   ========================================================================== */
.topbar-right {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  flex-shrink: 0 !important;
}

.topbar-actions-row {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: nowrap !important;
}

.dropdown-tools-wrapper {
  position: relative;
  display: inline-block;
}

.btn-tools-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 6px;
  height: 32px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-tools-toggle:hover,
.dropdown-tools-wrapper.open .btn-tools-toggle {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.dropdown-chevron {
  transition: transform 0.2s ease;
  color: #64748b;
  margin-left: 2px;
}

.dropdown-tools-wrapper.open .dropdown-chevron {
  transform: rotate(180deg);
}

.dropdown-menu-tools {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 290px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.14), 0 8px 10px -6px rgba(15, 23, 42, 0.08);
  padding: 6px 0;
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.dropdown-tools-wrapper.open .dropdown-menu-tools {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-group-label {
  padding: 6px 14px 4px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

.dropdown-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 4px 0;
}

.dropdown-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  color: #1e293b;
  transition: background-color 0.12s ease;
  font-family: inherit;
  box-sizing: border-box;
}

.dropdown-menu-item:hover,
.dropdown-menu-item:focus {
  background: #f8fafc;
  outline: none;
}

.dropdown-menu-item .item-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.12s, color 0.12s;
}

.dropdown-menu-item:hover .item-icon {
  background: #e0e7ff;
  color: #4f46e5;
}

.dropdown-menu-item .item-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dropdown-menu-item .item-title {
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.35;
}

.dropdown-menu-item .item-subtitle {
  font-size: 10.5px;
  color: #64748b;
  line-height: 1.25;
  margin-top: 1px;
}

/* 視覺編碼槽頂部條 (Graphic Walker Encoding Shelves) */
.encoding-shelves-strip {
  background: #ffffff;
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
  padding: 10px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  z-index: 20;
}

.shelves-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.shelf-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px 8px;
  min-height: 38px;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.shelf-group.drag-over {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.shelf-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.shelf-drop-target {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 140px;
  min-height: 28px;
}

.shelf-placeholder {
  font-size: 12px;
  color: #94a3b8;
  font-style: italic;
  pointer-events: none;
}

/* 槽位中的標籤膠囊 (Shelf Pill) */
.shelf-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  animation: pillPop 0.15s ease-out;
}

@keyframes pillPop {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.shelf-pill.dimension {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1e40af;
}

.shelf-pill.measure {
  border-color: #a7f3d0;
  background: #ecfdf5;
  color: #065f46;
}

.shelf-pill-name {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shelf-agg-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 800;
  color: #059669;
  cursor: pointer;
  background: rgba(16, 185, 129, 0.15);
  padding: 1px 4px;
  border-radius: 3px;
}
.shelf-agg-badge:hover {
  background: #059669;
  color: #fff;
}

.shelf-pill-remove {
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0 2px;
  border-radius: 2px;
  transition: color 0.1s ease, background-color 0.1s ease;
}
.shelf-pill-remove:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.shelf-action-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.shelf-action-btn:hover {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

/* 柱狀圖堆疊 / 併排模式切換按鈕 (Tableau Grouped vs Stacked Toggle) */
.shelf-mode-toggle-group {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  overflow: hidden;
  background: #f8fafc;
  margin-left: 6px;
  vertical-align: middle;
}

.shelf-mode-toggle-group .btn-stack-toggle {
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.4;
}

.shelf-mode-toggle-group .btn-stack-toggle:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.shelf-mode-toggle-group .btn-stack-toggle.active {
  background: #2563eb;
  color: #ffffff;
}

/* Facet Shelf Pill & Scale Toggle Button */
.shelf-pill.facet {
  border-color: #c4b5fd;
  background: #f5f3ff;
  color: #6d28d9;
}

.btn-facet-scale {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 4px;
  border: 1px solid #c4b5fd;
  background: #ffffff;
  color: #6d28d9;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.4;
  margin-left: 6px;
}

.btn-facet-scale:hover {
  background: #ede9fe;
  border-color: #8b5cf6;
}

.btn-facet-scale.scale-free {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #ffffff;
}

/* 左側欄位清單 (Field Dock) */
.fields-shelf-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.fields-group-title {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 4px;
  border-bottom: 1px solid #e2e8f0;
}

.fields-pills-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.fields-pills-list::-webkit-scrollbar {
  width: 4px;
}
.fields-pills-list::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}
.fields-pills-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* 欄位標籤 (Field Pill) */
.field-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  font-size: 12px;
  color: #1e293b;
  cursor: grab;
  user-select: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.field-pill:hover {
  border-color: #94a3b8;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  transform: translateY(-1px);
}

.field-pill.dragging {
  opacity: 0.4;
  border-style: dashed;
}

.field-pill.dimension {
  border-left: 3px solid #2563eb;
}

.field-pill.measure {
  border-left: 3px solid #059669;
}

.field-drag-handle {
  color: #94a3b8;
  font-size: 11px;
  margin-right: 6px;
}

.field-type-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
  margin-right: 6px;
}

.field-pill.dimension .field-type-badge {
  background: #eff6ff;
  color: #2563eb;
}

.field-pill.measure .field-type-badge {
  background: #ecfdf5;
  color: #059669;
}

.field-name-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.field-quick-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0.35;
  transition: opacity 0.15s;
}

.field-pill:hover .field-quick-actions {
  opacity: 1;
}

.field-quick-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 3px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.1s ease, color 0.1s ease, border-color 0.1s ease;
}

.field-quick-btn:hover {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.field-quick-btn.facet-btn {
  background: #faf5ff;
  color: #7c3aed;
  border-color: #ddd6fe;
  font-weight: 800;
}

.field-quick-btn.facet-btn:hover {
  background: #7c3aed;
  color: #ffffff;
  border-color: #7c3aed;
}

/* ECharts Viewport 容器 */
.echarts-viewport-container {
  width: 100%;
  height: 100%;
  min-height: 200px;
  flex: 1;
  position: relative;
}

/* 上傳拖放區強化 */
.upload-dropzone-compact.drag-active {
  border-color: #ea580c;
  background: #fff7ed;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.2);
}

/* Sidebar Compact Spacing to ensure all 7 atoms fit without scrolling */
.sidebar-scroll-container {
  padding: 10px !important;
  gap: 10px !important;
}

.dock-card {
  padding: 10px 12px !important;
  gap: 8px !important;
}

.upload-dropzone-compact {
  padding: 6px 10px !important;
}

.dropzone-inner {
  gap: 8px !important;
}

.dropzone-prompt {
  font-size: 11px !important;
}

.dropzone-hint {
  font-size: 9.5px !important;
}

.fields-shelf-section {
  gap: 8px !important;
  margin-top: 4px !important;
}

.fields-pills-list {
  max-height: 125px !important;
  gap: 5px !important;
}

.field-pill {
  padding: 4px 8px !important;
  font-size: 11px !important;
}

/* 7 大原子卡片優化排版 */
.chart-type-dock-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.chart-type-card {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
  min-width: 0;
}

.chart-type-card:hover {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.chart-type-card.active {
  background: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
}

.chart-type-card.full-width {
  grid-column: 1 / -1;
  padding: 7px 10px;
}

.chart-type-card .card-icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ea580c;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background: rgba(234, 88, 12, 0.08);
  border-radius: 4px;
}

.chart-type-card.active .card-icon-box {
  background: rgba(234, 88, 12, 0.2);
  color: #fb923c;
}

.chart-type-card .card-text-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.chart-type-card .card-header-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}

.chart-type-card .card-num {
  font-size: 9.5px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #ea580c;
}

.chart-type-card.active .card-num {
  color: #fb923c;
}

.chart-type-card .card-name {
  font-size: 11px;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
}

.chart-type-card.active .card-name {
  color: #ffffff;
}

.chart-type-card .card-en {
  font-size: 8.5px;
  font-family: 'JetBrains Mono', monospace;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
}

.chart-type-card.active .card-en {
  color: rgba(255, 255, 255, 0.7);
}

/* ==========================================================================
   Tableau-like Data Preparation & Schema Classifier (欄位語意分類精靈)
   ========================================================================== */

.btn-schema-trigger {
  width: 100%;
  margin-top: 6px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  color: #2563eb;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, color 0.15s ease;
}

.btn-schema-trigger:hover {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
  transform: translateY(-1px);
}

.schema-modal-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.75);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.schema-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.schema-modal-card {
  width: 95%;
  max-width: 1200px;
  height: 88vh;
  max-height: 850px;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: schemaModalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes schemaModalSlideUp {
  from { transform: translateY(20px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Header */
.schema-modal-header {
  padding: 16px 24px;
  background: #0f172a;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.schema-header-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.schema-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.schema-badge-tableau {
  background: #2563eb;
  color: #ffffff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
}

.schema-title {
  font-size: 17px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.01em;
}

.schema-steps-tracker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.step-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}

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

.step-pill.step-active {
  background: rgba(37, 99, 235, 0.3);
  color: #93c5fd;
  border: 1px solid #3b82f6;
  font-weight: 700;
}

.step-pill.step-pending {
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
}

.step-connector {
  color: #64748b;
  font-size: 11px;
}

/* Toolbar */
.schema-modal-toolbar {
  padding: 10px 24px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.schema-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.schema-dataset-tag {
  font-weight: 700;
  font-size: 13px;
  color: #0f172a;
}

.schema-stat-chip {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #e2e8f0;
  color: #334155;
  font-weight: 600;
}

.schema-stat-chip.chip-dim {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.schema-stat-chip.chip-mea {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.schema-toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.schema-filter-group {
  display: flex;
  background: #e2e8f0;
  padding: 2px;
  border-radius: 6px;
  gap: 2px;
}

.schema-filter-btn {
  border: none;
  background: transparent;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.schema-filter-btn.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.schema-search-input {
  padding: 5px 10px;
  font-size: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  width: 170px;
  outline: none;
}
.schema-search-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}

/* Notice Banner */
.schema-notice-banner {
  padding: 8px 24px;
  background: #eff6ff;
  border-bottom: 1px solid #dbeafe;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #1e3a8a;
}
.schema-notice-banner .notice-icon {
  font-size: 15px;
}

/* Table Wrap */
.schema-table-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  background: #ffffff;
}

.schema-grid-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.schema-grid-table th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  color: #475569;
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 1px solid #cbd5e1;
  white-space: nowrap;
  z-index: 2;
}

.schema-grid-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.schema-grid-table tr:hover td {
  background: #f8fafc;
}

/* Type Select */
.schema-type-select {
  padding: 4px 6px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  color: #1e293b;
  width: 100%;
  cursor: pointer;
}
.schema-type-select:focus {
  border-color: #2563eb;
}

/* Field Name & Alias Input */
.schema-field-name-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.schema-field-orig {
  font-weight: 700;
  color: #0f172a;
  font-size: 12px;
}
.schema-alias-input {
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  color: #475569;
  width: 100%;
}
.schema-alias-input:focus {
  border-color: #2563eb;
  background: #ffffff;
}

/* Role Segmented Toggle (維度 🔵 vs 度量 🟢) */
.role-segmented-toggle, .nature-segmented-toggle {
  display: inline-flex;
  background: #f1f5f9;
  padding: 2px;
  border-radius: 5px;
  border: 1px solid #e2e8f0;
  gap: 2px;
}

.role-toggle-btn, .nature-toggle-btn {
  border: none;
  background: transparent;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
  white-space: nowrap;
}

.role-toggle-btn.active.btn-dim {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(37,99,235,0.3);
}

.role-toggle-btn.active.btn-mea {
  background: #059669;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(5,150,105,0.3);
}

.nature-toggle-btn.active.btn-discrete {
  background: #1e40af;
  color: #ffffff;
}

.nature-toggle-btn.active.btn-continuous {
  background: #047857;
  color: #ffffff;
}

/* Aggregation Select */
.schema-agg-select {
  padding: 4px 6px;
  font-size: 11.5px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  color: #0f172a;
  cursor: pointer;
}

/* Profiling & Sample Values */
.schema-profile-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.schema-cardinality-text {
  font-size: 10.5px;
  color: #64748b;
  font-family: 'JetBrains Mono', monospace;
}
.schema-samples-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.schema-sample-pill {
  font-size: 10px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
  padding: 1px 5px;
  border-radius: 3px;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Reasoning Badge */
.schema-reason-pill {
  font-size: 11px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
  line-height: 1.3;
}

/* Footer */
.schema-modal-footer {
  padding: 14px 24px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.schema-footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.schema-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-tableau-next {
  background: #2563eb;
  border: 1px solid #1d4ed8;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(37,99,235,0.25);
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.btn-tableau-next:hover {
  background: #1d4ed8;
  box-shadow: 0 4px 12px rgba(37,99,235,0.35);
  transform: translateY(-1px);
}

/* ==========================================================================
   17 Domains & Year Range Extractor Modal (e-Stat SSDSE Indicator Matrix)
   遵循 Hallmark 簡約去 AI 味設計：精準 4px/8px 比例、深石板色、純淨 SVG 圖標
   ========================================================================== */

/* Topbar & Dock Trigger Buttons */
.btn-domain-top {
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #334155;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-domain-top:hover {
  background: #1e293b;
  border-color: #475569;
}

.btn-domain-dock {
  width: 100%;
  margin-top: 6px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-domain-dock:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

/* Modal Overlay & Card */
.domain-modal-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(5px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.domain-modal-overlay.open {
  display: flex;
  opacity: 1;
}

.domain-modal-card {
  width: 1220px;
  max-width: 96vw;
  height: 88vh;
  max-height: 860px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalEnter 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Modal Header */
.domain-modal-header {
  background: #0f172a;
  color: #ffffff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #334155;
}

.domain-header-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.domain-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.domain-badge-estat {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  background: #2563eb;
  color: #ffffff;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}

.domain-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}

.domain-subtitle {
  font-size: 12px;
  color: #94a3b8;
  margin: 0;
}

/* Year Range Control Strip */
.domain-year-strip {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.year-strip-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.year-strip-label {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.year-preset-chips {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.year-preset-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.year-preset-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.year-preset-btn.active {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #ffffff;
  font-weight: 700;
}

.year-strip-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.year-select-box {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #475569;
  font-weight: 500;
}

.year-select {
  padding: 4px 8px;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  color: #0f172a;
  cursor: pointer;
}

.year-step-select {
  padding: 4px 8px;
  font-size: 11.5px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
}

/* Modal Body Split Layout */
.domain-modal-body {
  display: flex;
  flex: 1;
  min-height: 0;
  background: #ffffff;
}

/* Left Sidebar: 17 Domains Nav */
.domain-nav-sidebar {
  width: 280px;
  min-width: 280px;
  border-right: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.domain-nav-header {
  padding: 10px 16px;
  font-size: 11.5px;
  font-weight: 700;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.domain-nav-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.domain-nav-item {
  padding: 9px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.domain-nav-item:hover {
  background: #edf2f7;
}

.domain-nav-item.active {
  background: #ffffff;
  border-left-color: #2563eb;
  font-weight: 600;
}

.domain-nav-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.domain-code-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  background: #e2e8f0;
  color: #334155;
}

.domain-nav-item.active .domain-code-tag {
  background: #dbeafe;
  color: #1e40af;
}

.domain-nav-name {
  font-size: 12.5px;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.domain-badge-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  background: #e2e8f0;
  color: #64748b;
}

.domain-badge-count.has-selected {
  background: #2563eb;
  color: #ffffff;
}

/* Right Content Area: Variables Selection */
.domain-content-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.domain-content-toolbar {
  padding: 12px 24px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.domain-info-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.domain-current-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.domain-current-desc {
  font-size: 12px;
  color: #64748b;
}

.domain-action-strip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.domain-search-box {
  position: relative;
  width: 220px;
}

.domain-search-input {
  width: 100%;
  padding: 6px 10px 6px 28px;
  font-size: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #f8fafc;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.domain-search-input:focus {
  border-color: #2563eb;
  background: #ffffff;
}

.domain-search-icon {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

.btn-domain-action {
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-domain-action:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

/* Variables Grid Container */
.domain-var-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  background: #f8fafc;
}

.domain-var-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 12px;
}

.var-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.var-card:hover {
  border-color: #94a3b8;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.var-card.selected {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 1px #2563eb;
}

.var-card-checkbox {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: #2563eb;
  cursor: pointer;
}

.var-card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

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

.var-code-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  padding: 1px 6px;
  border-radius: 3px;
}

.var-card.selected .var-code-pill {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}

.var-unit-pill {
  font-size: 10.5px;
  font-family: 'JetBrains Mono', monospace;
  color: #64748b;
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 3px;
}

.var-name-row {
  font-size: 13.5px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.35;
}

.var-desc-text {
  font-size: 11.5px;
  color: #64748b;
  line-height: 1.4;
}

/* Modal Footer */
.domain-modal-footer {
  padding: 12px 24px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.domain-footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #334155;
}

.domain-summary-tag {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #2563eb;
}

.domain-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-domain-export {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-domain-export:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.btn-domain-apply {
  background: #2563eb;
  border: 1px solid #1d4ed8;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(37,99,235,0.25);
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.btn-domain-apply:hover {
  background: #1d4ed8;
  box-shadow: 0 4px 12px rgba(37,99,235,0.35);
  transform: translateY(-1px);
}

/* ==========================================================================
   Tableau / PyGWalker 互動篩選器列 (Active Filters & Quick Range Bar)
   ========================================================================== */
.active-filters-strip {
  background: #ffffff;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  padding: 4px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  min-height: 38px;
  max-height: 48px;
  overflow-x: auto;
  overflow-y: hidden;
  background-color: #fcfdfe;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.filter-strip-label {
  font-size: 11px;
  font-weight: 700;
  color: #2563eb;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-group-card {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 2px 8px;
  flex-wrap: nowrap;
  max-height: 38px;
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 0;
}

.filter-chip-container {
  display: inline-flex;
  gap: 4px;
  flex-wrap: nowrap;
  max-height: 34px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px;
  align-items: center;
  flex-shrink: 0;
}

.filter-group-header {
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  margin-right: 2px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.filter-chip-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.filter-chip-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
}

.filter-chip-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.filter-chip-btn.active .filter-count {
  color: rgba(255, 255, 255, 0.8);
}

.filter-count {
  font-size: 9.5px;
  font-family: 'JetBrains Mono', monospace;
  color: #94a3b8;
}

.filter-quick-action {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 2px 4px;
  border-radius: 3px;
}
.filter-quick-action:hover {
  color: #0f172a;
  background: rgba(15, 23, 42, 0.05);
}

.filter-range-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #475569;
}

.filter-range-input {
  width: 60px;
  padding: 3px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  text-align: center;
  background: #ffffff;
  color: #0f172a;
}

.filter-range-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}

.filter-range-btn {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #2563eb;
  background: #2563eb;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
}
.filter-range-btn:hover {
  background: #1d4ed8;
}

.filter-preset-btn {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
}
.filter-preset-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
}

.filter-reset-btn {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.filter-reset-btn:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

.field-quick-btn.filter-btn {
  background: #f8fafc;
  color: #475569;
  border-color: #cbd5e1;
}
.field-quick-btn.filter-btn:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

/* ==========================================================================
   Narrow / Tablet Screen Optimization (< 1100px)
   確保窄視窗或平板下，左側 Dock 與 10 大 Data Atoms 圖表選取器具備順暢捲動與可點擊性
   ========================================================================== */
@media (max-width: 1100px) {
  .sidebar-dock {
    width: 280px;
  }
  .sidebar-scroll-container {
    overflow-y: auto !important;
    max-height: 100% !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .chart-type-dock-grid,
  .chart-types-grid {
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    max-height: none;
    overflow-y: visible;
  }
  .chart-type-card {
    padding: 6px 6px !important;
    min-height: 38px;
  }
  .chart-type-card .card-name {
    font-size: 11.5px !important;
  }
  .chart-type-card .card-en {
    font-size: 9px !important;
  }
  .fields-pills-list {
    max-height: 100px !important;
  }
}

/* ==========================================================================
   Data Atoms 現代行動版響應式體驗 (Mobile Responsive System <= 900px)
   讓手機瀏覽時排版緊湊、圖表置頂、點擊自如、零橫向破版
   ========================================================================== */
@media (max-width: 900px) {
  html, body {
    height: auto !important;
    min-height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: block !important;
  }

  .app-shell {
    height: auto !important;
    min-height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: block !important;
    flex: none !important;
  }

  /* 頂部實戰步驟橫條：左右滑動藥丸列 */
  .portal-top-bar {
    padding: 8px 12px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .portal-top-bar > div:first-child {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 4px !important;
    gap: 6px !important;
    max-width: 100% !important;
    scrollbar-width: none !important;
  }

  .portal-top-bar > div:first-child a,
  .portal-top-bar > div:first-child span {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    height: 28px !important;
    font-size: 11.5px !important;
  }

  .portal-top-bar > div:first-child::-webkit-scrollbar {
    display: none !important;
  }

  .portal-top-bar > div:last-child {
    display: flex !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 8px !important;
    max-width: 100% !important;
    font-size: 11px !important;
    scrollbar-width: none !important;
  }

  /* 頂部功能條 (App Topbar) */
  .app-topbar {
    height: auto !important;
    padding: 10px 12px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .topbar-left {
    width: 100% !important;
  }

  .brand-cluster {
    width: 100% !important;
  }

  .brand-subtitle {
    display: none !important; /* 手機端隱藏超長副標題，避免擠壓 */
  }

  .topbar-right {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  #datasetQuickSelect {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    font-size: 12.5px !important;
    padding: 7px 10px !important;
  }

  .topbar-actions-row {
    display: flex !important;
    overflow-x: visible !important;
    gap: 6px !important;
    width: 100% !important;
    align-items: center !important;
  }

  .topbar-actions-row button {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    font-size: 11.5px !important;
    padding: 6px 10px !important;
    height: 32px !important;
  }

  .dropdown-menu-tools {
    right: 0 !important;
    max-width: 92vw !important;
    width: 280px !important;
  }

  /* 工作區主體：手機版圖表置頂 (order: 1)，側邊欄與原子庫置底 (order: 2) */
  .workspace-body {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    overflow: visible !important;
  }

  .main-stage {
    order: 1 !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .sidebar-dock {
    order: 2 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    border-right: none !important;
    border-top: 2px solid #e2e8f0 !important;
  }

  .sidebar-scroll-container {
    overflow: visible !important;
    height: auto !important;
    padding: 12px !important;
    gap: 12px !important;
  }

  /* 視覺編碼槽 (Encoding Shelves) */
  .encoding-shelves-strip {
    padding: 8px 10px !important;
    gap: 6px !important;
  }

  .shelves-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
  }

  .shelf-group {
    width: 100% !important;
    flex: none !important;
    box-sizing: border-box !important;
  }

  .shelf-action-btn {
    align-self: flex-start !important;
  }

  /* 畫布視口 (Canvas Viewport) */
  .stage-body {
    height: auto !important;
    overflow: visible !important;
    flex: none !important;
  }

  .echarts-viewport-container,
  .canvas-viewport {
    height: 400px !important;
    min-height: 380px !important;
    max-height: 450px !important;
    padding: 6px !important;
    overflow: visible !important;
  }

  .canvas-wrapper {
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: auto !important;
    border-radius: 8px !important;
  }

  #chartContainer, #mainChartCanvas {
    width: 100% !important;
    height: 100% !important;
  }

  /* 統計 KPI 緞帶 */
  .kpi-ribbon {
    height: auto !important;
    padding: 8px 12px !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
  }

  /* 10 大 Data Atoms 按鈕網格：轉為 2 欄方便大拇指點擊 */
  .chart-types-grid,
  .chart-type-dock-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
  }

  .chart-type-card {
    padding: 8px 6px !important;
    font-size: 11px !important;
  }

  .chart-type-card.full-width {
    grid-column: span 2 !important;
  }

  /* 篩選控制器在手機上的彈性排版 */
  .filters-control-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    padding: 8px 12px !important;
  }

  .filter-pills-wrap {
    flex-wrap: wrap !important;
    gap: 4px !important;
  }

  /* 表格抽屜與彈窗水平滾動防破版 */
  .data-drawer,
  .drawer-body,
  .table-scroll-wrap,
  .schema-table-wrap,
  .modal-card {
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   PyGWalker Data Profiling Sparklines (微型分佈圖與特徵畫像)
   ========================================================================== */

.col-profiling-box {
  margin-top: 4px;
  padding: 3px 5px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-weight: normal;
  font-size: 9px;
  line-height: 1;
  cursor: default;
  min-width: 84px;
  box-sizing: border-box;
  text-align: left;
  transition: all 0.15s ease;
}

.col-profiling-box:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.profiling-svg {
  display: block;
  width: 100%;
  height: 18px;
  overflow: visible;
}

.profiling-range-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
  font-size: 8px;
  color: #64748b;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}

.profiling-category-bar {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: #e2e8f0;
  margin-bottom: 3px;
  width: 100%;
}

.cat-bar-segment {
  height: 100%;
  transition: opacity 0.15s ease;
}

.cat-bar-segment:hover {
  opacity: 0.8;
}

.profiling-cat-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 8px;
  color: #475569;
  white-space: nowrap;
  gap: 2px;
}

.cat-label-chip {
  max-width: 65px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: #1e293b;
}

.cat-unique-chip {
  font-family: 'JetBrains Mono', monospace;
  color: #64748b;
  background: #e2e8f0;
  padding: 1px 3px;
  border-radius: 2px;
}

/* ==========================================================================
   Custom Pinned Dashboard (自訂多宮格組合看板)
   ========================================================================== */

.pinned-count-badge {
  display: inline-block;
  min-width: 16px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 10px;
  background: #fbbf24;
  color: #78350f;
  margin-left: 4px;
}

.dashboard-modal-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  padding: 20px;
  box-sizing: border-box;
}

.dashboard-modal-overlay.open {
  display: flex;
}

.dashboard-modal-card {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  width: 95vw;
  max-width: 1560px;
  height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  animation: modalScaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.dashboard-modal-header {
  padding: 14px 20px;
  background: #0f172a;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 1px solid #1e293b;
}

.dashboard-modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dashboard-title-icon {
  font-size: 22px;
}

.dashboard-modal-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.dashboard-modal-subtitle {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 1px;
}

.dashboard-layout-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #1e293b;
  padding: 3px;
  border-radius: 6px;
  border: 1px solid #334155;
}

.dashboard-layout-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.dashboard-layout-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.dashboard-layout-btn.active {
  background: #2563eb;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.dashboard-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f8fafc;
}

.dashboard-grid-container {
  display: grid;
  gap: 18px;
  transition: all 0.2s ease;
}

.dashboard-grid-container.cols-1 {
  grid-template-columns: 1fr;
}

.dashboard-grid-container.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.dashboard-grid-container.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1100px) {
  .dashboard-grid-container.cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .dashboard-grid-container.cols-2,
  .dashboard-grid-container.cols-3 {
    grid-template-columns: 1fr;
  }
}

/* Dashboard Empty State */
.dashboard-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  color: #64748b;
}

.dashboard-empty-icon {
  font-size: 52px;
  margin-bottom: 14px;
  opacity: 0.85;
}

.dashboard-empty-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 6px;
}

.dashboard-empty-desc {
  font-size: 13px;
  max-width: 440px;
  line-height: 1.6;
  color: #64748b;
  margin-bottom: 18px;
}

/* Individual Pinned Chart Card */
.dashboard-card {
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 6px -1px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dashboard-card:hover {
  box-shadow: 0 10px 18px -3px rgba(0, 0, 0, 0.1);
  border-color: #cbd5e1;
}

.dashboard-card-header {
  padding: 10px 14px;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dashboard-card-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.dashboard-card-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-card-badge {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  white-space: nowrap;
}

.dashboard-card-dataset {
  font-size: 9.5px;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-card-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dashboard-card-tool-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.dashboard-card-tool-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.dashboard-card-tool-btn.btn-remove:hover {
  background: #fef2f2;
  color: #ef4444;
}

.dashboard-card-body {
  padding: 10px;
  flex: 1;
  min-height: 340px;
  position: relative;
  background: #ffffff;
}

.dashboard-card-chart {
  width: 100%;
  height: 100%;
  min-height: 340px;
}

.dashboard-card-footer {
  padding: 6px 14px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: #64748b;
}

.dashboard-card-shelves-info {
  display: flex;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-card-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: #94a3b8;
}

/* ==========================================================================
   Workbook Multi-Tab Sheets Bar (Tableau / PyGWalker 多工作表分頁列)
   ========================================================================== */

.workbook-tabs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border-bottom: 1px solid #cbd5e1;
  padding: 4px 14px 0 14px;
  gap: 12px;
  min-height: 38px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.workbook-tabs-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.workbook-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  white-space: nowrap;
  margin-right: 2px;
  flex-shrink: 0;
}

.workbook-actions-fixed {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.workbook-tabs-scroll-container {
  display: flex;
  align-items: flex-end;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  padding-bottom: 1px;
}

.workbook-tabs-scroll-container::-webkit-scrollbar {
  height: 3px;
}

.workbook-tabs-scroll-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}

.workbook-tabs-list {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-width: max-content;
}

.workbook-tab {
  background: #e2e8f0;
  color: #475569;
  border: 1px solid #cbd5e1;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.15s ease;
  position: relative;
  user-select: none;
}

.workbook-tab:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.workbook-tab.active {
  background: #ffffff;
  color: #1d4ed8;
  font-weight: 700;
  border-top: 3px solid #2563eb;
  border-left: 1px solid #cbd5e1;
  border-right: 1px solid #cbd5e1;
  border-bottom: 1px solid #ffffff;
  box-shadow: 0 -2px 8px rgba(37, 99, 235, 0.12);
  margin-bottom: -1px;
  padding-bottom: 7px;
  z-index: 2;
}

.workbook-tab.active .tab-title {
  color: #1d4ed8;
  font-weight: 700;
}

.tab-chart-icon {
  font-size: 13px;
}

.tab-title {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-rename-btn,
.tab-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 11px;
  padding: 1px 3px;
  border-radius: 3px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.12s, background 0.12s;
}

.tab-rename-btn:hover {
  color: #2563eb;
  background: rgba(37, 99, 235, 0.12);
}

.tab-close-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

.btn-add-sheet {
  background: #eff6ff;
  border: 1px dashed #3b82f6;
  color: #2563eb;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: all 0.15s ease;
  margin-bottom: 2px;
  flex-shrink: 0;
}

.btn-add-sheet:hover {
  background: #dbeafe;
  border-color: #1d4ed8;
  color: #1e40af;
  transform: translateY(-1px);
}

.btn-duplicate-sheet {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #475569;
  padding: 5px 9px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: all 0.15s ease;
  margin-bottom: 2px;
  flex-shrink: 0;
}

.btn-duplicate-sheet:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
  transform: translateY(-1px);
}

.workbook-tabs-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
  flex-shrink: 0;
}

.btn-sheet-quick-pin {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #475569;
  padding: 4px 9px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.12s ease;
}

.btn-sheet-quick-pin:hover {
  background: #eff6ff;
  border-color: #2563eb;
  color: #2563eb;
}

.btn-sheet-dashboard {
  background: #4f46e5;
  border: 1px solid #4338ca;
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.12s ease;
}

.btn-sheet-dashboard:hover {
  background: #4338ca;
}

/* Distribution Toggle Controls (盒鬚 vs 小提琴) */
.dist-toggle-group {
  display: inline-flex;
  align-items: center;
  background: #e2e8f0;
  padding: 2px;
  border-radius: 6px;
  margin-left: 8px;
}

.dist-toggle-btn {
  background: transparent;
  border: none;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.dist-toggle-btn.active {
  background: #ffffff;
  color: #2563eb;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.brand-subtitle {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
  line-height: 1.2;
}

/* ==========================================================================
   Collapsible Sidebar (Plan 2: 一鍵收合 / 展開側邊欄與全寬工作區)
   ========================================================================== */
.workspace-body {
  position: relative !important;
}

.sidebar-dock {
  width: 320px;
  min-width: 320px;
  flex-shrink: 0;
  height: 100%;
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.28s ease;
  position: relative;
  overflow: hidden;
}

.sidebar-dock-header {
  height: 38px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle, #e2e8f0);
  background: #f8fafc;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  flex-shrink: 0;
  user-select: none;
}

.sidebar-dock-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #1e293b;
}

.btn-dock-collapse {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  cursor: pointer;
  color: #64748b;
  font-size: 11px;
  transition: all 0.15s ease;
}

.btn-dock-collapse:hover {
  background: #eff6ff;
  color: #2563eb;
  border-color: #93c5fd;
}

/* 浮動側邊欄收合切換拉柄 (Boundary Handle Tab) */
.sidebar-toggle-handle {
  position: absolute;
  top: 8px;
  left: 320px;
  z-index: 35;
  width: 20px;
  height: 36px;
  background: #ffffff;
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-left: none;
  border-radius: 0 8px 8px 0;
  box-shadow: 2px 1px 6px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #64748b;
  font-size: 11px;
  font-weight: bold;
  transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.15s, color 0.15s, box-shadow 0.15s;
  outline: none;
  padding: 0;
}

.sidebar-toggle-handle:hover {
  background: #eff6ff;
  color: #2563eb;
  box-shadow: 3px 2px 8px rgba(37, 99, 235, 0.2);
}

/* 當側邊欄收合時的佈局狀態 (Collapsed State) */
.sidebar-collapsed .sidebar-dock,
.workspace-body.sidebar-collapsed .sidebar-dock {
  width: 0 !important;
  min-width: 0 !important;
  border-right: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.sidebar-collapsed .sidebar-toggle-handle,
.workspace-body.sidebar-collapsed .sidebar-toggle-handle {
  left: 0 !important;
  border-left: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 0 8px 8px 0;
  background: #2563eb;
  color: #ffffff;
  box-shadow: 3px 2px 10px rgba(37, 99, 235, 0.3);
}

.sidebar-collapsed .sidebar-toggle-handle:hover,
.workspace-body.sidebar-collapsed .sidebar-toggle-handle:hover {
  background: #1d4ed8;
  color: #ffffff;
}

.sidebar-collapsed .main-stage,
.workspace-body.sidebar-collapsed .main-stage {
  flex: 1 1 100% !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* ==========================================================================
   Workspace Zoom Controller (Plan 1: 工作區縮放控制器 75% ~ 150%)
   ========================================================================== */
.zoom-controls-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #f1f5f9;
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: var(--radius-sm, 6px);
  padding: 2px 4px;
}

.btn-zoom-action {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: all 0.15s ease;
  user-select: none;
  line-height: 1.2;
}

.btn-zoom-action:hover:not(:disabled) {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.2);
}

.btn-zoom-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: #e2e8f0;
}

.zoom-level-badge {
  font-family: 'JetBrains Mono', monospace, sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #1e293b;
  min-width: 42px;
  text-align: center;
  padding: 2px 4px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  user-select: none;
}

.btn-zoom-reset {
  background: #fafafa;
  color: #64748b;
}

.btn-zoom-reset:hover {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.workbook-tabs-divider {
  width: 1px;
  height: 18px;
  background: var(--border-subtle, #e2e8f0);
  margin: 0 4px;
}

/* ECharts Viewport 縮放轉場過渡 */
.echarts-viewport-container {
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1), height 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Toast 提示通知全域保證 */
.toast-notice {
  z-index: 99999 !important;
}

.toast-notice.show,
.toast-notice.visible {
  transform: translateY(0) !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Stage Body 支援縮放 (>100%) 時水平與垂直平滑滾動 */
.stage-body {
  overflow-x: auto !important;
  overflow-y: auto !important;
}

/* 行動裝置與窄螢幕適配 (<= 900px) 隱藏浮動拉柄避免遮擋頂部圖表 */
@media (max-width: 900px) {
  .sidebar-toggle-handle,
  .btn-dock-collapse {
    display: none !important;
  }
}

