/* brain.reyway.com — 全站 CSS（在小喬 tokens.css 之上）
   注意：HTML 必須先 link /styles/tokens.css 再 link 此檔
   alias：把本檔用到的舊 var name 映射到小喬的官方 token */

:root {
  /* alias to 小喬 tokens.css */
  --bg: var(--bg-page);
  --bg-soft: var(--bg-tint);
  --ink: var(--text-primary);
  --ink-soft: var(--text-secondary);
  --ink-light: var(--text-tertiary);
  --line: var(--line-soft);
  --brand: var(--ink-primary);
  --brand-soft: var(--ink-primary-hover);
  --danger: var(--state-error);
  --info: var(--state-info);
  --radius: var(--radius-sm);
  --radius-lg: var(--radius-md);
  --serif: var(--font-serif-en);
  --sans: var(--font-sans-tc);
  --transition: var(--ease-graceful);
}

html, body {
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; transition: color 0.2s var(--transition); }
a:hover { color: var(--gold); }

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s var(--transition), box-shadow 0.2s var(--transition);
}
input:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(45, 74, 62, 0.10);
}

/* ===== 全站 Header ===== */
.brain-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(248, 245, 238, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brain-header-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem;
}
.brain-logo {
  display: flex; align-items: center; gap: 0.6rem;
  text-decoration: none;
  color: var(--ink);
}
.brain-logo-mark {
  width: 32px; height: 32px;
  background: var(--brand);
  color: var(--bg);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.1rem;
}
.brain-logo-text {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.brain-logo-sub {
  font-size: 0.72rem;
  color: var(--ink-light);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.brain-nav {
  display: flex; gap: 0.4rem; align-items: center;
}
.brain-nav-item {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius);
  color: var(--ink-soft);
  font-size: 0.92rem;
  transition: all 0.2s var(--transition);
}
.brain-nav-item:hover {
  background: var(--bg-soft);
  color: var(--ink);
}
.brain-nav-item.active {
  background: var(--brand);
  color: var(--bg);
}
.brain-nav-item.active:hover { color: var(--bg); }
.brain-nav-item i { width: 16px; height: 16px; }

/* ===== 共用 ===== */
.page {
  max-width: 1200px; margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
  position: relative;
}
.page-hero { margin-bottom: 2.5rem; }
.page-hero-eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.6rem;
}
.page-hero-title {
  font-family: var(--serif);
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.page-hero-sub {
  margin-top: 0.8rem;
  color: var(--ink-soft);
  font-size: 1.02rem;
  max-width: 60ch;
}

/* Hero 分區小標籤（資訊輸入區）—— 襯線小字 + 古銅金細邊 */
.page-hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.9rem auto 0;
  padding: 0.32rem 0.85rem;
  border: 1px solid rgba(181, 149, 72, 0.42);
  border-radius: 999px;
  background: rgba(181, 149, 72, 0.06);
  color: var(--gold);
  font-family: var(--serif);
  font-size: 0.82rem;
  letter-spacing: 0.18em;
}
.page-hero-chip-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0.8;
}
.page-hero-chip-text { line-height: 1; }
@media (max-width: 480px) {
  .page-hero-chip {
    font-size: 0.76rem;
    padding: 0.28rem 0.7rem;
    letter-spacing: 0.14em;
  }
}

/* 主按鈕 */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: all 0.25s var(--transition);
  background: var(--brand);
  color: var(--bg);
}
.btn:hover { background: var(--brand-soft); transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.btn:active { transform: translateY(0); }
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--bg-soft); color: var(--ink); border-color: var(--brand); transform: none; box-shadow: none; }
.btn-gold { background: var(--gold); color: #2A2210; }
.btn-gold:hover { background: var(--gold-soft); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.82rem; }
.btn-icon { padding: 0.5rem; }
.btn-icon i { width: 16px; height: 16px; }

/* 「同步給七員」toggle 按鈕 — OFF=灰、ON=古銅金實心 */
.btn-share-off {
  background: transparent;
  color: var(--ink-light, #999);
  border: 1px solid var(--line, #ddd);
}
.btn-share-off:hover {
  background: var(--bg-soft, #f5f5f0);
  color: var(--ink-soft, #666);
  border-color: var(--gold, #b8946d);
  transform: none;
  box-shadow: none;
}
.btn-share-on {
  background: linear-gradient(135deg, #b8946d 0%, #9a7950 100%);
  color: #fff;
  border: 1px solid #9a7950;
  box-shadow: 0 1px 3px rgba(154, 121, 80, 0.35), inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-share-on:hover {
  background: linear-gradient(135deg, #c4a07a 0%, #a6855c 100%);
  color: #fff;
  transform: none;
}
.btn-share-on i, .btn-share-off i { width: 14px; height: 14px; }

/* 卡片 */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  transition: all 0.3s var(--transition);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(45, 74, 62, 0.25);
}

/* 標籤 */
.tag {
  display: inline-flex; align-items: center;
  padding: 0.18rem 0.65rem;
  background: var(--bg-soft);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}
.tag.tag-gold { background: rgba(201, 169, 97, 0.12); color: #8C7236; border-color: rgba(201, 169, 97, 0.35); }
.tag.tag-brand { background: rgba(45, 74, 62, 0.10); color: var(--brand); border-color: rgba(45, 74, 62, 0.25); }
.tag.tag-grade-A { background: rgba(177, 74, 63, 0.10); color: var(--danger); border-color: rgba(177, 74, 63, 0.30); }
.tag.tag-grade-B { background: rgba(72, 106, 143, 0.10); color: var(--info); border-color: rgba(72, 106, 143, 0.25); }
.tag.tag-grade-C { background: var(--bg-soft); color: var(--ink-light); }

/* 空狀態 */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--ink-light);
}
.empty-state i { width: 56px; height: 56px; margin-bottom: 1rem; opacity: 0.45; }
.empty-state-title { font-family: var(--serif); font-size: 1.4rem; color: var(--ink-soft); margin-bottom: 0.4rem; }

/* Loading */
.loading-dots { display: inline-flex; gap: 4px; }
.loading-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--brand);
  animation: bounce 1.4s infinite ease-in-out both;
}
.loading-dots span:nth-child(2) { animation-delay: 0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.5); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Toast */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg);
  padding: 0.8rem 1.4rem; border-radius: 999px;
  font-size: 0.9rem; letter-spacing: 0.05em;
  box-shadow: var(--shadow-hover);
  opacity: 0; pointer-events: none;
  transition: all 0.4s var(--transition);
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-error { background: var(--danger); }
.toast.toast-ok { background: var(--brand); }

/* ===== 太極氛圍紋（道家、極淡、若隱若現）=====
   主公明示「隱隱約約、不要太直接」 — 小喬 2026-04-29 */
.taiji-ambient {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, 78vw);
  aspect-ratio: 1 / 1;
  pointer-events: none;
  z-index: 0;
  opacity: 0.06;
  animation: taijiTurn 90s linear infinite;
  filter: blur(0.3px);
}
.taiji-ambient svg { width: 100%; height: 100%; display: block; }

@keyframes taijiTurn {
  from { transform: translateX(-50%) rotate(0deg); }
  to   { transform: translateX(-50%) rotate(360deg); }
}

/* hero 主標下方的落款印章式小太極 */
.taiji-seal {
  margin: 1.2rem auto 0;
  width: 18px;
  height: 18px;
  opacity: 0.55;
}
.taiji-seal svg { width: 100%; height: 100%; display: block; }

/* 手機版：太極縮小、避免爆版 */
@media (max-width: 640px) {
  .taiji-ambient {
    width: min(380px, 88vw);
    opacity: 0.05;
  }
  .taiji-seal { width: 14px; height: 14px; }
}

/* 尊重「減少動態效果」設定 */
@media (prefers-reduced-motion: reduce) {
  .taiji-ambient { animation: none; }
}

/* ===== 投入頁 ===== */
.submit-stage {
  max-width: 760px; margin: 1.5rem auto 0;
  position: relative;
  z-index: 1;
}
.submit-textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 280px;
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.7;
  padding: 1.4rem 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--bg-card);
  resize: vertical;
  box-shadow: var(--shadow-card);
}
.submit-textarea::placeholder { color: var(--ink-light); font-style: italic; }
.dropzone {
  margin-top: 1rem;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  text-align: center;
  color: var(--ink-light);
  font-size: 0.95rem;
  transition: all 0.2s var(--transition);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.5);
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--brand);
  background: rgba(45, 74, 62, 0.04);
  color: var(--ink-soft);
}
.dropzone i { width: 28px; height: 28px; opacity: 0.6; margin-bottom: 0.4rem; }
.dropzone-preview {
  display: none;
  margin-top: 1rem;
  padding: 0.8rem;
  background: var(--bg-soft);
  border-radius: var(--radius);
  text-align: left;
}
.dropzone-preview img { max-width: 100%; max-height: 180px; border-radius: var(--radius); }
.dropzone-preview .filename { font-size: 0.85rem; color: var(--ink-soft); margin-top: 0.4rem; }

.submit-actions {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 1.4rem;
  flex-wrap: wrap; gap: 0.8rem;
}
.submit-hint { color: var(--ink-light); font-size: 0.85rem; }
.submit-btn { padding: 0.85rem 2rem; font-size: 1rem; }

.processing-banner {
  display: none;
  margin-top: 1.5rem;
  padding: 1rem 1.3rem;
  background: rgba(45, 74, 62, 0.06);
  border: 1px solid rgba(45, 74, 62, 0.18);
  border-radius: var(--radius);
  color: var(--brand);
  align-items: center; gap: 0.8rem;
}
.processing-banner.show { display: flex; }
.processing-banner i { width: 18px; height: 18px; animation: spin 2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.examples-row {
  margin-top: 2.5rem;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.8rem;
}
.example-chip {
  display: flex; flex-direction: column; gap: 0.3rem;
  padding: 0.9rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s var(--transition);
  text-align: left;
  width: 100%;
}
.example-chip:hover { border-color: var(--brand); background: rgba(45, 74, 62, 0.03); }
.example-chip-label { font-size: 0.78rem; color: var(--gold); letter-spacing: 0.15em; text-transform: uppercase; }
.example-chip-text { font-size: 0.9rem; color: var(--ink-soft); }

/* ===== Inbox ===== */
.toolbar {
  display: flex; gap: 0.7rem; align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.toolbar .grow { flex: 1; }

.inbox-list { display: grid; gap: 1rem; }
.inbox-card {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 1.2rem;
  padding: 1.2rem;
}
.inbox-card.no-thumb { grid-template-columns: 1fr; }
.inbox-thumb {
  width: 80px; height: 80px;
  border-radius: var(--radius);
  background: var(--bg-soft);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-light);
}
.inbox-thumb img { width: 100%; height: 100%; object-fit: cover; }
.inbox-thumb i { width: 28px; height: 28px; opacity: 0.5; }

.inbox-body { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.inbox-title {
  font-family: var(--serif);
  font-size: 1.2rem;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.inbox-summary {
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.55;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.inbox-meta { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.inbox-time { color: var(--ink-light); font-size: 0.78rem; }
.inbox-actions {
  display: flex; gap: 0.4rem; margin-top: 0.6rem; flex-wrap: wrap;
}
.inbox-source-link {
  font-size: 0.8rem; color: var(--ink-light);
  display: inline-flex; align-items: center; gap: 0.3rem;
}
.inbox-source-link i { width: 12px; height: 12px; }

.dup-flag {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.78rem; color: var(--info);
  padding: 0.15rem 0.55rem;
  background: rgba(72, 106, 143, 0.10);
  border-radius: 999px;
}
.dup-flag i { width: 12px; height: 12px; }

/* ===== Archive ===== */
.archive-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  align-items: start;
}
.archive-sidebar { position: sticky; top: 90px; }
.sidebar-title {
  font-family: var(--serif);
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  margin-bottom: 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}
.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.4rem 0.5rem; line-height: 1.6; }
.tag-cloud .tag-cloud-item {
  cursor: pointer;
  color: var(--ink-soft);
  background: none;
  border: 1px solid transparent;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius);
  transition: all 0.2s var(--transition);
}
.tag-cloud-item:hover { color: var(--brand); border-color: var(--line); }
.tag-cloud-item.active { color: var(--bg); background: var(--brand); border-color: var(--brand); }

.search-bar {
  display: flex; gap: 0.6rem; align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.4rem 0.4rem 0.4rem 1rem;
  margin-bottom: 1.2rem;
}
.search-bar i { width: 18px; height: 18px; color: var(--ink-light); }
.search-bar input { flex: 1; border: none; background: transparent; padding: 0.5rem 0; }
.search-bar input:focus { box-shadow: none; }
.search-filters {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  align-items: center;
}
.search-filters input[type="date"] {
  padding: 0.35rem 0.6rem; font-size: 0.85rem;
}

.archive-card {
  cursor: pointer;
  margin-bottom: 1rem;
}
.archive-card-title {
  font-family: var(--serif);
  font-size: 1.25rem;
  color: var(--ink);
  margin-bottom: 0.4rem;
}
.archive-card-summary {
  color: var(--ink-soft); font-size: 0.92rem; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.archive-card-meta {
  display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center;
  margin-top: 0.7rem;
}

/* archive 詳細頁 modal */
.archive-modal-bg {
  position: fixed; inset: 0;
  background: rgba(26, 43, 36, 0.50);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: flex-start; justify-content: center;
  padding: 4rem 1rem 2rem;
  overflow-y: auto;
}
.archive-modal-bg.show { display: flex; }
.archive-modal {
  background: var(--bg);
  width: 100%; max-width: 980px;
  border-radius: var(--radius-lg);
  padding: 2.4rem;
  position: relative;
  display: grid; grid-template-columns: 1fr 280px; gap: 2rem;
}
.modal-close {
  position: absolute; top: 1rem; right: 1rem;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-soft);
  color: var(--ink-soft);
}
.modal-close:hover { background: var(--ink); color: var(--bg); }
.modal-body h2 {
  font-family: var(--serif); font-size: 2rem; font-weight: 500;
  margin-bottom: 0.8rem;
}
.modal-body .source-link {
  display: inline-flex; align-items: center; gap: 0.3rem;
  margin-bottom: 1rem; font-size: 0.85rem; color: var(--ink-light);
}
.modal-body .summary-block {
  font-size: 1rem; line-height: 1.7; color: var(--ink-soft);
  padding: 1rem 1.2rem;
  background: rgba(201, 169, 97, 0.06);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1rem 0;
}
.modal-body .content-block {
  margin-top: 1.2rem;
  white-space: pre-wrap; font-size: 0.92rem; line-height: 1.7;
  color: var(--ink-soft); max-height: 360px; overflow-y: auto;
  padding: 1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
}
.modal-side h3 {
  font-family: var(--serif); font-size: 1.1rem; font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 0.7rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}
.related-card {
  padding: 0.7rem 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.2s var(--transition);
}
.related-card:hover { border-color: var(--brand); background: rgba(45, 74, 62, 0.03); }
.related-card-title { font-size: 0.9rem; color: var(--ink); margin-bottom: 0.3rem; }
.related-card-meta { font-size: 0.72rem; color: var(--ink-light); }

/* ===== Sanctum ===== */
.sanctum-tabs {
  display: flex; gap: 0.5rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2rem;
  overflow-x: auto;
}
.sanctum-tab {
  padding: 0.7rem 1.2rem;
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--ink-light);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: all 0.2s var(--transition);
  display: flex; align-items: center; gap: 0.4rem;
}
.sanctum-tab i, .sanctum-tab svg { width: 16px; height: 16px; }
.sanctum-tab.active { color: var(--brand); border-bottom-color: var(--gold); }
.sanctum-tab:hover { color: var(--ink); }

.sanctum-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.2rem;
}
.sanctum-card {
  position: relative;
  padding: 1.6rem 1.5rem 1.4rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  transition: all 0.3s var(--transition);
  overflow: hidden;
}
.sanctum-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-soft) 50%, var(--gold) 100%);
}
.sanctum-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--gold-soft); }
.sanctum-type {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.4rem;
}
.sanctum-title {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 0.6rem;
  line-height: 1.3;
}
.sanctum-body {
  font-size: 0.9rem; color: var(--ink-soft);
  line-height: 1.65;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.sanctum-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 1rem;
  font-size: 0.75rem; color: var(--ink-light);
}

/* ===== FeedbackBubble（全站浮動）===== */
.feedback-bubble {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 90;
}
.fb-trigger {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-hover);
  transition: all 0.25s var(--transition);
}
.fb-trigger:hover { background: var(--gold); color: #2A2210; transform: scale(1.05); }
.fb-trigger i { width: 22px; height: 22px; }

.fb-panel {
  position: absolute; bottom: 64px; right: 0;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  box-shadow: var(--shadow-hover);
  display: none;
  animation: fadeUp 0.25s var(--transition);
}
.fb-panel.open { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fb-title {
  font-family: var(--serif); font-size: 1.1rem; font-weight: 500;
  margin-bottom: 0.4rem;
}
.fb-sub { font-size: 0.82rem; color: var(--ink-light); margin-bottom: 0.8rem; }
.fb-types { display: flex; gap: 0.4rem; margin-bottom: 0.7rem; }
.fb-type {
  flex: 1;
  padding: 0.4rem 0.5rem;
  font-size: 0.82rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink-soft);
  transition: all 0.2s var(--transition);
}
.fb-type.active { background: var(--brand); color: var(--bg); border-color: var(--brand); }
.fb-textarea { width: 100%; min-height: 90px; font-size: 0.9rem; }
.fb-submit { width: 100%; margin-top: 0.7rem; }

/* ====================================================================
   ===== 對話 widget（全站浮動 + 詳細頁 inline）=====
   道家：宣紙白底、古玉墨綠邊、襯線標題、極淡、慢動效
   ==================================================================== */

/* 浮動氣泡 */
.brain-chat-bubble {
  position: fixed;
  bottom: 24px;
  /* FeedbackBubble 已佔右下角，對話 widget 放它的左邊 */
  right: 92px;
  z-index: 95;
}
.bc-trigger {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-hover);
  border: 1px solid var(--gold);
  transition: all 0.4s var(--transition);
  position: relative;
}
.bc-trigger::after {
  /* 淡淡的古銅金外光、道家氣感 */
  content: '';
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(181, 149, 72, 0.25);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s var(--transition);
}
.bc-trigger:hover {
  transform: translateY(-2px) scale(1.04);
  background: var(--brand-soft);
}
.bc-trigger:hover::after { opacity: 1; }
.bc-trigger i { width: 22px; height: 22px; }

/* 展開面板 */
.bc-panel {
  position: absolute;
  bottom: 64px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 60vh;
  max-height: 600px;
  min-height: 420px;
  background: var(--bg);
  border: 0.5px solid rgba(45, 74, 62, 0.35);
  border-radius: 16px;
  box-shadow: 0 24px 60px -16px rgba(26, 43, 36, 0.28),
              0 8px 24px -10px rgba(26, 43, 36, 0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: bcFadeUp 0.5s var(--transition);
}
.bc-panel.open { display: flex; }
@keyframes bcFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Header */
.bc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.95rem 1.1rem;
  border-bottom: 0.5px solid var(--line);
  background: rgba(248, 245, 238, 0.55);
}
.bc-head-title {
  display: flex; align-items: baseline; gap: 0.45rem;
  font-family: var(--serif);
  color: var(--ink);
}
.bc-head-title-main { font-size: 1.1rem; font-weight: 500; letter-spacing: 0.04em; }
.bc-head-title-sep { color: var(--gold); font-size: 0.9rem; }
.bc-head-title-sub { font-size: 0.95rem; color: var(--ink-soft); letter-spacing: 0.05em; }
.bc-head-actions { display: flex; gap: 0.25rem; }
.bc-icon-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px;
  color: var(--ink-light);
  transition: all 0.25s var(--transition);
}
.bc-icon-btn:hover { background: var(--bg-soft); color: var(--ink); }
.bc-icon-btn i { width: 14px; height: 14px; }

/* 模式提示 chip */
.bc-mode-row {
  padding: 0.7rem 1.1rem 0.4rem;
  border-bottom: 0.5px solid var(--line);
  background: var(--bg);
}
.bc-mode-pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--ink-soft);
  border: 0.5px solid var(--line);
}
.bc-mode-pill i { width: 12px; height: 12px; opacity: 0.7; }
.bc-mode-pill strong {
  color: var(--brand);
  font-weight: 500;
  margin-left: 0.15rem;
}
.bc-mode-pill.record-mode {
  background: rgba(45, 74, 62, 0.06);
  border-color: rgba(45, 74, 62, 0.22);
  color: var(--brand);
}

/* Thread 訊息區 */
.bc-thread {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem;
  display: flex; flex-direction: column; gap: 0.85rem;
  background: var(--bg);
}
.bc-empty {
  margin: auto;
  text-align: center;
  color: var(--ink-light);
  padding: 2rem 1rem;
}
.bc-empty i { width: 36px; height: 36px; opacity: 0.35; margin-bottom: 0.6rem; }
.bc-empty p { font-size: 0.88rem; line-height: 1.7; max-width: 26ch; margin: 0 auto; }

/* 訊息泡泡 */
.bc-msg { display: flex; flex-direction: column; gap: 0.2rem; max-width: 88%; }
.bc-msg-bubble {
  padding: 0.7rem 0.95rem;
  font-size: 0.9rem;
  line-height: 1.65;
  border-radius: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
.bc-msg-meta {
  font-size: 0.7rem;
  color: var(--ink-light);
  letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 0.25rem;
}
.bc-msg-meta i { width: 10px; height: 10px; opacity: 0.7; }

.bc-msg-user { align-self: flex-end; align-items: flex-end; }
.bc-msg-user .bc-msg-bubble {
  background: var(--brand);
  color: var(--bg);
  border-bottom-right-radius: 4px;
}

.bc-msg-ai { align-self: flex-start; align-items: flex-start; }
.bc-msg-ai .bc-msg-bubble {
  background: var(--bg-card);
  color: var(--ink);
  border: 0.5px solid var(--line);
  border-bottom-left-radius: 4px;
}

.bc-msg-note { align-self: center; align-items: center; max-width: 80%; }
.bc-msg-note .bc-msg-bubble {
  background: rgba(181, 149, 72, 0.07);
  color: var(--ink-soft);
  border: 0.5px dashed rgba(181, 149, 72, 0.4);
  font-style: italic;
  font-size: 0.86rem;
  text-align: center;
}
.bc-msg-note .bc-msg-meta { color: var(--gold); }

.bc-cursor {
  display: inline-block;
  margin-left: 2px;
  animation: bcBlink 1s steps(2, jump-none) infinite;
  color: var(--gold);
  font-weight: 700;
}
@keyframes bcBlink { 50% { opacity: 0; } }

/* Input 區 */
.bc-input-area {
  border-top: 0.5px solid var(--line);
  padding: 0.7rem 0.9rem 0.85rem;
  background: rgba(248, 245, 238, 0.6);
}

.bc-toggle, .record-thread-toggle {
  display: inline-flex;
  background: var(--bg-card);
  border: 0.5px solid var(--line);
  border-radius: 999px;
  padding: 2px;
  margin-bottom: 0.55rem;
  font-size: 0.78rem;
}
.bc-toggle-btn, .rt-toggle-btn {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  color: var(--ink-light);
  letter-spacing: 0.03em;
  transition: all 0.3s var(--transition);
}
.bc-toggle-btn i, .rt-toggle-btn i { width: 12px; height: 12px; }
.bc-toggle-btn.active { background: var(--brand); color: var(--bg); }
.bc-toggle-btn.active[data-mode="note"] { background: var(--gold); color: #2A2210; }
.rt-toggle-btn.active { background: var(--brand); color: var(--bg); }
.rt-toggle-btn.active[data-mode="note"] { background: var(--gold); color: #2A2210; }

.bc-input-row {
  display: flex; gap: 0.5rem; align-items: flex-end;
}
.bc-textarea {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
  line-height: 1.55;
  border-radius: 10px;
  border: 0.5px solid var(--line);
  background: var(--bg-card);
  resize: none;
}
.bc-send {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--brand);
  color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.25s var(--transition);
}
.bc-send:hover { background: var(--brand-soft); transform: translateY(-1px); }
.bc-send:disabled { opacity: 0.45; cursor: not-allowed; }
.bc-send i { width: 16px; height: 16px; }

/* ===== 詳細頁 inline thread 區塊 ===== */
.record-thread {
  margin-top: 1.6rem;
  border-top: 0.5px solid var(--line);
  padding-top: 1.2rem;
}
.record-thread-head {
  display: flex; align-items: center; gap: 0.5rem;
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--ink-soft);
  margin-bottom: 0.7rem;
  letter-spacing: 0.04em;
}
.record-thread-head i { width: 16px; height: 16px; color: var(--gold); }
.record-thread-hint {
  margin-left: auto;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--ink-light);
  font-style: italic;
}
.record-thread-list {
  background: var(--bg-card);
  border: 0.5px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  display: flex; flex-direction: column; gap: 0.7rem;
  max-height: 360px;
  overflow-y: auto;
  margin-bottom: 0.8rem;
}
.rt-empty {
  color: var(--ink-light);
  font-size: 0.85rem;
  font-style: italic;
  text-align: center;
  padding: 1.4rem 0.5rem;
}
.record-thread-input {
  display: flex; flex-direction: column; gap: 0.5rem;
}
.record-thread-textarea {
  width: 100%;
  min-height: 56px;
  font-size: 0.9rem;
  line-height: 1.6;
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  resize: vertical;
  background: var(--bg-card);
}
.record-thread-send { align-self: flex-end; }

/* ===== RWD ===== */
@media (max-width: 640px) {
  .brain-chat-bubble {
    /* 手機把對話氣泡放右下角主位、Feedback 移到左 */
    bottom: 16px;
    right: 16px;
  }
  .bc-trigger { width: 48px; height: 48px; }
  .bc-trigger i { width: 20px; height: 20px; }
  .bc-panel {
    /* 全螢幕 */
    position: fixed;
    bottom: 0; right: 0; left: 0; top: 0;
    width: 100vw;
    height: 100vh;
    max-height: none;
    border-radius: 0;
    border: none;
  }
}
@media (max-width: 880px) {
  /* Feedback 跟對話氣泡兩個避免重疊 */
  .feedback-bubble { bottom: 16px; right: 76px; }
}

/* 尊重 reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .bc-panel { animation: none; }
  .bc-cursor { animation: none; }
}

/* ===== RWD ===== */
@media (max-width: 880px) {
  .archive-layout { grid-template-columns: 1fr; }
  .archive-sidebar { position: static; order: 2; padding-top: 1rem; }
  .archive-main { order: 1; }
  .archive-modal { grid-template-columns: 1fr; padding: 1.6rem; }
  .modal-side { border-top: 1px solid var(--line); padding-top: 1.4rem; }
  .brain-header-inner { padding: 0.8rem 1rem; gap: 0.6rem; }
  .brain-logo-text { font-size: 1.2rem; }
  .brain-logo-sub { display: none; }
  .brain-nav { gap: 0.2rem; }
  .brain-nav-item { padding: 0.4rem 0.6rem; font-size: 0.85rem; }
  .brain-nav-item span { display: none; }
  .brain-nav-item i { width: 18px; height: 18px; }
  .brain-nav-item.active { padding: 0.4rem 0.7rem; }
  .brain-nav-item.active span { display: inline; }
  .page { padding: 1.5rem 1rem 4rem; }
  .submit-textarea { min-height: 200px; padding: 1rem; }
  .inbox-card { grid-template-columns: 60px 1fr; padding: 1rem; gap: 0.8rem; }
  .inbox-thumb { width: 60px; height: 60px; }
  .sanctum-grid { grid-template-columns: 1fr; }
  .feedback-bubble { bottom: 16px; right: 16px; }
  .fb-panel { width: calc(100vw - 32px); right: 0; }
}

/* =====================================================================
   ===== v3 投入頁 — UserMessage 輸入框 / Persona Dropdown / 結果卡片 =====
   道家：宣紙白底、古玉墨綠 0.5px 邊、慢動效、襯線標題
   ===================================================================== */

/* 主公對 AI 講話的小輸入框 */
.user-message-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 0.6rem;
  padding: 0.7rem 1rem;
  font-size: 0.92rem;
  font-family: var(--sans);
  line-height: 1.55;
  border-radius: var(--radius);
  border: 0.5px solid var(--line);
  background: var(--bg-card);
  resize: none;
  min-height: 44px;
  max-height: 100px;
  font-style: italic;
}
.user-message-input::placeholder { color: var(--ink-light); font-style: italic; }

/* Persona Dropdown（投入頁與對話 widget 共用 base） */
.persona-dropdown {
  position: relative;
  display: inline-block;
}
.persona-trigger {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 0.5px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  transition: all 0.3s var(--transition);
  cursor: pointer;
  font-family: var(--sans);
}
.persona-trigger:hover {
  border-color: rgba(45, 74, 62, 0.35);
  background: rgba(45, 74, 62, 0.03);
  color: var(--ink);
}
.persona-trigger .persona-icon {
  font-size: 1rem;
  line-height: 1;
}
.persona-trigger .persona-label-prefix {
  color: var(--ink-light);
  font-size: 0.8rem;
}
.persona-trigger .persona-name { color: var(--brand); font-weight: 500; }
.persona-trigger .persona-caret {
  width: 12px; height: 12px;
  margin-left: 0.15rem;
  opacity: 0.5;
  transition: transform 0.3s var(--transition);
}
.persona-dropdown.open .persona-trigger .persona-caret {
  transform: rotate(180deg);
}

.persona-menu {
  position: absolute;
  top: calc(100% + 6px);
  /* 預設靠 trigger 左邊展開（投入頁的 trigger 在左下角，靠右會切到視窗）*/
  left: 0;
  right: auto;
  min-width: 240px;
  background: var(--bg);
  border: 0.5px solid rgba(45, 74, 62, 0.25);
  border-radius: 12px;
  box-shadow: 0 18px 40px -12px rgba(26, 43, 36, 0.22),
              0 6px 16px -6px rgba(26, 43, 36, 0.15);
  padding: 0.5rem;
  display: none;
  z-index: 110;
  max-height: 360px;
  overflow-y: auto;
  animation: pmFadeIn 0.35s var(--transition);
}
.persona-dropdown.open .persona-menu { display: block; }
@keyframes pmFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* 對話 widget 內的 dropdown：往下展開（避免被 Header 蓋） */
.persona-dropdown.menu-down .persona-menu {
  top: calc(100% + 6px);
  right: 0;
  left: auto;
}
.persona-group {
  padding: 0.4rem 0.4rem 0.2rem;
}
.persona-group + .persona-group {
  border-top: 0.5px solid var(--line);
  margin-top: 0.3rem;
  padding-top: 0.55rem;
}
.persona-group-title {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  padding: 0.2rem 0.6rem 0.4rem;
  font-family: var(--serif);
}
.persona-item {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s var(--transition);
  width: 100%;
  text-align: left;
}
.persona-item:hover {
  background: rgba(45, 74, 62, 0.05);
}
.persona-item.active {
  background: rgba(45, 74, 62, 0.08);
}
.persona-item-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex: 0 0 auto;
}
.persona-item-text {
  display: flex; flex-direction: column; gap: 0.05rem;
  min-width: 0;
}
.persona-item-name {
  font-size: 0.92rem;
  color: var(--ink);
  font-weight: 500;
  font-family: var(--sans);
}
.persona-item-title {
  font-size: 0.74rem;
  color: var(--ink-light);
  letter-spacing: 0.04em;
}
.persona-item-check {
  margin-left: auto;
  color: var(--gold);
  width: 14px; height: 14px;
  opacity: 0;
  flex: 0 0 auto;
}
.persona-item.active .persona-item-check { opacity: 1; }

/* 投入頁 actions row 改造：persona dropdown 與 submit 並排 */
.submit-actions {
  align-items: center;
}
.submit-actions-right {
  display: flex; align-items: center; gap: 0.6rem;
  flex-wrap: wrap;
}

/* AI 處理中 spinner（升級版、襯線體） */
.intake-spinner {
  display: none;
  margin-top: 1.6rem;
  padding: 1.6rem 1.4rem;
  background: rgba(45, 74, 62, 0.04);
  border: 0.5px solid rgba(45, 74, 62, 0.18);
  border-radius: var(--radius-lg);
  text-align: center;
  font-family: var(--serif);
  color: var(--brand);
  letter-spacing: 0.08em;
  animation: spinnerFadeIn 0.5s var(--transition);
}
.intake-spinner.show { display: block; }
@keyframes spinnerFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.intake-spinner-icon {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
  display: inline-block;
}
.intake-spinner-text {
  font-size: 1.05rem;
  font-style: italic;
}
.intake-spinner-cursor {
  display: inline-block;
  margin-left: 4px;
  color: var(--gold);
  font-weight: 700;
  animation: bcBlink 1s steps(2, jump-none) infinite;
}
.intake-spinner-sub {
  margin-top: 0.4rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--ink-light);
  letter-spacing: 0.04em;
}

/* 投入結果卡片（AI 回覆 + 三按鈕） */
.intake-result {
  display: none;
  margin-top: 1.8rem;
  padding: 1.8rem 1.8rem 1.4rem;
  background: var(--bg-card);
  border: 0.5px solid rgba(45, 74, 62, 0.30);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px -16px rgba(26, 43, 36, 0.22),
              0 4px 12px -4px rgba(26, 43, 36, 0.10);
  position: relative;
  overflow: hidden;
  animation: resultFadeIn 0.6s var(--transition);
}
.intake-result.show { display: block; }
.intake-result.fading { opacity: 0; transform: translateY(-6px); transition: all 0.5s var(--transition); }
@keyframes resultFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* 卡片頂上的金線（道家落款感） */
.intake-result::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--gold) 30%,
    var(--gold-soft) 50%,
    var(--gold) 70%,
    transparent 100%);
  opacity: 0.7;
}
.intake-result-head {
  display: flex; align-items: center; gap: 0.7rem;
  margin-bottom: 1.1rem;
  padding-bottom: 0.9rem;
  border-bottom: 0.5px solid var(--line);
}
.intake-result-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(45, 74, 62, 0.08);
  border: 0.5px solid rgba(45, 74, 62, 0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex: 0 0 auto;
}
.intake-result-who {
  display: flex; flex-direction: column; gap: 0.1rem;
}
.intake-result-name {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.intake-result-title {
  font-size: 0.78rem;
  color: var(--ink-light);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.intake-result-section {
  margin-bottom: 1.1rem;
}
.intake-result-section:last-of-type {
  margin-bottom: 0.4rem;
}
.intake-result-label {
  font-family: var(--serif);
  font-size: 0.85rem;
  color: var(--gold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.intake-result-summary {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--ink-soft);
  padding: 0.9rem 1.1rem;
  background: rgba(201, 169, 97, 0.05);
  border-left: 2px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  white-space: pre-wrap;
}
.intake-result-opening {
  font-size: 0.96rem;
  line-height: 1.8;
  color: var(--ink);
  font-family: var(--sans);
  white-space: pre-wrap;
  padding: 0.4rem 0.2rem;
}
.intake-result-tags {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  margin-top: 0.3rem;
}
.intake-result-actions {
  margin-top: 1.4rem;
  padding-top: 1.1rem;
  border-top: 0.5px solid var(--line);
  display: flex; gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.intake-result-actions .btn {
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
}
.intake-result-actions .btn-toss {
  background: transparent;
  color: var(--ink-light);
  border: 0.5px solid var(--line);
}
.intake-result-actions .btn-toss:hover {
  background: var(--bg-soft);
  color: var(--ink-soft);
  transform: none;
  box-shadow: none;
}

/* 對話 widget head 的 persona dropdown trigger（縮小版） */
.bc-head .persona-dropdown {
  margin-left: 0.6rem;
}
.bc-head .persona-trigger {
  padding: 0.32rem 0.55rem;
  font-size: 0.8rem;
  border-radius: 999px;
  background: rgba(45, 74, 62, 0.05);
  border: 0.5px solid rgba(45, 74, 62, 0.2);
}
.bc-head .persona-trigger .persona-label-prefix { display: none; }
.bc-head .persona-menu {
  right: 0;
  left: auto;
  top: calc(100% + 4px);
  min-width: 220px;
}

/* 手機版：投入頁 actions / 結果卡片 */
@media (max-width: 640px) {
  .submit-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .submit-actions-right {
    justify-content: space-between;
  }
  .submit-btn { flex: 1; justify-content: center; }
  .persona-trigger { padding: 0.5rem 0.7rem; font-size: 0.85rem; }
  /* 投入頁的 trigger 在左下角，靠 trigger 左邊展開（避免左切）；對話 widget 內的 dropdown 由 .menu-down 規則覆寫成 right:0 */
  #personaDropdown .persona-menu { min-width: 220px; left: 0; right: auto; }

  .intake-result { padding: 1.4rem 1.2rem 1.1rem; }
  .intake-result-head { gap: 0.55rem; }
  .intake-result-avatar { width: 34px; height: 34px; font-size: 1.05rem; }
  .intake-result-name { font-size: 1.05rem; }
  .intake-result-actions { justify-content: stretch; }
  .intake-result-actions .btn { flex: 1; justify-content: center; min-width: 0; padding: 0.6rem 0.5rem; font-size: 0.85rem; }
}

/* ============================================================
   v6 — Inbox 七員迴流徽章（古銅金小膠囊）
   ============================================================ */
.inbox-card-agent { position: relative; }
.agent-badge {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: #B59548;
  color: #FDFBF6;
  border: 0;
  border-radius: 999px;
  font-family: var(--font-sans-tc, sans-serif);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(31,42,36,0.12);
  transition: all 0.4s cubic-bezier(.2,.7,.2,1);
}
.agent-badge:hover {
  background: #A88A47;
  transform: translateY(-1px);
}

/* ============================================================
   v7 — Archive 搜尋模式切換 + 過月回顧
   ============================================================ */
.search-mode-toggle {
  display: inline-flex;
  border: 1px solid var(--line-soft, #E8E2D4);
  border-radius: 999px;
  padding: 2px;
  background: #FFFFFF;
  margin: 0 0.4rem;
}
.search-mode-toggle .sm-btn {
  background: transparent;
  border: 0;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-family: inherit;
  color: var(--text-secondary, #6B7670);
  cursor: pointer;
  transition: all 0.3s ease;
}
.search-mode-toggle .sm-btn.active {
  background: var(--ink-primary, #2A4338);
  color: var(--text-on-dark, #F4EFE3);
}

.recall-block {
  margin: 1.2rem 0 1.6rem;
  padding: 1.2rem 1.2rem 1rem;
  background: linear-gradient(180deg, rgba(181,149,72,0.04) 0%, transparent 100%);
  border: 1px dashed rgba(181,149,72,0.3);
  border-radius: 12px;
}
.recall-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
  font-size: 0.85rem;
  color: var(--text-secondary, #6B7670);
}
.recall-head i { color: #B59548; width: 16px; height: 16px; }
.recall-title {
  font-family: var(--font-serif-tc, serif);
  font-size: 1rem;
  color: var(--text-primary, #1F2A24);
  letter-spacing: 0.04em;
}
.recall-sub { font-size: 0.78rem; color: var(--text-tertiary, #98A09B); margin-left: auto; font-style: italic; }
.recall-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.6rem;
  opacity: 0.85;
}
.recall-card {
  background: rgba(253,251,246,0.6);
  border: 1px solid var(--line-soft, #E8E2D4);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(.2,.7,.2,1);
}
.recall-card:hover {
  opacity: 1;
  background: #FFFFFF;
  transform: translateY(-2px);
  border-color: rgba(181,149,72,0.4);
}
.recall-card-date {
  font-size: 0.72rem;
  color: #B59548;
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
}
.recall-card-title {
  font-family: var(--font-serif-tc, serif);
  font-size: 0.95rem;
  color: var(--text-primary, #1F2A24);
  margin-bottom: 0.3rem;
  line-height: 1.4;
}
.recall-card-summary {
  font-size: 0.78rem;
  color: var(--text-secondary, #6B7670);
  line-height: 1.55;
}

/* ============================================================
   v8 — 每日思維卡（宣紙白底、儀式感、留白）
   ============================================================ */
.page-daily-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 1.4rem 6rem;
}
.daily-card {
  background: #FDFBF6;
  border: 1px solid var(--line-soft, #E8E2D4);
  padding: 4rem 3rem 3rem;
  position: relative;
  box-shadow: 0 1px 2px rgba(31,42,36,0.04), 0 12px 40px rgba(31,42,36,0.06);
  border-radius: 4px;
}
.daily-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #B59548 50%, transparent);
  opacity: 0.6;
}
.daily-card-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: #B59548;
  text-align: center;
  margin-bottom: 1.2rem;
}
.daily-card-title {
  font-family: var(--font-serif-tc, 'Noto Serif TC', serif);
  font-size: 2.4rem;
  font-weight: 500;
  text-align: center;
  color: var(--text-primary, #1F2A24);
  margin: 0 0 2rem;
  line-height: 1.3;
  letter-spacing: 0.02em;
}
.daily-card-content {
  font-size: 1.05rem;
  line-height: 2;
  color: var(--text-primary, #1F2A24);
  white-space: pre-wrap;
  word-break: break-word;
  padding: 1.6rem 0;
  border-top: 1px solid var(--line-soft, #E8E2D4);
  border-bottom: 1px solid var(--line-soft, #E8E2D4);
  margin-bottom: 1.4rem;
}
.daily-card-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 1.6rem;
}
.daily-card-opening {
  margin: 1.6rem 0 0;
  padding: 1.6rem 1.2rem;
  background: rgba(181,149,72,0.04);
  border-left: 2px solid #B59548;
  font-family: var(--font-serif-tc, 'Noto Serif TC', serif);
  font-size: 1.05rem;
  line-height: 1.95;
  color: var(--text-primary, #1F2A24);
  position: relative;
}
.daily-card-opening .opening-mark {
  font-size: 2rem;
  color: #B59548;
  line-height: 1;
  margin-bottom: 0.4rem;
}
.daily-card-opening .opening-text { font-style: italic; }
.daily-card-opening .opening-sign {
  margin-top: 0.8rem;
  font-size: 0.78rem;
  color: var(--text-tertiary, #98A09B);
  font-style: normal;
  letter-spacing: 0.06em;
}
.daily-card-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 2rem;
}
.daily-card-seal {
  position: absolute;
  bottom: 14px; right: 14px;
  width: 28px; height: 28px;
  opacity: 0.5;
}
@media (max-width: 600px) {
  .daily-card { padding: 2.4rem 1.4rem 1.8rem; }
  .daily-card-title { font-size: 1.7rem; }
  .daily-card-content { font-size: 1rem; padding: 1.2rem 0; }
  .daily-card-actions .btn { flex: 1; justify-content: center; }
}

/* ============================================================
   v9 — 送禮分享 modal
   ============================================================ */
.gift-field { margin-bottom: 1.1rem; }
.gift-label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-secondary, #6B7670);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.gift-input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line-soft, #E8E2D4);
  background: #FFFFFF;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-primary, #1F2A24);
  border-radius: 6px;
  box-sizing: border-box;
}
.gift-input:focus {
  outline: none;
  border-color: #B59548;
}
.gift-format-group {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}
.gift-radio {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--line-soft, #E8E2D4);
  border-radius: 999px;
  background: #FFFFFF;
  transition: all 0.25s ease;
}
.gift-radio:hover { border-color: #B59548; }
.gift-radio input { margin: 0; accent-color: #B59548; }
.gift-result {
  margin-top: 1.4rem;
  padding: 1.1rem 1rem;
  background: rgba(181,149,72,0.06);
  border: 1px solid rgba(181,149,72,0.3);
  border-radius: 8px;
}
.gift-result-title {
  font-family: var(--font-serif-tc, serif);
  font-size: 1rem;
  color: var(--text-primary, #1F2A24);
  margin-bottom: 0.7rem;
}
.gift-result-url {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.6rem;
}
.gift-result-url input {
  flex: 1;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line-soft, #E8E2D4);
  background: #FFFFFF;
  font-family: var(--font-mono, monospace);
  font-size: 0.78rem;
  color: var(--text-primary, #1F2A24);
  border-radius: 4px;
  min-width: 0;
}
.gift-result-meta {
  font-size: 0.78rem;
  color: var(--text-secondary, #6B7670);
}

/* ============================================================
   v10 — Inbox 詳情 Modal（點卡片展開、看完整摘要 + 開原連結）
   道家：宣紙白 / 古玉墨綠邊 / 古銅金點綴 / 慢動效
   ============================================================ */
.inbox-card .inbox-clickable {
  cursor: pointer;
  border-radius: var(--radius);
  margin: -0.3rem -0.4rem;
  padding: 0.3rem 0.4rem;
  transition: background 0.4s ease-out;
}
.inbox-card .inbox-clickable:hover {
  background: rgba(181, 149, 72, 0.06);
}

/* 單欄版 modal（沒有右側欄）*/
.inbox-detail-modal {
  grid-template-columns: 1fr !important;
  max-width: 760px;
  animation: inboxModalIn 0.5s cubic-bezier(.2,.7,.2,1);
}
@keyframes inboxModalIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* modal 內 tag 區 */
.modal-tag-row {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  margin: 0.4rem 0 1rem;
  align-items: center;
}
.tag.tag-soft {
  background: rgba(45, 74, 62, 0.05);
  color: var(--ink-soft);
  border: 1px dashed var(--line);
}
.tag.tag-agent {
  background: #B59548;
  color: #FDFBF6;
  border: 0;
}

/* modal 原始 URL 顯示 */
.modal-source-url {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.82rem; color: var(--ink-light);
  font-family: var(--font-mono, monospace);
  word-break: break-all;
  margin-bottom: 0.8rem;
  padding: 0.4rem 0.7rem;
  background: var(--bg-soft);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.modal-source-url i { width: 13px; height: 13px; flex-shrink: 0; }

/* modal section 區塊（觀察 / 截圖 / 對話）*/
.modal-section {
  margin-top: 1.4rem;
}
.modal-section-label {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-family: var(--serif);
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
  letter-spacing: 0.03em;
}
.modal-section-label i { width: 15px; height: 15px; opacity: 0.7; }

/* modal 截圖 */
.modal-thumb-img {
  display: block;
  max-width: 100%;
  max-height: 360px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  object-fit: contain;
}

/* modal thread 對話 */
.modal-thread {
  display: flex; flex-direction: column; gap: 0.7rem;
  max-height: 320px; overflow-y: auto;
  padding: 0.5rem 0.2rem;
}
.modal-thread-msg {
  display: grid; grid-template-columns: 50px 1fr;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--line);
}
.modal-thread-assistant {
  background: rgba(201, 169, 97, 0.06);
  border-color: rgba(201, 169, 97, 0.18);
}
.modal-thread-role {
  font-family: var(--serif);
  font-size: 0.78rem;
  color: var(--ink-light);
  letter-spacing: 0.04em;
}
.modal-thread-text {
  font-size: 0.9rem; line-height: 1.6;
  color: var(--ink-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

/* modal 時間列 */
.modal-time-row {
  display: flex; flex-wrap: wrap; gap: 1rem;
  font-size: 0.78rem;
  color: var(--ink-light);
  margin-top: 1.4rem;
  padding-top: 0.9rem;
  border-top: 1px dashed var(--line);
}
.modal-time-row span { display: inline-flex; align-items: center; gap: 0.3rem; }
.modal-time-row i { width: 12px; height: 12px; }

/* modal 底部按鈕列 */
.modal-action-bar {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  align-items: center;
  margin-top: 1.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}
.modal-action-bar .grow { flex: 1; }
.modal-open-link {
  /* 古銅金實心、墨綠字、顯眼 */
  background: var(--gold, #B59548) !important;
  color: var(--ink, #2A4338) !important;
  border: 0;
  font-weight: 500;
}
.modal-open-link:hover {
  background: #A88A47 !important;
  transform: translateY(-1px);
}

/* RWD：手機版改全螢幕（限定 inbox 詳情 modal）*/
@media (max-width: 880px) {
  #inboxModalBg {
    padding: 0;
    align-items: stretch;
  }
  #inboxModalBg .inbox-detail-modal {
    max-width: 100%;
    padding: 1.4rem 1.2rem;
    border-radius: 0;
    min-height: 100vh;
  }
  #inboxModalBg .modal-action-bar {
    position: sticky; bottom: 0;
    background: var(--bg);
    margin: 1rem -1.2rem -1.4rem;
    padding: 1rem 1.2rem;
    border-top: 1px solid var(--line);
    z-index: 5;
  }
  #inboxModalBg .modal-action-bar .grow { display: none; }
  #inboxModalBg .modal-action-bar .btn { flex: 1; justify-content: center; min-width: 0; }
  #inboxModalBg .modal-thread { max-height: 240px; }
}
