/* Scoped to the personal conversation surfaces; the existing app shell stays intact. */
.bb-home, .bb-chat, .bb-profile, .bb-dialog {
  --bb-ink: #f3f1fa;
  --bb-muted: #c1bdcf;
  --bb-accent: #d5c5f1;
  color: var(--bb-ink);
}
/* 统一中枢布局 */
.bb-unified-home {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 20px;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

/* 恢复脑管家卡通形象样式 */
.bb-avatar-container {
    position: relative;
    width: 140px;
    height: 140px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: float-core 6s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}

.bb-avatar-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(147, 112, 219, 0.5) 0%, transparent 70%);
    filter: blur(20px);
    z-index: 0;
    animation: pulse-glow 4s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}

.bb-avatar-img {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    z-index: 2;
    border: 2px solid rgba(255,255,255,0.1);
    box-shadow: 0 12px 36px rgba(0,0,0,0.5), inset 0 0 20px rgba(147, 112, 219, 0.3);
}

/* 恢复最近记录样式 */
.bb-recent-reports {
    width: 100%;
    margin-top: 32px;
    background: rgba(255,255,255,0.015);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 20px;
    padding: 20px;
    backdrop-filter: blur(12px);
}

.bb-recent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.bb-recent-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    color: rgba(255,255,255,0.9);
}

.bb-recent-header .bb-text-button {
    min-height: auto;
    padding: 0;
    font-size: 12px;
    color: var(--bb-accent);
}

.bb-recent-empty {
    font-size: 13px;
    color: rgba(255,255,255,0.4);
    text-align: center;
    padding: 12px 0;
}

/* 欢迎文字 */
.bb-greeting-text {
    text-align: center;
    margin-bottom: 32px;
}
.bb-greeting-text h2 {
    font-size: 26px;
    font-weight: 300;
    color: white;
    letter-spacing: 3px;
    margin: 0 0 10px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
.bb-greeting-text p {
    font-size: 15px;
    color: rgba(255,255,255,0.55);
    margin: 0;
    letter-spacing: 0.5px;
}

/* 极简搜索框 */
.bb-search-composer {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 30px;
    padding: 6px 6px 6px 24px;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    margin-bottom: 12px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.bb-search-composer:focus-within {
    background: rgba(255,255,255,0.05);
    border-color: rgba(147, 112, 219, 0.4);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2), 0 0 0 4px rgba(147, 112, 219, 0.1);
    transform: translateY(-1px);
}
.bb-search-composer input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 15px;
    outline: none;
}
.bb-search-composer input::placeholder { color: rgba(255,255,255,0.3); }
.bb-search-send {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.1);
    color: white;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}
.bb-search-send:hover { background: #7a63a5; transform: scale(1.05); }

.bb-status-mini {
    font-size: 11px; color: rgba(255,255,255,0.3); margin-bottom: 40px; text-align: center;
}

/* 功能环绕卡片 (Action Grid) */
.bb-action-grid {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.bb-action-card {
    background: rgba(255,255,255,0.015);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.bb-action-card:hover {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.12);
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 12px 24px rgba(0,0,0,0.2), 0 0 20px rgba(147, 112, 219, 0.05);
}

.bb-action-card:active {
    transform: translateY(0) scale(0.98);
    transition-duration: 0.1s;
}

.bb-action-card.action-sleep {
    grid-column: span 2;
    flex-direction: row;
    align-items: center;
    background: linear-gradient(135deg, rgba(122, 99, 165, 0.08), rgba(75, 62, 124, 0.15));
    border: 1px solid rgba(147, 112, 219, 0.15);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}

.bb-action-card.action-sleep:hover {
    background: linear-gradient(135deg, rgba(122, 99, 165, 0.15), rgba(75, 62, 124, 0.25));
    border-color: rgba(147, 112, 219, 0.3);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05), 0 16px 32px rgba(0,0,0,0.25), 0 0 30px rgba(147, 112, 219, 0.15);
}

.action-icon {
    width: 44px; height: 44px;
    border-radius: 14px;
    background: rgba(255,255,255,0.03);
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.9);
    margin-bottom: 16px;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.05);
}
.action-sleep .action-icon { margin-bottom: 0; margin-right: 16px; background: rgba(147, 112, 219, 0.15); color: #d5c5f1; }

.action-text h3 { margin: 0 0 6px; font-size: 16px; font-weight: 500; color: rgba(255,255,255,0.95); letter-spacing: 0.5px; }
.action-text p { margin: 0; font-size: 13px; color: rgba(255,255,255,0.5); line-height: 1.4; }

.action-play-icon {
    margin-left: auto;
    width: 48px; height: 48px;
    border-radius: 50%;
    background: white;
    color: #4b3e7c;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* 历史旧样式 */
.bb-home { display: none; }
.bb-identity { display: flex; align-items: center; gap: 16px; margin: 0 0 22px; }
.bb-avatar.butler-avatar-img {
  width: 76px; height: 76px; flex: 0 0 76px; object-fit: cover; border-radius: 50%;
  border: 1px solid rgba(213,197,241,.22); box-shadow: 0 0 26px rgba(178,141,229,.12);
}
.bb-eyebrow { color: var(--bb-muted); font-size: 10px; letter-spacing: .06em; margin-bottom: 5px; }
.bb-home .bb-identity h2 { font-size: 21px; line-height: 1.4; margin: 0; letter-spacing: .02em; }
.bb-greeting { margin: 7px 0 0; font-size: 13px; color: var(--bb-muted); text-align: center; }
.bb-composer {
  position: relative; width: 100%; max-width: 480px; margin: 0 auto;
  border: 1px solid rgba(216,206,239,.15); border-radius: 20px; padding: 12px 13px 10px;
  background: rgba(255, 255, 255, 0.05); transition: border-color .2s, box-shadow .2s;
}
.bb-composer:focus-within { border-color: var(--bb-accent); box-shadow: 0 0 0 3px rgba(213,197,241,.08); }
.bb-composer textarea {
  font: inherit; font-size: 14px; line-height: 1.6; color: var(--bb-ink);
  width: 100%; min-height: 56px; max-height: 150px; resize: vertical;
  border: 0; background: transparent; border-radius: 4px; padding: 0; box-shadow: none;
}
.bb-composer textarea:focus-visible { outline: 1px solid transparent; }
.bb-composer textarea::placeholder { color: #aaa8be; opacity: 1; }
.bb-composer-bottom { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 6px; }
.bb-composer-bottom > span { color: var(--bb-muted); font-size: 11px; }
.bb-send {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  border: 0; flex-shrink: 0; background: var(--bb-accent); color: #251c38;
  transition: transform .16s, background-color .16s; cursor: pointer;
}
.bb-send svg { width: 23px; height: 23px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.bb-send:hover { background: #e5daf7; transform: translateY(-1px); }
.bb-send:active { transform: scale(.94); }
.bb-tools { display: flex; justify-content: center; gap: 12px; margin-top: 20px; }
.bb-tools button {
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7); padding: 8px 16px; border-radius: 20px;
  font-size: 13px; cursor: pointer; transition: all 0.2s ease;
}
.bb-tools button:hover { background: rgba(255,255,255,0.1); color: #fff; border-color: rgba(255,255,255,0.2); }
.bb-text-button:hover { color: #fff; text-decoration: underline; }
.bb-status { font-size: 11px; line-height: 1.7; color: var(--bb-muted); margin: 4px 0; overflow-wrap: anywhere; }
.bb-status:empty { display: none; }
.bb-text-button { font: inherit; font-size: 12px; color: var(--bb-muted); background: none; border: 0; padding: 9px 0; min-height: 44px; cursor: pointer; text-align: left; }
.bb-preview { width: 100%; display: grid; gap: 4px; color: var(--bb-muted); background: transparent; border: 0; border-top: 1px solid rgba(255,255,255,.1); padding: 12px 0; text-align: left; font: inherit; font-size: 12px; cursor: pointer; }
.bb-preview span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bb-home [hidden], .bb-chat [hidden] { display: none !important; }
.bb-chat-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.bb-messages { max-height: 45dvh; min-height: 160px; overflow-y: auto; overscroll-behavior: contain; padding: 8px 2px; scrollbar-width: thin; }
.bb-message { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.85; margin-bottom: 20px; }
.bb-user { padding: 12px 15px; margin-left: 25px; border-radius: 16px 16px 3px 16px; background: rgba(168,142,205,.16); }
.bb-assistant { padding: 0 4px; }
.bb-assistant p { margin: 7px 0 0; }
.bb-message-label { font-size: 10px; letter-spacing: .04em; color: var(--bb-accent); }
.bb-message .bb-text-button { display: block; }
.bb-source-note { font-size: 11px; color: var(--bb-muted); line-height: 1.7; }
.bb-sources { margin-top: 12px; border-top: 1px solid rgba(255,255,255,.12); font-size: 12px; white-space: normal; }
.bb-sources summary { cursor: pointer; padding: 10px 0; min-height: 44px; box-sizing: border-box; }
.bb-sources summary:focus-visible { outline: 2px solid var(--bb-accent); outline-offset: 2px; }
.bb-sources details { border-top: 1px solid rgba(255,255,255,.08); }
.bb-sources pre { font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; padding: 10px; background: rgba(255,255,255,.04); }
.bb-empty { margin: 30px 0; line-height: 1.9; color: var(--bb-muted); font-size: 13px; }
.bb-history { padding: 8px 0; border-block: 1px solid rgba(255,255,255,.12); max-height: 180px; overflow-y: auto; }
.bb-history-item { display: block; width: 100%; border: 0; background: transparent; color: var(--bb-ink); font: inherit; text-align: left; padding: 12px 4px; cursor: pointer; }
.bb-profile { margin: 22px 0; padding: 16px 0; border-block: 1px solid rgba(255,255,255,.12); }
.bb-profile summary { font-size: 15px; cursor: pointer; min-height: 28px; }
.bb-profile p, .bb-profile label { font-size: 12px; color: var(--bb-muted); }
.bb-profile select {
  display: block; width: 100%; margin: 8px 0 14px; padding: 12px; font: inherit;
  background: #16192e; border: 1px solid #55516d; border-radius: 10px; color: var(--bb-ink); color-scheme: dark;
}
.bb-dialog {
  width: min(410px, calc(100% - 24px)); max-height: 85dvh; overflow-y: auto; overscroll-behavior: contain;
  border-radius: 24px; border: 1px solid #55506b; background: #131528;
  padding: 24px; margin: auto; box-shadow: 0 24px 80px #0009;
}
.bb-dialog::backdrop { background: rgba(2,2,10,.74); backdrop-filter: blur(5px); }
.bb-dialog h2 { font-size: 20px; margin: 0 0 14px; }
.bb-dialog > p { font-size: 12px; color: var(--bb-muted); line-height: 1.8; }
.bb-consent-row { display: flex; align-items: flex-start; gap: 11px; padding: 14px 0; font-size: 13px; line-height: 1.8; cursor: pointer; }
.bb-consent-row input { flex: 0 0 19px; width: 19px; height: 19px; margin: 3px 0 0; accent-color: var(--bb-accent); }
.bb-dialog-actions { display: flex; gap: 10px; margin-top: 20px; }
.bb-primary, .bb-secondary { border-radius: 12px; font: inherit; font-size: 13px; min-height: 44px; padding: 11px 16px; cursor: pointer; }
.bb-primary { background: var(--bb-accent); color: #251c38; border: 1px solid var(--bb-accent); }
.bb-secondary { background: transparent; border: 1px solid #6e6683; color: var(--bb-ink); }
.bb-dialog-actions button { flex: 1; }
.bb-home button:focus-visible, .bb-chat button:focus-visible, .bb-dialog :focus-visible, .bb-profile :focus-visible {
  outline: 2px solid #e2d5fa; outline-offset: 3px;
}
.bb-home button, .bb-chat button, .bb-dialog button, .bb-profile button { touch-action: manipulation; }
.bb-home button:disabled, .bb-chat button:disabled, .bb-dialog button:disabled { opacity: .5; cursor: wait; transform: none; }
.bb-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; border: 0; }
.bb-home { animation: bb-enter .3s ease-out; }
.bb-dialog[open] { animation: bb-enter .2s ease-out; }
#careMount .bb-card{margin-top:18px;padding:18px}
#careMount label{display:block;margin:10px 0;color:inherit}
#careMount input:not([type=checkbox]),#careMount select,#careMount textarea{display:block;width:100%;max-width:100%;box-sizing:border-box;margin:6px 0;padding:10px;border:1px solid rgba(255,255,255,.18);border-radius:10px;background:#171c2a;color:#fff}
#careMount p,#careMount small{overflow-wrap:anywhere;line-height:1.7}
#careMount small{display:block}
#careMount button{margin:8px 8px 8px 0}
@keyframes bb-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 370px) {
  .bb-identity { gap: 12px; }
  .bb-avatar.butler-avatar-img { width: 64px; height: 64px; flex-basis: 64px; }
  .bb-home .bb-identity h2 { font-size: 19px; }
  .bb-eyebrow { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .bb-home, .bb-dialog[open] { animation: none; }
  .bb-send, .bb-composer { transition: none; }
}
