/* ============================================================
   BIRC 系統網路群
   全站一套設計：訪客的品牌網站與登入後的內部入口共用。
   顏色取自機房照片：機櫃黑、高架地板灰、會議椅的鈷藍、HP 機櫃的黃。
   前台是白頁上的灰色內容塊；後台是灰地板上的白卡片（細框加淡陰影）。
   圓角依層級：區塊 32、卡片 24–28、照片 20–24、清單列與小卡 16–20、
   輸入框 14、選單項 10–12、按鈕與標籤為膠囊。
   白（light）／黑（dark）雙主題，以 data-theme 切換
   ============================================================ */

:root {
  /* Manrope 只有拉丁字母與數字，中文落到 Noto Sans TC */
  --font: "Manrope", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  /* 技術資料（IP、Port、FTP 路徑、日期）用的等寬字；中文落到 Noto Sans TC */
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, "Noto Sans TC", monospace;

  /* 版面：左右留白至少 --gutter，超寬螢幕時內容限制在 --content-max 內置中。
     --pad-x 中的 % 在使用處才計算（相對於該元素的容器寬度） */
  --gutter: 48px;
  --content-max: 1312px;
  --pad-x: max(var(--gutter), calc((100% - var(--content-max)) / 2));
  --header-h: 72px;
  --sidenav-w: 256px;
  --rail-w: 72px;

  /* ---- 淺色主題 ---- */
  color-scheme: light;

  --bg: #ffffff;
  --floor: #f1f4f7;
  --card: #ffffff;
  --ink: #111820;
  --ink-2: #4f5b69;
  --ink-3: #626d7b;
  --line: #dde3ea;
  /* 輸入框外框要與底色有 3:1 對比，比一般分隔線深 */
  --field-line: #8a95a3;

  --blue: #1d5fe0;
  --blue-hover: #174cb8;
  --on-blue: #ffffff;
  --link: #1d5fe0;
  --tint: #e8effd;

  --yellow: #f6bf26;
  --on-yellow: #111820;
  --ink-btn-hover: #2a3542;

  --danger: #c42b2b;
  --danger-tint: #fdecec;
  --danger-solid: #c42b2b;
  --danger-solid-hover: #a32323;
  --on-danger: #ffffff;
  --warn: #8a5a00;
  --warn-tint: #fdf3d6;

  --header-bg: rgba(255, 255, 255, 0.88);
  --backdrop: rgba(17, 24, 32, 0.4);

  --footer-bg: #111820;
  --footer-head: #ffffff;
  --footer-ink: #c9d1da;
  --footer-dim: #8c97a3;
  --footer-line: #26303b;

  --toast-bg: #111820;
  --toast-ink: #edf1f5;
  --toast-accent: #8ab0ff;
  --toast-hover: rgba(255, 255, 255, 0.1);

  /* 維運管理的狀態色：正常／已解決用綠，只在狀態標籤與進度條上 */
  --ok: #1b7f3b;
  --ok-tint: #e3f5e8;

  /* 層次：陰影三級（貼著地板的卡片／懸停與浮起／選單、抽屜與通知），顏色取機櫃黑 */
  --shadow-1: 0 1px 2px rgba(17, 24, 32, 0.06), 0 1px 1px rgba(17, 24, 32, 0.03);
  --shadow-2: 0 2px 6px rgba(17, 24, 32, 0.05), 0 12px 28px rgba(17, 24, 32, 0.09);
  --shadow-3: 0 6px 12px rgba(17, 24, 32, 0.06), 0 24px 56px rgba(17, 24, 32, 0.16);
  /* 主要按鈕下方的藍色投影 */
  --shadow-blue: 0 1px 2px rgba(29, 95, 224, 0.28), 0 4px 12px rgba(29, 95, 224, 0.18);

  /* 半透明的墨色：疊在白頁、灰地板或卡片上都看得出來。
     --hover 是滑過時疊上的底色，--well 是比所在表面略深的凹槽（數字標籤、進度條軌道、灰色標籤） */
  --hover: rgba(17, 24, 32, 0.05);
  --well: rgba(17, 24, 32, 0.06);
  /* 高架地板的磚縫（首頁機房照片下方） */
  --seam: rgba(17, 24, 32, 0.09);
  /* 機房照片上的說明貼紙：兩種主題都是白底黑字 */
  --label-bg: #ffffff;
  --label-ink: #111820;

  /* 「平放在頁面上的塊」（清單列、入口、數字卡）與卡片的陰影，依所在的頁面而定：
     白頁（前台）上是灰底、沒有陰影；後台的灰地板上是白卡片（見 .shell--member .main）。
     --tile-chip 是塊上面的小標籤底色 */
  --tile: var(--floor);
  --tile-line: transparent;
  --tile-shadow: none;
  --tile-chip: var(--card);
  --card-shadow: none;
}

:root[data-theme="dark"] {
  /* ---- 深色主題 ---- */
  color-scheme: dark;

  --bg: #0e1318;
  --floor: #151b22;
  --card: #1b232c;
  --ink: #edf1f5;
  --ink-2: #a9b4c0;
  --ink-3: #8794a2;
  --line: #2a343f;
  --field-line: #5d6a78;

  /* 按鈕維持深藍底白字（亮藍底白字對比不足），連結文字改用淺藍 */
  --blue: #2f6bf0;
  --blue-hover: #2459d6;
  --on-blue: #ffffff;
  --link: #8ab0ff;
  --tint: rgba(138, 176, 255, 0.14);

  --yellow: #f2bc2c;
  --on-yellow: #111820;
  --ink-btn-hover: #2a3542;

  --danger: #ff8a8a;
  --danger-tint: rgba(255, 138, 138, 0.12);
  --danger-solid: #d63a3a;
  --danger-solid-hover: #b92f2f;
  --on-danger: #ffffff;
  --warn: #f2bc2c;
  --warn-tint: rgba(242, 188, 44, 0.14);

  --header-bg: rgba(14, 19, 24, 0.86);
  --backdrop: rgba(0, 0, 0, 0.6);

  --footer-bg: #070a0d;
  --footer-head: #ffffff;
  --footer-ink: #c3cbd4;
  --footer-dim: #8794a2;
  --footer-line: #1e262f;

  --toast-bg: #edf1f5;
  --toast-ink: #111820;
  --toast-accent: #1d5fe0;
  --toast-hover: rgba(17, 24, 32, 0.08);

  --ok: #6fd48f;
  --ok-tint: rgba(111, 212, 143, 0.14);

  /* 深色底上陰影幾乎看不見，層次主要靠表面的明度與外框 */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 10px 28px rgba(0, 0, 0, 0.45);
  --shadow-3: 0 24px 56px rgba(0, 0, 0, 0.6);
  --shadow-blue: 0 4px 14px rgba(47, 107, 240, 0.3);

  --hover: rgba(237, 241, 245, 0.07);
  --well: rgba(237, 241, 245, 0.07);
  --seam: rgba(237, 241, 245, 0.07);
  --label-bg: #ffffff;
  --label-ink: #111820;
}

@media (max-width: 680px) {
  :root {
    --gutter: 24px;
    --header-h: 64px;
  }
}

/* ---------------- 基本元素 ---------------- */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

/* 標頭固定在上方：鍵盤移動焦點而捲動時，停在標頭下方 16px，焦點框才不會被標頭蓋住。
   這段留白要小於 .cat-nav 黏住的位移（標頭 + 24px），否則聚焦黏住的類別時頁面會跳動 */
html {
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: 40px;
  font-weight: 900;
  line-height: 1.15;
}

h2 {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.3;
}

h3,
h4 {
  font-weight: 700;
}

a {
  color: inherit;
}

/* 選取文字的底色跟著品牌藍 */
::selection {
  background: color-mix(in srgb, var(--link) 26%, transparent);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mono {
  font-family: var(--mono);
}

/* 用 --link 而非 --blue：暗色主題的 --blue 是白字按鈕用的深藍，畫在深色底或淡藍底（已勾選的列）上不到 3:1；亮色主題兩者同色 */
:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

/* 外部連結標記 ↗ */
.ext {
  margin-left: 4px;
  font-size: 12px;
  color: var(--ink-3);
}

/* ---------------- 標頭（訪客與登入者共用） ---------------- */

/* 高於遮罩（65）與抽屜／下拉選單（70），選單打開時仍能按標頭的關閉鈕 */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 75;
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--header-h);
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
}

/* 訪客：左右留白與頁面內容相同，標誌對齊下方內容 */
.shell--site .topbar {
  padding-inline: var(--pad-x);
}

/* 登入者：標誌對齊下方側欄的圖示欄（側欄留白 12px + 項目留白 12px） */
.shell--member .topbar {
  padding-inline: 24px 16px;
}

/* 圓角只是讓鍵盤焦點框跟著圓 */
.brand {
  display: flex;
  align-items: center;
  flex: none;
  gap: 10px;
  border-radius: 12px;
  font-size: 16px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.brand b {
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-logo {
  flex: none;
  width: 32px;
  height: 32px;
}

.brand-text {
  font-weight: 500;
  color: var(--ink-2);
}

/* 圓形圖示鈕：主題切換與窄螢幕的選單鈕 */
.menu-btn,
.theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.menu-btn:hover,
.theme-btn:hover {
  background: var(--hover);
  color: var(--ink);
}

.menu-btn svg,
.theme-btn svg {
  width: 18px;
  height: 18px;
}

/* 選單鈕只在 ≤1080px 出現 */
.menu-btn {
  display: none;
}

/* 訪客的選單鈕放在最右側；登入者的留在最左，因為抽屜從左側滑出 */
.shell--site .menu-btn {
  order: 5;
}

.shell--site .theme-btn {
  margin-left: auto;
}

/* ---------------- 訪客標頭：上方導覽與登入鈕 ---------------- */

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 32px;
}

.site-nav-link {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.site-nav-link:hover {
  background: var(--hover);
  color: var(--ink);
}

/* 目前位置不只靠顏色（暗色主題的 --link 與 --ink-2 亮度幾乎相同，強制色彩模式下底色也會被移除）；
   上方導覽到 1081px 仍要放得下，用底線而不加粗（加粗會變寬） */
.site-nav-link.active {
  background: var(--tint);
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

.header-cta {
  display: flex;
  align-items: center;
  flex: none;
  height: 40px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: var(--shadow-blue);
  color: var(--on-blue);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.header-cta:hover {
  background: var(--blue-hover);
}

/* ---------------- 訪客下拉選單（只在 ≤1080px 出現，見響應式） ---------------- */

.site-menu {
  display: none;
}

.site-menu-link {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.site-menu-link:hover {
  background: var(--hover);
}

/* 字重也標示目前位置，不只靠顏色 */
.site-menu-link.active {
  background: var(--tint);
  color: var(--link);
  font-weight: 700;
}

/* 本身是 .btn，這裡只管位置 */
.site-menu .site-menu-cta {
  margin-top: 12px;
}

/* ---------------- 登入者標頭：模式切換與右側連結 ---------------- */

/* 分段切換：灰色軌道上，目前的模式是藍色實心膠囊（白色膠囊與灰軌道對比太低，看不出開著哪個模式） */
.mode-switch {
  display: flex;
  align-items: center;
  flex: none;
  gap: 2px;
  margin-left: 16px;
  padding: 4px;
  border-radius: 999px;
  background: var(--well);
}

/* 透明外框在強制色彩模式下會畫成系統色外框，與選取的實心膠囊區分 */
.mode-switch button {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.mode-switch button:hover {
  color: var(--ink);
}

.mode-switch button.active {
  background: var(--blue);
  box-shadow: var(--shadow-blue);
  color: var(--on-blue);
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

/* 「登出」是 button，外觀與兩個連結相同 */
.topbar-nav a,
.topbar-nav .header-link {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.topbar-nav a:hover,
.topbar-nav .header-link:hover {
  background: var(--hover);
  color: var(--ink);
}

/* ---------------- 側欄（僅登入後） ---------------- */

/* 收縮／展開的動畫中寬度會暫時變窄，文字一律不換行，超出的部分由 overflow 裁掉。
   scroll-padding：鍵盤移動焦點而捲動時上下留白，焦點框不會被側欄邊緣裁掉 */
.sidenav {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: var(--sidenav-w);
  padding: 12px 12px 0;
  border-right: 1px solid var(--line);
  background: var(--bg);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-top: 12px;
  scroll-padding-bottom: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--field-line) transparent;
  white-space: nowrap;
}

.sidenav-user {
  display: flex;
  align-items: center;
  flex: none;
  border-radius: 16px;
  background: var(--floor);
}

.sidenav-user-main {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 12px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 16px;
  color: var(--ink);
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.sidenav-user-main:hover {
  background: var(--tint);
}

.sidenav-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--link);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

/* 頭像與滑過時的底色相同，改用卡片色才不會消失 */
.sidenav-user-main:hover .sidenav-avatar {
  background: var(--card);
}

.sidenav-user-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidenav-user-name {
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidenav-user-sub {
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-3);
}

/* 滑過的淡藍底上 --ink-3 在暗色主題不到 4.5:1 */
.sidenav-user-main:hover .sidenav-user-sub {
  color: var(--ink-2);
}

.sidenav-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 36px;
  height: 36px;
  margin-right: 6px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sidenav-logout:hover {
  background: var(--card);
  color: var(--ink);
}

.sidenav-logout svg {
  width: 18px;
  height: 18px;
}

/* 三組之間 16px：項目多，排緊一點，比側欄矮的視窗少捲動一些 */
.sidenav-group {
  flex: none;
  margin-top: 16px;
}

/* 第一組（首頁）沒有組名，緊接在有底色的使用者卡片下方，12px 就分得開 */
.sidenav-user + .sidenav-group {
  margin-top: 12px;
}

.sidenav-label {
  margin-bottom: 4px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}

/* 桌面版排緊一點（36px），一個畫面多看到幾項；抽屜（觸控）恢復 44px，見響應式 */
.sidenav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sidenav-ic {
  width: 18px;
  height: 18px;
  color: var(--ink-3);
  transition: color 0.15s ease;
}

.sidenav-item:hover {
  background: var(--hover);
  color: var(--ink);
}

.sidenav-item:hover .sidenav-ic {
  color: var(--ink-2);
}

/* 字重也標示目前位置，不只靠顏色 */
.sidenav-item.active {
  background: var(--tint);
  color: var(--link);
  font-weight: 700;
}

/* 目前頁面左側的指示燈條（像機櫃上亮著的那一格） */
.sidenav-item.active::before {
  content: "";
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--link);
}

.sidenav-item.active .sidenav-ic {
  color: var(--link);
}

/* 內部連結的 .ext 是空的；外部連結的箭頭靠右 */
.sidenav-item .ext {
  margin-left: auto;
}

.sidenav-foot {
  flex: none;
  margin-top: auto;
  padding: 24px 12px 8px;
  font-size: 12px;
  color: var(--ink-3);
}

/* 選單過長而捲動時，收縮鈕仍黏在側欄底部；底色不透明，下方留 12px。
   z-index 讓按鈕自成一層，下方的 ::after 色帶才會畫在鍵盤焦點框底下 */
.sidenav-collapse {
  position: sticky;
  bottom: 12px;
  z-index: 1;
  display: flex;
  align-items: center;
  flex: none;
  gap: 12px;
  width: 100%;
  height: 44px;
  margin-bottom: 12px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

/* 黏住時要蓋住捲過去的選項：方形的底從按鈕頂端鋪到下方 12px，
   按鈕圓角外的缺口也蓋住（否則底下的圖示會從圓角旁露出來） */
.sidenav-collapse::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: -1;
  height: calc(100% + 12px);
  background: var(--bg);
}

/* 按鈕上方的漸層：選單比視窗長時，看得出下面還有項目可以捲 */
.sidenav-collapse::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  height: 24px;
  background: linear-gradient(to top, var(--bg), transparent);
  pointer-events: none;
}

/* 底色不透明（要蓋住捲過去的選項），滑過時疊上一層 --hover */
.sidenav-collapse:hover {
  background-image: linear-gradient(var(--hover), var(--hover));
  color: var(--ink);
}

.sidenav-collapse svg {
  width: 18px;
  height: 18px;
}

/* ---------------- 遮罩（窄螢幕的側欄抽屜／下拉選單） ---------------- */

/* 只在 ≤1080px 使用：視窗從窄拉寬時選單狀態可能還開著，寬螢幕上不該蓋住頁面。
   從標頭下方開始：半透明的標頭疊上遮罩會變灰，模式切換的灰色軌道也會看不見 */
.backdrop {
  position: fixed;
  inset: var(--header-h) 0 0;
  z-index: 65;
  display: none;
  background: var(--backdrop);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

/* ---------------- 主欄 ---------------- */

/* 直向 flex：頁尾（只有訪客有）以 margin-top: auto 推到底部 */
.main {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--header-h));
  margin-top: var(--header-h);
  background: var(--bg);
}

/* 訪客沒有側欄，內容滿版。
   後台的頁面底色是高架地板的灰，內容是放在地板上的白卡片：「塊」改成白底加細框與淡陰影 */
.shell--member .main {
  margin-left: var(--sidenav-w);
  background: var(--floor);
  --tile: var(--card);
  --tile-line: var(--line);
  --tile-shadow: var(--shadow-1);
  --tile-chip: var(--floor);
  --card-shadow: var(--shadow-1);
}

/* 卡片裡的「塊」回到灰底凹槽（卡片本身已經是白的）；
   後台裡的品牌頁內容（非系網人員看到的關於我們、團隊成員）維持前台的白頁 */
.ov-card,
.order-col,
.duty-card,
.ck-summary,
.ck-item,
.table-wrap,
.shell--member .form-panel,
.shell--member .site {
  --tile: var(--floor);
  --tile-line: transparent;
  --tile-shadow: none;
  --tile-chip: var(--card);
}

.shell--member .site {
  background: var(--bg);
  --card-shadow: none;
}

/* ---------------- 頁首與麵包屑 ---------------- */

.page-head {
  padding: 56px var(--pad-x) 28px;
}

/* 只有子頁面（新增、修改、類別管理）才有麵包屑 */
.crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--ink-2);
}

.crumb-link {
  color: var(--ink-2);
  text-decoration: none;
  transition: color 0.15s ease;
}

.crumb-link:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.crumb-sep {
  color: var(--ink-3);
}

.crumb-current {
  color: var(--ink);
}

.page-title {
  max-width: 24em;
  font-size: clamp(30px, 3.4vw, 48px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.page-sub {
  max-width: 40em;
  margin-top: 12px;
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink-2);
}

/* 後台是每天工作的地方：頁首比前台小一級、排緊一點，把畫面留給內容 */
.shell--member .page-head {
  padding: 40px var(--pad-x) 20px;
}

.shell--member .page-title {
  font-size: clamp(26px, 2.6vw, 34px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0;
}

.shell--member .page-sub {
  max-width: 48em;
  margin-top: 8px;
  font-size: 15px;
}

/* ---------------- 頁面內容 ---------------- */

.page-body {
  padding: 8px var(--pad-x) 96px;
}

.manage-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

/* 在工具列裡與搜尋框並排，間距由工具列負責 */
.manage-bar--inline {
  margin-bottom: 0;
}

/* ---------------- 響應式 ---------------- */

/* 收縮成圖示列只在桌面版生效；窄螢幕的抽屜一律顯示完整文字 */
@media (min-width: 1081px) {
  .sidenav,
  .shell--member .main {
    transition: width 0.2s ease, margin-left 0.2s ease;
  }

  /* 鍵盤移動焦點時，選項不要停在黏住的收縮鈕與它上方的漸層後面（按鈕 44px + 下方 12px + 漸層 24px） */
  .sidenav {
    scroll-padding-bottom: 88px;
  }

  /* 圖示列很窄，捲軸會把圖示擠偏；仍可用滾輪、觸控板或鍵盤捲動。
     標籤與頁尾隱藏後，頭像、群組與收縮鈕之間一律隔 12px，
     捲到底時最後一個選項才不會貼著收縮鈕（焦點框下緣會被蓋住） */
  html.nav-collapsed .sidenav {
    width: var(--rail-w);
    row-gap: 12px;
    scrollbar-width: none;
  }

  html.nav-collapsed .shell--member .main {
    margin-left: var(--rail-w);
  }

  /* 圖示列的圖示置中在 72px 欄內（中心約 36px），標誌跟著左移對齊 */
  html.nav-collapsed .shell--member .topbar {
    padding-left: 20px;
  }

  html.nav-collapsed .sidenav-label,
  html.nav-collapsed .sidenav-user-text,
  html.nav-collapsed .sidenav-logout,
  html.nav-collapsed .sidenav-text,
  html.nav-collapsed .sidenav-item .ext,
  html.nav-collapsed .sidenav-foot,
  html.nav-collapsed .sidenav-collapse-label {
    display: none;
  }

  /* 上下各留 6px，頭像外的灰底接近正方形，不會只剩頭像的高度 */
  html.nav-collapsed .sidenav-user-main {
    justify-content: center;
    padding: 6px 0;
  }

  /* 間距改由上面的 row-gap 負責 */
  html.nav-collapsed .sidenav-group {
    margin-top: 0;
  }

  html.nav-collapsed .sidenav-item {
    justify-content: center;
    padding: 0;
  }

  /* 收縮後只剩圖示，淡藍底與圖示的色差不足 3:1，改用實心藍底白圖示。
     透明外框平常看不見，強制色彩模式移除底色時會畫成外框；
     圖示顏色繼承自連結，強制色彩模式下才會一起換成系統色（直接指定白色在淺色對比主題中會變成白底白圖示） */
  html.nav-collapsed .sidenav-item.active {
    border: 2px solid transparent;
    background: var(--blue);
    color: var(--on-blue);
  }

  html.nav-collapsed .sidenav-item.active .sidenav-ic {
    color: inherit;
  }

  /* 整格已經是實心藍，不需要左側的指示燈條 */
  html.nav-collapsed .sidenav-item.active::before {
    display: none;
  }

  /* 圖示列放不下並排的徽章：縮小後疊在圖示的右上角 */
  html.nav-collapsed .sidenav-badge {
    position: absolute;
    top: 1px;
    right: 3px;
    min-width: 16px;
    margin: 0;
    padding: 0 4px;
    font-size: 10px;
    line-height: 16px;
    text-align: center;
  }

  /* 頁尾文字隱藏後，改由收縮鈕自己推到底部 */
  html.nav-collapsed .sidenav-collapse {
    justify-content: center;
    margin-top: auto;
    padding: 0;
  }
}

@media (max-width: 1280px) {
  /* 上方導覽到 1081px 仍要放得下 */
  .site-nav-link {
    padding: 0 10px;
  }
}

@media (max-width: 1080px) {
  .menu-btn {
    display: flex;
  }

  .backdrop {
    display: block;
  }

  /* 側欄改為從左側滑出的抽屜；關閉時一併隱藏，鍵盤不會跳到畫面外的連結 */
  .sidenav {
    z-index: 70;
    padding-bottom: 12px;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0s linear 0.2s;
  }

  .sidenav.open {
    transform: none;
    visibility: visible;
    box-shadow: var(--shadow-3);
    transition: transform 0.2s ease;
  }

  /* 抽屜多半用手指點：項目恢復 44px 高、15px 字 */
  .sidenav-item {
    height: 44px;
    border-radius: 12px;
    font-size: 15px;
  }

  .sidenav-item.active::before {
    top: 12px;
    bottom: 12px;
  }

  /* 收縮只在桌面版生效，抽屜中不顯示 */
  .sidenav-collapse {
    display: none;
  }

  .shell--member .main {
    margin-left: 0;
  }

  /* 訪客：上方導覽收進標頭下方的下拉選單 */
  .site-nav {
    display: none;
  }

  /* 關閉時延後隱藏 visibility，淡出動畫才看得到。
     畫面矮（手機橫放）時選單會捲動，scroll-padding 讓焦點框不被上下緣裁掉 */
  .site-menu {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    z-index: 70;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: calc(100svh - var(--header-h));
    padding: 12px var(--pad-x) 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-padding-top: 12px;
    scroll-padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
    border-radius: 0 0 24px 24px;
    background: var(--bg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
  }

  .site-menu.open {
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: var(--shadow-3);
    transition: opacity 0.15s ease, transform 0.15s ease;
  }
}

@media (max-width: 900px) {
  /* 清單頁多了模式切換，900px 以下標頭放不下這三個連結；
     官網、個人資訊、登出在側欄抽屜裡都有 */
  .topbar-nav {
    display: none;
  }

  .shell--member .theme-btn {
    margin-left: auto;
  }
}

@media (max-width: 680px) {
  .shell--member .topbar {
    padding-inline: 16px;
  }

  .mode-switch {
    margin-left: 0;
  }

  .mode-switch button {
    padding: 0 12px;
  }

  .mode-long {
    display: none;
  }

  .header-cta {
    padding: 0 18px;
  }

  .page-head {
    padding-top: 40px;
    padding-bottom: 20px;
  }

  .shell--member .page-head {
    padding-top: 28px;
    padding-bottom: 16px;
  }

  .page-sub {
    font-size: 16px;
  }

  .page-body {
    padding-bottom: 64px;
  }
}

@media (max-width: 480px) {
  .brand-text {
    display: none;
  }

  /* 320px 寬（小手機或放大 400%）時，清單頁的標頭也要放得下模式切換與主題鈕 */
  .shell--member .topbar {
    gap: 6px;
    padding-inline: 12px;
  }

  .mode-switch {
    gap: 0;
  }

  .mode-switch button {
    padding: 0 10px;
  }
}

/* ---------------- 強制色彩模式 ---------------- */

/* 系統色會蓋掉藍底，兩個按鈕都只剩外框；選取的模式保留藍底白字 */
@media (forced-colors: active) {
  .mode-switch button.active {
    forced-color-adjust: none;
  }
}

/* ---------------- 按鈕 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease,
    transform 0.1s ease;
}

/* 按下去的回饋：微微縮小（回應操作的動態，不是自動播放的動畫） */
.btn:active {
  transform: scale(0.98);
}

/* 處理中、上傳中：看得出暫時不能按 */
.btn:disabled {
  box-shadow: none;
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  background: var(--blue);
  box-shadow: var(--shadow-blue);
  color: var(--on-blue);
}

.btn--primary:hover {
  background: var(--blue-hover);
}

/* 外框按鈕：次要操作，也用在主視覺等淺色底上 */
.btn--secondary {
  border-color: var(--line);
  background-color: var(--card);
  box-shadow: var(--shadow-1);
  color: var(--ink);
}

/* 白底疊上一層 --hover，外框加深：在白頁與灰地板上都看得出滑過 */
.btn--secondary:hover {
  border-color: var(--field-line);
  background-image: linear-gradient(var(--hover), var(--hover));
}

.btn--ghost {
  color: var(--link);
}

.btn--ghost:hover {
  background: var(--tint);
}

.btn--danger-ghost {
  color: var(--danger);
}

.btn--danger-ghost:hover {
  background: var(--danger-tint);
}

.btn--danger {
  background: var(--danger-solid);
  color: var(--on-danger);
}

.btn--danger:hover {
  background: var(--danger-solid-hover);
}

/* 黃色服務承諾面板上的深色按鈕 */
.btn--ink {
  background: var(--on-yellow);
  color: var(--on-blue);
}

.btn--ink:hover {
  background: var(--ink-btn-hover);
}

.btn--sm {
  min-height: 36px;
  padding: 0 14px;
  font-size: 14px;
}

.btn--block {
  width: 100%;
}

/* 外部連結標記跟著按鈕文字顏色；與文字的間距交給按鈕的 gap */
.btn .ext {
  margin-left: 0;
  color: inherit;
  opacity: 0.8;
}

.btn-ic {
  width: 16px;
  height: 16px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

/* ---------------- 列內刪除確認 ---------------- */

.confirm-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.confirm-text {
  margin: 0 4px;
  font-size: 14px;
  color: var(--danger);
  white-space: nowrap;
}

/* ---------------- 連結清單（標題＋網址） ---------------- */

/* 列內操作按鈕要不要換到標題下方，看清單本身的寬度（見響應式的容器查詢） */
.link-list {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.link-row {
  display: flex;
  align-items: center;
  border: 1px solid var(--tile-line);
  border-radius: 18px;
  background: var(--tile);
  box-shadow: var(--tile-shadow);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

/* 只有連結列有懸停底色（類別管理列的 .link-main 是 span）；
   指標移到右側操作按鈕時不上色，按鈕自己的懸停底色才看得出來 */
.link-row:has(> a.link-main:hover) {
  border-color: transparent;
  background: var(--tint);
}

/* 圓角跟著整列，鍵盤焦點框才會貼合列的外形 */
.link-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 22px;
  border-radius: inherit;
  color: var(--ink);
  text-decoration: none;
  transition: color 0.15s ease;
}

a.link-main:hover {
  color: var(--link);
}

/* max-width：窄螢幕的列改成直排時，不讓不斷行的摘要（.link-desc）把寬度撐出列外 */
.link-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
}

/* 搜尋結果的出處：區塊 › 類別 */
.link-place {
  font-size: 13px;
  color: var(--ink-3);
}

.link-title {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

/* 後台清單的內容摘要只顯示一行，完整內容在修改頁 */
.link-desc {
  overflow: hidden;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 網域或檔案類型；網域可長達三十多個字元，限制寬度以免把標題擠成一欄 */
.link-kind {
  flex: none;
  max-width: 40%;
  overflow: hidden;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--tile-chip);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 整列變成淡藍底時，標籤一律用卡片色才分得出來 */
.link-row:has(> a.link-main:hover) .link-kind {
  background: var(--card);
}

.row-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
}

/* ---------------- 搜尋與工具列 ---------------- */

.search {
  position: relative;
  width: 100%;
  max-width: 640px;
}

.search-ic {
  position: absolute;
  top: calc(50% - 9px);
  left: 18px;
  width: 18px;
  height: 18px;
  color: var(--ink-2);
  pointer-events: none;
}

/* block 才不會在輸入框下方多出行高空隙，圖示的垂直置中依賴外框高度 */
.search-input {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 20px 0 48px;
  border: 1px solid var(--field-line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}

/* Safari 的搜尋欄位左側另有一段裝飾留白 */
.search-input::-webkit-search-decoration {
  -webkit-appearance: none;
}

/* Firefox 預設會把提示文字調淡 */
.search-input::placeholder {
  color: var(--ink-3);
  opacity: 1;
}

/* 以藍框加淡藍光暈取代焦點外框；透明外框在強制色彩模式下仍會顯示 */
.search-input:focus {
  outline: 2px solid transparent;
  border-color: var(--link);
  box-shadow: 0 0 0 3px var(--tint);
}

.search-summary {
  margin: 16px 0 12px;
  font-size: 14px;
  color: var(--ink-2);
}

.cat-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.cat-toolbar .search {
  flex: 1 1 320px;
}

/* ---------------- 提示框與管理模式提示列 ---------------- */

.note-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 16px;
  background: var(--tint);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
}

/* 提示框緊接著表格或清單時隔開一點，不要貼在一起 */
.note-box + .table-wrap,
.note-box + .ck-list,
.note-box + .link-list {
  margin-top: 16px;
}

/* 對齊第一行文字的中線 */
.note-ic {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  color: var(--link);
}

.manage-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding: 10px 10px 10px 18px;
  border-radius: 16px;
  background: var(--warn-tint);
  font-size: 15px;
  color: var(--ink);
}

.manage-banner .note-ic {
  margin-top: 0;
  color: var(--warn);
}

/* 放不下時按鈕換到下一行並靠右，不把說明擠成每行幾個字；
   基準寬度不超過圖示（18px＋間距 12px）右側的空間，最窄的手機上圖示仍與說明同一行 */
.manage-banner-text {
  flex: 1 1 min(240px, 100% - 30px);
}

.manage-banner .btn {
  margin-left: auto;
}

/* ---------------- 類別瀏覽 ---------------- */

.cat-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

/* 類別多時會比視窗高，改在清單內捲動，下面的類別才點得到 */
.cat-nav {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--field-line) transparent;
}

.cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.cat-item:hover {
  background: var(--hover);
  color: var(--ink);
}

/* 字重也標示目前的類別，不只靠顏色 */
.cat-item.active {
  background: var(--tint);
  color: var(--link);
  font-weight: 700;
}

/* 清單會捲動，焦點框畫在內側才不會被裁掉 */
.cat-item:focus-visible {
  outline-offset: -2px;
}

/* 後台（寬螢幕）：類別欄是一張白卡片；≤900px 改成橫向膠囊時不需要 */
@media (min-width: 901px) {
  .shell--member .cat-nav {
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--card);
    box-shadow: var(--card-shadow);
  }
}

.cat-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.cat-count {
  flex: none;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--well);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  transition: background-color 0.15s ease;
}

/* 項目本身變成灰底或淡藍底時，數字標籤改用卡片底色才分得出來 */
.cat-item:hover .cat-count,
.cat-item.active .cat-count {
  background: var(--card);
}

.cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 36px;
  margin-bottom: 16px;
}

.cat-head h2 {
  font-size: 22px;
  font-weight: 800;
}

/* ---------------- 資料表格 ---------------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--card-shadow);
}

.data-table {
  width: 100%;
  min-width: 640px;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table th {
  padding: 14px 18px;
  background: var(--floor);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  text-align: left;
  white-space: nowrap;
}

/* FTP 路徑、機器名稱是很長的連續字串；anywhere 才會降低欄位的最小寬度（break-word 不會），
   表格才縮得進外框，操作欄不會被擠到捲動範圍外 */
.data-table td {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  font-size: 15px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.data-table tbody tr:hover {
  background: var(--floor);
}

.data-table td.mono {
  font-size: 14px;
}

.th-actions,
.td-actions {
  width: 1%;
  white-space: nowrap;
}

.data-table .td-actions {
  padding: 8px 12px;
}

/* 「修改」與「刪除」或刪除確認之間的間距 */
.td-actions > * + * {
  margin-left: 4px;
}

/* ---------------- 表單 ---------------- */

.form-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 640px;
}

.form-panel > .btn-row {
  margin-top: 0;
}

/* 後台的表單是放在地板上的一張白卡片 */
.shell--member .form-panel {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--card-shadow);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

/* 16px 字級避免手機瀏覽器在聚焦時放大頁面 */
.input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--field-line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font-size: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:hover:not(:disabled):not(:focus):not([aria-invalid="true"]) {
  border-color: var(--ink-2);
}

.input::placeholder {
  color: var(--ink-3);
  opacity: 1;
}

.input:focus {
  outline: 2px solid transparent;
  border-color: var(--link);
  box-shadow: 0 0 0 3px var(--tint);
}

.input[aria-invalid="true"] {
  border-color: var(--danger);
}

/* 錯誤欄位平時就是紅框，聚焦時改畫實線焦點框才看得出來（淡紅光暈與底色不到 1.2:1） */
.input[aria-invalid="true"]:focus {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
  box-shadow: none;
}

/* iOS Safari 會把停用欄位再調淡，固定文字顏色與不透明度 */
.input:disabled {
  border-color: var(--line);
  background: var(--floor);
  color: var(--ink-3);
  -webkit-text-fill-color: var(--ink-3);
  opacity: 1;
  cursor: not-allowed;
}

.textarea {
  height: auto;
  min-height: 120px;
  padding: 12px 16px;
  line-height: 1.6;
  resize: vertical;
}

.select {
  padding-right: 12px;
  cursor: pointer;
}

/* 表格列內的小型下拉選單（帳號管理的角色） */
.select--sm {
  width: auto;
  height: 36px;
  padding: 0 8px 0 12px;
  border-radius: 10px;
  font-size: 14px;
}

/* 勾選後的填色與焦點框同為 --link，在已勾選列的淡藍底上才看得清楚；瀏覽器會依填色自動改用深色勾號 */
.checkbox {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--link);
  cursor: pointer;
}

.field-help {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
}

.field > .field-help {
  margin-top: -2px;
}

/* 緊接在上一個欄位下方，抵銷外層的間距 */
.field-error {
  margin-top: -12px;
  font-size: 13px;
  color: var(--danger);
}

.field-link {
  margin-left: 8px;
  color: var(--link);
  white-space: nowrap;
}

.url-row {
  display: flex;
  gap: 8px;
}

.url-row .input {
  flex: 1;
  min-width: 0;
}

/* 「選擇檔案」是包住原生檔案欄位的 label，高度與輸入框一致 */
.file-btn {
  position: relative;
  flex: none;
  min-height: 48px;
}

/* 原生欄位看不見，鍵盤焦點改畫在外層按鈕上 */
.file-btn:focus-within {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

/* 用滑鼠點「選擇檔案」也會讓原生欄位取得焦點；與全站一致，只在鍵盤操作時顯示焦點框
   （不支援 :has() 的瀏覽器略過這條，維持上面的 :focus-within） */
.file-btn:has(.file-input:focus:not(:focus-visible)) {
  outline: none;
}

/* 原生檔案選擇欄位隱藏但仍可被鍵盤聚焦 */
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* 段落照片：縮圖排成格狀，欄數依表單寬度自動增減 */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* 縮圖、檔名與移除鈕置中排成一欄 */
.photo-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  text-align: center;
}

/* 原圖是直式 900×1200，縮圖維持同樣比例 */
.photo-thumb {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 16px;
  background: var(--floor);
}

/* 還沒上傳的照片沒有預覽：灰底上放上傳圖示與說明 */
.photo-thumb--new {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
}

.photo-thumb--new svg {
  width: 24px;
  height: 24px;
}

.photo-name {
  max-width: 100%;
  font-size: 13px;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

/* 欄位是直向 flex，按鈕不撐滿整欄 */
.photo-add {
  align-self: flex-start;
}

/* ---------------- 響應式 ---------------- */

/* 操作按鈕換到標題下方，佔滿整列；依清單寬度而非視窗：登入後清單左邊還有側欄與類別欄，
   1081px 視窗的類別清單只剩約 420px。1366px 筆電（含捲軸）的類別清單約 705px，仍排成一列。
   左右留白讓按鈕文字與標題對齊（7px + 按鈕外框 1px + 按鈕留白 14px = 標題的 22px）。
   最窄的手機上，刪除確認（確定刪除？＋刪除＋取消）放不下時換到下一行，不超出列外 */
@container (max-width: 680px) {
  .link-row {
    flex-wrap: wrap;
  }

  .link-main {
    flex-basis: 100%;
  }

  .row-actions {
    flex-wrap: wrap;
    width: 100%;
    padding: 0 7px 12px;
  }
}

@media (max-width: 900px) {
  .cat-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  /* 類別改為可橫向捲動的一排 */
  .cat-nav {
    position: static;
    flex-direction: row;
    gap: 6px;
    max-height: none;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  /* 橫排時與其他橫向控制項一樣是膠囊 */
  .cat-item {
    flex: none;
    border-radius: 999px;
    white-space: nowrap;
  }
}

@media (max-width: 680px) {
  .link-main {
    padding: 16px 18px;
  }

  /* 標題留白縮為 18px，按鈕跟著左移對齊（3px + 1px + 14px） */
  .row-actions {
    padding-inline: 3px;
  }
}

@media (max-width: 480px) {
  /* 網域標籤移到標題下方，標題用滿整列寬 */
  .link-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .link-kind {
    max-width: 100%;
  }
}

/* ---------------- 首頁（登入後）：成員工作台 ---------------- */

.member-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 40px var(--pad-x) 28px;
}

.member-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.member-panel-kicker {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}

/* 字級來自同一元素上的 .page-title；帳號是任意字串，過長時允許任意處斷開，不撐破版面 */
.member-panel-title {
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.member-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* 區段標題（工作台的各組入口、值班排程與通知設定的各段）：與上一段隔開 36px */
.dash-heading {
  margin: 36px 0 14px;
  font-size: 20px;
  font-weight: 800;
}

/* 頁面的第一個標題、緊接在工具列之後的標題，以及表單卡片裡的標題（卡片本身有 24px 間距）不需要那麼大的留白 */
.dash-heading:first-child,
.manage-bar + .dash-heading,
.search-summary + .dash-heading,
.form-panel .dash-heading {
  margin-top: 8px;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(248px, 100%), 1fr));
  gap: 12px;
}

/* 入口是橫列：圖示在左、標題與說明在右。二十個入口排成一頁看得完，不必捲很長 */
.dash-tile {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 2px 14px;
  padding: 16px 18px;
  border: 1px solid var(--tile-line);
  border-radius: 20px;
  background: var(--tile);
  box-shadow: var(--tile-shadow);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dash-tile:hover {
  border-color: var(--link);
  box-shadow: var(--shadow-2);
}

/* 圖示放在淡藍的圓角方塊上，跨標題與說明兩列 */
.dash-ic {
  grid-row: span 2;
  width: 44px;
  height: 44px;
  padding: 11px;
  border-radius: 14px;
  background: var(--tint);
  color: var(--link);
}

.dash-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  transition: color 0.15s ease;
}

.dash-tile:hover .dash-title {
  color: var(--link);
}

/* 說明只有一行，放不下就截斷（完整的數字在各頁面裡） */
.dash-meta {
  overflow: hidden;
  font-size: 13px;
  color: var(--ink-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------- 機房檢核 ---------------- */

.idc-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 880px;
}

/* 說明文字緊接在日期列下方，與它是同一組 */
.idc-form > .field-help {
  margin-top: -16px;
}

.idc-form > .btn-row {
  margin-top: 0;
}

.idc-date {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.idc-date .field {
  width: 220px;
}

/* 與日期輸入框同高 */
.idc-date .btn {
  min-height: 48px;
}

.idc-progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.progress-label {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.progress {
  flex: 1 1 160px;
  max-width: 320px;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--well);
}

/* 寬度的變化本身就是回饋（勾選後看得到進度往前），所以這裡例外地轉場 width */
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--blue);
  transition: width 0.2s ease;
}

.idc-bulk {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

/* 只有三欄：窄螢幕不需要表格的最小寬度與橫向捲動 */
.data-table.idc-table {
  min-width: 0;
}

.th-no,
.td-no,
.th-check,
.td-check {
  width: 96px;
}

/* 表頭預設靠左，勾選欄要與下方的勾選框對齊 */
.data-table th.th-check,
.data-table td.td-check {
  text-align: center;
}

.td-check .checkbox {
  vertical-align: middle;
}

/* 檢核編號只是序號：內文字體，數字等寬才會對齊 */
.td-no {
  font-variant-numeric: tabular-nums;
}

/* 點項目文字也能勾選（label 對應同列的勾選框） */
.td-item label {
  display: block;
  cursor: pointer;
}

.idc-table td {
  transition: background-color 0.15s ease, color 0.15s ease;
}

/* 已勾選的列整列染色，一眼看出還有哪些沒檢查 */
.idc-table tbody tr.is-checked td {
  background: var(--tint);
  color: var(--ink-2);
}

/* 相鄰的已勾選列：暗色主題下 --line 與淡藍底幾乎同色，分隔線改用頁面底色 */
.idc-table tbody tr.is-checked + tr.is-checked td {
  border-top-color: var(--bg);
}

/* 檢核紀錄的補充說明：保留使用者輸入的換行 */
.data-table .td-pre {
  white-space: pre-line;
}

/* 今日值班與值班表連結 */
.idc-duty {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 0 0 16px;
  font-size: 15px;
}

.idc-duty .text-link {
  font-size: 14px;
}

/* 有異狀不勾選時，在該項填原因 */
.idc-reason {
  height: 40px;
  margin-top: 8px;
  font-size: 15px;
}

/* 異狀原因與補充資訊超過 250 字 */
.field-help.field-help--over {
  color: var(--danger);
}

/* 資料載入中（全站資料第一次載入、個人資訊） */
.loading {
  margin: 24px 0;
  font-size: 14px;
  color: var(--ink-2);
}

/* ---------------- 團隊成員管理 ---------------- */

/* 姓名是每一列的識別：加粗、不斷行 */
.td-name {
  font-weight: 600;
  white-space: nowrap;
}

/* 證照數量：次要資訊，數字等寬 */
.data-table .td-count {
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------------- 待辦事項、帳號管理 ---------------- */

.td-progress,
.data-table .td-date {
  white-space: nowrap;
}

.progress.progress--sm {
  display: inline-block;
  width: 88px;
  height: 8px;
  vertical-align: middle;
}

.progress-num {
  margin-left: 8px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

/* 過了預計完成日還沒完成 */
.tag-late {
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--danger-tint);
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
}

/* 狀態標籤：除了顏色也有文字；前面的小圓點像設備面板上的狀態燈號 */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  vertical-align: middle;
}

.status::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}

.status--open {
  background: var(--tint);
  color: var(--link);
}

.status--pending {
  background: var(--warn-tint);
  color: var(--warn);
}

.status--disabled {
  background: var(--well);
  color: var(--ink-2);
}

/* 停用、未回報、尚未開始：燈沒亮（空心） */
.status--disabled::before {
  border: 1.5px solid currentColor;
  background: transparent;
}

.tag-self {
  margin-left: 6px;
  font-family: inherit;
  font-size: 12px;
  color: var(--ink-2);
}

/* 表單中的單一勾選框（例如待辦的「已完成」） */
.field.field--check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

/* 上傳中：按鈕暫停使用 */
.file-btn.is-busy {
  opacity: 0.7;
  pointer-events: none;
}

/* ---------------- 維運管理（原 ops-schedule）：值班排程、每日檢核、異常、訂閱、任務、專案、通知設定 ---------------- */

/* 區段標題下的一行說明 */
.section-note {
  margin: -8px 0 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-2);
}

.form-panel--wide {
  max-width: 880px;
}

.form-panel--wide .dash-heading {
  margin-bottom: 4px;
}

/* 狀態標籤：正常／已解決（綠）與異常／逾期（紅） */
.status--ok {
  background: var(--ok-tint);
  color: var(--ok);
}

.status--danger {
  background: var(--danger-tint);
  color: var(--danger);
}

/* 分類標籤：類型、優先級、手動指定；與狀態標籤同形但只用灰底 */
.tag-soft {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--well);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--ink-2);
  white-space: nowrap;
  vertical-align: middle;
}

td > .tag-soft:first-child,
.ov-strong > .tag-soft,
.duty-card-name > .tag-soft {
  margin-left: 6px;
}

.tag-soft--warn {
  background: var(--warn-tint);
  color: var(--warn);
}

.tag-soft--danger {
  background: var(--danger-tint);
  color: var(--danger);
}

/* 表格列的第二行說明 */
.td-sub {
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
}

.td-sub--late {
  color: var(--danger);
  font-weight: 600;
}

/* 名稱可以斷行（任務、訂閱、檢核項目的標題常常很長） */
.td-name--wrap {
  white-space: normal;
}

/* 停用或已完成的列淡化 */
.data-table tbody tr.is-off td {
  color: var(--ink-2);
}

/* 側欄「異常追蹤」的徽章 */
.sidenav-badge {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--danger-solid);
  color: var(--on-danger);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.sidenav-item .sidenav-badge + .ext {
  margin-left: 0;
}

/* 列內確認（非刪除）的提示文字用一般墨色 */
.confirm-text.confirm-text--plain {
  color: var(--ink-2);
  white-space: normal;
}

/* 圓形圖示鈕：上移、下移 */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-2);
  cursor: pointer;
}

.icon-btn:hover:not(:disabled) {
  border-color: var(--field-line);
  background-image: linear-gradient(var(--hover), var(--hover));
  color: var(--ink);
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* 勾選框的一列（工作日、篩選） */
.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.check-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  cursor: pointer;
}

fieldset.field {
  margin: 0;
  padding: 0;
  border: 0;
}

/* 篩選列：勾選框、分頁與下拉選單 */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  margin-bottom: 16px;
}

.filter-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-2);
}

.filter-select .input {
  width: auto;
  height: 40px;
  font-size: 15px;
}

/* 分頁式篩選（未解決／已解決、全部／有異常…）：膠囊，目前的加粗加淡藍底 */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 16px;
}

.filter-bar .tabs {
  margin-bottom: 0;
}

.tab {
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tab:hover {
  border-color: var(--field-line);
  color: var(--ink);
}

/* 目前的分頁：機櫃黑的實心膠囊，加粗（不只靠顏色） */
.tab.active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
  font-weight: 800;
}

/* 數字卡：待處理、逾期… */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.kpi-row--compact {
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  margin-bottom: 16px;
}

.kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 18px 16px;
  border: 1px solid var(--tile-line);
  border-radius: 18px;
  background: var(--tile);
  box-shadow: var(--tile-shadow);
}

.kpi-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}

.kpi-num {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.kpi-num--alert {
  color: var(--danger);
}

/* 本週系網之星 */
.duty-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 32px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--card-shadow);
}

.duty-card-name {
  display: block;
  font-size: 22px;
  font-weight: 800;
}

.duty-card-sub {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  color: var(--ink-2);
}

.duty-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* 排班月曆：七欄，每格是可按的值班日 */
.cal {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.cal-head,
.cal-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.cal-head > div {
  padding: 0 4px 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  text-align: center;
}

.cal-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 84px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  text-align: left;
}

button.cal-cell {
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

button.cal-cell:hover {
  border-color: var(--field-line);
  background-image: linear-gradient(var(--hover), var(--hover));
}

/* 休息日：沒有外框的凹槽 */
.cal-cell.is-off {
  border-color: transparent;
  background: var(--well);
  color: var(--ink-2);
}

/* 今天：藍色雙線外框 */
.cal-cell.is-today {
  border-color: var(--link);
  box-shadow: inset 0 0 0 1px var(--link);
}

.cal-cell.is-selected {
  background: var(--tint);
  border-color: var(--link);
}

.cal-date {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

.cal-cell.is-today .cal-date {
  font-weight: 800;
  color: var(--link);
}

.cal-name {
  font-size: 15px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.cal-name--none {
  font-weight: 400;
  color: var(--ink-3);
}

.cal-note {
  font-size: 12px;
  color: var(--ink-2);
}

/* 手動指定面板 */
.override-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
  padding: 18px 20px;
  border-radius: 20px;
  background: var(--tint);
}

.override-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  font-size: 15px;
}

.override-current {
  color: var(--ink-2);
}

.override-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
}

.override-field {
  flex: 1 1 240px;
  max-width: 360px;
}

.override-row .btn-row {
  margin-top: 0;
}

/* 輪值順序：兩欄 */
.order-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.order-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--card-shadow);
}

.order-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.order-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.order-head .btn {
  margin-left: auto;
}

.order-dirty {
  display: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--warn);
}

.order-dirty.show {
  display: inline;
}

.order-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.order-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 14px;
  border-radius: 14px;
  background: var(--floor);
}

.order-pos {
  min-width: 24px;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

.order-name {
  flex: 1;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* 每日檢核：已提交的確認卡 */
.done-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  padding: 40px 24px;
  border-radius: 24px;
  background: var(--ok-tint);
  text-align: center;
}

.done-card h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
}

.done-card p {
  max-width: 560px;
  margin: 0;
  line-height: 1.7;
}

.done-card .btn-row {
  justify-content: center;
  margin-top: 16px;
}

.done-ic {
  width: 56px;
  height: 56px;
  padding: 14px;
  border-radius: 999px;
  background: var(--card);
  color: var(--ok);
}

/* 進度摘要 */
.ck-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--card-shadow);
}

.ck-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
  margin: 0;
}

.ck-meta div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ck-meta dt {
  font-size: 13px;
  color: var(--ink-2);
}

.ck-meta dd {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.progress--ok .progress-fill {
  background: var(--ok);
}

.progress--danger .progress-fill {
  background: var(--danger-solid);
}

.note-box--warn {
  background: var(--warn-tint);
}

.note-box--warn .note-ic {
  color: var(--warn);
}

/* 檢核項目清單：每項一張卡，手機上按鈕夠大 */
.ck-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}

.ck-item {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--card-shadow);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ck-item.is-normal {
  border-color: transparent;
  background: var(--ok-tint);
}

.ck-item.is-abnormal {
  border-color: transparent;
  background: var(--danger-tint);
}

.ck-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.ck-mark {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--well);
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

.ck-mark svg {
  width: 18px;
  height: 18px;
}

.ck-item.is-normal .ck-mark {
  background: var(--ok);
  color: #fff;
}

.ck-item.is-abnormal .ck-mark {
  background: var(--danger-solid);
  color: var(--on-danger);
}

.ck-body {
  flex: 1;
  min-width: 0;
}

.ck-title {
  margin: 4px 0 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.ck-desc {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-2);
  white-space: pre-line;
}

/* 兩段式按鈕：正常／異常，整寬、至少 44px 高 */
.seg {
  display: flex;
  gap: 8px;
}

.seg > button {
  flex: 1;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--field-line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

/* 還沒按下的「正常／異常」：滑過時先透出各自的顏色 */
.seg-ok:hover:not(:disabled):not([aria-pressed="true"]) {
  border-color: var(--ok);
  background: var(--ok-tint);
  color: var(--ok);
}

.seg-bad:hover:not(:disabled):not([aria-pressed="true"]) {
  border-color: var(--danger);
  background: var(--danger-tint);
  color: var(--danger);
}

.seg-more:hover:not(:disabled) {
  border-color: var(--ink-2);
  background-image: linear-gradient(var(--hover), var(--hover));
}

.seg > button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.seg-ok[aria-pressed="true"] {
  border-color: var(--ok);
  background: var(--ok);
  color: #fff;
}

.seg-bad[aria-pressed="true"] {
  border-color: var(--danger-solid);
  background: var(--danger-solid);
  color: var(--on-danger);
}

.seg-more {
  flex: 0 1 auto;
}

/* 項目下方的異常 */
.ck-issues {
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--card);
}

.ck-item.is-abnormal .ck-issues,
.ck-item.is-normal .ck-issues {
  background: var(--bg);
}

.issues-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--danger);
}

.issues-note {
  font-weight: 400;
  color: var(--ink-2);
}

.issue-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.issue {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.issue-item {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.issue-text {
  margin: 0;
  line-height: 1.6;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.issue-meta {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
}

.issue-meta .tag-soft {
  margin: 0 4px 0 0;
}

.issue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* 列內展開的表單 */
.inline-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--floor);
}

.inline-form .textarea {
  min-height: 88px;
}

.inline-form .btn-row {
  margin-top: 0;
}

.ck-orphans {
  margin-bottom: 24px;
}

/* 提交列 */
.ck-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: 24px;
  padding: 16px 20px;
  border: 1px solid var(--tile-line);
  border-radius: 20px;
  background: var(--tile);
  box-shadow: var(--tile-shadow);
}

.ck-hint {
  margin: 0;
  font-size: 14px;
  color: var(--ink-2);
}

.ck-bar .btn-row {
  margin-top: 0;
}

/* 檢核紀錄的展開列 */
.history-detail > td {
  padding: 0 18px 18px;
  background: var(--floor);
}

.history-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 12px;
}

.history-h {
  margin: 8px 0 0;
  font-size: 15px;
  font-weight: 800;
}

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0;
  font-size: 15px;
}

.kv dt {
  color: var(--ink-2);
}

.kv dd {
  margin: 0;
}

.kv--tight {
  margin-top: 12px;
  font-size: 14px;
}

.plain-list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
}

/* 訂閱表單的週期單位 */
.period-unit {
  flex: 0 0 120px;
}

/* 通知設定 */
.routes-table {
  min-width: 0;
}

.routes-table th:not(:first-child),
.routes-table td:not(:first-child) {
  width: 120px;
  text-align: center;
}

.secret-status {
  margin-left: 8px;
  vertical-align: middle;
}

.steps {
  margin: 0;
  padding-left: 22px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-2);
}

.steps li + li {
  margin-top: 4px;
}

/* 首頁的維運概況 */

/* 今天的狀況：一張白卡片，標題前是一顆狀態燈（綠／黃／紅），待處理的事項排成一列可按的膠囊 */
.ov-health {
  --lamp: var(--ok);
  --lamp-glow: var(--ok-tint);
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--card-shadow);
}

.ov-health--warn {
  --lamp: var(--warn);
  --lamp-glow: var(--warn-tint);
}

.ov-health--danger {
  --lamp: var(--danger-solid);
  --lamp-glow: var(--danger-tint);
}

.ov-health-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.4;
}

/* 狀態燈：實心圓外面一圈淡色光暈 */
.ov-health-title::before {
  content: "";
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--lamp);
  box-shadow: 0 0 0 5px var(--lamp-glow);
}

.ov-health-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-2);
}

/* 每件待處理的事是一顆膠囊：立即處理的紅、其餘黃，按下去到對應的頁面 */
.ov-health-list .text-link {
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--warn-tint);
  font-size: 14px;
  color: var(--warn);
  transition: box-shadow 0.15s ease;
}

.ov-health-list .is-danger .text-link {
  background: var(--danger-tint);
  color: var(--danger);
}

.ov-health-list .text-link::after {
  content: "›";
  font-weight: 400;
}

.ov-health-list .text-link:hover {
  box-shadow: inset 0 0 0 1px currentColor;
  text-decoration: none;
}

/* 兩欄：四張卡排成 2×2，不會剩一張掉到下一列 */
.ov-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* 卡片數是奇數時（非系網人員只有三張），最後一張橫跨兩欄 */
.ov-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

/* 卡片裡的數字卡：上排兩格（要注意的：異常、逾期）、下排三格，剛好排滿；只有一格時佔整列 */
.ov-card .kpi-row--compact {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.ov-card .kpi-row--compact .kpi {
  grid-column: span 2;
  padding: 12px 14px 14px;
}

.ov-card .kpi-row--compact .kpi:nth-child(-n + 2) {
  grid-column: span 3;
}

.ov-card .kpi-row--compact .kpi:only-child {
  grid-column: 1 / -1;
}

.ov-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--card-shadow);
}

.ov-card-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.ov-card-title--row {
  margin: 32px 0 12px;
  font-size: 18px;
}

.ov-more {
  font-size: 14px;
  font-weight: 600;
}

.ov-big {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.3;
}

.ov-sub {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-2);
}

/* 卡片是直向 flex：進度條的 flex-basis 會變成高度，這裡固定回 10px 高、整列寬 */
.ov-card .progress {
  flex: none;
  width: 100%;
  max-width: none;
}

.ov-card .btn {
  align-self: flex-start;
}

/* 近期檢核：一排直立的燈號，一格一次檢核 */
.ov-strip {
  display: flex;
  gap: 4px;
}

.ov-strip > span {
  flex: 1;
  height: 28px;
  border-radius: 6px;
  background: var(--ok);
}

.ov-strip > .ov-strip-reported {
  background: var(--danger-solid);
}

.ov-strip > .ov-strip-missed {
  background: var(--well);
  box-shadow: inset 0 0 0 1px var(--field-line);
}

.ov-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ov-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 15px;
}

.ov-list li:first-child {
  border-top: 0;
}

.ov-list li.is-current {
  font-weight: 700;
}

.ov-strong {
  font-weight: 600;
}

.ov-strong .td-sub {
  display: inline;
  margin: 0;
  font-weight: 400;
}

/* 內容區不夠寬時（側欄旁的小筆電、平板）概況卡片改單欄 */
@media (max-width: 1180px) {
  .ov-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .cal-cell {
    min-height: 64px;
    padding: 8px;
  }

  .cal-name {
    font-size: 13px;
  }

  .cal-note {
    display: none;
  }
}

@media (max-width: 680px) {
  .ck-bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 24px rgba(17, 24, 32, 0.08);
  }

  .seg {
    flex-wrap: wrap;
  }

  .seg-more {
    flex: 1 1 100%;
  }

  /* 手機上卡片裡的數字卡一列兩格，落單的最後一格佔整列 */
  .ov-card .kpi-row--compact .kpi,
  .ov-card .kpi-row--compact .kpi:nth-child(-n + 2) {
    grid-column: span 3;
  }

  .ov-card .kpi-row--compact .kpi:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .kv {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .kv dd {
    margin-bottom: 6px;
  }
}

/* ---------------- 登入／註冊 ---------------- */

/* 左側照片（圓角區塊）、右側表單；高度至少填滿標頭以下的視窗 */
.auth-split {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 16px;
  min-height: calc(100vh - var(--header-h));
  padding: 16px;
}

/* 容器查詢單位（cqi）讓標語依照片欄的寬度縮放 */
.auth-brand {
  container-type: inline-size;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  border-radius: 28px;
  background: var(--floor);
}

.auth-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 文字放在實色面板上，不壓在照片亮部 */
.auth-brand-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px;
  padding: 28px 28px 32px;
  border-radius: 20px;
  background: var(--bg);
  box-shadow: var(--shadow-2);
  color: var(--ink);
}

.auth-brand-kicker {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}

/* 標語 12 個字固定一行（中文自動換行會斷在詞中間）：
   字級為欄寬扣掉面板外距與內距（88px）及一點餘裕後除以 12，最大 28px */
.auth-brand-title {
  font-size: clamp(18px, calc((100cqi - 96px) / 12), 28px);
  font-weight: 900;
  line-height: 1.3;
}

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  background: var(--bg);
}

.auth-card {
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: 100%;
  max-width: 400px;
}

.auth-title {
  font-size: 44px;
  font-weight: 900;
}

/* 副標貼近標題 */
.auth-sub {
  margin-top: -14px;
  font-size: 17px;
  color: var(--ink-2);
}

.auth-switch {
  font-size: 15px;
  color: var(--ink-2);
}

.auth-switch a {
  margin-left: 4px;
  font-weight: 600;
  color: var(--link);
  text-underline-offset: 4px;
}

.auth-demo {
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-3);
}

/* ---------------- 通知 ---------------- */

/* 亮色主題的通知與頁尾同色：細框讓它疊在頁尾上時仍看得出是獨立的一塊。
   寬度用 100%（fixed 時為視窗寬、不含捲軸）而非 100vw，桌面有捲軸時左右才都留 16px */
.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: min(440px, calc(100% - 32px));
  padding: 14px 6px 14px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--toast-bg);
  box-shadow: var(--shadow-3);
  color: var(--toast-ink);
  font-size: 15px;
  line-height: 1.5;
  animation: toast-in 0.2s ease both;
}

/* 通知出現是對操作的回應（存檔、刪除之後）：從下方滑入一小段 */
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.toast-ic {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  color: var(--toast-accent);
}

/* 刪除換檔資訊時，訊息含 FTP 路徑這類不能斷行的長字串；允許任意處斷開，關閉鈕才不會被擠出通知外 */
.toast-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* 上下負邊距：按鈕與第一行文字置中對齊，又不會把單行通知撐高 */
.toast-close {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: -5px 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.toast-close:hover {
  background: var(--toast-hover);
}

/* 通知的底色與頁面相反，焦點框改用通知的強調色才看得清楚 */
.toast-close:focus-visible {
  outline-color: var(--toast-accent);
}

.toast-close svg {
  width: 16px;
  height: 16px;
}

/* ---------------- 頁尾 ---------------- */

/* margin-top: auto 把頁尾推到 .main 底部；上緣圓角接在內容之後 */
.site-footer {
  margin-top: auto;
  border-radius: 32px 32px 0 0;
  background: var(--footer-bg);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  padding: 72px var(--pad-x) 56px;
}

.f-brand b {
  font-size: 17px;
  font-weight: 700;
  color: var(--footer-head);
}

.f-brand p {
  max-width: 360px;
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--footer-dim);
}

.f-col h4 {
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--footer-head);
}

/* 每個連結一行；寬度貼合文字，底線與焦點框都只框住文字 */
.f-col a {
  display: block;
  width: fit-content;
  margin-bottom: 10px;
  font-size: 15px;
  color: var(--footer-ink);
  text-decoration: none;
  transition: color 0.15s ease;
}

.f-col a:hover {
  color: var(--footer-head);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* 深色頁尾上，白色焦點框比品牌藍清楚 */
.f-col a:focus-visible {
  outline-color: var(--footer-head);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 20px var(--pad-x) 24px;
  border-top: 1px solid var(--footer-line);
  font-size: 13px;
  color: var(--footer-dim);
}

/* ---------------- 404 / 請重新登入 ---------------- */

/* 撐滿標頭以下的空間（訪客則是到頁尾為止），內容上下置中 */
.empty-state {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.empty-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 96px 24px;
  text-align: center;
}

.empty-icon {
  width: 72px;
  height: 72px;
  padding: 20px;
  border-radius: 999px;
  background: var(--well);
  color: var(--ink-2);
}

.empty-title {
  margin-top: 24px;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--ink);
}

.empty-desc {
  max-width: 480px;
  margin-top: 12px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink-2);
}

.empty-body .btn-row {
  justify-content: center;
  margin-top: 32px;
}

/* ---------------- 響應式 ---------------- */

@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  /* 只留表單，照片欄隱藏 */
  .auth-split {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .auth-brand {
    display: none;
  }
}

@media (max-width: 680px) {
  .member-panel {
    padding-top: 40px;
  }

  .dash-grid {
    gap: 10px;
  }

  .idc-bulk {
    margin-left: 0;
  }

  /* 縮窄編號與勾選欄、表頭允許換行，把寬度留給檢核項目 */
  .th-no,
  .td-no,
  .th-check,
  .td-check {
    width: 56px;
  }

  .data-table.idc-table th,
  .data-table.idc-table td {
    padding-inline: 10px;
  }

  .data-table.idc-table th {
    white-space: normal;
  }

  .auth-split {
    padding: 0;
  }

  .site-footer {
    border-radius: 24px 24px 0 0;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    padding-top: 48px;
    padding-bottom: 40px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 4px;
  }
}

/* ---------------- 強制色彩模式 ---------------- */

/* 系統色會把進度條的底與填色換成同一色，保留原本的顏色 */
@media (forced-colors: active) {
  .progress {
    forced-color-adjust: none;
  }
}

/* ---------------- 品牌頁內容（.site）：首頁、關於我們、團隊成員 ----------------
   只有訪客看得到；登入後這幾個網址是後台的工作台與編輯頁。 */

/* 容器查詢單位（cqi）讓字級與留白依內容區寬度縮放：vw 含捲軸寬度，桌面有捲軸時會超出 */
.site {
  container-type: inline-size;
}

/* 舊站原文照原本分行 */
.about-line {
  display: block;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--link);
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.text-link-ic {
  width: 18px;
  height: 18px;
}

/* ---------------- 首頁主視覺 ---------------- */

/* 標語在上，下方一排機房照片底部對齊、高低不一，像並排立在地板上的機櫃；
   地板就是下一個區塊的灰底 */
.hero {
  padding: 72px var(--pad-x) 0;
}

/* 全站唯一的進場動畫：標語與機房照片依序浮上 */
.hero-copy {
  animation: lead-in 0.7s cubic-bezier(0.2, 0, 0.2, 1) both;
}

@keyframes lead-in {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
}

.hero-kicker {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-2);
}

/* 系名與中心名各自不斷開，窄螢幕在兩者之間換行 */
.hero-kicker span {
  display: inline-block;
}

.hero-pre,
.hero-post {
  font-size: clamp(20px, 1.9cqi, 26px);
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink-2);
}

.hero-pre {
  margin-top: 48px;
}

/* 寬螢幕排成一行：12 個字 × 7.2cqi 在內容區 ≥640px 時都放得下 */
.hero-title {
  margin-top: 6px;
  font-size: clamp(36px, 7.2cqi, 104px);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.hero-line {
  display: inline;
}

.hero-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px 48px;
  margin-top: 16px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.rack-row {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr 0.9fr;
  align-items: end;
  gap: 16px;
  margin-top: 64px;
}

.rack {
  position: relative;
  overflow: hidden;
  margin: 0;
  border-radius: 24px 24px 0 0;
  background: var(--floor);
  animation: lead-in 0.8s cubic-bezier(0.2, 0, 0.2, 1) both;
}

.rack img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 照片左上角的說明：白底黑字的小貼紙，像機櫃上貼的編號標籤；兩種主題都是白底 */
.rack-label {
  position: absolute;
  top: 12px;
  left: 12px;
  max-width: calc(100% - 24px);
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--label-bg);
  box-shadow: var(--shadow-1);
  color: var(--label-ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}

.rack:nth-child(1) {
  aspect-ratio: 4 / 5;
  animation-delay: 0.1s;
}

.rack:nth-child(2) {
  aspect-ratio: 4 / 5;
  animation-delay: 0.18s;
}

.rack:nth-child(3) {
  aspect-ratio: 5 / 7;
  animation-delay: 0.26s;
}

.rack:nth-child(4) {
  aspect-ratio: 1 / 1;
  animation-delay: 0.34s;
}

/* ---------------- 區塊 ---------------- */

.band {
  padding: 96px var(--pad-x);
}

.band--floor {
  background: var(--floor);
}

/* 機房照片腳下的地板：照片立在一條黃色的安全線上（照片裡機櫃底部貼的那條），
   線以下是高架地板，磚縫往下淡出。全站只有這一處用這個細節 */
.hero + .band--floor {
  position: relative;
  isolation: isolate;
  border-top: 4px solid var(--yellow);
}

.hero + .band--floor::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  z-index: -1;
  height: 280px;
  background-image: linear-gradient(to right, var(--seam) 1px, transparent 1px),
    linear-gradient(to bottom, var(--seam) 1px, transparent 1px);
  background-position: center top;
  background-size: 120px 120px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent);
  mask-image: linear-gradient(to bottom, #000, transparent);
  pointer-events: none;
}

/* 最後一段是灰底時（團隊成員），延伸到頁尾的圓角下方，圓角外才不會露出白色缺角；
   下方留白多加圓角的高度，內容與頁尾的距離不變 */
.site > .band--floor:last-child {
  margin-bottom: -32px;
  padding-bottom: 128px;
}

.band-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 48px;
  margin-bottom: 48px;
}

/* 關於我們的段落標題與區塊標題同一套字級 */
.band-title,
.story-title {
  font-size: clamp(30px, 3cqi, 44px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.band-lead {
  max-width: 36em;
  margin-top: 14px;
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink-2);
}

/* ---------------- 我們的工作 ---------------- */

/* 照片在左、舊站原文在右（與關於我們同一段文字，照舊站分行） */
.work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.work-card {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  padding: 10px;
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow-1);
}

.work-photo {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 20px;
  background: var(--floor);
}

.work-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 24px 24px 28px;
}

.work-title {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.3;
}

.work-text {
  margin-top: 14px;
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink-2);
}

.work-text .about-line + .about-line {
  margin-top: 6px;
}

/* ---------------- 團隊 ---------------- */

/* 左側說明捲動時固定在標頭下方，右側名單與證照 */
.team {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: 64px;
  align-items: start;
}

.team-intro {
  position: sticky;
  top: calc(var(--header-h) + 40px);
}

.team-intro .btn {
  margin-top: 32px;
}

.roster {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.roster-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px 16px 16px;
  border-radius: 20px;
  background: var(--floor);
}

.avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--link);
  font-size: 22px;
  font-weight: 700;
}

.avatar--lg {
  width: 64px;
  height: 64px;
  font-size: 26px;
}

.roster-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.roster-name {
  font-size: 17px;
  font-weight: 700;
}

.roster-role {
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
}

.cert-heading {
  margin: 40px 0 16px;
  font-size: 16px;
  font-weight: 700;
}

.cert-wall {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cert-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
}

/* 有人數徽章時右側留白縮小，徽章貼近膠囊邊緣 */
.cert-chip:has(.cert-count) {
  padding-right: 6px;
}

.cert-count {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--on-yellow);
  font-size: 12px;
  font-weight: 700;
}

/* ---------------- 公開資源 ---------------- */

.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.resource-card {
  display: flex;
  flex-direction: column;
  min-height: 300px;
  padding: 28px 28px 24px;
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow-1);
  color: var(--ink);
  text-decoration: none;
  transition: box-shadow 0.2s ease;
}

/* 可以按的卡片：滑過時浮起一級（只有陰影變化，沒有位移） */
.resource-card:hover {
  box-shadow: var(--shadow-2);
}

/* 卡片窄時（901–930px 的三欄）數字標籤換到標題下方，標題不會從詞中間斷開 */
.resource-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 16px;
}

.resource-title {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.3;
  transition: color 0.15s ease;
}

.resource-count {
  flex: none;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--floor);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.resource-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  font-size: 15px;
  color: var(--ink-2);
}

/* 預覽的標題各只顯示一行 */
.resource-preview li {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-go {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-top: 24px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--link);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.resource-go svg {
  width: 20px;
  height: 20px;
}

.resource-card:hover .resource-title {
  color: var(--link);
}

.resource-card:hover .resource-go {
  background: var(--blue);
  color: var(--on-blue);
}

/* ---------------- 服務承諾 ---------------- */

/* 整頁唯一的大面積黃色 */
.promise {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 36px;
  margin: 96px var(--pad-x);
  padding: 72px clamp(28px, 5cqi, 80px);
  border-radius: 32px;
  background: var(--yellow);
  color: var(--on-yellow);
}

/* 字級讓舊站原文的第一行在桌機寬度一行放得下，避免在「資訊安全」中間斷開；
   內容區較窄時（登入後在側欄旁、平板）放不下，keep-all 讓它只在逗號後換行，不斷在詞中間 */
.promise-text {
  font-size: clamp(20px, 1.95cqi, 28px);
  font-weight: 800;
  line-height: 1.6;
  text-wrap: balance;
  word-break: keep-all;
}

/* 藍色焦點框在黃底上（暗色主題）對比不足 3:1，改用深色 */
.promise :focus-visible {
  outline-color: var(--on-yellow);
}

/* ---------------- 關於我們、團隊成員的頁首 ---------------- */

.page-lead {
  padding: 88px var(--pad-x) 64px;
}

.page-lead-title {
  font-size: clamp(44px, 6cqi, 88px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.page-lead-sub {
  max-width: 36em;
  margin-top: 24px;
  font-size: clamp(18px, 1.6cqi, 22px);
  font-weight: 500;
  line-height: 1.7;
  color: var(--ink-2);
  text-wrap: balance;
}

/* ---------------- 關於我們：圖文段落，左右交替並換底色 ---------------- */

.story {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 64px;
  align-items: center;
  padding: 88px var(--pad-x);
}

.story--flip {
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  background: var(--floor);
}

.story--flip .story-copy {
  order: 2;
}

/* 沒有照片的段落只留文字欄 */
.story--text {
  grid-template-columns: minmax(0, 1fr);
}

.story--text .story-copy {
  max-width: 760px;
}

.story-text {
  margin-top: 24px;
  font-size: 18px;
  line-height: 1.9;
}

/* 預設兩欄直幅（兩張照片）；四張排成正方形的 2×2，一張裁成橫幅 */
.story-media {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.story-media img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 24px;
  background: var(--floor);
}

.story-media--4 img {
  aspect-ratio: 1 / 1;
}

.story-media--1 {
  grid-template-columns: minmax(0, 1fr);
}

.story-media--1 img {
  aspect-ratio: 4 / 3;
}

/* ---------------- 團隊成員 ---------------- */

.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 20px;
}

.member-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 28px;
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow-1);
}

.member-top {
  display: flex;
  align-items: center;
  gap: 18px;
}

.member-name {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--ink);
  text-decoration: none;
}

.member-name--link:hover {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.member-role {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
}

.member-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px 20px;
  margin: 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 15px;
}

.member-meta dt {
  padding-top: 3px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  white-space: nowrap;
}

.member-meta dd {
  margin: 0;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--floor);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.6;
}

.member-none {
  color: var(--ink-3);
}

/* ---------------- 品牌頁響應式 ---------------- */

@media (max-width: 1080px) {
  /* 團隊改為上下排列，說明不再固定 */
  .team {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .team-intro {
    position: static;
  }
}

@media (max-width: 900px) {
  /* 主標題改兩行，固定在「的」之後換行；8 個字 × 10cqi 放得下 */
  .hero-title {
    font-size: 10cqi;
    white-space: normal;
  }

  .hero-line {
    display: block;
  }

  .hero {
    padding-top: 48px;
  }

  .hero-pre {
    margin-top: 32px;
  }

  .rack-row {
    margin-top: 48px;
  }

  .work-grid,
  .resource-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .resource-card {
    min-height: 0;
  }

  .story,
  .story--flip {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  /* 單欄時一律文字在上、照片在下 */
  .story--flip .story-copy {
    order: 0;
  }
}

@media (max-width: 680px) {
  /* 機房照片改為可橫向滑動的一排，貼齊螢幕左右邊緣 */
  .rack-row {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 58cqi;
    gap: 10px;
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
    scrollbar-width: none;
  }

  .rack {
    scroll-snap-align: start;
    border-radius: 20px 20px 0 0;
  }

  .rack:nth-child(2) {
    aspect-ratio: 3 / 4;
  }

  .band {
    padding-top: 64px;
    padding-bottom: 64px;
  }

  /* 手機上標題離照片近，磚縫淡出得快一點、格子小一點，不壓在文字上 */
  .hero + .band--floor::before {
    height: 120px;
    background-size: 80px 80px;
  }

  /* 頁尾圓角在 ≤680px 是 24px */
  .site > .band--floor:last-child {
    margin-bottom: -24px;
    padding-bottom: 88px;
  }

  .band-head {
    margin-bottom: 32px;
  }

  .work-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .work-photo {
    aspect-ratio: 4 / 3;
  }

  .work-body {
    padding: 20px 14px 14px;
  }

  .roster {
    grid-template-columns: minmax(0, 1fr);
  }

  .resource-card {
    padding: 24px 22px 20px;
  }

  .promise {
    margin-top: 64px;
    margin-bottom: 64px;
    padding: 48px 28px;
    border-radius: 28px;
  }

  /* 手機上逗號之間的句子比一行還長，恢復逐字換行，否則會超出黃色面板 */
  .promise-text {
    word-break: normal;
  }

  .page-lead {
    padding-top: 56px;
    padding-bottom: 40px;
  }

  .story {
    padding-top: 64px;
    padding-bottom: 64px;
  }

  .story-text {
    font-size: 17px;
  }

  .member-card {
    padding: 22px;
  }
}

/* ---------------- 減少動態 ---------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
