/* Gatheren Files — Module 02: Explorer, Gallery, and Queue Layout */
/* ==========================================================================
   3. Viewport-Locked 3-Pane Google Drive Explorer & Document Workbench
   ========================================================================== */
.workspace-grid,
#explorerWorkspaceMain {
  flex: 1;
  height: calc(100vh - var(--header-height));
  height: calc(100dvh - var(--header-height));
  min-height: 0;
  display: grid;
  grid-template-columns: 260px 1fr;
  overflow: hidden;
}

/* Pane 1: Left Taxonomy Tree (Fixed 260px, Scrollable) */
#treePaneContainer,
.left-explorer-panel {
  width: 260px;
  min-width: 260px;
  max-width: 260px;
  height: 100%;
  max-height: calc(100vh - var(--header-height));
  max-height: calc(100dvh - var(--header-height));
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.panel-header-compact {
  height: 36px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 6px;
}

.panel-header-compact .section-eyebrow {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.total-files-pill {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--bg-card);
  color: var(--accent-blue);
  white-space: nowrap;
}

.project-selector-bar {
  display: none !important;
}

.project-selector-bar.hidden {
  display: none !important;
}

.proj-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.12s ease;
}

.proj-chip:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.proj-chip.active {
  background: var(--accent-blue-soft);
  color: var(--accent-blue);
  border-color: rgba(56, 189, 248, 0.35);
}

.proj-chip small {
  font-size: 10px;
  opacity: 0.78;
}

.explorer-search-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 80px;
  gap: 5px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-hairline);
  flex-shrink: 0;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 8px;
  color: var(--text-muted);
  pointer-events: none;
  display: inline-flex;
}

.search-input-wrap input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  color: var(--text-primary);
  padding: 5px 7px 5px 25px;
  border-radius: 6px;
  font-size: 11.5px;
}

.explorer-search-box select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  color: var(--text-secondary);
  padding: 4px 5px;
  border-radius: 6px;
  font-size: 11px;
}

/* ==========================================================================
   Dynamic 4-Level Shared Drive & Category Hierarchy Tree (Feature 12: R5)
   Level 1: Shared Drives (0.待歸檔, 1.備標專案, 2.工程執行, 3-6 歸檔)
   Level 2: Projects (RosePark, NTUDorm, QuChiDam...)
   Level 3: Categories (00..15 Standard Folders)
   Level 4: Subcategories / Subfolders
   ========================================================================== */
.taxonomy-tree,
#explorerWorkspaceMain #treePaneContainer #taxonomyTreeContainer {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-x pan-y;
  padding: 6px 8px calc(28px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Level 1: Shared Drive Node */
.tax-drive-node {
  border-radius: 6px;
  margin-bottom: 2px;
  flex-shrink: 0;
  contain: layout style;
}

.tax-drive-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  transition: background 0.12s ease;
  gap: 6px;
  min-width: max-content;
  box-sizing: border-box;
}

.tax-drive-header:hover {
  background: var(--bg-card-hover);
}

.tax-drive-header.active {
  background: var(--accent-blue-soft);
  color: var(--accent-blue);
}

.tax-drive-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 0px;
  min-width: 82px;
  overflow: hidden;
}

.tax-drive-icon {
  display: inline-flex;
  align-items: center;
  color: var(--accent-blue);
  flex-shrink: 0;
}

.tax-drive-name {
  flex: 1 1 0px;
  min-width: 56px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tax-count {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.tax-count-inbox {
  background: var(--accent-amber-soft);
  color: var(--accent-amber);
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
}

/* Level 2: Project List & Node */
.tax-proj-list {
  padding-left: 10px;
  margin: 2px 0 4px 5px;
  border-left: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: max-content;
  box-sizing: border-box;
}

.tax-proj-node {
  border-radius: 5px;
  flex-shrink: 0;
}

.tax-proj-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 7px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.12s ease;
  gap: 6px;
  min-width: max-content;
  box-sizing: border-box;
}

.tax-proj-header:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.tax-proj-header.active {
  background: var(--accent-blue-soft);
  color: var(--accent-blue);
}

.tax-proj-left {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1 1 0px;
  min-width: 82px;
  overflow: hidden;
}

.tax-proj-icon {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.tax-proj-name {
  flex: 1 1 0px;
  min-width: 56px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Level 3: Category List & Node */
.tax-cat-list {
  padding-left: 10px;
  margin: 2px 0 4px 5px;
  border-left: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: max-content;
  box-sizing: border-box;
}

.tax-cat-node,
.tax-pure-folder-node {
  border-radius: 5px;
  flex-shrink: 0;
  contain: layout style;
}

.tax-cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-secondary);
  transition: background 0.12s ease;
  gap: 6px;
  min-width: max-content;
  box-sizing: border-box;
}

.tax-cat-header:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.tax-cat-header.active {
  background: var(--accent-blue-soft);
  color: var(--accent-blue);
  font-weight: 700;
}

.tax-cat-left {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1 1 0px;
  min-width: 82px;
  overflow: hidden;
}

.tax-code-pill {
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--bg-card);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.tax-cat-name {
  flex: 1 1 0px;
  min-width: 56px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Level 4: Subcategory List & Item */
.tax-sub-list {
  padding-left: 10px;
  margin: 1px 0 3px 5px;
  border-left: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: max-content;
  box-sizing: border-box;
}

.tax-sub-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 6px;
  font-size: 10.5px;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  gap: 5px;
  transition: all 0.12s ease;
  min-width: max-content;
  box-sizing: border-box;
  flex-shrink: 0;
}

.tax-sub-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.tax-sub-item.active {
  background: var(--accent-blue-soft);
  color: var(--accent-blue);
  font-weight: 600;
}

.tax-sub-left {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 0px;
  min-width: 82px;
  overflow: hidden;
}

.tax-sub-icon {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.tax-sub-name {
  flex: 1 1 0px;
  min-width: 56px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tax-chevron-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  cursor: pointer;
  color: var(--text-muted);
}

.tax-chevron-toggle:hover {
  color: var(--text-primary);
}

.tax-right-cluster {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.folder-pin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0.45;
  flex-shrink: 0;
  transition: opacity 0.14s ease, color 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.tax-dept-header:hover .folder-pin-btn,
.tax-proj-header:hover .folder-pin-btn,
.tax-cat-header:hover .folder-pin-btn,
.tax-sub-item:hover .folder-pin-btn,
.tax-pure-folder-row:hover .folder-pin-btn,
.picker-tree-header-row:hover .folder-pin-btn,
.picker-tree-leaf-row:hover .folder-pin-btn,
.folder-pin-btn:hover,
.folder-pin-btn.pinned {
  opacity: 1;
}

.folder-pin-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.folder-pin-btn.pinned {
  color: var(--accent-amber, #d97706);
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
}

@media (hover: none), (pointer: coarse) {
  .folder-pin-btn {
    opacity: 0.78;
    width: 22px;
    height: 22px;
  }
}

.folder-touch-drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  padding: 6px 12px;
  border-radius: 7px;
  background: var(--bg-elevated, #1e293b);
  border: 1.5px solid var(--accent-blue, #38bdf8);
  color: var(--text-primary, #f8fafc);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}

/* Personal Favourite Folders List (Same width as File Tree Container) */
.favourite-folders-section {
  width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 6px 8px;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.favourite-folders-section.drag-over {
  background: var(--accent-blue-soft, rgba(37, 99, 235, 0.08));
  border-color: var(--accent-blue, #2563eb);
  box-shadow: inset 0 0 0 1.5px var(--accent-blue, #2563eb);
}

.favourite-folders-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 2px 4px 5px;
  user-select: none;
}

.favourite-folders-title {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

.favourite-folders-title svg {
  color: var(--accent-amber, #d97706);
  flex-shrink: 0;
}

.favourite-folders-count,
.favourite-count-badge {
  font-size: 10px;
  font-family: var(--font-sans);
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  padding: 0 5px;
  border-radius: 999px;
}

.favourite-folders-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 108px;
  overflow-y: auto;
  width: 100%;
  box-sizing: border-box;
}

.favourite-empty-hint {
  font-size: 11px;
  color: var(--text-muted);
  padding: 5px 6px;
  border: 1px dashed var(--border-subtle);
  border-radius: 6px;
  text-align: center;
  line-height: 1.35;
}

.favourite-folder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11.5px;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.favourite-folder-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.favourite-folder-item.active {
  background: var(--accent-blue-soft);
  color: var(--accent-blue);
  border-color: rgba(37, 99, 235, 0.35);
  font-weight: 600;
}

.fav-item-left,
.favourite-folder-left {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex: 1;
}

.fav-item-icon,
.favourite-folder-icon {
  display: inline-flex;
  align-items: center;
  color: var(--accent-amber, #d97706);
  flex-shrink: 0;
}

.favourite-folder-item.active .fav-item-icon,
.favourite-folder-item.active .favourite-folder-icon {
  color: var(--accent-blue);
}

.fav-item-name,
.favourite-folder-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.fav-item-ctx,
.favourite-folder-context {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: 4px;
  padding: 0 4px;
  white-space: nowrap;
  max-width: 76px;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.fav-unpin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--accent-amber, #d97706);
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.75;
  transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.fav-unpin-btn:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-red, #dc2626);
}


/* Right Workspace: Split Panes & Full Height Workbench */
.right-main-workspace {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-root);
}

/* Lower Split: Pane 2 (Version Containers 380px) + Pane 3 (Preview Workbench flex:1) + Right 3-Dot Slider + Inbox Queue */
.content-and-preview-split {
  flex: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

/* Pane 2: Version Containers Column (Draggable width, hidden by default until a folder is opened) */
#containersPane,
.containers-list-column {
  width: var(--containers-pane-width, 340px);
  min-width: 190px;
  max-width: 55vw;
  flex: 0 0 var(--containers-pane-width, 340px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-root);
  transition: width 0.18s cubic-bezier(0.22, 1, 0.36, 1), flex-basis 0.18s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.14s ease;
}

#containersPane.collapsed,
.containers-list-column.collapsed {
  width: 0px !important;
  min-width: 0px !important;
  max-width: 0px !important;
  flex: 0 0 0px !important;
  border-right-width: 0px !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.resizing-containers #containersPane,
body.resizing-containers .containers-list-column {
  transition: none !important;
}

body.resizing-containers {
  cursor: col-resize !important;
  user-select: none !important;
}

body.resizing-containers iframe {
  pointer-events: none !important;
}

.containers-resize-handle {
  width: 6px;
  flex: 0 0 6px;
  cursor: col-resize;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 12;
  transition: background 0.15s ease;
}

.containers-resize-handle:hover,
.containers-resize-handle.dragging {
  background: rgba(56, 189, 248, 0.18);
}

.containers-resize-handle.collapsed {
  display: none !important;
  width: 0 !important;
  flex: 0 0 0px !important;
}

.containers-resize-grip {
  width: 2px;
  height: 28px;
  border-radius: 2px;
  background: var(--border-subtle);
  transition: background 0.15s ease, height 0.15s ease;
}

.containers-resize-handle:hover .containers-resize-grip,
.containers-resize-handle.dragging .containers-resize-grip {
  background: var(--accent-blue);
  height: 42px;
}

.containers-toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Pane 3: Maximized Preview Viewport Stage (shrinks smoothly when Inbox Queue is pulled open, staying visible & interactive) */
#previewViewportPane,
.preview-pane-column {
  flex: 1 1 280px;
  min-width: 260px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-surface);
}

.containers-toolbar {
  height: 40px;
  min-height: 40px;
  padding: 0 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.breadcrumb-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 0%;
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
}

#currentFolderBreadcrumb {
  flex: 1 1 auto;
  min-width: 48px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.count-chip {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--bg-card);
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 112px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.version-containers-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.v-container-card {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-left: 3px solid transparent;
  border-radius: 8px;
  padding: 9px 11px;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
  display: flex;
  flex-direction: column;
  gap: 5px;
  contain: layout style paint;
  content-visibility: auto;
  contain-intrinsic-size: auto 78px;
}

.vc-load-more-sentinel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 4px 12px;
}

.v-container-card:hover {
  background: var(--bg-card-hover);
}

.v-container-card.selected {
  border-color: rgba(56, 189, 248, 0.35);
  border-left-color: var(--accent-blue);
  background: var(--bg-card-hover);
  box-shadow: var(--specular-top);
}

.vc-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 4px;
}

.vc-eyebrow-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  width: 100%;
}

.vc-header .badge-tag {
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vc-title {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.38;
  color: var(--text-primary);
  word-break: break-word;
  overflow-wrap: anywhere;
  width: 100%;
  min-width: 0;
}

.vc-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-secondary);
  gap: 6px;
  row-gap: 3px;
}

.vc-meta-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.version-pills-bar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.v-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.12s ease;
}

.v-pill:hover,
.v-pill.active {
  background: var(--accent-blue);
  color: var(--btn-accent-fg);
  border-color: var(--accent-blue);
}

.v-pill.official {
  border-color: var(--accent-amber);
}

.v-pill.official:not(.active) .gc-icon {
  color: var(--accent-amber);
}

/* Pane 3: Unified 44px Preview Toolbar & Maximized Document Viewport */
.preview-pane-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg-surface);
  overflow: hidden;
}

.unified-preview-toolbar {
  min-height: 46px;
  padding: 5px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.preview-doc-identity {
  min-width: 160px;
  flex: 1 1 200px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.preview-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.preview-doc-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-doc-meta {
  font-size: 10.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.segmented-mode-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-card);
  padding: 2px;
  border-radius: 7px;
  border: 1px solid var(--border-hairline);
  flex-shrink: 0;
}

.seg-mode-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.12s ease;
}

.seg-mode-btn:hover {
  color: var(--text-primary);
}

.seg-mode-btn.active {
  background: var(--accent-blue);
  color: var(--btn-accent-fg);
  font-weight: 700;
}

.preview-utilities-cluster {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.toolbar-divider {
  width: 1px;
  height: 18px;
  background: var(--border-subtle);
  margin: 0 3px;
}

/* Inline Merge Popover & Settings Popover */
.merge-popover {
  min-width: 280px;
}

.popover-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.popover-search-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  margin-bottom: 6px;
}

.merge-targets-list {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.merge-target-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 7px;
  border-radius: 5px;
  background: var(--bg-card);
  cursor: pointer;
  font-size: 11.5px;
}

.merge-target-item:hover {
  background: var(--accent-blue-soft);
  color: var(--accent-blue);
}

.settings-popover {
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.popover-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.popover-field label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.popover-field select {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 4px 7px;
  border-radius: 5px;
  font-size: 11.5px;
}

.full-width-link {
  width: 100%;
  justify-content: center;
  text-decoration: none;
}

/* Staged Incoming Evidence Strip (Full-Width Filename Row + Compact Route/Actions Row) */
.incoming-evidence-strip {
  padding: 6px 12px;
  background: var(--accent-blue-soft);
  border-bottom: 1px solid rgba(56, 189, 248, 0.35);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  flex-shrink: 0;
}

.evidence-info-col {
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.evidence-top-line {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
  flex-wrap: nowrap;
}

.evidence-tag {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent-blue);
  color: var(--btn-accent-fg);
  white-space: nowrap;
  flex-shrink: 0;
}

.evidence-name-diff {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1 1 0%;
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  word-break: break-word;
}

.evidence-orig-name {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 11px;
}

.evidence-std-name {
  font-weight: 700;
  color: var(--text-primary);
}

.evidence-inline-rename-wrap {
  display: flex !important;
  align-items: center;
  gap: 5px;
  width: 100%;
  flex: 1 1 100%;
  min-width: 0;
}

.evidence-inline-rename-wrap .q-inline-rename-input {
  flex: 1 1 0% !important;
  width: 100% !important;
  min-width: 180px;
  font-size: 12px;
  padding: 3px 8px;
}

.evidence-route-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
  flex-wrap: wrap;
}

.evidence-route-meta-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  flex: 1 1 260px;
}

.evidence-route-top-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  width: 100%;
  flex-wrap: wrap;
}

.evidence-route-pill {
  font-size: 11px;
  color: var(--accent-emerald);
  font-weight: 600;
  min-width: 0;
  word-break: break-word;
}

.evidence-why-host {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.evidence-why-host .q-tier-why {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
}

.evidence-ocr-text {
  font-size: 10.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.evidence-actions-col {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Maximized Preview Viewport */
.preview-viewport,
#previewViewport {
  flex: 1;
  height: 100%;
  position: relative;
  background: var(--preview-canvas-bg);
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Latest Files Card Gallery View (Feature 14)
   ========================================================================== */
.latest-files-gallery-view {
  width: 100%;
  height: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--bg-surface);
  min-height: 0;
}

.gallery-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card);
  flex-shrink: 0;
}

.preview-back-folder-btn {
  flex-shrink: 0;
}

.gallery-title-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  min-width: 0;
  flex: 1 1 auto;
}

.gallery-title {
  font-weight: 700;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(56vw, 720px);
}

.gallery-count-pill {
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--accent-blue-soft);
  color: var(--accent-blue);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.gallery-summary-chip {
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-hairline);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.gallery-filter-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.gallery-filter-chip {
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline);
  color: var(--text-secondary);
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.gallery-filter-chip.active,
.gallery-filter-chip:hover {
  background: var(--accent-blue-soft);
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

.latest-files-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 272px), 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 14px;
  padding: 14px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.gallery-file-card {
  --card-disc-color: #14b8a6;
  background: var(--bg-card);
  border: 1.5px solid var(--card-disc-color, var(--border-subtle));
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  contain: layout style paint;
  content-visibility: auto;
  contain-intrinsic-size: auto 320px;
}

.gallery-file-card:hover {
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
  transform: translateY(-2px);
}

@media (hover: none), (pointer: coarse) {
  .gallery-file-card {
    box-shadow: none;
    transition: border-color 0.12s ease;
  }
  .gallery-file-card:hover {
    box-shadow: none;
    transform: none;
  }
}

.gallery-card-top-zone {
  background: color-mix(in srgb, var(--card-disc-color, #14b8a6) 8%, var(--bg-card));
  border-bottom: 1px solid color-mix(in srgb, var(--card-disc-color, #14b8a6) 24%, var(--border-hairline));
  padding: 9px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.gallery-card-header,
.gallery-card-badges-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  flex-wrap: wrap;
  font-size: 11px;
}

.gallery-badges-spacer {
  flex: 1 1 0%;
}

.gallery-card-badges-left {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.gallery-cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 700;
  background: var(--accent-blue-soft);
  color: var(--accent-blue);
  border: 1px solid color-mix(in srgb, var(--accent-blue) 35%, transparent);
  max-width: 175px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-cat-pill span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-proj-pill {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 99px;
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-ver-count-pill {
  padding: 2px 6px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.14);
  color: var(--accent-emerald, #10b981);
  border: 1px solid rgba(16, 185, 129, 0.3);
  white-space: nowrap;
}

.gallery-doc-code-pill {
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: color-mix(in srgb, var(--card-disc-color, #14b8a6) 15%, var(--bg-surface));
  color: var(--card-disc-color, #14b8a6);
  border: 1px solid color-mix(in srgb, var(--card-disc-color, #14b8a6) 42%, transparent);
}

.gallery-format-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.gallery-disc-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 700;
  background: color-mix(in srgb, var(--card-disc-color, #14b8a6) 16%, var(--bg-surface));
  color: var(--card-disc-color, #14b8a6);
  border: 1px solid color-mix(in srgb, var(--card-disc-color, #14b8a6) 45%, transparent);
  white-space: nowrap;
}

.gallery-ver-pill {
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 800;
  background: color-mix(in srgb, var(--card-disc-color, #14b8a6) 18%, var(--bg-surface));
  color: var(--card-disc-color, #14b8a6);
  border: 1px solid color-mix(in srgb, var(--card-disc-color, #14b8a6) 45%, transparent);
  white-space: nowrap;
}

.gallery-card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.gallery-card-title {
  padding: 0;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  white-space: normal !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  width: 100%;
  flex: 1;
}

.gallery-card-date {
  color: var(--text-muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

.gallery-card-preview-stage {
  flex: 0 0 164px;
  min-height: 164px;
  height: 164px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  padding: 8px;
  border-bottom: 1px solid var(--border-hairline);
}

/* Shimmer Skeleton Placeholder (Feature 16 — GPU-composited opacity & auto-disabled once loaded) */
.gallery-card-skeleton {
  position: absolute;
  inset: 0;
  background: var(--bg-card);
  animation: galleryShimmer 1.6s infinite ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  z-index: 1;
}

.gallery-card-skeleton.is-loaded {
  display: none !important;
  animation: none !important;
}

@media (pointer: coarse), (max-width: 1280px), (prefers-reduced-motion: reduce) {
  .gallery-card-skeleton {
    animation: none !important;
  }
}

@keyframes galleryShimmer {
  0%, 100% {
    opacity: 0.58;
  }
  50% {
    opacity: 0.94;
  }
}

.gallery-card-preview-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: relative;
  z-index: 2;
}

.gallery-card-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  color: var(--text-muted);
  position: relative;
  z-index: 2;
}

/* Gallery Pagination Bar (Feature 16) */
.gallery-pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.gallery-page-indicator {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.gallery-pagination-bar button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.gallery-card-author-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 7px 12px;
  background: color-mix(in srgb, var(--bg-surface) 65%, var(--bg-card));
  border-bottom: 1px solid var(--border-hairline);
  flex-shrink: 0;
}

.gallery-author-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 0;
}

.gallery-author-avatar,
.gallery-author-chip .gc-user-avatar,
.gallery-author-chip .gc-user-avatar-fallback {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--border-subtle, #cbd5e1) 70%, transparent);
}

.gallery-author-chip .gc-user-avatar {
  object-fit: cover;
  display: inline-block;
}

.gallery-author-chip .gc-user-avatar-fallback {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.gallery-author-info,
.gallery-author-meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.gallery-author-name {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.gallery-card-meta-right {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: auto;
}

.gallery-author-role,
.gallery-author-name .role {
  font-weight: 500;
  color: var(--text-secondary);
}

.gallery-author-email {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-card-desc-zone {
  padding: 7px 12px;
  font-size: 11.5px;
  line-height: 1.42;
  color: var(--text-secondary);
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gallery-card-desc-zone strong {
  color: var(--text-primary);
}

.gallery-card-footer {
  padding: 7px 12px 9px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-top: auto;
  border-top: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.gallery-card-ver-switcher {
  width: 100%;
}

.gallery-card-actions-pillbox {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 99px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  width: 100%;
  justify-content: space-around;
}

.gallery-card-act-btn,
.gallery-pill-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 99px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
  flex: 1;
}

.gallery-card-act-btn:hover,
.gallery-pill-action-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.gallery-card-act-btn.primary,
.gallery-pill-action-btn.primary-view {
  border-color: var(--card-disc-color, var(--accent-blue));
  color: var(--card-disc-color, var(--accent-blue));
  background: color-mix(in srgb, var(--card-disc-color, #14b8a6) 10%, var(--bg-card));
}

.gallery-card-act-btn.primary:hover,
.gallery-pill-action-btn.primary-view:hover {
  background: var(--card-disc-color, var(--accent-blue));
  color: #ffffff;
}

.gallery-action-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--accent-blue);
}

/* Settings Discipline Colors Grid (Requirement 2) */
.settings-disciplines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.discipline-color-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 2px solid var(--disc-item-color, var(--border-subtle));
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.discipline-color-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.discipline-color-code {
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 800;
  font-family: var(--font-sans);
  background: color-mix(in srgb, var(--disc-item-color, #14b8a6) 18%, var(--bg-card));
  color: var(--disc-item-color, #14b8a6);
}

.discipline-color-names {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.discipline-color-zh {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.discipline-color-en {
  font-size: 10.5px;
  color: var(--text-muted);
}

.discipline-color-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.discipline-color-picker {
  width: 32px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.discipline-color-hex {
  width: 74px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 11px;
  text-transform: uppercase;
}

.gallery-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ==========================================================================
   Stacked Multi-Document Scan Deck & Animated 1-by-1 Review Stepper
   ========================================================================== */
.gc-file-stack {
  position: relative;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1.5px solid color-mix(in srgb, var(--accent-blue) 42%, var(--border-subtle));
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  z-index: 1;
}

/* Physical 3-Layer Paper Stack Deck Effect when Folded */
.gc-file-stack.is-folded {
  margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
}

.gc-file-stack.is-folded::before,
.gc-file-stack.is-folded::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  height: 100%;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid color-mix(in srgb, var(--accent-blue) 30%, var(--border-subtle));
  pointer-events: none;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease;
}

.gc-file-stack.is-folded::before {
  bottom: -5px;
  z-index: -1;
  transform: scaleX(0.985);
  opacity: 0.88;
}

.gc-file-stack.is-folded::after {
  bottom: -9px;
  left: 12px;
  right: 12px;
  z-index: -2;
  transform: scaleX(0.968);
  opacity: 0.62;
}

.gc-file-stack.is-folded:hover {
  border-color: var(--accent-blue);
}

.gc-file-stack.is-folded:hover::before {
  transform: translateY(2px) scaleX(0.988);
}

.gc-file-stack.is-folded:hover::after {
  transform: translateY(4px) scaleX(0.972);
}

.gc-file-stack.is-unfolded {
  border-color: var(--accent-blue);
  background: color-mix(in srgb, var(--accent-blue) 5%, var(--bg-surface));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  margin-bottom: 6px;
}

.gc-stack-header {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  cursor: pointer;
  border-radius: 9px;
}

.gc-file-stack.is-unfolded .gc-stack-header {
  border-bottom: 1px solid var(--border-hairline);
  border-radius: 9px 9px 0 0;
  background: color-mix(in srgb, var(--accent-blue) 8%, var(--bg-card));
}

.stack-chk-col {
  padding-top: 2px;
}

.gc-stack-header-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gc-stack-top-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

.gc-stack-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 700;
  background: var(--accent-blue-soft);
  color: var(--accent-blue);
  border: 1px solid color-mix(in srgb, var(--accent-blue) 35%, transparent);
}

.gc-stack-rot-badge,
.rule-hit-badge.stack-rotated-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1.5px 7px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.14);
  color: var(--accent-emerald, #10b981);
  border: 1px solid rgba(16, 185, 129, 0.32);
}

.rule-hit-badge.stack-page-pill {
  background: var(--accent-blue-soft);
  color: var(--accent-blue);
  border-color: color-mix(in srgb, var(--accent-blue) 35%, transparent);
  font-weight: 700;
}

.gc-stack-uploader {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.gc-stack-orig-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 22px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  word-break: break-word;
  line-height: 1.35;
}

.gc-stack-peek-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 7px;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
}

.gc-stack-peek-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  min-width: 0;
}

.gc-stack-peek-idx {
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--accent-blue);
  border: 1px solid var(--border-hairline);
  flex-shrink: 0;
}

.gc-stack-peek-page {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.gc-stack-peek-name {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.gc-stack-peek-dest {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: var(--accent-emerald, #10b981);
  white-space: nowrap;
  max-width: 135px;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.gc-stack-peek-more {
  font-size: 10.5px;
  color: var(--text-secondary);
  padding-top: 2px;
  border-top: 1px dashed var(--border-hairline);
}

.gc-stack-actions-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 2px;
}

/* Unfolded Deck Body & Interactive 1-by-1 Stepper */
.gc-stack-unfolded-body {
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gc-stack-unfolded-body.just-unfolded .gc-stack-stepper-bar {
  animation: gcStackBarReveal 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.gc-stack-stepper-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.gc-stack-stepper-nav {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.gc-stack-step-pills {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.gc-stack-step-pill {
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.gc-stack-step-pill:hover {
  border-color: var(--accent-blue);
  color: var(--text-primary);
}

.gc-stack-step-pill.step-done {
  border-color: rgba(16, 185, 129, 0.45);
  color: var(--accent-emerald, #10b981);
}

.gc-stack-step-pill.step-binned {
  opacity: 0.55;
  text-decoration: line-through;
}

.gc-stack-step-pill.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.35);
  transform: translateY(-1px);
}

.gc-stack-stepper-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.gc-stack-active-pos {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-blue);
  font-variant-numeric: tabular-nums;
}

.gc-stack-all-cards-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.gc-stack-child-card {
  border-left: 3px solid var(--accent-blue);
}

.gc-stack-unfold-anim {
  animation: gcStackUnfoldCard 0.36s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--stack-card-delay, 0ms);
}

.gc-stack-card-step-anim {
  animation: gcStackStepSlide 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes gcStackBarReveal {
  0% {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes gcStackUnfoldCard {
  0% {
    opacity: 0;
    transform: translateY(-14px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes gcStackStepSlide {
  0% {
    opacity: 0.35;
    transform: translateX(10px) scale(0.985);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* Queue All Clear Celebration Empty Card */
.queue-all-clear-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  margin: 6px 2px;
  border-radius: 10px;
  border: 1px solid rgba(16, 185, 129, 0.32);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(56, 189, 248, 0.06));
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.queue-all-clear-card:hover {
  transform: translateY(-1px);
  border-color: rgba(16, 185, 129, 0.55);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.13), rgba(56, 189, 248, 0.1));
}

.queue-all-clear-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.16);
  color: var(--accent-emerald);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.queue-all-clear-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.3;
}

.queue-all-clear-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ==========================================================================
   Shared Drive Sync Permission Hint & Tablet File Tree Optimization (768px-1180px)
   ========================================================================== */
.tax-drive-sync-hint {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin: 3px 2px 4px;
  padding: 5px 7px;
  border-radius: 5px;
  border: 1px dashed var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.35;
  max-width: 215px;
  white-space: normal;
  word-break: break-word;
  box-sizing: border-box;
  flex-shrink: 0;
}

.tax-drive-sync-hint-icon {
  display: inline-flex;
  align-items: center;
  color: var(--accent-amber);
  margin-top: 1px;
  flex-shrink: 0;
}

.tax-drive-sync-hint-text {
  flex: 1;
  min-width: 0;
}

/* Tablet Portrait & Landscape (iPad Mini / Air / Pro 768px - 1180px) */
@media (min-width: 768px) and (max-width: 1180px) {
  #explorerWorkspaceMain.workspace-grid {
    grid-template-columns: 205px 1fr;
    height: calc(100vh - var(--header-height));
    height: calc(100dvh - var(--header-height));
    min-height: 0;
  }

  #explorerWorkspaceMain #treePaneContainer.left-explorer-panel {
    width: 205px;
    min-width: 205px;
    max-width: 205px;
    height: 100%;
    max-height: calc(100dvh - var(--header-height));
    min-height: 0;
  }

  #explorerWorkspaceMain #treePaneContainer #favouriteFoldersList {
    max-height: min(86px, 14dvh);
  }

  #explorerWorkspaceMain #treePaneContainer #taxonomyTreeContainer {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-x pan-y;
    padding: 5px 6px calc(32px + env(safe-area-inset-bottom, 0px));
  }

  .tax-drive-sync-hint {
    max-width: 175px;
  }
}

/* Coarse Pointer / Touch Devices (Tablets & Touchscreens) */
@media (hover: none) and (pointer: coarse) {
  #taxonomyTreeContainer .tax-drive-header {
    min-height: 32px;
    padding-top: 5px;
    padding-bottom: 5px;
  }

  #taxonomyTreeContainer .tax-proj-header,
  #taxonomyTreeContainer .tax-cat-header,
  #taxonomyTreeContainer .tax-sub-item {
    min-height: 29px;
  }

  #taxonomyTreeContainer .tax-chevron-toggle {
    width: 20px;
    height: 20px;
  }
}

/* Inline Queue Proposed Filename Editor & Evidence Strip Rename */
.q-std-name-editable {
  cursor: text;
  border-radius: 4px;
  padding: 1px 3px;
  margin: -1px -3px;
  border-bottom: 1px dashed rgba(99, 102, 241, 0.45);
  transition: background 0.14s ease, border-color 0.14s ease;
}

.q-std-name-editable:hover {
  background: rgba(99, 102, 241, 0.12);
  border-bottom-color: var(--accent, #6366f1);
}

.btn-edit-group-name {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  margin-left: 4px;
  vertical-align: middle;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  opacity: 0.72;
  transition: opacity 0.14s ease, background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.queue-job-item:hover .btn-edit-group-name,
.gc-file-stack:hover .btn-edit-group-name,
.v-container-card:hover .btn-edit-group-name,
.gallery-file-card:hover .btn-edit-group-name,
.btn-edit-group-name:hover,
.btn-edit-group-name:focus-visible {
  opacity: 1;
  color: var(--accent, #6366f1);
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.28);
}

.vc-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
  width: 100%;
}

.vc-title-row .vc-title {
  flex: 1 1 auto;
  min-width: 0;
}

.vc-group-title-editable {
  cursor: text;
}

.q-inline-rename-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  max-width: 100%;
  min-height: 22px;
  margin-top: 0;
}

.q-inline-rename-input {
  flex: 1 1 auto;
  min-width: 120px;
  height: 22px;
  padding: 1px 6px;
  line-height: 1.3;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-primary, #f8fafc);
  background: var(--bg-elevated, rgba(15, 23, 42, 0.85));
  border: 1px solid var(--accent, #6366f1);
  border-radius: 5px;
  outline: none;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
  box-sizing: border-box;
}

[data-theme="light"] .q-inline-rename-input {
  color: #0f172a;
  background: #ffffff;
}

.evidence-name-editable {
  cursor: text;
  border-bottom: 1px dashed rgba(99, 102, 241, 0.45);
  border-radius: 3px;
  padding: 0 3px;
}

.evidence-name-editable:hover {
  background: rgba(99, 102, 241, 0.12);
}

/* Icon+Label Rename-Only (手動歸檔) Button, Non-Project Pill & Queue Drag-to-Stack Feedback */
.btn-amber-manual {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-amber, #f59e0b);
  border: 1px solid rgba(245, 158, 11, 0.36);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.btn-amber-manual:hover {
  background: rgba(245, 158, 11, 0.24);
  border-color: var(--accent-amber, #f59e0b);
  color: var(--accent-amber, #f59e0b);
  transform: translateY(-1px);
}

.q-why-pill.q-why-nonproject {
  background: rgba(245, 158, 11, 0.11);
  color: var(--accent-amber, #d97706);
  border-color: rgba(245, 158, 11, 0.32);
}

.queue-job-item[data-stack-draggable="1"],
.gc-file-stack[data-stack-draggable="1"] {
  cursor: grab;
}

.queue-job-item.is-dragging-stack-source,
.gc-file-stack.is-dragging-stack-source {
  opacity: 0.55;
  transform: scale(0.985);
}

.queue-job-item.is-stack-drop-target,
.gc-file-stack.is-stack-drop-target {
  position: relative;
  border: 2px dashed var(--accent-blue, #0284c7) !important;
  background: color-mix(in srgb, var(--accent-blue, #0284c7) 14%, var(--bg-card)) !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.22) !important;
}

.queue-job-item.is-stack-drop-target::after,
.gc-file-stack.is-stack-drop-target::after {
  content: attr(data-drop-hint);
  position: absolute;
  top: -10px;
  right: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  background: var(--accent-blue, #0284c7);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
  pointer-events: none;
  z-index: 10;
}

/* Hide duplicate top-of-preview routing/evidence strip */
#incomingEvidenceStrip {
  display: none !important;
}

/* Immediate Slide-Right Fly-Away & Collapse Animation when a Queue Decision is Taken */
@keyframes queueCardSlideOutRight {
  0% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  72% {
    opacity: 0;
    transform: translateX(110%) scale(0.96);
  }
  100% {
    opacity: 0;
    transform: translateX(112%) scale(0.96);
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: -8px;
    border-top-width: 0;
    border-bottom-width: 0;
  }
}

.queue-job-item.queue-card-sliding-out-right,
.gc-file-stack.queue-card-sliding-out-right,
.queue-job-item.queue-card-fly-away,
.gc-file-stack.queue-card-fly-away {
  animation: queueCardSlideOutRight 0.25s cubic-bezier(0.22, 1, 0.36, 1) forwards !important;
  pointer-events: none !important;
  overflow: hidden !important;
  will-change: transform, opacity, max-height;
}



