/* =====================================================================
   HA Portal 樣張共用：色票＋元件（只放元件，不放任何頁面版面）
   主題：預設深色；:root[data-theme=light|dark] 手動指定；
         沒指定時跟隨系統（prefers-color-scheme: light → 高對比淺色）
   ===================================================================== */

/* ---------- 色票：深色（預設，沿用現行值） ---------- */
:root {
  color-scheme: dark;
  --hp-bg: #050a14;
  --hp-bg-2: #0a1322;
  --hp-bg-3: #0e1a2e;
  --hp-surface: #111c33;
  --hp-surface-2: #152339;
  --hp-border: rgba(255, 255, 255, .09);
  --hp-border-2: rgba(255, 255, 255, .15);
  --hp-text: rgba(255, 255, 255, .96);
  --hp-text-2: rgba(255, 255, 255, .72);
  --hp-text-3: rgba(255, 255, 255, .48);
  --hp-brand: #2563eb;
  --hp-brand-2: #3b82f6;
  --hp-brand-3: #60a5fa;
  --hp-success: #22c55e;
  --hp-warn: #f59e0b;
  --hp-error: #ef4444;
  --hp-info: #38bdf8;
  --hp-line: #06c755;
  --hp-mute: #94a3b8;            /* 灰：只給離線、無資料 */

  /* 狀態淡底／邊框／字色（膠囊、橫幅、提示共用） */
  --hp-ok-bg: rgba(34, 197, 94, .14);     --hp-ok-bd: rgba(34, 197, 94, .38);     --hp-ok-ink: #4ade80;
  --hp-warn-bg: rgba(245, 158, 11, .14);  --hp-warn-bd: rgba(245, 158, 11, .40);  --hp-warn-ink: #fbbf24;
  --hp-error-bg: rgba(239, 68, 68, .14);  --hp-error-bd: rgba(239, 68, 68, .42);  --hp-error-ink: #f87171;
  --hp-info-bg: rgba(56, 189, 248, .13);  --hp-info-bd: rgba(56, 189, 248, .38);  --hp-info-ink: #7dd3fc;
  --hp-brand-bg: rgba(59, 130, 246, .16); --hp-brand-bd: rgba(96, 165, 250, .42); --hp-brand-ink: #93c5fd;
  --hp-mute-bg: rgba(148, 163, 184, .12); --hp-mute-bd: rgba(148, 163, 184, .32); --hp-mute-ink: #cbd5e1;

  /* 其他 */
  --hp-grid: rgba(255, 255, 255, .14);        /* 表格格線 */
  --hp-th-bg: #0e1a2e;                        /* 表頭底 */
  --hp-row-hover: rgba(96, 165, 250, .06);
  --hp-field-bg: #0a1322;                     /* 輸入框底 */
  --hp-placeholder: rgba(255, 255, 255, .42); /* 輸入框提示字 */
  --hp-check-bd: rgba(255, 255, 255, .36);    /* 勾選框邊框 */
  --hp-ring: rgba(96, 165, 250, .75);         /* 鍵盤焦點框 */
  --hp-overlay: rgba(2, 6, 14, .62);          /* 彈窗遮罩 */
  --hp-scroll: rgba(255, 255, 255, .18);
  --hp-scroll-hover: rgba(255, 255, 255, .32);
  --hp-skel-a: rgba(255, 255, 255, .05);
  --hp-skel-b: rgba(255, 255, 255, .11);
  --hp-shadow-card: inset 0 1px 0 rgba(255, 255, 255, .03), 0 10px 28px -16px rgba(0, 0, 0, .7);
  --hp-shadow-pop: 0 24px 64px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .06);
  --hp-select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");

  /* 按鈕配色（各變體覆寫） */
  --hp-btn2-top: #1d2c49;  --hp-btn2-bot: #15223b;  --hp-btn2-bd: rgba(255, 255, 255, .14); --hp-btn2-fg: rgba(255, 255, 255, .96);
  --hp-btng-top: rgba(255, 255, 255, .06); --hp-btng-bot: rgba(255, 255, 255, .015); --hp-btng-bd: rgba(255, 255, 255, .11); --hp-btng-fg: rgba(255, 255, 255, .82);
  --hp-btn-hl: rgba(255, 255, 255, .10);      /* 次要／幽靈鈕上緣內亮線 */
  --hp-btn-drop: 0 1px 2px rgba(0, 0, 0, .45), 0 6px 14px -6px rgba(0, 0, 0, .6);

  /* 字體 */
  --hp-font: system-ui, -apple-system, "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", "Heiti TC", sans-serif;
}

/* ---------- 色票：高對比淺色（戶外陽光下） ---------- */
/* 跟隨系統（沒手動指定深色時） */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --hp-bg: #f3f5f9;
    --hp-bg-2: #e9edf3;
    --hp-bg-3: #dde3ec;
    --hp-surface: #ffffff;
    --hp-surface-2: #f7f9fc;
    --hp-border: #a3aebe;
    --hp-border-2: #7c8799;
    --hp-text: #0b1220;
    --hp-text-2: #273246;
    --hp-text-3: #454f63;
    --hp-brand: #1d4ed8;
    --hp-brand-2: #2563eb;
    --hp-brand-3: #1e40af;
    --hp-success: #137a37;
    --hp-warn: #a84d06;
    --hp-error: #b91c1c;
    --hp-info: #0369a1;
    --hp-line: #06c755;
    --hp-mute: #475569;
    --hp-ok-bg: #dcfce7;    --hp-ok-bd: #4ade80;    --hp-ok-ink: #14532d;
    --hp-warn-bg: #ffedd5;  --hp-warn-bd: #fb923c;  --hp-warn-ink: #7c2d12;
    --hp-error-bg: #fee2e2; --hp-error-bd: #f87171; --hp-error-ink: #7f1d1d;
    --hp-info-bg: #e0f2fe;  --hp-info-bd: #38bdf8;  --hp-info-ink: #0c4a6e;
    --hp-brand-bg: #dbeafe; --hp-brand-bd: #60a5fa; --hp-brand-ink: #1e3a8a;
    --hp-mute-bg: #e2e8f0;  --hp-mute-bd: #94a3b8;  --hp-mute-ink: #334155;
    --hp-grid: #a3aebe;
    --hp-th-bg: #e9edf3;
    --hp-row-hover: rgba(29, 78, 216, .05);
    --hp-field-bg: #ffffff;
    --hp-placeholder: #6b7587;
    --hp-check-bd: #7c8799;
    --hp-ring: #1d4ed8;
    --hp-overlay: rgba(15, 23, 42, .45);
    --hp-scroll: rgba(15, 23, 42, .28);
    --hp-scroll-hover: rgba(15, 23, 42, .48);
    --hp-skel-a: #e3e8ef;
    --hp-skel-b: #f1f4f8;
    --hp-shadow-card: 0 1px 2px rgba(15, 23, 42, .08), 0 6px 18px -12px rgba(15, 23, 42, .25);
    --hp-shadow-pop: 0 24px 64px -12px rgba(15, 23, 42, .35), 0 0 0 1px rgba(15, 23, 42, .12);
    --hp-select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23273246' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    --hp-btn2-top: #ffffff;  --hp-btn2-bot: #e8edf4;  --hp-btn2-bd: #7c8799; --hp-btn2-fg: #0b1220;
    --hp-btng-top: #ffffff;  --hp-btng-bot: #f3f6fa;  --hp-btng-bd: #a3aebe; --hp-btng-fg: #273246;
    --hp-btn-hl: rgba(255, 255, 255, .9);
    --hp-btn-drop: 0 1px 2px rgba(15, 23, 42, .18), 0 4px 10px -4px rgba(15, 23, 42, .22);
  }
}
/* 手動指定淺色（內容與上方相同） */
:root[data-theme="light"] {
  color-scheme: light;
  --hp-bg: #f3f5f9;
  --hp-bg-2: #e9edf3;
  --hp-bg-3: #dde3ec;
  --hp-surface: #ffffff;
  --hp-surface-2: #f7f9fc;
  --hp-border: #a3aebe;
  --hp-border-2: #7c8799;
  --hp-text: #0b1220;
  --hp-text-2: #273246;
  --hp-text-3: #454f63;
  --hp-brand: #1d4ed8;
  --hp-brand-2: #2563eb;
  --hp-brand-3: #1e40af;
  --hp-success: #137a37;
  --hp-warn: #a84d06;
  --hp-error: #b91c1c;
  --hp-info: #0369a1;
  --hp-line: #06c755;
  --hp-mute: #475569;
  --hp-ok-bg: #dcfce7;    --hp-ok-bd: #4ade80;    --hp-ok-ink: #14532d;
  --hp-warn-bg: #ffedd5;  --hp-warn-bd: #fb923c;  --hp-warn-ink: #7c2d12;
  --hp-error-bg: #fee2e2; --hp-error-bd: #f87171; --hp-error-ink: #7f1d1d;
  --hp-info-bg: #e0f2fe;  --hp-info-bd: #38bdf8;  --hp-info-ink: #0c4a6e;
  --hp-brand-bg: #dbeafe; --hp-brand-bd: #60a5fa; --hp-brand-ink: #1e3a8a;
  --hp-mute-bg: #e2e8f0;  --hp-mute-bd: #94a3b8;  --hp-mute-ink: #334155;
  --hp-grid: #a3aebe;
  --hp-th-bg: #e9edf3;
  --hp-row-hover: rgba(29, 78, 216, .05);
  --hp-field-bg: #ffffff;
  --hp-placeholder: #6b7587;
  --hp-check-bd: #7c8799;
  --hp-ring: #1d4ed8;
  --hp-overlay: rgba(15, 23, 42, .45);
  --hp-scroll: rgba(15, 23, 42, .28);
  --hp-scroll-hover: rgba(15, 23, 42, .48);
  --hp-skel-a: #e3e8ef;
  --hp-skel-b: #f1f4f8;
  --hp-shadow-card: 0 1px 2px rgba(15, 23, 42, .08), 0 6px 18px -12px rgba(15, 23, 42, .25);
  --hp-shadow-pop: 0 24px 64px -12px rgba(15, 23, 42, .35), 0 0 0 1px rgba(15, 23, 42, .12);
  --hp-select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23273246' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --hp-btn2-top: #ffffff;  --hp-btn2-bot: #e8edf4;  --hp-btn2-bd: #7c8799; --hp-btn2-fg: #0b1220;
  --hp-btng-top: #ffffff;  --hp-btng-bot: #f3f6fa;  --hp-btng-bd: #a3aebe; --hp-btng-fg: #273246;
  --hp-btn-hl: rgba(255, 255, 255, .9);
  --hp-btn-drop: 0 1px 2px rgba(15, 23, 42, .18), 0 4px 10px -4px rgba(15, 23, 42, .22);
}

/* ---------- 基礎 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--hp-bg);
  color: var(--hp-text);
  font-family: var(--hp-font);
  font-size: 14px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
.hp-num, .num { font-variant-numeric: tabular-nums; }
.hp-icon { display: inline-block; flex: none; vertical-align: middle; }
.hp-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- 捲軸美化（細、圓角、半透明、透明軌道） ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb {
  background-color: var(--hp-scroll);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--hp-scroll-hover); }
/* 不支援 webkit 捲軸的瀏覽器（Firefox）改用標準屬性 */
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: var(--hp-scroll) transparent; }
}

/* ---------- 按鈕 .hp-btn ／ 圖示鈕 .hp-btn-icon ---------- */
/* 預設＝次要（secondary）樣式；高度用 height＋border-box 寫死：一般 40px、--sm 36px */
.hp-btn, .hp-btn-icon {
  --_top: var(--hp-btn2-top);
  --_bot: var(--hp-btn2-bot);
  --_bd: var(--hp-btn2-bd);
  --_fg: var(--hp-btn2-fg);
  --_hl: var(--hp-btn-hl);
  --_glow: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--_bd);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--_top), var(--_bot));
  color: var(--_fg);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .01em;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 1px 0 var(--_hl), var(--hp-btn-drop), 0 6px 16px -6px var(--_glow);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.hp-btn:hover, .hp-btn-icon:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  text-decoration: none;
  box-shadow: inset 0 1px 0 var(--_hl), var(--hp-btn-drop), 0 10px 22px -8px var(--_glow);
}
.hp-btn:active, .hp-btn-icon:active {
  transform: translateY(1px);
  filter: brightness(.97);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, .28);
  transition-duration: .05s;
}
.hp-btn:focus-visible, .hp-btn-icon:focus-visible { outline: 2px solid var(--hp-ring); outline-offset: 2px; }
.hp-btn:disabled, .hp-btn-icon:disabled,
.hp-btn[aria-disabled="true"], .hp-btn-icon[aria-disabled="true"] {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  filter: saturate(.6);
  box-shadow: inset 0 1px 0 var(--_hl);
}
.hp-btn .hp-icon { width: 18px; height: 18px; }
.hp-btn-icon { width: 40px; padding: 0; }
.hp-btn-icon .hp-icon { width: 20px; height: 20px; }

/* 尺寸：36px */
.hp-btn--sm { height: 36px; font-size: 13px; padding: 0 12px; border-radius: 9px; gap: 6px; }
.hp-btn--sm .hp-icon { width: 16px; height: 16px; }
.hp-btn-icon.hp-btn--sm { width: 36px; padding: 0; }
.hp-btn-icon.hp-btn--sm .hp-icon { width: 18px; height: 18px; }
.hp-btn--block { display: flex; width: 100%; }

/* 變體 */
.hp-btn--primary {
  --_top: #3b82f6; --_bot: #2563eb; --_bd: #1d4ed8; --_fg: #fff;
  --_hl: rgba(255, 255, 255, .28); --_glow: rgba(37, 99, 235, .55);
}
.hp-btn--secondary { /* 與預設相同，保留語意用 */ }
.hp-btn--ghost {
  --_top: var(--hp-btng-top); --_bot: var(--hp-btng-bot); --_bd: var(--hp-btng-bd); --_fg: var(--hp-btng-fg);
}
.hp-btn--danger {
  --_top: #ef4444; --_bot: #dc2626; --_bd: #b91c1c; --_fg: #fff;
  --_hl: rgba(255, 255, 255, .26); --_glow: rgba(220, 38, 38, .5);
}
.hp-btn--line {
  --_top: #05b04c; --_bot: #03923d; --_bd: #037a33; --_fg: #fff;
  --_hl: rgba(255, 255, 255, .26); --_glow: rgba(6, 199, 85, .42);
  font-weight: 700;
}
/* 淺色主題：藍、紅加深，確保白字對比 */
:root[data-theme="light"] .hp-btn--primary { --_top: #2563eb; --_bot: #1d4ed8; --_bd: #1e40af; --_glow: rgba(29, 78, 216, .35); }
:root[data-theme="light"] .hp-btn--danger { --_top: #dc2626; --_bot: #b91c1c; --_bd: #991b1b; --_glow: rgba(185, 28, 28, .3); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .hp-btn--primary { --_top: #2563eb; --_bot: #1d4ed8; --_bd: #1e40af; --_glow: rgba(29, 78, 216, .35); }
  :root:not([data-theme="dark"]) .hp-btn--danger { --_top: #dc2626; --_bot: #b91c1c; --_bd: #991b1b; --_glow: rgba(185, 28, 28, .3); }
}

/* ---------- 讀取轉圈 ---------- */
.hp-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: hp-spin .7s linear infinite;
  flex: none;
}
@keyframes hp-spin { to { transform: rotate(360deg); } }

/* ---------- 狀態膠囊 .hp-pill ---------- */
.hp-pill {
  --_bg: var(--hp-mute-bg); --_bd: var(--hp-mute-bd); --_ink: var(--hp-mute-ink);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
  height: 24px;
  padding: 0 10px;
  border: 1px solid var(--_bd);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, 0)), var(--_bg);
  color: var(--_ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10), 0 1px 2px rgba(0, 0, 0, .18);
}
.hp-pill .hp-icon { width: 14px; height: 14px; }
.hp-pill__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 22%, transparent); flex: none; }
.hp-pill--ok    { --_bg: var(--hp-ok-bg);    --_bd: var(--hp-ok-bd);    --_ink: var(--hp-ok-ink); }
.hp-pill--warn  { --_bg: var(--hp-warn-bg);  --_bd: var(--hp-warn-bd);  --_ink: var(--hp-warn-ink); }
.hp-pill--error { --_bg: var(--hp-error-bg); --_bd: var(--hp-error-bd); --_ink: var(--hp-error-ink); }
.hp-pill--brand { --_bg: var(--hp-brand-bg); --_bd: var(--hp-brand-bd); --_ink: var(--hp-brand-ink); }
.hp-pill--info  { --_bg: var(--hp-info-bg);  --_bd: var(--hp-info-bd);  --_ink: var(--hp-info-ink); }
.hp-pill--mute  { --_bg: var(--hp-mute-bg);  --_bd: var(--hp-mute-bd);  --_ink: var(--hp-mute-ink); }

/* ---------- 卡片 .hp-card（只一層框） ---------- */
.hp-card {
  background: var(--hp-surface);
  border: 1px solid var(--hp-border);
  border-radius: 14px;
  padding: var(--hp-card-pad, 20px);
  box-shadow: var(--hp-shadow-card);
  min-width: 0;
}
.hp-card--flush { padding: 0; overflow: hidden; }

/* ---------- 分頁籤 .hp-tabs（膠囊式，總高 40px） ---------- */
.hp-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-sizing: border-box;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--hp-border);
  border-radius: 999px;
  background: var(--hp-bg-2);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .25);
}
.hp-tabs::-webkit-scrollbar { display: none; }
.hp-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
  height: 32px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--hp-text-2);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  flex: none;
  transition: background .15s, color .15s, box-shadow .15s;
}
.hp-tab:hover { color: var(--hp-text); background: var(--hp-row-hover); }
.hp-tab:focus-visible { outline: 2px solid var(--hp-ring); outline-offset: 1px; }
.hp-tab .hp-icon { width: 16px; height: 16px; }
.hp-tab.is-active, .hp-tab[aria-selected="true"], .hp-tab[aria-current="page"] {
  color: var(--hp-text);
  border-color: var(--hp-btn2-bd);
  background: linear-gradient(180deg, var(--hp-btn2-top), var(--hp-btn2-bot));
  box-shadow: inset 0 1px 0 var(--hp-btn-hl), 0 1px 3px rgba(0, 0, 0, .3);
}
.hp-tab__count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--hp-brand-bg); color: var(--hp-brand-ink);
  font-size: 12px; line-height: 20px; text-align: center;
}

/* ---------- 輸入框／下拉 .hp-input .hp-select（40px） ---------- */
.hp-input, .hp-select {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--hp-border-2);
  border-radius: 10px;
  background-color: var(--hp-field-bg);
  color: var(--hp-text);
  font-size: 14px;
  line-height: 1;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .18);
  transition: border-color .15s, box-shadow .15s;
}
.hp-input::placeholder { color: var(--hp-placeholder); opacity: 1; }
.hp-input:hover, .hp-select:hover { border-color: var(--hp-brand-3); }
.hp-input:focus, .hp-select:focus {
  outline: none;
  border-color: var(--hp-brand-2);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .18), 0 0 0 3px color-mix(in srgb, var(--hp-brand-2) 30%, transparent);
}
.hp-input:disabled, .hp-select:disabled { opacity: .55; cursor: not-allowed; }
.hp-input.is-invalid { border-color: var(--hp-error); }
.hp-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: var(--hp-select-arrow);
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
  cursor: pointer;
}
.hp-select option { background: var(--hp-surface); color: var(--hp-text); }
/* 自訂下拉：原生 select 藏起來，按鈕沿用 .hp-select 外觀，清單是浮動卡片 */
.hp-dd-native { display: none !important; }
.hp-select.hp-dd {
  display: flex; align-items: center; gap: 8px;
  padding-right: 10px; background-image: none;
  font: inherit; font-size: 14px; font-weight: 400; text-align: left;
}
.hp-dd__text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-dd__arrow { flex: none; display: inline-flex; color: var(--hp-text-3); transition: transform .18s ease; }
.hp-dd.is-open { border-color: var(--hp-brand-2); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .18), 0 0 0 3px color-mix(in srgb, var(--hp-brand-2) 30%, transparent); }
.hp-dd.is-open .hp-dd__arrow { transform: rotate(180deg); color: var(--hp-brand-2); }
.hp-dd__pop {
  position: fixed; z-index: 1050;
  box-sizing: border-box; padding: 6px; overflow-y: auto;
  border: 1px solid var(--hp-border-2); border-radius: 12px;
  background: var(--hp-surface); box-shadow: var(--hp-shadow-pop);
  scrollbar-width: thin; scrollbar-color: var(--hp-scroll) transparent;
}
.hp-dd__item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  box-sizing: border-box; min-height: 40px; padding: 8px 12px;
  border: 0; border-radius: 8px; background: none;
  color: var(--hp-text); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.hp-dd__item > span { flex: 1 1 auto; min-width: 0; }
.hp-dd__item.is-active { background: var(--hp-row-hover); }
.hp-dd__item.is-selected { background: var(--hp-brand-bg); color: var(--hp-brand-ink); font-weight: 600; }
.hp-dd__item svg { flex: none; }
.hp-dd__text.is-placeholder { color: var(--hp-placeholder); }
.hp-dd--date.is-open .hp-dd__arrow { transform: none; }
/* 日期選擇月曆 */
.hp-dp { width: 296px; padding: 10px; overflow: visible; }
.hp-dp__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.hp-dp__head b { font-size: 15px; }
.hp-dp__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.hp-dp__grid i { font-style: normal; text-align: center; font-size: 12px; color: var(--hp-text-3); line-height: 28px; }
.hp-dp__day {
  box-sizing: border-box; height: 36px; border: 1px solid transparent; border-radius: 8px;
  background: none; color: var(--hp-text); font: inherit; font-size: 14px; cursor: pointer;
}
.hp-dp__day:hover:not(:disabled) { background: var(--hp-row-hover); }
.hp-dp__day.is-today { border-color: var(--hp-brand-bd); }
.hp-dp__day.is-selected { background: var(--hp-brand-2); border-color: var(--hp-brand-2); color: #fff; font-weight: 700; }
.hp-dp__day:disabled { color: var(--hp-text-3); opacity: .45; cursor: not-allowed; }
.hp-dp__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--hp-border); }
/* 去掉日期欄位、搜尋欄位的原生裝飾 */
.hp-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.hp-input::-webkit-calendar-picker-indicator { opacity: .7; cursor: pointer; }
:root:not([data-theme="light"]) .hp-input::-webkit-calendar-picker-indicator { filter: invert(.8); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .hp-input::-webkit-calendar-picker-indicator { filter: none; }
}

/* ---------- 勾選膠囊 .hp-chip（篩選用，36px） ---------- */
/* 結構：<label class="hp-chip"><input type="checkbox"><span>發電機</span></label> */
.hp-chip { display: inline-flex; position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hp-chip > input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.hp-chip > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--hp-btng-bd);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--hp-btng-top), var(--hp-btng-bot));
  color: var(--hp-text-2);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 var(--hp-btn-hl), 0 1px 2px rgba(0, 0, 0, .2);
  transition: background .15s, border-color .15s, color .15s, transform .12s;
}
.hp-chip:hover > span { transform: translateY(-1px); color: var(--hp-text); }
.hp-chip:active > span { transform: translateY(1px); }
.hp-chip > span::before {
  /* 勾勾：未勾選時收起，勾選後展開 */
  content: "";
  width: 0;
  height: 9px;
  margin-right: -6px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
  opacity: 0;
  transition: width .15s, margin .15s, opacity .15s;
}
.hp-chip > input:checked + span {
  border-color: var(--hp-brand-bd);
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, 0)), var(--hp-brand-bg);
  color: var(--hp-brand-ink);
}
.hp-chip > input:checked + span::before { width: 5px; margin-right: 2px; opacity: 1; }
.hp-chip > input:focus-visible + span { outline: 2px solid var(--hp-ring); outline-offset: 2px; }
.hp-chip > input:disabled + span { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- 勾選框 .hp-check（例：保持登入） ---------- */
/* 結構：<label class="hp-check"><input type="checkbox"><span class="hp-check__box"></span>保持登入</label> */
.hp-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  color: var(--hp-text-2);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  position: relative;
}
.hp-check > input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.hp-check__box {
  position: relative;
  width: 20px;
  height: 20px;
  flex: none;
  border: 1.5px solid var(--hp-check-bd);
  border-radius: 6px;
  background: var(--hp-field-bg);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .2);
  transition: background .15s, border-color .15s;
}
.hp-check__box::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform .12s;
}
.hp-check > input:checked + .hp-check__box {
  border-color: var(--hp-brand);
  background: linear-gradient(180deg, var(--hp-brand-2), var(--hp-brand));
}
.hp-check > input:checked + .hp-check__box::after { transform: rotate(45deg) scale(1); }
.hp-check > input:focus-visible + .hp-check__box { outline: 2px solid var(--hp-ring); outline-offset: 2px; }

/* ---------- 開關元件 .hp-toggle（56×32） ---------- */
/* 結構：<button class="hp-toggle" role="switch" aria-checked="true" data-state="on"><span class="hp-toggle__thumb"></span></button>
   data-state：on（綠）／off（紅，關閉語意）／offline（灰，離線）
   送出中：aria-busy="true"（滑塊轉圈）；停用：disabled（斷線時）
   唯讀：改用 .hp-toggle--readonly（狀態燈＋文字，不是按鈕） */
.hp-toggle {
  --_track-top: rgba(239, 68, 68, .30);
  --_track-bot: rgba(239, 68, 68, .18);
  --_track-bd: rgba(239, 68, 68, .70);
  position: relative;
  display: inline-block;
  flex: none;
  box-sizing: border-box;
  width: 56px;
  height: 32px;
  padding: 0;
  border: 1.5px solid var(--_track-bd);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--_track-top), var(--_track-bot));
  cursor: pointer;
  vertical-align: middle;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .28), 0 1px 0 rgba(255, 255, 255, .04);
  transition: background .2s, border-color .2s, opacity .2s, filter .2s;
}
.hp-toggle__thumb {
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffffff, #e2e8f0);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .4), inset 0 -1px 0 rgba(0, 0, 0, .08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hp-error);
  transition: left .2s cubic-bezier(.3, .7, .4, 1), width .2s, height .2s, top .2s, background .2s;
}
.hp-toggle:hover:not(:disabled):not([aria-busy="true"]):not([data-state="offline"]):not(.hp-toggle--readonly) { filter: brightness(1.08); }
.hp-toggle:active:not(:disabled) .hp-toggle__thumb { width: 28px; }
.hp-toggle:focus-visible { outline: 2px solid var(--hp-ring); outline-offset: 3px; }

/* 開啟：綠色實底、滑塊靠右 */
.hp-toggle[data-state="on"] {
  --_track-top: #2fd36b;
  --_track-bot: #16a34a;
  --_track-bd: #15803d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), inset 0 -2px 4px rgba(0, 0, 0, .18), 0 0 14px -2px rgba(34, 197, 94, .45);
}
.hp-toggle[data-state="on"] .hp-toggle__thumb { left: calc(100% - 26.5px); color: #16a34a; }
.hp-toggle[data-state="on"]:active:not(:disabled) .hp-toggle__thumb { left: calc(100% - 30.5px); }

/* 離線：灰色虛線框、滑塊縮小置中（狀態不明） */
.hp-toggle[data-state="offline"] {
  --_track-top: var(--hp-mute-bg);
  --_track-bot: var(--hp-mute-bg);
  --_track-bd: var(--hp-mute);
  border-style: dashed;
  cursor: not-allowed;
  box-shadow: none;
}
.hp-toggle[data-state="offline"] .hp-toggle__thumb {
  top: 7.5px;
  left: calc(50% - 7px);
  width: 14px;
  height: 14px;
  background: var(--hp-mute);
  box-shadow: none;
}

/* 送出中：藍色流動條紋＋滑塊轉圈，不可再按 */
.hp-toggle[aria-busy="true"] {
  --_track-bd: var(--hp-brand-2);
  background: repeating-linear-gradient(-45deg, var(--hp-brand-bg) 0 6px, transparent 6px 12px), var(--hp-brand-bg);
  background-size: 17px 17px;
  animation: hp-toggle-flow .6s linear infinite;
  cursor: progress;
  pointer-events: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .2);
}
.hp-toggle[aria-busy="true"] .hp-toggle__thumb { color: var(--hp-brand); }
.hp-toggle[aria-busy="true"] .hp-toggle__thumb::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: hp-spin .7s linear infinite;
}
@keyframes hp-toggle-flow { to { background-position: 17px 0; } }

/* 停用（斷線時）：保留顏色但淡化 */
.hp-toggle:disabled { opacity: .5; cursor: not-allowed; }
.hp-toggle[data-state="offline"]:disabled { opacity: 1; }

/* 唯讀狀態展示：狀態燈＋文字（合約到期、僅可查看）；用 <span>，不是按鈕
   結構：<span class="hp-toggle hp-toggle--readonly" data-state="on">開啟</span> */
.hp-toggle.hp-toggle--readonly, .hp-toggle.hp-toggle--readonly[data-state] {
  --_lamp: var(--hp-error);
  --_ink: var(--hp-error-ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  height: 32px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--hp-border-2);
  border-radius: 8px;
  background: var(--hp-bg-2);
  color: var(--_ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: default;
  box-shadow: none;
  filter: none;
  opacity: 1;
}
.hp-toggle--readonly::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .7), transparent 45%), var(--_lamp);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--_lamp) 22%, transparent), 0 0 10px color-mix(in srgb, var(--_lamp) 70%, transparent);
}
.hp-toggle--readonly .hp-icon { width: 14px; height: 14px; color: var(--hp-text-3); }
.hp-toggle.hp-toggle--readonly[data-state="on"] { --_lamp: var(--hp-success); --_ink: var(--hp-ok-ink); }
.hp-toggle.hp-toggle--readonly[data-state="offline"] { --_lamp: var(--hp-mute); --_ink: var(--hp-mute-ink); }
.hp-toggle.hp-toggle--readonly[data-state="offline"]::before { box-shadow: 0 0 0 3px var(--hp-mute-bg); }

/* ---------- 彈窗 .hp-modal（三段式） ---------- */
.hp-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--hp-overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .18s ease;
}
.hp-modal-backdrop.is-open { opacity: 1; }
.hp-modal {
  display: flex;
  flex-direction: column;
  width: min(480px, 100%);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  border: 1px solid var(--hp-border-2);
  border-radius: 16px;
  background: var(--hp-surface);
  color: var(--hp-text);
  box-shadow: var(--hp-shadow-pop);
  overflow: hidden;
  transform: translateY(8px) scale(.98);
  transition: transform .2s cubic-bezier(.2, .8, .3, 1);
}
.hp-modal-backdrop.is-open .hp-modal { transform: none; }
.hp-modal__head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 14px 16px 14px 20px;
  border-bottom: 1px solid var(--hp-border);
}
.hp-modal__title { flex: 1; min-width: 0; margin: 0; font-size: 16px; font-weight: 700; line-height: 1.4; }
.hp-modal__body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px;
  color: var(--hp-text-2);
  font-size: 15px;
  line-height: 1.65;
  overscroll-behavior: contain;
}
.hp-modal__foot {
  flex: none;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--hp-border);
  background: var(--hp-surface-2);
}
/* 底部放連結鈕（例：聯絡續約的撥打／寄信）＋關閉：一列放不下就換列，主要動作排第一、關閉排最後，不往左溢出 */
.hp-modal__foot:has(> a.hp-btn) { flex-wrap: wrap; }
.hp-modal__foot:has(> a.hp-btn) > a.hp-btn { flex: 1 1 200px; }
.hp-modal__foot:has(> a.hp-btn) > button.hp-btn { flex: 1 1 100%; order: 3; }
.hp-modal__foot:has(> a.hp-btn) > a.hp-btn--primary { order: -1; }
/* 確認類：高度包住內容 */
.hp-modal--confirm { height: auto; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); }
.hp-modal--confirm .hp-modal__body { flex: 0 1 auto; }
.hp-modal__lead { display: flex; gap: 14px; align-items: flex-start; }
.hp-modal__icon {
  width: 40px; height: 40px; flex: none; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--hp-brand-bg); color: var(--hp-brand-ink); border: 1px solid var(--hp-brand-bd);
}
.hp-modal__icon--danger { background: var(--hp-error-bg); color: var(--hp-error-ink); border-color: var(--hp-error-bd); }
.hp-modal__icon--warn { background: var(--hp-warn-bg); color: var(--hp-warn-ink); border-color: var(--hp-warn-bd); }
.hp-modal__strong { color: var(--hp-text); font-weight: 700; font-size: 16px; }
/* 清單類：固定高度，不忽高忽低 */
.hp-modal--list { width: min(640px, 100%); height: min(640px, calc(100vh - 48px)); height: min(640px, calc(100dvh - 48px)); }
.hp-modal--list .hp-modal__body { padding: 0; }
html.hp-modal-open { overflow: hidden; }
/* 手機：從底部升起、滿寬 */
@media (max-width: 500px) {
  .hp-modal-backdrop { align-items: flex-end; padding: 0; }
  .hp-modal {
    width: 100%;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    transform: translateY(100%);
    transition: transform .26s cubic-bezier(.2, .8, .3, 1);
  }
  .hp-modal--list { height: min(640px, calc(100vh - 48px)); height: min(640px, calc(100dvh - 48px)); }
  .hp-modal__foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .hp-modal__foot > .hp-btn { flex: 1; }
}

/* ---------- 短暫提示 .hp-toast（頂部中間，3 秒自動消失） ---------- */
.hp-toast-host {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 32px);
  transform: translateX(-50%);
  pointer-events: none;
}
.hp-toast {
  --_ink: var(--hp-info-ink); --_bd: var(--hp-info-bd); --_ic: var(--hp-info);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  min-height: 44px;
  padding: 10px 16px 10px 12px;
  border: 1px solid var(--_bd);
  border-radius: 12px;
  background: var(--hp-surface);
  color: var(--hp-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  box-shadow: var(--hp-shadow-pop);
  pointer-events: auto;
  animation: hp-toast-in .22s cubic-bezier(.2, .8, .3, 1);
}
.hp-toast .hp-icon { color: var(--_ic); width: 20px; height: 20px; }
.hp-toast.is-leaving { opacity: 0; transform: translateY(-8px); transition: opacity .2s, transform .2s; }
.hp-toast--ok    { --_bd: var(--hp-ok-bd);    --_ic: var(--hp-success); }
.hp-toast--warn  { --_bd: var(--hp-warn-bd);  --_ic: var(--hp-warn); }
.hp-toast--error { --_bd: var(--hp-error-bd); --_ic: var(--hp-error); }
.hp-toast--brand { --_bd: var(--hp-brand-bd); --_ic: var(--hp-brand-2); }
@keyframes hp-toast-in { from { opacity: 0; transform: translateY(-12px); } }

/* ---------- 頂部橫幅 .hp-banner ---------- */
.hp-banner {
  --_bg: var(--hp-info-bg); --_bd: var(--hp-info-bd); --_ink: var(--hp-info-ink);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--_bd);
  background: var(--_bg);
  color: var(--_ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
}
.hp-banner .hp-icon { width: 20px; height: 20px; }
.hp-banner__text { flex: 1; min-width: 0; }
.hp-banner__text small { display: block; font-weight: 400; opacity: .9; font-size: 13px; }
.hp-banner--warn  { --_bg: var(--hp-warn-bg);  --_bd: var(--hp-warn-bd);  --_ink: var(--hp-warn-ink); }
.hp-banner--error { --_bg: var(--hp-error-bg); --_bd: var(--hp-error-bd); --_ink: var(--hp-error-ink); }
.hp-banner--info  { --_bg: var(--hp-info-bg);  --_bd: var(--hp-info-bd);  --_ink: var(--hp-info-ink); }

/* ---------- 表格 .hp-table（一張表、外框一層、格線連續等粗） ---------- */
.hp-table-wrap { max-width: 100%; overflow: auto; }
.hp-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--hp-grid);
  background: var(--hp-surface);
  font-size: 14px;
}
.hp-table th, .hp-table td { border: 1px solid var(--hp-grid); }
.hp-table th {
  height: 40px;
  padding: 0 12px;
  background: var(--hp-th-bg);
  color: var(--hp-text-2);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}
.hp-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
  color: var(--hp-text);
}
.hp-table td.num { text-align: right; white-space: nowrap; } /* 數字靠右；表頭一律置中 */
.hp-table tbody tr:hover td { background: var(--hp-row-hover); }
.hp-table .is-mute { color: var(--hp-text-3); }

/* ---------- 骨架載入 .hp-skel ---------- */
.hp-skel {
  display: block;
  height: 16px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--hp-skel-a) 0%, var(--hp-skel-b) 50%, var(--hp-skel-a) 100%);
  background-size: 200% 100%;
  animation: hp-skel 1.3s ease-in-out infinite;
}
.hp-skel--text { height: 12px; border-radius: 6px; }
.hp-skel--title { height: 20px; width: 40%; }
.hp-skel--block { height: 96px; border-radius: 12px; }
.hp-skel--circle { width: 40px; height: 40px; border-radius: 50%; }
@keyframes hp-skel { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- 曲線（HP.sparkline／HP.chart 產出的 SVG） ---------- */
.hp-spark { display: block; overflow: visible; }
.hp-chart { display: block; overflow: visible; font-family: var(--hp-font); }
.hp-chart__grid { stroke: var(--hp-border); stroke-width: 1; }
.hp-chart__axis { stroke: var(--hp-border-2); stroke-width: 1; }
.hp-chart__label { fill: var(--hp-text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.hp-chart__empty { fill: var(--hp-text-3); font-size: 13px; }

/* ---------- 減少動態 ---------- */
/* ---------- 確認彈窗三列 .hp-confirm-rows（工地／設備／動作） ---------- */
.hp-confirm-rows { margin: 16px 0 0; border: 1px solid var(--hp-border); border-radius: 10px; overflow: hidden; }
.hp-confirm-rows > div { display: grid; grid-template-columns: 64px 1fr; align-items: center; min-height: 40px; }
.hp-confirm-rows > div + div { border-top: 1px solid var(--hp-border); }
.hp-confirm-rows dt { align-self: stretch; display: flex; align-items: center; justify-content: center; background: var(--hp-bg-2); color: var(--hp-text-3); font-size: 13px; font-weight: 600; }
.hp-confirm-rows dd { margin: 0; padding: 8px 12px; color: var(--hp-text); font-size: 14px; font-weight: 700; }
.hp-confirm-rows dd.is-danger { color: var(--hp-error-ink); }
.hp-confirm-rows dd.is-ok { color: var(--hp-ok-ink); }

/* ---------- 控制三段進度條 .hp-steps（HP.stepsHtml 產生） ---------- */
.hp-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: 100%; }
.hp-steps__seg { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.hp-steps__seg i { display: block; height: 4px; border-radius: 999px; background: var(--hp-border-2); transition: background .25s; }
.hp-steps__seg b { font-size: 12px; font-weight: 600; color: var(--hp-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp-steps__seg.is-lit i { background: var(--hp-brand-2); }
.hp-steps__seg.is-lit b { color: var(--hp-text-2); }
.hp-steps__seg.is-current i { animation: hp-steps-pulse 1s ease-in-out infinite; }
.hp-steps--done .hp-steps__seg i { background: var(--hp-success); }
.hp-steps--done .hp-steps__seg b { color: var(--hp-ok-ink); }
.hp-steps--warn .hp-steps__seg.is-lit i { background: var(--hp-warn); }
.hp-steps--warn .hp-steps__seg:last-child b { color: var(--hp-warn-ink); }
@keyframes hp-steps-pulse { 50% { opacity: .45; } }

/* ---------- 手機觸控尺寸（≤820：開關、頁籤、膠囊至少 40px 好按） ---------- */
@media (max-width: 820px) {
  .hp-tab { height: 40px; }
  .hp-chip > span { height: 40px; }
  .hp-toggle { width: 64px; height: 36px; }
  .hp-toggle::after { content: ""; position: absolute; inset: -5px -4px; }
  .hp-toggle__thumb { width: 28px; height: 28px; }
  .hp-toggle:active:not(:disabled) .hp-toggle__thumb { width: 32px; }
  .hp-toggle[data-state="on"] .hp-toggle__thumb { left: calc(100% - 30.5px); }
  .hp-toggle[data-state="on"]:active:not(:disabled) .hp-toggle__thumb { left: calc(100% - 34.5px); }
  .hp-toggle[data-state="offline"] .hp-toggle__thumb { top: 9.5px; left: calc(50% - 7px); width: 14px; height: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .hp-skel, .hp-toggle[aria-busy="true"] { animation: none; }
  .hp-btn, .hp-btn-icon, .hp-toggle, .hp-toggle__thumb, .hp-modal, .hp-modal-backdrop { transition: none; }
}

/* 表格儲存格裡只有一顆膠囊（狀態、動作）→ 置中 */
td:has(> .hp-pill:only-child) { text-align: center; }
