/* App shell layout — mobile-first */

.hb-shell {
  min-height: 100dvh;
  min-height: 100vh;
  display: grid;
  /* header（topbar + 進行中任務條）自適應高度，其餘吃滿 */
  grid-template-rows: auto 1fr;
  background: transparent;
  color: var(--hb-ink);
  /* 避免手機橫向溢出 */
  overflow-x: clip;
  width: 100%;
  max-width: 100vw;
}

.hb-shell__header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--hb-surface-solid) 82%, transparent);
  backdrop-filter: saturate(130%) blur(16px);
  -webkit-backdrop-filter: saturate(130%) blur(16px);
}

.hb-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--hb-space-3);
  height: calc(var(--hb-topbar-height) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(var(--hb-space-3), env(safe-area-inset-right, 0px)) 0
    max(var(--hb-space-3), env(safe-area-inset-left, 0px));
  border-bottom: 1px solid color-mix(in srgb, var(--hb-line-strong, var(--hb-line)) 55%, transparent);
  background: transparent;
}

/* 進行中任務即時進度（有 job 才渲染） */
.hb-first-run {
  display: grid;
  gap: var(--hb-space-3);
  padding: 0.65rem max(var(--hb-space-3), env(safe-area-inset-right, 0px)) 0.75rem
    max(var(--hb-space-3), env(safe-area-inset-left, 0px));
  border-bottom: 1px solid color-mix(in srgb, var(--hb-brand) 28%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-brand) 8%, var(--hb-surface-solid));
}

.hb-first-run__copy {
  display: grid;
  gap: 0.15rem;
}

.hb-first-run__copy p {
  margin: 0;
  color: var(--hb-muted);
  font-size: var(--hb-text-sm);
}

.hb-first-run__steps {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--hb-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.hb-first-run__steps li {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius-lg);
  background: var(--hb-surface-solid);
  color: var(--hb-muted);
  font-size: var(--hb-text-xs);
  font-weight: 600;
}

.hb-first-run__step {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.45rem 0.55rem;
  color: inherit;
  text-decoration: none;
  border-radius: inherit;
}

.hb-first-run__step:hover {
  color: var(--hb-ink);
  background: color-mix(in srgb, var(--hb-brand) 10%, var(--hb-surface-solid));
}

.hb-first-run__step > span:first-child {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--hb-radius-pill);
  background: var(--hb-surface-muted);
}

.hb-first-run__steps li.is-current {
  border-color: var(--hb-brand);
  background: var(--hb-brand-soft);
  color: var(--hb-ink);
}

.hb-first-run__steps li.is-done {
  color: var(--hb-ink);
}

.hb-first-run__steps li.is-current .hb-first-run__step > span:first-child,
.hb-first-run__steps li.is-done .hb-first-run__step > span:first-child {
  background: var(--hb-brand);
  color: var(--hb-brand-on);
}

.hb-first-run__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.hb-first-run__progress {
  color: var(--hb-muted);
  font-size: var(--hb-text-xs);
  font-weight: 600;
}

@media (max-width: 720px) {
  .hb-first-run__steps {
    grid-template-columns: 1fr 1fr;
  }
}

.hb-job-strip {
  border-bottom: 1px solid color-mix(in srgb, var(--hb-brand) 28%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-brand) 8%, var(--hb-surface-solid));
}

.hb-job-strip__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: stretch;
  padding: 0.4rem max(var(--hb-space-3), env(safe-area-inset-right, 0px)) 0.5rem
    max(var(--hb-space-3), env(safe-area-inset-left, 0px));
}

.hb-job-strip__item {
  flex: 1 1 12rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.35rem 0.55rem;
  border-radius: var(--hb-radius, 8px);
  border: 1px solid color-mix(in srgb, var(--hb-brand) 22%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-surface-solid) 88%, transparent);
  color: inherit;
  text-decoration: none;
  font-size: var(--hb-text-xs);
  line-height: 1.35;
}

.hb-job-strip__item:hover {
  border-color: color-mix(in srgb, var(--hb-brand) 50%, var(--hb-line));
}

.hb-job-strip__title {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  align-items: baseline;
  font-weight: 600;
}

.hb-job-strip__status {
  font-weight: 500;
  color: var(--hb-brand-deep);
  font-size: var(--hb-text-2xs);
}

.hb-job-strip__summary {
  color: var(--hb-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.hb-job-strip__bar {
  margin-top: 0.2rem;
}

.hb-job-strip__more {
  align-self: center;
  font-size: var(--hb-text-xs);
  color: var(--hb-brand-deep);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.25rem 0.4rem;
}

.hb-job-strip__more:hover {
  text-decoration: underline;
}

.hb-persona-job {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--hb-radius, 8px);
  border: 1px solid color-mix(in srgb, var(--hb-brand) 30%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-brand) 7%, var(--hb-surface));
}

.hb-persona-job__head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.65rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.hb-persona-job__sum {
  margin: 0 0 0.4rem;
  font-size: var(--hb-text-sm);
}

.hb-persona-job__link {
  display: inline-block;
  margin-top: 0.45rem;
  font-size: var(--hb-text-xs);
  color: var(--hb-brand-deep);
  text-decoration: none;
}

.hb-persona-job__link:hover {
  text-decoration: underline;
}

.hb-topbar__brand {
  display: flex;
  align-items: center;
  gap: var(--hb-space-2);
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  min-width: 0;
  flex: 1;
}

.hb-topbar__brand:hover {
  color: var(--hb-brand-deep);
}

.hb-topbar__mark,
.hb-brand-mark {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  display: block;
  border-radius: 0.65rem;
  object-fit: cover;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--hb-brand) 24%, transparent),
    0 0 16px var(--hb-magic-glow),
    0 5px 14px color-mix(in srgb, var(--hb-ink) 24%, transparent);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.hb-topbar__brand:hover .hb-topbar__mark {
  transform: translateY(-1px);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--hb-magic) 52%, transparent),
    0 0 22px var(--hb-magic-glow),
    0 7px 18px color-mix(in srgb, var(--hb-ink) 30%, transparent);
}

.hb-topbar__title {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
  line-height: 1.15;
}

.hb-topbar__name {
  font-size: var(--hb-text-sm);
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hb-topbar__en {
  font-size: var(--hb-text-2xs);
  font-weight: 600;
  color: var(--hb-muted);
  letter-spacing: 0.04em;
  text-transform: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 360px) {
  .hb-topbar__en {
    display: none;
  }
}

.hb-topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Workspace 切換：獨立於用量/鈴鐺/帳號那顆膠囊之外的自成一格 chip */
.hb-ws-switch {
  --hb-top-ctrl: 2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: var(--hb-top-ctrl);
  padding: 0 0.65rem 0 0.55rem;
  border: 1px solid color-mix(in srgb, var(--hb-line) 90%, transparent);
  border-radius: 0.55rem;
  background: color-mix(in srgb, var(--hb-surface) 92%, var(--hb-surface-muted));
  color: var(--hb-ink-secondary);
  font-size: var(--hb-text-xs);
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.hb-ws-switch:hover,
.hb-ws-switch:focus-within {
  border-color: color-mix(in srgb, var(--hb-brand) 45%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-brand-soft, var(--hb-surface-muted)) 55%, var(--hb-surface));
}

.hb-ws-switch__ico {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  opacity: 0.75;
}

.hb-ws-switch__label {
  font-weight: 650;
  white-space: nowrap;
}

@media (max-width: 480px) {
  /* 手機寬度有限：只留 icon + 下拉，文字標籤讓路給用量/鈴鐺/帳號 */
  .hb-ws-switch__label {
    display: none;
  }
  .hb-ws-switch {
    padding: 0 0.5rem;
  }
}

.hb-ws-switch__select {
  max-width: 8.5rem;
  height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--hb-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

/* 用量 + 鈴鐺 + 帳號：同一工具列（略方圓角，非膠囊） */
.hb-topbar__cluster {
  --hb-top-ctrl: 2rem;
  --hb-top-cluster-radius: 0.55rem;
  --hb-top-item-radius: 0.4rem;
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.2rem;
  border: 1px solid color-mix(in srgb, var(--hb-line) 90%, transparent);
  border-radius: var(--hb-top-cluster-radius);
  background: color-mix(in srgb, var(--hb-surface) 92%, var(--hb-surface-muted));
  box-shadow: 0 1px 0 color-mix(in srgb, #fff 40%, transparent) inset;
}

.hb-topbar__cluster .hb-usage-widget__trigger,
.hb-topbar__cluster .hb-bell__trigger,
.hb-topbar__cluster .hb-account__trigger {
  height: var(--hb-top-ctrl);
  min-height: var(--hb-top-ctrl);
  border: 0;
  border-radius: var(--hb-top-item-radius);
  background: transparent;
  box-shadow: none;
  color: var(--hb-ink-secondary);
}

.hb-topbar__cluster .hb-usage-widget__trigger:hover,
.hb-topbar__cluster .hb-usage-widget__trigger.is-open,
.hb-topbar__cluster .hb-bell__trigger:hover,
.hb-topbar__cluster .hb-bell__trigger.is-open,
.hb-topbar__cluster .hb-account__trigger:hover,
.hb-topbar__cluster .hb-account__trigger.is-open {
  background: color-mix(in srgb, var(--hb-brand-soft, var(--hb-surface-muted)) 70%, var(--hb-surface));
  color: var(--hb-brand-deep);
  border-color: transparent;
}

/* 本頁說明抽屜：portal 到 body，必須高於 sticky header / dock */
.hb-page-help {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  justify-content: flex-end;
}

.hb-page-help__scrim {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: color-mix(in srgb, var(--hb-ink) 28%, transparent);
  cursor: pointer;
}

.hb-page-help__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(22.5rem, 100vw);
  max-width: 100%;
  height: 100%;
  background: var(--hb-surface-solid, var(--hb-surface));
  color: var(--hb-ink);
  border-left: 1px solid var(--hb-line);
  box-shadow: var(--hb-shadow-card, 0 8px 32px color-mix(in srgb, var(--hb-ink) 12%, transparent));
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) 0;
}

.hb-page-help__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--hb-space-3);
  padding: var(--hb-space-4) var(--hb-space-4) var(--hb-space-3);
  border-bottom: 1px solid var(--hb-line);
}

.hb-page-help__kicker {
  margin: 0 0 0.2rem;
  font-size: var(--hb-text-2xs, 0.7rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--hb-muted);
}

.hb-page-help__title {
  margin: 0;
  font-size: var(--hb-text-lg);
  font-weight: 600;
  color: var(--hb-ink);
  line-height: 1.3;
}

.hb-page-help__body {
  flex: 1;
  overflow: auto;
  padding: var(--hb-space-4);
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-5);
}

.hb-page-help__section {
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-2);
}

.hb-page-help__section-title {
  margin: 0;
  font-size: var(--hb-text-xs);
  font-weight: 600;
  color: var(--hb-ink-secondary);
}

.hb-page-help__text {
  margin: 0;
  font-size: var(--hb-text-sm);
  line-height: 1.55;
  color: var(--hb-ink);
}

.hb-page-help__steps {
  margin: 0;
  padding-left: 1.2rem;
  font-size: var(--hb-text-sm);
  line-height: 1.55;
  color: var(--hb-ink);
}

.hb-page-help__steps li + li {
  margin-top: 0.4rem;
}

.hb-page-help__related {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-2);
}

.hb-page-help__link {
  display: inline-flex;
  align-items: center;
  font-size: var(--hb-text-sm);
  font-weight: 600;
  color: var(--hb-brand-deep, var(--hb-brand));
  text-decoration: none;
}

.hb-page-help__link:hover {
  text-decoration: underline;
}

.hb-page-help__foot {
  padding: var(--hb-space-3) var(--hb-space-4);
  border-top: 1px solid var(--hb-line);
}

.hb-page-help__hint {
  margin: 0;
  font-size: var(--hb-text-2xs, 0.7rem);
  color: var(--hb-muted);
}

@media (max-width: 40rem) {
  .hb-page-help__panel {
    width: min(100vw, 100%);
  }
}

.hb-topbar__cluster .hb-usage-widget__trigger.is-tight {
  color: var(--hb-warning-deep);
}

.hb-topbar__cluster .hb-usage-widget__trigger.is-tight:hover,
.hb-topbar__cluster .hb-usage-widget__trigger.is-tight.is-open {
  background: color-mix(in srgb, var(--hb-warning) 16%, var(--hb-surface));
}

.hb-topbar__cluster .hb-bell__badge {
  top: -0.05rem;
  right: -0.05rem;
}

.hb-topbar__chip {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0 0.75rem;
  border-radius: var(--hb-radius-pill);
  border: 1px solid var(--hb-line);
  background: var(--hb-surface);
  font-size: var(--hb-text-sm);
  color: var(--hb-ink-secondary);
  text-decoration: none;
}

a.hb-topbar__chip:hover {
  color: var(--hb-brand-deep);
  border-color: var(--hb-brand);
}

/* 頂欄：方案＋剩餘點數（文字可讀，細進度只在面板） */
.hb-usage-widget {
  position: relative;
}

.hb-usage-widget--ghost {
  min-width: 2.75rem;
  min-height: var(--hb-top-ctrl, 2rem);
  opacity: 0.35;
  font-size: var(--hb-text-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hb-usage-widget__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 13.5rem;
  height: var(--hb-top-ctrl, 2rem);
  min-height: var(--hb-top-ctrl, 2rem);
  padding: 0 0.7rem;
  border-radius: var(--hb-top-item-radius, 0.4rem);
  font: inherit;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.hb-usage-widget__badge {
  font-size: var(--hb-text-xs);
  font-weight: 750;
  letter-spacing: 0.01em;
  line-height: 1;
  color: inherit;
  flex-shrink: 0;
}

/* Free：無光 */
.hb-usage-widget__trigger.is-free .hb-usage-widget__badge,
.hb-usage-widget__trigger.is-plan-free .hb-usage-widget__badge {
  font-weight: 650;
  text-shadow: none;
}

/*
 * 方案字光：只貼在方案名上（多層 text-shadow 朦朧），
 * 比極簡版明顯、比整顆光暈小。
 */
.hb-usage-widget__trigger.is-plan-starter .hb-usage-widget__badge {
  color: var(--hb-brand-deep);
  font-weight: 770;
  animation: hb-plan-text-breathe-starter 2.8s ease-in-out infinite;
}

.hb-usage-widget__trigger.is-plan-pro .hb-usage-widget__badge {
  color: color-mix(in srgb, var(--hb-gold) 70%, var(--hb-gold-bright) 30%);
  font-weight: 790;
  animation: hb-plan-text-breathe-pro 2.8s ease-in-out infinite;
}

@keyframes hb-plan-text-breathe-starter {
  0%,
  100% {
    text-shadow:
      0 0 3px color-mix(in srgb, var(--hb-brand) 35%, transparent),
      0 0 8px color-mix(in srgb, var(--hb-brand) 22%, transparent),
      0 0 14px color-mix(in srgb, var(--hb-brand) 12%, transparent);
  }
  50% {
    text-shadow:
      0 0 5px color-mix(in srgb, var(--hb-brand) 70%, transparent),
      0 0 12px color-mix(in srgb, var(--hb-brand) 45%, transparent),
      0 0 20px color-mix(in srgb, var(--hb-brand) 22%, transparent);
  }
}

@keyframes hb-plan-text-breathe-pro {
  0%,
  100% {
    text-shadow:
      0 0 3px color-mix(in srgb, var(--hb-gold-bright) 40%, transparent),
      0 0 8px color-mix(in srgb, var(--hb-gold) 28%, transparent),
      0 0 14px color-mix(in srgb, var(--hb-gold) 14%, transparent);
  }
  50% {
    text-shadow:
      0 0 5px color-mix(in srgb, var(--hb-gold-bright) 75%, transparent),
      0 0 12px color-mix(in srgb, var(--hb-gold-bright) 55%, transparent),
      0 0 20px color-mix(in srgb, var(--hb-gold) 28%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hb-usage-widget__trigger.is-plan-starter .hb-usage-widget__badge {
    animation: none;
    text-shadow:
      0 0 4px color-mix(in srgb, var(--hb-brand) 50%, transparent),
      0 0 10px color-mix(in srgb, var(--hb-brand) 28%, transparent);
  }
  .hb-usage-widget__trigger.is-plan-pro .hb-usage-widget__badge {
    animation: none;
    text-shadow:
      0 0 4px color-mix(in srgb, var(--hb-gold-bright) 55%, transparent),
      0 0 10px color-mix(in srgb, var(--hb-gold) 30%, transparent);
  }
}

.hb-usage-widget__sep {
  font-size: var(--hb-text-2xs);
  font-weight: 600;
  opacity: 0.4;
  line-height: 1;
  user-select: none;
}

.hb-usage-widget__stat {
  font-size: var(--hb-text-2xs);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
  color: var(--hb-muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hb-usage-widget__trigger:hover .hb-usage-widget__stat,
.hb-usage-widget__trigger.is-open .hb-usage-widget__stat {
  color: inherit;
}

.hb-usage-widget__stat--cta {
  color: var(--hb-brand-deep);
  font-weight: 750;
}

.hb-usage-widget__stat--warn {
  color: var(--hb-warning-deep);
  font-weight: 750;
}

.hb-usage-widget__panel {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  z-index: 80;
  width: min(19.5rem, calc(100vw - 1.25rem));
  padding: 0.9rem 1rem;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius-lg);
  background: var(--hb-surface);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--hb-line) 35%, transparent),
    0 14px 36px color-mix(in srgb, #000 10%, transparent);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.hb-usage-widget__head {
  display: flex;
  justify-content: space-between;
  gap: 0.85rem;
}

.hb-usage-widget__eyebrow {
  display: block;
  font-size: var(--hb-text-2xs);
  font-weight: 650;
  color: var(--hb-muted);
}

.hb-usage-widget__head-plan {
  display: block;
  margin-top: 0.2rem;
  font-size: var(--hb-text-lg);
  font-weight: 750;
  letter-spacing: -0.02em;
}

.hb-usage-widget__inf {
  color: var(--hb-brand-deep);
  font-weight: 750;
}

.hb-usage-widget__price {
  display: block;
  margin-top: 0.25rem;
  font-size: var(--hb-text-sm);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--hb-text);
}

.hb-usage-widget__period {
  margin-left: 0.15rem;
  font-weight: 600;
  color: var(--hb-muted);
}

.hb-usage-widget__head-use {
  text-align: right;
  flex-shrink: 0;
}

.hb-usage-widget__head-num {
  display: block;
  margin-top: 0.2rem;
  font-size: var(--hb-text-lg);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.hb-usage-widget__cap {
  font-weight: 600;
  color: var(--hb-muted);
  font-size: var(--hb-text-sm);
}

.hb-usage-widget__left {
  display: block;
  margin-top: 0.2rem;
  font-size: var(--hb-text-2xs);
  color: var(--hb-muted);
}

/* 面板內完整進度條（頂欄觸發鈕不再塞細線） */
.hb-usage-widget__track {
  height: 0.4rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--hb-line) 55%, var(--hb-surface-muted));
  overflow: hidden;
}

.hb-usage-widget__track-fill {
  height: 100%;
  border-radius: inherit;
  background: color-mix(in srgb, var(--hb-brand) 78%, transparent);
  transition: width 0.2s ease;
}

.hb-usage-widget__track-fill.is-warn {
  background: var(--hb-warning);
}

.hb-usage-widget__track-fill.is-over {
  background: var(--hb-danger);
}

.hb-usage-widget__bullets {
  margin: 0;
  padding: 0 0 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: var(--hb-text-xs);
  line-height: 1.4;
  color: var(--hb-text);
}

.hb-usage-widget__caps {
  margin: 0;
  font-size: var(--hb-text-2xs);
  font-weight: 650;
  line-height: 1.4;
  color: var(--hb-text);
}

.hb-usage-widget__caps--pts {
  font-weight: 500;
  color: var(--hb-muted);
}

.hb-usage-widget__nudge {
  margin: 0;
  padding: 0.45rem 0.55rem;
  border-radius: var(--hb-radius);
  border: 1px solid color-mix(in srgb, var(--hb-warning) 28%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-warning) 10%, var(--hb-surface-muted));
  font-size: var(--hb-text-2xs);
  font-weight: 650;
  line-height: 1.4;
  color: var(--hb-text);
}

.hb-usage-widget__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  padding-top: 0.15rem;
  border-top: 1px solid var(--hb-line);
}

.hb-usage-widget__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.15rem;
  padding: 0.35rem 0.5rem;
  font-size: var(--hb-text-xs);
  text-decoration: none;
  text-align: center;
}

@media (max-width: 720px) {
  .hb-usage-widget__trigger {
    max-width: 9.5rem;
    padding: 0 0.6rem;
  }

  .hb-usage-widget__stat {
    font-size: var(--hb-text-2xs);
  }
}

@media (max-width: 480px) {
  .hb-topbar__cluster {
    gap: 0.1rem;
    padding: 0.15rem;
  }

  .hb-topbar__cluster .hb-account__name,
  .hb-topbar__cluster .hb-account__chev {
    display: none;
  }

  .hb-topbar__cluster .hb-account__trigger {
    width: var(--hb-top-ctrl);
    min-width: var(--hb-top-ctrl);
    padding: 0;
    justify-content: center;
  }
}

/* 手機：單欄；桌面才切側欄 + 主區（勿在手機仍留 sidebar 寬度） */
.hb-shell__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
  width: 100%;
}

.hb-sidebar {
  display: none;
  border-right: 1px solid color-mix(in srgb, var(--hb-line-strong, var(--hb-line)) 70%, transparent);
  background: color-mix(in srgb, var(--hb-surface-solid) 84%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: var(--hb-space-4) var(--hb-space-3);
}

.hb-sidebar__label {
  margin: 0 0 var(--hb-space-3) var(--hb-space-2);
  font-size: var(--hb-text-2xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hb-subtle);
}

.hb-nav__group {
  display: flex;
  flex-direction: column;
}

.hb-nav__group + .hb-nav__group {
  margin-top: var(--hb-space-4);
  padding-top: var(--hb-space-3);
  border-top: 1px solid color-mix(in srgb, var(--hb-line) 80%, transparent);
}

.hb-nav__group-label {
  margin: 0 0 var(--hb-space-1) var(--hb-space-2);
  font-size: var(--hb-text-2xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--hb-subtle);
}

.hb-nav__group-toggle {
  display: flex;
  align-items: center;
  gap: var(--hb-space-1);
  width: 100%;
  margin: 0 0 var(--hb-space-1);
  padding: var(--hb-space-1) var(--hb-space-2);
  border: 0;
  border-radius: var(--hb-radius);
  background: none;
  font-size: var(--hb-text-2xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--hb-subtle);
  text-align: left;
  cursor: pointer;
}

.hb-nav__group-toggle::after {
  content: "▸";
  font-size: var(--hb-text-2xs);
}

.hb-nav__group-toggle[aria-expanded="true"]::after {
  content: "▾";
}

.hb-nav__group-toggle:hover {
  background: var(--hb-surface-muted);
  color: var(--hb-ink);
}

.hb-nav {
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-1);
}

.hb-nav__item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 2.55rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--hb-radius);
  color: var(--hb-ink-secondary);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--hb-text-sm);
  letter-spacing: -0.01em;
  outline: none;
  border: 1px solid transparent;
  transition: background 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
  position: relative;
}

.hb-nav__ico {
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  opacity: 0.88;
}

.hb-nav__item:hover,
.hb-nav__item:focus-visible {
  background: var(--hb-brand-soft);
  color: var(--hb-brand-deep);
}

/*
 * 選中 = 實心主色塊 + 近黑字（10.3:1）；hover 只是淡底。
 * 兩者一眼分得出來，也不必再靠一條被圓角切掉的 inset 3px 直線來區別
 * —— 原本 hover 與選中的底色、字色完全相同，只差那條線。
 */
.hb-nav__item--active,
.hb-nav__item--active:hover,
.hb-nav__item--active:focus-visible {
  background: var(--hb-brand);
  color: var(--hb-brand-on);
  font-weight: 700;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--hb-ink) 10%, transparent);
}

.hb-nav__item--active .hb-nav__ico {
  opacity: 1;
}

.hb-nav__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.hb-main {
  min-width: 0;
  width: 100%;
  padding-top: var(--hb-space-4);
  padding-right: max(var(--hb-space-4), env(safe-area-inset-right, 0px));
  padding-bottom: calc(var(--hb-space-8) + var(--hb-dock-height) + env(safe-area-inset-bottom, 0px));
  padding-left: max(var(--hb-space-4), env(safe-area-inset-left, 0px));
}

.hb-main__inner {
  max-width: 67.5rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  /* 頁面主軸：標題／橫幅／卡片之間必有天地 */
  gap: var(--hb-gap-section);
  min-width: 0;
  width: 100%;
}

/* 防止子元素 margin 再疊出怪縫或貼死 */
.hb-main__inner > * {
  margin-block: 0;
  min-width: 0;
}

.hb-page-title {
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-2);
  padding-bottom: var(--hb-space-2);
  margin: 0;
}

.hb-page-title__row {
  display: flex;
  align-items: center;
  gap: var(--hb-space-2);
  min-width: 0;
}

.hb-page-title h1 {
  margin: 0;
  font-size: var(--hb-text-xl);
  letter-spacing: -0.03em;
  font-weight: 700;
  line-height: 1.25;
  color: var(--hb-ink);
  min-width: 0;
}

/** 標題旁本頁說明：小圓標，不佔正文 */
.hb-page-help-trigger {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 1.5px solid color-mix(in srgb, var(--hb-muted) 55%, var(--hb-line-strong));
  border-radius: 999px;
  background: transparent;
  color: var(--hb-muted);
  font: inherit;
  font-size: var(--hb-text-xs);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  outline: none;
}

.hb-page-help-trigger:hover,
.hb-page-help-trigger:focus-visible,
.hb-page-help-trigger[aria-expanded="true"] {
  border-color: var(--hb-brand);
  color: var(--hb-brand-deep, var(--hb-brand));
  background: var(--hb-brand-soft);
}

.hb-page-help-trigger:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--hb-brand) 35%, transparent);
}

.hb-page-title::after {
  content: "";
  width: 3.25rem;
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--hb-brand), var(--hb-magic), transparent);
  box-shadow: 0 0 12px var(--hb-magic-glow);
}

.hb-page-title p {
  color: var(--hb-muted);
  line-height: 1.55;
  max-width: 36rem;
  font-size: var(--hb-text-sm);
}

/* —— 手機底欄：4 主入口 + 更多 —— */
.hb-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: stretch;
  gap: 0.15rem;
  min-height: calc(var(--hb-dock-height) + env(safe-area-inset-bottom, 0px));
  padding: 0.4rem 0.4rem calc(0.4rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid color-mix(in srgb, var(--hb-line-strong, var(--hb-line)) 50%, transparent);
  background: color-mix(in srgb, var(--hb-surface-solid) 84%, transparent);
  backdrop-filter: saturate(160%) blur(22px);
  -webkit-backdrop-filter: saturate(160%) blur(22px);
}

.hb-dock__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.22rem;
  min-width: 0;
  min-height: 3.05rem;
  border-radius: 0.75rem;
  border: 0;
  background: transparent;
  color: var(--hb-muted);
  text-decoration: none;
  font: inherit;
  font-size: var(--hb-text-2xs);
  font-weight: 650;
  padding: 0.3rem 0.15rem;
  text-align: center;
  line-height: 1.1;
  outline: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hb-dock__item--btn {
  /* same visual as NavLink items */
}

.hb-dock__item:focus-visible {
  color: var(--hb-brand-deep);
  background: var(--hb-brand-soft);
}

/* 與側欄選單同一套：選中是實心主色塊。 */
.hb-dock__item--active,
.hb-dock__item--active:focus-visible {
  color: var(--hb-brand-on);
  background: var(--hb-brand);
  font-weight: 700;
}

.hb-dock__icon {
  display: grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  flex-shrink: 0;
}

.hb-dock__icon svg,
.hb-app-icon,
.hb-app-icon svg {
  display: block;
}

.hb-app-icon {
  flex-shrink: 0;
  line-height: 0;
  overflow: hidden;
}

.hb-app-icon svg {
  width: 100%;
  height: 100%;
}

.hb-app-icon path[stroke],
.hb-app-icon circle[stroke],
.hb-app-icon rect[stroke] {
  stroke: currentColor !important;
}

.hb-dock-more__ico {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.65rem;
  background: var(--hb-brand-soft);
  color: var(--hb-brand-deep);
  flex-shrink: 0;
}

.hb-dock__label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0;
}

/* 更多：底部 sheet */
.hb-dock-more {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.hb-dock-more__scrim {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: color-mix(in srgb, var(--hb-ink) 35%, transparent);
  cursor: pointer;
}

.hb-dock-more__sheet {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0.45rem 0.85rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
  border-radius: 1.15rem 1.15rem 0 0;
  background: var(--hb-surface);
  box-shadow: var(--hb-shadow-float);
  border: 1px solid var(--hb-line);
  border-bottom: 0;
  max-height: min(70dvh, 28rem);
  animation: hb-dock-sheet-in 0.2s ease-out;
}

@keyframes hb-dock-sheet-in {
  from {
    transform: translateY(12%);
    opacity: 0.6;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.hb-dock-more__handle {
  width: 2.25rem;
  height: 0.28rem;
  margin: 0.15rem auto 0.65rem;
  border-radius: 999px;
  background: var(--hb-line);
}

.hb-dock-more__title {
  margin: 0 0 0.65rem;
  font-size: var(--hb-text-base);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--hb-ink);
  padding: 0 0.25rem;
}

.hb-dock-more__group + .hb-dock-more__group {
  margin-top: 0.55rem;
}

.hb-dock-more__group-label {
  margin: 0 0 0.3rem 0.25rem;
  font-size: var(--hb-text-2xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--hb-subtle);
}

.hb-dock-more__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.hb-dock-more__row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid transparent;
  border-radius: var(--hb-radius-lg);
  background: var(--hb-surface-muted);
  color: var(--hb-ink);
  font: inherit;
  font-weight: 600;
  font-size: var(--hb-text-base);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hb-dock-more__row:hover,
.hb-dock-more__row:active {
  border-color: color-mix(in srgb, var(--hb-brand) 35%, var(--hb-line));
  background: var(--hb-brand-soft);
}

.hb-dock-more__row.is-active,
.hb-dock-more__row.is-active:hover {
  border-color: transparent;
  background: var(--hb-brand);
  color: var(--hb-brand-on);
  font-weight: 700;
}

.hb-dock-more__row .hb-dock__icon {
  width: 1.5rem;
  height: 1.5rem;
  color: inherit;
}

.hb-dock-more__row-label {
  flex: 1;
  min-width: 0;
}

.hb-dock-more__check {
  font-size: var(--hb-text-sm);
  font-weight: 700;
  color: var(--hb-brand-deep);
  flex-shrink: 0;
}

@media (min-width: 600px) {
  .hb-topbar {
    padding-left: var(--hb-space-4);
    padding-right: var(--hb-space-4);
    gap: var(--hb-space-4);
  }

  .hb-topbar__mark,
  .hb-brand-mark {
    width: 2rem;
    height: 2rem;
  }

  .hb-topbar__name {
    font-size: var(--hb-text-base);
  }

  .hb-main {
    padding-left: var(--hb-space-5);
    padding-right: var(--hb-space-5);
    padding-top: var(--hb-space-6);
  }

  .hb-main__inner {
    gap: var(--hb-gap-section);
  }

  .hb-page-title h1 {
    font-size: calc(var(--hb-text-xl) + 0.125rem);
  }
}

@media (min-width: 960px) {
  .hb-shell__body {
    grid-template-columns: var(--hb-sidebar-width) minmax(0, 1fr);
  }

  .hb-sidebar {
    display: block;
  }

  .hb-dock {
    display: none;
  }

  .hb-main {
    padding: var(--hb-gap-page) var(--hb-space-8) var(--hb-space-10);
  }

  .hb-main__inner {
    gap: var(--hb-gap-page);
  }

  .hb-page-title h1 {
    font-size: calc(var(--hb-text-xl) + 0.25rem);
  }

  .hb-topbar {
    height: var(--hb-topbar-height);
    padding-top: 0;
  }
}
