/* ============================================================================
   Jason Tools — 共用設計系統
   風格與 jt-doc-tools 對齊：紫色漸層側欄、淺灰底、白卡片、藍色主色、8px 圓角。
   兩個站看起來要像同一套系統，所以設計 token 與元件尺寸都刻意逐字沿用。

   舊版每個工具頁各自帶一整份 CSS，同一顆「清除」按鈕在 26 個頁面有 26 種長相。
   這份檔案是唯一的視覺來源，工具頁只該補「這個工具獨有」的樣式。
   ========================================================================== */

:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #d9dde3;
  --text: #23272e;
  --muted: #6b7380;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #16a34a;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);

  --sidebar-w: 300px;
  --sidebar-from: #6366f1;
  --sidebar-to: #4f46e5;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", "Noto Sans Mono CJK TC", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC",
               "PingFang TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/**
 * 🔴 **日文介面要換字型堆疊，這不是美觀問題。**
 *
 * 中文與日文有一批**字形不同的漢字**（直・今・骨・者・海・類…）。
 * 用 `Noto Sans TC` / `PingFang TC` / `Microsoft JhengHei` 渲染日文，
 * 那些字會長成中文的樣子 —— 日文使用者一眼就看得出「這頁不是給我看的」。
 *
 * ⚠️ 只靠 `<html lang="ja">` 讓瀏覽器自己挑是不夠的：上面那三套**都宣稱支援**
 *    那些漢字，瀏覽器不會因為 lang 就跳過它們去找日文字型。要明確換掉。
 * ⚠️ 不載任何網路字型 —— 站台零外部資源（見 tests/check-network.js）。
 *    列的都是各平台本來就有的：macOS/iOS 的 Hiragino、Windows 的 Yu Gothic、
 *    Linux 的 Noto Sans JP / IPA。
 */
:root[lang="ja"] body,
html[lang="ja"] body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
               "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", "Meiryo",
               "IPAexGothic", sans-serif;
}

/* 圖示：一律走 currentColor，按鈕改色時圖示自動跟著改 */
.ic { flex: none; vertical-align: -0.15em; }

/**
 * `hidden` 屬性一律當作隱藏。
 *
 * 瀏覽器預設的 `[hidden]{display:none}` 只是一條**元素選擇器**規則，任何
 * class 寫的 `display:` 都比它強 —— `.sb-item{display:flex}` 讓搜尋的過濾完全失效、
 * `.lang-menu{display:flex}` 讓語言選單一載入就開著、`.note{display:flex}` 讓
 * 「節點數不足」的空警示常駐在畫面上。與其每次踩到再補一條，不如在這裡一次講清楚。
 */
[hidden] { display: none !important; }

/* ── 側邊欄 ───────────────────────────────────────────────────────────── */

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidebar-from) 0%, var(--sidebar-to) 100%);
  color: #f4f3ff;
  display: flex; flex-direction: column;
  z-index: 50;
  overflow: hidden;                 /* 捲動交給 .sidebar-scroll */
  box-shadow: 4px 0 16px rgba(15, 23, 42, 0.18), 1px 0 0 rgba(0,0,0,0.08);
}

.sidebar-header {
  flex: 0 0 auto;
  padding: 18px 16px 14px;
}

/* 品牌列：logo 放在白色圓角磚上（設計圖），版本號在站名下方 */
.brand-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.brand-block { display: inline-flex; flex-direction: column; align-items: stretch; line-height: 1.15; }

.sidebar-collapse {
  flex-shrink: 0;
  width: 30px; height: 30px; padding: 0; border: none; border-radius: 9px;
  background: rgba(255,255,255,0.16); color: #fff; font-size: 14px; line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-collapse:hover { background: rgba(255,255,255,0.22); }

/* 收起後留在左緣的展開頁籤 */
.sidebar-expand {
  display: none; position: fixed; left: 0; top: 50%; transform: translateY(-50%);
  z-index: 60; width: 22px; height: 84px; padding: 0;
  border: none; border-radius: 0 8px 8px 0;
  background: var(--primary); color: #fff; font-size: 15px; cursor: pointer;
  box-shadow: 2px 0 8px rgba(0,0,0,0.18);
}
.sidebar-expand:hover { filter: brightness(1.12); width: 26px; }

/* 收起狀態：側欄滑出畫面，內容占滿整個寬度 */
body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .content { margin-left: 0; }
body.sidebar-collapsed .sidebar-expand { display: inline-flex; align-items: center; justify-content: center; }

/**
 * 全螢幕模式（工具自己的「假全螢幕」，不是 Fullscreen API）。
 *
 * 收掉外框，把整個視窗讓給工具。**規則放在共用層**，因為每支工具原本各寫一套，
 * 而且是對著舊 SPA 的 `.main-content` / `.content-body` 寫的：改成 MPA 之後
 * 側欄雖然藏起來了，`.content` 的 `margin-left: var(--sidebar-w)` 還在，
 * 工具整塊被推出畫面右邊；`.container` 又留著舊主視覺的底色，
 * 結果是整片藍底加上被切掉的右半邊（2026-09-06 使用者回報）。
 */
body.fullscreen-active .sidebar,
body.fullscreen-active .sidebar-toggle,
body.fullscreen-active .sidebar-expand,
body.fullscreen-active .page-head { display: none !important; }
body.fullscreen-active .content { margin-left: 0 !important; }

/* 全螢幕的退出鈕：頁首被藏起來，全螢幕按鈕跟著不見，畫面上就沒有出口了。
   這顆固定在右上角，z-index 要壓過工具自己的固定列（weathermap 的分頁列是 10001）。 */
.jt-fs-exit { display: none; }
body.fullscreen-active .jt-fs-exit {
  display: inline-flex; align-items: center; gap: 6px;
  position: fixed; top: 10px; right: 12px; z-index: 100001;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); color: var(--text);
  font-size: 13px; font-weight: 600; cursor: pointer;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .18);
}
body.fullscreen-active .jt-fs-exit:hover { background: #f1f5f9; border-color: #c7cdd6; }
body.fullscreen-active .jt-fs-exit:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (max-width: 900px) {
  body.fullscreen-active .jt-fs-exit { top: 8px; right: 8px; min-height: 34px; }
}
body.fullscreen-active .container {
  max-width: none !important; width: auto !important;
  margin: 0 !important; padding: 14px 16px 18px !important;
  background: var(--bg) !important;
}
.sidebar { transition: transform 0.18s ease; }
.content { transition: margin-left 0.18s ease; }
.brand { display: flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; min-width: 0; }
/* logo 放在白色圓角磚裡：深色側欄上直接放彩色 logo 會糊掉 */
.brand-logo {
  width: 40px; height: 40px; flex: 0 0 40px; object-fit: contain;
  background: #fff; border-radius: 11px; padding: 5px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}
.brand-text { font-weight: 700; font-size: 16px; line-height: 1.2; word-break: keep-all; }
.brand-version { display: block; font-size: 11.5px; line-height: 1;
                 color: rgba(255,255,255,0.72); margin-top: 5px; }

/* 特異性要壓過下面的 input[type=...] 通用規則（屬性選擇器 0,1,1 比單一 class 高），
   否則側欄搜尋框會被畫成白底白字，placeholder 直接消失。 */
/* 搜尋框：圖示以 background 方式放進左側，不必為它多包一層元素 */
.sidebar-search-wrap { position: relative; }
.sidebar-search-wrap > .ic {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: rgba(255,255,255,0.75); pointer-events: none;
}
.sidebar input.sidebar-search {
  width: 100%; padding: 7px 12px 7px 34px; border-radius: 9px;
  border: 1px solid rgba(255,255,255,0.22); background: rgba(255,255,255,0.16);
  color: #fff; font-size: 13.5px; outline: none;
  font-family: inherit;
}
.sidebar input.sidebar-search::placeholder { color: rgba(255,255,255,0.7); }
.sidebar input.sidebar-search:focus { background: rgba(255,255,255,0.22); border-color: rgba(255,255,255,0.6); }

.sidebar-scroll {
  flex: 1 1 auto; overflow-y: auto;
  padding: 12px 0 8px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.35) transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 6px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.35); border-radius: 3px; }

.sb-group { margin: 0 12px 8px 0; }
/**
 * 分類標題**要比工具項目更深**，才看得出層級。
 * 改版時一度把它調成淺色（rgba(255,255,255,0.12)），結果標題跟底下的項目
 * 明度差不多，整條側欄變成一片同色的方塊，分不出哪裡是一組的開頭。
 */
.sb-group > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 9px;
  padding: 11px 13px; font-size: 14.5px; font-weight: 600;
  color: #fff;
  border-radius: 11px;
  background: rgba(17, 17, 45, 0.38);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
.sb-group > summary::-webkit-details-marker { display: none; }
.sb-group > summary:hover { background: rgba(17, 17, 45, 0.52); }
.sb-group > summary::after {
  content: ''; margin-left: auto;
  width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid currentColor; opacity: 0.9; transition: transform 0.15s;
}
.sb-group:not([open]) > summary::after { transform: rotate(-90deg); }
/* 字級 12px 是下限，不是美感選擇：check-mobile 以 12px 為界。
   這顆徽章原本 11px，一直沒被抓到 —— 掃描只看「超過一個字」的文字節點，
   而分類數量在系統工具長到 12 個之前都是個位數。 */
.sb-count {
  background: rgba(255,255,255,0.22); color: #fff;
  font-size: 12px; padding: 1px 8px; border-radius: 10px;
  font-weight: 600; line-height: 1.45;
}

.sb-items { display: flex; flex-direction: column; gap: 6px; padding: 6px 0 8px; }
.sb-item {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 10px 11px; border-radius: 11px;
  background: rgba(255,255,255,0.10); color: #fff;
  text-decoration: none; transition: background 0.12s, transform 0.05s;
  border: 1px solid transparent;
}
/* 搜尋時用 `hidden` 屬性藏項目，但 `.sb-item` 自己宣告了 display:flex，
   class 選擇器比瀏覽器預設的 [hidden] 規則強 —— 不補這一條，搜尋等於沒有過濾
   （搜「ceph」整組系統工具 6 支全都留在畫面上，使用者 2026-09-06 回報）。 */
.sb-item[hidden], .sb-group[hidden] { display: none !important; }
.sb-item:hover { background: rgba(255,255,255,0.20); }
.sb-item:active { transform: translateY(1px); }
.sb-item .tile { margin-top: 1px; }
.sb-item-body { display: block; min-width: 0; }   /* min-width:0 才截得斷長名稱 */
.sb-item-name { display: block; font-size: 14px; font-weight: 600; line-height: 1.3; }
.sb-item-desc { display: block; font-size: 12px; line-height: 1.4; margin-top: 3px;
                color: rgba(255,255,255,0.80); }

/**
 * 語言切換：頁首右上角一顆鈕，緊鄰收折鈕。
 *
 * 原本是搜尋框下面一個整行寬的 <select> —— 只有兩個語言卻佔掉一整列，
 * 而且視覺上跟搜尋框搶注意力。只有兩種語言時，切換鈕比下拉選單少一次點擊。
 * 鈕上顯示的是**切過去會變成的語言**（中文介面顯示 EN），因為那才是按下去的結果。
 */
/* 右緣跟下面的搜尋框切齊：真的頂到側欄邊緣反而顯得被切掉（使用者 2026-09-06） */
.brand-actions { position: relative; display: flex; align-items: center; gap: 4px; margin-left: auto; }
/* 語言選單：貼在按鈕下方，白底深字（側欄是深底，選單延用側欄配色會看不清楚） */
.lang-menu[hidden] { display: none !important; }
.lang-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30;
  min-width: 132px; padding: 5px; border-radius: 11px;
  background: #fff; border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  display: flex; flex-direction: column; gap: 2px;
}
.lang-menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border: none; border-radius: 8px;
  background: none; color: var(--text); font-size: 13.5px; font-family: inherit;
  text-align: left; cursor: pointer;
}
.lang-menu-item:hover { background: #f1f5f9; }
.lang-menu-item.is-current { color: var(--primary-dark); font-weight: 600; background: #eff6ff; }
.lang-menu-item.is-current::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.lang-menu-item:not(.is-current)::before { content: ''; width: 6px; height: 6px; }
.sidebar-lang-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; border-radius: 9px;
  border: none;
  background: rgba(255,255,255,0.16); color: #fff;
  cursor: pointer; line-height: 1;
}
.sidebar-lang-btn:hover { background: rgba(255,255,255,0.22); }
.sidebar-lang-btn .ic { width: 16px; height: 16px; }

/**
 * 當前所在的工具：改成**淺色底＋深色字**（設計圖）。
 * 原本是半透明白疊在紫底上，跟 hover 狀態太像，一眼分不出人在哪一頁。
 */
.sb-item.is-active {
  background: #f1f0ff; color: #312e81;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
}
.sb-item.is-active .sb-item-desc { color: #4c46a8; }

.sb-empty { display: none; padding: 14px 12px; font-size: 12.5px;
            color: rgba(255,255,255,0.8); }

/* ── 工具配色磚 ───────────────────────────────────────────────────────────
   側欄與首頁共用同一組色票，由 js/tools-registry.js 依 slug 的穩定雜湊指派，
   同一支工具在兩個地方永遠是同一個顏色。
   色盤刻意避開靛藍與紫色 —— 側欄本身是紫色漸層，同色系的圖示會糊進背景。
   ──────────────────────────────────────────────────────────────────────── */

.tile {
  flex: 0 0 36px; width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
}
.tile .ic { color: currentColor; }
/* 側欄的磚塊加一圈淡白內框，才不會在紫色底上失去邊界 */
.sb-item .tile {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35), 0 1px 2px rgba(0,0,0,0.15);
}
.tile:not([class*="tile-color-"]) { background: linear-gradient(135deg, #94a3b8, #64748b); }

.tile-color-0  { background: linear-gradient(135deg, #f472b6, #db2777); }
.tile-color-1  { background: linear-gradient(135deg, #38bdf8, #0284c7); }
.tile-color-2  { background: linear-gradient(135deg, #34d399, #059669); }
.tile-color-3  { background: linear-gradient(135deg, #fbbf24, #d97706); }
.tile-color-4  { background: linear-gradient(135deg, #fb7185, #e11d48); }
.tile-color-5  { background: linear-gradient(135deg, #fb923c, #ea580c); }
.tile-color-6  { background: linear-gradient(135deg, #2dd4bf, #0d9488); }
.tile-color-7  { background: linear-gradient(135deg, #facc15, #ca8a04); }
.tile-color-8  { background: linear-gradient(135deg, #a3e635, #65a30d); }
.tile-color-9  { background: linear-gradient(135deg, #fda4af, #be123c); }
.tile-color-10 { background: linear-gradient(135deg, #22d3ee, #0891b2); }
.tile-color-11 { background: linear-gradient(135deg, #84cc16, #4d7c0f); }
.tile-color-12 { background: linear-gradient(135deg, #f97316, #c2410c); }
.tile-color-13 { background: linear-gradient(135deg, #eab308, #854d0e); }
.tile-color-14 { background: linear-gradient(135deg, #4ade80, #16a34a); }
.tile-color-15 { background: linear-gradient(135deg, #f87171, #b91c1c); }
.tile-color-16 { background: linear-gradient(135deg, #60a5fa, #1d4ed8); }
.tile-color-17 { background: linear-gradient(135deg, #5eead4, #0f766e); }
.tile-color-18 { background: linear-gradient(135deg, #fcd34d, #b45309); }
.tile-color-19 { background: linear-gradient(135deg, #7dd3fc, #0369a1); }
.tile-color-20 { background: linear-gradient(135deg, #86efac, #15803d); }
.tile-color-21 { background: linear-gradient(135deg, #fdba74, #c2410c); }
.tile-color-22 { background: linear-gradient(135deg, #67e8f9, #0e7490); }
.tile-color-23 { background: linear-gradient(135deg, #bef264, #4d7c0f); }
.tile-color-24 { background: linear-gradient(135deg, #f9a8d4, #be185d); }
.tile-color-25 { background: linear-gradient(135deg, #99f6e4, #0d9488); }

/* ── 主內容 ───────────────────────────────────────────────────────────── */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  height: 56px; padding: 0 20px;
  background: #fff; border-bottom: 1px solid var(--border);
}
.topbar-title { font-weight: 600; font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.topbar-title .ic { color: var(--primary); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.content { margin-left: var(--sidebar-w); min-height: 100vh; }
/* 🔴 **不設寬度上限**（使用者 2026-09-14：「寬度夠時 所有卡片 要左右自動展過去
   不要到一個寬度就不再長寬」）。舊版是 1180px，1900px 的視窗扣掉側欄之後
   左右各空掉兩百多 px —— 而 .tool-grid 的 auto-fill 本來就會自己排滿，
   卡住它的是這一層容器。 */
.container { margin: 0 auto; padding: 24px 20px 64px; }

/* ⚠️ 但**整段文字要另外收住**。容器放開之後，2400px 的螢幕上一個段落會排成
   一行一百多個字，那是另一種難讀 —— 所以放開的是卡片、格線與表格，不是行長。
   1100px 正好是舊版 1180px 容器扣掉內距之後的行長，所以段落看起來跟以前一樣。
   🔴 只套在「整段文字」上，不套在鍵值列的值（.kv-val）或摘要格
   —— 那些是資料不是散文，收窄會讓同一列的東西對不齊。
   實測過 70 頁：沒有任何 <p> 被當成版面容器用（裡面只有圖示與行內標記）。 */
.container p,
.container .card-hint,
.container .doc-note,
.container .field-hint { max-width: 1100px; }

/* 🔴 **單行控制項也要有上限，理由跟段落一樣。**
   容器放開之後，`.field-row` 的控制欄會跟著拉滿 —— 實測 2560px 下，一個放
   `#2563eb` 的色碼輸入框被拉到 **2174px**、cron 的分鐘欄位 1994px、
   ⚠️（那一格放的是像「每五分鐘」那種一兩個字元的排程式子 ——
   這裡刻意不把它逐字寫出來：**星號加斜線會提前關掉這段註解**，
   後面整段規則就變成解析不了的垃圾。我剛剛就是這樣把它弄壞的。）
   密碼產生器的符號集 1924px。那不是「用得到的空間」，是看起來壞掉。

   ⚠️ **多行與資料型的東西不在此列**：textarea、程式碼框、表格、長條圖
   寬一點是真的好用（貼一份憑證或設定檔時，一行看得完差很多）。
   收的只有「一行就寫得完」的控制項。

   980px 就是舊版 1180px 容器下控制欄的寬度（1140 內容 − 卡片內距 − 122 標籤
   − 12 間距）。
   🔴 **包在 `min-width: 1600px` 裡，不是無條件套用。** 第一版沒有包，量到
   1440px 下有 20 個控制項跟著變（搜尋框 1054 → 980，而且有幾個因為同一列的
   兄弟縮了反而變寬）—— 那是**在沒有問題的寬度上製造改動**。
   問題只發生在 1600px 以上，判準就寫在那裡。 */
@media (min-width: 1600px) {
    .container input:not([type="range"]):not([type="color"]):not([type="checkbox"]):not([type="radio"]),
    .container select,
    .container .jt-select,
    .container .field-row > :nth-child(2) { max-width: 980px; }
}

/* 標題列：工具圖示做成大色磚放在標題左邊（設計圖），右邊放本頁動作。 */
/* 圖示與「標題＋說明」整塊垂直置中：靠上對齊時說明會掉到圖示下緣以下，
   看起來像是說明跑到圖示底下（使用者回報）。 */
.page-head { margin-bottom: 20px; display: flex; align-items: center; gap: 16px; }
.page-head-main { min-width: 0; flex: 1; display: flex; align-items: center; gap: 14px; }
.page-head-icon { flex: 0 0 52px; width: 52px; height: 52px; border-radius: 14px; }
.page-head-icon .ic { width: 26px; height: 26px; }
.page-head-actions { flex: none; display: flex; gap: 8px; align-self: flex-start; padding-top: 0; }
.page-head h1 { font-size: 24px; line-height: 1.25; margin: 0 0 2px; display: flex; align-items: center; gap: 8px; }
/* 標題＋說明整塊要塞得進圖示的高度（52px），說明才不會掉到圖示下緣以下 —— 
   英文標題較長時最明顯（使用者 2026-09-06 回報） */
.page-head p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.4; }

h2 { font-size: 17px; margin: 22px 0 10px; display: flex; align-items: center; gap: 7px; }
h3 { font-size: 15px; margin: 16px 0 8px; }

a { color: var(--primary); }

/* ── 卡片 ─────────────────────────────────────────────────────────────── */

.card {
  --pad-x: 22px; --pad-y: 20px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow);
  padding: var(--pad-y) var(--pad-x); margin-bottom: 18px;
}
/**
 * 卡片標題列（對齊 jt-doc-tools 的做法）。
 *
 * 卡片第一個元素是標題時，把它做成整條有底色的標題列，卡片才看得出「這裡是一區」——
 * 原本只是一行粗體字，字少的時候跟內容黏在一起，看起來像沒有分區（使用者 2026-09-06）。
 * 用負邊界把它撐到卡片邊緣（padding 是 20px 22px）。
 */
.card > h2:first-child,
.card > h3:first-child,
.card > h4:first-child,
.card > .card-head:first-child,
.card > .setup-head:first-child,
.card > .field-label:first-child,
.card > label.input-label:first-child,
/* 🔴 對話框的標題列在 `.dlg-body` 裡，不是 `.card` 的直接子元素
   —— 少了這一條，`<dialog class="card">` 的標題就沒有底色也沒有下框線，
   跟同一頁的卡片長得不一樣（使用者 2026-09-12 回報「沒卡片標題」）。
   跟 `summary.doc-summary` 那次是同一個形狀：共用選擇器涵蓋不到另一種寫法。 */
.dlg-body > .card-head:first-child,
.info-section > h3:first-child {
  /* 負邊界要跟著容器的內距走，寫死數字時 .info-section（16px）會凸出卡片外 */
  margin: calc(-1 * var(--pad-y, 20px)) calc(-1 * var(--pad-x, 22px)) 16px !important;
  padding: 11px var(--pad-x, 22px);
  background: linear-gradient(to bottom, #f7f8fb, #eceff5);
  border-bottom: 1px solid #dfe4ec;
  border-radius: 13px 13px 0 0;
  font-size: 15.5px; font-weight: 600; color: #1e293b;
  display: flex; align-items: center; gap: 9px;
}
/* 設定卡與可收合說明卡有自己的 summary 版面，不套這條 */
details.card > summary:first-child { margin: calc(-1 * var(--pad-y, 20px)) calc(-1 * var(--pad-x, 22px)) 16px !important; padding: 11px var(--pad-x, 22px);
  background: linear-gradient(to bottom, #f7f8fb, #eceff5); border-bottom: 1px solid #dfe4ec;
  border-radius: 13px 13px 0 0; }
details.card:not([open]) > summary:first-child { margin-bottom: calc(-1 * var(--pad-y, 20px)) !important; border-bottom: none; border-radius: 13px; }
/* 🔴 設定卡的標題列**不再特別待遇**（2026-09-11 使用者在手機上回報
      「規劃條件卡片 標題樣式不對 內部元件左右頂到邊界 從來沒有修好過」）。
   舊版把它的底色與下框線關掉（`background: none; border-bottom: none`），
   於是同一頁裡「規劃條件」是白底浮著的標題，隔壁「排程與 Fast Ping」
   卻有灰底標題列 —— 一眼看過去就是兩種卡片。
   拿掉這兩條覆寫，它就跟 `details.card` 走同一套。 */

.card-head { display: flex; align-items: center; gap: 10px; margin: -2px 0 14px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 16.5px; }
.card-head .spacer { margin-left: auto; }
/* 卡片標題的小色磚（設計圖：每張卡片標題左邊都有一個） */
.card-head .tile { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 9px; }
.card-head .tile .ic { width: 16px; height: 16px; }

/* ── 工具列：同一列的控制項一律等高 ──────────────────────────────────
   🔴 這是「明講」不是「猜」。
   2026-09-09 試過用 `:has()` 自動判斷「這一列有下拉也有小按鈕」，
   結果 Markdown 工具列裡有些按鈕自己又包了一層（split button），
   同一列變成 38／38／31／38／38／31 —— 比原本一致的 31 還亂，只好還原。
   改成一個明確的類別：**哪一個容器是工具列由頁面自己講**，
   裡面的按鈕、小按鈕、下拉、分段按鈕、搜尋框全部收成 38px。
   （使用者 2026-09-09 連續三次回報「按鈕 下拉清單 沒有一個對齊」）*/
.toolbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar-row .btn,
.toolbar-row .btn-small,
.toolbar-row .jt-select > .jt-select-btn,
.toolbar-row > select,
.toolbar-row input[type="search"],
.toolbar-row input[type="text"],
.toolbar-row .seg > button {
  height: 38px; min-height: 38px; padding-top: 0; padding-bottom: 0;
}
.toolbar-row .seg { align-items: stretch; }
/* 同一個按鈕列裡同時有一般按鈕與小按鈕時，小按鈕跟著長高。
   ⚠️ **只看直接子元素、而且只在混用時**才套 —— 整列都是小按鈕的
   （站台 24 頁都有這種寫法）是刻意的密集列，不可以一起放大。
   實測只影響 browser-diag／mic-test／camera-check 那三列。 */
.actions:has(> .btn:not(.btn-small)):has(> .btn-small) > .btn-small { height: 38px; }

/* ── 按鈕 ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 16px; border-radius: 10px; font-weight: 500;
  border: 1px solid var(--border); background: #fff;
  cursor: pointer; font-size: 14px; font-family: inherit;
  text-decoration: none; color: var(--text); line-height: 1;
}
.btn:hover { background: #f3f4f6; }
.btn:disabled, .btn[disabled] { opacity: 0.55; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #15803d; border-color: #15803d; }
.btn-small { padding: 7px 13px; font-size: 13px; border-radius: 9px; }
.btn-lg { padding: 10px 22px; font-size: 15px; font-weight: 600; }
.btn-icon { padding: 7px; }
/**
 * 按鈕列。
 *
 * `align-items: center` 是必要的 —— 按鈕列裡常常夾著一段說明文字
 * （「下載範本：」那種），flex 預設的 stretch 會把那個 span 拉成整列高，
 * 文字貼在頂端，看起來就跟旁邊的按鈕沒對齊（使用者 2026-09-08 回報）。
 */
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; align-items: center; }
/* 按鈕列收進卡片裡以後，跟上面的欄位貼太近；最後一列也不要再多留一段空白 */
.card > .actions { margin: 16px 0 0; }
/* 但下面還有東西時（說明文字、輸出區）就得留出間距，不然會黏在按鈕底下 */
.card > .actions:not(:last-child) { margin-bottom: 14px; }

/* ── 表單 ─────────────────────────────────────────────────────────────── */

.field { margin-bottom: 14px; }
/* 工具頁內的欄位標籤（modernize-tool.js 產生的標記） */
.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
/* 唯讀的輸出框：底色區隔，一眼看得出「這格不是給你打字的」 */
textarea.is-output, input.is-output { background: #f8fafc; }
.field > label, .input-label {
  display: block; font-size: 13px; font-weight: 600;
  margin-bottom: 6px; color: var(--text);
}
.field-hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

input[type="text"], input[type="number"], input[type="password"], input[type="search"],
input[type="url"], input[type="email"], input[type="datetime-local"], input[type="date"],
input[type="time"], input[type="month"], input[type="week"], input[type="tel"],
select, textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 6px;
  background: #fff; color: var(--text);
  font-size: 14px; font-family: inherit; line-height: 1.5;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}
textarea { resize: vertical; min-height: 120px; font-family: var(--mono); font-size: 13px; }
select { cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--primary); }
.checkbox-row { display: flex; align-items: center; gap: 7px; font-size: 13.5px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 220px; min-width: 0; }

/* ── 表格 ─────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }        /* 寬表格自己捲，整頁不橫捲 */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th, table.tbl td {
  border-bottom: 1px solid var(--border); padding: 8px 10px; text-align: left;
}
table.tbl th { background: #f8fafc; font-weight: 600; white-space: nowrap; }
table.tbl tbody tr:hover { background: #f8fafc; }


/* ── 結果呈現 ─────────────────────────────────────────────────────────────
   計算類工具的輸出區共用元件。以前每支工具自己用 inline style 拼一套
   （紫色漸層橫幅、彩色左邊框、自訂標題色），結果同樣是「計算結果」，
   PVE 三支工具長得三個樣。
   ──────────────────────────────────────────────────────────────────────── */

/* 並排的資訊面板 */
.panel-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.panel {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; border-left: 3px solid var(--primary);
}
.panel > h4 {
  margin: 0 0 10px; font-size: 14px; font-weight: 600;
  display: flex; align-items: center; gap: 7px; color: var(--text);
}
.panel > h4 .ic { color: var(--primary); }
.panel.is-success { border-left-color: var(--success); }
.panel.is-success > h4 .ic { color: var(--success); }
.panel ul, .panel ol { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.7; }
.panel-line { font-size: 13.5px; line-height: 1.8; }
.panel-line strong { font-weight: 600; }

/* 最終結論。刻意**不用**滿版漸層 —— 那會把整頁的視覺重心搶走，
   而且跟站上其他地方的語彙對不上。改用主色淡底 + 左邊粗線。 */
.result-hero {
  margin-top: 14px; padding: 16px 18px;
  background: #eff6ff; border: 1px solid #bfdbfe; border-left: 4px solid var(--primary);
  border-radius: var(--radius);
}
.result-hero h4 {
  margin: 0 0 8px; font-size: 14px; font-weight: 600;
  display: flex; align-items: center; gap: 7px; color: var(--primary-dark);
}
.result-hero-value { font-size: 20px; font-weight: 700; color: var(--primary-dark); line-height: 1.5; }
.result-hero-sub { font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.result-hero-title { margin: 0 0 10px; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 7px; }

/* 面板內的次標題與公式方塊（計算類工具會用到） */
.panel-sub { margin: 0 0 8px; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.panel-sub .ic { color: var(--primary); }
.formula-box {
  background: #f8fafc; border: 1px solid var(--border); border-radius: 6px;
  padding: 10px 12px; font-family: var(--mono); font-size: 13px;
}

/* 統計膠囊：一排帶圖示的淡底圓角標籤，用來摘要一次處理的結果 */
.stat-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 16px; }
.stat-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 15px; border-radius: 11px;
  background: #eef2ff; color: #3730a3;
  font-size: 13.5px; font-weight: 600;
}
.stat-pill .ic { color: currentColor; opacity: 0.85; }
.stat-pill.is-ok { background: #ecfdf5; color: #047857; }
.stat-pill.is-warn { background: #fffbeb; color: #b45309; }
.stat-pill.is-err { background: #fef2f2; color: #b91c1c; }

/* 可收合的說明區（設計圖底部的「功能說明」「常用 OID 說明」） */
details.card > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  font-size: 16.5px; font-weight: 600; margin: -2px 0;
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after {
  content: ''; margin-left: auto;
  width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 6px solid var(--muted); transition: transform 0.15s;
}
details.card[open] > summary::after { transform: rotate(180deg); }
details.card[open] > summary { margin-bottom: 14px; }


/* ── 功能說明清單 ─────────────────────────────────────────────────────────
   「圖示 + 標籤：+ 說明」三欄格線。
   為什麼要做成格線而不是每行各自 flex：圖示的視覺寬度不一樣，標籤文字就會
   從不同的位置開始，整欄看起來歪歪扭扭（使用者截圖指出 CSV 那一頁「每一行
   前面都不對齊」）。格線放在 <ul> 上、每個 <li> 用 display:contents，
   三欄的寬度才會由所有列一起決定，自然對齊。
   ──────────────────────────────────────────────────────────────────────── */

.feature-list {
  display: grid;
  grid-template-columns: 22px minmax(96px, max-content) 1fr;
  align-items: start;          /* 說明換行時圖示要留在第一行，不要被垂直置中拉下去 */
  gap: 5px 12px;               /* 使用者 2026-09-06：行距太寬，靠近一點 */
  list-style: none; margin: 0; padding: 0;
  font-size: 13.5px; line-height: 1.65;
}
/**
 * **只有轉換過的項目**（圖示／標籤／說明三格）才攤平成格線列。
 *
 * `display: contents` 會把 <li> 的每個子節點變成獨立的格線項目 —— 同一份清單裡
 * 沒有 <strong> 的純句子項目會被拆成一堆碎片，一個字佔一列（2026-09-06
 * base64 頁面回報）。所以攤平只給有 `.fi-row` 標記的項目，其餘照常自成一列。
 */
/**
 * 說明卡（`.doc-cards`）後面接說明清單時要隔開。
 *
 * 兩個都是說明區的區塊，各自有內距但**都沒有外距** —— 接在一起時
 * 卡片的下緣直接貼著清單第一列的圖示，看起來像同一塊。
 * 2026-09-09 PVE 系統報告檢視器第一次把兩者放在一起，`check-visual` 的
 * 「相鄰元件間距 0」抓到。修在這裡，往後每一頁都受惠。
 */
.doc-cards + .feature-list,
.doc-cards + .doc-note,
.feature-list + .doc-cards { margin-top: 14px; }

.feature-list > li { margin-bottom: 0; }   /* 舊樣式層的 li 間距不要再疊上來 */
.feature-list > li.fi-row { display: contents; }
.feature-list ul, .feature-list ol { margin: 4px 0 0; padding-left: 20px; }
/**
 * 沒有三格結構的項目（純句子、或底下還帶巢狀清單的）**當一般區塊排**。
 * 之前給它 `display:grid` 加 22px 首欄，結果 <strong> 落進那個 22px 欄位裡，
 * 標籤被壓成一個字一行（email-subject／email-header／diff-compare 三頁全毀，
 * 使用者 2026-09-06 回報）。項目符號改用絕對定位的小圓點，不佔格線。
 */
.feature-list > li:not(.fi-row) {
  grid-column: 1 / -1;
  /* 22px 是圖示欄的寬度，小圓點要落在跟上面那些圖示同一條垂直線上，
     不然同一份清單會有兩個不同的左緣（使用者一直在講的「沒對齊」） */
  position: relative; padding-left: 22px;
  color: var(--muted);
}
.feature-list > li:not(.fi-row)::before {
  content: ''; position: absolute; left: 8.5px; top: 0.62em;
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; opacity: 0.42;
}
.feature-list > li:not(.fi-row) > strong { text-align: left; color: var(--text); }
/* 這類項目的符號由 li::before 畫，裡面那顆空圖示要收掉，否則會有兩顆點 */
.feature-list > li:not(.fi-row) > .fi-icon { display: none; }
/* 沒有專屬圖示的那幾行（原本的 emoji 被拿掉後沒補上）：畫一個小圓點。
   留白會看起來像那一行的圖示掉了，小圓點則明確表示「這行沒有圖示」。 */
.feature-list .fi-icon:empty::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; opacity: 0.42; flex: none;
}
/* 圖示（和沒有圖示時的小圓點）跟**第一行文字**對齊：說明換行時整格會被拉長，
   置中就會掉到兩行中間，一整列看起來高高低低（使用者 2026-09-06 回報） */
.feature-list .fi-icon { display: inline-flex; align-items: center; justify-content: center; height: 1.65em; }
.feature-list .fi-icon .ic { width: 17px; height: 17px; }
/* 標籤靠右：冒號對齊成一直線，說明欄本來就對齊，整份清單才像排過的 */
/**
 * 標籤靠左，**緊跟著自己的圖示**。
 *
 * 一度改成靠右讓冒號對齊，但欄寬是由最長的標籤決定的，短標籤（「刪除列：」）
 * 就被推到離圖示很遠的地方，看起來像兩件不相干的東西（使用者 2026-09-06）。
 * 說明欄本來就從同一個 x 開始，整份清單還是對齊的。
 */
.feature-list > li > strong { font-weight: 600; color: var(--text); text-align: left; max-width: 30ch; }
.feature-list > li > span:last-child { color: var(--muted); min-width: 0; }
/* 說明裡的長字串（檔名、指令）要能斷行，否則手機上會把整頁撐寬 */
.feature-list code, .feature-list kbd { overflow-wrap: anywhere; }

/* 圖示輪替配色 —— 一整排同一個顏色會讓清單變成一片灰，
   有變化才看得出「這些是不同的功能」。六色循環，與站台色盤同一家族。 */
.feature-list > li:nth-child(6n+1) .fi-icon { color: #2563eb; }
.feature-list > li:nth-child(6n+2) .fi-icon { color: #0d9488; }
.feature-list > li:nth-child(6n+3) .fi-icon { color: #c2410c; }
.feature-list > li:nth-child(6n+4) .fi-icon { color: #7c3aed; }
.feature-list > li:nth-child(6n+5) .fi-icon { color: #15803d; }
.feature-list > li:nth-child(6n)   .fi-icon { color: #b45309; }

@media (max-width: 700px) {
  /* 窄畫面改成兩欄：圖示 + 內容，標籤與說明上下排 */
  .feature-list { grid-template-columns: 22px 1fr; }
  .feature-list > li > strong { grid-column: 2; }
  .feature-list > li > span:last-child { grid-column: 2; margin-top: -6px; }
}

/* ── 提示訊息 ─────────────────────────────────────────────────────────── */

.note {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: #f8fafc;
  font-size: 13.5px; margin: 12px 0;
}
.note .ic { margin-top: 2px; flex: none; }
.note-info    { background: #eff6ff; border-color: #bfdbfe; }
.note-info .ic    { color: var(--primary); }
.note-success { background: #f0fdf4; border-color: #bbf7d0; }
.note-success .ic { color: var(--success); }
.note-warn    { background: #fffbeb; border-color: #fde68a; }
.note-warn .ic    { color: var(--warning); }
.note-error   { background: #fef2f2; border-color: #fecaca; }
.note-error .ic   { color: var(--danger); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 10px;
  font-size: 11.5px; font-weight: 600; line-height: 1.6;
  background: #eef2ff; color: #4338ca;
}
.badge-ok   { background: #dcfce7; color: #15803d; }
.badge-warn { background: #fef3c7; color: #b45309; }
.badge-err  { background: #fee2e2; color: #b91c1c; }

/* ── 程式碼與輸出 ─────────────────────────────────────────────────────── */

code, kbd, pre { font-family: var(--mono); }
code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
pre.out {
  background: #0f172a; color: #e2e8f0;
  padding: 14px; border-radius: var(--radius);
  overflow-x: auto; font-size: 12.5px; line-height: 1.55; margin: 0;
}

/* ── Toast 通知 ───────────────────────────────────────────────────────── */

.toast-host { position: fixed; top: 18px; right: 18px; z-index: 9999;
              display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 8px;
  background: #1e293b; color: #fff;
  padding: 10px 16px; border-radius: 8px; font-size: 14px;
  opacity: 0; transform: translateX(20px);
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.2);
  max-width: 340px;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast.ok   { background: var(--success); }
.toast-ic { display: inline-flex; align-items: center; margin-right: 6px; vertical-align: -3px; }
.toast.err  { background: var(--danger); }
.toast.warn { background: var(--warning); }

/* ── 首頁工具牆 ───────────────────────────────────────────────────────── */

.hero { text-align: center; padding: 26px 0 10px; }
/* 首頁的大 logo 要有陰影，而且要糊、要散（使用者 2026-09-08）。
   用 drop-shadow 不用 box-shadow —— logo 是去背 PNG，box-shadow 會在
   透明的方框外緣畫出一圈矩形陰影，那看起來像貼了一張紙。
   兩層疊：一層近的定形狀、一層遠的做暈開。 */
.hero-logo {
  width: 84px; height: 84px; object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(37, 99, 235, .22))
          drop-shadow(0 18px 34px rgba(15, 23, 42, .20));
}
/* 站名跟 jt-doc-tools 一樣用主色、字更大更粗 */
.hero h1 { justify-content: center; font-size: 34px; font-weight: 800; letter-spacing: 0.01em;
           color: var(--sidebar-to); margin: 12px 0 8px; }
.hero-tagline { color: var(--muted); font-size: 15px; margin: 0 0 16px; }
/* 🔴 使用者 2026-09-10 指定：四個標籤**只能排 4 / 2 / 1，不可以有一行三個**。
   所以不能用 flex-wrap（「塞得下就塞」正好會給出 3 + 1），也不能用
   auto-fit／auto-fill（同樣會排出 3 欄）。固定欄數 + 斷點才擋得住。
   欄寬用 max-content 不用 1fr —— 1fr 會把四個拉成等寬，字少的那個
   左右空一大塊。斷點是量出來的，見下面兩條的註解。 */
.hero-badges {
  display: grid; grid-template-columns: repeat(4, max-content);
  gap: 10px; justify-content: center;
}
/* 斷點是量出來的，不是猜的：四個標籤的內容寬中文約 858px、**英文約 1001px**，
   而首頁左邊還有 268px 的側欄 —— 第一版只算內容寬（1060px）就漏了側欄，
   實測中文 1150px、英文 1290px 就已經凸出視窗。
   取較寬的那一種：1001 + 內距 40 + 側欄 268 ≈ 1310 → **1320px 以下兩欄**；
   兩欄需要最寬的那個 ×2 ≈ 584px，加內距 → 640px 以下一欄。
   ⚠️ 側欄收合時可用寬度會變寬，那時四個其實排得下 —— 但寧可少排一列，
   也不要出現使用者明講不要的「一行三個」。 */
@media (max-width: 1320px) { .hero-badges { grid-template-columns: repeat(2, max-content); } }
/* 🔴 **斷點要跟著語言走。**
   上面那個 1320 是拿**英文**量出來的，而日文比英文再長一截 ——
   實測四個並排：繁中 858px、英文 1001px、**日文 1152px**。
   所以日文在 1320–1460 之間會凸出視窗（使用者 2026-09-14 在正式站回報
   「一切日文 上面四個標籤超過寬度了」）。
   日文的斷點：1152 + 內距 40 + 側欄 268 ≈ 1460 → **1480px**。
   ⚠️ **不把預設斷點一起拉到 1480** —— 那會讓中文與英文在 1320–1480 之間
   平白少排一列，而它們本來排得下。加語言就加一條，不要動別人的。
   ⚠️ 以後再加語言，這裡要再量一次；量法是把四個標籤的實際寬度加總
   （`tests/check-layout.js` 現在會在 en / ja 下各掃一次首頁，漏了會紅）。 */
@media (max-width: 1480px) { html[lang="ja"] .hero-badges { grid-template-columns: repeat(2, max-content); } }
/* ⚠️ 這一條要把日文那個選擇器一起列出來 —— `html[lang="ja"] .hero-badges` 是
   (0,2,1)，權重比裸的 `.hero-badges` 高，不列的話手機上日文會停在兩欄。 */
@media (max-width: 640px) {
  .hero-badges,
  html[lang="ja"] .hero-badges { grid-template-columns: max-content; }
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 20px; border-radius: 12px;
  background: #fff; border: 1px solid var(--border);
  font-size: 14px; box-shadow: var(--shadow);
}
.hero-badge .ic { color: var(--primary); }

.cat-head { display: flex; align-items: center; gap: 9px; margin: 30px 0 14px; }
.cat-head h2 { margin: 0; font-size: 19px; }
.cat-head .ic { color: var(--primary); }

.tool-grid {
  display: grid; gap: 14px;
  /* 比照 jt-doc-tools：卡片窄一點，一排多放一張 */
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
}
.tool-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow);
  padding: 18px 20px; text-decoration: none; color: var(--text);
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.tool-card:hover {
  transform: translateY(-2px); border-color: #c7d2fe;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12);
}
/* 圖示在上、名稱在圖示下、說明再下一行（jt-doc-tools 的排法） */
.tool-card-top { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
/* 首頁卡片的磚塊大一號；顏色同樣來自共用色盤，與側欄同一支工具一致 */
.tool-card-icon { flex: 0 0 46px; width: 46px; height: 46px; border-radius: 12px; }
.tool-card-icon .ic { width: 22px; height: 22px; }
.tool-card-name { font-weight: 600; font-size: 15px; line-height: 1.35; }
.tool-card-desc { display: block; font-size: 13px; color: var(--muted); line-height: 1.55; }
/* 設計圖的首頁卡片沒有標籤列 —— 卡片只留圖示、名稱、說明，版面乾淨得多。
   標籤仍留在 DOM 裡供搜尋比對使用，只是不顯示。 */
.tool-card-tags { display: none; }

/* ── 行動版 ───────────────────────────────────────────────────────────── */

.sidebar-toggle {
  display: none; position: fixed; left: 10px; top: 10px; z-index: 60;
  width: 38px; height: 38px; padding: 0;
  border: none; border-radius: 8px;
  background: var(--primary); color: #fff; cursor: pointer;
  align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 45;
  background: rgba(15, 23, 42, 0.45);
}

@media (max-width: 900px) {
  /**
   * **手機上所有輸入類元件都要 16px。**
   *
   * iOS Safari 只要看到 font-size 小於 16px 的輸入框，一聚焦就自動把整個畫面
   * 放大，使用者填完還得手動縮回去（2026-09-06 回報）。這是 iOS 的既定行為，
   * 只能用字級避開 —— viewport 加 user-scalable=no 也擋不住，而且會害到
   * 真的需要放大的人。
   *
   * 用 `!important`：側欄搜尋框（`.sidebar input.sidebar-search`）與各工具自己
   * 寫的字級都比單一元素選擇器強，不加就蓋不過去。這是功能性修正，不是排版偏好 ——
   * 少一個字級的細節，換掉「填完要自己縮回去」。
   */
  input, select, textarea { font-size: 16px !important; }

  .sidebar { transform: translateX(-100%); transition: transform 0.2s; width: 280px; }
  .sidebar.open { transform: translateX(0); }
  /**
   * 窄畫面自動收起時，用**跟桌機收折後同一個**左緣標籤來展開。
   * 原本是左上角一顆浮動漢堡（position: fixed, left/top: 10px），它會正好蓋在
   * 頁面標題的圖示上（使用者 2026-09-06 回報）；而且同一個站有兩種展開方式，
   * 使用者得記兩套。
   */
  .sidebar-toggle { display: none; }
  .sidebar-expand { display: inline-flex; align-items: center; justify-content: center; }
  body.sidebar-open .sidebar-expand { display: none; }
  .sidebar-overlay.show { display: block; }
  .content { margin-left: 0; }
  .topbar { padding-left: 58px; }
  .container { padding: 18px 14px 56px; }
  .hero h1 { font-size: 24px; }
}

/* ============================================================================
   舊版樣式相容層
   26 個工具頁是分批翻新的，還沒翻到的頁面仍在用舊的 class 名稱。這一層讓
   它們在新外框裡也長得像新的 —— 沒有這層，翻新期間站上會同時存在兩種
   長相的按鈕與輸入框，使用者每點一個工具就換一次視覺。
   翻新完成後這一整段可以刪掉（`npm run test:icons` 會回報還剩幾頁在用）。
   ========================================================================== */

.tool-main { display: block; }
.tool-header { margin-bottom: 16px; }
.tool-header h1 { font-size: 22px; margin: 0 0 6px; }
.tool-header p { margin: 0; color: var(--muted); font-size: 14px; }
.navbar, .back-btn, .nav-brand { display: none; }   /* 舊的頁內導覽由側欄取代 */

.input-section, .output-section, .button-section, .info-section, .result-section {
  margin-bottom: 16px;
}
.info-section {
  --pad-x: 16px; --pad-y: 16px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--pad-y) var(--pad-x);
}
.info-section h3 { margin-top: 0; }
.info-section ul { margin: 8px 0 0; padding-left: 20px; }
.info-section li { margin-bottom: 5px; font-size: 13.5px; }
.info-section .feature-list > li { margin-bottom: 0; }   /* 新版清單自己管行距 */

.textarea-input, .textarea-output {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 6px;
  font-family: var(--mono); font-size: 13px; line-height: 1.55;
  background: #fff; color: var(--text);
}
.textarea-output { background: #f8fafc; }

.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #f3f4f6; }
.btn-outline { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: #f3f4f6; }
.copy-btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px; padding: 6px 12px; border-radius: 6px;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  font-size: 13px; font-family: inherit; cursor: pointer;
}
.copy-btn:hover { background: #f3f4f6; }

/* 舊的通知元件（js/common.js 產生）沿用新的 toast 外觀 */
.notification {
  position: fixed; top: 18px; right: 18px; z-index: 9999;
  padding: 10px 16px; border-radius: 8px; color: #fff; font-weight: 500;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.2); max-width: 340px;
}

/* ══════════════════════════════════════════════════════════════════════
   設定卡 / 結果版面（2026-09-06 設計圖）

   先做在 PVE Ceph 容量計算機上，確認之後才推到其他頁（weathermap 除外），
   所以這裡全部用通用的類別名稱，不綁任何一支工具。
   ══════════════════════════════════════════════════════════════════════ */

/* 兩張設定卡並排；窄螢幕自動疊起來 */
.setup-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(430px, 1fr)); margin-bottom: 16px; }

/* 可收合的設定卡：用原生 <details>，不必為了收合寫 JS */
/* 🔴 **不可以寫 `padding: 0`。**
      舊版寫了，而下面那句註解說「靠 .card 自己的 --pad-x 就好」——
      那個前提從來不成立：`padding: 0` 拿掉的正是那個內距。
      結果每一張設定卡的**內文都貼著卡片邊緣**（實測卡片 14–376、
      內容 15–375，而一般卡片是 37–353），桌機與手機都一樣，
      而且從這個類別存在的第一天就是這樣。
   ⚠️ 我前兩次「修好了」都只比較了各列**彼此**對不對齊，
      沒有比過**卡片邊緣** —— 所以量了三次都沒量到使用者看到的那件事。 */
details.setup-card > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; }
details.setup-card > summary::-webkit-details-marker { display: none; }
/* 說明區那套 details.card 有自己的三角箭頭；設定卡用的是 .card-chevron，
   兩個都吃 margin-left:auto，不關掉就會一張卡上出現兩個箭頭 */
/* ⚠️ **`setup-card` 與 `doc-summary` 不可以混用。**
   這一條的用意是「setup-card 自己在標記裡放 .card-chevron，不要再多一個箭頭」，
   但它跟 `details.card > summary::after`（提供箭頭那一條）**權重相同、寫在後面**。
   所以 `<details class="card setup-card"><summary class="doc-summary">` 這種寫法
   會變成：doc-summary 的箭頭被這條關掉、而標記裡又沒有 .card-chevron ——
   **一個箭頭都沒有**（2026-09-12 使用者在 LibreNMS 容量計算機回報）。
   要收合卡片就二選一，不要兩種類別都掛。 */
details.setup-card > summary::after { content: none; }

/* 內文用卡片自己的內距（現在真的有了，見上面那段） */
.setup-body { padding: 0; }
.card-head-icon { flex: 0 0 38px; width: 38px; height: 38px; border-radius: 11px; }
.card-head-icon .ic { width: 20px; height: 20px; }
.card-head-text { min-width: 0; }
.card-title { margin: 0; font-size: 16.5px; font-weight: 700; line-height: 1.3; }
.card-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.card-chevron { margin-left: auto; color: var(--muted); transition: transform 0.15s; }
details.setup-card:not([open]) .card-chevron { transform: rotate(180deg); }

/* 一列一個欄位：標籤在左、控制項在右。
   **每一列固定同高**（含只有開關的那列），兩張卡並排時列與列才會互相對齊 —— 
   輸入框 41px、下拉 38px、開關 24px 各長各的，看起來就是沒排過（使用者 2026-09-06 回報）。 */
.field-row { display: grid; grid-template-columns: 122px minmax(0, 1fr); align-items: center; gap: 12px; margin-bottom: 10px; min-height: 42px; }
.field-row > :nth-child(2) { min-height: 42px; }
.field-row input[type="number"], .field-row input[type="text"], .field-row select { height: 42px; }
.field-row .switch { min-height: 42px; }
/* 🔴 `.field-row` 裡的分段按鈕要跟旁邊的輸入框一樣高（使用者 2026-09-10 回報
   「大小不同」：密碼產生器「產生數量」那一列，輸入框 42px、`1/5/10` 只有 35px）。
   ⚠️ **不可以改 `.seg > button` 的全域高度** —— 工具列（`.toolbar-row`）刻意是
      38px、密集按鈕列是 31px，改全域會把那兩處弄壞。這裡只限定在 `.field-row`
      與 `.field-stack` 底下，也就是「跟輸入框並排」的那些。
   ⚠️ 這是 `.jt-select` 那件事的同一個家族（2026-09-09 記過：預設值站錯邊、
      靠例外清單補）。當時把 `.jt-select` 收成 38px、42px 只留給欄位列，
      但 `.seg > button` 沒有跟著補上。 */
/* ⚠️ 不能只寫 `>` 直接子元素：`.seg` 常常被包在 `.inline-note-row`
   或 `.input-unit` 旁邊的容器裡（密碼產生器「產生數量」就是
   `.field-row > .inline-note-row > .seg`）。用後代選擇器，
   但**限定在欄位列底下**，工具列與密集按鈕列不受影響。 */
.field-row .seg > button,
.field-stack .seg > button { height: 42px; }
/* 用不到的欄位反灰但留在原位：整列隱藏會讓卡片高度跳動，也看不出「還有這個選項」 */
.field-row.is-disabled > label { color: var(--muted); }
.field-row :disabled { background: #f8fafc; color: var(--muted); cursor: not-allowed; }
.field-row:last-child { margin-bottom: 0; }
/* 控制項本身不需要整列寬時用這個 —— 例如只是選一個時區。
   撐滿一列的下拉在「標籤 + 值」的清單旁邊看起來特別突兀。

   🔴 標籤欄仍然是 122px，跟一般 `.field-row` 一樣。原本寫 `max-content`，
   於是**同一張卡片裡混用時每一列的控制項左緣都不一樣** —— 標籤長的那列
   往右挪，短的往左（IP 子網路那張卡片實測 477／425／453 三種左緣，
   使用者 2026-09-10 回報「欄位都不整齊」）。
   `is-compact` 要管的只有「控制項不要撐滿整列」這一件事，
   不該連帶改掉標籤欄的寬度。 */
.field-row.is-compact { grid-template-columns: 122px minmax(0, 280px); }
/* 只放得下兩三位數的欄位（百分比、台數、天數）用這個。
   `is-compact` 的 280px 對「20 %」來說太寬 —— 一個兩位數配一格單位，
   卻佔掉跟下拉選單差不多的寬度，看起來像沒設定好
   （使用者 2026-09-11 回報 LibreNMS 的規劃條件：「輸入框可以不用那麼寬」）。
   ⚠️ 標籤欄仍然是 122px：控制項的左緣要跟同一張卡片裡其他列對齊，
      這一條只縮右邊。 */
.field-row.is-narrow { grid-template-columns: 122px minmax(0, 168px); }
/* 下拉或較長的輸入用這個。留在 380px 是量出來的：這一類下拉最長的選項
   （「提供的精簡 MIN／MAX 方案（Σrows 15240）」）本身 285px，
   加上左右內距與箭頭剛好放得下。
   ⚠️ 不設上限的話它會撐滿整張卡片（實測 964px），
      而同一張卡片裡其他控制項只有 168–276px —— 一長一短看起來像沒排好
      （使用者 2026-09-11 回報 LibreNMS 的規劃條件「一直沒改好」）。 */
.field-row.is-mid { grid-template-columns: 122px minmax(0, 380px); }
.field-row > label { font-size: 14px; font-weight: 600; color: var(--text); }
.field-row input[type="number"], .field-row input[type="text"], .field-row select { width: 100%; }

/* 輸入框 + 單位後綴（50 [TB]） */
/**
 * `.seg` 當**分頁列**用的時候，要跟下面的內容留出間距。
 *
 * `.seg` 本身沒有外邊界 —— 那是對的，它大多數時候住在 `.field-row` 或按鈕列裡，
 * 給了邊界反而會把那一列撐開。但當它單獨一塊、底下接著一張卡片時
 * （SSL 憑證工具箱的「拆解 pfx / 打包 pfx」），兩塊就**貼在一起**
 * （使用者 2026-09-12 回報「按鈕跟下面貼在一起了 不好看」）。
 *
 * ⚠️ 用明確的類別讓頁面自己宣告，**不要用選擇器猜**「這個 seg 是不是分頁列」——
 *    站台在 `.toolbar-row` 那次試過用 `:has()` 自動判斷，結果把原本一致的
 *    高度弄得更亂（CLAUDE.md 2026-09-10）。
 */
.seg.seg-tabs { margin-bottom: 16px; }

.input-unit { display: flex; height: 42px; }
/**
 * 圓角要看位置，不能每個 input 都給左圓角。
 *
 * 原本 `.input-unit > input` 一律 `10px 0 0 10px` —— 一格的時候剛好，
 * 但**兩個 input 並排**（顏色選擇器 + HEX 文字框）時，第二個也帶著左圓角，
 * 蓋在第一個的直角右邊上，看起來就是兩塊疊在一起
 * （使用者 2026-09-08 回報「顏色區跟文字框疊到了」）。
 * 改成由位置決定：第一格左圓角、最後一格右圓角、中間全直角。
 */
/* 🔴 **內側圓角歸零要對「所有子元素」，不能只對 input。**
   舊版只寫 `.input-unit > input { border-radius: 0 }` —— 接在輸入框右邊的
   **按鈕**（密碼欄位的眼睛鈕、PKCS#12 的顯示鈕）保留自己的 `.btn-small`
   9px 圓角，於是右半邊是 10px、左半邊是 9px，**兩塊接不起來**
   （使用者 2026-09-12 回報「怎麼出現不接在一起的圓角」）。
   逐一列舉元素型別一定會再漏，所以預設站在「接合」那一邊：
   全部歸零，再由位置把外側加回去。 */
.input-unit > * { border-radius: 0; }
/* ⚠️ `.input-unit > input` 這一條的 `border-radius: 0` **不能省** ——
   上面那條是 (0,1,0)，而基礎的 `input[type="text"], …` 選擇器是 (0,1,1)，
   權重比它高（6px 會贏）。要 (0,1,1) 而且寫在後面才蓋得掉。
   2026-09-12 我把它合併進上面那條，結果按鈕修好了、**輸入框的右上右下變回 6px**
   —— 18 支工具一起中，而且是自己寫的量測腳本抓到的。 */
.input-unit > input { flex: 1; min-width: 0; border-radius: 0; }
.input-unit > :first-child { border-top-left-radius: 10px; border-bottom-left-radius: 10px; }
.input-unit > :last-child { border-top-right-radius: 10px; border-bottom-right-radius: 10px; }
/**
 * 顏色選擇器的色塊在 Safari／Firefox 會用原生樣式畫，
 * 有自己的內距與圓角、還會超出元素邊界。把它壓回框內才不會露出來。
 */
.input-unit > input[type="color"] { overflow: hidden; }
.input-unit > input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.input-unit > input[type="color"]::-webkit-color-swatch { border: none; border-radius: 6px; }
.input-unit > input[type="color"]::-moz-color-swatch { border: none; border-radius: 6px; }
/**
 * 滑桿＋數字框並排時，數字框要窄。
 *
 * 上面那條讓**兩個** input 都吃 `flex: 1`，於是滑桿與數字框**平分**寬度 ——
 * 一個只放 2–4 位數的框跟滑桿一樣寬（使用者 2026-09-07 回報「文字框太寬」）。
 * 用 `~` 限定「前面有滑桿」的情況，單獨的數字框仍然撐滿。
 */
.input-unit > input[type="range"] ~ input[type="number"] {
  flex: 0 0 92px; text-align: right;
  /* 數字框與單位是**接在一起的一個控制項**，滑桿是另一個 ——
     所以左圓角要還給數字框，不能因為它排在中間就變成直角
     （使用者 2026-09-08 回報「右邊文字框左上左下少了圓角」） */
  border-top-left-radius: 10px; border-bottom-left-radius: 10px;
}
/* 滑桿本身沒有框，貼著數字框看起來像黏在一起，要留出間距 */
.input-unit > input[type="range"] { margin-right: 12px; border-radius: 0; }

/**
 * 數字欄位的寬度上限。
 *
 * 數字框撐滿整張卡片沒有意義 —— UUID 的「產生數量」（1–100）原本是 **1054px**，
 * 密碼的長度與份數各 520px。一個放 1–4 位數的框給 200px 綽綽有餘，
 * 而且跟旁邊的按鈕、標籤比例才對得起來（使用者 2026-09-07 回報）。
 * `.input-unit` 裡的另有規則，不受這條影響。
 */
input[type="number"] { max-width: 200px; }
.input-unit > input[type="number"] { max-width: none; }
.input-unit > .unit-select {
  flex: 0 0 auto; width: auto; min-width: 78px;
  border: 1px solid var(--border); border-left: none; border-radius: 0 10px 10px 0;
  background: #f1f5f9; color: var(--text); font-size: 13px; font-weight: 600;
  padding: 0 10px; cursor: pointer;
}
/**
 * 單位後綴。
 *
 * `min-width` 是為了**讓同一張卡片裡的數字框對齊**：單位的字數不一樣
 * （%、台、顆、核、GiB、: 1），寬度跟著文字走的話，每一列的數字框
 * 左緣都不同，看起來寬度不一致（使用者 2026-09-08 回報）。
 * 固定一個容得下 3–4 個字的寬度，文字置中，整欄就對齊了。
 */
.input-unit > .unit {
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto; min-width: 54px; padding: 0 10px;
  border: 1px solid var(--border); border-left: none; border-radius: 0 10px 10px 0;
  background: #f1f5f9; color: var(--muted); font-size: 13px; font-weight: 600;
}
/* 排在第一個的單位是**前綴**（CIDR 的 /、指令列的終端機圖示）——
   接合處在右邊不是左邊，所以左框線要留著。
   ⚠️ 位置決定外觀，跟 .input-unit > .jt-select 同一個做法
   （2026-09-14 記過：把「接在右邊」寫死在元件上，換個位置就長反了）。 */
/* 🔴 圓角也要在這裡改。`.input-unit > .unit` 的 `border-radius: 0 10px 10px 0`
   寫在基礎規則裡，而 `.input-unit > :first-child` 的左圓角**權重相同、寫在前面**
   —— 於是前綴單位拿到的是右圓角（實測「每組」那一格是 `0 10px 10px 0`）。
   站台記過同一個形狀：規則存在但輸掉，跟「沒有定義」是兩回事。 */
.input-unit > .unit:first-child {
  border-left: 1px solid var(--border); border-right: none;
  border-radius: 10px 0 0 10px;
}
.input-unit > .unit:first-child:last-child { border-radius: 10px; border-right: 1px solid var(--border); }

/* 只給螢幕閱讀器看的文字（aria-live 的播報區、隱藏的 label）。
   ⚠️ 不可以用 display:none 或 visibility:hidden —— 那兩種輔助技術也讀不到。
   email-subject 與 yaml-format 各自複製過一份，現在收成同一份。 */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* 留空＝自動建議的欄位：AUTO 徽章放在框內左側，一眼看出「這格可以不填」 */
.input-auto { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 6px 0 8px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.input-auto:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
.input-auto > input { flex: 1; min-width: 0; height: 100%; border: none; background: none; padding: 0 6px; font-size: 14px; outline: none; }
.auto-pill {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  padding: 5px 9px; border-radius: 8px; background: #e0edff; color: #1d4ed8;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
}
.auto-pill.is-off { background: #f1f5f9; color: var(--muted); }

/* 開關 */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; }
.switch > input { position: absolute; opacity: 0; width: 44px; height: 24px; margin: 0; cursor: pointer; }
.switch .track { position: relative; width: 44px; height: 24px; border-radius: 999px; background: #cbd5e1; transition: background 0.15s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.28); transition: transform 0.15s; }
.switch > input:checked + .track { background: var(--primary); }
.switch > input:checked + .track::after { transform: translateX(20px); }
.switch > input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25); }

/* 送出列：左邊是狀態提示，右邊是動作 */
.submit-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 18px; }
.submit-hint { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.submit-hint .ic { color: var(--primary); }
.submit-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* 結果摘要：一排數字，每格一個圖示 */
.summary-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--border); border-radius: 12px; background: #f8fafc; overflow: hidden;
}
.summary-item { display: flex; align-items: center; gap: 11px; padding: 14px 16px; border-left: 1px solid var(--border); }
.summary-item:first-child { border-left: none; }
/* 超過一列時的框線：原本只有 :first-child 取消左框線，所以第 5 格開始
   會多一條左框、也沒有上框（鍵盤 5 格、滑鼠 10 格才踩到）。 */
.summary-item:nth-child(4n+1) { border-left: none; }
.summary-item:nth-child(n+5) { border-top: 1px solid var(--border); }
/* 補滿最後一列用的空格：只提供框線，沒有內容也不進無障礙樹 */
.summary-item.is-filler { min-height: 0; }
/* 摘要格線後面接別的區塊時要留距離，不然會直接貼上去 */
.summary-grid + * { margin-top: 14px; }
.summary-item .ic { width: 22px; height: 22px; flex: none; }
/* 🔴 標題字不要太小太淡（使用者 2026-09-12 回報「每一格的標題字 太小太淡 看不清」）。
   12px + `--muted` 在白底是 4.78:1 —— 過得了 WCAG AA 的 4.5，
   但**「過門檻」不等於「看得清楚」**，尤其 12px 的中文。
   改成 13px + #475569（7.58:1）+ 半粗；數值仍然靠字級與字重當主角，
   標題只是從「看不清」變成「看得清」，不會搶走數字。 */
.summary-label { display: block; font-size: 13px; color: #475569; font-weight: 600; line-height: 1.4; }
.summary-value { display: block; font-size: 18px; font-weight: 700; line-height: 1.3; }
/* 同一個數字的另一種單位（TB / TiB）*/
.summary-alt { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }

/**
 * 配置摘要條：節點數 × 每節點磁碟｜OSD｜副本｜容錯
 *
 * 用格線而不是 flex-wrap —— flex 折行會排成「3 格 + 1 格」，最後一格獨佔一行，
 * 而且每格寬度不一（使用者 2026-09-04 回報寬度變化時很難看）。格線固定 4 欄／2 欄，
 * 換行點是設計好的。分隔線用 1px gap 加底色做，格子本身不用畫框。
 */
.meta-strip {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px; background: var(--border);
  margin: 14px 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
}
.meta-strip > div {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 16px; font-size: 13.5px; background: #fff;
}
.meta-strip .ic { width: 20px; height: 20px; }
.meta-strip .ic { color: var(--primary); flex: none; }
/* 較長的項目拆成兩行：上面是名目、下面是數字，比讓它自己折行好讀 */
/* 與第一列（.summary-item）同一套排版：上面小標題、下面粗體數值（使用者 2026-09-06） */
.meta-label { display: block; font-size: 12px; color: var(--muted); line-height: 1.4; }
.meta-value { display: block; font-size: 16px; font-weight: 700; line-height: 1.3; }

/* 節點圖：每個節點一張小卡，磁碟是卡片內的號碼格 */
.node-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); }
.node-card {
  border: 1px solid var(--border); border-radius: 12px; background: #fff;
  /* 內距交給裡面的區塊自己給，標題列才鋪得到邊 */
  padding: 0; overflow: hidden;
}
/* 標題列給底色（使用者 2026-09-06：整張卡片都白的，看不出分區）*/
.node-card-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; font-size: 14px; font-weight: 700;
  background: linear-gradient(to bottom, #f7f8fb, #eceff5);
  border-bottom: 1px solid #dfe4ec;
}
.node-card-head .ic { color: var(--primary); flex: none; }
.node-card > .node-sub, .node-card > .disk-grid { margin-left: 12px; margin-right: 12px; }
.node-card > .disk-grid { margin-bottom: 12px; }
.node-raw { margin-left: auto; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.node-sub { font-size: 12.5px; color: var(--muted); margin: 9px 0; }
.disk-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.disk-chip { padding: 4px 0; border: 1px solid #bfdbfe; border-radius: 7px; background: #f5f9ff;
             color: #1d4ed8; font-size: 11.5px; font-weight: 600; text-align: center; }

/* 手機版頂列：桌機用不到（側欄一直在），只在窄螢幕出現 */
.appbar { display: none; }

@media (max-width: 900px) {
  .appbar {
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 40;
    padding: 10px 14px;
    background: linear-gradient(135deg, var(--sidebar-from), var(--sidebar-to));
    color: #fff;
    /* 頂列是 sticky 的，捲動時內容會從它下面經過 —— 沒有陰影就看不出上下層
       關係，看起來像文字直接消失在色塊裡（使用者 2026-09-06）*/
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.18), 0 1px 2px rgba(15, 23, 42, 0.10);
  }
  /* 站名整塊是回首頁的連結，但看起來仍然是標題（不加底線、不變色） */
  .appbar-brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
  .appbar-brand > span { display: block; min-width: 0; }
  .appbar-logo { width: 34px; height: 34px; border-radius: 10px; background: #fff; padding: 4px; object-fit: contain; }
  .appbar-title { display: block; font-size: 15px; font-weight: 700; line-height: 1.2; }
  .appbar-ver { display: block; font-size: 11px; opacity: 0.8; }
  .appbar-actions { margin-left: auto; display: flex; gap: 6px; }
  .appbar-btn {
    width: 34px; height: 34px; border: none; border-radius: 10px; padding: 0;
    background: rgba(255,255,255,0.18); color: #fff; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
  }
  /* 手機上導覽入口固定在頂列右上（使用者 2026-09-06：「選單鈕一律放右上」）。
     左緣的展開標籤只保留給桌機的收折狀態。 */
  .appbar ~ .sidebar-toggle, .sidebar-toggle { display: none; }
  .sidebar-expand { display: none !important; }
  /**
   * 手機的側欄是滑出式抽屜，關掉它靠的是頂列的漢堡鈕或點外面的遮罩 ——
   * 抽屜裡那顆「收合」鈕（«）在這裡沒有作用（`.sidebar-expand` 已經被藏起來，
   * 按下去反而找不到路開回來），而且它佔掉的 34px 正好讓
   * 「IT @ Jason Tools」在 280px 的抽屜裡折成兩行（使用者 2026-09-07 用 iPhone 回報）。
   */
  .sidebar-collapse { display: none; }

  /* 標題在窄螢幕一定會折行；圖示改成靠第一行對齊，字級也縮一階 */
  /* 複製連結改放頂列（使用者 2026-09-06），頁首這顆就不必再佔一行 */
  .page-head-actions { display: none; }
  .page-head { align-items: flex-start; gap: 12px; }
  .page-head-icon { flex: 0 0 42px; width: 42px; height: 42px; border-radius: 12px; }
  .page-head-icon .ic { width: 21px; height: 21px; }
  .page-head h1 { font-size: 19px; }
  .page-head p { font-size: 12.5px; }

  .setup-grid { grid-template-columns: 1fr; }
  /* 手機上標籤欄只剩 108px，稍微長一點的標籤就被折成兩行、還會斷在
     「（X-」和「*）」中間（使用者 2026-09-08 回報）。
     ≤560px 直接改成上下排：標籤一列、控制項一列。 */
  .field-row { grid-template-columns: 108px minmax(0, 1fr); gap: 10px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-item:nth-child(odd) { border-left: none; }
  .summary-item:nth-child(n+3) { border-top: 1px solid var(--border); }
  .meta-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .submit-actions { margin-left: 0; width: 100%; }
  .submit-actions .btn { flex: 1 1 0; justify-content: center; }
  .submit-actions .btn-primary { flex-basis: 100%; }

  /* 卡片標題列在窄螢幕要能換行：不換行的話標題會被擠成一個字一行，
     右邊的按鈕還會凸出卡片外（2026-09-06 手機截圖） */
  .card-head { flex-wrap: wrap; }
  .card-head .card-title { flex: 1 1 auto; min-width: 0; }
  .card-head .spacer { display: none; }
  .card-head > .btn { flex: 1 1 30%; justify-content: center; white-space: nowrap; }

  /* 節點卡在手機上**往下排**：橫向滑動會讓人以為只有兩個節點，
     而且右邊那張永遠被切一半（使用者 2026-09-06 回報） */
  .node-grid { grid-template-columns: 1fr; }
}

/* 流程圖：一格一個階段，中間用箭頭串起來（Ceph 網路計算機的「怎麼算到這個數字」） */
.flow { display: flex; align-items: stretch; gap: 9px; flex-wrap: wrap; margin: 14px 0 4px; }
.flow-box {
  flex: 1 1 160px; min-width: 0; padding: 12px 13px;
  border: 1px solid var(--border); border-radius: 12px; background: #fff;
}
.flow-box.is-load   { background: #faf5ff; border-color: #e9d5ff; }
.flow-box.is-result { background: #eff6ff; border-color: #bfdbfe; }
.flow-title { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; }
.flow-title .ic { color: var(--primary); flex: none; }
.flow-value { font-size: 19px; font-weight: 700; margin-top: 7px; line-height: 1.25; }
.flow-value.is-need { color: var(--primary-dark); }
.flow-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.flow-sub.is-spare { color: var(--success); }
.flow-arrow {
  flex: 0 0 auto; align-self: center;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11.5px; color: var(--muted); white-space: nowrap;
}
.flow-arrow .ic { color: var(--primary); }
.flow-disks { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.flow-disks .disk-chip { flex: 0 0 40px; }

/**
 * 流程圖的折行問題（使用者 2026-09-06 兩次回報「寬度不夠時不好看」）。
 *
 * 四個方塊 + 三個箭頭橫著排大約要 1150px（實測 1094px 就會折行）。原本是用視窗寬度開斷點，但真正
 * 決定排不排得下的是**卡片內的可用寬度** —— 側欄展開／收合、瀏覽器縮放、
 * 側邊視窗都會改變它，用視窗寬度猜一定會有猜錯的時候：畫面 1460px 看起來
 * 很寬，內容區其實只剩 1050px，於是前三格擠一行、第四格自己一行，中間還
 * 吊著一個沒有去處的箭頭。
 *
 * 改用容器查詢，直接問「我這一格有多寬」，就不必再維護一堆斷點，
 * body.sidebar-collapsed 的特例也可以一起拿掉。
 */
.flow-host { container-type: inline-size; }

@media (max-width: 1340px) {
  .meta-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@container (max-width: 940px) {
  /* 直向排列時 flex-basis 會變成「高度」，190px 的基準會把每格撐成一大塊空白 */
  .flow { flex-direction: column; }
  .flow-box { flex: 0 0 auto; }
  .flow-arrow { flex-direction: row; gap: 6px; }
  .flow-arrow .ic { transform: rotate(90deg); }

  /* 直向時方塊改成一行式（標題｜數值｜說明），不然整寬的方塊裡都是空白 */
  .flow-box { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
  .flow-title { flex: 0 0 auto; }
  .flow-value { margin-top: 0; font-size: 17px; }
  .flow-sub { margin-top: 0; margin-left: auto; }
  .flow-disks { flex: 1 1 100%; order: 3; margin-top: 4px; }
}

/* 不支援容器查詢的舊瀏覽器：退回用視窗寬度判斷 */
@supports not (container-type: inline-size) {
  @media (max-width: 1340px) {
    .flow { flex-direction: column; }
    .flow-box { flex: 0 0 auto; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
    .flow-arrow { flex-direction: row; gap: 6px; }
    .flow-arrow .ic { transform: rotate(90deg); }
    .flow-title { flex: 0 0 auto; }
    .flow-value { margin-top: 0; font-size: 17px; }
    .flow-sub { margin-top: 0; margin-left: auto; }
    .flow-disks { flex: 1 1 100%; order: 3; margin-top: 4px; }
  }
}

/* ══════════════════════════════════════════════════════════════════════
   分析型工具的共用元件（2026-09-06 設計師範本）

   Email Header 分析先用，之後的「輸入 → 輸出」類工具（base64、url、
   email-subject…）也吃同一套。RWD 一併在這裡處理，頁面不必各自寫。
   ══════════════════════════════════════════════════════════════════════ */

/* 評分環：用 conic-gradient 畫，不必載圖表函式庫 */
.score-ring {
  --score: 0;
  --ring: var(--success);
  position: relative; flex: 0 0 132px; width: 132px; height: 132px; border-radius: 50%;
  background: conic-gradient(var(--ring) calc(var(--score) * 1%), #e8ecf2 0);
  display: flex; align-items: center; justify-content: center;
}
.score-ring::before {
  content: ''; position: absolute; inset: 11px; border-radius: 50%; background: #fff;
}
.score-ring-in { position: relative; text-align: center; line-height: 1.15; }
.score-ring-label { font-size: 11.5px; color: var(--muted); }
.score-ring-value { font-size: 30px; font-weight: 800; color: var(--text); }
.score-ring-tag {
  display: inline-block; margin-top: 3px; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; background: #dcfce7; color: #15803d;
}
.score-ring-tag.is-warn { background: #fef3c7; color: #b45309; }
.score-ring-tag.is-err  { background: #fee2e2; color: #b91c1c; }

/* 檢查結果卡：圖示磚 + 名稱 + 徽章 + 一行說明 */
.check-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.check-card { border: 1px solid var(--border); border-radius: 12px; padding: 13px 14px; background: #fff;
              min-width: 0; overflow-wrap: anywhere; }
/* 允許折行：DMARC 那一張同時有「pass」與「推算」兩顆徽章，
   四欄版面下卡片只有兩百多 px，不折行的話第二顆會被擠出卡片外
   （使用者 2026-09-08 回報）。 */
.check-card-top { display: flex; align-items: center; gap: 9px 8px; flex-wrap: wrap; }
.check-card-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.check-card-tile {
  flex: 0 0 30px; width: 30px; height: 30px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
}
.check-card-name { font-size: 14.5px; font-weight: 700; }
/* 只有**第一顆**徽章推到右邊。兩顆都給 margin-left:auto 的話，
   剩餘空間會被**平分**，第二顆（「推算」那種註記）就被頂到卡片最右緣
   （使用者 2026-09-08 回報）。這正是 check-visual 第 3 條規則講的情況。 */
.check-card .badge { margin-left: auto; flex: none; white-space: nowrap; }
/* 折行之後第二顆會落到新的一行，這時 margin-left:auto 會把它推到最右邊 —— 那是對的 */
.check-card .badge ~ .badge { margin-left: 6px; }
/* 🔴 `overflow-wrap: anywhere` 不是保險起見加的：說明裡會出現
   `apc01-pu1-obe.outbound.protection.outlook.com` 這種**沒有空白可斷**的
   長網域，而這一排是固定寬的格線 —— 不給斷點的話那一段會直接壓過卡片右緣
   （使用者 2026-09-10 回報）。`min-width: 0` 是給 flex/grid 子項解除
   min-content 下限用的，缺了它 anywhere 也救不回來。 */
.check-card-desc { font-size: 12.5px; color: var(--muted); margin-top: 7px; line-height: 1.5;
                   min-width: 0; overflow-wrap: anywhere; }
.check-card.is-pass .check-card-tile { background: linear-gradient(135deg, #4ade80, #16a34a); }
.check-card.is-warn .check-card-tile { background: linear-gradient(135deg, #fbbf24, #d97706); }
.check-card.is-fail .check-card-tile { background: linear-gradient(135deg, #f87171, #dc2626); }
.check-card.is-none .check-card-tile { background: linear-gradient(135deg, #cbd5e1, #94a3b8); }

/* 名稱 → 值 清單（郵件基本資訊、路由與來源） */
.kv-list { display: grid; gap: 2px; }
.kv-row {
  display: grid; grid-template-columns: 22px minmax(76px, max-content) minmax(0, 1fr);
  /* 值換行時整列變高，置中的話圖示與標籤會掉到中間、跟第一行對不齊
     （使用者 2026-09-06）。改成一律靠上，再用微調對齊第一行文字。 */
  align-items: start; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f1f5f9;
}
.kv-row:last-child { border-bottom: none; }
.kv-row .ic { color: var(--primary); align-self: start; margin-top: 1px; }
.kv-row > .kv-key { line-height: 1.5; }
.kv-row > .kv-val { line-height: 1.5; }
.kv-key { font-size: 13px; color: var(--muted); }
.kv-val { font-size: 13.5px; overflow-wrap: anywhere; }
.kv-val.is-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* 傳遞路徑：一站一列，帶時間軸 */
/**
 * 傳遞路徑：站與站之間要有流向箭頭。
 *
 * 一列一站疊在一起，看不出誰流向誰（使用者 2026-09-07）。用偽元素在間隙裡
 * 畫「短線 + 向下三角」，不動任何標記，也不會被螢幕閱讀器念到（content: ''）。
 * 箭頭對齊左側編號徽章的中線：.hop 左內距 13px + 徽章半徑 12px = 25px。
 */
.hop-list { display: grid; gap: 26px; }
.hop { position: relative; }
.hop:not(:last-child)::before {
  content: ''; position: absolute; left: 24px; bottom: -17px;
  width: 2px; height: 9px; background: #cbd5e1;
}
.hop:not(:last-child)::after {
  content: ''; position: absolute; left: 20px; bottom: -24px;
  width: 0; height: 0;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 7px solid #94a3b8;
}
.hop {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 11px;
  align-items: start; padding: 11px 13px;
  border: 1px solid var(--border); border-radius: 11px; background: #fff;
}
.hop-no {
  width: 24px; height: 24px; border-radius: 50%; background: #eff6ff; color: var(--primary-dark);
  font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.hop-main { min-width: 0; }
.hop-host { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.hop-meta { font-size: 12px; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.hop-side { text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; }
.hop-delay { font-weight: 700; color: var(--text); }
.hop-delay.is-skew { color: var(--warning); }
.hop.is-insecure { border-color: #fecaca; background: #fef8f8; }

/* 分段選擇（設計圖的「編碼方式／字元編碼」）*/
/**
 * 分段按鈕。
 *
 * ⚠️ **會折行**（窄畫面、選項多的時候），所以每一顆都要有上框線與左框線，
 * 再用 -1px 的負邊界把它們收進容器的框線裡（`overflow: hidden` 會把
 * 第一列的上框線與第一欄的左框線裁掉）。
 * 原本只給 `border-left` 且 `:first-child` 拿掉 —— 折行之後第二列的第一顆
 * 沒有上框線、第一列的最後一顆右邊空著，看起來就是「框線沒畫好」
 * （使用者 2026-09-08 在手機上回報「儲存型態」那一組）。
 */
.seg { display: inline-flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg > button {
  border: none; background: #fff; color: var(--text);
  padding: 9px 16px; font-size: 13.5px; font-family: inherit; cursor: pointer;
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  margin: -1px 0 0 -1px;
  /* 🔴 分段按鈕的字不可以在**詞中間**斷行 —— 中文預設哪裡都能斷，
     「包含」就被拆成兩行「包／含」（2026-09-09 在 Zimbra 看到的）。
     ⚠️ 用 `nowrap` 太強：手機上三顆一列時，「掃頻 200–8000 Hz」這種長標籤
     會整個凸出卡片（喇叭測試實測）。`keep-all` 才對 —— 中文詞不拆，
     但空白與標點處照樣可以換行。 */
  word-break: keep-all;
  /* 🔴 折行時最後一列要長大填滿，不然右邊會空一截、看起來像框線少畫了一段
     （使用者 2026-09-09 在倒數看板的「主題」與「數字動畫」回報）。
     `flex-grow` 只有在**那一列有剩餘空間**時才生效 —— 不折行的分段按鈕
     容器寬度剛好等於內容，沒有空間可以分，外觀完全不受影響。
     ⚠️ 手機斷點另有 `flex: 1 1 33.333%` 的等分規則，那個更強、照舊。 */
  flex: 1 1 auto;
}
/* 🔴 分段按鈕只佔它需要的寬度。
   `.seg` 本身是 inline-flex，但它幾乎都住在 `.field-row` 的第二欄（grid）
   或 `.field-stack`／各頁自己的 flex 欄裡 —— 那兩種容器的預設對齊都是
   **stretch**，於是按鈕右邊拖著一大塊空的外框，最後一顆的圓角掉在整列
   最右邊，看起來像框線畫太長（使用者 2026-09-09：「如果按鈕沒有那麼多，
   不要直接把寬度拉最右邊滿 很奇怪」）。實測全站 56 個 `.seg` 有 22 個是這樣。
   ⚠️ 手機斷點刻意讓 `.seg` 滿版分格（見下面的 @media，那裡有明確的
   `width: 100%`），不受這條影響。 */
.seg { align-self: start; justify-self: start; max-width: 100%; }
/* `.field-row` 那一列是垂直置中的，只有水平方向要收窄 */
.field-row > .seg { align-self: center; }
.seg > button.is-on { background: var(--primary); color: #fff; font-weight: 600; }
.seg > button:not(.is-on):hover { background: #f1f5f9; }

/* 左右雙欄的輸入／輸出（設計圖的「主旨轉換」）*/
.io-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.io-panel { border: 1px solid var(--border); border-radius: 12px; background: #fff; overflow: hidden; }
.io-head {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 9px 12px; background: linear-gradient(to bottom, #f7f8fb, #eceff5);
  border-bottom: 1px solid var(--border); font-size: 13.5px; font-weight: 600;
}
.io-head .spacer { margin-left: auto; }
.io-body { padding: 10px 12px; }
.io-body textarea { width: 100%; border: none; outline: none; resize: vertical; min-height: 132px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

@media (max-width: 900px) {
  .io-grid { grid-template-columns: 1fr; }
  .score-ring { flex-basis: 108px; width: 108px; height: 108px; }
  .score-ring-value { font-size: 25px; }
  .kv-row { grid-template-columns: 22px minmax(0, 1fr); }
  .kv-row .kv-val { grid-column: 2 / -1; }
  .hop { grid-template-columns: 26px minmax(0, 1fr); }
  .hop-side { grid-column: 2 / -1; text-align: left; margin-top: 4px; }
  /* 折行時 flex 依內容分配寬度，每一格長短不一（「每分鐘」比「每天」寬）。
     改用格線平均分配，折成兩排也還是整齊的兩排（使用者 2026-09-06 手機截圖）。 */
  /* 一列三欄，而且**最後一列要自己填滿**。
     用格線的話，選項數不是 3 的倍數時最後一列右邊會空一截、沒有格子，
     看起來就是「框線少畫了一段」（使用者 2026-09-08 回報「儲存型態」）。
     改用 flex + 33.33% 的基準寬：前三顆剛好一列，落單的那顆會長大填滿整列。 */
  .seg { width: 100%; display: flex; flex-wrap: wrap; }
  .seg > button {
    justify-content: center;
    flex: 1 1 33.333%; min-width: 0;
    border-left: 1px solid var(--border); border-top: 1px solid var(--border);
  }
  .seg > button:nth-child(3n + 1) { border-left: none; }
  .seg > button:nth-child(-n + 3) { border-top: none; }
}
/* 3 欄放得下就維持 3 欄（6 個選項剛好兩排）；再窄才降成 2 欄 */
@media (max-width: 370px) {
  .seg > button { flex-basis: 50%; }
  .seg > button:nth-child(3n + 1) { border-left: 1px solid var(--border); }
  .seg > button:nth-child(-n + 3) { border-top: 1px solid var(--border); }
  .seg > button:nth-child(odd) { border-left: none; }
  .seg > button:nth-child(-n + 2) { border-top: none; }
}

/* ── 說明區的圖卡（Email Header 分析的「分析與驗證說明」範本）───────── */

/* 淡底色的功能小卡：圖示磚 + 標題 + 一行說明 */
/* 🔴 欄位下限從 240px 提到 300px。
   240px 在 1100px 的內容寬會排成 4 欄，而說明卡的標題常常是一整句話
   （「一般信件裡的錯誤碼不算結果」「證據程度分三種，沒有百分比」）——
   4 欄之下那種標題會折成三行，卡片高度參差不齊。使用者的說法是
   「每個說明項目標題字太多 如果要那麼多 欄位數要更少」（2026-09-10）。
   300px → 同樣寬度排 3 欄，標題大多一到兩行。 */
.doc-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
/* 🔴 **沒有色彩變體時也要看得出來是一張卡**（使用者 2026-09-10 回報
   「這頁的說明少了框」，退信分析器與通訊錄轉換器並排一看就分得出來）。

   舊值是 `border: 1px solid transparent` + 沒有底色 —— 卡片只有在
   加了 `t-blue` 這類變體時才長出外觀，忘了加就完全隱形。
   全站有 **4 頁 31 張**是裸的 `.doc-card`（csp-designer、ip-subnet-calculator、
   mail-bounce-analyzer、security-headers）。

   ⚠️ 這跟 2026-09-09 的 `t-plain` 是同一家族（那次是「變體名稱有人用但從來沒定義」），
      也是 2026-09-10 記過的那句話：**預設要站在常見的那一邊**，
      不要靠例外清單補 —— 例外清單永遠列不完，使用者就得一頁一頁幫我們找。
   ⚠️ 用中性灰而不是隨便挑一個顏色：有變體的頁面不受影響（變體會蓋過去），
      沒變體的頁面得到一張「安靜但看得見」的卡。 */
.doc-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 12px;
            background: #f8fafc; border: 1px solid #e2e8f0; }
.doc-card-tile {
  flex: 0 0 38px; width: 38px; height: 38px; border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
}
.doc-card-tile .ic { width: 19px; height: 19px; }
.doc-card-title { display: block; font-size: 14.5px; font-weight: 700; }
.doc-card-desc { display: block; font-size: 12.5px; color: var(--muted); margin-top: 4px; line-height: 1.55; }
.doc-card.t-blue   { background: #eff6ff; border-color: #dbeafe; }
.doc-card.t-blue   .doc-card-tile { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.doc-card.t-cyan   { background: #ecfeff; border-color: #cffafe; }
.doc-card.t-cyan   .doc-card-tile { background: linear-gradient(135deg, #22d3ee, #0891b2); }
.doc-card.t-violet { background: #f5f3ff; border-color: #ede9fe; }
.doc-card.t-violet .doc-card-tile { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.doc-card.t-amber  { background: #fffbeb; border-color: #fde68a; }
.doc-card.t-amber  .doc-card-tile { background: linear-gradient(135deg, #fbbf24, #d97706); }
.doc-card.t-green  { background: #f0fdf4; border-color: #bbf7d0; }
.doc-card.t-green  .doc-card-tile { background: linear-gradient(135deg, #4ade80, #16a34a); }
.doc-card.t-rose   { background: #fff1f2; border-color: #fecdd3; }
.doc-card.t-rose   .doc-card-tile { background: linear-gradient(135deg, #fb7185, #e11d48); }
/* 🔴 中性色的說明卡。`t-plain` 這個名字有四支工具在用
   （json-format、ldap-filter、pve-report-viewer、zimbra-search），
   但 `.doc-card.t-plain` **從來沒有定義過** —— 底色與邊框是透明的、
   色磚沒有背景，於是同一排裡那一張看起來像少畫了一塊
   （使用者 2026-09-09 在 Zimbra 那一頁回報「這幾張卡片 怪怪的」）。
   ⚠️ 跟 `.doc-card.is-plain` 不是同一件事：那個是 SPF／DKIM／DMARC
   那一排用的白底直式版型，會改 flex 方向。 */
.doc-card.t-plain  { background: #f8fafc; border-color: #e2e8f0; }
.doc-card.t-plain  .doc-card-tile { background: linear-gradient(135deg, #94a3b8, #475569); }

/* 白底的說明卡（SPF / DKIM / DMARC 那一排） */
.doc-card.is-plain { background: #fff; border-color: var(--border); flex-direction: column; gap: 9px; }
.doc-card.is-plain .doc-card-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.doc-link { font-size: 12.5px; color: var(--primary); text-decoration: none; font-weight: 600; }
.doc-link:hover { text-decoration: underline; }

/* 狀態圖例：通過／失敗／中性／未知 */
.legend-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-top: 12px; }
.legend-item { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 11px; background: #f8fafc; border: 1px solid var(--border); }
.legend-item .ic { flex: none; }
.legend-name { display: block; font-size: 13.5px; font-weight: 700; }
.legend-desc { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.legend-item.is-pass { background: #f0fdf4; border-color: #bbf7d0; } .legend-item.is-pass .ic, .legend-item.is-pass .legend-name { color: #16a34a; }
.legend-item.is-fail { background: #fef2f2; border-color: #fecaca; } .legend-item.is-fail .ic, .legend-item.is-fail .legend-name { color: #dc2626; }
.legend-item.is-warn { background: #fffbeb; border-color: #fde68a; } .legend-item.is-warn .ic, .legend-item.is-warn .legend-name { color: #b45309; }
.legend-item.is-none .ic, .legend-item.is-none .legend-name { color: var(--muted); }

/* 流程步驟（郵件處理流程）*/
.step-flow { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.step {
  flex: 1 1 150px; min-width: 0; position: relative;
  padding: 14px 12px 20px; border-radius: 12px; text-align: center;
  border: 1px solid var(--border); background: #fff;
}
.step .ic { color: var(--primary); }
.step-name { font-size: 13.5px; font-weight: 700; margin-top: 6px; }
.step-desc { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
/* 步驟編號原本 22px 圓 / 11px 字，太小看不清（使用者 2026-09-07）。
   11px 也低於手機掃描的 12px 下限，但 1–5 是**單字元**所以規則沒抓到 ——
   跟側欄分類徽章同一類漏網。`bottom` 是圓的半徑，放大要一起跟。 */
.step-no {
  position: absolute; left: 50%; bottom: -13px; transform: translateX(-50%);
  width: 26px; height: 26px; border-radius: 50%; background: #dcfce7; color: #15803d;
  font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.step-arrow { align-self: center; color: var(--primary); flex: none; }
.step.t-blue   { background: #eff6ff; border-color: #dbeafe; }
.step.t-green  { background: #f0fdf4; border-color: #bbf7d0; }
.step.t-rose   { background: #fff1f2; border-color: #fecdd3; }
.step.t-violet { background: #f5f3ff; border-color: #ede9fe; }
.step.t-cyan   { background: #ecfeff; border-color: #cffafe; }

/**
 * 五個步驟橫排至少要 ~900px。側欄佔掉 300px 之後，視窗 1250px 以下就會折成
 * 「3 格 + 吊一個箭頭 + 2 格」，而且兩行的格子寬度還不一樣（使用者 2026-09-06）。
 * 提早改成直向，並把每一格壓成一行式，才不會拉得很長。
 */
@media (max-width: 1250px) {
  .step-flow { flex-direction: column; }
  .step-arrow { transform: rotate(90deg); align-self: center; }
  /* 直向時 flex-basis 會變成「高度」，150px 的基準會把每一格撐成一大塊 */
  .step {
    flex: 0 0 auto;
    display: flex; align-items: center; gap: 11px; text-align: left;
    padding: 11px 14px 11px 12px;
  }
  .step-name { margin-top: 0; flex: 0 0 auto; }
  .step-desc { margin-top: 0; margin-left: auto; text-align: right; }
  .step-no { position: static; transform: none; margin-left: 8px; }
}

/**
 * 手機再窄一點，說明就一行放不下了 —— 靠右對齊的兩行字會排成
 * 「上傳或貼上 CSV／」換行「JSON／TSV」，右緣對齊、左緣參差，很難看。
 * 這個寬度改成說明自成一列，跟名稱切齊在圖示右邊。
 */
@media (max-width: 560px) {
  .step { flex-wrap: wrap; }
  .step-no { order: 2; margin-left: auto; }
  .step-desc { order: 3; flex: 1 1 100%; margin-left: 31px; text-align: left; }

  /**
   * 欄位列改成標籤在上、控制項在下。
   *
   * 390px 的畫面扣掉側邊留白只剩約 300px，標籤欄佔掉 108px 之後，
   * 「AUTO 自動建議」那顆徽章一放進去，輸入框只剩五十幾 px ——
   * 預設文字被切成一個殘缺的字（Ceph 容量計算機兩個欄位都是這樣）。
   */
  .field-row { grid-template-columns: minmax(0, 1fr); gap: 6px; align-items: stretch; }
  .field-row > label { line-height: 1.3; }
}

/* ── 分頁切換（設計圖的「文字轉換／檔案轉換」）───────────────────────── */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs > button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  font-size: 14.5px; font-weight: 600; font-family: inherit;
}
.tabs > button:hover { background: #f8fafc; }
.tabs > button.is-on { background: var(--primary); border-color: var(--primary); color: #fff; }
.tabs > button.is-on .ic { color: #fff; }
.tabs > button .ic { color: var(--primary); }

/* 設定列：標籤 + 分段選擇 + 其他控制項擠在同一行 */
.setting-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: #f8fafc;
}
.setting-bar .field-name { font-size: 13.5px; font-weight: 600; }
.setting-bar .sep { width: 1px; align-self: stretch; background: var(--border); }
.setting-bar .push { margin-left: auto; }

/* 輸入／輸出面板右下角的計數 */
.io-count { font-size: 11.5px; color: var(--muted); text-align: right; padding: 0 12px 8px; }

@media (max-width: 900px) {
  .tabs > button { flex: 1 1 auto; justify-content: center; }
  .setting-bar { gap: 10px; }
  .setting-bar .sep { display: none; }
  .setting-bar .push { margin-left: 0; }
}

/* ── 步驟卡的編號徽章、拖曳區、檔案列（編碼轉換器等）──────────────── */
.step-badge {
  flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 14px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 26px 18px; border: 2px dashed var(--border); border-radius: 12px;
  background: #f8fafc; text-align: center; color: var(--muted);
}
.dropzone.is-over { border-color: var(--primary); background: #eff6ff; }
.dropzone .ic { color: var(--primary); }
/* 按鈕裡的圖示要跟著按鈕的文字色，不然藍圖示會消失在藍底按鈕上 */
.dropzone .btn .ic { color: inherit; }
.dropzone-title { font-size: 14.5px; font-weight: 600; color: var(--text); }
.dropzone-sub { font-size: 12.5px; }
.file-chip {
  display: flex; align-items: center; gap: 10px; margin-top: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px; background: #fff;
}
.file-chip .ic { color: var(--primary); }
.file-chip-name { font-size: 13.5px; font-weight: 600; }
.file-chip-size { margin-left: auto; font-size: 12.5px; color: var(--muted); }

/* 來源 → 目標 */
.convert-row { display: flex; align-items: stretch; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.convert-box { flex: 1 1 240px; padding: 13px 15px; border: 1px solid var(--border); border-radius: 12px; background: #f8fafc; }
.convert-box.is-target { background: #f0fdf4; border-color: #bbf7d0; }
.convert-label { font-size: 12px; color: var(--muted); }
.convert-value { font-size: 15.5px; font-weight: 700; margin-top: 3px; }
.convert-arrow { align-self: center; color: var(--primary); }

/* 行預覽 */
.line-view {
  border: 1px solid var(--border); border-radius: 11px; background: #fff;
  max-height: 340px; overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
}
.line-row { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 10px; padding: 3px 12px; }
.line-row:nth-child(odd) { background: #fafbfc; }
.line-no { color: var(--muted); text-align: right; user-select: none; }
.line-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.line-eol { font-size: 10px; color: #1d4ed8; background: #eff6ff; border-radius: 5px; padding: 0 5px; align-self: center; }
.line-eol.is-crlf { color: #b45309; background: #fffbeb; }

@media (max-width: 900px) {
  .convert-arrow { transform: rotate(90deg); align-self: center; }
  .line-row { grid-template-columns: 40px minmax(0, 1fr) auto; }
}

/* 舊樣式層（.info-section li 等）排在後面，會把新版清單的行距加回去。
   這一條放在最末尾收尾，確保 .feature-list 的行距由 gap 決定。 */
.feature-list > li { margin-bottom: 0; }

/* ── 說明區樣板（設計者 2026-09-06 的 XML 頁範本）─────────────────────
 *
 * 每一頁下方的說明區統一長這樣：可收合的 details.card，標題列是
 * 「色磚圖示 + 標題 + 副標 + 右側數量徽章 + 收合箭頭」，內容是一格格的說明小卡。
 * summary 的底色標題列由上面 details.card > summary:first-child 那條負責。
 */
details.card > summary.doc-summary { align-items: center; gap: 11px; padding-top: 10px; padding-bottom: 10px; }
.doc-summary .doc-summary-tile {
  flex: 0 0 34px; width: 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(135deg, #60a5fa, #2563eb);
}
.doc-summary .doc-summary-tile .ic { width: 18px; height: 18px; }
/* 🔴 收合卡片的標題磚要跟一般卡片標題一樣大。
   上面那條 30px 的選擇器是 `.card-head .tile`，而 `details` 的標題列是
   `summary.doc-summary`，**不在 `.card-head` 裡** —— 於是收合卡片一路
   用 `.card-head-icon` 的 38px，跟旁邊的卡片差一圈。
   Zimbra 搜尋語法那一頁的「更多條件」夾在兩張一般卡片中間，差異最明顯
   （使用者 2026-09-09 回報「更多條件的 icon 怎那麼大」）。 */
.doc-summary .tile { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 9px; }
.doc-summary .tile .ic { width: 16px; height: 16px; }
.doc-summary-text { min-width: 0; }
/* 說明搬進卡片內容之後，接在 summary 後面的第一段要有上緣間距 */
details.card > summary + .card-hint { margin-top: 12px; }
.doc-summary-title { display: block; font-size: 15.5px; font-weight: 700; color: #1e293b; line-height: 1.3; }
/* `.doc-summary-sub` 已於 2026-09-09 全面移除（使用者：「卡片標題只要一行，
   說明放卡片內」）。規則留一行空殼會讓人以為還能用，直接刪掉；
   說明改用卡片內容區的 `.card-hint`。 */
/**
 * 數量徽章靠右。
 *
 * ⚠️ 收合箭頭 `details.card > summary::after` **也有 `margin-left: auto`**，
 * 而兩個 auto 邊界會把剩餘空間**平分** —— 徽章因此停在標題列中間
 * （使用者 2026-09-07 回報「統計數字怎麼在中間怪怪位置」）。
 * 有徽章時就讓徽章獨佔那段空白，箭頭跟在後面。
 * （原本這裡註解寫「箭頭是絕對定位」，那是錯的，它是 flex 項目。）
 */
.doc-summary .count-pill { margin-left: auto; }
.doc-summary:has(.count-pill)::after { margin-left: 0; }
.count-pill {
  flex: none; padding: 4px 11px; border-radius: 999px;
  background: #e0edff; color: var(--primary-dark);
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}

/* 說明小卡裡的語法範例小方塊 */
.doc-card-code {
  display: inline-block; margin-top: 8px; padding: 5px 10px;
  background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; color: #334155;
  /* break-all 會把 iodepth=32 從中間切開，只能斷在空白處 */
  word-break: normal; overflow-wrap: break-word;
}
/* 白底、左邊是打勾圓圈的變體（設計圖的「支援的 XML 特性」）*/
.doc-card.is-check { background: #fff; border-color: var(--border); }
.doc-card.is-check .doc-card-tile { border-radius: 50%; }

/* 說明區最後一行的提醒：左邊圖示 + 文字，右邊一顆狀態徽章 */
/**
 * 說明區最下面那一行「依據：…」。
 *
 * 🔴 這裡原本只有 `align-items: center` —— 那是給「文字 + 綠色徽章」那種
 * flex 版寫的，套在單純的 `<p class="doc-note">` 上**完全沒有作用**，
 * 於是那段出處說明就是一段沒有樣式的黑字（使用者 2026-09-10 回報
 * 「最下面的依據：說明文字 沒有樣式 不好看」）。
 * 現在不論哪一種寫法都有外觀：上緣一條分隔線、淺色小字，
 * 看得出來是註腳而不是正文。
 */
.doc-note {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--border);
  font-size: 12.5px; line-height: 1.7; color: var(--muted);
}
.doc-note .doc-note-text { flex: 1 1 auto; min-width: 0; }
.doc-note .pill-ok {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; background: #dcfce7; color: #15803d;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.doc-note .pill-ok .ic { color: #15803d; width: 15px; height: 15px; }

@media (max-width: 700px) {
  .doc-summary .count-pill { margin-right: 22px; }
  .doc-note { flex-wrap: wrap; }
}

/* ── 純 CSS 長條圖（FIO 分析的各 Job／延遲分佈）───────────────────────
 * 不載圖表函式庫：右邊是等寬的軌道，長度用百分比，數值寫在條子右邊。
 */
.bar-chart { display: grid; grid-template-columns: minmax(84px, max-content) 1fr minmax(76px, max-content); gap: 7px 12px; align-items: center; }
.bar-row { display: contents; }
.bar-label { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { display: block; height: 20px; border-radius: 6px; background: #eef1f6; overflow: hidden; }
/* 條子是 <span>，不宣告 block 的話 height:100% 對行內元素無效，整條會是空的 */
.bar-fill { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #60a5fa, #2563eb); min-width: 2px; }
.bar-fill.t-green  { background: linear-gradient(90deg, #4ade80, #16a34a); }
.bar-fill.t-amber  { background: linear-gradient(90deg, #fbbf24, #d97706); }
.bar-fill.t-rose   { background: linear-gradient(90deg, #fb7185, #e11d48); }
.bar-fill.t-violet { background: linear-gradient(90deg, #a78bfa, #7c3aed); }
.bar-value { font-size: 13px; font-weight: 700; text-align: right; white-space: nowrap;
  font-variant-numeric: tabular-nums; }
@media (max-width: 700px) {
  .bar-chart { grid-template-columns: minmax(66px, max-content) 1fr minmax(64px, max-content); gap: 6px 8px; }
  .bar-label, .bar-value { font-size: 12px; }
}

/* 區塊沒有內容時的提示文字 */
.empty-hint { font-size: 13px; color: var(--muted); padding: 10px 2px; }

/* 六格的條件列排四欄會多出兩個空格（右邊那個是灰的），改排三欄剛好兩列 */
.meta-strip.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .meta-strip.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── 自訂下拉選單 ─────────────────────────────────────────────────────
 *
 * 使用者要求（2026-09-06）：全站不用瀏覽器原生的下拉，一律用站台自己的樣式。
 * 原生 <select> 的選單是作業系統畫的，Windows／macOS／Linux 各長一個樣，
 * 字級與圓角都跟不上這一套設計，深色底的頁面上尤其突兀。
 *
 * 做法（實作在 js/layout.js 的 enhanceSelects）：<select> 留在 DOM 裡當唯一的
 * 資料來源（既有程式碼讀 .value、掛 onchange 都照舊），只是視覺上藏起來，
 * 由一顆按鈕負責顯示、一個掛在 body 上的浮層負責展開。浮層放 body 是因為
 * 卡片有 overflow 與 z-index，放在原地會被切掉。
 */
.jt-select { position: relative; display: inline-flex; width: 100%; }
.jt-select > select.jt-select-native {
  /* 不能用 display:none —— 表單驗證與 label 的 for 都還要靠它 */
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; pointer-events: none; border: 0; padding: 0; margin: 0;
}
.jt-select-btn {
  display: inline-flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 12px; padding-right: 34px; position: relative;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
  color: var(--text); font-family: inherit; font-size: 14px; line-height: 1.35;
  text-align: left; cursor: pointer;
  /* 🔴 預設跟 `.btn` 一樣高（38px）。
     42px 是為了跟 `.field-row` 的輸入框對齊而定的，但下拉出現在**按鈕列**的
     機會一樣多 —— SQL、YAML、Markdown 三頁都被回報過「下拉清單高度不一」。
     把 42px 收回去只給欄位列，按鈕列就不必逐頁補 CSS
     （跟 `.card-hint` 的 -2px 同一個教訓：預設要站在常見的那一邊）。 */
  /* ⚠️ 用 height 不是 min-height —— `min-height` 擋不住內距把它撐高
     （10px + 10px + 行高 ≈ 41px，還是跟 38px 的按鈕差 3px）。 */
  height: 38px; padding-top: 0; padding-bottom: 0;
}
/* 欄位列與欄位堆疊：旁邊是 42px 的輸入框，下拉要跟著 42px */
.field-row > .jt-select > .jt-select-btn,
.field-stack > .jt-select > .jt-select-btn,
.input-unit > .jt-select > .jt-select-btn { height: 42px; }
/* 🔴 小按鈕（31px）貼在下拉旁邊時跟著下拉走。
   `.btn-small` 的 31px 是給表格「動作」欄那種密集列用的，接在 38px 的下拉旁邊
   會矮一截（通訊錄工具列、麥克風與攝影機的「重新整理裝置」都是這一種）。
   用 `:has()` 判斷「同一個容器裡同時有下拉與按鈕」，不必逐頁補 CSS。 */
:is(span, div):not(.input-unit):has(> .jt-select):has(> .btn-small) > .btn-small { height: 38px; }
/* 🔴 `.input-unit` 要排除掉。它自己就是 42px 高、flex 預設 stretch，裡面的控制項
   本來就會撐滿（測試檔案產生器的「輸入框 + 按鈕」就是 42/42）；但上面那條
   把小按鈕釘在 38px，於是 LibreNMS 的「下拉 + 加入」變成 42/38，接縫矮一截
   —— 使用者 2026-09-14 回報「右邊加入按鈕的左邊也怪」，那 4px 就是其中一半。
   `.input-unit` 是接成一體的控制項，不是按鈕列。 */
/* ⚠️ 2026-09-09 試過把它放寬成 `:has(> * > .jt-select)`（讓下拉可以包在
   自己的小容器裡），結果**更糟**：Markdown 工具列裡有些按鈕本身也包了一層
   （split button），於是同一列變成 38／38／31／38／38／31 —— 比原本
   一致的 31 還亂。這件事要用明確的工具列類別做，不要靠 `:has()` 猜。
   詳見 §9 的排隊項目。 */
.jt-select-btn:hover { background: #f8fafc; }
.jt-select-btn:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.22); }
.jt-select-btn[disabled] { background: #f8fafc; color: var(--muted); cursor: not-allowed; }
.jt-select-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jt-select-caret {
  position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none; transition: transform 0.15s;
}
.jt-select.is-open .jt-select-caret { transform: translateY(-50%) rotate(180deg); }
.jt-select.is-open .jt-select-btn { border-color: var(--primary); }

/* 接在輸入框右邊的單位選擇（.input-unit > .unit-select）要保留接合的直角 */
.input-unit > .jt-select { flex: 0 0 auto; width: auto; }
/* ⚠️ 上面那條是給「接在輸入框右邊的**單位**選擇」用的 —— 它本來就該貼著內容。
   但有些地方下拉才是**主控制項**、右邊接一顆按鈕（LibreNMS 的「加入應用程式」）。
   那時候下拉要能縮，不然窄畫面下按鈕會被擠出卡片外
   （2026-09-13 `test:layout` 在 390px 抓到）。
   🔴 用明確的修飾類別讓頁面自己宣告，**不要用 :has() 猜**是哪一種
   （`.toolbar-row` 那次的教訓，CLAUDE.md 2026-09-10）。 */
.input-unit.is-grow > .jt-select { flex: 1 1 auto; min-width: 0; width: auto; }
.input-unit.is-grow > .jt-select > .jt-select-btn { width: 100%; }
/* 🔴 **位置規則要往內傳一層。**
   `.jt-select` 的外框其實畫在裡面那顆 `.jt-select-btn` 上，而 `.input-unit`
   的圓角與接合規則（`> :first-child` / `> :last-child`）是寫給**直接子元素**的
   —— 隔了一層就全部搆不到。舊版直接把「右圓角 + 沒有左框線」寫死在
   `.jt-select-btn` 上，那是假設下拉一定是**接在輸入框右邊的單位選擇**；
   下拉自己是主控制項、右邊接一顆按鈕時（LibreNMS 的「加入應用程式」）就長反了
   —— 使用者 2026-09-14 回報「下拉清單左邊沒框線，右邊加入按鈕的左邊也怪」。
   ⚠️ 這是站台記過很多次的同一個形狀：**共用選擇器搆不到另一種寫法**
   （`summary.doc-summary` 搆不到 `.card-head`、`.card-head .tile` 搆不到
   `details` 的標題列）。修在這裡，不要逐頁補覆寫。 */
.input-unit > .jt-select > .jt-select-btn { border-radius: 0; white-space: nowrap; }
.input-unit > .jt-select:first-child > .jt-select-btn {
  border-top-left-radius: 10px; border-bottom-left-radius: 10px;
}
.input-unit > .jt-select:last-child > .jt-select-btn {
  border-top-right-radius: 10px; border-bottom-right-radius: 10px;
}
/* 當成「單位」接在別的控制項右邊時才是灰底、字重稍粗，而且左框線交給左邊那一格
   —— 兩條框線疊在一起會變成 2px。下拉排在第一個時它是主控制項，
   要跟輸入框一樣是白底、有自己的左框線。 */
.input-unit > .jt-select:not(:first-child) > .jt-select-btn {
  border-left: none; background: #f8fafc; font-weight: 500;
}
.input-unit > .jt-select:not(:first-child) > .jt-select-btn:hover { background: #f1f5f9; }

/* 浮層本身（掛在 body 上，用 fixed 定位）*/
.jt-select-menu {
  position: fixed; z-index: 3000; margin: 0; padding: 5px;
  background: #fff; border: 1px solid var(--border); border-radius: 11px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16), 0 2px 6px rgba(15, 23, 42, 0.08);
  max-height: 300px; overflow-y: auto; overscroll-behavior: contain;
}
.jt-select-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  font-size: 14px; color: var(--text); white-space: nowrap;
}
.jt-select-opt .ic { flex: none; color: var(--primary); visibility: hidden; }
.jt-select-opt.is-sel { background: #eff6ff; color: var(--primary-dark); font-weight: 600; }
.jt-select-opt.is-sel .ic { visibility: visible; }
.jt-select-opt.is-active { background: #f1f5f9; }
.jt-select-opt.is-sel.is-active { background: #dbeafe; }
.jt-select-opt[aria-disabled="true"] { color: var(--muted); cursor: not-allowed; opacity: 0.6; }
.jt-select-group {
  padding: 8px 10px 4px; font-size: 11.5px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em;
}
.jt-select-group + .jt-select-opt { margin-top: 0; }

/* 手機：字級跟輸入框一致，避免 iOS Safari 放大 */
@media (max-width: 900px) {
  .jt-select-btn { font-size: 16px; }
  .jt-select-opt { font-size: 15px; padding: 10px 11px; }
  .jt-select-menu { max-height: 60vh; }
}

/* ── 程式碼面板：行號 + 語法著色 ───────────────────────────────────────
 *
 * 設計圖（JSON 頁，2026-09-06）的輸入區與文字檢視都有行號。<pre> 沒辦法用
 * CSS 計數器數行（換行不是元素），所以行號是另一欄由 JS 填的 .code-gutter，
 * 捲動時跟著本文一起移動。
 *
 * 編輯用的版本（.is-editor）是「透明的 textarea 疊在著色好的 <pre> 上面」：
 * 使用者打字在 textarea，看到的顏色來自底下那層。兩層的字體、字級、行高、
 * 內距必須逐項相同，差一點就會出現「游標跟字錯開」。
 */
.code-pane {
  position: relative; display: flex;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
  overflow: hidden;
}
.code-gutter {
  /* 固定寬度：編輯版的兩層是用 inset 對齊到這個寬度，寬度浮動就會錯開 */
  flex: 0 0 46px; width: 46px; box-sizing: border-box; padding: 12px 9px 12px 0;
  background: #f8fafc; border-right: 1px solid var(--border);
  /* 2.41:1 太淡看不清楚（check-contrast 抓到）。行號雖然是輔助資訊，
     但它是拿來對照「第幾行」的，看不清楚就失去用處 */
  color: #6b7380; text-align: right; user-select: none;
  font-family: ui-monospace, SFMono-Regular, Consolas, Menlo, monospace;
  font-size: 13px; line-height: 1.6; white-space: pre; overflow: hidden;
}
.code-body {
  flex: 1 1 auto; min-width: 0; margin: 0; padding: 12px 14px; box-sizing: border-box;
  font-family: ui-monospace, SFMono-Regular, Consolas, Menlo, monospace;
  font-size: 13px; line-height: 1.6; tab-size: 4;
  white-space: pre; overflow: auto; color: var(--text);
  border: 0; background: transparent; resize: none;
}
.code-pane.is-editor { height: 260px; }
/* width:100% 的通用 textarea 規則會壓掉 right:0（同時指定 left 與 width 時
   right 會被忽略），所以要把寬度交還給定位 */
.code-pane.is-editor .code-body { position: absolute; inset: 0 0 0 46px; width: auto; height: auto; }
.code-pane.is-editor pre.code-body { pointer-events: none; z-index: 1; }
.code-pane.is-editor textarea.code-body {
  z-index: 2; color: transparent; background: transparent;
  caret-color: var(--text); outline: none;
}
.code-pane.is-editor textarea.code-body::placeholder { color: var(--muted); }
.code-pane.is-editor textarea.code-body:focus { outline: none; }
.code-pane:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18); }

/* ── YAML 語法著色的色票 ─────────────────────────────────────────
   🔴 **搬到共用的地方，因為它已經有兩個使用者了。**
   `js/yaml-doc.js` 的 `highlight()` 產生 `.y-*` 這些 class，
   YAML 格式化那一頁自己定義了顏色，而 **Oxidized 組態工作台也用同一支著色器
   卻沒有定義** —— 所以那一頁的 YAML 原文一點顏色都沒有，而畫面上看起來
   「只是比較樸素」，不像壞掉。
   是 2026-09-15 新加的「填值後 class 沒套到樣式」那條規則抓到的。
   ⚠️ 著色器是共用的，色票就不該各頁留一份 —— 兩份遲早走鐘。 */
.code-body .y-key      { color: #0f766e; font-weight: 600; }
.code-body .y-str      { color: #1d4ed8; }
.code-body .y-num      { color: #7c3aed; }
.code-body .y-bool     { color: #b45309; font-weight: 600; }
.code-body .y-null     { color: #64748b; font-style: italic; }
.code-body .y-comment  { color: #15803d; font-style: italic; }
.code-body .y-anchor   { color: #be123c; font-weight: 600; }
.code-body .y-tag      { color: #c2410c; }
.code-body .y-punct    { color: #64748b; }
.code-body .y-doc      { color: #0891b2; font-weight: 600; }
.code-body .y-directive{ color: #0891b2; }
.code-pane.is-output { max-height: 620px; }
.code-pane.is-output .code-body { max-height: 620px; }
.code-copy {
  position: absolute; top: 8px; right: 12px; z-index: 3;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--border); background: rgba(255, 255, 255, 0.95);
  font-family: inherit; font-size: 12.5px; font-weight: 500; color: var(--text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.code-copy:hover { background: #f1f5f9; }
.code-empty { color: var(--muted); text-align: center; padding: 60px 12px; }

/* 語法著色（輸入與輸出共用一套色） */
.code-body .json-key     { color: #1d4ed8; font-weight: 600; }
.code-body .json-string  { color: #15803d; }
.code-body .json-number  { color: #b45309; }
.code-body .json-boolean { color: #be123c; font-weight: 600; }
.code-body .json-null    { color: #be123c; font-weight: 600; }
.code-body .json-bracket { color: #475569; }

/**
 * Markdown **原始碼**的語法著色。唯一來源是 `js/md-engine.js` 的
 * `highlightSource()`。目前 Markdown 預覽與編輯器的輸入區、郵件退信分析器的
 * 報告預覽共用這一組 —— 同一段文字在兩個地方要長得一樣。
 */
.md-h    { color: #1d4ed8; font-weight: 700; }
.md-b    { color: #b45309; font-weight: 600; }
.md-i    { color: #b45309; font-style: italic; }
.md-code { color: #15803d; }
.md-fence{ color: #0f766e; }
.md-li   { color: #7c3aed; }
.md-task { color: #be185d; font-weight: 600; }
.md-quote{ color: #64748b; font-style: italic; }   /* #94a3b8 只有 2.6:1，讀不到 */
.md-url  { color: #0369a1; text-decoration: underline; }
.md-hr   { color: #64748b; }

/**
 * XML 的語法著色。唯一來源是 `js/xml-doc.js` 的 token 表 ——
 * 頁面不自己再寫一套規則，兩套規則遲早會走鐘，畫面上的顏色就會跟診斷結果
 * 對不起來。目前 XML 格式化檢視器與 OPNsense 設定分析器共用這一組。
 */
.code-body .x-tag      { color: #b91c1c; font-weight: 600; }
.code-body .x-attr     { color: #b45309; }
.code-body .x-value    { color: #1d4ed8; }
.code-body .x-punct    { color: #64748b; }
.code-body .x-comment  { color: #15803d; font-style: italic; }
.code-body .x-cdata      { color: #7c3aed; }
.code-body .x-cdata-mark { color: #7c3aed; font-weight: 600; }
.code-body .x-pi       { color: #0891b2; }
.code-body .x-decl     { color: #0891b2; }
.code-body .x-doctype  { color: #b45309; font-weight: 600; }
.code-body .x-text     { color: #23272e; }
.code-body .x-error    { color: #b91c1c; text-decoration: underline wavy #dc2626; }
.code-body .x-hit      { background: #fef08a; border-radius: 2px; }
.code-body .x-hit.is-current { background: #fb923c; color: #1c1917; }

/**
 * 設定檔的語法著色（NXLog、Vector 這類「指令 + 區塊」的設定）。
 *
 * 跟上面那組 json-* 分開命名，因為色彩對應的語意不同：設定檔沒有 JSON 的
 * boolean/null 概念，卻多了區塊標籤與變數。顏色沿用同一組色票，
 * 整站看起來才是同一套（都通過 check-contrast）。
 */
.code-body .tok-com { color: #64748b; font-style: italic; }
.code-body .tok-tag { color: #7c3aed; font-weight: 600; }
.code-body .tok-key { color: #1d4ed8; font-weight: 600; }
.code-body .tok-str { color: #15803d; }
.code-body .tok-num { color: #b45309; }
.code-body .tok-var { color: #be123c; }

/**
 * 🔴 編輯用的 code-pane **一定要有底下那層 <pre>**，因為 textarea 的字是
 * 透明的（顏色來自底層）。少了那一層，使用者貼上內容之後只看得到選取的
 * 藍底、看不到任何字 —— 2026-09-09 NXLog 的「貼上設定」就是這樣
 * （使用者回報「我貼上內容 為何字看不到?」）。
 *
 * 這一條是安全網：沒有著色層時把字還給 textarea 自己。看起來沒有顏色，
 * 但至少讀得到；不能讓一個結構疏漏變成「整塊空白」。
 */
.code-pane.is-editor:not(:has(pre.code-body)) textarea.code-body { color: var(--text); }

/* 流程圖上可點的節點（NXLog／Vector）：要看得出來可以點 */
.nx-gnode { cursor: pointer; }
.nx-gnode:hover rect:first-of-type { filter: brightness(0.97); }
.nx-gnode:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/**
 * 分頁列與分段按鈕**直接放在卡片裡**時，下面要有間距。
 *
 * 這兩個元件本身沒有外距（它們也會被放進欄位列、工具列裡，那些場合有外距反而錯），
 * 所以「按鈕列貼著下面的內容」這個形狀 2026-09-09 一天內被回報三次：
 * 兩行按鈕貼在一起、按鈕又跟下面的資訊貼在一起。
 * 用 `.card > ` 限定成「卡片的直接子元素」——那個位置一定是區塊排版。
 */
.card > .tabs, .card > .seg, .card > .tabs-lg { margin-bottom: 14px; }

/* 檢視切換列：左邊分頁、右邊統計徽章 */
.view-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.view-bar .spacer { margin-left: auto; }
.stat-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 9px; border: 1px solid transparent;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  font-family: inherit; cursor: default;
}
.stat-pill .ic { width: 15px; height: 15px; }
.stat-pill.t-blue   { background: #eff6ff; border-color: #dbeafe; color: var(--primary-dark); }
.stat-pill.t-violet { background: #f5f3ff; border-color: #ede9fe; color: #6d28d9; }
.stat-pill.t-plain  { background: #f1f5f9; border-color: #e2e8f0; color: var(--muted); }
button.stat-pill { cursor: pointer; }
button.stat-pill:hover:not(:disabled) { filter: brightness(0.97); }
button.stat-pill:disabled { cursor: not-allowed; opacity: 0.75; }

@media (max-width: 900px) {
  .code-gutter { flex-basis: 38px; width: 38px; font-size: 12px; }
  .code-body { font-size: 12.5px; }
  .code-pane.is-editor .code-body { inset: 0 0 0 38px; }
  .view-bar .spacer { margin-left: 0; }
}

/* ── 檢視區內的工具列（JSON 樹狀／圖表檢視）───────────────────────────
 * 設計圖 2026-09-06：淺底圓角的一條，裡面是白底按鈕、分割式下拉、搜尋框，
 * 右邊放縮放與全螢幕。原本每顆按鈕都自己寫一整串 inline style。
 */
.pane-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 12px; padding: 10px;
  background: #f8fafc; border: 1px solid var(--border); border-radius: 11px;
}
.pane-toolbar .push { margin-left: auto; }
.pane-toolbar .sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 2px; }
.pane-toolbar .btn { padding: 8px 14px; font-size: 13.5px; border-radius: 9px; }

/* 分割式按鈕：主動作 + 箭頭（展開／收摺至第 N 階）*/
.split-btn { position: relative; display: inline-flex; }
/* 🔴 用 `:last-of-type` 不是 `:last-child`。
   `.split-btn` 裡除了兩顆按鈕，還有一個 `.pane-menu` 的浮層 div —— 那個 div
   才是最後一個**子元素**，所以 `:last-child` 永遠選不到箭頭按鈕，箭頭就保留
   了完整圓角與自己的左框線，看起來像兩顆分開的按鈕（使用者 2026-09-09 回報
   「展開與收摺按鈕右邊的下拉按鈕樣式沒有組合好」）。
   `:last-of-type` 是按**元素型別**數的，兩顆 button 裡的第二顆就命中。 */
.split-btn > .btn:first-of-type { border-radius: 9px 0 0 9px; }
.split-btn > .btn:last-of-type {
  border-radius: 0 9px 9px 0; border-left: none;
  padding-left: 9px; padding-right: 9px;
}
/* 中間那條界線：兩顆按鈕之間要看得出是兩個動作，但共用一個外框 */
.split-btn > .btn:last-of-type::before {
  content: ''; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 1px; background: var(--border);
}
.split-btn > .btn:last-of-type { position: relative; }

.pane-menu {
  position: absolute; top: 100%; left: 0; margin-top: 5px; z-index: 1200;
  min-width: 132px; padding: 5px;
  background: #fff; border: 1px solid var(--border); border-radius: 11px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16), 0 2px 6px rgba(15, 23, 42, 0.08);
}
.pane-menu-head {
  padding: 6px 9px 5px; font-size: 11.5px; font-weight: 700;
  color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.pane-menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 8px; background: none;
  text-align: left; cursor: pointer;
  font-family: inherit; font-size: 13.5px; color: var(--text);
}
.pane-menu-item:hover { background: #f1f5f9; }
.pane-menu-item .ic { color: var(--primary); }

/* 標籤 + 控制項擠成一顆藥丸（方向：往右）*/
.chip-field {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 6px 0 11px; height: 38px;
  background: #eff6ff; border: 1px solid #dbeafe; border-radius: 10px;
  font-size: 13px; font-weight: 600; color: var(--primary-dark); white-space: nowrap;
}
.chip-field .jt-select-btn { min-height: 30px; padding: 4px 30px 4px 9px; font-size: 13px; background: #fff; }

/* 圖表縮放：一組小圓鈕 */
.zoom-group { display: inline-flex; align-items: center; gap: 4px; }
.zoom-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--border); background: #fff; color: var(--text);
}
.zoom-btn:hover { background: #f1f5f9; }
.zoom-value { min-width: 46px; text-align: center; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .pane-toolbar { padding: 8px; gap: 6px; }
  .pane-toolbar .push { margin-left: 0; }
  .pane-toolbar .btn { flex: 1 1 auto; justify-content: center; }
}

/**
 * 卡片的說明文字放在卡片「裡面」，不是放在標題列（使用者要求 2026-09-06）。
 *
 * 標題列是有底色的一條，塞了兩行字之後那一條會變得很高、而且說明字擠在
 * 深色標題旁邊不好讀。改成標題列只放標題，說明移到內容區的第一行。
 */
/* 🔴 上邊界的預設是 **10px**，`-2px` 只給「緊接在卡片標題列後面」那一種。
   原本反過來寫（預設 -2px、逐一補例外），結果同一個 bug 修了三次：
   程式碼方塊後面、指令方塊後面、徽章後面 —— 每一次都是「說明被往上吸，
   黏在上面那塊東西身上」，而且使用者每次都得自己看出來
   （2026-09-09 一天之內就回報了 SNMP 的指令方塊、CSP 的徽章、NXLog 的警示帶三處）。
   例外清單永遠列不完，把預設改成安全的那一邊才是治本。 */
.card-hint {
  margin: 10px 0 14px; font-size: 13px; color: var(--muted); line-height: 1.55;
}
/* 貼齊卡片標題列：這才是 -2px 當初要解決的情境 */
.card-head + .card-hint,
.setup-head + .card-hint,
.card > .card-hint:first-child { margin-top: -2px; }
.card-hint + .code-pane, .card-hint + .setup-body { margin-top: 0; }


/* 時間／日期輸入框：瀏覽器預設的小時鐘圖示顏色與大小各家不同，統一一下 */
input[type="time"], input[type="date"], input[type="datetime-local"], input[type="month"], input[type="week"] {
  min-height: 42px; border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  opacity: 0.5; cursor: pointer; padding: 2px; border-radius: 5px;
}
input[type="time"]::-webkit-calendar-picker-indicator:hover,
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1; background: #f1f5f9;
}

/* 分段按鈕帶圖示時，圖示要跟著文字的顏色走 */
.seg > button > .ic { width: 15px; height: 15px; margin-right: 6px; vertical-align: -2px; color: var(--muted); }
.seg > button.is-on > .ic { color: #fff; }

/* Cron 欄位示意圖：五欄對照表（原本是 ASCII 線條圖，中文字寬對不齊）*/
.cron-fields { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.cron-field {
  padding: 10px 8px; border-radius: 10px; text-align: center;
  background: #f8fafc; border: 1px solid var(--border);
}
.cron-field-star { font-family: var(--mono); font-size: 19px; font-weight: 700; color: var(--primary); line-height: 1; }
.cron-field-name { display: block; font-size: 13px; font-weight: 700; margin-top: 6px; }
.cron-field-range { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; font-family: var(--mono); }
.cron-fields-note { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
@media (max-width: 700px) {
  .cron-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── 指令步驟（PVE CLI 匯入工具的設計圖，2026-09-06）─────────────────
 * 一列一個步驟：編號、左邊說明、右邊深色指令方塊、最右邊複製鈕。
 */
.cmd-steps { display: flex; flex-direction: column; gap: 10px; }
.cmd-step { display: grid; grid-template-columns: 30px minmax(140px, 190px) 1fr auto; gap: 12px; align-items: center; }
.cmd-step-no {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 13.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.cmd-step-text { min-width: 0; }
.cmd-step-name { display: block; font-size: 14px; font-weight: 700; }
.cmd-step-desc { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.cmd-box {
  min-width: 0; padding: 11px 14px; border-radius: 10px;
  background: #1e293b; color: #e2e8f0;
  font-family: var(--mono); font-size: 13px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-all; margin: 0;
}
.cmd-box .cmd-ph { color: #fbbf24; }
/**
 * 指令方塊裡的 <code> 要跟著方塊的深底走。
 *
 * 全域的 `code` 規則給了淺灰底（#f1f5f9），疊在 .cmd-box 的 #1e293b 上就變成
 * 淺底淺字，整段指令看不見（2026-09-07 採樣助手第一版）。
 */
.cmd-box code { background: none; color: inherit; padding: 0; font-size: inherit; }

/* 指令與複製鈕並排：按鈕不要壓在文字上面 */
.cmd-row { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 6px; }
/* 指令列上面的小標題（「快速打包指令」這種）。跟 .field-label 同一個外觀，
   只是多一個圖示的間距。 */
/**
 * 按鈕列裡的分組分隔線。
 *
 * 一列裡有兩群性質不同的按鈕時（「執行」與「輸出」、「編輯」與「刪除」），
 * 拆成兩列會讓人以為是兩個不相干的區塊，全部擠在一起又看不出分組。
 * 一條細線就夠了 —— 它不是控制項，所以 aria-hidden。
 * 折行時自己也會跟著折，不會留一條孤零零的線在列首（`.actions` 是 flex-wrap）。
 */
.actions > .actions-sep {
  flex: none; align-self: stretch; width: 1px; min-height: 24px;
  margin: 0 4px; background: var(--border);
}
@media (max-width: 560px) {
  /* 窄畫面按鈕會排成多列，直立的線就沒有意義了 —— 改成整列的橫線 */
  .actions > .actions-sep { width: 100%; height: 1px; min-height: 0; margin: 4px 0; }
}

.pve-cmd-label { display: flex; align-items: center; gap: 6px; margin: 14px 0 6px; }
.pve-cmd-label .ic { color: var(--primary); }
.cmd-row .cmd-box { flex: 1 1 auto; min-width: 0; }
/* 收摺的長指令：整段四十幾行貼在卡片裡，下面的說明全被推出畫面
   （使用者 2026-09-11：「這邊指令很多 要可以收摺」）。
   ⚠️ 複製鈕**留在收摺外面** —— 想複製的人不必先展開再捲到底。 */
.cmd-fold { flex: 1 1 auto; min-width: 0; }
.cmd-fold > summary {
  display: flex; align-items: center; gap: 7px; cursor: pointer; list-style: none;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: #f8fafc; font-size: 13.5px; font-weight: 600; color: var(--text);
}
.cmd-fold > summary::-webkit-details-marker { display: none; }
.cmd-fold > summary:hover { border-color: var(--primary); }
.cmd-fold > summary .ic { color: var(--primary); flex: none; transition: transform .15s; }
.cmd-fold[open] > summary .ic { transform: rotate(90deg); }
.cmd-fold > summary .cmd-fold-n { margin-left: auto; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.cmd-fold[open] > summary { border-radius: var(--radius) var(--radius) 0 0; border-bottom: none; }
.cmd-fold[open] > .cmd-box { border-radius: 0 0 var(--radius) var(--radius); margin: 0; }
.cmd-row .btn { flex: none; }
@media (max-width: 900px) {
  .cmd-step { grid-template-columns: 30px 1fr auto; }
  .cmd-step .cmd-box { grid-column: 1 / -1; }
}

/* 平台挑選卡（VMware／Hyper-V／KVM…）：點了整張卡變選取狀態 */
.pick-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.pick-card {
  display: flex; align-items: center; gap: 11px; position: relative;
  padding: 13px 14px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border); background: #fff; text-align: left;
  font-family: inherit; color: var(--text);
}
.pick-card:hover { background: #f8fafc; }
.pick-card.is-on { border-color: var(--primary); background: #eff6ff; box-shadow: 0 0 0 1px var(--primary) inset; }
.pick-card-tile {
  flex: 0 0 36px; width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(135deg, #94a3b8, #64748b);
}
.pick-card.is-on .pick-card-tile { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.pick-card-name { display: block; font-size: 14px; font-weight: 700; }
.pick-card-sub { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.pick-card-check { position: absolute; top: 10px; right: 11px; color: var(--primary); visibility: hidden; }
.pick-card.is-on .pick-card-check { visibility: visible; }

/* 大分頁：圖示 + 標題 + 副標，兩張並排（設計圖的「磁碟映像匯入／OVA-OVF 匯入」）*/
.tabs-lg { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 16px; }
.tab-lg {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border); background: #fff; text-align: left;
  font-family: inherit; color: var(--text); box-shadow: var(--shadow);
}
.tab-lg:hover { background: #f8fafc; }
.tab-lg.is-on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset, var(--shadow); }
.tab-lg .ic { color: var(--muted); width: 22px; height: 22px; flex: none; }
.tab-lg.is-on .ic { color: var(--primary); }
.tab-lg-name { display: block; font-size: 15.5px; font-weight: 700; }
.tab-lg.is-on .tab-lg-name { color: var(--primary); }
.tab-lg-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* 前置檢查：一排小卡 */
.check-row { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.check-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; border-radius: 11px; background: #f8fafc; border: 1px solid var(--border);
}
.check-item .ic { flex: none; color: var(--muted); }
.check-item.is-ok { background: #f0fdf4; border-color: #bbf7d0; }
.check-item.is-ok .ic { color: var(--success); }
.check-item.is-warn { background: #fffbeb; border-color: #fde68a; }
.check-item.is-warn .ic { color: var(--warning); }
.check-item-name { display: block; font-size: 13.5px; font-weight: 600; }
.check-item-sub { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/**
 * 控制項後面接一句說明：寬度夠就排在右邊，窄了才折下來。
 *
 * 原本說明是 `display:block` 硬佔一列 —— 一句「只計算實體核心。這是比較保守的
 * 一邊，也是預設值。」讓整個欄位列多了一行（使用者 2026-09-08 回報）。
 */
.inline-note-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
/* 工具列裡「標籤 + 控制項」要當一組折行，不然標籤會被留在上一列 */
.bar-group { display: inline-flex; align-items: center; gap: 8px; }
.inline-note-row > .card-hint { margin: 0; flex: 1 1 260px; min-width: 0; }

/* 控制項下面帶一行說明時用這個。
   `.inline-note-row` 是**水平**排的 —— 控制項滿版時說明會被推到下一列，
   而 `.field-row` 的 `align-items: center` 會把標籤對到整塊的垂直中線，
   看起來就是「標籤沒有對齊輸入框」。這一組把說明明確排在下面，
   並讓標籤對齊**第一行**。 */
.field-row:has(> .field-stack) { align-items: start; }
.field-row > .field-label:has(~ .field-stack),
.field-row:has(> .field-stack) > .field-label { min-height: 42px; display: inline-flex; align-items: center; }
.field-stack { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
/* 🔴 **控制項列前面接著別的區塊時會貼在一起。**
   `.field-row` 只有 `margin-bottom: 10px`、`.field-stack` 連邊界都沒有 ——
   所以「一塊有內容的東西 + 一列控制項」這種組合的間距是 **0**。
   使用者 2026-09-14 在 OPNsense 回報「這排按鈕跟下面表格貼太近了」就是這個形狀；
   把 `check-visual` 的相鄰間距規則搬進**填值後**的版面複檢之後，
   又抓到五支工具的同一件事（Email Header、EML、SSL 憑證、Vector、Graylog 容量）
   —— 它們的結果區要先匯入資料才畫得出來，剛打開的頁面上量不到。

   ⚠️ **刻意逐對指定，不寫成 `* + .field-row` 那種通用規則。**
   通用規則量過了：載入時只修好 1 對，卻把 WebAuthn 兩處本來正常的間距
   從 14px / 12px **縮成 10px** —— 修一個弄壞兩個。
   逐對指定的範圍框得住，而且每一對都看得出為什麼。 */
.field-stack + .field-stack,
.cmd-box + .field-row, .cmd-box + .field-stack,
.kv-list + .field-row, .kv-list + .field-stack,
.dropzone + .field-row, .dropzone + .field-stack { margin-top: 12px; }
.panel-grid + .card, .kv-list + .card, .cmd-box + .card { margin-top: 16px; }
.field-stack > .card-hint { margin: 0; }
.field-stack > input, .field-stack > select, .field-stack > textarea { width: 100%; }

/**
 * 表格儲存格裡並排的按鈕。
 *
 * `appendChild` 兩顆按鈕預設是完全貼在一起的（使用者 2026-09-08 回報
 * 「動作裡兩按鈕靠太近」）。這條讓所有表格的動作欄都有間距，
 * 不必每個工具各自記得包一層 flex。
 */
td > .btn + .btn { margin-left: 6px; }

/* 選填設定裡的開關小藥丸 */
.chip-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: #fff;
  font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted);
  /* 這是一顆膠囊，不是一段文字 —— 標籤在詞中間斷成兩行（「文／字」）
     會讓它看起來像壞掉（2026-09-09 在 LDAP 篩選條件設計器看到的）。
     同樣用 `keep-all` 不用 `nowrap`，長標籤才還有地方換行。 */
  word-break: keep-all;
}
.chip-toggle:hover { background: #f8fafc; }
.chip-toggle.is-on { background: #eff6ff; border-color: #bfdbfe; color: var(--primary-dark); }
.chip-toggle > .ic { width: 14px; height: 14px; flex: none; }
/* 一排藥丸的容器（ICS 的星期、測試檔案的分類、條碼的格式都用這個） */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

/**
 * 設定卡的標題列（不可收折版）。
 *
 * 主要的輸入卡不該可以收合起來 —— 收掉之後整頁看不出要填什麼
 * （使用者 2026-09-06：「這卡片不應該可以收折 不能收」）。
 * 原本是 <details><summary>，現在改成一般的標題列，樣式沿用同一套。
 */
/* 標題列的版面由上面 `.card > .setup-head:first-child` 那條負責（跟一般卡片
   同一套：淡底、下框線、與卡片同寬）。這裡只補設定卡自己的圖示尺寸 ——
   原本它自己寫 padding: 16px 18px 6px，等於自成一格沒有標題列
   （使用者 2026-09-07：「這四個少了卡片標題列設計」）。 */
.setup-card > .setup-head { gap: 12px; }
.setup-card > .setup-head .card-head-icon { flex: 0 0 38px; }

/* ── 網路連線品質測試的版面（設計圖 2026-09-06）─────────────────────── */

/* 安全提醒：一條橫幅，四個重點並排，右邊一個連結 */
/**
 * 四個重點用格線排，不用 flex-wrap。
 * flex 折行時最後一項會自己佔一行、右邊的連結被推到很遠的地方，看起來像壞掉
 * （使用者 2026-09-06）。格線會平均分配，折成兩排也還是整齊的兩排。
 */
.safety-bar {
  display: grid; gap: 10px 18px; align-items: center;
  /* auto-fit 跟兩側的 max-content 混在一起時只會長出一條軌道，整條變成一欄，
     所以直接寫死四欄（2026-09-06）*/
  grid-template-columns: max-content repeat(4, minmax(0, 1fr)) max-content;
  padding: 12px 16px; margin-bottom: 16px;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px;
}
.safety-label { display: inline-flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 700; color: #92400e; white-space: nowrap; }
.safety-label .ic { color: var(--warning); }
.safety-item { display: inline-flex; align-items: flex-start; gap: 8px; min-width: 0; }
.safety-item .ic { color: #b45309; flex: none; margin-top: 1px; }
.safety-item strong { display: block; font-size: 13px; color: #78350f; }
.safety-item span > span { display: block; font-size: 11.5px; color: #a16207; margin-top: 1px; }
.safety-more {
  display: inline-flex; align-items: center; gap: 5px; justify-self: end;
  font-size: 13px; font-weight: 600; color: var(--primary); text-decoration: none; white-space: nowrap;
}
.safety-more:hover { text-decoration: underline; }

/**
 * 站台清單與測試控制台各自一整列（使用者 2026-09-06：「測試控制台卡片不要放在
 * 測試站台右邊，讓它自己一列」）。並排時站台表格只剩四百多 px，網址欄一直在
 * 邊緣掙扎；分成兩列之後兩邊都有整個內容寬度可用。
 */
/* 後面接卡片時要留距離，不然會直接貼上去 */
.nt-cols { display: flex; flex-direction: column; gap: 16px; margin-bottom: 18px; }

/* 控制台占整列，四個設定就橫著排。
   auto-fit + 240px 在 1014px 的內容寬只排得下三欄，最後一個會落單
   （使用者 2026-09-06）—— 直接寫死四欄，窄一點再降成兩欄。 */
.nt-console .nt-settings { display: grid; gap: 10px 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .nt-console .nt-settings { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px)  { .nt-console .nt-settings { grid-template-columns: minmax(0, 1fr); } }
/* 四欄並排時每格只剩 ~250px，固定 104px 的標籤會把下拉擠到剩一百多 px、
   「標準測試（3次）」被截成「標準測試（…」。標籤改成內容寬即可。 */
.nt-console .field-row { grid-template-columns: max-content minmax(0, 1fr); gap: 8px; margin-bottom: 0; }
.nt-console .field-row > label { font-size: 13px; }
.nt-console .field-row > label { display: inline-flex; align-items: center; gap: 7px; }
.nt-console .field-row > label .ic { color: var(--muted); flex: none; }
/* 測試資訊佔滿一列，動作按鈕自己一列靠右 —— 並排時按鈕會浮在資訊框頂端，
   兩塊的高度對不齊（使用者 2026-09-06）*/
.nt-console .nt-bottom { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.nt-console .nt-bottom .nt-info { margin-top: 0; }
.nt-console .nt-bottom .actions { margin-top: 0; justify-content: flex-end; }
@media (max-width: 700px) {
  /* 手機上按鈕改成整列平分，不然三顆並排會撐出卡片外（版面回歸抓到）*/
  .nt-console .nt-bottom .actions { flex: 1 1 100%; }
  .nt-console .nt-bottom .actions > .btn { flex: 1 1 100%; justify-content: center; }
}
.nt-info-grid.is-row { flex-direction: row; flex-wrap: wrap; gap: 9px 26px; }

/* 測試資訊 */
.nt-info { border: 1px solid #bfdbfe; background: #eff6ff; border-radius: 12px; padding: 12px 14px; margin-top: 14px; }
.nt-info-head { display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 700; color: var(--primary-dark); }
.nt-info-head .ic { color: var(--primary); }
.nt-info-refresh {
  margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 8px; cursor: pointer;
  border: 1px solid #bfdbfe; background: #fff; color: var(--primary);
}
.nt-info-refresh:hover { background: #dbeafe; }
.nt-info-grid { display: flex; flex-direction: column; gap: 9px; margin-top: 10px; }
.nt-info-grid > div { display: flex; align-items: flex-start; gap: 9px; }
.nt-info-grid .ic { color: var(--primary); flex: none; margin-top: 2px; }
.nt-info-label { display: block; font-size: 11.5px; color: var(--muted); }
.nt-info-value { display: block; font-size: 13px; font-weight: 600; color: var(--text); word-break: break-all; }

@media (max-width: 1280px) {
  .nt-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1250px) {
  /* 排不下四欄時整條改成兩欄，標籤與連結各自佔滿一列 */
  .safety-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .safety-label { grid-column: 1 / -1; }
  .safety-more { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 700px) {
  .safety-bar { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 10px 12px; }
  .safety-item span > span { display: none; }
}


/* 一組開關排成整齊的格線（PVE CLI 的「匯入後掛載設定」）。
   原本是自然換行，兩個擠一行、寬度長短不一，看起來很亂（使用者 2026-09-06）。 */
.switch-grid {
  display: grid; gap: 8px 20px;
  /* min() 是必要的：純 minmax(330px,…) 在窄畫面會硬撐 330px，把內容推出卡片外 */
  grid-template-columns: repeat(auto-fit, minmax(min(330px, 100%), 1fr));
}
.switch-grid > .switch { min-height: 38px; align-items: flex-start; }
/* 🔴 `align-items: flex-start` 是**故意的**（標籤折成兩行時開關要留在第一行，
   英文介面很容易折），要調的是這個 margin。
   舊值 `+2px` 讓開關比文字**低 3.9px**（使用者 2026-09-10 回報「切換開關跟他的
   文字沒有對齊」）：track 高 24、文字行高 20.25，flex-start 之下
   track 中心 = 2 + 12 = 14、文字中心 = 10.1。
   要對齊第一行就是 10.1 − 12 ≈ **−2px**。 */
.switch-grid > .switch > .track { margin-top: -2px; }
.switch-grid > .switch > span:last-child { line-height: 1.5; }

/* 必填欄位沒填時的紅框（按下送出才亮，打字時就收掉）*/
.text-input.is-invalid, input.is-invalid, select.is-invalid, textarea.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.16);
}
.input-unit > input.is-invalid { position: relative; z-index: 1; }

/* ── 所有標頭的清單（Email Header 分析，設計圖 2026-09-06）──────────────
 * 一列一張：左邊有色條的是 Received（帶編號）與警示標頭，值放在等寬方塊裡。
 * 原本是兩欄表格，整頁灰字看不出哪幾條要看。
 */
.hdr-list { display: flex; flex-direction: column; }
.hdr-row {
  display: grid; grid-template-columns: minmax(150px, 210px) minmax(0, 1fr);
  gap: 10px 16px; align-items: start;
  padding: 11px 14px; border-bottom: 1px solid #eef1f6;
  border-left: 3px solid transparent;
}
.hdr-row:last-child { border-bottom: none; }
.hdr-row.is-recv  { border-left-color: var(--primary); background: #fbfdff; }
.hdr-row.is-alert { border-left-color: var(--warning); background: #fffdf6; }
.hdr-name {
  display: flex; align-items: center; gap: 7px;
  font-size: 13.5px; font-weight: 700; color: #1e293b; line-height: 1.5;
  word-break: break-word;
}
.hdr-name .ic { color: var(--warning); flex: none; }
.hdr-no {
  flex: none; padding: 1px 7px; border-radius: 6px;
  background: #e0edff; color: var(--primary-dark);
  font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.hdr-val {
  margin: 0; padding: 8px 11px; border-radius: 8px;
  background: #f5f7fa; border: 1px solid #eaeef4;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; color: #334155;
  white-space: pre-wrap; word-break: break-all;
}

@media (max-width: 760px) {
  /* 手機：標頭名稱在上、值在下（設計圖的手機版）*/
  .hdr-row { grid-template-columns: minmax(0, 1fr); gap: 7px; padding: 12px 12px; }
}

/* 次要的小標記（例如 DMARC 的「推算」）：跟主徽章並排，不換行 */
.badge-soft { background: #f1f5f9; color: var(--muted); border: 1px solid var(--border); }
.check-card-top .badge { white-space: nowrap; }
/* 卡片說明開頭的限定詞（例如 DMARC 的「推算」）。#475569 疊在 #eef2f7
   上是 7.4:1，比 var(--muted) 保險。 */
.check-card-tag {
  display: inline-block; margin-right: 6px; padding: 1px 7px;
  border-radius: 999px; background: #eef2f7; color: #475569;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}

/* ── 單選卡（Email Subject 的編碼方式／字元編碼，設計圖 2026-09-06）──────
 * 一格一個選項，選到的整格上色。比一排小圓點好按，手機上尤其明顯。
 */
.radio-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); }
/* 單選卡下面接欄位列時要留距離：.radio-cards 沒有下外距、.field-row 只有
   margin-bottom，兩者相鄰時會貼在一起（使用者 2026-09-07 回報「壓縮演算法
   跟上面貼太近」）。 */
/* ⚠️ 用 `~` 不用 `+`：中間常常夾著 `hidden` 的欄位列（螢幕測試的「圖樣選項」
   在自訂顏色模式下是隱藏的），緊鄰兄弟選擇器會被那個隱藏元素隔開而失效，
   間距就掉回 0（使用者 2026-09-07 回報「自訂顏色色條太靠上」）。 */
.radio-cards ~ .field-row, .radio-cards ~ .card-hint,
.pat-grid ~ .field-row, .pat-grid ~ .card-hint { margin-top: 14px; }

/* 顏色選擇器預設高度只有二十幾 px，跟旁邊 42px 的輸入框搭不起來 */
.input-unit > input[type="color"] {
  flex: 0 0 92px; height: auto; padding: 4px; cursor: pointer;
  border: 1px solid var(--border); border-right: none; border-radius: 10px 0 0 10px;
  background: #fff;
}
.radio-card {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--border); background: #fff;
  font-size: 14px; color: var(--text);
}
.radio-card:hover { background: #f8fafc; }
.radio-card > input { position: absolute; opacity: 0; width: 0; height: 0; }
.radio-card .dot {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid #cbd5e1; background: #fff; position: relative;
}
.radio-card > input:checked + .dot { border-color: var(--primary); }
.radio-card > input:checked + .dot::after {
  content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--primary);
}
.radio-card:has(> input:checked) {
  border-color: var(--primary); background: #eff6ff; font-weight: 600; color: var(--primary-dark);
}
.radio-card > input:focus-visible + .dot { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25); }

/* 單選卡的標題與說明。
   這兩個 class 一直沒有規則 —— 兩個都是 inline span，於是名稱與說明串成
   同一段文字（使用者 2026-09-08 回報）。名稱要當標題、說明自己一行。 */
.radio-card-title {
  display: block; font-size: 14.5px; font-weight: 700; line-height: 1.45;
  margin-bottom: 4px;
}
.radio-card-title .badge { margin-left: 6px; vertical-align: middle; }
/* 標題可以帶圖示。站台的按鈕一律「圖示 + 文字」，單選卡的標題也照這個規矩；
   圖示跟著 currentColor，所以選中時轉主色會一起轉。 */
.radio-card-title > .ic { width: 15px; height: 15px; margin-right: 5px; vertical-align: -2px; }
.radio-card-desc {
  display: block; font-size: 12.5px; line-height: 1.55; color: var(--muted);
  /* 選中時整張卡片會轉成主色粗體，說明要壓回來 —— 不然整段都是粗藍字，
     反而看不出哪個是標題 */
  font-weight: 400;
}
.radio-card:has(> input:checked) .radio-card-desc { color: #3f5b8c; }

/* 面板：卡片裡再分區（轉換設定／輸入文字／轉換結果）*/
.panel {
  border: 1px solid var(--border); border-radius: 12px; background: #fff;
  padding: 14px 16px; margin-bottom: 14px;
}
.panel:last-child { margin-bottom: 0; }
.panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; }
.panel-head .ic { color: var(--muted); flex: none; }
.panel-head .panel-name { font-size: 14px; font-weight: 700; }
.panel-head .spacer { margin-left: auto; }
.panel.is-quiet { background: #f8fafc; }

/* 輸入與輸出之間的分隔箭頭（設計圖的向下箭頭）*/
.io-divider { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; color: var(--primary); }
.io-divider::before, .io-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/**
 * 說明卡裡的第二層小標題。
 *
 * `.info-section > h3:first-child` 會被做成整條有底色的標題列，但第二個之後的
 * h3 沒人管，變成貼齊卡片左緣的一行粗體字，跟上面清單的縮排對不齊
 * （使用者 2026-09-06 在 Amass 頁回報「排列問題」）。
 */
.info-section > h3:not(:first-child),
.card > h3:not(:first-child) {
  display: flex; align-items: center; gap: 7px;
  margin: 20px 0 10px; padding: 0 0 7px;
  font-size: 14.5px; font-weight: 700; color: #1e293b;
  border-bottom: 1px solid var(--border);
}
.info-section > h3:not(:first-child) .ic,
.card > h3:not(:first-child) .ic { color: var(--primary); }
.info-section > p { font-size: 13.5px; line-height: 1.7; color: var(--text); margin: 0; }

/* ── 手機版的可點目標與字級（tests/check-mobile.js 抓出來的）──────────────
 *
 * 手指按得到的最小尺寸大約是 32-34px。桌機用滑鼠時 25px 的小按鈕沒問題，
 * 手機上會一直按不中；小字在手機上也讀不清楚。
 */
@media (max-width: 900px) {
  .btn, .btn-small, .zoom-btn, .code-copy, .nt-info-refresh, .appbar-btn {
    min-height: 36px;
  }
  .btn-small { padding: 8px 14px; font-size: 13.5px; }
  .code-copy { padding: 8px 13px; }
  .zoom-btn, .nt-info-refresh { min-width: 36px; }
  .sidebar-lang-btn, .sidebar-collapse { min-width: 34px; min-height: 34px; }

  /* 11px 的字在手機上幾乎讀不到 */
  .brand-version, .appbar-ver { font-size: 12px; }
  /* 藥丸鈕在手機上也要點得到（門檻 32px） */
  .chip-toggle { min-height: 34px; padding: 7px 12px; }
  .badge, .count-pill, .stat-pill, .doc-card-desc, .summary-label,
  .meta-label, .nt-info-label, .check-card-desc, .legend-desc, .flow-sub {
    font-size: 12px;
  }
}
@media (max-width: 900px) {
  /* 各工具頁自己定義的小元件也一起拉大 */
  .copy-mini-btn, .copy-btn, .btn-sm, .load-file-btn, .clear-input-btn,
  .search-btn, .search-clear-btn, .edit-btn-small { min-height: 34px; min-width: 34px; }

  .toolbar-section-label, .toolbar-group label, .field-hint, .doc-card-code,
  .pick-card-sub, .disk-chip, .cron-field-range, .auto-pill, .hdr-no,
  .tab-lg-sub, .safety-item span > span, .step-desc { font-size: 12px; }
}
@media (max-width: 900px) {
  /* 最後一批：各頁自訂的小字與小按鈕 */
  .flow-arrow, .check-item-sub, .cmd-step-desc, .hop-meta,
  .toolbar-section .toolbar-section-label { font-size: 12px; }
  .flow-arrow { font-size: 12px; }
}

/* 長檔名與長指令（process_metrics_YYYYMMDD_HHMMSS.csv）在手機寬度會頂出卡片右緣。
   `anywhere` 只在真的塞不下時才斷，一般字詞不會被硬切（`break-all` 會，別用）。 */
.card code { overflow-wrap: anywhere; }

/**
 * 對話框：外框固定、內層捲動。
 *
 * `<dialog class="card">` 自己捲動時，捲軸畫在圓角上，右上與右下會被切成直角
 * （使用者 2026-09-07 回報）。把內距與捲動都交給內層，外框只負責邊框與圓角，
 * `overflow: hidden` 就會把捲軸一起裁進圓角裡。
 */
dialog.card {
  overflow: hidden;
  padding: 0;
  max-height: calc(100vh - 48px);
}
/**
 * ⚠️ flex 一定要綁在 [open] 上。
 *
 * 瀏覽器預設樣式是 `dialog:not([open]) { display: none }`，權重 0,1,1；
 * `dialog.card` 也是 0,1,1 —— 權重相同時**作者樣式勝出**，於是寫成
 * `dialog.card { display: flex }` 會讓**關閉狀態的對話框一直顯示**，
 * 落在 DOM 裡的位置、沒有遮罩（使用者 2026-09-07 回報「新增來源位置錯亂」）。
 */
dialog.card[open] { display: flex; flex-direction: column; }
dialog.card > .dlg-body {
  overflow-y: auto;
  min-height: 0;                     /* flex 子元素要這條才捲得動 */
  /* 🔴 內距要用 `--pad-*` 宣告出來，上面那條標題列的負邊界才抵得掉
     —— 寫死 `padding: 20px 22px` 的話，標題列會照 `.card` 的預設 22px 往外拉，
     左右各凸出 0px 剛好對上是巧合，換一個內距就歪了。 */
  --pad-x: 22px; --pad-y: 20px;
  padding: var(--pad-y) var(--pad-x);
}
dialog.card::backdrop { background: rgba(15, 23, 42, 0.45); }

/**
 * 切換語言時的「載入中」提示（`js/i18n.js` 的 `showLoading`）。
 *
 * 字典是好幾 MB 的 script，慢一點的連線要等好幾秒，而那段時間畫面完全沒有變化
 * —— 使用者按了語言卻什麼都沒發生（2026-09-16 回報）。
 *
 * ⚠️ **不擋住畫面**：固定在右下角的一條小提示，不是 modal。
 *    這個站的設計就是「切語言不重新整理、填到一半的內容不會不見」，
 *    載入時把畫面鎖住等於自己打自己一巴掌。
 */
.jt-lang-loading {
  position: fixed;
  right: 16px; bottom: 16px;
  z-index: 9999;
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  color: var(--text);
}
.jt-lang-spinner {
  flex: 0 0 15px; width: 15px; height: 15px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: jt-lang-spin .7s linear infinite;
}
@keyframes jt-lang-spin { to { transform: rotate(360deg); } }
/* ⚠️ 會動的東西要尊重系統的「減少動態效果」設定 —— 轉圈對前庭敏感的人是不舒服的。
   停下來之後它仍然是一個看得見的圓圈，提示本身不會消失。 */
@media (prefers-reduced-motion: reduce) {
  .jt-lang-spinner { animation: none; border-top-color: var(--primary); }
}

/**
 * 對話框右上角的關閉叉叉（使用者 2026-09-16：「這種彈出視窗 右上角也要有 X 關閉按鈕」）。
 *
 * 底下那顆「關閉」按鈕仍然留著 —— 兩顆不是重複：
 * 內容長到要捲動時，底下那顆在畫面外，而右上角這顆跟著標題列一起固定在上面。
 *
 * ⚠️ **只有圖示的按鈕一定要有 `aria-label`**（`npm run test:a11y` 會擋）。
 * ⚠️ 44px 的可點範圍是手機的最小值（`npm run test:mobile` 的門檻是 32px），
 *    但視覺上只畫 30px —— 用 padding 撐開命中範圍，不是把圖示放大。
 */
.card-head .dlg-x {
  margin-left: auto;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.card-head .dlg-x:hover { background: #eef1f5; color: var(--text); border-color: var(--border); }
.card-head .dlg-x:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.card-head .dlg-x .ic { width: 18px; height: 18px; }
/* ⚠️ 標題列本來就有一個 `.spacer` 的慣例；兩個 `margin-left: auto` 會把空間
   **平分**，徽章因此停在中間（站台 2026-09-07 記過）。有 `.spacer` 時讓它負責推。 */
.card-head .spacer ~ .dlg-x { margin-left: 0; }
@media (max-width: 900px) {
  .card-head .dlg-x { width: 40px; height: 40px; }
}

/* 手機上這一行是說明文字，11.5px 太小（check-mobile 的門檻是 12px） */
@media (max-width: 900px) {
  .summary-alt { font-size: 12.5px; }
}

/* 卡片說明文字的警示版本（數值進入要提醒的區間時） */
/* 警語提示：原本只換字色，一行橘字浮在卡片上看起來像沒排版好
   （使用者 2026-09-08 回報）。給它容器，並把字色壓深到在淡黃底上
   仍有 4.87:1 —— var(--warning) 疊在 #fffbeb 上只有 3.9:1，不夠。 */
.card-hint.is-warn {
  color: #b45309; font-weight: 600;
  background: #fffbeb; border: 1px solid #fde68a; border-left: 3px solid var(--warning);
  border-radius: 8px; padding: 9px 12px;
}
.doc-note-text.is-warn { color: var(--warning); font-weight: 600; }

/* 共用確認對話框（js/layout.js 的 jtConfirm）。取代原生 confirm() —— 那個
   長得不像這個站台、會擋住整個分頁，而且不吃標記。 */
dialog.jt-confirm { max-width: 420px; width: calc(100% - 32px); }
dialog.jt-confirm .jt-confirm-text {
  margin: 0 0 18px; font-size: 14.5px; line-height: 1.6; color: var(--text);
  white-space: pre-line;                 /* 訊息裡的換行照樣呈現 */
}
dialog.jt-confirm .jt-confirm-actions { justify-content: flex-end; margin: 0; }
dialog.jt-prompt { max-width: 560px; }
dialog.jt-prompt .jt-confirm-text { margin-bottom: 10px; font-weight: 600; }
dialog.jt-prompt input, dialog.jt-prompt textarea { margin-bottom: 18px; }

/* ── 掃描回饋：整個畫面閃一下（像相機閃光燈）──────────────────────
   覆蓋層掛在 <body> 上用 position: fixed，才蓋得住整個視窗；
   只閃背景不動版面，`pointer-events: none` 保證不會擋到操作。
   `prefers-reduced-motion` 的使用者不閃 —— 全螢幕閃光對部分人是有風險的。 */
.jt-scan-flash {
  position: fixed; inset: 0; z-index: 100000;
  background: #fff; opacity: 0; pointer-events: none;
  animation: jtScanFlash .28s ease-out;
}
@keyframes jtScanFlash {
  0%   { opacity: 0; }
  18%  { opacity: .82; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .jt-scan-flash { animation: none; }
}

/* 文字區可以拖檔案進來時的狀態（js/layout.js 的 jtEnableTextDrop）*/
textarea.is-dragover, input.is-dragover {
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

/* 很窄的畫面：欄位改成上下排，標籤才不會被折行
   （使用者 2026-09-08：「vCard 版本 / 保留自訂欄位（X-*）」被換行）。
   `.field-label`／`<label>` 都要，因為兩種寫法站上都有。 */
@media (max-width: 560px) {
  .field-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .field-row > label,
  .field-row > .field-label { min-height: 0; }
  .field-row > :nth-child(2) { min-height: 0; }
}

/* ── 釘選 ────────────────────────────────────────────────────────
   側欄項目與首頁卡片右上角的星星。平常很淡，滑過或已釘選才明顯 ——
   40 個工具每個都掛一顆亮星星，畫面會變成一片黃點。 */
.sb-item { position: relative; }
.sb-pin-btn {
  position: absolute; top: 6px; right: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0;
  border: none; border-radius: 7px; background: transparent;
  color: rgba(255, 255, 255, .35);
  cursor: pointer; opacity: 0;
  transition: opacity .15s, color .15s, background .15s;
}
.sb-item:hover .sb-pin-btn,
.sb-pin-btn:focus-visible { opacity: 1; }
.sb-pin-btn:hover { background: rgba(255, 255, 255, .16); color: #fff; }
/* 已釘選的一律看得見，不然使用者無從得知哪些釘過 */
.sb-pin-btn.is-pinned { opacity: 1; color: #fbbf24; }
.sb-pin-btn.is-pinned .ic { fill: currentColor; }

/* 釘選群組的底色跟其他分類一樣 —— 原本用琥珀色底想強調它，
   結果側欄多出一塊跟整體不同調的顏色（使用者 2026-09-08 回報）。
   要區分靠標題列的星星圖示就夠了，底色不必另外一套。 */
.sb-pinned .sb-group-icon .ic { color: #fbbf24; }

.tool-card { position: relative; }
.card-pin-btn {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  border: 1px solid transparent; border-radius: 8px; background: transparent;
  color: #cbd5e1; cursor: pointer; opacity: 0;
  transition: opacity .15s, color .15s, border-color .15s, background .15s;
}
.tool-card:hover .card-pin-btn,
.card-pin-btn:focus-visible { opacity: 1; }
.card-pin-btn:hover { background: #fffbeb; border-color: #fde68a; color: #d97706; }
.card-pin-btn.is-pinned { opacity: 1; color: #f59e0b; }
.card-pin-btn.is-pinned .ic { fill: currentColor; }

/* 觸控裝置沒有 hover —— 星星一律顯示，不然手機上永遠釘不了。
   而且**要放大到 32px 以上**：26px 的可點目標在手機上按不準
   （check-mobile 的門檻是 32px，39 頁全部被它抓到）。 */
@media (hover: none) {
  .sb-pin-btn, .card-pin-btn { opacity: .55; }
  .sb-pin-btn.is-pinned, .card-pin-btn.is-pinned { opacity: 1; }
}
@media (max-width: 900px) {
  .sb-pin-btn { width: 34px; height: 34px; top: 4px; right: 4px; }
  .card-pin-btn { width: 34px; height: 34px; }
}

/* ── 全站拖放檔案（2026-09-12）────────────────────────────────────
   拖著檔案經過頁面時給一個明確的回饋 —— 沒有回饋的話，使用者不知道
   這一頁到底收不收，只好又去找「選擇檔案」按鈕。
   ⚠️ 覆蓋層一定要 `pointer-events: none`，不然它自己會擋掉 drop 事件。 */
body.jt-file-dragging::after {
    content: attr(data-drop-hint);
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-dark);
    background: rgba(37, 99, 235, .08);
    border: 3px dashed var(--primary);
    border-radius: var(--radius);
}
@media (prefers-reduced-motion: no-preference) {
    body.jt-file-dragging::after { transition: none; }
}
