:root {
  --wh-page-padding: 16px;
  --wh-panel-gap: 12px;
  --wh-toolbar-padding-y: 8px;
  --wh-hit-size: 32px;
}

body.wh-work-page .page-container-compact {
  padding: var(--wh-page-padding) !important;
}
body.wh-work-page .page-wrapper { min-height: 0; }
#tabler-main-content, #tabler-subpage-container, #tabler-console-container {
  min-width: 0;
  min-height: 0;
}
.wh-toolbar {
  padding: var(--wh-toolbar-padding-y) 12px;
  gap: 8px;
  flex-shrink: 0;
}
.wh-toolbar .btn, .wh-toolbar .form-control, .wh-toolbar .form-select {
  min-height: var(--wh-hit-size);
}
/* 關注／歷史任務清單共用樣式：工具列、表格、標題按鈕、狀態區塊 */
.wh-list-toolbar {
  padding: var(--wh-toolbar-padding-y) 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.wh-list-toolbar .btn, .wh-list-toolbar .form-control, .wh-list-toolbar .form-select { min-height: var(--wh-hit-size); }
.wh-list-filter { flex: 1 1 140px; min-width: 0; max-width: 240px; }
.wh-list-search { flex: 1 1 180px; min-width: 0; max-width: 360px; }
/* 不設定 min-width，窄版不強制橫向捲動 */
.wh-list-table { table-layout: fixed; width: 100%; }
.wh-list-table td { overflow-wrap: anywhere; }
.wh-list-scroll { overflow-x: auto; }
/* 標題為可聚焦按鈕：Enter／Space 開啟詳情，使用本文字型 */
.wh-list-title {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  text-align: start;
  color: var(--tblr-body-color);
  font-weight: 600;
  white-space: normal;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.wh-list-title:hover { color: var(--tblr-primary); }
.wh-list-title:focus-visible { outline: 2px solid var(--tblr-primary); outline-offset: 2px; border-radius: 2px; }
/* 列內圖示操作（查看詳情、取消關注）套用共用點擊區：桌面 32px、觸控 44px */
.wh-list-table td .btn-icon { min-width: var(--wh-hit-size); min-height: var(--wh-hit-size); }
.wh-list-meta { font-size: 12px; color: var(--tblr-secondary); margin-top: 4px; overflow-wrap: anywhere; }
.wh-list-state { text-align: center; padding: 32px 12px; color: var(--tblr-secondary); }
.wh-list-state-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
/* 窄版：隱藏獨立編號欄（編號已併入標題首行），標題與狀態維持可見 */
@media (max-width: 767.98px) {
  .wh-list-col-optional { display: none; }
  .wh-list-scroll { overflow-x: hidden; }
  /* 兩頁欄位順序皆為「…狀態、操作」：窄版收窄狀態與操作欄並減少儲存格內距，把寬度留給標題 */
  .wh-list-table th:nth-last-child(2) { width: 84px !important; }
  .wh-list-table th:last-child { width: 60px !important; }
  .wh-list-table > :is(thead, tbody) > tr > :is(th, td) { padding-left: 8px; padding-right: 8px; }
}
.wh-task-search { flex: 1 1 180px; max-width: 360px; min-width: 140px; }
.wh-task-options { padding: 8px 12px; border-bottom: 1px solid var(--tblr-border-color); }
.wh-task-options[hidden] { display: none; }
.wh-task-options-body { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.wh-task-options-body > select { flex: 1 1 130px; max-width: 240px; }
.wh-task-options-body label { flex-basis: 100%; margin: 0; }
.wh-task-secondary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wh-task-status { font-size: 12px; min-width: 0; padding-top: 4px; padding-bottom: 4px; }
.wh-task-status #task-quick-feedback { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabler-dc-container { gap: var(--wh-panel-gap) !important; }
.dc-device-picker { width: 240px; max-width: 100%; }
.dc-main-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.dc-main-toolbar .dc-connection-info { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dc-terminal-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dc-terminal-toolbar .card-title { margin-right: auto; }
#tabler-dc-topic-label:empty { display: none; }
#tabler-dc-topic-label { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
#tabler-dc-output { padding: 12px !important; }
#tabler-dc-welcome { white-space: normal; }
.dc-command-area { padding: 12px; flex-shrink: 0; }
.dc-command-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dc-command-row > .input-group { flex: 1 1 280px; min-width: 0; width: auto; }
.dc-command-row .form-control { min-width: 0; }
.dc-preset-menu { max-width: min(360px, 85vw); max-height: 260px; overflow: auto; padding: 8px; }
.dc-preset-menu select { min-width: 200px; max-width: 100%; }
.dc-workspace.dc-narrow { grid-template-columns: minmax(0, 1fr) !important; }
.dc-narrow .dc-splitter { display: none; }
.dc-narrow:not(.dc-mobile-reference) .dc-reference-card,
.dc-narrow.dc-mobile-reference .dc-terminal-card { display: none !important; }
.tabler-dc-container:has(.dc-narrow) .dc-mobile-switch { display: flex; flex-shrink: 0; }
.dc-tool-overlay .dc-tool-panel:not([hidden]) { position: absolute; inset: 0; z-index: 5; max-height: 100%; }
.dc-terminal-card { position: relative; }
.dc-tool-panel { background: var(--tblr-bg-surface); }
.dc-tool-close { float: right; }
.dc-short #tabler-dc-output { padding: 6px 12px !important; }
.dc-short .dc-command-row > .input-group { flex-basis: 200px; }
.dc-short #tabler-dc-status-bar { max-height: 44px; overflow: auto; }

@media (max-width: 767.98px) {
  :root { --wh-page-padding: 12px; }
  .wh-task-search { max-width: none; }
  .dc-main-toolbar .dc-connection-info { flex-basis: 100%; }
  .dc-main-toolbar .dc-last-message { display: none; }
  #tabler-dc-kb-detail { padding: 16px !important; }
}
@media (pointer: coarse) {
  :root { --wh-hit-size: 44px; }
  .tabler-dc-container .btn, .tabler-dc-container .form-control,
  .tabler-dc-container .form-select { min-height: 44px; }
}

.wh-task-options { flex-shrink: 0; max-height: 40%; overflow: auto; }
.wh-task-status #task-filter-summary { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh-task-status #task-quick-feedback:empty { display: none; }

/* S2 任務看板與便籤：主工作區不再被進行中欄的便籤占用半高。 */
.wh-task-workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; height: var(--wh-workspace-height, 80dvh); min-height: 0; }
/* 需求便籤依使用習慣顯示於左側（DOM 已置於看板前）；工作區 <1000px 時改為看板下方 */
/* 桌面寬度明確定義單列高度＝工作區高度；否則隱含列高 auto 會被卡片內容撐開，
   使 #tabler-tasks-layout 的 height:100% 失效，看板欄與清單無法內部捲動 */
@media (min-width: 768px) {
  .wh-task-workspace { grid-template-rows: minmax(0, 1fr); }
  /* 看板同理：未定義列高時欄位被卡片撐高，overflow-y:hidden 直接裁掉下方卡片 */
  .wh-kanban-board { grid-template-rows: minmax(0, 1fr); }
}
.wh-task-workspace.wh-note-open { grid-template-columns: minmax(280px, 28%) minmax(0, 1fr); }
.wh-task-workspace.wh-note-open.wh-note-bottom { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 40%); }
.wh-task-workspace.wh-note-bottom > .wh-task-note { order: 1; }
#tabler-tasks-layout { min-width: 0; margin: 0; }
#tabler-task-list-col { padding: 0; min-width: 0; }
#tabler-tasks-kanban-view { padding: 12px !important; }
.wh-kanban-board { display: grid; grid-template-columns: repeat(4, minmax(280px, 1fr)); gap: 12px; overflow-x: auto; overflow-y: hidden; padding-bottom: 8px; }
.wh-kanban-column { min-width: 0; }
.wh-task-note { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.wh-task-note[hidden] { display: none; }
.wh-task-note .btn, .kanban-card-actions > .btn, .kanban-card [data-watched] { min-width: var(--wh-hit-size); min-height: var(--wh-hit-size); padding: 4px !important; }
.kanban-card { cursor: grab; }
.kanban-card:active { cursor: grabbing; }
.kanban-card .card-body.p-2 { padding: 10px !important; }
.kanban-card .card-body > .d-flex:first-child { gap: 4px !important; margin-bottom: 4px !important; }
.wh-mobile-column-select { display: none; }
@media (max-width: 767.98px) {
  .wh-task-workspace { height: auto; }
  .wh-task-workspace.wh-note-open.wh-note-bottom { height: var(--wh-workspace-height, 80dvh); grid-template-rows: minmax(0, 1fr) minmax(160px, 35%); }
  .wh-task-workspace.wh-note-open #tabler-tasks-layout { height: 100% !important; min-height: 0 !important; }
  .wh-note-open #tabler-task-list-col, .wh-note-open #tabler-tasks-main-card { height: 100% !important; min-height: 0; }
  .wh-note-open #tabler-tasks-kanban-view, .wh-note-open #tabler-tasks-table-view { flex: 1; min-height: 0; overflow: auto; }
  .wh-note-open #tabler-kanban-board, .wh-note-open .wh-kanban-column { height: 100%; min-height: 0; }
  .wh-note-open .kanban-column-card { height: 100%; overflow: hidden; }
  .wh-note-open .kanban-card-list { min-height: 0; max-height: none; flex: 1; }
  .wh-task-note { box-shadow: none; }
  .wh-mobile-column-select { display: block; width: calc(100% - 24px); margin: 8px 12px; }
  .wh-kanban-board { grid-template-columns: minmax(0, 1fr); overflow: visible; }
  .wh-mobile-column-hidden { display: none; }
}
.wh-mobile-column-select[hidden] { display: none; }

/* 批次 E（保守版）：看板卡、需求便籤、篩選徽章的 macOS 外觀。只改外觀屬性，不動版面。
   .card.kanban-card（0,2,0）高於 theme-macos.css 的 .card（0,1,0）；卡片 class 的 .border 帶強制旗標，
   邊框維持 Tabler 預設 1px（顏色已由 --tblr-border-color 取自 --wh-separator），此處不再覆寫 */
.card.kanban-card {
  border-radius: var(--wh-radius-panel);
  border-color: var(--wh-separator);
  background-color: var(--wh-bg-content);
  box-shadow: none;
}
/* hover 只換底色，不位移；選取中的卡片仍由 bg-primary-lt 決定 */
.card.kanban-card:hover { background-color: var(--wh-bg-control-hover); }
.card.wh-task-note {
  border: 1px solid var(--wh-separator);
  background-color: var(--wh-bg-content-secondary);
  box-shadow: none;
}
/* 篩選條件數徽章：inspector 樣式（accent-tint 底＋accent-text 字） */
#task-options-count {
  background-color: var(--wh-accent-tint);
  color: var(--wh-accent-text);
}

/* Knowledge reference keeps search space and article reading rhythm. */
.dc-kb-toolbar { padding: 8px 12px; }
.dc-kb-result-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; line-height: 1.45; }
.dc-kb-detail { padding: 24px; }
@container (max-width: 959px) { .dc-kb-detail { padding: 16px; } }

.dc-kb-detail-header h3 { min-width: 0; overflow-wrap: anywhere; }
.dc-kb-detail-header button { flex-shrink: 0; }

/* S4：共用知識工作區，只約束閱讀頁，不影響編輯表單及其他自然捲動頁面。 */
.wh-nav-section { padding: 12px 12px 4px; font-size: 12px; font-weight: 600; color: var(--tblr-secondary); }
.wh-kb-workspace { height: var(--wh-workspace-height, 80dvh); min-height: 0; gap: var(--wh-panel-gap); container-type: inline-size; }
.wh-kb-workspace #tabler-kb-main-row { display: grid; grid-template-columns: minmax(260px, 32%) minmax(0, 1fr); gap: var(--wh-panel-gap); margin: 0; min-height: 0; }
.wh-kb-workspace #tabler-kb-main-row > div { width: auto; max-width: none !important; min-width: 0 !important; padding: 0; margin: 0; min-height: 0; }
.wh-kb-workspace #tabler-kb-main-row > div > .card { min-height: 0; overflow: hidden; }
.wh-kb-workspace #tabler-kb-classifications { flex-shrink: 0; max-height: 35%; overflow: auto; }
.wh-kb-workspace #tabler-kb-classifications summary { padding: 8px 12px !important; min-height: var(--wh-hit-size); cursor: pointer; }
.wh-kb-workspace #tabler-kb-list-container, .wh-kb-workspace #tabler-kb-detail-body { min-height: 0; overscroll-behavior: contain; }
.wh-kb-workspace .card-header, .wh-kb-workspace .card-footer { flex-shrink: 0; }
.wh-kb-workspace #tabler-kb-detail-header { flex-wrap: wrap; gap: 8px; padding: 8px 12px !important; }
.wh-kb-workspace #tabler-kb-detail-header > div { flex-wrap: wrap; min-width: 0; }
.wh-kb-workspace #tabler-kb-detail-title { overflow-wrap: anywhere; }
.wh-reader-body { padding: 24px; }
.wh-result-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; line-height: 1.45; }
.wh-kb-workspace .btn, .wh-kb-workspace summary, .wh-kb-workspace input { min-height: var(--wh-hit-size); }
@container (max-width: 650px) {
  .wh-kb-workspace #tabler-kb-main-row { grid-template-columns: minmax(0, 1fr); }
  .wh-kb-workspace #tabler-kb-detail-col { display: none !important; }
  .wh-kb-workspace #tabler-kb-detail-col.tabler-kb-detail-mobile-active { display: flex !important; position: fixed; inset: 0; z-index: 1050; margin: 0; }
  .wh-kb-workspace #tabler-kb-mobile-back { display: inline-flex !important; }
  .wh-reader-body { padding: 16px; }
}
@media (max-width: 767.98px) { .wh-reader-body { padding: 16px; } }

/* S4 第二批：共享知識庫與文章庫共用的清單/內文分割工作區（泛化自 .wh-kb-workspace）。
   .wh-split-workspace 是容器查詢的容器；容器本身無法被自己的 @container 規則樣式化，
   因此網格放在內層 .wh-split-grid。改用容器查詢而非視窗寬度，是因為側欄展開會縮小工作區，
   視窗寬度無法反映實際可用寬度。 */
.wh-split-workspace { height: var(--wh-workspace-height, 80dvh); min-height: 0; gap: var(--wh-panel-gap); container-type: inline-size; }
.wh-split-grid { display: grid; height: 100%; min-height: 0; gap: var(--wh-panel-gap); }
.wh-split-grid--2 { grid-template-columns: minmax(260px, 32%) minmax(0, 1fr); }
.wh-split-grid--3 { grid-template-columns: minmax(160px, 200px) minmax(220px, 300px) minmax(0, 1fr); }
.wh-split-grid > .card { display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.wh-split-grid .card-header, .wh-split-grid .card-footer { flex-shrink: 0; }
/* 清單與內文各自獨立捲動 */
.wh-split-scroll { min-height: 0; overflow: auto; overscroll-behavior: contain; }
.wh-split-toolbar { padding: 8px 12px; flex-wrap: wrap; gap: 8px; flex-shrink: 0; }
.wh-reading-body { padding: 24px; }
/* 行寬約 72ch 只套用在 Markdown 內文，HTML iframe 容器不受限 */
.wh-reading-measure, .wh-reading-body .markdown { max-width: 72ch; }
.wh-result-summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh-split-back { display: none; }
.wh-split-grid .btn, .wh-split-grid input { min-height: var(--wh-hit-size); }
.wh-split-aside-body { min-height: 0; }
/* 詳情區塊顯示時為直向 flex，讓 HTML 畫布填滿內文面板；高度下限以工作區比例計算而非固定像素 */
.wh-split-reading-flex:not(.d-none) { display: flex; flex-direction: column; flex: 1 1 auto; }
.wh-split-reader .tabler-sk-html-container { min-height: calc(var(--wh-workspace-height, 80dvh) * 0.7); }
@container (max-width: 650px) {
  .wh-split-grid--2, .wh-split-grid--3 { grid-template-columns: minmax(0, 1fr); }
  .wh-split-grid--3 { grid-template-rows: auto minmax(0, 1fr); }
  /* 分類面板以工作區比例限制高度並可捲動，不使用固定像素 */
  .wh-split-grid--3 > .wh-split-aside { max-height: calc(var(--wh-workspace-height, 80dvh) * 0.35); }
  .wh-split-grid--2 > .wh-split-reader { display: none; }
  .wh-split-grid--3 > .wh-split-reader { display: none; }
  .wh-split-grid[data-reader-open="true"] > .wh-split-reader { display: flex; grid-row: 1 / -1; }
  .wh-split-grid[data-reader-open="true"] > .wh-split-list-panel,
  .wh-split-grid[data-reader-open="true"] > .wh-split-aside { display: none; }
  .wh-split-back { display: inline-flex; }
  .wh-reading-body { padding: 16px; }
}
/* 中等工作區（651～1000px）：三欄會把內文擠到約 230px，改為分類置頂、清單與內文兩欄 */
@container (min-width: 651px) and (max-width: 1000px) {
  .wh-split-grid--3 { grid-template-columns: minmax(220px, 34%) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .wh-split-grid--3 > .wh-split-aside { grid-column: 1 / -1; max-height: calc(var(--wh-workspace-height, 80dvh) * 0.25); }
}

/* S4 第四批：設備清單／排程／操作紀錄共用樣式 */
/* 列內操作：主按鈕 + 「更多」，不換行、靠右 */
.wh-ops-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: nowrap; gap: 8px; }
.wh-ops-actions .btn { min-height: var(--wh-hit-size); }
/* 「更多」下拉觸發鈕採共用點擊區 */
.wh-ops-more { min-width: var(--wh-hit-size); min-height: var(--wh-hit-size); }
/* Ping 離線歷程表改以 dvh 計算的局部捲動，取代固定 200px */
.wh-ops-ping-scroll { max-height: min(40dvh, 240px); overflow: auto; }

/* 排程對象勾選區：以 dvh 限制高度並局部捲動，取代 inline 120px */
.wh-ops-target-picker { max-height: min(30dvh, 160px); overflow: auto; }
/* 排程雙欄：寬版各自局部捲動；窄版不再把兩個捲動區上下擠在一屏，
   改為自然頁面捲動，只有可能很長的排程對象清單保留有限高度的局部捲動 */
.wh-ops-schedule-grid { min-width: 0; }
.wh-ops-schedule-grid .btn-sm { min-width: var(--wh-hit-size); }
@container (max-width: 650px) {
  .wh-ops-schedule-grid { height: auto; grid-template-rows: auto auto; }
  .wh-ops-schedule-grid > .card { overflow: visible; }
  .wh-ops-schedule-grid #tabler-ds-target-list { max-height: min(40dvh, 320px); }
  .wh-ops-schedule-grid #tabler-ds-sched-list { overflow: visible; }
}
/* 排程 Modal 底部儲存／取消維持共用點擊區 */
#tabler-ds-modal .modal-footer .btn { min-height: var(--wh-hit-size); }

/* 操作紀錄：標題卡在上、主體佔滿剩餘工作區高度（不用 vh 扣值） */
.wh-ops-log-grid { flex: 1 1 0; height: auto; min-height: 0; }
/* 查詢工具收合：日曆欄隱藏，清單獨佔整列 */
.wh-ops-log-grid.wh-ops-query-collapsed { grid-template-columns: minmax(0, 1fr); }
#tabler-ol-cal-col[hidden], #tabler-ol-query-panel[hidden] { display: none !important; }
@container (max-width: 650px) {
  .wh-ops-log-grid { grid-template-rows: auto minmax(0, 1fr); }
  .wh-ops-log-grid.wh-ops-query-collapsed { grid-template-rows: minmax(0, 1fr); }
  /* 窄版展開日曆時最多佔工作區一半，其餘留給清單 */
  .wh-ops-log-grid > #tabler-ol-cal-col { max-height: calc(var(--wh-workspace-height, 80dvh) * 0.5); }
}
/* 日誌輸出與指令：以 dvh 限高並局部捲動 */
.wh-ops-log-output { min-height: 180px; max-height: min(60dvh, 520px); overflow: auto; white-space: pre-wrap; word-break: break-all; line-height: 1.6; }
.wh-ops-log-cmd { max-height: min(30dvh, 180px); overflow: auto; white-space: pre-wrap; word-break: break-all; line-height: 1.5; }

/* ── 待辦頁：內容區自然高度，操作命中區達 --wh-hit-size ── */
.wh-todo-content { overflow-x: auto; }
.wh-todo-hit { min-width: var(--wh-hit-size); min-height: var(--wh-hit-size); }
/* 勾選框維持 1.25rem 視覺尺寸，外層 label 撐滿 --wh-hit-size 作為實際命中區；
   以負外距讓 label 垂直置中於標題首行（約 1.5rem 行高），不額外推高列表項目 */
.wh-todo-check { display: inline-flex; align-items: center; justify-content: center; width: var(--wh-hit-size); height: var(--wh-hit-size); margin: calc((1.5rem - var(--wh-hit-size)) / 2) 0; cursor: pointer; }
.wh-todo-check .form-check-input { width: 1.25rem; height: 1.25rem; }
.wh-todo-actions { align-items: center; }
/* 提示列（完成後可復原）：非阻塞，置於內容區頂部 */
.wh-todo-undo .btn { min-height: var(--wh-hit-size); }

/* ── AI 工作台：自然頁面捲動，長內容在自己區域捲動，不用 vh 扣值 ── */
.wh-ai-filters { padding: 8px 12px; }
.wh-ai-filter { flex: 1 1 140px; min-width: 0; max-width: 240px; width: auto; }
.wh-ai-task-picker { flex: 1 1 220px; min-width: 0; }
.wh-ai-editor { height: clamp(200px, 38dvh, 420px); overflow: auto; }
.wh-ai-preview { max-height: min(60dvh, 560px); overflow: auto; overscroll-behavior: contain; }

/* ── 會議記錄：沿用 wh-split 雙窗格，內容區 padding 16px（寬版 24px），預覽由外層捲動 ── */
.wh-mn-body { padding: 16px; display: flex; flex-direction: column; }
.wh-mn-body > #tabler-mn-content-edit { flex: 1 1 auto; min-height: 0; }
.wh-mn-preview { min-height: 0; }
@container (min-width: 900px) {
  .wh-mn-body { padding: 24px; }
}

/* ── 架構圖／共享架構圖：沿用 wh-split 雙窗格，畫布填滿讀取區 ── */
/* Mermaid 畫布：填滿剩餘高度、置中、超出時自行捲動，取代固定 min-height */
.wh-dg-canvas { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; align-items: center; justify-content: center; }
.wh-dg-canvas svg { max-width: 100%; height: auto; }
/* 說明／留言文字維持約 72ch 行寬 */
.wh-dg-prose { max-width: 72ch; }
.wh-dg-item { min-height: var(--wh-hit-size); }
.wh-dg-readonly-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--tblr-border-radius, 4px); background: var(--tblr-lime-lt, rgba(116, 184, 22, .12)); color: var(--tblr-lime, #74b816); font-size: .8125rem; white-space: nowrap; }
/* 編輯器區：容器查詢以自身寬度決定並排或分頁，不依賴視窗寬度 */
.wh-dg-main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; container-type: inline-size; }
.wh-dg-tabs { display: none; flex-shrink: 0; }
.wh-dg-tabs .nav-link { min-height: var(--wh-hit-size); }
.wh-dg-editor-split { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.wh-dg-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.wh-dg-pane + .wh-dg-pane { border-left: 1px solid var(--tblr-border-color, rgba(128, 128, 128, .25)); }
.wh-dg-textarea { flex: 1 1 auto; min-height: 0; resize: none; line-height: 1.5; font-size: .82rem; }
#tabler-dg-feedback:empty { display: none; }
@container (max-width: 560px) {
  .wh-dg-tabs { display: flex; }
  .wh-dg-editor-split { grid-template-columns: minmax(0, 1fr); }
  .wh-dg-main[data-dg-pane="edit"] [data-dg-pane-el="preview"],
  .wh-dg-main[data-dg-pane="preview"] [data-dg-pane-el="edit"] { display: none; }
  .wh-dg-pane + .wh-dg-pane { border-left: 0; }
}

/* ── 系統設定：各分頁自然頁面捲動，不使用 vh 扣值；長清單以 dvh 有界捲動 ── */
.wh-st-scroll { max-height: clamp(240px, 60dvh, 560px); overflow: auto; overscroll-behavior: contain; }
.wh-st-scroll--sm { max-height: clamp(120px, 28dvh, 200px); }
.wh-st-toolbar { padding: 8px 12px; gap: 8px; }
.wh-st-feedback:empty { display: none; }
/* 設定頁按鈕、輸入框與分頁連結採共用點擊區 */
.wh-st-root .btn, .wh-st-root .form-control, .wh-st-root .form-select, .wh-st-root .nav-tabs .nav-link, .wh-st-root .nav-pills .nav-link { min-height: var(--wh-hit-size); }

/* 批次 F：settings 左側分類 + 右側內容（macOS System Settings 風格）。
   .wh-st-workspace 為容器查詢的容器，窄版依實際可用寬度而非視窗寬度決定。 */
.wh-st-workspace { container-type: inline-size; }
.wh-st-layout { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: var(--wh-panel-gap); align-items: start; }
.wh-st-sidebar { background: var(--wh-bg-content-secondary); border: 1px solid var(--wh-separator); border-radius: var(--wh-radius-popover); padding: 8px; min-width: 0; }
.wh-st-sidebar .nav { gap: 2px; }
.wh-st-nav-title { padding: 8px 10px 2px; font-size: 11px; font-weight: 600; letter-spacing: .02em; color: var(--tblr-secondary-color); list-style: none; }
.wh-st-nav-title:first-child { padding-top: 2px; }
.wh-st-nav-link { display: flex; align-items: center; font-size: 13px; padding: 6px 10px; }
.wh-st-content { min-width: 0; }
@container (max-width: 650px) {
  .wh-st-layout { grid-template-columns: minmax(0, 1fr); }
  .wh-st-sidebar { overflow-x: auto; }
  .wh-st-sidebar .nav { flex-direction: row; flex-wrap: nowrap; align-items: center; }
  .wh-st-nav-title { display: none; }
  .wh-st-nav-link { white-space: nowrap; }
}
.wh-st-root .btn-close { min-height: 0; }

/* 儀表板：維持自然頁面捲動，只對齊共用間距；卡片高度由內容與 row-deck 決定，不再固定最小高度 */
.wh-dash .wh-dash-row { --tblr-gutter-x: var(--wh-panel-gap, 12px); --tblr-gutter-y: var(--wh-panel-gap, 12px); }
.wh-dash .wh-dash-row + .wh-dash-row { margin-top: var(--wh-panel-gap, 12px); }
.wh-dash .card-header { padding: 8px 12px; min-height: 0; }

/* VIS02：深色主題下 Tabler 次要文字沿用 #667382，在卡片底色上對比僅約 3.2:1；
   只覆寫次要「文字」為 gray-500（約 5.6:1），不改 --tblr-secondary，避免影響按鈕與徽章底色 */
[data-bs-theme="dark"] .text-secondary,
[data-bs-theme="dark"] .text-muted { color: var(--tblr-gray-500) !important; }
[data-bs-theme="dark"] .table thead th,
[data-bs-theme="dark"] .wh-list-meta,
[data-bs-theme="dark"] .wh-list-state { color: var(--tblr-gray-500); }

/* 側欄「遠端控制台」工作階段狀態：圖示右上狀態點（側欄收合仍可見）＋標題下方設備代碼與狀態 */
[data-console-nav] .nav-link-icon { position: relative; }
[data-console-nav] .nav-link-title { min-width: 0; }
.wh-console-dot { position: absolute; top: 0; right: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--tblr-gray-500); box-shadow: 0 0 0 2px var(--wh-bg-sidebar, var(--tblr-bg-surface)); }
[data-console-state="connected"] .wh-console-dot { background: var(--tblr-green); }
[data-console-state="connecting"] .wh-console-dot { background: var(--tblr-yellow); }
.wh-console-device { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; line-height: 1.3; color: var(--tblr-gray-500); font-family: 'IBM Plex Mono', monospace; }
.wh-console-dot[hidden], .wh-console-device[hidden] { display: none !important; }
