/* ─── 两仪命理 AI 工作台 — 纯黑深灰金点缀视觉系统 (无 Emoji 规范) ────────────────────────── */

:root {
    --gold: #d3a85e;
    --gold-light: #e8c87a;
    --gold-dark: #997328;
    --gold-glow: rgba(211, 168, 94, 0.15);

    --bg-black: #09090b;
    --bg-dark-grey: #121215;
    --bg-card: #18181c;
    --bg-card-hover: #222228;
    --bg-input: #151518;

    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-gold: rgba(211, 168, 94, 0.25);
    --border-gold-bright: rgba(211, 168, 94, 0.5);

    --text-white: #ffffff;
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-gold: #e8c87a;

    --element-wood: #4caf50;
    --element-fire: #ef5350;
    --element-earth: #d3a85e;
    --element-metal: #cfd8dc;
    --element-water: #42a5f5;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;
}

/* 基础重置 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background-color: var(--bg-black);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* 移动端 Header */
.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 52px;
    background: var(--bg-dark-grey);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 100;
}

.mobile-header .logo-text {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    color: var(--text-white);
    font-size: 1.05rem;
}

/* 三栏布局 Container */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--bg-black);
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.82rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}
.icon-btn:hover {
    color: var(--text-gold);
    border-color: var(--border-gold);
}

.wallet-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    color: var(--text-gold);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.wallet-btn:hover {
    background: rgba(211, 168, 94, 0.15);
    border-color: var(--gold-light);
}

/* ─── 1. 左侧边栏 (桌面固定 260px，不被手动折叠) ────────────────────────── */
.sidebar-left {
    width: 260px;
    min-width: 260px;
    background: var(--bg-dark-grey);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 50;
}

.sidebar-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.logo-title {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-white);
    letter-spacing: 0.5px;
}

.new-chat-btn {
    margin: 16px 16px 10px;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-md);
    color: var(--text-gold);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.new-chat-btn:hover {
    background: rgba(211, 168, 94, 0.15);
    border-color: var(--gold-light);
}

.sidebar-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px;
}
.sidebar-scroll-area::-webkit-scrollbar {
    width: 4px;
}
.sidebar-scroll-area::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
}

.sidebar-section {
    margin-bottom: 18px;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    padding: 6px 8px;
    margin-bottom: 4px;
}

.add-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    border-radius: 4px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}
.add-btn:hover {
    color: var(--text-gold);
    border-color: var(--border-gold);
}

.profile-list, .chat-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    cursor: pointer;
    background: transparent;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}
.profile-item:hover {
    background: var(--bg-card-hover);
}
.profile-item.active {
    background: var(--bg-card);
    border-color: var(--border-gold);
}

.profile-item .avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #22222a;
    border: 1px solid var(--border-gold);
    color: var(--text-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.82rem;
    flex-shrink: 0;
}

.profile-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.profile-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
}
.profile-item.active .profile-name {
    color: var(--text-gold);
}
.profile-date {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.chat-item {
    padding: 8px 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.15s;
}
.chat-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-white);
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-dark-grey);
}
.footer-account-info {
    display: flex;
    align-items: center;
    gap: 8px;
}
.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
}
.account-status-text {
    font-size: 0.76rem;
    color: var(--text-muted);
}

/* ─── 2. 中间聊天区 ─────────────────────────────────────────────────────── */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-black);
    position: relative;
}

.chat-header {
    height: 56px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-dark-grey);
    z-index: 40;
}

.current-profile-wrapper {
    position: relative;
}

.current-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    transition: all 0.2s;
}
.current-profile:hover {
    border-color: var(--border-gold);
}

.avatar-sm {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--gold-dark);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.78rem;
}

.profile-meta {
    display: flex;
    flex-direction: column;
}
.profile-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.current-profile .name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-white);
}
.daymaster-pill {
    font-size: 0.68rem;
    padding: 1px 6px;
    background: rgba(211, 168, 94, 0.15);
    border: 1px solid var(--border-gold);
    color: var(--text-gold);
    border-radius: 3px;
}
.current-profile .date {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.current-profile .arrow {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.profile-dropdown {
    position: absolute;
    top: 46px;
    left: 0;
    min-width: 240px;
    background: #141418;
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    padding: 6px;
    z-index: 100;
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-primary);
}
.dropdown-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-gold);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
}
.chat-content::-webkit-scrollbar {
    width: 5px;
}
.chat-content::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
}

/* 太极动画与等待视图 */
.waiting-state {
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-width: 540px;
}

.taiji-container {
    width: 170px;
    height: 170px;
    margin-bottom: 20px;
}

.taiji-svg {
    width: 100%;
    height: 100%;
}

.zodiac-ring {
    transform-origin: 120px 120px;
    animation: rotateZodiac 25s linear infinite;
}

.zodiac {
    font-family: 'Noto Serif SC', serif;
    font-size: 14px;
    font-weight: 700;
    fill: var(--text-gold);
    text-anchor: middle;
    dominant-baseline: central;
}

.taiji-core {
    transform-origin: 120px 120px;
    animation: rotateCore 18s linear infinite reverse;
}

@keyframes rotateZodiac {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
@keyframes rotateCore {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.welcome-text h2 {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.35rem;
    color: var(--text-white);
    margin-bottom: 8px;
}
.welcome-text .subtitle {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.action-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}
.chip {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.chip:hover {
    border-color: var(--border-gold);
    color: var(--text-gold);
    background: rgba(211, 168, 94, 0.1);
}

/* 消息与推演列表 */
.message-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.chat-message-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
}
.user-message-row {
    justify-content: flex-end;
}
.assistant-message-row {
    justify-content: flex-start;
}
.chat-message-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    margin-top: 2px;
    border-radius: 50%;
    font-size: 19px;
    line-height: 1;
    user-select: none;
}
.assistant-avatar {
    color: var(--gold-light);
    border: 1px solid var(--border-gold-bright);
    background: radial-gradient(circle at 35% 30%, #29231a, #0f0f12 72%);
    box-shadow: 0 0 14px rgba(211, 168, 94, 0.16);
}
.user-avatar {
    position: relative;
    overflow: hidden;
    border: 1px solid hsl(var(--avatar-hue) 70% 65% / 0.65);
    background:
        radial-gradient(circle at 30% 30%, hsl(var(--avatar-hue) 85% 80% / 0.9) 0 10%, transparent 11%),
        conic-gradient(from 40deg, hsl(var(--avatar-hue) 70% 54%), hsl(calc(var(--avatar-hue) + 80) 68% 44%), hsl(calc(var(--avatar-hue) + 180) 70% 38%), hsl(var(--avatar-hue) 70% 54%));
}
.user-avatar::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255,255,255,0.82);
    border-radius: 50%;
    box-shadow: 7px -8px 0 -3px rgba(255,255,255,0.72);
}

.msg-user {
    align-self: flex-end;
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    color: var(--text-white);
    padding: 12px 16px;
    border-radius: 14px 14px 2px 14px;
    max-width: 80%;
    font-size: 0.9rem;
    line-height: 1.6;
}

.msg-agent {
    align-self: flex-start;
    flex: 1;
    min-width: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.agent-msg-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-gold);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}

.agent-steps-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.agent-step-card {
    background: var(--bg-black);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.agent-step-card.running {
    border-color: var(--border-gold);
}

.agent-step-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
}
.agent-step-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}
.agent-step-status {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}
.agent-step-status.running {
    background: rgba(211, 168, 94, 0.2);
    color: var(--text-gold);
}
.agent-step-status.done {
    background: rgba(76, 175, 80, 0.15);
    color: #81c784;
}

.agent-step-thinking {
    padding: 8px 12px 10px;
    font-size: 0.76rem;
    color: var(--text-secondary);
    border-top: 1px dashed var(--border-subtle);
    line-height: 1.5;
}

.conclusion-card {
    background: rgba(211, 168, 94, 0.08);
    border-left: 3px solid var(--gold);
    padding: 12px 16px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-white);
}

/* 输入栏 */
.chat-input-area {
    padding: 12px 20px 20px;
    max-width: 820px;
    margin: 0 auto;
    width: 100%;
}

.mode-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.mode-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.mode-pill {
    font-size: 0.76rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s;
}
.mode-pill.active {
    background: rgba(211, 168, 94, 0.15);
    border-color: var(--border-gold);
    color: var(--text-gold);
}
.mode-pill input {
    display: none;
}

.input-box-card {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 10px 14px;
    transition: border-color 0.2s;
}
.input-box-card:focus-within {
    border-color: var(--border-gold);
}

.input-tools {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}
.tool-chip {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.74rem;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.tool-chip:hover {
    color: var(--text-gold);
    border-color: var(--border-gold);
}

.input-field-group {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

#chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-white);
    font-size: 0.9rem;
    line-height: 1.5;
    resize: none;
    max-height: 120px;
    font-family: inherit;
}

.send-btn {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    color: var(--text-gold);
    font-size: 0.84rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}
.send-btn:hover {
    background: var(--gold);
    color: #000;
}

/* ─── 3. 右侧命盘面板 (桌面固定 420px 宽度) ────────────────────────────── */
.sidebar-right {
    width: 420px;
    min-width: 420px;
    background: var(--bg-dark-grey);
    border-left: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 50;
}

.panel-header {
    height: 52px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
}

.tabs {
    display: flex;
    width: 100%;
}

.tab {
    flex: 1;
    padding: 14px 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}
.tab:hover {
    color: var(--text-secondary);
}
.tab.active {
    color: var(--text-gold);
    border-bottom-color: var(--gold);
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
}
.panel-content::-webkit-scrollbar {
    width: 4px;
}
.panel-content::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
}

.tab-pane {
    display: none;
}
.tab-pane.active {
    display: block;
}

/* 紫微斗数 12 宫 Grid 布局 (参考 tianfu-ai 官方四排三列) */
.ziwei-panel-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ziwei-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}
.ziwei-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.ziwei-12-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.zw-cell {
    background: #141418;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 8px 6px;
    min-height: 96px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}
.zw-cell.original-cell {
    border-color: var(--border-gold);
}

.zw-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.zw-stars-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.zw-star-item {
    font-size: 0.76rem;
    font-weight: 700;
    color: #ffffff;
}
.zw-star-item.major-star {
    color: var(--text-gold);
}
.zw-star-item.mutagen-star {
    color: #ef5350;
}

.zw-branch-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.zw-bottom-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-top: 1px solid rgba(255,255,255,0.04);
    padding-top: 4px;
    margin-top: 4px;
}
.zw-stage-range {
    font-size: 0.65rem;
    color: var(--text-muted);
}
.zw-palace-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-white);
}

/* 八字卡片 */
.bazi-card, .wuxing-card, .qimen-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 12px;
}

.bazi-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.card-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-gold);
}
.daymaster-tag {
    font-size: 0.72rem;
    color: var(--text-gold);
    background: rgba(211, 168, 94, 0.15);
    padding: 2px 8px;
    border-radius: 3px;
}

.bazi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.bazi-col {
    text-align: center;
    background: var(--bg-black);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 8px 4px;
}
.bazi-col.day-col {
    border-color: var(--border-gold);
}

.col-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.pillar-box {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-white);
}
.ten-god {
    font-size: 0.68rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* 五行条形图 */
.wuxing-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.78rem;
}
.wuxing-label {
    width: 18px;
    font-weight: 700;
}
.wuxing-bar-container {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}
.wuxing-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}
.wuxing-count {
    width: 28px;
    text-align: right;
    color: var(--text-secondary);
    font-size: 0.72rem;
}

/* 分析报告 Tab */
.report-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.btn-action {
    flex: 1;
    padding: 8px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
.primary-action {
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    color: var(--text-gold);
}
.secondary-action {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.markdown-body {
    font-size: 0.88rem;
    line-height: 1.75;
    color: var(--text-primary);
}
.markdown-body h2, .markdown-body h3 {
    color: var(--text-gold);
    margin-top: 14px;
    margin-bottom: 8px;
    font-family: 'Noto Serif SC', serif;
}
.markdown-body p {
    margin-bottom: 12px;
}

.placeholder-text {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
    padding: 24px 0;
}

.floating-panel-btn {
    position: fixed;
    right: 16px;
    top: 64px;
    background: var(--bg-card);
    color: var(--text-gold);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-full);
    padding: 6px 14px;
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    z-index: 60;
}

/* ─── 4. 模态弹窗 ───────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal {
    background: #141418;
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 420px;
    overflow: hidden;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-title {
    font-family: 'Noto Serif SC', serif;
    color: var(--text-white);
    font-size: 1rem;
}
.modal-close {
    background: none; border: none;
    color: var(--text-muted); font-size: 1.1rem; cursor: pointer;
}

.modal-body {
    padding: 20px;
}
.auth-description {
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.6;
    margin-bottom: 16px;
}
.auth-wallet-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.auth-wallet-address {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-gold);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.76rem;
}
.auth-message {
    min-height: 1.4em;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.5;
}
.form-group {
    margin-bottom: 14px;
}
.form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.input-text, .input-select, .input-date, .input-time {
    width: 100%;
    background: var(--bg-black);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text-white);
    font-size: 0.88rem;
    outline: none;
}
.input-text:focus, .input-select:focus, .input-date:focus, .input-time:focus {
    border-color: var(--border-gold);
}

.datetime-inputs {
    display: flex;
    gap: 10px;
}

.pill-group {
    display: flex;
    gap: 8px;
}
.pill {
    flex: 1;
    padding: 6px;
    background: var(--bg-black);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
}
.pill.active {
    background: rgba(211, 168, 94, 0.15);
    border-color: var(--border-gold);
    color: var(--text-gold);
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.btn {
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
}
.btn.secondary {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}
.btn.primary {
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    color: var(--text-gold);
}

/* ─── 5. 响应式布局 Media Queries ───────────────────────────────────────── */
@media (max-width: 1023px) {
    .sidebar-right {
        position: fixed;
        right: 0; top: 0; bottom: 0;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .sidebar-right.open {
        transform: translateX(0);
    }
}

@media (max-width: 767px) {
    .mobile-header {
        display: flex;
    }
    .app-container {
        height: calc(100vh - 52px);
    }
    .sidebar-left {
        position: fixed;
        left: 0; top: 52px; bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .sidebar-left.open {
        transform: translateX(0);
    }
    .sidebar-right {
        top: 52px;
    }
    .header-actions {
        display: none;
    }
}

/* ─── 6. 打印与 PDF 导出 Print Styles ─────────────────────────────────────── */
@media print {
    .mobile-header,
    .sidebar-left,
    .chat-area,
    .panel-header,
    .panel-tabs,
    .tab-pane:not(#tab-report),
    .floating-panel-btn,
    .report-actions {
        display: none !important;
    }

    body, .app-container, .sidebar-right {
        background: #ffffff !important;
        color: #000000 !important;
        height: auto !important;
        overflow: visible !important;
        position: static !important;
        width: 100% !important;
    }

    .sidebar-right {
        border: none !important;
        padding: 20px !important;
    }

    #tab-report {
        display: block !important;
        padding: 0 !important;
        color: #000000 !important;
    }

    .report-content {
        color: #111111 !important;
        font-size: 13pt !important;
        line-height: 1.6 !important;
    }

    .report-content h2,
    .report-content h3 {
        color: #000000 !important;
        border-bottom: 1px solid #ccc !important;
        padding-bottom: 4px !important;
        margin-top: 16px !important;
        page-break-after: avoid;
    }
}

/* ─── 折叠侧边栏 (Collapsible Sidebars) ────────────────────────────────────── */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar-toggle-btn {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
}
.sidebar-left.collapsed {
    width: 64px !important;
    min-width: 64px !important;
}
.sidebar-left.collapsed .logo-title,
.sidebar-left.collapsed .btn-text,
.sidebar-left.collapsed .sidebar-scroll-area,
.sidebar-left.collapsed .sidebar-footer {
    display: none !important;
}
.sidebar-left.collapsed .sidebar-header {
    justify-content: center;
}
.sidebar-right.collapsed {
    display: none !important;
}

/* ─── 三大结构盘通用黑金硬核样式 (Deterministic Calculated Visuals) ───────────── */
.det-sub-header {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: #997328;
    margin-bottom: 4px;
    font-family: 'Outfit', sans-serif;
}
.det-main-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 8px;
}
.det-notice-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.det-bottom-link {
    margin-top: 16px;
    font-size: 0.78rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}
.det-bottom-link:hover {
    color: var(--text-gold);
}

/* ─── 1. 基础四柱 (Image 1 Specs) ────────────────────────────────────────── */
.bazi-det-card {
    background: #101216;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px;
}

.bazi-4pillars-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.pillar-col-card {
    background: #16181d;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 8px 4px;
    text-align: center;
}

.pillar-col-card .pillar-header-title {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.04);
    padding: 2px 0;
    border-radius: 4px;
    margin-bottom: 6px;
}

.pillar-col-card .ten-god-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #e8c87a;
    margin-bottom: 6px;
}

.pillar-col-card .stem-box,
.pillar-col-card .branch-box {
    margin: 4px 0;
}

.pillar-col-card .char-main {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
    color: var(--text-white);
}

.pillar-col-card .element-tag {
    display: inline-block;
    font-size: 0.65rem;
    padding: 1px 5px;
    border-radius: 4px;
    margin-top: 2px;
}
.element-tag.wood { background: rgba(76, 175, 80, 0.15); color: #4caf50; }
.element-tag.fire { background: rgba(239, 83, 80, 0.15); color: #ef5350; }
.element-tag.earth { background: rgba(211, 168, 94, 0.15); color: #d3a85e; }
.element-tag.metal { background: rgba(207, 216, 220, 0.15); color: #cfd8dc; }
.element-tag.water { background: rgba(66, 165, 245, 0.15); color: #42a5f5; }

.hidden-stems-box {
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
    margin-top: 6px;
    padding-top: 4px;
    font-size: 0.68rem;
    color: var(--text-muted);
}
.hidden-stems-box .hs-row {
    margin-top: 2px;
}
.hidden-stems-box .hs-title {
    font-size: 0.62rem;
    color: #666;
    display: block;
}

.bazi-legend-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 10px 0 14px 0;
    font-size: 0.7rem;
    color: var(--text-muted);
}
.bazi-legend-row .dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 4px;
}
.legend-same { background: #e8c87a; }
.legend-gen { background: #4caf50; }
.legend-ke { background: #ef5350; }

.daymaster-card-box {
    background: #14161b;
    border-left: 3px solid #ef5350;
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
}
.dm-sub-label {
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}
.dm-val-text {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-white);
    margin-top: 2px;
}

.wuxing-bars-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.wuxing-bar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.78rem;
}
.wuxing-bar-item .w-label {
    width: 18px;
    color: var(--text-secondary);
}
.wuxing-bar-item .w-track {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}
.wuxing-bar-item .w-fill {
    height: 100%;
    border-radius: 3px;
}
.wuxing-bar-item .w-num {
    width: 18px;
    text-align: right;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.bazi-check-footer {
    background: #14161a;
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
}
.bazi-check-footer .check-title {
    color: var(--text-secondary);
    font-weight: 600;
}
.bazi-check-footer .check-tag {
    background: rgba(76, 175, 80, 0.1);
    color: #4caf50;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    border: 1px solid rgba(76, 175, 80, 0.2);
}
.bazi-check-footer .check-arrow {
    color: var(--text-muted);
    font-size: 0.65rem;
}

/* ─── 2. 紫微斗数 (Image 2 Specs) ────────────────────────────────────────── */
.ziwei-meta-pills, .qimen-meta-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.pill-tag {
    background: #16181d;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 12px;
}

.ziwei-12-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.zw-cell {
    background: #121418;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 8px;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.zw-cell.original-cell {
    border-color: #d3a85e;
    box-shadow: inset 0 0 10px rgba(211, 168, 94, 0.1);
}
.zw-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.zw-stars-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.zw-star-item {
    font-size: 0.72rem;
    color: var(--text-secondary);
}
.zw-star-item.major-star {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-white);
}
.zw-branch-label {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.85rem;
    color: #e8c87a;
    font-weight: 700;
}
.zw-bottom-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    font-size: 0.68rem;
    color: var(--text-muted);
}
.zw-palace-name {
    font-family: 'Noto Serif SC', serif;
    font-weight: 700;
    color: var(--text-primary);
}

/* ─── 3. 时家奇门 (Image 3 Specs) ────────────────────────────────────────── */
.qimen-9-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
.qm-cell {
    background: #121418;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 8px;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.qm-cell.highlight-cell {
    border-color: #d3a85e;
}
.qm-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.qm-name {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-white);
}
.qm-dir {
    font-size: 0.7rem;
    color: #e8c87a;
}
.qm-stems-line {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 2px;
}
.qm-elements-line {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.qm-tag-badge {
    display: inline-block;
    font-size: 0.62rem;
    color: #ef5350;
    background: rgba(239, 83, 80, 0.1);
    padding: 1px 4px;
    border-radius: 3px;
    margin-top: 2px;
}

/* Profile Kebab (3-dots) Menu & Context Dropdown */
.profile-item {
    position: relative;
}
.profile-kebab-btn {
    margin-left: auto;
    background: transparent;
    border: none;
    color: var(--text-muted, #888);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    line-height: 1;
}
.profile-kebab-btn:hover {
    color: var(--text-gold, #e2b714);
    background: rgba(255, 255, 255, 0.1);
}
.profile-menu-dropdown {
    position: absolute;
    right: 8px;
    top: 34px;
    background: #1e2026;
    border: 1px solid rgba(226, 183, 20, 0.3);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    z-index: 999;
    display: none;
    flex-direction: column;
    min-width: 90px;
    overflow: hidden;
}
.profile-menu-dropdown.show {
    display: flex;
}
.profile-menu-item {
    padding: 6px 12px;
    font-size: 0.8rem;
    color: var(--text-primary, #ddd);
    cursor: pointer;
    transition: background 0.15s;
}
.profile-menu-item:hover {
    background: rgba(226, 183, 20, 0.15);
    color: #e2b714;
}
.profile-menu-item.danger:hover {
    background: rgba(244, 67, 54, 0.15);
    color: #f44336;
}

/* Chat list items */
.chat-item-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: var(--radius-md, 6px);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: 4px;
}
.chat-item-wrapper:hover {
    background: var(--bg-card-hover, rgba(255, 255, 255, 0.08));
    border-color: rgba(226, 183, 20, 0.2);
}
.chat-item-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
    margin-right: 8px;
}
.chat-item-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary, #eee);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-item-sub {
    font-size: 0.72rem;
    color: var(--text-muted, #888);
}
.chat-item-star {
    background: transparent;
    border: none;
    color: #888;
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 4px;
    transition: color 0.15s;
}
.chat-item-star.active, .chat-item-star:hover {
    color: #ffca28;
}

/* 服务端 6-Stage 推演与报告证据入口 */
.pipeline-stage-list {
    display: grid;
    gap: 6px;
    margin-bottom: 12px;
}
.pipeline-stage {
    display: block;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.76rem;
    overflow: hidden;
}
.pipeline-stage.running { border-color: var(--border-gold); color: var(--text-gold); }
.pipeline-stage.done { border-color: rgba(76, 175, 80, 0.35); color: var(--text-primary); }
.pipeline-stage-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    list-style: none;
}
.pipeline-stage-summary::-webkit-details-marker { display: none; }
.pipeline-stage-summary::after {
    content: '⌄';
    color: var(--text-muted);
    font-size: 16px;
    transition: transform 0.2s ease;
}
.pipeline-stage[open] .pipeline-stage-summary::after { transform: rotate(180deg); }
.pipeline-stage-title {
    min-width: 0;
    font-weight: 600;
    color: var(--text-primary);
}
.pipeline-stage-state {
    color: var(--text-muted);
    white-space: nowrap;
}
.pipeline-stage.running .pipeline-stage-state::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 7px;
    border: 2px solid rgba(212, 168, 94, 0.3);
    border-top-color: var(--text-gold);
    border-radius: 50%;
    vertical-align: -2px;
    animation: pipeline-spin 0.8s linear infinite;
}
.pipeline-stage-detail {
    padding: 0 12px 10px;
    border-top: 1px dashed var(--border-subtle);
    color: var(--text-secondary);
    line-height: 1.55;
}
.pipeline-detail-item {
    margin: 8px 0 0;
    font-size: 0.76rem;
}
@keyframes pipeline-spin {
    to { transform: rotate(360deg); }
}
.report-chart-evidence {
    display: block;
    width: calc(100% - 24px);
    margin: 0 12px 10px;
    padding: 8px 10px;
    background: rgba(211, 168, 94, 0.08);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-sm);
    color: var(--text-gold);
    font-size: 0.76rem;
    text-align: left;
    cursor: pointer;
}
.report-chart-evidence:hover { border-color: var(--border-gold-bright); }
