@import "./tokens.css";
@import "./ui.css";
@import "./layout.css";

/* 中文：Noto Sans TC 由 index.html 以可變字重 400–700 載入。 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  /* 防止 iOS 雙擊縮放造成奇怪橫向 */
  text-size-adjust: 100%;
}

html,
body,
#root {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  max-width: 100%;
  overflow-x: clip;
}

body {
  font-family: var(--hb-font-sans);
  font-size: var(--hb-text-base);
  line-height: 1.58;
  letter-spacing: -0.011em;
  font-synthesis: none;
  color: var(--hb-ink);
  /* 星圖網格 + 潮汐法光，低對比避免干擾資訊。 */
  background:
    radial-gradient(circle at 24px 24px, color-mix(in srgb, var(--hb-brand) 16%, transparent) 0 1px, transparent 1.4px) 0 0 / 56px 56px,
    linear-gradient(color-mix(in srgb, var(--hb-brand) 4%, transparent) 1px, transparent 1px) 0 0 / 80px 80px,
    linear-gradient(90deg, color-mix(in srgb, var(--hb-brand) 4%, transparent) 1px, transparent 1px) 0 0 / 80px 80px,
    radial-gradient(ellipse 70% 50% at 0% -5%, var(--hb-aurora-1), transparent 55%),
    radial-gradient(ellipse 55% 40% at 100% 0%, var(--hb-aurora-2), transparent 50%),
    radial-gradient(ellipse 50% 35% at 50% 100%, var(--hb-aurora-3), transparent 55%),
    var(--hb-bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-weight: 700;
  line-height: 1.35;
  color: var(--hb-ink);
}

p {
  margin: 0;
}

a {
  color: var(--hb-brand-deep);
  text-decoration: none;
}

a:hover {
  color: color-mix(in srgb, var(--hb-brand-deep) 75%, var(--hb-ink));
}

code,
kbd,
pre {
  font-family: var(--hb-font-mono);
}

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

:focus-visible {
  outline: 3px solid var(--hb-focus);
  outline-offset: 3px;
}

img,
svg {
  display: block;
  max-width: 100%;
}

.hb-route-loading {
  width: 2rem;
  height: 2rem;
  margin: 20vh auto;
  border: 2px solid color-mix(in srgb, var(--hb-brand) 22%, var(--hb-line));
  border-top-color: var(--hb-magic);
  border-right-color: var(--hb-brand);
  border-radius: 50%;
  box-shadow: 0 0 18px var(--hb-magic-glow);
  animation: hb-route-spin 0.7s linear infinite;
}

.hb-route-loading--content {
  margin: 4rem auto;
}

@keyframes hb-route-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hb-route-loading {
    animation: none;
  }
}

/* English decorative labels — same Inter + Noto Sans TC stack as body */
.display-en {
  font-family: var(--hb-font-en);
  letter-spacing: 0.02em;
}

/* Semantic text helpers */
.text-muted {
  color: var(--hb-muted);
}

.text-subtle {
  color: var(--hb-subtle);
}

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

/* —— Public intro / legal pages (pre AppShell, no auth) —— */
.hb-public {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: var(--hb-space-5) var(--hb-space-6) var(--hb-space-8);
  background: var(--hb-bg);
  color: var(--hb-ink);
}

/** 首頁：乾淨背景，少一點「AI 漸層點陣」感 */
.hb-public--home {
  padding: var(--hb-space-5) var(--hb-space-6) var(--hb-space-8);
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--hb-surface-solid) 88%, var(--hb-bg)) 0%,
      var(--hb-bg) 12rem
    );
}

.hb-public__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--hb-space-4);
  max-width: 56rem;
  width: 100%;
  margin: 0 auto var(--hb-space-6);
}

.hb-public__brand {
  display: flex;
  align-items: center;
  gap: var(--hb-space-3);
}

.hb-public__brand-link {
  text-decoration: none;
  color: inherit;
}

.hb-public__brand .hb-brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  object-fit: cover;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--hb-brand) 24%, transparent),
    0 0 24px var(--hb-magic-glow),
    0 8px 20px color-mix(in srgb, var(--hb-ink) 22%, transparent);
}

.hb-public__brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  line-height: 1.2;
}

.hb-public__brand-text strong {
  font-size: var(--hb-text-lg);
  letter-spacing: -0.02em;
}

.hb-public__brand-text span {
  font-size: var(--hb-text-2xs);
  font-weight: 600;
}

.hb-public__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--hb-space-3);
}

.hb-public-locale {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--hb-line-strong);
  border-radius: var(--hb-radius-pill);
  overflow: hidden;
  background: var(--hb-surface-solid);
}

.hb-public-locale__btn {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0.35rem 0.7rem;
  font: inherit;
  font-size: var(--hb-text-xs);
  font-weight: 650;
  line-height: 1.2;
  color: var(--hb-muted);
  background: transparent;
  cursor: pointer;
}

.hb-public-locale__btn + .hb-public-locale__btn {
  border-left: 1px solid var(--hb-line-strong);
}

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

.hb-public-locale__btn.is-active {
  color: var(--hb-brand-on);
  background: var(--hb-brand);
}

.hb-public-locale__btn:focus-visible {
  outline: 2px solid var(--hb-focus);
  outline-offset: 1px;
  z-index: 1;
}

.hb-public__nav-link {
  font-size: var(--hb-text-sm);
  font-weight: 600;
  color: var(--hb-brand-deep);
  text-decoration: none;
}

.hb-public__nav-link:hover {
  text-decoration: underline;
}

.hb-public__nav-cta {
  text-decoration: none;
}

.hb-public__main {
  flex: 1;
  max-width: 56rem;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-8);
}

.hb-public--home .hb-public__main {
  gap: clamp(2.5rem, 5vw, 4rem);
  padding-bottom: var(--hb-space-6);
}

.hb-public__main--narrow {
  max-width: 42rem;
}

.hb-public__hero {
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-5);
  max-width: 36rem;
  padding: var(--hb-space-4) 0 var(--hb-space-2);
}

.hb-public__hero-points {
  margin: var(--hb-space-2) 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: var(--hb-text-sm);
  color: var(--hb-ink-secondary);
}

.hb-public__hero-points li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.hb-public__hero-points li::before {
  content: "";
  flex: 0 0 auto;
  width: 0.45rem;
  height: 0.45rem;
  margin-top: 0.45rem;
  border-radius: 999px;
  background: var(--hb-brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hb-brand) 22%, transparent);
}

.hb-public__hero-visual {
  width: 100%;
}

.hb-public__feature-grid--wide {
  grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr));
}

.hb-public__free-band {
  padding: var(--hb-space-6);
  border-radius: var(--hb-radius-lg);
  border: 1px solid color-mix(in srgb, var(--hb-brand) 35%, var(--hb-line));
  background:
    radial-gradient(ellipse 70% 80% at 0% 0%, color-mix(in srgb, var(--hb-brand-soft) 70%, transparent), transparent 55%),
    var(--hb-surface);
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-5);
}

.hb-public__free-band-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--hb-space-3);
  max-width: 40rem;
}

.hb-public__free-band-head .hb-public__section-title {
  margin: 0;
}

.hb-public__free-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--hb-space-4);
}

.hb-public__check-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: var(--hb-text-sm);
  line-height: 1.55;
  color: var(--hb-ink-secondary);
}

.hb-public__check-list li {
  padding-left: 1.25rem;
  position: relative;
}

.hb-public__check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--hb-success);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--hb-success) 25%, transparent);
}

.hb-public__free-credits {
  margin: 0 0 var(--hb-space-2);
  font-size: var(--hb-text-lg);
}

.hb-public__free-note {
  margin: var(--hb-space-3) 0;
  font-size: var(--hb-text-sm);
  color: var(--hb-ink-secondary);
  line-height: 1.6;
}

.hb-public__free-cta {
  text-decoration: none;
  display: inline-block;
  margin-top: var(--hb-space-2);
}

.hb-public__pricing-footnote {
  margin: var(--hb-space-4) 0 0;
  font-size: var(--hb-text-sm);
  max-width: 40rem;
  line-height: 1.6;
}

/* Product UI mock frames (homepage) */
.hb-public-previews {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr));
  gap: var(--hb-space-5);
}

.hb-public-preview {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-3);
}

.hb-public-preview__caption {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: var(--hb-text-sm);
}

.hb-public-preview__caption strong {
  font-size: var(--hb-text-base);
  letter-spacing: -0.02em;
  color: var(--hb-ink);
}

.hb-public-preview__frame {
  border-radius: var(--hb-radius-lg);
  border: 1px solid var(--hb-line-strong);
  background: var(--hb-surface-solid);
  box-shadow: var(--hb-shadow-card);
  overflow: hidden;
  min-height: 13.5rem;
}

.hb-public-preview__frame--radar {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--hb-brand) 14%, transparent),
    var(--hb-shadow-card);
}

.hb-public-preview__frame--hero {
  min-height: 16rem;
  transform: rotate(-1.2deg);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--hb-brand) 18%, transparent),
    0 18px 40px color-mix(in srgb, var(--hb-ink) 14%, transparent);
}

.hb-public-preview__chrome {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--hb-line);
  background: color-mix(in srgb, var(--hb-surface-muted) 80%, var(--hb-surface-solid));
}

.hb-public-preview__chrome > span {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--hb-muted) 35%, var(--hb-line-strong));
}

.hb-public-preview__chrome > span:nth-child(1) {
  background: color-mix(in srgb, var(--hb-danger) 55%, white);
}

.hb-public-preview__chrome > span:nth-child(2) {
  background: color-mix(in srgb, var(--hb-warning) 55%, white);
}

.hb-public-preview__chrome > span:nth-child(3) {
  background: color-mix(in srgb, var(--hb-success) 55%, white);
}

.hb-public-preview__chrome-bar {
  flex: 1;
  height: 0.45rem;
  margin-left: 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--hb-line-strong) 80%, transparent);
}

.hb-public-preview__body {
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--hb-brand-soft) 35%, transparent), transparent 60%),
    var(--hb-bg);
}

.hb-mock-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hb-mock-row--head {
  justify-content: space-between;
}

.hb-mock-row--list {
  padding: 0.45rem 0.55rem;
  border-radius: var(--hb-radius);
  border: 1px solid var(--hb-line);
  background: var(--hb-surface-solid);
}

.hb-mock-stack {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.hb-mock-card {
  padding: 0.7rem 0.75rem;
  border-radius: var(--hb-radius);
  border: 1px solid var(--hb-line);
  background: var(--hb-surface-solid);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.hb-mock-card--dim {
  opacity: 0.72;
}

.hb-mock-editor {
  min-height: 5.5rem;
  padding: 0.75rem;
  border-radius: var(--hb-radius);
  border: 1px solid var(--hb-line);
  background: var(--hb-surface-solid);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.hb-mock-line {
  display: block;
  height: 0.45rem;
  width: 100%;
  border-radius: 999px;
  background: color-mix(in srgb, var(--hb-ink) 10%, var(--hb-line-strong));
}

.hb-mock-line--med {
  width: 72%;
}

.hb-mock-line--short {
  width: 42%;
}

.hb-mock-pill {
  display: block;
  width: 4.5rem;
  height: 1.15rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--hb-brand) 45%, var(--hb-surface-muted));
}

.hb-mock-chip {
  display: block;
  width: 2.8rem;
  height: 0.9rem;
  border-radius: 999px;
  background: var(--hb-surface-muted);
  border: 1px solid var(--hb-line);
}

.hb-mock-chip--active {
  background: color-mix(in srgb, var(--hb-brand) 35%, white);
  border-color: color-mix(in srgb, var(--hb-brand) 40%, var(--hb-line));
}

.hb-mock-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.hb-mock-btn {
  display: block;
  width: 3.8rem;
  height: 1.15rem;
  border-radius: 0.45rem;
  background: var(--hb-brand);
}

.hb-mock-btn--ghost {
  background: transparent;
  border: 1px solid var(--hb-line-strong);
}

.hb-mock-btn--wide {
  width: 5.5rem;
}

.hb-mock-btn--sm {
  width: 2.6rem;
  height: 0.95rem;
}

.hb-mock-label {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: var(--hb-text-xs);
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--hb-brand-deep);
  background: color-mix(in srgb, var(--hb-brand) 18%, var(--hb-surface-solid));
  border: 1px solid color-mix(in srgb, var(--hb-brand) 28%, var(--hb-line));
}

.hb-mock-meta {
  font-size: var(--hb-text-xs);
  font-weight: 600;
  color: var(--hb-muted);
  letter-spacing: 0.01em;
}

.hb-mock-text {
  display: block;
  font-size: var(--hb-text-xs);
  line-height: 1.4;
  font-weight: 600;
  color: var(--hb-ink);
  letter-spacing: -0.01em;
}

.hb-mock-text--muted {
  font-weight: 500;
  color: var(--hb-muted);
}

.hb-mock-chip--label {
  width: auto;
  min-width: 2.4rem;
  height: auto;
  padding: 0.15rem 0.45rem;
  font-size: var(--hb-text-xs);
  font-weight: 650;
  color: var(--hb-muted);
  line-height: 1.2;
}

.hb-mock-chip--label.hb-mock-chip--active {
  color: var(--hb-brand-deep);
}

.hb-mock-card--compact {
  padding: 0.45rem 0.5rem;
  gap: 0.28rem;
}

.hb-mock-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}

.hb-mock-board__col {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.hb-mock-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--hb-brand-deep);
  flex: 0 0 auto;
}

.hb-mock-status {
  width: 2.2rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--hb-line-strong);
  flex: 0 0 auto;
}

.hb-mock-status.is-ready {
  background: color-mix(in srgb, var(--hb-success) 55%, white);
}

.hb-pricing__card.is-free {
  border-color: color-mix(in srgb, var(--hb-brand) 40%, var(--hb-line));
}

.hb-pricing__cta a {
  text-decoration: none;
  display: block;
}

.hb-pricing__cta a .hb-btn {
  width: 100%;
}

.hb-public__eyebrow {
  margin: 0;
  font-size: var(--hb-text-sm);
  font-weight: 650;
  color: var(--hb-brand-deep);
  letter-spacing: 0.02em;
}

.hb-public__title {
  margin: 0;
  font-size: clamp(1.65rem, 3.2vw, 2.1rem);
  line-height: 1.25;
  letter-spacing: -0.025em;
  font-weight: 700;
  color: var(--hb-ink);
}

.hb-public__lead {
  margin: 0;
  font-size: var(--hb-text-base);
  line-height: 1.6;
  color: var(--hb-ink-secondary);
  max-width: 32rem;
}

.hb-public--home .hb-public__features,
.hb-public--home .hb-public__product-section,
.hb-public--home .hb-public__pricing-section {
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-5);
}

.hb-public__pricing-hint {
  margin-top: calc(-1 * var(--hb-space-2));
  font-size: var(--hb-text-xs);
}

.hb-public__feature-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--hb-space-4);
}

@media (max-width: 48rem) {
  .hb-public__feature-list {
    grid-template-columns: 1fr;
  }
}

.hb-pricing--home {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 48rem) {
  .hb-pricing--home {
    grid-template-columns: 1fr;
  }
}

.hb-pricing--home .hb-pricing__card {
  padding: var(--hb-space-4);
  overflow: visible;
}

.hb-pricing--home .hb-pricing__head {
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-2);
}

.hb-pricing__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: var(--hb-text-xs);
  font-weight: 650;
  color: var(--hb-brand-deep);
  background: color-mix(in srgb, var(--hb-brand) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--hb-brand) 30%, var(--hb-line));
}

.hb-pricing__credits-wrap {
  position: relative;
  align-self: flex-start;
  margin-top: 0.15rem;
}

.hb-pricing__credits-trigger {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: var(--hb-text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--hb-muted);
  cursor: help;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, var(--hb-muted) 55%, transparent);
}

.hb-pricing__credits-trigger:hover,
.hb-pricing__credits-trigger:focus-visible {
  color: var(--hb-ink);
  text-decoration-color: var(--hb-brand-deep);
  outline: none;
}

.hb-pricing__tip {
  position: absolute;
  left: 0;
  bottom: calc(100% + 0.55rem);
  z-index: 20;
  width: min(18.5rem, 78vw);
  padding: 0.75rem 0.85rem;
  border-radius: var(--hb-radius);
  border: 1px solid var(--hb-line-strong);
  background: var(--hb-surface-solid, var(--hb-surface));
  box-shadow: var(--hb-shadow-card);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(0.25rem);
  transition:
    opacity 0.14s ease,
    transform 0.14s ease,
    visibility 0.14s;
}

.hb-pricing__credits-wrap:hover .hb-pricing__tip,
.hb-pricing__credits-wrap:focus-within .hb-pricing__tip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.hb-pricing__tip-title {
  margin: 0 0 0.45rem;
  font-size: var(--hb-text-sm);
  font-weight: 700;
  color: var(--hb-ink);
  line-height: 1.35;
}

.hb-pricing__tip-list {
  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-ink);
}

.hb-pricing__tip-meta {
  margin: 0.5rem 0 0;
  font-size: var(--hb-text-xs);
  line-height: 1.4;
  font-weight: 600;
  color: var(--hb-ink);
}

.hb-pricing__tip-meta + .hb-pricing__tip-meta {
  margin-top: 0.2rem;
  font-weight: 500;
}

.hb-public__feature-item {
  margin: 0;
  padding: var(--hb-space-4);
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius-lg);
  background: var(--hb-surface-solid, var(--hb-surface));
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-2);
}

.hb-public__feature-name {
  margin: 0;
  font-size: var(--hb-text-base);
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--hb-ink);
}

.hb-public__feature-body {
  margin: 0;
  font-size: var(--hb-text-sm);
  line-height: 1.55;
  color: var(--hb-muted);
}

.hb-public__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--hb-space-4);
  margin-top: var(--hb-space-1);
}

.hb-public__actions a {
  text-decoration: none;
}

.hb-public__text-link {
  font-size: var(--hb-text-sm);
  font-weight: 600;
  color: var(--hb-brand-deep);
  text-decoration: none;
}

.hb-public__text-link:hover {
  text-decoration: underline;
}

.hb-public__section-title {
  margin: 0;
  font-size: var(--hb-text-lg);
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--hb-ink);
}

.hb-public__section-lead {
  margin: 0;
  max-width: 32rem;
  font-size: var(--hb-text-sm);
  line-height: 1.55;
  color: var(--hb-muted);
}

.hb-public__feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: var(--hb-space-4);
}

.hb-public__feature-grid .hb-card {
  height: 100%;
  box-shadow: var(--hb-shadow-card);
}

.hb-public__footer {
  max-width: 64rem;
  width: 100%;
  margin: var(--hb-space-8) auto 0;
  padding-top: var(--hb-space-5);
  border-top: 1px solid var(--hb-line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--hb-space-3);
  font-size: var(--hb-text-sm);
}

.hb-public__footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--hb-space-3) var(--hb-space-4);
}

.hb-public__legal-hero {
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-3);
}

.hb-public__legal-sections {
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-4);
}

.hb-public__legal-body {
  margin: 0;
  line-height: 1.7;
  white-space: pre-line;
  color: var(--hb-ink-secondary);
}

/* Auth / login shell (pre AppShell) */
.hb-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--hb-space-6);
  background:
    radial-gradient(circle at 28px 28px, color-mix(in srgb, var(--hb-brand) 20%, transparent) 0 1px, transparent 1.5px) 0 0 / 64px 64px,
    radial-gradient(ellipse 70% 50% at 15% 0%, color-mix(in srgb, var(--hb-brand-dim) 18%, transparent), transparent 55%),
    radial-gradient(ellipse 60% 45% at 90% 10%, color-mix(in srgb, var(--hb-brand) 13%, transparent), transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 100%, color-mix(in srgb, var(--hb-brand-dim) 10%, transparent), transparent 50%),
    var(--hb-bg);
}

.hb-login-brand {
  display: flex;
  align-items: center;
  gap: var(--hb-space-3);
  margin-bottom: var(--hb-space-4);
}

.hb-login-brand .hb-brand-mark {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.75rem;
  object-fit: cover;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--hb-brand) 24%, transparent),
    0 0 24px var(--hb-magic-glow),
    0 8px 20px color-mix(in srgb, var(--hb-ink) 22%, transparent);
}

.hb-login-brand__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  line-height: 1.2;
}

.hb-login-brand__text strong {
  font-size: var(--hb-text-lg);
  letter-spacing: -0.02em;
}

.hb-login-brand__text span {
  font-size: var(--hb-text-2xs);
  font-weight: 600;
}

.hb-login .hb-card {
  width: min(100%, 26rem);
  box-shadow: var(--hb-shadow-card);
}

.hb-login a {
  text-decoration: none;
}

.hb-login a .hb-btn {
  width: 100%;
}

.hb-login-password-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.hb-login-forgot {
  align-self: flex-end;
  font-size: var(--hb-text-xs);
  font-weight: 600;
  color: var(--hb-brand-deep);
  text-decoration: none;
}

.hb-login-forgot:hover {
  text-decoration: underline;
}

.hb-login-back {
  display: block;
  font-size: var(--hb-text-sm);
  font-weight: 600;
  text-align: center;
  color: var(--hb-brand-deep);
  text-decoration: none;
}

.hb-login-back:hover {
  text-decoration: underline;
}

.hb-login-public-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--hb-space-3) var(--hb-space-4);
  margin-top: var(--hb-space-1);
}

.hb-login-mock-mail {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--hb-radius);
  border: 1px dashed color-mix(in srgb, var(--hb-brand) 40%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-brand-soft, var(--hb-surface-muted)) 50%, var(--hb-surface));
}

.hb-login-mock-mail__link {
  font-weight: 650;
  font-size: var(--hb-text-sm);
  color: var(--hb-brand-deep);
}

/* —— 天地系統：堆疊／區段預設不貼死 —— */
.hb-stack {
  display: flex;
  flex-direction: column;
  gap: var(--hb-gap-stack);
}

.hb-stack--tight {
  gap: var(--hb-gap-tight);
}

.hb-stack--loose {
  gap: var(--hb-gap-block);
}

/* 連續區塊（卡片／列表／空狀態）之間的呼吸 */
.hb-section {
  display: flex;
  flex-direction: column;
  gap: var(--hb-gap-block);
  min-width: 0;
}

.hb-form-error {
  margin: 0;
  color: var(--hb-danger-deep);
  font-size: var(--hb-text-sm);
  line-height: 1.5;
  padding: 0.15rem 0;
}

.hb-wizard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--hb-gap-inline);
  margin-top: var(--hb-gap-stack);
  padding-top: var(--hb-space-1);
}

.hb-wizard-actions > .hb-btn {
  flex: 1 1 auto;
  min-width: min(100%, 7.5rem);
}

@media (min-width: 560px) {
  .hb-wizard-actions > .hb-btn {
    flex: 0 0 auto;
    min-width: 0;
  }
}

.hb-stepper {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--hb-space-2);
}

.hb-stepper__item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.25rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--hb-radius-pill);
  border: 1px solid var(--hb-line);
  background: var(--hb-surface);
  color: var(--hb-muted);
  font-size: var(--hb-text-sm);
  font-weight: 600;
  cursor: pointer;
}

.hb-stepper__item.is-active {
  border-color: var(--hb-brand);
  color: var(--hb-brand-deep);
  background: var(--hb-brand-soft);
}

.hb-stepper__item.is-done {
  color: var(--hb-ink-secondary);
}

.hb-stepper__num {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--hb-surface-muted);
  font-size: var(--hb-text-2xs);
}

.hb-choice {
  display: flex;
  align-items: center;
  gap: var(--hb-space-3);
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius);
  background: var(--hb-surface);
  cursor: pointer;
}

.hb-choice.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.hb-avatar {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px solid color-mix(in srgb, var(--hb-surface) 80%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--hb-line) 55%, transparent);
}

.hb-avatar--sm {
  width: 1.375rem;
  height: 1.375rem;
  font-size: var(--hb-text-2xs);
  border-width: 1.5px;
}

.hb-avatar--lg {
  width: 2.85rem;
  height: 2.85rem;
  font-size: var(--hb-text-base);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--hb-line) 40%, transparent),
    0 3px 10px color-mix(in srgb, var(--hb-brand) 12%, transparent);
}

/* 底色由 avatar_color 帶入（後端配色皆為中間調），近黑字在那組上有 6:1 以上，
   不再需要原本用來救白字的暗色陰影。 */
.hb-avatar--initials {
  color: var(--hb-brand-on);
  font-size: var(--hb-text-2xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  user-select: none;
}

.hb-avatar--img {
  background: var(--hb-surface-muted);
}

.hb-script-row {
  padding: var(--hb-space-5);
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius-lg);
  background: var(--hb-surface-muted);
  display: flex;
  flex-direction: column;
  gap: var(--hb-gap-stack);
  margin: 0;
}

.hb-script-row.is-hidden {
  opacity: 0.72;
}

.hb-script-row__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hb-thread-preview {
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-3);
}

.hb-bubble {
  padding: var(--hb-space-4);
  border-radius: var(--hb-radius-lg);
  border: 1px solid var(--hb-line);
  background: var(--hb-bg);
}

.hb-bubble.is-root {
  border-color: var(--hb-brand);
  background: var(--hb-brand-soft);
}

.hb-bubble__meta {
  display: flex;
  align-items: center;
  gap: var(--hb-space-2);
  margin-bottom: var(--hb-space-2);
}

.hb-summary-list {
  margin: 0 0 var(--hb-space-3);
  padding-left: 1.2rem;
  line-height: 1.7;
  color: var(--hb-ink-secondary);
}

.hb-account-grid {
  display: grid;
  gap: var(--hb-space-3);
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .hb-account-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.hb-account-card {
  display: flex;
  gap: var(--hb-space-3);
  align-items: flex-start;
}

.hb-list-row {
  display: flex;
  justify-content: space-between;
  gap: var(--hb-gap-stack) var(--hb-gap-inline);
  align-items: flex-start;
  flex-wrap: wrap;
  min-width: 0;
  margin: 0;
}

.hb-list-row__actions {
  display: flex;
  align-items: center;
  gap: var(--hb-space-2);
  flex-wrap: wrap;
  width: 100%;
}

.hb-list-row__actions > .hb-btn {
  flex: 1 1 auto;
  min-width: min(100%, 6.5rem);
}

@media (min-width: 560px) {
  .hb-list-row__actions {
    width: auto;
  }

  .hb-list-row__actions > .hb-btn {
    flex: 0 0 auto;
    min-width: 0;
  }
}

.hb-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--hb-space-2);
}

@media (max-width: 520px) {
  .hb-filter-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.15rem;
    margin-inline: -0.15rem;
    padding-inline: 0.15rem;
    scrollbar-width: none;
  }

  .hb-filter-chips::-webkit-scrollbar {
    display: none;
  }

  .hb-filter-chips .hb-chip {
    flex: 0 0 auto;
  }
}

.hb-chip {
  min-height: 2rem;
  padding: 0.3rem 0.85rem;
  border-radius: var(--hb-radius-pill);
  border: 1px solid var(--hb-line);
  background: var(--hb-surface);
  color: var(--hb-ink-secondary);
  font-size: var(--hb-text-sm);
  font-weight: 600;
  cursor: pointer;
}

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

.hb-chip.is-active {
  background: var(--hb-brand-soft);
  border-color: var(--hb-brand);
  color: var(--hb-brand-deep);
}

/* —— 靈感：固定高度工作區（左右同高；左欄=上/訊息/底 三列 grid，底永不被裁） —— */
.hb-inspire-chat {
  /* 扣掉：頂欄 + 標題 + studio bar + tabs + 主區 padding */
  --hb-inspire-h: min(42rem, calc(100dvh - 17.5rem));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(13.5rem, 16rem);
  grid-template-rows: minmax(0, 1fr);
  gap: var(--hb-space-3);
  align-items: stretch;
  height: var(--hb-inspire-h);
  min-height: 20rem;
  max-height: var(--hb-inspire-h);
  overflow: hidden;
  margin: 0;
  box-sizing: border-box;
}

.hb-inspire-chat.is-library-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.hb-inspire-chat__main {
  /* 三列：頂固定 / 訊息吃剩餘可捲 / 底固定（輸入永遠在） */
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius-lg);
  background: var(--hb-surface);
  padding: 0.75rem 0.9rem 0.65rem;
  overflow: hidden;
  box-sizing: border-box;
}

.hb-inspire-chat__top {
  grid-row: 1;
  min-height: 0;
  max-height: 12rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-bottom: 0.5rem;
  margin-bottom: 0;
  border-bottom: 1px solid var(--hb-line);
  overflow: hidden;
  flex-shrink: 0;
}

/* session 選擇列 */
.hb-inspire-session-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  min-height: 2rem;
}

.hb-inspire-session-bar__label {
  font-size: var(--hb-text-2xs);
  font-weight: 600;
  color: var(--hb-muted);
  flex-shrink: 0;
}

.hb-inspire-session-select {
  flex: 1 1 8rem;
  min-width: 0;
  max-width: 100%;
  height: 2rem;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius);
  background: var(--hb-surface-muted, var(--hb-surface));
  color: var(--hb-text);
  font: inherit;
  font-size: var(--hb-text-xs);
  padding: 0 0.5rem;
}

.hb-inspire-session-bar__tools {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
}

.hb-inspire-trends {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 0;
}

.hb-inspire-trends__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  min-height: 1.75rem;
}

.hb-inspire-trends__title-block {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.hb-inspire-trends__label {
  font-size: var(--hb-text-xs);
  font-weight: 600;
  color: var(--hb-muted);
  letter-spacing: 0.01em;
}

.hb-inspire-trends__hint {
  font-size: var(--hb-text-2xs);
  color: var(--hb-muted);
  opacity: 0.85;
  line-height: 1.3;
}

.hb-inspire-trends__empty {
  font-size: var(--hb-text-2xs);
  color: var(--hb-muted);
  padding: 0.25rem 0;
}

.hb-inspire-trends__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
}

/* 頂部工具用文字鈕，避免與 chip 搶成兩排大按鈕 */
.hb-inspire-tool-btn {
  border: 0;
  background: transparent;
  color: var(--hb-muted);
  font: inherit;
  font-size: var(--hb-text-xs);
  font-weight: 600;
  padding: 0.35rem 0.5rem;
  min-height: 2rem;
  border-radius: var(--hb-radius);
  cursor: pointer;
  line-height: 1.3;
}

.hb-inspire-tool-btn:hover:not(:disabled) {
  color: var(--hb-brand-deep);
  background: var(--hb-surface-muted);
}

.hb-inspire-tool-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hb-inspire-trends__chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.2rem 0 0.35rem;
  -webkit-overflow-scrolling: touch;
  /* 單行 chip，高度放寬不裁切 */
  min-height: 2.5rem;
  align-items: center;
}

.hb-inspire-trend-chip-wrap {
  display: inline-flex;
  align-items: stretch;
  flex-shrink: 0;
  height: 2.15rem;
}

.hb-inspire-trend-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--hb-line);
  border-right: none;
  border-radius: var(--hb-radius-pill) 0 0 var(--hb-radius-pill);
  background: var(--hb-surface-muted);
  padding: 0 0.65rem 0 0.45rem;
  font-size: var(--hb-text-xs);
  cursor: pointer;
  color: var(--hb-text);
  line-height: 1.2;
  height: 100%;
  max-width: 12rem;
}

.hb-inspire-trend-chip:hover {
  border-color: color-mix(in srgb, var(--hb-brand) 40%, var(--hb-line));
}

.hb-inspire-trend-chip.is-seed {
  opacity: 0.85;
}

.hb-inspire-trend-chip__rank {
  flex-shrink: 0;
  min-width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--hb-brand) 18%, var(--hb-surface));
  color: var(--hb-muted);
  font-size: var(--hb-text-2xs);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hb-inspire-trend-chip__seed {
  font-size: var(--hb-text-2xs);
  color: var(--hb-muted);
  flex-shrink: 0;
}

.hb-inspire-trend-chip__heat {
  font-size: var(--hb-text-2xs);
  color: var(--hb-muted);
}

.hb-inspire-trend-chip__pin {
  border: 1px solid var(--hb-line);
  border-radius: 0 var(--hb-radius-pill) var(--hb-radius-pill) 0;
  background: var(--hb-surface);
  padding: 0 0.55rem;
  font-size: var(--hb-text-base);
  cursor: pointer;
  color: var(--hb-muted);
  height: 100%;
  line-height: 1;
}

.hb-inspire-trend-chip__pin:hover {
  color: var(--hb-brand-deep);
}

.hb-inspire-status {
  margin: 0.15rem 0 0;
  font-size: var(--hb-text-xs);
  max-height: 2.6rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 唯一會長內容的區域：中間列，吃掉剩餘高度並內捲 */
.hb-inspire-messages {
  grid-row: 2;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.55rem 0.1rem;
  -webkit-overflow-scrolling: touch;
}

.hb-inspire-msg {
  max-width: 90%;
  padding: 0.7rem 0.9rem;
  border-radius: var(--hb-radius);
  border: 1px solid var(--hb-line);
  background: var(--hb-surface-muted);
  flex-shrink: 0;
}

.hb-inspire-msg--user {
  align-self: flex-end;
  background: color-mix(in srgb, var(--hb-brand-soft, var(--hb-surface-muted)) 70%, var(--hb-surface));
  border-color: color-mix(in srgb, var(--hb-brand) 25%, var(--hb-line));
}

.hb-inspire-msg--assistant {
  align-self: flex-start;
}

.hb-inspire-msg__role {
  font-size: var(--hb-text-2xs);
  font-weight: 600;
  color: var(--hb-muted);
  margin-bottom: 0.2rem;
}

.hb-inspire-cursor {
  display: inline-block;
  margin-left: 1px;
  animation: hb-inspire-blink 1s step-end infinite;
  opacity: 0.7;
}
@keyframes hb-inspire-blink {
  50% {
    opacity: 0;
  }
}
.hb-inspire-msg__text {
  font-size: var(--hb-text-sm);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* AI 氣泡：markdown + 逐行換行 */
.hb-inspire-msg__md {
  font-size: var(--hb-text-sm);
  line-height: 1.65;
  word-break: break-word;
  overflow-wrap: anywhere;
  color: var(--hb-text);
}

.hb-inspire-msg__stream {
  position: relative;
}

.hb-inspire-msg__stream .hb-inspire-cursor {
  vertical-align: text-bottom;
}

.hb-inspire-stop {
  display: flex;
  justify-content: center;
  padding: 4px 0 8px;
}

/* —— 輕量 markdown（聊天泡泡：逐行換行，不擠成一團） —— */
.hb-md {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1.65;
}

.hb-md > :first-child {
  margin-top: 0;
}

.hb-md > :last-child {
  margin-bottom: 0;
}

/* 一般文字：每個實際換行 = 一行 */
.hb-md__line {
  display: block;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-height: 1.35em;
}

/* 原文空一行 → 段落間距 */
.hb-md__gap {
  display: block;
  height: 0.65em;
  flex-shrink: 0;
  pointer-events: none;
}

.hb-md__h {
  margin: 0.7em 0 0.3em;
  font-weight: 700;
  line-height: 1.4;
  color: var(--hb-text);
}

.hb-md__h:first-child {
  margin-top: 0;
}

.hb-md__h--1 {
  font-size: var(--hb-text-lg);
}

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

.hb-md__h--3 {
  font-size: var(--hb-text-sm);
}

.hb-md__ul,
.hb-md__ol {
  margin: 0.35em 0 0.55em;
  padding-left: 1.35em;
}

.hb-md__ul {
  list-style: disc;
}

.hb-md__ol {
  list-style: decimal;
}

.hb-md__ul li,
.hb-md__ol li {
  margin: 0.28em 0;
  padding-left: 0.15em;
  line-height: 1.6;
}

.hb-md__ul li::marker,
.hb-md__ol li::marker {
  color: var(--hb-muted);
}

.hb-md__quote {
  margin: 0.45em 0 0.55em;
  padding: 0.35em 0 0.35em 0.75em;
  border-left: 3px solid color-mix(in srgb, var(--hb-brand) 45%, var(--hb-line));
  color: var(--hb-muted);
  display: flex;
  flex-direction: column;
}

.hb-md__pre {
  margin: 0.45em 0 0.55em;
  padding: 0.55rem 0.7rem;
  border-radius: calc(var(--hb-radius) - 2px);
  background: color-mix(in srgb, var(--hb-surface-muted) 80%, #000 6%);
  border: 1px solid var(--hb-line);
  overflow-x: auto;
  font-size: var(--hb-text-xs);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--hb-font-mono);
}

.hb-md__pre code {
  font: inherit;
  background: none;
  padding: 0;
  border: 0;
}

.hb-md__code {
  font-family: var(--hb-font-mono);
  font-size: 0.85em;
  padding: 0.1em 0.35em;
  border-radius: 0.3em;
  background: color-mix(in srgb, var(--hb-surface-muted) 90%, var(--hb-brand) 6%);
  border: 1px solid color-mix(in srgb, var(--hb-line) 80%, transparent);
}

.hb-md__a {
  color: var(--hb-brand-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}

.hb-md__a:hover {
  filter: brightness(1.08);
}

.hb-md__hr {
  border: 0;
  border-top: 1px solid var(--hb-line);
  margin: 0.65em 0;
  width: 100%;
}

.hb-md strong {
  font-weight: 700;
}

.hb-md em {
  font-style: italic;
}

.hb-md del {
  opacity: 0.75;
}

.hb-inspire-draft {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--hb-line);
}

.hb-inspire-draft__body {
  margin: 0 0 0.5rem;
  font-family: inherit;
  font-size: var(--hb-text-sm);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.hb-inspire-chat__bottom {
  grid-row: 3;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.5rem;
  margin-top: 0;
  border-top: 1px solid var(--hb-line);
  background: var(--hb-surface);
  width: 100%;
  flex-shrink: 0;
  box-sizing: border-box;
}

.hb-inspire-composer {
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

/* 次要：產文 / ? / 已送 — 不佔大按鈕列，但要點得到 */
.hb-inspire-composer__tools {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.2rem 0.4rem;
  min-height: 1.85rem;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}

.hb-inspire-composer__tools .hb-inspire-tool-btn {
  min-height: 1.85rem;
  min-width: 1.85rem;
  padding: 0.2rem 0.5rem;
  font-size: var(--hb-text-xs);
}

.hb-inspire-composer__tools .hb-inspire-tool-btn--primary {
  font-weight: 700;
  color: var(--hb-brand-deep);
  background: color-mix(in srgb, var(--hb-brand) 12%, transparent);
  border-radius: var(--hb-radius);
}

/* ? 稍強調，避免擠成幾乎看不見 */
.hb-inspire-composer__tools .hb-inspire-tool-btn[aria-label] {
  font-weight: 700;
  color: var(--hb-text);
}

/* 產文：鎖定素材 */
.hb-inspire-material-modal {
  width: min(32rem, 100%);
  max-height: min(88dvh, 40rem);
  background: var(--hb-surface);
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius-lg, 0.75rem);
  box-shadow: 0 18px 48px color-mix(in srgb, #000 28%, transparent);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem 1.15rem 1.1rem;
  overflow: auto;
  box-sizing: border-box;
}

.hb-inspire-material-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.hb-inspire-material-modal__hint {
  margin: 0.35rem 0 0;
  font-size: var(--hb-text-xs);
  color: var(--hb-muted);
  line-height: 1.45;
}

.hb-inspire-material-modal__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: var(--hb-text-xs);
  font-weight: 600;
  color: var(--hb-muted);
}

.hb-inspire-material-modal__field .hb-textarea,
.hb-inspire-material-modal__field .hb-input {
  font-weight: 400;
  color: var(--hb-text);
  width: 100%;
  box-sizing: border-box;
}

.hb-inspire-material-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* 聊天軟體列：輸入 + 右側圓形發送（與對話框底緣對齊） */
.hb-inspire-composer__row {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 0.5rem;
  min-width: 0;
  width: 100%;
}

/* 本輪參考：多 pin 橫向捲 */
.hb-inspire-pinned {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.85rem;
  max-height: 1.85rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.hb-inspire-pinned__label {
  font-size: var(--hb-text-2xs);
  font-weight: 600;
  color: var(--hb-muted);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.hb-inspire-pinned__count {
  font-weight: 500;
  opacity: 0.85;
}

.hb-inspire-pinned__empty {
  font-size: var(--hb-text-2xs);
  color: var(--hb-muted);
  opacity: 0.85;
}

.hb-inspire-pin-chip {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius-pill);
  background: var(--hb-surface-muted);
  font-size: var(--hb-text-2xs);
  flex-shrink: 0;
  overflow: hidden;
}

.hb-inspire-pin-chip.is-on {
  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)) 60%, var(--hb-surface));
}

.hb-inspire-pin-chip__main {
  border: 0;
  background: transparent;
  color: var(--hb-text);
  font: inherit;
  font-weight: 600;
  padding: 0.2rem 0.45rem 0.2rem 0.55rem;
  cursor: pointer;
  white-space: nowrap;
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hb-inspire-pin-chip__main:hover {
  color: var(--hb-brand-deep);
}

.hb-inspire-pin-chip__x {
  border: 0;
  border-left: 1px solid color-mix(in srgb, var(--hb-line) 80%, transparent);
  background: transparent;
  color: var(--hb-muted);
  font: inherit;
  font-size: var(--hb-text-sm);
  line-height: 1;
  padding: 0 0.4rem;
  cursor: pointer;
}

.hb-inspire-pin-chip__x:hover {
  color: var(--hb-text);
  background: color-mix(in srgb, var(--hb-surface) 50%, transparent);
}

.hb-inspire-flow-one-liner {
  margin: 0;
  padding: 0.35rem 0.15rem 0.15rem;
  font-size: var(--hb-text-2xs);
  color: var(--hb-muted);
  flex-shrink: 0;
}

.hb-inspire-empty-guide {
  padding: 1.25rem 0.75rem 1rem;
  text-align: center;
  flex-shrink: 0;
}

.hb-inspire-empty-guide__title {
  margin: 0 0 0.4rem;
  font-size: var(--hb-text-base);
  font-weight: 700;
  color: var(--hb-text);
}

.hb-inspire-empty-guide__desc {
  margin: 0 0 1rem;
  font-size: var(--hb-text-sm);
  color: var(--hb-muted);
  line-height: 1.5;
  max-width: 22rem;
  margin-inline: auto;
}

.hb-inspire-empty-guide__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
}

.hb-inspire-tool-btn.is-on {
  color: var(--hb-brand-deep);
  background: color-mix(in srgb, var(--hb-brand) 12%, transparent);
}

.hb-inspire-library__head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.hb-inspire-ready-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--hb-radius);
  border: 1px dashed color-mix(in srgb, var(--hb-brand) 40%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-brand) 6%, var(--hb-surface));
  font-size: var(--hb-text-xs);
  color: var(--hb-text);
  flex-shrink: 0;
}

.hb-inspire-composer__row .hb-field {
  margin: 0;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  width: auto;
  min-width: 0;
  gap: 0;
}

.hb-inspire-composer__row .hb-field__label:empty {
  display: none;
}

.hb-inspire-composer .hb-textarea {
  resize: none;
  display: block;
  width: 100%;
  box-sizing: border-box;
  /* 明確蓋掉全域 .hb-textarea min-height: 6.5rem，與送出圓鈕同高對齊 */
  min-height: 2.75rem !important;
  max-height: 5.5rem;
  height: auto;
  font-size: var(--hb-text-sm);
  line-height: 1.4;
  padding: 0.6rem 0.85rem;
  border-radius: 1.25rem;
  field-sizing: content;
}

.hb-inspire-send-btn {
  flex: 0 0 2.75rem;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-end;
  background: var(--hb-brand);
  color: var(--hb-brand-on);
  cursor: pointer;
  line-height: 0;
  box-shadow: 0 1px 2px color-mix(in srgb, #000 12%, transparent);
  transition: opacity 0.12s ease, transform 0.12s ease, background 0.12s ease;
}

.hb-inspire-send-btn:hover:not(:disabled) {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.hb-inspire-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.hb-inspire-send-btn .hb-app-icon {
  display: block;
  flex-shrink: 0;
}

.hb-inspire-send-btn__dots {
  display: block;
  font-size: var(--hb-text-base);
  font-weight: 700;
  line-height: 1;
  width: 1em;
  text-align: center;
}

.hb-inspire-fp-bar__ok {
  color: var(--hb-success);
  font-weight: 600;
}

.hb-inspire-fp-bar__bad {
  color: var(--hb-danger-deep);
  font-weight: 600;
}

/* portal 到 body：不進 inspire grid，避免擠壞雙欄固定高度 */
.hb-inspire-prompt-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--hb-scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  box-sizing: border-box;
}

.hb-inspire-prompt-modal {
  width: min(52rem, 100%);
  height: min(88dvh, 52rem);
  max-height: min(88dvh, 52rem);
  background: var(--hb-surface);
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius-lg, 0.75rem);
  box-shadow: 0 18px 48px color-mix(in srgb, #000 28%, transparent);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.hb-inspire-prompt-modal__head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem 0.75rem;
  border-bottom: 1px solid var(--hb-line);
}

.hb-inspire-prompt-modal__head-text {
  min-width: 0;
  flex: 1 1 auto;
}

.hb-inspire-prompt-modal__fp {
  margin: 0.35rem 0 0;
  font-size: var(--hb-text-xs);
  color: var(--hb-muted);
  word-break: break-all;
  line-height: 1.4;
}

.hb-inspire-prompt-modal__actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.hb-inspire-prompt-modal__how {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.55rem 1.15rem;
  font-size: var(--hb-text-xs);
  color: var(--hb-muted);
  line-height: 1.45;
  border-bottom: 1px solid var(--hb-line);
}

.hb-inspire-prompt-modal__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.85rem 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  -webkit-overflow-scrolling: touch;
}

.hb-inspire-prompt-block {
  flex: 0 0 auto;
  border: 1px solid var(--hb-line);
  border-radius: 0.5rem;
  background: var(--hb-surface-muted, var(--hb-surface));
  overflow: hidden;
}

.hb-inspire-prompt-block__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0.7rem;
  font-size: var(--hb-text-xs);
  font-weight: 600;
  border-bottom: 1px solid var(--hb-line);
  background: color-mix(in srgb, var(--hb-surface) 70%, var(--hb-surface-muted));
}

.hb-inspire-prompt-block__body {
  margin: 0;
  padding: 0.7rem 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: var(--hb-text-xs);
  line-height: 1.55;
  font-family: var(--hb-font-mono);
}

/* 右欄：吃 grid 欄寬，勿再寫死 16.5rem（會撐破雙欄） */
.hb-inspire-library {
  width: 100%;
  min-width: 0;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius-lg);
  background: var(--hb-surface);
  padding: 0.75rem 0.7rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  align-self: stretch;
  box-sizing: border-box;
}

.hb-inspire-library__head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 0.55rem;
  margin-bottom: 0.55rem;
  border-bottom: 1px solid var(--hb-line);
  min-height: 2rem;
}

.hb-inspire-library__head strong {
  font-size: var(--hb-text-sm);
}

.hb-inspire-library__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0.15rem 0.1rem 0.5rem 0;
  -webkit-overflow-scrolling: touch;
}

.hb-inspire-add {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--hb-line);
}

.hb-inspire-lib-section__title {
  margin: 0 0 0.35rem;
  font-size: var(--hb-text-2xs);
  font-weight: 600;
  color: var(--hb-muted);
  text-transform: none;
  letter-spacing: 0.02em;
}

.hb-inspire-lib-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.hb-inspire-el-row {
  display: flex;
  align-items: stretch;
  gap: 0.15rem;
}

.hb-inspire-el {
  flex: 1;
  text-align: left;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius);
  background: var(--hb-surface-muted);
  padding: 0.4rem 0.55rem;
  cursor: pointer;
  color: inherit;
  min-width: 0;
}

.hb-inspire-el:hover {
  border-color: color-mix(in srgb, var(--hb-brand) 35%, var(--hb-line));
}

.hb-inspire-el.is-pinned,
.hb-inspire-el-row.is-pinned .hb-inspire-el {
  border-color: color-mix(in srgb, var(--hb-brand) 50%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-brand-soft, var(--hb-surface-muted)) 55%, var(--hb-surface));
}

.hb-inspire-el__title {
  display: block;
  font-size: var(--hb-text-sm);
  font-weight: 600;
}

.hb-inspire-el__meta {
  display: block;
  font-size: var(--hb-text-2xs);
  color: var(--hb-muted);
  margin-top: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hb-inspire-el__del {
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius);
  background: transparent;
  width: 1.75rem;
  cursor: pointer;
  color: var(--hb-muted);
  flex-shrink: 0;
}

.hb-inspire-el__del:hover {
  color: var(--hb-text);
}

@media (max-width: 899px) {
  .hb-inspire-chat {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    --hb-inspire-h: min(34rem, calc(100dvh - 12rem - var(--hb-dock-height, 3.75rem)));
    height: var(--hb-inspire-h);
    max-height: var(--hb-inspire-h);
    min-height: 18rem;
    overflow: hidden;
    gap: var(--hb-space-2);
    margin: 0;
  }

  .hb-inspire-chat__main {
    height: 100%;
    max-height: 100%;
    min-height: 0;
    padding: 0.65rem 0.7rem 0.55rem;
  }

  .hb-inspire-library {
    width: 100%;
    min-width: 0;
    height: auto;
    max-height: 9.5rem;
    min-height: 7rem;
  }

  .hb-inspire-chat__top {
    max-height: 6.5rem;
    gap: 0.35rem;
    padding-bottom: 0.4rem;
  }

  .hb-inspire-trends__tools {
    width: auto;
  }

  .hb-inspire-composer .hb-textarea {
    min-height: 2.5rem !important;
    max-height: 4.5rem;
  }

  .hb-inspire-send-btn {
    flex-basis: 2.5rem;
    width: 2.5rem;
    height: 2.5rem;
  }
}

/* legacy inspire (unused screens) */
.hb-inspire {
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-3);
}

.hb-inspire-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-3);
  padding: var(--hb-space-3) var(--hb-space-4);
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius-lg);
  background: var(--hb-surface);
}

.hb-inspire-search-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--hb-space-2);
  align-items: end;
}

.hb-inspire-search-row .hb-field {
  margin: 0;
}

.hb-inspire-search-row .hb-field__label:empty {
  display: none;
}

.hb-inspire-opt-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--hb-space-2);
  align-items: end;
}

@media (min-width: 720px) {
  .hb-inspire-opt-row {
    grid-template-columns: 1fr 1fr auto;
  }
}

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

.hb-inspire-angle-card {
  text-align: left;
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius);
  background: var(--hb-surface);
  color: inherit;
  font: inherit;
  line-height: 1.5;
  cursor: pointer;
}

.hb-inspire-angle-card:hover {
  border-color: var(--hb-brand);
}

.hb-inspire-angle-card.is-selected {
  border-color: color-mix(in srgb, var(--hb-brand) 45%, var(--hb-line));
  background: var(--hb-brand-soft);
}


.hb-tab__count {
  opacity: 0.75;
  font-weight: 500;
  font-size: 0.85em;
}

/* 海巡批次 */
.hb-scout-run-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.5rem;
}

.hb-scout-run-item {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius);
  background: var(--hb-surface-muted);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.hb-scout-run-item:hover,
.hb-scout-run-item.is-active {
  border-color: color-mix(in srgb, var(--hb-brand) 55%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-brand) 9%, var(--hb-surface-muted));
}

.hb-scout-run-item__meta {
  color: var(--hb-muted);
  font-size: var(--hb-text-2xs);
  font-weight: 600;
}

.hb-scout-run-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem 0.85rem;
  align-items: end;
}

@media (max-width: 520px) {
  .hb-scout-run-row {
    grid-template-columns: 1fr;
  }

  .hb-scout-run-row__action {
    justify-self: start;
  }
}

.hb-scout-run-row__action {
  padding-bottom: 0.05rem;
}

.hb-scout-now__meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.hb-scout-now__stance {
  margin: 0;
  font-size: var(--hb-text-xs);
  line-height: 1.4;
}

/* 命中依主題分組 */
.hb-scout-theme-chips {
  min-height: auto;
  max-height: none;
  flex-wrap: wrap;
  overflow: visible;
  gap: 0.4rem;
}

.hb-scout-theme-list {
  display: flex;
  flex-direction: column;
  gap: var(--hb-gap-block);
  margin: 0;
  padding: 0;
  list-style: none;
}

.hb-scout-theme-group {
  display: flex;
  flex-direction: column;
  gap: var(--hb-gap-stack);
  padding: 0;
  margin: 0;
}

.hb-scout-theme-group__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--hb-gap-inline);
  padding-bottom: var(--hb-space-3);
  margin: 0;
  border-bottom: 1px solid var(--hb-line);
}

.hb-scout-theme-group__title {
  font-size: var(--hb-text-base);
  font-weight: 650;
  line-height: 1.35;
}

/* 探查：今日進度 + 現在這一則 + 佇列 */
.hb-scout-today-row {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 0.75rem 1.25rem;
  align-items: end;
}

@media (max-width: 520px) {
  .hb-scout-today-row {
    grid-template-columns: 1fr;
  }
}

.hb-scout-progress {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  padding-bottom: 0.15rem;
}

.hb-scout-schedule-note {
  margin: 0;
  color: var(--hb-muted);
  font-size: var(--hb-text-xs);
  line-height: 1.55;
}

.hb-scout-now__text {
  margin: 0;
  font-size: var(--hb-text-base);
  line-height: 1.55;
}

.hb-scout-queue-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--hb-gap-tight);
  width: 100%;
  text-align: left;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius);
  background: var(--hb-surface-muted);
  cursor: pointer;
  color: inherit;
  font: inherit;
  margin: 0;
}

.hb-scout-queue-item:hover {
  border-color: color-mix(in srgb, var(--hb-brand) 40%, var(--hb-line));
}

.hb-scout-queue-item.is-active {
  border-color: color-mix(in srgb, var(--hb-brand) 55%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-brand) 9%, var(--hb-surface-muted));
}

.hb-scout-queue-item__meta {
  font-size: var(--hb-text-2xs);
  color: var(--hb-muted);
  font-weight: 600;
}

.hb-scout-queue-item__text {
  font-size: var(--hb-text-sm);
  line-height: 1.45;
}

.hb-chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--hb-gap-tight) var(--hb-gap-inline);
  margin: 0;
}

.hb-chip.is-static {
  cursor: default;
  opacity: 0.95;
}

.hb-chip.is-static:hover {
  border-color: var(--hb-line);
  color: var(--hb-ink-secondary);
}

/* —— 品牌庫（Apple 式：手機橫向 chip、桌面左軌） —— */
.hb-brands {
  display: flex;
  flex-direction: column;
  gap: var(--hb-gap-section);
  min-height: 12rem;
  margin: 0;
}

@media (min-width: 900px) {
  .hb-brands {
    display: grid;
    grid-template-columns: minmax(15rem, 17.5rem) minmax(0, 1fr);
    gap: var(--hb-gap-section);
    align-items: start;
  }
}

.hb-brands__rail {
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius-xl);
  background: var(--hb-surface);
  box-shadow: var(--hb-shadow-card);
  padding: var(--hb-space-5);
  display: flex;
  flex-direction: column;
  gap: var(--hb-gap-stack);
}

.hb-brands__rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--hb-space-3);
}

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

.hb-brands__rail-label {
  font-size: var(--hb-text-base);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.hb-brands__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  border-radius: var(--hb-radius-pill);
  background: var(--hb-brand-soft);
  color: var(--hb-brand-deep);
  font-size: var(--hb-text-2xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hb-brands__create {
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-3);
  padding: var(--hb-space-3);
  border-radius: var(--hb-radius-lg);
  background: var(--hb-surface-muted);
}

.hb-brands__search {
  width: 100%;
}

.hb-brands__empty-hint {
  margin: 0;
  padding: var(--hb-space-3) var(--hb-space-1);
  font-size: var(--hb-text-sm);
  color: var(--hb-muted);
  line-height: 1.5;
}

/* 手機：橫向可捲 chip；桌面：直列清單 */
.hb-brands__chips {
  display: flex;
  flex-direction: row;
  gap: var(--hb-space-2);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  padding-bottom: 0.15rem;
  margin: 0 calc(var(--hb-space-4) * -1);
  padding-left: var(--hb-space-4);
  padding-right: var(--hb-space-4);
  scrollbar-width: thin;
}

@media (min-width: 900px) {
  .hb-brands__chips {
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: min(32rem, 68vh);
    margin: 0;
    padding: 0;
    scroll-snap-type: none;
  }
}

.hb-brands__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex: 0 0 auto;
  min-height: var(--hb-touch);
  max-width: 12rem;
  padding: 0.45rem 0.85rem 0.45rem 0.45rem;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius-pill);
  background: var(--hb-surface);
  color: var(--hb-ink);
  font: inherit;
  font-weight: 600;
  font-size: var(--hb-text-sm);
  cursor: pointer;
  scroll-snap-align: start;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  text-align: left;
}

@media (min-width: 900px) {
  .hb-brands__chip {
    width: 100%;
    max-width: none;
    border-radius: var(--hb-radius);
    padding: 0.65rem 0.75rem;
  }
}

.hb-brands__chip:hover {
  border-color: color-mix(in srgb, var(--hb-brand) 40%, var(--hb-line));
  background: var(--hb-brand-soft);
}

.hb-brands__chip.is-active {
  border-color: color-mix(in srgb, var(--hb-brand) 40%, var(--hb-line));
  background: var(--hb-brand-soft);
  color: var(--hb-brand-deep);
}

.hb-brands__chip-mark {
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: linear-gradient(
    145deg,
    var(--hb-accent-warm),
    var(--hb-brand)
  );
  color: var(--hb-brand-on);
  font-size: var(--hb-text-xs);
  font-weight: 700;
  flex-shrink: 0;
}

/* 選中時只加深暖色那一端；漸層收到 --hb-brand-deep 會讓近黑字在深端看不見。 */
.hb-brands__chip.is-active .hb-brands__chip-mark {
  background: linear-gradient(145deg, var(--hb-accent-warm), var(--hb-brand));
}

.hb-brands__chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hb-brands__panel {
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius-xl);
  background: var(--hb-surface);
  box-shadow: var(--hb-shadow-card);
  padding: var(--hb-space-5);
  min-height: 14rem;
  display: flex;
  flex-direction: column;
  gap: var(--hb-gap-block);
  margin: 0;
}

@media (min-width: 640px) {
  .hb-brands__panel {
    padding: var(--hb-space-6);
  }
}

.hb-brands__panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--hb-gap-stack);
  margin: 0;
}

.hb-brands__panel-identity {
  display: flex;
  align-items: center;
  gap: var(--hb-space-3);
  min-width: 0;
}

.hb-brands__avatar {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--hb-accent-warm), var(--hb-brand));
  color: var(--hb-brand-on);
  font-size: var(--hb-text-lg);
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: var(--hb-shadow-soft);
  border: 2px solid color-mix(in srgb, var(--hb-surface) 70%, transparent);
}

.hb-brands__panel-titles {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.hb-brands__panel-titles h2 {
  margin: 0;
  font-size: var(--hb-text-xl);
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hb-brands__panel-titles p {
  margin: 0;
  font-size: var(--hb-text-xs);
  line-height: 1.4;
}

.hb-brands__form {
  display: flex;
  flex-direction: column;
  gap: var(--hb-gap-stack);
  max-width: 32rem;
  margin: 0;
}

.hb-brands__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--hb-gap-inline);
  padding-top: var(--hb-space-2);
  margin: 0;
}

.hb-brands__actions .hb-btn {
  min-height: var(--hb-touch);
  min-width: 6.5rem;
}

.hb-brands__danger-ghost {
  color: var(--hb-danger) !important;
  border-color: transparent !important;
  margin-left: auto;
}

.hb-brands__danger-ghost:hover:not(:disabled) {
  background: var(--hb-danger-soft) !important;
  color: var(--hb-danger) !important;
  border-color: transparent !important;
}

.hb-brands__products {
  display: flex;
  flex-direction: column;
  gap: var(--hb-gap-stack);
  margin: 0;
}

.hb-brands__products-bar {
  display: flex;
  flex-direction: column;
  gap: var(--hb-gap-inline);
  margin: 0;
}

@media (min-width: 560px) {
  .hb-brands__products-bar {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }

  .hb-brands__products-search {
    flex: 1;
    min-width: 0;
    max-width: 18rem;
  }
}

.hb-brands__product-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--hb-gap-stack);
}

.hb-brands__product-card {
  display: flex;
  flex-direction: column;
  gap: var(--hb-gap-stack);
  margin: 0;
  padding: var(--hb-space-5);
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius-lg);
  background: var(--hb-bg);
}

.hb-brands__product-form {
  display: flex;
  flex-direction: column;
  gap: var(--hb-gap-stack);
  margin: 0;
}

.hb-brands__product-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--hb-space-2);
}

.hb-brands__product-name {
  font-size: var(--hb-text-base);
  letter-spacing: -0.01em;
}

.hb-brands__product-meta {
  margin: 0;
  font-size: var(--hb-text-sm);
  line-height: 1.5;
  color: var(--hb-ink-secondary);
}

.hb-brands__product-body {
  margin: 0;
  font-size: var(--hb-text-sm);
  line-height: 1.6;
  color: var(--hb-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hb-brands__product-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--hb-space-2);
  padding-top: var(--hb-space-1);
}

@media (min-width: 480px) {
  .hb-brands__product-actions {
    display: flex;
    justify-content: flex-start;
  }

  .hb-brands__product-actions .hb-btn {
    min-width: 5.5rem;
  }
}

.hb-brands__product-form {
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-4);
  padding: var(--hb-space-4);
  border-radius: var(--hb-radius-lg);
  background: var(--hb-surface-muted);
  border: 1px solid var(--hb-line);
}

@media (min-width: 640px) {
  .hb-brands__product-form {
    padding: var(--hb-space-5);
  }
}

.hb-brands__product-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--hb-space-3);
}

.hb-brands__product-form-head h3 {
  margin: 0;
  font-size: var(--hb-text-lg);
  letter-spacing: -0.01em;
}

.hb-brands__import {
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-3);
  padding-bottom: var(--hb-space-2);
  border-bottom: 1px solid var(--hb-line);
}

@media (min-width: 560px) {
  .hb-brands__import {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
  }
}

/* 相容舊 class（其他頁若仍引用） */
.hb-brand-layout {
  display: contents;
}

.hb-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--hb-gap-inline);
  margin: 0;
  padding-top: var(--hb-gap-stack);
  border-top: 1px solid color-mix(in srgb, var(--hb-line) 80%, transparent);
}

.hb-pager--compact {
  border-top: 0;
  padding-top: var(--hb-space-2);
  justify-content: center;
}

.hb-pager__meta {
  font-size: var(--hb-text-sm);
  min-width: 5rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.hb-pager__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--hb-gap-tight);
}

.hb-pager__controls .hb-field {
  min-width: 5.5rem;
  margin: 0;
}

.hb-pager__page {
  font-size: var(--hb-text-sm);
  font-weight: 650;
  min-width: 3.75rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.hb-pager__count {
  opacity: 0.75;
}

.hb-inspire-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius-lg);
  background: var(--hb-surface);
  max-height: min(28rem, 60vh);
  overflow-y: auto;
}

.hb-inspire-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.15rem 0.75rem;
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  border: none;
  border-bottom: 1px solid var(--hb-line);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background 0.12s ease;
}

.hb-inspire-row:last-child {
  border-bottom: none;
}

.hb-inspire-row:hover {
  background: var(--hb-surface-muted);
}

.hb-inspire-row.is-selected {
  background: var(--hb-brand-soft);
  border-color: color-mix(in srgb, var(--hb-brand) 35%, var(--hb-line));
}

.hb-inspire-row__title {
  grid-column: 1;
  font-weight: 650;
  font-size: var(--hb-text-base);
  line-height: 1.3;
}

.hb-inspire-row__meta {
  grid-column: 2;
  grid-row: 1;
  font-size: var(--hb-text-2xs);
  font-weight: 600;
  color: var(--hb-ink-secondary);
  white-space: nowrap;
  align-self: start;
}

.hb-inspire-heat {
  color: var(--hb-brand-deep);
  font-variant-numeric: tabular-nums;
}

.hb-inspire-row__snip {
  grid-column: 1 / -1;
  font-size: var(--hb-text-xs);
  color: var(--hb-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hb-inspire-detail {
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-4);
  padding: var(--hb-space-4);
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius-lg);
  background: var(--hb-surface);
  min-height: 14rem;
}

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

.hb-inspire-detail__title {
  margin: 0;
  font-size: var(--hb-text-lg);
  font-weight: 700;
  line-height: 1.3;
}

.hb-inspire-detail__summary {
  margin: 0;
  line-height: 1.55;
  color: var(--hb-ink-secondary);
}

.hb-inspire-detail__kw {
  margin: 0;
  font-size: var(--hb-text-xs);
}

.hb-inspire-detail__label {
  display: block;
  font-size: var(--hb-text-2xs);
  font-weight: 650;
  color: var(--hb-muted);
  margin-bottom: var(--hb-space-2);
  letter-spacing: 0.02em;
}

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

.hb-inspire-quote-btn {
  margin: 0;
  padding: 0.55rem 0.75rem;
  border-left: 3px solid var(--hb-line);
  border-top: none;
  border-right: none;
  border-bottom: none;
  background: var(--hb-surface-muted);
  border-radius: 0 var(--hb-radius) var(--hb-radius) 0;
  font-size: var(--hb-text-sm);
  color: var(--hb-ink-secondary);
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  font: inherit;
  width: 100%;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.hb-inspire-quote-btn:hover {
  border-left-color: var(--hb-brand);
}

.hb-inspire-quote-btn.is-picked {
  border-left-color: var(--hb-brand);
  background: var(--hb-brand-soft);
  color: var(--hb-ink);
}

.hb-inspire-angle {
  padding: var(--hb-space-3);
  border-radius: var(--hb-radius);
  background: var(--hb-surface-muted);
  border: 1px dashed var(--hb-line);
}

.hb-inspire-angle__hook {
  margin: 0 0 var(--hb-space-2);
  font-weight: 600;
  line-height: 1.5;
}

.hb-inspire-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--hb-space-2);
  margin-top: auto;
  padding-top: var(--hb-space-2);
}

@media (max-width: 899px) {
  .hb-inspire-list {
    max-height: 14rem;
  }

  .hb-inspire-search-row {
    grid-template-columns: 1fr 1fr;
  }

  .hb-inspire-search-row .hb-field {
    grid-column: 1 / -1;
  }
}

.hb-progress {
  height: 0.5rem;
  border-radius: var(--hb-radius-pill);
  background: var(--hb-surface-muted);
  overflow: hidden;
}

.hb-progress--sm {
  height: 0.35rem;
  margin-top: 0.35rem;
}

.hb-progress__bar {
  height: 100%;
  background: var(--hb-brand);
  border-radius: var(--hb-radius-pill);
  transition: width 0.2s ease;
}

.hb-progress__bar.is-warn {
  background: var(--hb-warning);
}

.hb-progress__bar.is-danger {
  background: var(--hb-danger);
}

.hb-banner-warn {
  margin: 0;
  padding: 0.65rem 0.85rem;
  border-radius: var(--hb-radius);
  border: 1px solid color-mix(in srgb, var(--hb-warning) 45%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-warning) 12%, var(--hb-surface));
  font-size: var(--hb-text-sm);
  line-height: 1.45;
}

/* —— 用量與方案 —— */
.hb-usage-mine {
  gap: var(--hb-gap-section, 1.1rem);
}

.hb-usage-sub__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1.25rem;
}

.hb-usage-sub__label {
  display: block;
  font-size: var(--hb-text-xs);
  font-weight: 650;
  color: var(--hb-muted);
  margin-bottom: 0.2rem;
}

.hb-usage-sub__plan {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.hb-usage-sub__plan strong {
  font-size: var(--hb-text-xl);
  font-weight: 750;
  letter-spacing: -0.02em;
}

.hb-usage-sub__meta {
  margin: 0.3rem 0 0;
  font-size: var(--hb-text-sm);
  color: var(--hb-muted);
}

.hb-usage-sub__caps {
  margin: 0.25rem 0 0;
  font-size: var(--hb-text-xs);
  color: var(--hb-text);
  font-weight: 600;
  line-height: 1.4;
}

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

.hb-usage-status {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.hb-usage-status__nums {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
}

.hb-usage-status__big {
  margin: 0.2rem 0 0;
  font-size: var(--hb-text-2xl);
  font-weight: 750;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.hb-usage-status__remain .hb-usage-status__big {
  color: var(--hb-brand-deep);
}

.hb-usage-status__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  font-size: var(--hb-text-sm);
}

.hb-usage-disclosure {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-align: left;
}

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

/* 三欄比價 */
.hb-plans-page {
  gap: var(--hb-gap-section, 1.15rem);
}

.hb-plans-page__current {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  font-size: var(--hb-text-sm);
}

.hb-plans-page__current strong {
  font-weight: 750;
}

.hb-plans-page__caps {
  flex-basis: 100%;
  font-size: var(--hb-text-xs);
  font-weight: 600;
  color: var(--hb-text);
}

.hb-plans-page__back {
  margin-left: auto;
  font-size: var(--hb-text-xs);
  font-weight: 650;
  color: var(--hb-muted);
  text-decoration: none;
}

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

.hb-pricing {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: stretch;
}

@media (max-width: 800px) {
  .hb-pricing {
    grid-template-columns: 1fr;
  }
}

.hb-pricing__card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.1rem 1.15rem;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius-lg);
  background: var(--hb-surface);
  min-width: 0;
}

.hb-pricing__card.is-popular {
  border-color: color-mix(in srgb, var(--hb-brand) 45%, var(--hb-line));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--hb-brand) 18%, transparent);
}

.hb-pricing__card.is-current {
  background: color-mix(in srgb, var(--hb-brand-soft, var(--hb-surface-muted)) 45%, var(--hb-surface));
}

.hb-pricing__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.hb-pricing__name {
  margin: 0;
  font-size: var(--hb-text-lg);
  font-weight: 750;
}

.hb-pricing__blurb {
  margin: 0.35rem 0 0;
  font-size: var(--hb-text-sm);
  color: var(--hb-muted);
  line-height: 1.4;
}

.hb-pricing__price {
  margin: 0.85rem 0 0;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.hb-pricing__price strong {
  font-size: var(--hb-text-xl);
  font-weight: 750;
  letter-spacing: -0.03em;
}

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

.hb-pricing__credits {
  margin: 0.25rem 0 0;
  font-size: var(--hb-text-sm);
  color: var(--hb-muted);
  font-variant-numeric: tabular-nums;
}

.hb-pricing__credits strong {
  color: var(--hb-text);
  font-weight: 700;
}

.hb-pricing__softcaps {
  margin: 0.35rem 0 0;
  font-size: var(--hb-text-xs);
  font-weight: 650;
  line-height: 1.4;
  color: var(--hb-text);
}

.hb-pricing__softcaps--pts {
  margin-top: 0.15rem;
  font-weight: 500;
  color: var(--hb-muted);
}

.hb-pricing__bullets {
  margin: 0;
  padding: 0 0 0 1.05rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: var(--hb-text-sm);
  line-height: 1.45;
}

.hb-pricing__cta {
  margin-top: auto;
}

.hb-pricing__cta .hb-btn {
  width: 100%;
}

/* 結帳兩欄 */
.hb-checkout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(14rem, 18rem);
  gap: 1rem 1.25rem;
  align-items: start;
}

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

  .hb-checkout__aside {
    order: -1;
  }
}

.hb-checkout__order {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
}

.hb-checkout__big-price {
  margin: 0.15rem 0 0;
  font-size: var(--hb-text-2xl);
  font-weight: 750;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.hb-checkout__period {
  margin-left: 0.2rem;
  font-size: var(--hb-text-base);
  font-weight: 600;
  color: var(--hb-muted);
  letter-spacing: 0;
}

.hb-checkout__aside .hb-btn {
  width: 100%;
}

.hb-checkout__links {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.85rem;
  font-size: var(--hb-text-sm);
}

.hb-checkout__links a {
  color: var(--hb-muted);
  text-decoration: none;
}

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

.hb-usage-ring {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem 1.75rem;
}

.hb-usage-ring__visual {
  position: relative;
  width: 148px;
  height: 148px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 50%;
}

.hb-usage-ring__track {
  stroke: var(--hb-surface-muted);
}

.hb-usage-ring__fill {
  stroke: var(--hb-brand);
  transition: stroke-dasharray 0.25s ease;
}

.hb-usage-ring__visual.is-warn .hb-usage-ring__fill {
  stroke: var(--hb-warning);
}

.hb-usage-ring__visual.is-over .hb-usage-ring__fill {
  stroke: var(--hb-danger);
}

.hb-usage-ring__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  pointer-events: none;
}

.hb-usage-ring__center strong {
  font-size: var(--hb-text-2xl);
  font-weight: 750;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.hb-usage-ring__center span {
  font-size: var(--hb-text-xs);
  font-weight: 650;
  color: var(--hb-muted);
}

.hb-usage-ring__meta {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
}

.hb-usage-ring__plan {
  align-self: flex-start;
  padding: 0.15rem 0.55rem;
  border-radius: var(--hb-radius-pill);
  border: 1px solid color-mix(in srgb, var(--hb-brand) 40%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-brand-soft, var(--hb-surface-muted)) 60%, var(--hb-surface));
  font-size: var(--hb-text-sm);
  font-weight: 700;
}

.hb-usage-ring__metrics {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.65rem 1.15rem;
}

.hb-usage-ring__pct {
  margin-left: auto;
  font-size: var(--hb-text-sm);
  font-weight: 650;
  color: var(--hb-muted);
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

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

.hb-usage-mbars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.hb-usage-mbar {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  gap: 0.55rem 0.65rem;
  align-items: center;
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid transparent;
  border-radius: var(--hb-radius);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: default;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.hb-usage-mbar:hover,
.hb-usage-mbar:focus-visible,
.hb-usage-mbar.is-on {
  background: var(--hb-surface-muted);
  border-color: var(--hb-line);
  outline: none;
}

.hb-usage-mbar__label {
  font-size: var(--hb-text-sm);
  font-weight: 650;
  white-space: nowrap;
}

.hb-usage-mbar__track {
  height: 0.55rem;
  border-radius: 999px;
  background: var(--hb-surface-muted);
  overflow: hidden;
  border: 1px solid var(--hb-line);
}

.hb-usage-mbar__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--hb-brand);
  transition: width 0.2s ease;
}

.hb-usage-mbar.is-over .hb-usage-mbar__fill {
  background: var(--hb-danger);
}

.hb-usage-mbar__val {
  display: inline-flex;
  align-items: baseline;
  gap: 0.15rem;
  font-size: var(--hb-text-sm);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 4.5rem;
  justify-content: flex-end;
}

.hb-usage-mbar__pts {
  margin-left: 0.35rem;
  font-size: var(--hb-text-xs);
  font-weight: 650;
  color: var(--hb-muted);
}

.hb-usage-mbar__inf {
  margin-left: 0.25rem;
  font-weight: 750;
  color: var(--hb-brand-deep);
}

.hb-usage-mbar__unit {
  margin-left: 0.1rem;
  font-size: var(--hb-text-xs);
  color: var(--hb-muted);
}

.hb-usage-mbar__over {
  margin-left: 0.35rem;
  font-size: var(--hb-text-xs);
  font-weight: 700;
  color: var(--hb-danger-deep);
}

.hb-usage-byok-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0.75rem 0 0;
  border-top: 1px solid var(--hb-line);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 1.25rem;
}

.hb-usage-byok-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: var(--hb-text-sm);
}

@media (max-width: 560px) {
  .hb-usage-byok-list {
    grid-template-columns: 1fr;
  }
}

.hb-usage-ppick {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

@media (max-width: 560px) {
  .hb-usage-ppick {
    grid-template-columns: 1fr;
  }
}

.hb-usage-ppick__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius-lg);
  background: var(--hb-surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.hb-usage-ppick__item:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--hb-brand) 40%, var(--hb-line));
}

.hb-usage-ppick__item.is-active {
  border-color: color-mix(in srgb, var(--hb-brand) 55%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-brand-soft, var(--hb-surface-muted)) 55%, var(--hb-surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hb-brand) 25%, transparent);
  cursor: default;
}

.hb-usage-ppick__item:disabled:not(.is-active) {
  opacity: 0.55;
  cursor: not-allowed;
}

.hb-usage-ppick__name {
  font-size: var(--hb-text-sm);
  font-weight: 700;
}

.hb-usage-ppick__credits strong {
  font-size: var(--hb-text-xl);
  font-weight: 750;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

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

.hb-usage-ppick__item.is-active .hb-usage-ppick__price {
  color: var(--hb-brand-deep);
  font-weight: 700;
}

.hb-usage-checkout {
  max-width: 36rem;
}

.hb-usage-checkout__rights {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--hb-line);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.hb-usage-checkout__headline {
  margin: 0;
  font-size: var(--hb-text-base);
  font-weight: 650;
  line-height: 1.45;
  color: var(--hb-text);
}

.hb-usage-checkout__block {
  margin: 0;
}

.hb-usage-checkout__h {
  margin: 0 0 0.4rem;
  font-size: var(--hb-text-sm);
  font-weight: 750;
  letter-spacing: 0.01em;
  color: var(--hb-muted);
}

.hb-usage-checkout__list {
  margin: 0;
  padding: 0 0 0 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: var(--hb-text-sm);
  line-height: 1.5;
  color: var(--hb-text);
}

.hb-usage-checkout__list--notes {
  color: var(--hb-muted);
}

.hb-usage-checkout__plan {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.hb-usage-checkout__label {
  margin: 0;
  font-size: var(--hb-text-xs);
  font-weight: 650;
  color: var(--hb-muted);
}

.hb-usage-checkout__name {
  margin: 0.2rem 0 0;
  font-size: var(--hb-text-lg);
  font-weight: 750;
}

.hb-usage-checkout__val {
  margin: 0.2rem 0 0;
  font-variant-numeric: tabular-nums;
}

.hb-usage-checkout__val strong {
  font-size: var(--hb-text-xl);
  font-weight: 750;
}

.hb-usage-checkout__mock-tag {
  align-self: flex-start;
  padding: 0.12rem 0.5rem;
  border-radius: var(--hb-radius-pill);
  border: 1px dashed color-mix(in srgb, var(--hb-brand) 40%, var(--hb-line));
  font-size: var(--hb-text-xs);
  font-weight: 700;
  color: var(--hb-brand-deep);
}

/* 用量：AI / Search 次數 */
.hb-usage-call-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--hb-gap-stack);
  margin: 0;
}

@media (min-width: 560px) {
  .hb-usage-call-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hb-usage-call-stats:has(> :nth-child(3)) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hb-usage-call-stats--five {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .hb-usage-call-stats--five {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.hb-usage-call-stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: var(--hb-space-4);
  border-radius: var(--hb-radius-lg);
  border: 1px solid var(--hb-line);
  background: var(--hb-surface-muted);
  min-width: 0;
}

.hb-usage-call-stat--buy {
  border-color: color-mix(in srgb, var(--hb-brand) 35%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-brand-soft, var(--hb-surface-muted)) 70%, var(--hb-surface));
}

.hb-usage-call-stat--use {
  border-color: color-mix(in srgb, var(--hb-warning) 40%, var(--hb-line));
}

.hb-usage-tenant {
  gap: var(--hb-gap-section, 1.1rem);
}

.hb-usage-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
}

.hb-usage-filters__gran {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.hb-usage-toolbar__dates {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.hb-usage-toolbar__date {
  width: auto;
  min-width: 0;
  max-width: 10.5rem;
  padding: 0.35rem 0.5rem;
  font-size: var(--hb-text-sm);
}

.hb-usage-toolbar__dash {
  color: var(--hb-muted);
  font-weight: 600;
}

.hb-progress__bar--buy {
  background: var(--hb-brand);
}

.hb-progress__bar--use {
  background: var(--hb-accent-warm);
}

.hb-usage-chart {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.hb-usage-chart--empty {
  min-height: 6rem;
  border-radius: var(--hb-radius);
  background: var(--hb-surface-muted);
}

.hb-usage-chart__readout {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.55rem 1.15rem;
  min-height: 1.75rem;
  font-variant-numeric: tabular-nums;
}

.hb-usage-chart__period {
  min-width: 3rem;
  font-size: var(--hb-text-sm);
  font-weight: 650;
  color: var(--hb-muted);
}

.hb-usage-chart__period.is-focus {
  color: var(--hb-text);
}

.hb-usage-chart__metric {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  line-height: 1.1;
  cursor: default;
}

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

.hb-usage-chart__metric--buy .hb-usage-chart__name {
  color: var(--hb-brand-deep);
}

.hb-usage-chart__metric--use .hb-usage-chart__name {
  color: var(--hb-warning-deep);
}

.hb-usage-chart__metric strong {
  font-size: var(--hb-text-xl);
  font-weight: 750;
  letter-spacing: -0.03em;
  color: var(--hb-text);
}

.hb-usage-chart__dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}

.hb-usage-chart__metric--buy .hb-usage-chart__dot {
  background: var(--hb-brand);
}

.hb-usage-chart__metric--use .hb-usage-chart__dot {
  background: var(--hb-accent-warm);
}

.hb-usage-chart__pct {
  margin-left: auto;
  font-size: var(--hb-text-sm);
  font-weight: 650;
  color: var(--hb-muted);
}

.hb-usage-chart__svg {
  width: 100%;
  height: auto;
  max-height: 220px;
  display: block;
  touch-action: manipulation;
}

.hb-usage-chart__grid {
  stroke: var(--hb-line);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0.7;
}

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

.hb-usage-chart__hit {
  fill: transparent;
  cursor: crosshair;
}

.hb-usage-chart__bar--buy {
  fill: var(--hb-brand);
  opacity: 0.72;
  transition: opacity 0.12s ease;
}

.hb-usage-chart__bar--use {
  fill: var(--hb-accent-warm);
  opacity: 0.88;
  transition: opacity 0.12s ease;
}

.hb-usage-chart__col.is-on .hb-usage-chart__bar {
  opacity: 1;
}

.hb-usage-chart__col:not(.is-on) .hb-usage-chart__bar {
  opacity: 0.55;
}

.hb-usage-chart:not(:hover):not(:focus-within) .hb-usage-chart__bar {
  opacity: 0.85;
}

.hb-usage-side-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--hb-line);
  font-size: var(--hb-text-sm);
  color: var(--hb-muted);
}

.hb-usage-side-metrics strong {
  color: var(--hb-text);
  font-variant-numeric: tabular-nums;
  margin-left: 0.25rem;
}

.hb-usage-member-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.35rem;
}

.hb-usage-member-bar__nums {
  font-size: var(--hb-text-sm);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (min-width: 720px) {
  .hb-usage-member-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

.hb-usage-call-stat__label {
  font-size: var(--hb-text-sm);
  font-weight: 650;
  color: var(--hb-muted);
}

.hb-usage-call-stat__value {
  font-size: var(--hb-text-2xl);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.hb-usage-call-stat__hint {
  font-size: var(--hb-text-xs);
  line-height: 1.4;
}

.hb-usage-member-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--hb-gap-stack);
}

.hb-usage-member-row {
  display: flex;
  flex-direction: column;
  gap: var(--hb-gap-inline);
  padding: var(--hb-space-4);
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius-lg);
  background: var(--hb-bg);
  margin: 0;
}

@media (min-width: 720px) {
  .hb-usage-member-row {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(10rem, auto);
    align-items: center;
  }
}

.hb-usage-member-row__main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.hb-usage-member-row__uid {
  font-size: var(--hb-text-xs);
  font-family: var(--hb-font-mono);
  word-break: break-all;
}

.hb-usage-member-row__stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
  font-size: var(--hb-text-sm);
}

.hb-usage-member-row__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--hb-gap-tight);
}

.hb-usage-member-row__actions .hb-field {
  min-width: 6.5rem;
}

.hb-usage-ledger-empty {
  display: flex;
  justify-content: center;
  padding: 0.5rem 0;
}

.hb-usage-ledger {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.hb-usage-ledger__row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius);
  background: var(--hb-surface-muted);
}

.hb-usage-ledger__main {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.hb-usage-ledger__main strong {
  font-size: var(--hb-text-sm);
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.hb-usage-ledger__cost {
  flex-shrink: 0;
  font-size: var(--hb-text-sm);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: var(--hb-warning-deep);
}

/* —— 今日 dashboard —— */
.hb-today-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hb-today-simple-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--hb-gap-inline);
  margin: 0 0 var(--hb-gap-section);
}

.hb-today-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

@media (max-width: 720px) {
  .hb-today-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.hb-today-metric {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius);
  background: var(--hb-surface);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.12s ease;
}

a.hb-today-metric:hover {
  border-color: color-mix(in srgb, var(--hb-brand) 45%, var(--hb-line));
}

.hb-today-metric.is-alert {
  border-color: color-mix(in srgb, var(--hb-danger) 45%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-danger) 8%, var(--hb-surface));
}

.hb-today-metric__label {
  font-size: var(--hb-text-2xs);
  font-weight: 600;
  color: var(--hb-muted);
}

.hb-today-metric__value {
  font-size: var(--hb-text-xl);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.hb-today-metric__den {
  font-size: var(--hb-text-base);
  font-weight: 600;
  color: var(--hb-muted);
}

.hb-today-metric__hint {
  font-size: var(--hb-text-2xs);
  color: var(--hb-muted);
}

.hb-today-alert-text {
  color: var(--hb-danger-deep);
}

.hb-today-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hb-today-list__item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius);
  background: var(--hb-surface-muted);
  text-decoration: none;
  color: inherit;
}

.hb-today-list__item:hover {
  border-color: color-mix(in srgb, var(--hb-brand) 40%, var(--hb-line));
}

.hb-today-list__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  font-size: var(--hb-text-2xs);
  font-weight: 600;
  color: var(--hb-muted);
}

.hb-today-list__text {
  font-size: var(--hb-text-sm);
  line-height: 1.45;
}

.hb-today-account-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.hb-today-account {
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius);
  background: var(--hb-surface-muted);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.hb-today-account__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
}

.hb-today-account__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: var(--hb-text-xs);
  color: var(--hb-ink-secondary, var(--hb-text));
}

.hb-today-account__insight {
  margin: 0;
  font-size: var(--hb-text-xs);
  line-height: 1.45;
  color: var(--hb-muted);
}

/* —— 帳號成效 / 月比圖 —— */
.hb-insights-panel {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
}

.hb-insights-status {
  margin: 0;
}

.hb-insights-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem 1rem;
  align-items: end;
}

.hb-insights-toolbar__hint {
  min-width: 0;
  align-self: center;
}

@media (max-width: 560px) {
  .hb-insights-toolbar {
    grid-template-columns: 1fr;
  }
}

.hb-insights-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-bottom: 0.05rem;
}

.hb-insights-kpis .hb-today-metric__hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}

.hb-insights-spark {
  display: block;
  max-width: 100%;
  margin-bottom: 0.35rem;
}

.hb-insights-bars__row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.45rem;
  align-items: end;
  min-height: 9.5rem;
}

@media (max-width: 520px) {
  .hb-insights-bars__row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-height: 8.5rem;
  }
}

.hb-insights-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  margin: 0;
  padding: 0.25rem 0.15rem 0.15rem;
  border: 1px solid transparent;
  border-radius: var(--hb-radius);
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.hb-insights-bar:hover {
  background: var(--hb-surface-muted);
}

.hb-insights-bar.is-selected {
  border-color: color-mix(in srgb, var(--hb-brand) 55%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-brand-soft, var(--hb-surface-muted)) 55%, var(--hb-surface));
}

.hb-insights-bar__track {
  width: 100%;
  max-width: 2.75rem;
  height: 7rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: var(--hb-radius) var(--hb-radius) 0.2rem 0.2rem;
  background: var(--hb-surface-muted);
  border: 1px solid var(--hb-line);
  overflow: hidden;
}

.hb-insights-bar__fill {
  width: 70%;
  min-height: 2px;
  border-radius: 0.2rem 0.2rem 0 0;
  background: color-mix(in srgb, var(--hb-brand) 55%, var(--hb-surface-muted));
  transition: height 0.2s ease;
}

.hb-insights-bar__fill.is-current {
  background: var(--hb-brand);
}

.hb-insights-bar__fill.is-estimate {
  opacity: 0.55;
  background: repeating-linear-gradient(
    -45deg,
    color-mix(in srgb, var(--hb-brand) 35%, var(--hb-surface-muted)),
    color-mix(in srgb, var(--hb-brand) 35%, var(--hb-surface-muted)) 4px,
    color-mix(in srgb, var(--hb-brand) 18%, var(--hb-surface-muted)) 4px,
    color-mix(in srgb, var(--hb-brand) 18%, var(--hb-surface-muted)) 8px
  );
}

.hb-insights-bar__fill.is-estimate.is-current {
  opacity: 0.85;
}

.hb-insights-bar__val {
  font-size: var(--hb-text-2xs);
  font-weight: 650;
  color: var(--hb-ink-secondary, var(--hb-text));
  line-height: 1.2;
}

.hb-insights-bar__lab {
  font-size: var(--hb-text-2xs);
  color: var(--hb-muted);
}

.hb-insights-bar__lab.is-current {
  font-weight: 700;
  color: var(--hb-brand-deep);
}

.hb-insights-bullets {
  margin: 0;
  padding: 0 0 0 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: var(--hb-text-sm);
  line-height: 1.5;
}

.hb-insights-bullets--action li {
  color: var(--hb-brand-deep);
}

.hb-insights-snap-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--hb-line);
}

.hb-insights-snap-meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--hb-radius);
  border: 1px solid var(--hb-line);
  background: var(--hb-surface-muted);
}

.hb-insights-snap-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.85rem;
  font-size: var(--hb-text-xs);
  align-items: center;
}

/* —— 頂欄：通知（緊湊）+ 帳號選單 —— */
.hb-bell {
  position: relative;
}

.hb-bell__trigger {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: var(--hb-top-ctrl, 2rem);
  height: var(--hb-top-ctrl, 2rem);
  padding: 0;
  border: 1px solid var(--hb-line);
  border-radius: 999px;
  background: var(--hb-surface);
  color: var(--hb-ink-secondary);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.hb-bell__trigger:hover,
.hb-bell__trigger.is-open {
  color: var(--hb-brand-deep);
  border-color: color-mix(in srgb, var(--hb-brand) 45%, var(--hb-line));
}

.hb-bell__icon {
  display: grid;
  place-items: center;
  line-height: 0;
}

.hb-bell__badge {
  position: absolute;
  top: -0.2rem;
  right: -0.25rem;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: var(--hb-danger);
  color: var(--hb-danger-on);
  font-size: var(--hb-text-2xs);
  font-weight: 700;
  line-height: 1.05rem;
  text-align: center;
}

.hb-bell__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  width: min(20rem, 90vw);
  max-height: 22rem;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius-lg);
  background: var(--hb-surface);
  box-shadow: var(--hb-shadow-card);
  z-index: 50;
  overflow: hidden;
}

.hb-bell__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--hb-line);
  flex-shrink: 0;
}

.hb-bell__head-title {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.hb-bell__head-count {
  font-size: var(--hb-text-2xs);
  font-weight: 600;
  color: var(--hb-brand-deep);
}

.hb-bell__text-btn {
  border: 0;
  background: transparent;
  color: var(--hb-muted);
  font: inherit;
  font-size: var(--hb-text-xs);
  font-weight: 600;
  cursor: pointer;
  padding: 0.15rem 0.25rem;
}

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

.hb-bell__empty {
  margin: 0;
  padding: 1.1rem 0.85rem;
  font-size: var(--hb-text-sm);
  color: var(--hb-muted);
  text-align: center;
}

.hb-bell__list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  max-height: 15.5rem;
}

.hb-bell__item {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.2rem;
  padding: 0.6rem 0.75rem;
  border: 0;
  border-bottom: 1px solid var(--hb-line);
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.hb-bell__item.is-unread {
  background: color-mix(in srgb, var(--hb-brand-soft, var(--hb-surface-muted)) 70%, var(--hb-surface));
}

.hb-bell__item:hover {
  background: var(--hb-surface-muted);
}

.hb-bell__item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.hb-bell__kind {
  font-size: var(--hb-text-2xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--hb-muted);
  text-transform: none;
}

.hb-bell__time {
  font-size: var(--hb-text-2xs);
  color: var(--hb-muted);
  flex-shrink: 0;
}

.hb-bell__item-title {
  font-size: var(--hb-text-sm);
  font-weight: 650;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hb-bell__item-body {
  font-size: var(--hb-text-xs);
  line-height: 1.4;
  color: var(--hb-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hb-bell__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.55rem 0.45rem;
  border-top: 1px solid var(--hb-line);
  background: var(--hb-surface);
  flex-shrink: 0;
}

.hb-bell__more {
  font-size: var(--hb-text-2xs);
  padding-left: 0.25rem;
}

.hb-account {
  position: relative;
}

.hb-account__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 9.5rem;
  height: var(--hb-top-ctrl, 2rem);
  min-height: var(--hb-top-ctrl, 2rem);
  padding: 0 0.5rem 0 0.15rem;
  border: 1px solid var(--hb-line);
  border-radius: 999px;
  background: var(--hb-surface);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.hb-account__trigger:hover,
.hb-account__trigger.is-open {
  border-color: color-mix(in srgb, var(--hb-brand) 45%, var(--hb-line));
  color: var(--hb-brand-deep);
}

.hb-account__avatar {
  width: 1.55rem !important;
  height: 1.55rem !important;
  flex-shrink: 0;
}

.hb-account__avatar.hb-avatar--initials {
  background: var(--hb-brand-soft) !important;
  color: var(--hb-brand-deep);
  font-size: var(--hb-text-2xs);
  text-shadow: none;
}

.hb-account__name {
  font-size: var(--hb-text-xs);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  line-height: 1;
}

.hb-account__chev {
  font-size: var(--hb-text-2xs);
  color: var(--hb-muted);
  flex-shrink: 0;
  line-height: 1;
}

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

  .hb-account__trigger {
    padding: 0 0.2rem 0 0.15rem;
  }

  .hb-account__chev {
    display: none;
  }
}

.hb-account__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  width: min(15rem, 88vw);
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius-lg);
  background: var(--hb-surface);
  box-shadow: var(--hb-shadow-card);
  z-index: 50;
  overflow: hidden;
}

.hb-account__link--btn {
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

/* 設定：主題三選一 */
.hb-theme-picker {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

@media (min-width: 480px) {
  .hb-theme-picker {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.hb-theme-picker__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  min-height: 4.5rem;
  padding: 0.65rem 0.5rem;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius-lg);
  background: var(--hb-surface-muted);
  color: var(--hb-ink-secondary);
  font: inherit;
  font-size: var(--hb-text-sm);
  font-weight: 650;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.hb-theme-picker__btn:hover {
  border-color: color-mix(in srgb, var(--hb-brand) 40%, var(--hb-line));
  color: var(--hb-brand-deep);
}

.hb-theme-picker__btn.is-active {
  border-color: color-mix(in srgb, var(--hb-brand) 55%, var(--hb-line));
  background: var(--hb-brand-soft);
  color: var(--hb-brand-deep);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--hb-brand) 25%, transparent);
}

.hb-theme-picker__swatch {
  width: 100%;
  max-width: 4.5rem;
  height: 1.65rem;
  border-radius: 999px;
  border: 1px solid var(--hb-line);
}

/* 主題預覽色塊：唯一允許寫死色碼的地方 —— 它要在任何主題下都同時顯示
   淺色與深色長什麼樣，所以不能吃會隨主題切換的 var()。 */
.hb-theme-picker__swatch--light {
  background: linear-gradient(90deg, #fcfdfd 40%, #8bc5cd 40%, #8bc5cd 70%, #b96b1c 70%);
}

.hb-theme-picker__swatch--dark {
  background: linear-gradient(90deg, #141a1a 42%, #89c5cd 42%, #89c5cd 72%, #e18c37 72%);
}

.hb-theme-picker__swatch--system {
  background: linear-gradient(
    90deg,
    #fcfdfd 0%,
    #fcfdfd 48%,
    #141a1a 52%,
    #141a1a 100%
  );
}

.hb-account__meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--hb-line);
}

.hb-account__meta-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.hb-account__meta-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.hb-account__meta strong {
  font-size: var(--hb-text-sm);
}

.hb-account__meta .text-muted {
  font-size: var(--hb-text-2xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hb-account__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.3rem;
}

.hb-profile-avatar {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
  padding-bottom: 0.85rem;
  margin-bottom: 0.15rem;
  border-bottom: 1px solid var(--hb-line);
}

.hb-profile-avatar__img {
  width: 4.5rem !important;
  height: 4.5rem !important;
  font-size: var(--hb-text-xl) !important;
}

.hb-profile-avatar__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  min-width: 0;
}

.hb-profile-avatar__btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.hb-profile-avatar__hint {
  margin: 0;
  font-size: var(--hb-text-xs);
}

.hb-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hb-account__role {
  align-self: flex-start;
  padding: 0.12rem 0.45rem;
  border-radius: var(--hb-radius-pill);
  border: 1px solid var(--hb-line);
  background: var(--hb-surface-muted);
  font-size: var(--hb-text-2xs);
  font-weight: 700;
  color: var(--hb-ink-secondary, var(--hb-text));
}

.hb-account__role.is-admin {
  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)) 70%, var(--hb-surface));
  color: var(--hb-brand-deep);
}

.hb-account__role.is-verified {
  border-color: color-mix(in srgb, var(--hb-success) 40%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-success) 12%, var(--hb-surface));
  color: var(--hb-success);
}

.hb-account__role.is-unverified {
  border-color: color-mix(in srgb, var(--hb-warning) 45%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-warning) 14%, var(--hb-surface));
  color: var(--hb-warning-deep);
}

.hb-verify-status {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.hb-verify-status__badge {
  align-self: flex-start;
  padding: 0.2rem 0.55rem;
  border-radius: var(--hb-radius-pill);
  font-size: var(--hb-text-2xs);
  font-weight: 700;
}

.hb-verify-status__badge.is-pending {
  border: 1px solid color-mix(in srgb, var(--hb-warning) 45%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-warning) 14%, var(--hb-surface));
  color: var(--hb-warning-deep);
}

.hb-verify-code-display {
  margin: 0;
  font-size: var(--hb-text-xl);
  font-weight: 750;
  letter-spacing: 0.28em;
  font-variant-numeric: tabular-nums;
  color: var(--hb-brand-deep);
}

.hb-profile-status {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* 左欄固定寬放 tag，右欄文字同一條左緣對齊 */
.hb-profile-role {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 0.65rem 1rem;
  align-items: start;
}

.hb-profile-role__badge {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  width: 7rem;
  min-height: 1.55rem;
  padding-top: 0.12rem;
}

.hb-profile-role__badge .hb-badge {
  max-width: 100%;
  justify-content: center;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
}

.hb-profile-role__text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.hb-profile-role__title {
  margin: 0;
  font-weight: 650;
  line-height: 1.45;
  min-height: 1.55rem;
  display: flex;
  align-items: center;
}

.hb-profile-role__meta {
  margin: 0;
  font-size: var(--hb-text-xs);
  line-height: 1.45;
  color: var(--hb-muted);
  word-break: break-word;
}

.hb-profile-role__action {
  margin: 0.15rem 0 0;
}

@media (max-width: 480px) {
  .hb-profile-role {
    grid-template-columns: 6.25rem minmax(0, 1fr);
    gap: 0.5rem 0.75rem;
  }

  .hb-profile-role__badge {
    width: 6.25rem;
  }
}

/* —— 管理員：使用者列表 —— */
.hb-admin-users {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--hb-gap-section);
  align-items: start;
  min-width: 0;
  margin: 0;
}

@media (min-width: 860px) {
  .hb-admin-users {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: var(--hb-gap-section);
  }
}

.hb-admin-user-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--hb-gap-inline);
}

.hb-admin-user-row {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--hb-gap-inline);
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius);
  background: var(--hb-surface-muted);
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.hb-admin-user-row:hover {
  border-color: color-mix(in srgb, var(--hb-brand) 40%, var(--hb-line));
}

.hb-admin-user-row.is-active {
  border-color: var(--hb-brand);
  background: color-mix(in srgb, var(--hb-brand-soft, var(--hb-surface-muted)) 60%, var(--hb-surface));
}

.hb-admin-user-row__main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.hb-admin-user-row__main strong {
  font-size: var(--hb-text-sm);
}

.hb-admin-user-row__main .text-muted {
  font-size: var(--hb-text-xs);
}

.hb-admin-user-row__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.hb-admin-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.hb-admin-detail-name {
  margin: 0;
  font-size: var(--hb-text-lg);
  font-weight: 700;
}

.hb-admin-dl {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 1rem;
}

@media (max-width: 520px) {
  .hb-admin-dl {
    grid-template-columns: 1fr;
  }
}

.hb-admin-dl div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.hb-admin-dl dt {
  font-size: var(--hb-text-2xs);
  font-weight: 650;
  color: var(--hb-muted);
}

.hb-admin-dl dd {
  margin: 0;
  font-size: var(--hb-text-sm);
  line-height: 1.4;
  word-break: break-word;
}

.hb-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hb-admin-custom-pw {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--hb-line);
}

.hb-admin-search {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  align-items: end;
}

.hb-admin-search > .hb-btn {
  width: 100%;
  min-height: var(--hb-touch);
}

@media (min-width: 520px) {
  .hb-admin-search {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .hb-admin-search > .hb-btn {
    width: auto;
  }
}

.hb-admin-create-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--hb-space-3);
}

.hb-admin-create-form {
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-4);
  max-width: 28rem;
}

.hb-admin-create-checks {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.hb-admin-user-row.is-suspended {
  opacity: 0.88;
  background: color-mix(in srgb, var(--hb-danger-soft) 45%, var(--hb-surface));
}

.hb-admin-user-row__uid {
  font-size: var(--hb-text-2xs) !important;
  font-family: var(--hb-font-mono);
  word-break: break-all;
}

.hb-admin-suspend {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--hb-radius-lg);
  border: 1px solid color-mix(in srgb, var(--hb-danger) 22%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-danger-soft) 40%, var(--hb-surface));
}

.hb-admin-usage {
  display: flex;
  flex-direction: column;
  gap: var(--hb-gap-stack);
  padding: 0.85rem 0.95rem;
  border-radius: var(--hb-radius-lg);
  border: 1px solid color-mix(in srgb, var(--hb-brand) 28%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-brand-soft) 55%, var(--hb-surface));
}

.hb-admin-usage__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--hb-gap-inline);
}

.hb-admin-usage__row .hb-field {
  flex: 1 1 10rem;
  min-width: 0;
}

.hb-admin-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--hb-line);
}

.hb-admin-pager__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.35rem 0.5rem;
  width: 100%;
  justify-content: space-between;
}

@media (min-width: 520px) {
  .hb-admin-pager__controls {
    width: auto;
  }
}

.hb-admin-pager__controls .hb-field {
  min-width: 5.5rem;
}

.hb-admin-pager__page {
  font-size: var(--hb-text-sm);
  font-weight: 650;
  min-width: 3.5rem;
  text-align: center;
}

.hb-admin-roles {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius);
  background: var(--hb-surface-muted);
}

.hb-admin-temp-pw {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.85rem 1rem;
  border-radius: var(--hb-radius);
  border: 1px solid color-mix(in srgb, var(--hb-brand) 40%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-brand-soft, var(--hb-surface-muted)) 55%, var(--hb-surface));
}

.hb-admin-temp-pw__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
}

.hb-admin-temp-pw__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
}

.hb-admin-temp-pw__code {
  flex: 1;
  min-width: 10rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--hb-radius);
  border: 1px solid var(--hb-line);
  background: var(--hb-surface);
  font-size: var(--hb-text-lg);
  font-weight: 700;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
  user-select: all;
}

.hb-admin-temp-pw__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.hb-account__nav {
  display: flex;
  flex-direction: column;
  padding: 0.3rem 0;
}

.hb-account__link {
  padding: 0.55rem 0.85rem;
  font-size: var(--hb-text-sm);
  font-weight: 600;
  color: inherit;
  text-decoration: none;
}

.hb-account__link:hover {
  background: var(--hb-surface-muted);
  color: var(--hb-brand-deep);
}

.hb-account__logout {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--hb-line);
  background: transparent;
  padding: 0.6rem 0.85rem;
  text-align: left;
  font: inherit;
  font-size: var(--hb-text-sm);
  font-weight: 600;
  color: var(--hb-danger-deep);
  cursor: pointer;
}

.hb-account__logout:hover {
  background: color-mix(in srgb, var(--hb-danger) 8%, var(--hb-surface));
}

/* Avoid mobile dock covering content — already in layout; ensure links ok */
a .hb-btn {
  /* keep button styles when wrapped */
}

/* —— 邀請關係：精簡列表 + 真樹狀 —— */
.hb-invite-code {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.hb-invite-code__display {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
}

.hb-invite-code__value,
.hb-invite-code__inline {
  font-family: var(--hb-font-mono);
  font-size: var(--hb-text-lg);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--hb-brand-deep);
  background: color-mix(in srgb, var(--hb-brand) 10%, var(--hb-surface));
  padding: 0.35rem 0.75rem;
  border-radius: var(--hb-radius);
  border: 1px solid color-mix(in srgb, var(--hb-brand) 28%, var(--hb-line));
}

.hb-invite-code__inline {
  font-size: var(--hb-text-base);
  padding: 0.2rem 0.55rem;
}

.hb-invite-code__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.hb-invite-stats {
  margin: 0;
  font-size: var(--hb-text-sm);
  font-weight: 600;
}

.hb-invite-simple {
  margin: 0;
  font-size: var(--hb-text-sm);
}

.hb-invite-plain {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: var(--hb-text-sm);
}

.hb-invite-plain li {
  padding: 0.35rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--hb-line) 60%, transparent);
}

.hb-invite-plain li:last-child {
  border-bottom: 0;
}

.hb-invite-claim {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.hb-invite-claim__hint {
  margin: 0;
  font-size: var(--hb-text-sm);
}

.hb-invite-claim__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hb-invite-claim-note {
  margin: 0;
  font-size: var(--hb-text-xs);
}

/* 單篇寫作：預計發送時間 */
.hb-compose-schedule {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 0.75rem;
}

.hb-compose-schedule .hb-field {
  flex: 1 1 14rem;
  margin: 0;
  min-width: 0;
}

.hb-compose-schedule__now {
  flex-shrink: 0;
}

/* 設定：開發模式 + Chrome 擴充 */
.hb-settings-dev-hint {
  margin: 0;
  font-size: var(--hb-text-xs);
  line-height: 1.5;
}

.hb-settings-ext-wrap {
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius);
  background: var(--hb-surface-muted);
}

.hb-ext-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.hb-ext-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
}

.hb-ext-card__desc {
  margin: 0.35rem 0 0;
  font-size: var(--hb-text-sm);
  line-height: 1.5;
  max-width: 36rem;
}

.hb-ext-card__steps {
  margin: 0;
  padding-left: 1.25rem;
  font-size: var(--hb-text-sm);
  line-height: 1.55;
  color: var(--hb-ink-secondary, inherit);
}

.hb-ext-card__steps li {
  margin-bottom: 0.3rem;
}

.hb-ext-card__steps li:last-child {
  margin-bottom: 0;
}

.hb-admin-invite-line {
  font-size: var(--hb-text-sm);
  font-family: var(--hb-font-mono);
  color: var(--hb-brand-deep);
  letter-spacing: 0.04em;
}

/* 管理：焦點鑽取圖（非整棵展開） */
.hb-org {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius);
  background: var(--hb-surface);
  overflow: hidden;
  min-height: min(70vh, 680px);
}

.hb-org__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 0.75rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--hb-line);
  background: var(--hb-surface-muted);
}

.hb-org__bar .hb-field {
  flex: 1 1 14rem;
  margin: 0;
  min-width: 0;
}

.hb-org__meta {
  font-size: var(--hb-text-xs);
  white-space: nowrap;
}

/* 搜尋命中列表 */
.hb-org-hits {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(58vh, 560px);
  overflow: auto;
}

.hb-org-hits__row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  gap: 0.15rem 0.75rem;
  padding: 0.7rem 0.9rem;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--hb-line) 55%, transparent);
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.hb-org-hits__row:hover {
  background: color-mix(in srgb, var(--hb-brand) 8%, transparent);
}

.hb-org-hits__name {
  font-weight: 700;
  font-size: var(--hb-text-sm);
}

.hb-org-hits__code {
  font-family: var(--hb-font-mono);
  font-size: var(--hb-text-2xs);
  color: var(--hb-muted);
  justify-self: end;
  align-self: center;
  grid-row: 1 / span 2;
}

.hb-org-hits__path {
  grid-column: 1;
  font-size: var(--hb-text-2xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 起點：根節點 */
.hb-org-start {
  padding: 1rem 0.9rem 1.25rem;
}

.hb-org-start__hint {
  margin: 0 0 0.75rem;
  font-size: var(--hb-text-sm);
}

.hb-org-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hb-org-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  min-width: 7.5rem;
  max-width: 12rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius);
  background: var(--hb-surface-muted);
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: default;
}

.hb-org-chip.is-clickable {
  cursor: pointer;
}

.hb-org-chip.is-clickable:hover {
  border-color: color-mix(in srgb, var(--hb-brand) 45%, var(--hb-line));
  background: color-mix(in srgb, var(--hb-brand) 8%, var(--hb-surface));
}

.hb-org-chip.is-active {
  border-color: var(--hb-brand);
  background: color-mix(in srgb, var(--hb-brand) 14%, var(--hb-surface));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--hb-brand) 25%, transparent);
}

.hb-org-chip.is-dim {
  opacity: 0.92;
}

.hb-org-chip:disabled {
  opacity: 1;
}

.hb-org-chip__name {
  font-weight: 700;
  font-size: var(--hb-text-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.hb-org-chip__code {
  font-family: var(--hb-font-mono);
  font-size: var(--hb-text-2xs);
  color: var(--hb-muted);
}

.hb-org-chip__sub {
  font-size: var(--hb-text-2xs);
  color: var(--hb-brand-deep);
  font-weight: 600;
}

.hb-org-chip__flag {
  color: var(--hb-warning-deep);
}

/* 焦點圖 */
.hb-org-focus {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.hb-org-crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.2rem;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--hb-line);
  font-size: var(--hb-text-xs);
  background: color-mix(in srgb, var(--hb-surface-muted) 60%, var(--hb-surface));
}

.hb-org-crumb__home,
.hb-org-crumb__link {
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--hb-brand-deep);
  cursor: pointer;
  padding: 0.15rem 0.25rem;
  border-radius: 4px;
}

.hb-org-crumb__home:hover,
.hb-org-crumb__link:hover {
  background: color-mix(in srgb, var(--hb-brand) 10%, transparent);
}

.hb-org-crumb__link.is-current {
  color: var(--hb-ink);
  font-weight: 700;
  cursor: default;
  pointer-events: none;
}

.hb-org-crumb__sep {
  color: var(--hb-muted);
  opacity: 0.6;
  padding: 0 0.1rem;
}

.hb-org-graph {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1.1rem 0.85rem 1rem;
  flex: 1;
}

.hb-org-graph__layer {
  display: flex;
  justify-content: center;
  width: 100%;
}

.hb-org-graph__edge {
  color: var(--hb-muted);
  font-size: var(--hb-text-sm);
  line-height: 1;
  opacity: 0.65;
  user-select: none;
}

.hb-org-graph__none {
  font-size: var(--hb-text-xs);
  padding: 0.4rem 0.6rem;
}

.hb-org-graph__kids {
  width: 100%;
  max-width: 42rem;
}

.hb-org-graph__kids-label {
  margin: 0 0 0.45rem;
  font-size: var(--hb-text-xs);
  font-weight: 650;
  color: var(--hb-muted);
  text-align: center;
}

.hb-org-graph__empty {
  margin: 0.5rem 0 0;
  font-size: var(--hb-text-sm);
}

.hb-org-reassign {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border-top: 1px solid var(--hb-line);
  background: var(--hb-surface-muted);
}

.hb-org-reassign .hb-field {
  flex: 1 1 12rem;
  margin: 0;
}

.hb-org-reassign__actions {
  display: flex;
  gap: 0.4rem;
}
