/* 頁面專用樣式（共用元件在 theme.css）。不使用 inline style（CSP style-src 'self'）。 */

.gh-avatar-lg {
  width: 52px;
  height: 52px;
  font-size: 1.25rem;
}

.card-header .gh-step-num {
  width: 1.5rem;
  height: 1.5rem;
  background: var(--gh-primary);
  border-color: var(--gh-primary);
  color: #fff;
}

.gh-scroll-list {
  max-height: 60vh;
  overflow-y: auto;
}

/* ---------- Mapping 編輯器（三欄） ---------- */
.gh-mapper-shell {
  --gh-mapper-toolbar: 52px;
}

.gh-mapper-toolbar {
  position: sticky;
  top: var(--gh-topbar-height);
  z-index: 15;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--gh-mapper-toolbar);
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.75rem;
  background: var(--gh-surface);
  border: 1px solid var(--gh-border);
  border-radius: var(--gh-radius);
  box-shadow: var(--gh-shadow-sm);
}

.gh-mapper-filter {
  flex: 0 1 16rem;
  min-width: 10rem;
}

.gh-mapper-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--gh-fs-sm);
  color: var(--gh-text-muted);
  margin-left: auto;
  white-space: nowrap;
}

.gh-unsaved-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gh-accent);
  box-shadow: 0 0 0 3px var(--gh-accent-subtle);
}

.gh-mapper-actions {
  display: flex;
  gap: 0.4rem;
}

.gh-mapper-messages:empty {
  display: none;
}

.gh-mapper-message-list {
  max-height: 10rem;
  overflow-y: auto;
  padding-left: 1.1rem;
}

/* 健康檢查＋載入時的警告：一行摘要（details），詳情收合；「可能遺失資料」的徽章收合時也看得到。 */
.gh-mapper-summary {
  display: block;
  padding: 0.4rem 0.75rem;
  margin-bottom: 0.75rem;
}

.gh-mapper-summary-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.6rem;
  cursor: pointer;
  list-style: none;
}

.gh-mapper-summary-line::-webkit-details-marker {
  display: none;
}

.gh-mapper-summary-part {
  font-size: var(--gh-fs-sm);
}

.gh-mapper-summary .gh-badge-danger {
  background: var(--gh-danger-text);
  color: var(--gh-surface);
  font-weight: 600;
}

.gh-mapper-summary-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
  font-size: var(--gh-fs-sm);
  text-decoration: underline;
}

.gh-mapper-summary-toggle .bi {
  transition: transform var(--gh-transition);
}

.gh-mapper-summary[open] .gh-mapper-summary-toggle .bi {
  transform: rotate(180deg);
}

.gh-mapper-summary[open] .gh-mapper-summary-more,
.gh-mapper-summary:not([open]) .gh-mapper-summary-less {
  display: none;
}

.gh-mapper-summary-body {
  max-height: 40vh;
  overflow-y: auto;
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--gh-border);
}

.gh-mapper-summary-body > * + * {
  margin-top: 0.5rem;
}

/* 編輯器三欄：≥1200px 時分類／規則／FHIR 元素，中間夾兩個拖曳把手（把手就是欄間距）；欄寬可以拖曳調整、左右兩欄可以收合
   （mapping-editor.js；寬度是 html 上的 CSS 變數 --gh-me-categories-w／--gh-me-tree-w，theme-init.js 在繪製前先套用）。 */
.gh-mapper {
  --gh-me-resizer: 0.75rem;
  --gh-me-cat-default: 260px;
  --gh-me-tree-default: 340px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  height: calc(100vh - var(--gh-topbar-height) - var(--gh-mapper-toolbar) - 2.5rem);
  min-height: 520px;
}

.gh-mapper-resizer {
  display: none;
}

/* 寬螢幕：分類欄 17.5rem（標準字級 280px；必填缺漏與規則數兩個徽章並排時，Resource 名稱仍完整，「大字」也一樣）。
   FHIR 元素欄在 1600px 以上才跟著字級變寬（標準字級一樣是 340px）；較窄時維持 340px，中間的規則欄才不會被擠得太窄。 */
@media (min-width: 1400px) {
  .gh-mapper {
    --gh-me-cat-default: 17.5rem;
  }
}

@media (min-width: 1600px) {
  .gh-mapper {
    --gh-me-tree-default: 21.25rem;
  }
}

@media (min-width: 1200px) {
  .gh-mapper {
    --gh-me-cat-col: min(var(--gh-me-categories-w, var(--gh-me-cat-default)), 35%);
    --gh-me-tree-col: min(var(--gh-me-tree-w, var(--gh-me-tree-default)), 45%);
    --gh-me-cat-gap: var(--gh-me-resizer);
    --gh-me-tree-gap: var(--gh-me-resizer);
    grid-template-columns: var(--gh-me-cat-col) var(--gh-me-cat-gap) minmax(0, 1fr) var(--gh-me-tree-gap) var(--gh-me-tree-col);
    gap: 0;
  }

  .gh-mapper > .gh-mapper-categories {
    grid-column: 1;
  }

  .gh-mapper > #me-resize-categories {
    grid-column: 2;
  }

  .gh-mapper > .gh-mapper-rules {
    grid-column: 3;
  }

  .gh-mapper > #me-resize-tree {
    grid-column: 4;
  }

  .gh-mapper > .gh-mapper-tree {
    grid-column: 5;
  }

  .gh-mapper-resizer {
    display: block;
    position: relative;
    cursor: col-resize;
    touch-action: none;
    border-radius: var(--gh-radius);
  }

  .gh-mapper-resizer::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 2.5rem;
    transform: translate(-50%, -50%);
    border-radius: 2px;
    background: var(--gh-border-strong);
    opacity: 0.5;
    transition: opacity var(--gh-transition), background-color var(--gh-transition);
  }

  .gh-mapper-resizer:hover::after,
  .gh-mapper-resizer:focus-visible::after,
  .gh-mapper-resizer.is-dragging::after {
    background: var(--gh-primary);
    opacity: 1;
  }

  .gh-mapper-resizer:focus-visible {
    outline: 2px solid var(--gh-primary);
    outline-offset: -2px;
  }

  /* 收合的欄：欄寬與把手都變成 0（工具列的按鈕可以再展開）。 */
  [data-gh-mapper-hide~="categories"] .gh-mapper {
    --gh-me-cat-col: 0px;
    --gh-me-cat-gap: 0px;
  }

  [data-gh-mapper-hide~="tree"] .gh-mapper {
    --gh-me-tree-col: 0px;
    --gh-me-tree-gap: 0px;
  }

  [data-gh-mapper-hide~="categories"] .gh-mapper-categories,
  [data-gh-mapper-hide~="categories"] #me-resize-categories,
  [data-gh-mapper-hide~="tree"] .gh-mapper-tree.offcanvas-xl,
  [data-gh-mapper-hide~="tree"] #me-resize-tree {
    display: none;
  }

  /* 拖曳中不選取文字 */
  .gh-mapper.is-resizing {
    user-select: none;
    cursor: col-resize;
  }
}

.gh-mapper-layout-tools {
  gap: 0.15rem;
}

#me-toggle-categories[aria-expanded="false"],
#me-toggle-tree[aria-expanded="false"],
#me-fullscreen[aria-pressed="true"] {
  background: var(--gh-primary-subtle);
  color: var(--gh-primary-strong);
}

.gh-mapper-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--gh-surface);
  border: 1px solid var(--gh-border);
  border-radius: var(--gh-radius);
  box-shadow: var(--gh-shadow-sm);
  overflow: hidden;
}

.gh-mapper-pane-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--gh-border);
  font-weight: 600;
  font-size: var(--gh-fs-md);
  flex-shrink: 0;
}

.gh-mapper-pane-body {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
}

@media (max-width: 1199.98px) {
  .gh-mapper-categories {
    display: none;
  }

  .gh-mapper-tree.offcanvas-xl {
    --bs-offcanvas-width: min(400px, 92vw);
    border-radius: 0;
  }
}

@media (min-width: 1200px) {
  .gh-mapper-tree.offcanvas-xl {
    position: static;
    transform: none;
    visibility: visible;
    background-color: var(--gh-surface) !important;
    border: 1px solid var(--gh-border);
  }
}

.gh-mapper-category-select {
  max-width: 22rem;
}

/* 規則欄標題列：欄位窄時（例如「大字」）排序與「新增規則」換到下一行，標題不會被擠成一字一行。 */
.gh-mapper-rules > .gh-mapper-pane-head {
  flex-wrap: wrap;
  row-gap: 0.5rem;
}

#me-rules-title {
  flex-shrink: 0;
}

/* 手機寬度：規則欄標題列換行，分類下拉自己一列（不會被擠成空白框），排序與「新增規則」排在下一列。 */
@media (max-width: 575.98px) {
  .gh-mapper-rules > .gh-mapper-pane-head {
    flex-wrap: wrap;
    row-gap: 0.5rem;
  }

  .gh-mapper-category-select {
    min-width: 9rem;
    flex: 1 1 100%;
    max-width: none;
  }
}

/* 左欄：分類 */
.gh-cat-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.5rem 0.55rem 0.75rem;
  border-bottom: 1px solid var(--gh-border);
  cursor: pointer;
  transition: background-color var(--gh-transition);
}

.gh-cat-item:hover {
  background: var(--gh-hover);
}

.gh-cat-item.active {
  background: var(--gh-primary-subtle);
}

.gh-cat-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--gh-primary);
}

.gh-cat-item.active .gh-cat-name {
  color: var(--gh-primary-strong);
  font-weight: 600;
}

.gh-cat-item:focus-visible {
  outline: 2px solid var(--gh-primary);
  outline-offset: -2px;
}

.gh-cat-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--gh-surface-2);
  color: var(--gh-primary);
  flex-shrink: 0;
}

.gh-cat-item.active .gh-cat-icon {
  background: var(--gh-surface);
}

.gh-cat-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
  line-height: 1.3;
}

.gh-cat-name {
  font-weight: 500;
  font-size: var(--gh-fs-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gh-cat-sub {
  font-size: var(--gh-fs-xs);
  color: var(--gh-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gh-cat-sub code {
  font-size: var(--gh-fs-xs);
  color: var(--gh-text-muted);
}

.gh-cat-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.2rem;
  max-width: 7.5rem;
}

.gh-cat-badges .gh-badge {
  padding: 0.05rem 0.4rem;
  font-size: var(--gh-fs-xs);
}

.gh-cat-menu {
  opacity: 0.55;
}

.gh-cat-item:hover .gh-cat-menu,
.gh-cat-menu[aria-expanded="true"] {
  opacity: 1;
}

/* 中欄：規則 */
.gh-rule-group-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  background: var(--gh-surface-2);
  border-bottom: 1px solid var(--gh-border);
  font-size: var(--gh-fs-sm);
}

.gh-rule {
  display: flex;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem 0.65rem 0.9rem;
  border-bottom: 1px solid var(--gh-border);
  transition: background-color 600ms ease;
}

.gh-rule:hover {
  background: var(--gh-surface-2);
}

.gh-rule.has-warning {
  background: var(--gh-warning-subtle);
  box-shadow: inset 3px 0 0 var(--gh-warning);
}

.gh-rule.is-new {
  background: var(--gh-primary-subtle);
}

.gh-rule-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.gh-rule-path {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.gh-rule-path-input {
  font-size: var(--gh-fs-sm);
  font-weight: 500;
  background: transparent;
  border-color: transparent;
  padding-left: 0.35rem;
  margin-left: -0.35rem;
}

.gh-rule-path-input:hover {
  border-color: var(--gh-border-strong);
}

.gh-rule-path-input:focus {
  background: var(--gh-surface);
}

.gh-rule-status:empty {
  display: none;
}

.gh-rule-value {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
}

.gh-rule-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  flex: 1 1 14rem;
  min-width: 0;
}

.gh-rule-fields > .form-control,
.gh-rule-fields > .form-select {
  flex: 1 1 12rem;
  min-width: 0;
}

.gh-rule-refer {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1 1 12rem;
}

.gh-rule-refer-label {
  font-size: var(--gh-fs-xs);
  color: var(--gh-text-muted);
  white-space: nowrap;
}

.gh-rule-hint {
  flex-basis: 100%;
  font-size: var(--gh-fs-xs);
  color: var(--gh-text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* 代碼欄位的一行中文說明（這個欄位是做什麼的）與收合的「這些選項是什麼意思？」 */
.gh-rule-help {
  flex-basis: 100%;
  font-size: var(--gh-fs-sm);
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
}

.gh-rule-codes-help {
  flex-basis: 100%;
  font-size: var(--gh-fs-xs);
}

.gh-rule-codes-help summary {
  color: var(--gh-text-muted);
  cursor: pointer;
}

.gh-rule-codes-help dl {
  margin: 0.4rem 0 0.25rem;
  max-height: 16rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.gh-rule-codes-help dt {
  font-weight: 600;
  white-space: pre;
}

.gh-rule-codes-help dd {
  margin: 0 0 0.35rem 1rem;
}

.gh-rule-chip {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--gh-fs-xs);
  color: var(--gh-info-text);
  background: var(--gh-info-subtle);
  border-radius: 6px;
  padding: 0.15rem 0.5rem;
  align-self: flex-start;
  max-width: 100%;
}

.gh-rule-chip code {
  color: inherit;
}

.gh-rule-warning {
  display: flex;
  gap: 0.35rem;
  font-size: var(--gh-fs-xs);
  color: var(--gh-warning-text);
}

/* 規則列的警告區（伺服器警告、索引跳號與一鍵改號、多層提示）。 */
.gh-rule-warnings {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.gh-rule-warnings .gh-rule-warning {
  align-items: flex-start;
  flex-wrap: wrap;
}

.gh-rule-warnings .gh-rule-warning > span {
  flex: 1 1 16rem;
  min-width: 0;
  white-space: normal;
}

.gh-rule-fix {
  flex-shrink: 0;
  padding: 0 0.45rem;
  font-size: var(--gh-fs-xs);
  line-height: 1.6;
}

.gh-rule-index-hint {
  align-items: flex-start;
  white-space: normal;
}

.gh-rule-actions {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex-shrink: 0;
}

.gh-rule-actions .btn.is-on {
  color: var(--gh-primary);
  background: var(--gh-primary-subtle);
}

.gh-rule-more {
  margin: 0.75rem auto;
  display: flex;
}

.gh-rule-more-bar {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.gh-rule-more-bar .gh-rule-more {
  margin: 0.75rem 0;
}

/* 預設的規則卡片（2026-11，密集）：右側的三個按鈕（多層路徑、群組代表欄位、刪除）排成一列，放在路徑那一行的右邊，
   卡片只有「路徑」與「值來源＋欄位」兩行（1080p 每條約 80px）；所有控制項都還在。精簡顯示（一行一條）另見 .gh-rules-compact。 */
#me-rules:not(.gh-rules-compact) .gh-rule {
  position: relative;
  padding-top: 0.35rem;
  padding-bottom: 0.4rem;
}

#me-rules:not(.gh-rules-compact) .gh-rule-main {
  gap: 0.25rem;
}

#me-rules:not(.gh-rules-compact) .gh-rule-path {
  padding-right: 6.75rem;
}

#me-rules:not(.gh-rules-compact) .gh-rule-path-input {
  min-height: 1.75rem;
  padding-top: 0.1rem;
  padding-bottom: 0.1rem;
}

#me-rules:not(.gh-rules-compact) .gh-rule-actions {
  position: absolute;
  top: 0.3rem;
  right: 0.5rem;
  flex-direction: row;
}

.gh-rule-empty {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0.9rem;
  color: var(--gh-text-muted);
  font-size: var(--gh-fs-sm);
  border-bottom: 1px solid var(--gh-border);
}

/* 右欄：元素樹與詳情 */
.gh-mapper-tree-search {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--gh-border);
  flex-shrink: 0;
}

.gh-mapper-tree-search .gh-search {
  min-width: 0;
  flex: 1 1 auto;
}

.gh-mapper-tree-body {
  padding: 0.35rem 0;
  min-height: 12rem;
}

.gh-tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* 樹狀導引線表示階層，用實線 border-strong（1px 虛線對視力較弱的人會斷成點）。 */
.gh-tree .gh-tree {
  margin-left: 1.05rem;
  border-left: 1px solid var(--gh-border-strong);
}

.gh-tree-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.6rem 0.22rem 0.35rem;
  font-size: var(--gh-fs-sm);
  cursor: pointer;
  border-radius: 6px;
  margin: 0 0.35rem;
  white-space: nowrap;
}

/* 滑鼠移過：只有中性底色。選取：淺藍底 + 左側 4px 色條（inset 陰影，文字不位移）+ 深藍粗體名稱，兩者不會看起來一樣。 */
.gh-tree-row:hover {
  background: var(--gh-hover);
}

.gh-tree-row.active {
  background: var(--gh-primary-subtle);
  color: var(--gh-primary-strong);
  box-shadow: inset 4px 0 0 var(--gh-primary);
}

.gh-tree-row.active .gh-tree-name {
  font-weight: 600;
}

/* 選取列上的次要文字用 muted（subtle 在淺藍底上對比不到 4.5:1）。 */
.gh-tree-row.active .gh-tree-card,
.gh-tree-row.active .gh-tree-caret,
.gh-tree-row.active .gh-tree-type {
  color: var(--gh-text-muted);
}

.gh-tree-row:focus-visible {
  outline: 2px solid var(--gh-primary);
  outline-offset: -2px;
}

.gh-tree-caret {
  width: 1rem;
  display: inline-grid;
  place-items: center;
  color: var(--gh-text-subtle);
  font-size: var(--gh-fs-xs);
  flex-shrink: 0;
}

.gh-tree-name {
  font-family: var(--gh-font-mono);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.gh-tree-name.is-leaf {
  font-weight: 400;
}

.gh-tree-required {
  color: var(--gh-danger-text);
  font-weight: 700;
}

.gh-tree-flag {
  font-size: var(--gh-fs-xs);
  color: var(--gh-info-text);
}

.gh-tree-type {
  margin-left: auto;
  font-size: var(--gh-fs-xs);
  color: var(--gh-text-muted);
  padding-left: 0.4rem;
}

.gh-tree-card {
  font-size: var(--gh-fs-xs);
  color: var(--gh-text-subtle);
  font-family: var(--gh-font-mono);
  min-width: 2.4rem;
  text-align: right;
}

.gh-tree-empty {
  padding: 0.25rem 1.5rem;
  font-size: var(--gh-fs-xs);
  color: var(--gh-text-subtle);
}

/* 字變大後每列較高：詳細資料最多佔 38%，樹狀清單至少留 12rem。 */
.gh-mapper-detail {
  flex-shrink: 0;
  max-height: 38%;
  overflow-y: auto;
  border-top: 1px solid var(--gh-border);
  background: var(--gh-surface-2);
  padding: 0.75rem 0.9rem;
  font-size: var(--gh-fs-sm);
}

.gh-detail-empty {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  color: var(--gh-text-muted);
  font-size: var(--gh-fs-sm);
}

.gh-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.gh-detail-head strong {
  font-family: var(--gh-font-mono);
  font-size: var(--gh-fs-md);
}

.gh-detail-pathline {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.4rem;
}

.gh-detail-path {
  font-size: var(--gh-fs-xs);
  color: var(--gh-text-muted);
  overflow-wrap: anywhere;
}

.gh-detail-summary {
  margin: 0 0 0.4rem;
  color: var(--gh-text);
}

.gh-detail-def {
  font-size: var(--gh-fs-xs);
  color: var(--gh-text-muted);
  margin-bottom: 0.4rem;
}

.gh-detail-def summary {
  cursor: pointer;
  color: var(--gh-link);
}

.gh-detail-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
  margin-bottom: 0.4rem;
  font-size: var(--gh-fs-xs);
}

.gh-detail-actions {
  margin: 0.5rem 0;
}

.gh-detail-vs-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.gh-detail-codes {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 10rem;
  overflow-y: auto;
  border: 1px solid var(--gh-border-strong);
  border-radius: 6px;
  background: var(--gh-surface);
}

.gh-detail-codes li {
  display: flex;
  gap: 0.5rem;
  padding: 0.2rem 0.5rem;
  font-size: var(--gh-fs-xs);
  border-bottom: 1px solid var(--gh-border);
}

.gh-detail-codes li:last-child {
  border-bottom: 0;
}

.gh-detail-codes span {
  color: var(--gh-text-muted);
}

/* 新增分類：資源目錄 */
.gh-resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
  max-height: 340px;
  overflow-y: auto;
  padding: 2px;
}

.gh-resource-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-align: left;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--gh-border-strong);
  border-radius: 8px;
  background: var(--gh-surface);
  color: var(--gh-text);
  font-size: var(--gh-fs-sm);
  transition: border-color var(--gh-transition), box-shadow var(--gh-transition);
}

.gh-resource-card:hover {
  border-color: var(--gh-primary);
}

.gh-resource-card.active {
  border-color: var(--gh-primary);
  box-shadow: 0 0 0 3px rgba(var(--gh-primary-rgb), 0.18);
  background: var(--gh-primary-subtle);
  color: var(--gh-primary-strong);
}

.gh-resource-card-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.gh-resource-card-head .bi {
  color: var(--gh-primary);
}

.gh-resource-card-head .gh-badge {
  margin-left: auto;
  font-size: var(--gh-fs-xs);
}

.gh-resource-card-desc {
  color: var(--gh-text-muted);
  font-size: var(--gh-fs-xs);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gh-resource-card-foot {
  display: flex;
  justify-content: space-between;
  font-size: var(--gh-fs-xs);
}

/* 共用資源選擇器（_ResourcePicker.cshtml、resource-picker.js）：卡片是 role="radio"，選取時除了底色另有勾號（不只靠顏色）。 */
.gh-resource-picker .gh-resource-card {
  cursor: pointer;
  user-select: none;
}

.gh-resource-card:focus-visible {
  outline: 2px solid var(--gh-primary);
  outline-offset: 2px;
}

.gh-resource-card-check {
  display: none;
  margin-left: auto;
}

.gh-resource-card.active .gh-resource-card-check {
  display: inline-block;
}

.gh-resource-card-zh {
  color: var(--gh-text);
  font-size: var(--gh-fs-sm);
  line-height: 1.3;
}

.gh-resource-card-count {
  align-self: flex-start;
  font-size: var(--gh-fs-xs);
}

.gh-resource-picker-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

/* 分頁固定一列；放不下時（手機）水平捲動而不換行。 */
.gh-resource-tabs {
  flex-wrap: nowrap;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

.gh-resource-tabs button {
  white-space: nowrap;
  flex: 0 0 auto;
}

.gh-resource-tabs button:focus-visible {
  outline: 2px solid var(--gh-primary);
  outline-offset: -2px;
}

.gh-resource-search {
  flex: 1 1 16rem;
  min-width: 0;
}

.gh-resource-group-title {
  grid-column: 1 / -1;
  margin-top: 0.35rem;
  font-size: var(--gh-fs-xs);
  font-weight: 600;
  color: var(--gh-text-muted);
}

.gh-resource-group-title:first-child {
  margin-top: 0;
}

.gh-resource-group-en {
  margin-left: 0.4rem;
  font-weight: 400;
  color: var(--gh-text-subtle);
}

.gh-resource-empty {
  grid-column: 1 / -1;
  padding: 0.5rem;
}

/* 「已選擇：Observation 觀察／檢驗」摘要 */
.gh-resource-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--gh-border);
  border-radius: 8px;
  background: var(--gh-primary-subtle);
  font-size: var(--gh-fs-sm);
}

.gh-resource-summary[hidden],
.gh-name-chips[hidden] {
  display: none;
}

.gh-name-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.gh-name-chip {
  --bs-btn-padding-y: 0.1rem;
  --bs-btn-padding-x: 0.6rem;
  --bs-btn-font-size: var(--gh-fs-sm);
}

/* 進階設定（可選）：預設收合 */
.gh-advanced {
  margin-top: 1rem;
  border-top: 1px solid var(--gh-border);
  padding-top: 0.75rem;
}

.gh-advanced > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: var(--gh-fs-md);
  color: var(--gh-text);
}

.gh-advanced > summary .gh-advanced-note {
  font-weight: 400;
  font-size: var(--gh-fs-sm);
  color: var(--gh-text-muted);
}

.gh-advanced > summary:focus-visible {
  outline: 2px solid var(--gh-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.gh-advanced[open] > summary {
  margin-bottom: 0.75rem;
}

.gh-field-code {
  font-size: var(--gh-fs-xs);
  font-weight: 400;
  color: var(--gh-text-muted);
}

@media (max-width: 575.98px) {
  .gh-resource-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .gh-resource-picker .gh-resource-grid {
    max-height: none;
  }
}

.gh-multi-segments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--gh-border);
  border-radius: 8px;
  background: var(--gh-surface-2);
}

.gh-required-group + .gh-required-group {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gh-border);
}

/* Mapping 頁：編輯器填滿視窗（三欄各自捲動，頁面本身不捲動、不顯示頁尾）；視窗太矮或太窄時恢復一般捲動。
   三欄至少保留 min(60vh, 420px)：上方的提示展開得很長時，只有內容區（.gh-content）出現一個捲軸，工具列黏在上緣，不會把三欄壓扁。 */
@media (min-width: 992px) and (min-height: 640px) {
  .gh-page-mapper .gh-main {
    height: 100vh;
    min-height: 0;
  }

  .gh-page-mapper .gh-footer {
    display: none;
  }

  .gh-page-mapper .gh-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding-bottom: 16px;
  }

  .gh-page-mapper .gh-content-inner {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
  }

  /* 只有編輯器格線伸縮；頁首、流程列、提示、工具列維持內容高度（分類很多時也不被壓扁）。 */
  .gh-page-mapper .gh-content-inner > :not(.gh-mapper-shell),
  .gh-page-mapper .gh-mapper-shell > :not(.gh-mapper) {
    flex-shrink: 0;
    min-height: auto;
  }

  .gh-page-mapper .gh-page-header {
    margin-bottom: 0.75rem;
  }

  .gh-page-mapper .gh-stepper {
    margin-bottom: 0.75rem;
  }

  .gh-page-mapper .gh-mapper-shell {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  /* 內容區自己捲動時，工具列黏在內容區的上緣（上方列在內容區外面） */
  .gh-page-mapper .gh-mapper-toolbar {
    top: 0;
    height: auto;
  }

  .gh-page-mapper .gh-mapper {
    flex: 1 1 auto;
    height: auto;
    min-height: min(60vh, 420px);
  }
}

/* 全螢幕編輯（#me-fullscreen，Esc 離開；html[data-gh-mapper-full]，theme-init.js 在繪製前套用）：
   隱藏側欄、上方列、頁首與流程列，編輯器使用整個視窗。只作用在 Mapping 頁。 */
[data-gh-mapper-full] .gh-page-mapper .gh-sidebar,
[data-gh-mapper-full] .gh-page-mapper .gh-sidebar-backdrop,
[data-gh-mapper-full] .gh-page-mapper .gh-topbar,
[data-gh-mapper-full] .gh-page-mapper .gh-page-header,
[data-gh-mapper-full] .gh-page-mapper .gh-stepper,
[data-gh-mapper-full] .gh-page-mapper .gh-footer {
  display: none;
}

[data-gh-mapper-full] .gh-page-mapper .gh-main {
  margin-left: 0;
}

[data-gh-mapper-full] .gh-page-mapper .gh-content {
  padding: 0.75rem;
}

[data-gh-mapper-full] .gh-page-mapper .gh-content > .gh-content-inner {
  max-width: none;
}

[data-gh-mapper-full] .gh-page-mapper .gh-mapper-toolbar {
  top: 0;
}

.gh-rule,
.gh-tree-row {
  scroll-margin-top: 12px;
  scroll-margin-bottom: 12px;
}

.gh-mapper-sort {
  width: auto;
  min-width: 8.5rem;
}

#me-compact.active {
  color: var(--gh-primary-strong);
  background: var(--gh-primary-subtle);
}

/* 精簡顯示：路徑與值放同一行，每條約 52px。 */
.gh-rules-compact .gh-rule {
  padding-top: 0.1rem;
  padding-bottom: 0.1rem;
  align-items: center;
}

/* 精簡模式：一行一條（1440×900 可以看到 15 條以上）。 */
.gh-rules-compact .gh-rule .form-control-sm,
.gh-rules-compact .gh-rule .form-select-sm {
  min-height: 1.6rem;
  padding-top: 0.1rem;
  padding-bottom: 0.1rem;
  font-size: var(--gh-fs-sm);
}

.gh-rules-compact .gh-rule .btn-sm {
  padding-top: 0.1rem;
  padding-bottom: 0.1rem;
}

.gh-rules-compact .gh-rule .gh-segmented {
  padding: 1px;
}

.gh-rules-compact .gh-rule-main {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

/* 路徑佔一半多一點（完整路徑在滑鼠提示）。「大字」時欄位較窄：路徑先縮，值至少留 9rem。 */
.gh-rules-compact .gh-rule-path {
  flex: 0 0 52%;
  min-width: 0;
}

.gh-rules-compact .gh-rule-value {
  flex: 1 1 auto;
  flex-wrap: nowrap;
  min-width: 0;
}

html[data-text-size="large"] .gh-rules-compact .gh-rule-path {
  flex-shrink: 1;
}

html[data-text-size="large"] .gh-rules-compact .gh-rule-value {
  min-width: 9rem;
}

.gh-rules-compact .gh-rule-value > .gh-segmented {
  flex-shrink: 0;
}

/* 精簡模式的值來源切換只顯示 icon（按鈕有 title）。 */
.gh-rules-compact .gh-rule-value .gh-segmented button {
  padding: 0.2rem 0.4rem;
  font-size: 0;
  gap: 0;
}

.gh-rules-compact .gh-rule-value .gh-segmented button .bi {
  font-size: var(--gh-fs-sm);
}

.gh-rules-compact .gh-rule-refer-label {
  display: none;
}

.gh-rules-compact .gh-rule-hint,
.gh-rules-compact .gh-rule-help,
.gh-rules-compact .gh-rule-codes-help,
.gh-rules-compact .gh-rule-chip {
  display: none;
}

.gh-rules-compact .gh-rule-actions {
  flex-direction: row;
}

.gh-rules-compact .gh-rule-warning,
.gh-rules-compact .gh-rule-warnings {
  display: none;
}

.gh-rules-compact .gh-rule.has-warning .gh-rule-path-input {
  text-decoration: underline wavy var(--gh-warning);
}

/* 表格的動作欄固定在右側：窄螢幕水平捲動時仍看得到（例如專案內容的 Mapping、xlsx、編輯、刪除）。 */
.gh-table td.gh-actions-sticky {
  position: sticky;
  right: 0;
  z-index: 1;
  background: var(--gh-surface);
  box-shadow: -8px 0 8px -8px rgba(16, 24, 40, 0.18);
}

.gh-table tr:hover td.gh-actions-sticky {
  background: var(--gh-surface-2);
}

/* 表格列的下拉選單（⋯、建立表單）以 data-bs-popper-config='{"strategy":"fixed"}' 用 position: fixed 定位，
   不會被 .table-responsive（overflow: auto）與 .gh-table-card（overflow: hidden）裁掉，列數少或手機上也完整顯示。
   sticky 的動作欄（z-index: 1）各自形成堆疊層，下一列的動作欄會蓋住展開的選單：選單開啟時把該欄提到上層。 */
.gh-table td.gh-actions-sticky:has(.dropdown-menu.show) {
  z-index: 5;
}

/* 手機寬度：名稱欄至少 8rem，不會被動作欄擠成一個字；表格外層 .table-responsive 會水平捲動。
   固定在右側的動作欄有 3 個以上按鈕時改成可以換行（12rem 寬，按鈕排成兩列），否則它會蓋住整個名稱欄。 */
@media (max-width: 575.98px) {
  .table-responsive > .gh-table td:has(> .gh-cell-title) {
    min-width: 8rem;
  }

  /* 備註等說明欄（.small）：至少 10rem，不會一個字一行把整列撐得很高。 */
  .table-responsive > .gh-table td.small {
    min-width: 10rem;
  }

  .gh-table td.gh-actions-sticky:has(> :nth-child(3)) {
    white-space: normal;
    min-width: 12rem;
  }

  .gh-table td.gh-actions-sticky:has(> :nth-child(3)) > * {
    margin-block: 0.125rem;
  }

  /* 表格會水平捲動，Resource 名稱等代碼不要在字中間斷開（例如「Observatio／n」）。 */
  .table-responsive > .gh-table td > code {
    overflow-wrap: normal;
  }
}

/* API 文件：參數名稱不要在字中間斷行。 */
.gh-api-params td:first-child code {
  white-space: nowrap;
  overflow-wrap: normal;
}

/* 轉換頁：按鈕列在窄螢幕換行時整齊排列。說明清單在按鈕列下方，按鈕列不再是卡片最後一塊，取消下方圓角。
   1200px 以上（按鈕一列）固定在視窗底部（sticky）：1366×768、1280×720 這類筆電畫面不必捲動就看得到「轉換並下載」，
   捲到卡片底部時回到原位；較窄時按鈕會換成兩列、佔太多高度（1024px 時曾蓋住「請求方式」），維持不固定。 */
.gh-convert-actions {
  position: static;
  flex-wrap: wrap;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

@media (min-width: 1200px) {
  .gh-convert-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    box-shadow: 0 -8px 12px -12px rgba(16, 24, 40, 0.35);
  }

  /* 用 Tab 移到欄位時，保留按鈕列的高度，避免焦點欄位被固定的按鈕列蓋住（WCAG 2.4.11）。 */
  .gh-card:has(> .gh-convert-actions) :is(input, select, textarea, .gh-dropzone) {
    scroll-margin-bottom: 6rem;
  }
}

.gh-convert-actions .btn {
  white-space: nowrap;
}

@media (max-width: 1199.98px) {
  .gh-convert-actions .btn {
    flex: 1 1 auto;
  }
}

.gh-convert-notes {
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

/* 精簡版上傳區（轉換頁）：圖示在左、文字在右，高度約為一般上傳區的一半。 */
.gh-dropzone-compact {
  flex-direction: row;
  justify-content: flex-start;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  text-align: left;
}

.gh-dropzone-compact > .bi {
  flex: none;
}

/* 工具列在窄螢幕換行時：篩選列一行、狀態與按鈕一行，不重疊到下方。 */
@media (max-width: 1199.98px) {
  .gh-mapper-toolbar {
    row-gap: 0.5rem;
  }

  .gh-mapper-status {
    margin-left: 0;
  }

  .gh-mapper-actions {
    margin-left: auto;
    flex-wrap: wrap;
  }
}

/* ---------- FHIR 伺服器、上傳、REST Dashboard ---------- */
.gh-server-card .card-footer {
  background: var(--gh-surface-2);
  border-top: 1px solid var(--gh-border);
}

.gh-server-test:empty {
  display: none;
}

.gh-server-test-line {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  font-weight: 500;
}

.gh-server-test-line.is-ok {
  color: var(--gh-success-text);
}

.gh-server-test-line.is-fail {
  color: var(--gh-danger-text);
}

.gh-server-test-line.is-pending {
  color: var(--gh-text-muted);
}

/* 測試連線的逐步診斷（清單卡片與伺服器表單共用；fhir-servers.js 以 textContent 產生，認證 B4） */
.gh-diag-panel:empty {
  display: none;
}

.gh-diag-panel {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--gh-border);
  border-radius: var(--gh-radius);
  background: var(--gh-surface-2);
}

.gh-server-test .gh-diag-steps {
  margin-top: 0.5rem;
}

.gh-diag-steps {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gh-diag-step {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.gh-diag-step > .bi {
  flex: none;
  margin-top: 0.15rem;
}

.gh-diag-step.is-ok > .bi {
  color: var(--gh-success-text);
}

.gh-diag-step.is-warning > .bi {
  color: var(--gh-warning-text);
}

.gh-diag-step.is-failed > .bi {
  color: var(--gh-danger-text);
}

.gh-diag-step.is-skipped,
.gh-diag-step.is-skipped > .bi {
  color: var(--gh-text-muted);
}

.gh-diag-step-body {
  min-width: 0;
}

.gh-diag-step-title {
  font-weight: 600;
}

.gh-diag-step-message {
  overflow-wrap: anywhere;
}

.gh-diag-step-details {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
  color: var(--gh-text-muted);
  overflow-wrap: anywhere;
}

.gh-diag-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
}

.gh-diag-url {
  font-family: var(--gh-font-mono);
  overflow-wrap: anywhere;
}

.gh-form-section-title .gh-step-num,
.gh-form-section-title.mb-2 .gh-step-num {
  display: inline-grid;
  width: 1.5rem;
  height: 1.5rem;
  background: var(--gh-primary);
  border-color: var(--gh-primary);
  color: #fff;
  vertical-align: middle;
}

.gh-json-input {
  font-size: var(--gh-fs-sm);
  min-height: 18rem;
}

.gh-convert-upload {
  padding-top: 1rem;
  border-top: 1px solid var(--gh-border);
}

.gh-upload-result.is-success {
  border-top: 3px solid var(--gh-success);
}

.gh-upload-result.is-fail {
  border-top: 3px solid var(--gh-danger);
}

.gh-explorer-params {
  width: min(22rem, 90vw);
  padding-bottom: 0;
}

.gh-explorer-param-list {
  max-height: 20rem;
  overflow-y: auto;
  border-top: 1px solid var(--gh-border);
  padding: 0.25rem 0;
}

.gh-explorer-param-list .dropdown-item.active {
  background: var(--gh-primary-subtle);
  color: var(--gh-primary-strong);
}

.gh-condition {
  height: 100%;
}

.gh-condition .card-header {
  padding: 0.5rem 0.75rem;
  gap: 0.5rem;
  display: flex;
  align-items: center;
}

.gh-condition .card-body {
  padding: 0.75rem;
}

.gh-condition .gh-prefix {
  max-width: 9.5rem;
}

.gh-condition.is-off {
  opacity: 0.55;
}

.gh-sort-link {
  color: inherit;
  text-decoration: none;
}

.gh-sort-link::after {
  content: "\F283";
  font-family: bootstrap-icons;
  font-size: var(--gh-fs-xs);
  margin-left: 0.3rem;
  opacity: 0.35;
}

th[data-sort-dir="asc"] .gh-sort-link::after {
  content: "\F235";
  opacity: 0.9;
}

th[data-sort-dir="desc"] .gh-sort-link::after {
  content: "\F229";
  opacity: 0.9;
}

.gh-sort-link:hover {
  color: var(--gh-link);
}

.gh-title-code {
  font-size: 1.25rem;
  color: var(--gh-text);
}

/* REST Dashboard 結果：不換行（窄螢幕水平捲動），過長的值以省略號截斷（title 顯示全文）。 */
.gh-explorer-table td:not(.gh-actions) {
  white-space: nowrap;
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gh-cell-wrap {
  overflow-wrap: anywhere;
  min-width: 12rem;
}

.gh-col-name {
  width: 14rem;
}

.gh-json-view {
  max-height: 36rem;
}

/* 請求方式下拉：至少容納「POST ▾」，窄欄時換行而不截字。 */
.gh-select-min {
  min-width: 7rem;
}

/* 單筆詳細：巢狀欄位展開（路徑：值），不截斷。 */
.gh-nested > summary {
  cursor: pointer;
  color: var(--gh-text);
}

.gh-nested > summary:focus-visible {
  outline: 2px solid var(--gh-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.gh-kv-nested {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-left: 2px solid var(--gh-border);
  font-size: var(--gh-fs-sm);
}

.gh-kv-nested dt {
  font-weight: 500;
  color: var(--gh-text-muted);
}

.gh-kv-nested dd {
  overflow-wrap: anywhere;
}

/* Composition 巢狀 section */
.gh-section-nested {
  border-left: 3px solid var(--gh-primary);
}

/* FHIR 驗證工具：結果狀態、數量、訊息表、含行號的 JSON。 */
.gh-validation-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1.0625rem;
}

.gh-validation-status.is-success {
  color: var(--gh-success-text);
  background: var(--gh-success-subtle);
}

.gh-validation-status.is-failure {
  color: var(--gh-danger-text);
  background: var(--gh-danger-subtle);
}

.gh-validation-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.gh-validation-count {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  color: var(--gh-text-muted);
}

.gh-validation-count strong {
  font-size: 1.375rem;
  font-weight: 600;
}

.gh-validation-count.is-error strong {
  color: var(--gh-danger-text);
}

.gh-validation-count.is-warning strong {
  color: var(--gh-warning-text);
}

.gh-validation-count.is-information strong {
  color: var(--gh-info-text);
}

.gh-validation-issues {
  max-height: 36rem;
}

.gh-validation-issues tr.gh-clickable {
  cursor: pointer;
}

.gh-validation-issues tr.gh-clickable:focus-visible {
  outline: 2px solid var(--gh-primary);
  outline-offset: -2px;
}

.gh-code-lines {
  max-height: 40rem;
  overflow: auto;
}

.gh-line-list {
  margin: 0;
  padding: 0.75rem 0 0.75rem 3.5rem;
  font-family: var(--gh-font-mono, "Cascadia Mono", Consolas, monospace);
  font-size: var(--gh-fs-sm);
  line-height: 1.55;
}

.gh-line-list li {
  padding-right: 1rem;
  white-space: pre;
}

.gh-line-list li::marker {
  color: var(--gh-text-subtle, var(--gh-text-muted));
  font-size: var(--gh-fs-xs);
}

.gh-line-list li.is-highlighted {
  background: var(--gh-warning-subtle);
  box-shadow: inset 3px 0 0 var(--gh-warning);
}

/* 主題管理：必填提示、欄位樹、填寫群組。 */
.gh-theme-required {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-bottom: 1rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--gh-radius-sm, 6px);
  background: var(--gh-success-subtle);
  color: var(--gh-success-text);
  font-size: var(--gh-fs-sm);
}

.gh-theme-required.is-missing {
  background: var(--gh-danger-subtle);
  color: var(--gh-danger-text);
}

.gh-theme-required code {
  color: inherit;
  background: transparent;
}

.gh-theme-required code.is-missing {
  font-weight: 600;
  text-decoration: underline dotted;
}

.gh-col-order {
  width: 5rem;
}

.gh-field-picker {
  --bs-offcanvas-width: 30rem;
}

.gh-field-tree,
.gh-field-tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.gh-field-tree ul {
  padding-left: 1.25rem;
  border-left: 1px solid var(--gh-border-strong);
  margin-left: 0.85rem;
}

.gh-field-node-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0;
}

.gh-field-toggle-spacer {
  display: inline-block;
  width: 31px;
}

.gh-field-node {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
}

.gh-field-node.is-required > .font-monospace {
  color: var(--gh-danger-text);
  font-weight: 600;
}

.gh-field-node-meta {
  font-size: var(--gh-fs-xs);
  color: var(--gh-text-muted);
  overflow-wrap: anywhere;
}

.gh-theme-group {
  margin-top: 1rem;
  padding: 0.75rem 1rem 1rem;
  border: 1px solid var(--gh-border);
  border-radius: var(--gh-radius-sm, 6px);
}

.gh-theme-group.is-plain {
  padding: 0;
  border: 0;
}

.gh-theme-group-title {
  float: none;
  width: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding: 0 0.35rem;
  font-size: var(--gh-fs-md);
}

.gh-theme-instance + .gh-theme-instance {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--gh-border);
}

.gh-theme-path {
  font-size: var(--gh-fs-xs);
}

/* 長的顯示名稱／路徑在窄欄位（1024px）時換行，不溢出。 */
.gh-theme-group .form-label,
.gh-theme-group-title code,
.gh-theme-path {
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}

.gh-theme-group-title {
  flex-wrap: wrap;
}

/* 寬螢幕時固定在視窗底部；窄螢幕（按鈕換行）時不固定，避免蓋住欄位。 */
@media (min-width: 1200px) {
  .gh-theme-actions {
    position: sticky;
    bottom: 0.75rem;
    z-index: 5;
    box-shadow: var(--gh-shadow-lg, 0 12px 32px rgba(16, 24, 40, 0.14));
  }
}

/* 帳號頁的狀態圖示（註冊完成、確認、重設）。 */
.gh-auth-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 1rem;
  border-radius: 50%;
  font-size: 1.6rem;
  color: var(--gh-primary);
  background: var(--gh-primary-subtle);
}

.gh-auth-icon.is-success {
  color: var(--gh-success);
  background: var(--gh-success-subtle);
}

.gh-auth-icon.is-danger {
  color: var(--gh-danger);
  background: var(--gh-danger-subtle);
}

/* 捲到結果時避開固定的頂端列（「只放要改的定義檔」送出到 #build，7e-3 審查的 L2；沒有起點時的說明連到套件頁的 #upload）。 */
[data-gh-validation],
[data-gh-theme-result],
[data-gh-custom-build],
.gh-builtin-card,
#upload,
#convert-result,
[data-gh-package-convert] {
  scroll-margin-top: 4.5rem;
}

/* 轉換錯誤表的路徑欄：保留最小寬度，太長時一行省略（完整路徑在滑鼠提示）。 */
.gh-cell-path {
  min-width: 14rem;
  max-width: 26rem;
}

.gh-cell-path code {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/*
  轉換錯誤表：固定欄寬排版，四欄依卡片寬度分配，訊息欄永遠在可視範圍內換行。
  （自動排版會被不換行的長路徑撐開，把訊息欄擠出卡片。）
*/
.gh-issue-table {
  table-layout: fixed;
  width: 100%;
}

.gh-issue-table .gh-col-row {
  width: 3.5rem;
}

.gh-issue-table .gh-col-group {
  width: 8rem;
}

.gh-issue-table .gh-col-path {
  width: 36%;
}

.gh-issue-table .gh-cell-path {
  min-width: 0;
  max-width: none;
}

/* 窄螢幕：路徑與分類讓出空間給訊息欄（完整內容都有滑鼠提示）。 */
@media (max-width: 1199.98px) {
  .gh-issue-table .gh-col-row {
    width: 3rem;
  }

  .gh-issue-table .gh-col-group {
    width: 5.5rem;
  }

  .gh-issue-table .gh-col-path {
    width: 26%;
  }
}

.gh-issue-table td.text-nowrap {
  overflow: hidden;
  text-overflow: ellipsis;
}

.gh-cell-message {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* 窄螢幕的表格：名稱欄至少保留幾個字的寬度，不會一字一行（P3 LOW）。 */
.gh-cell-min {
  min-width: 9rem;
}

/* ---------- 圖文教學（/Help/Tutorial）與使用說明頁的入口卡片 ---------- */
.gh-tutorial-cta {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  color: var(--gh-text);
  text-decoration: none;
  border-left: 4px solid var(--gh-primary);
}

.gh-tutorial-cta:hover,
.gh-tutorial-cta:focus-visible {
  color: var(--gh-text);
}

.gh-tutorial-cta-icon {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: var(--gh-radius);
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  background: var(--gh-primary-subtle);
  color: var(--gh-primary);
}

.gh-tutorial-cta-title {
  font-weight: 600;
  font-size: 1.05rem;
}

.gh-tutorial-cta-arrow {
  margin-left: auto;
  flex: none;
  color: var(--gh-primary);
  font-size: 1.25rem;
}

.gh-tutorial {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}

.gh-tutorial-toc {
  margin: 0;
  padding-left: 1.25rem;
  columns: 2;
  column-gap: 1.5rem;
}

.gh-tutorial-panel-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.gh-tutorial-subtitle {
  font-size: 1rem;
  font-weight: 600;
  margin: 0.5rem 0 0.25rem;
}

/* 整體流程：以箭頭串起的小標籤，窄螢幕自動換行。 */
.gh-tutorial-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.25rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.gh-tutorial-flow li {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: var(--gh-fs-sm);
  font-weight: 500;
  color: var(--gh-primary-strong);
}

.gh-tutorial-flow li + li::before {
  content: "→";
  color: var(--gh-text-subtle);
  margin-right: 0.15rem;
}

.gh-tutorial-table th,
.gh-tutorial-table td {
  white-space: nowrap;
}

.gh-tutorial-table .gh-tutorial-value {
  white-space: normal;
  overflow-wrap: anywhere;
  min-width: 8rem;
}

.gh-tutorial-chapter {
  scroll-margin-top: calc(var(--gh-topbar-height) + 16px);
}

.gh-tutorial-chapter-head {
  margin: 0.5rem 0 1rem;
}

.gh-tutorial-chapter-head h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0;
}

/* 功能說明（/Help/Features）：章節標題右邊的「前往這個功能」，窄螢幕時換到下一行 */
.gh-feature-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.gh-feature-head .gh-badge {
  margin-bottom: 0.35rem;
}

/* 功能說明的目錄分成「一般功能」與「只有系統管理者或稽核人員看得到」 */
.gh-toc-group {
  padding: 0.6rem 0.75rem 0.25rem;
  font-size: var(--gh-fs-xs);
  font-weight: 600;
  color: var(--gh-text-muted);
}

.gh-toc-group:first-child {
  padding-top: 0;
}

.gh-tutorial-eyebrow {
  margin: 0;
  font-size: var(--gh-fs-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--gh-accent-text);
}

.gh-tutorial-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.gh-tutorial-step {
  scroll-margin-top: calc(var(--gh-topbar-height) + 16px);
}

#sample {
  scroll-margin-top: calc(var(--gh-topbar-height) + 16px);
}

.gh-tutorial-step-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.gh-tutorial-num {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: var(--gh-fs-sm);
  font-weight: 700;
  background: var(--gh-primary);
  color: #fff;
  font-variant-numeric: tabular-nums;
}

[data-bs-theme="dark"] .gh-tutorial-num {
  color: var(--gh-bg);
}

.gh-tutorial-line {
  margin-bottom: 0.5rem;
  overflow-wrap: anywhere;
}

.gh-tutorial-label {
  display: inline-block;
  margin-right: 0.5rem;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  font-size: var(--gh-fs-xs);
  font-weight: 600;
  vertical-align: 0.1em;
  white-space: nowrap;
}

.gh-tutorial-label-do {
  background: var(--gh-primary-subtle);
  color: var(--gh-primary-strong);
}

.gh-tutorial-label-see {
  background: var(--gh-success-subtle);
  color: var(--gh-success-text);
}

.gh-tutorial-label-tip {
  background: var(--gh-accent-subtle);
  color: var(--gh-accent-text);
}

.gh-tutorial-tip {
  color: var(--gh-text-muted);
  font-size: var(--gh-fs-sm);
}

/* 截圖：寬圖填滿卡片，窄圖（視窗、局部畫面）維持原寬並排；一律不超出卡片。 */
.gh-tutorial-figs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.gh-tutorial-fig {
  margin: 0;
  max-width: 100%;
}

.gh-tutorial-zoom {
  display: block;
  border: 1px solid var(--gh-border);
  border-radius: var(--gh-radius-sm);
  overflow: hidden;
  background: var(--gh-surface-2);
  cursor: zoom-in;
}

.gh-tutorial-zoom:hover {
  border-color: var(--gh-border-strong);
  box-shadow: var(--gh-shadow-md);
}

.gh-tutorial-zoom img {
  display: block;
  max-width: 100%;
  height: auto;
}

.gh-tutorial-lightbox-body {
  padding: 0.5rem;
  text-align: center;
  background: var(--gh-surface-2);
}

.gh-tutorial-lightbox-body img {
  max-width: 100%;
  height: auto;
}

@media (max-width: 575.98px) {
  .gh-tutorial-toc {
    columns: 1;
  }

  .gh-tutorial-cta {
    align-items: flex-start;
  }
}

/* 稽核紀錄（/Audit）：窄螢幕時表格橫向捲動，「做了什麼」欄不被擠成一兩個字一行 */
.gh-audit-table .gh-audit-what {
  min-width: 11rem;
}

.gh-audit-table td:first-child {
  white-space: nowrap;
}

/* 表單流程（表頭 → 分類 → Mapping → 轉換）在手機寬度（375 px）：四個步驟與設定都放得下，不必橫向捲動（原本「Mapping」被截成「Mapp…」）。
   數量改成只給螢幕閱讀器（visually-hidden 的寫法，不用 display:none，報讀時仍然聽得到「12 條」）、隱藏箭頭（本來就是 aria-hidden）、
   縮小間距與圓圈；桌機不變。仍然放不下時（更窄的螢幕）照舊可以橫向捲動。 */
@media (max-width: 575.98px) {
  .gh-stepper {
    gap: 0.1rem;
    padding: 0.3rem;
  }

  .gh-step {
    gap: 0.3rem;
    padding: 0.35rem 0.4rem;
    font-size: var(--gh-fs-sm);
  }

  .gh-step-num {
    width: 1.625rem;
    height: 1.625rem;
    font-size: var(--gh-fs-xs);
  }

  .gh-step-count {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  .gh-step-sep {
    display: none;
  }

  .gh-stepper-end {
    padding-left: 0.25rem;
  }
}

/* 轉換前整理資料（Forms/Preprocess，docs/adr/0014）：欄位清單可以捲動；預覽的 JSON 換行顯示、不撐寬頁面（375 px 也不會橫向捲動）。 */
.gh-preprocess-fields {
  max-height: 16rem;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gh-border-strong);
  border-radius: var(--bs-border-radius);
}

.gh-preprocess-fields code,
.gh-preprocess-diff code {
  word-break: break-all;
}

.gh-preprocess-date-row + .gh-preprocess-date-row {
  border-top: 1px solid var(--gh-border);
  padding-top: 0.35rem;
  margin-top: 0.35rem;
}

.gh-preprocess-pre {
  max-height: 24rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: var(--gh-fs-sm);
}

.gh-preprocess-diff {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 0.15rem 0.75rem;
  font-size: var(--gh-fs-sm);
  margin-bottom: 1rem;
}

.gh-preprocess-diff dd {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.gh-preprocess-diff mark {
  padding: 0 0.15rem;
}

/* 版本歷史（草稿／發布）：每一版一行，發布者（Email）可以斷行。 */
.gh-preprocess-versions > li + li {
  border-top: 1px solid var(--gh-border);
}

.gh-preprocess-version-meta {
  overflow-wrap: anywhere;
}

/* 值對照（P2）：每個欄位一個區塊；每一列「資料中的值 → 代碼」，手機寬度改成上下排列。 */
.gh-valuemap {
  border: 1px solid var(--gh-border-strong);
  border-radius: .5rem;
  padding: .75rem;
  margin-bottom: 1rem;
  min-width: 0;
}

.gh-valuemap code {
  overflow-wrap: anywhere;
}

.gh-valuemap-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem .5rem;
  margin-bottom: .5rem;
}

.gh-valuemap-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .25rem .5rem;
  padding: .5rem 0;
  border-top: 1px solid var(--gh-border);
  /* 一個欄位可以有 1,000 列：畫面外的列不排版、不繪製（大小先以上次的實際大小估計），輸入時重新排版的成本與列數無關 */
  content-visibility: auto;
  contain-intrinsic-size: auto 5.5rem;
}

.gh-valuemap-row-head {
  content-visibility: visible;
}

.gh-valuemap-row-head {
  display: none;
  font-size: var(--gh-fs-sm);
  color: var(--bs-secondary-color);
  border-top: 0;
  padding-bottom: 0;
}

.gh-valuemap-arrow {
  display: none;
}

.gh-valuemap-row textarea {
  resize: vertical;
  overflow-y: auto; /* 伺服器依行數設定 rows；換行很長時可以捲動，輸入時 preprocess.js 調整高度 */
}

/* 支援的瀏覽器由 CSS 依內容調整高度（載入時不必逐列以 JavaScript 量測） */
@supports (field-sizing: content) {
  .gh-valuemap-row textarea {
    field-sizing: content;
    min-height: calc(2lh + .5rem + 2px);
    overflow-y: hidden;
  }
}

.gh-valuemap-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  margin-top: .25rem;
}

/* 建議：沒有 JavaScript 時不顯示（按鈕要 JavaScript 才能套用）；沒有建議時不佔空間 */
.no-js .gh-valuemap-suggestions,
.gh-valuemap-suggestions:not(:has(button)) {
  display: none;
}

.gh-valuemap-trash {
  justify-self: start;
}

/* 有 JavaScript：垃圾桶取代「刪除」核取方塊、「自己輸入代碼」的欄位只在選了它時顯示（preprocess.js 切換 gh-valuemap-row-custom） */
.no-js .gh-valuemap-trash,
html:not(.no-js) .gh-valuemap-delete,
html:not(.no-js) .gh-valuemap-row:not(.gh-valuemap-row-custom) [data-gh-valuemap-custom] {
  display: none;
}

/* 資料檔中出現過的值：空白要看得出來 */
.gh-valuemap-value {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.gh-valuemap-found {
  border-top: 1px solid var(--gh-border);
  padding-top: .5rem;
}

/* 值對照的步驟（找值、加入、儲存）與 CSV */
.gh-valuemap-steps,
.gh-valuemap-csv {
  background: var(--bs-tertiary-bg);
  border-radius: .5rem;
  padding: .75rem;
}

.gh-valuemap-steps-list {
  padding-left: 1.25rem;
}

.gh-valuemap-found-tools {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.gh-valuemap-found-tools[hidden] {
  display: none;
}

[data-gh-valuemap-found-title]:focus,
#vm-added:focus,
#vm-csv:focus {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}

.gh-valuemap-found-list {
  max-height: 16rem;
  overflow-y: auto;
}

.gh-valuemap-finder-file {
  width: auto;
  flex: 1 1 14rem;
  min-width: 0;
}

.gh-valuemap-row select,
.gh-valuemap-add-select {
  min-width: 0;
  max-width: 100%;
}

.gh-valuemap-feedback:empty {
  display: none;
}

.gh-valuemap-removed > :not(.gh-valuemap-delete):not(.gh-valuemap-head) {
  opacity: .5;
}

.gh-valuemap-add-select {
  width: auto;
  flex: 1 1 12rem;
}

@media (min-width: 576px) {
  .gh-valuemap-row {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
    align-items: start;
  }

  .gh-valuemap-row-head {
    display: grid;
  }

  .gh-valuemap-arrow {
    display: block;
    padding-top: .3rem;
    color: var(--bs-secondary-color);
  }

  .gh-valuemap-feedback {
    grid-column: 1 / -1;
  }

  .gh-valuemap-delete {
    padding-top: .3rem;
  }
}

/* 發布前的確認（id 規則，P3 WP2）：說明一行、核取方塊另起一行；核取方塊的框線用內文顏色（在有色的提示框中也看得清楚） */
.gh-publish-confirm {
  display: block;
  max-width: 48rem;
}

/* theme.css 的 .alert 是橫向的 flex（圖示＋文字）；確認區塊要上下排列 */
.alert.gh-ack {
  display: block;
  font-size: var(--gh-fs-sm);
  padding: .75rem;
  margin-bottom: .75rem;
}

.gh-ack .form-check-input {
  border-color: var(--bs-body-color);
}

.gh-ack .form-check-label {
  color: var(--bs-body-color);
  font-weight: 400;
}

/* Resource id 規則（P3 WP3）：與值對照相同的外觀；分類一行（名稱、型別、目前的 id 來源），有規則的分類下面直接編輯。手機寬度上下排列、不橫向捲動。 */
.gh-idrules-list {
  display: grid;
  gap: .5rem;
}

.gh-idrule-cat {
  border: 1px solid var(--gh-border-strong);
  border-radius: .5rem;
  padding: .5rem .75rem;
  min-width: 0;
}

/* 分類很多時，畫面外、沒有規則的分類不排版、不繪製（有規則的分類高度差很多，照常排版，捲動時不會跳動） */
.gh-idrule-cat:not(.gh-idrule-cat-on) {
  content-visibility: auto;
  contain-intrinsic-size: auto 5rem;
}

.gh-idrule-cat-on {
  border-color: var(--gh-primary);
}

.gh-idrule-cat-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem .5rem;
}

.gh-idrule-cat-head .gh-badge {
  white-space: normal;
  text-align: start;
}

.gh-idrule-presets,
.gh-idrule-add {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem;
  margin-top: .5rem;
}

.gh-idrule {
  margin-top: .5rem;
  min-width: 0;
}

.gh-idrule code {
  overflow-wrap: anywhere;
}

.gh-idrule-parts {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .375rem;
  padding-left: 1.25rem;
  margin-bottom: .25rem;
}

.gh-idrule-part {
  min-width: 0;
}

.gh-idrule-part-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem .5rem;
  min-width: 0;
}

.gh-idrule-part-kind {
  font-size: var(--gh-fs-sm);
  color: var(--bs-secondary-color);
  flex: 0 0 7.5rem;
}

.gh-idrule-part-main > .form-select,
.gh-idrule-part-main > .form-control {
  flex: 1 1 12rem;
  min-width: 0;
  width: auto;
}

.gh-idrule-part-tools {
  display: inline-flex;
  gap: .125rem;
}

/* 第一個不能往前、最後一個不能往後：淡化，不畫外框 */
.gh-idrule-part-tools .btn:disabled {
  border-color: transparent;
  opacity: .3;
}

.gh-idrule-part.is-invalid > .gh-idrule-part-main > .form-select,
.gh-idrule-part.is-invalid > .gh-idrule-part-main > .form-control {
  border-color: var(--bs-form-invalid-border-color);
}

.gh-idrule-prefix {
  max-width: 16rem;
}

/* 「分類代碼」只在勾選「和其他分類分開」時顯示（沒有 JavaScript 時一直顯示）；舊系統相容時前綴、分開與代碼都停用（伺服器輸出與 preprocess.js 同步） */
html:not(.no-js) .gh-idrule:not(:has([data-gh-idrule-separate]:checked)) [data-gh-idrule-label-wrap] {
  display: none;
}

.gh-idrules-key {
  max-width: 24rem;
}

@media (max-width: 575.98px) {
  .gh-idrule-part-kind {
    flex-basis: 100%;
  }

  .gh-idrule-parts {
    padding-left: 1rem;
  }
}

/* 共用確認視窗的「提醒」樣式（例如 id 會改變，P3 WP3） */
.gh-confirm-icon.is-warning {
  background: var(--gh-warning-subtle);
  color: var(--gh-warning);
}

/* 整份檔案的 id 檢查（ADR-0015 決策 18）：送出後捲到結果（#dryrun-result）時，標題要在畫面上方、不被固定的頂端列擋住（JavaScript 開或關都一樣） */
.gh-dryrun-result {
  scroll-margin-top: calc(var(--gh-topbar-height, 56px) + 1rem);
  /* 結果在頁面最下方：結果很短時頁面捲不到讓標題到上方，所以至少留一個畫面高（扣掉頂端列）的空間 */
  min-height: calc(100vh - var(--gh-topbar-height, 56px) - 2rem);
}

/* 送出後以程式聚焦整個結果區塊（讓螢幕報讀從標題開始讀）：不畫外框（它不是可以操作的元素） */
.gh-dryrun-result:focus {
  outline: none;
}

/* 「再檢查一個檔案」捲回選檔案的欄位：連同上方的欄位名稱一起露出，不被頂端列擋住 */
#dryrun-file {
  scroll-margin-top: calc(var(--gh-topbar-height, 56px) + 2.5rem);
}

/* 預覽中的 id（P3 WP4）：id 很長（40～64 字），在任何地方都可以斷行；手機寬度不橫向捲動。 */
.gh-idpreview-table {
  font-size: var(--gh-fs-sm);
}

.gh-idpreview-table code {
  overflow-wrap: anywhere;
  word-break: break-all;
}

.gh-idpreview-table th,
.gh-idpreview-table td {
  vertical-align: top;
}

.gh-idpreview-table td:first-child {
  white-space: nowrap;
}

/* 手機寬度：長的 id 只顯示前 12 字，點開（details）看完整的、可以選取；寬畫面顯示完整的 id。 */
.gh-id-short {
  display: none;
}

.gh-id-short summary {
  cursor: pointer;
}

@media (max-width: 575.98px) {
  .gh-id-full:has(+ .gh-id-short) {
    display: none;
  }

  .gh-id-short {
    display: block;
  }
}

/* 從專案表單建立主題（主題管理）：「所有登入的使用者」的提醒只在選了它時顯示；不支援 :has 的瀏覽器一律顯示（_FormTopicAudience） */
.gh-audience-choice:has(input[type="radio"][value="owner"]:checked) .gh-audience-all-warning {
  display: none;
}
