/* ============================================================
   家务AI管家 v5.0 — Multi-Agent 中控台设计系统
   8pt栅格 | 三色低饱和 | WCAG 2.1 | 轻量化极简商务
   ============================================================ */

/* ====== Design Tokens ====== */
:root {
    /* 8pt Grid Base */
    --grid: 8px;
    --space-xs: 4px; --space-sm: 8px; --space-md: 16px; --space-lg: 24px;
    --space-xl: 32px; --space-2xl: 48px; --space-3xl: 64px;

    /* 三色低饱和主色调 */
    --primary:        #5B6ABF;  /* 沉稳靛蓝 */
    --primary-light:  #EBEDF7;
    --primary-dark:   #454FA3;
    --secondary:      #8795A8;  /* 钢蓝灰 */
    --accent:         #4A9E8E;  /* 哑光青绿 */

    /* 语义色 */
    --success: #52A879; --success-light: #EDF6F1;
    --warning: #D4A24E; --warning-light: #FBF5EB;
    --danger:  #C45C5C; --danger-light:  #FBEEEE;
    --info:    #5B8FBF; --info-light:    #ECF2F8;

    /* 6个子Agent品牌色 */
    --shopping:     #D4954A; --shopping-light:     #FBF3E9;
    --meal:         #52A879; --meal-light:         #EDF6F1;
    --appliance:    #5B7FBF; --appliance-light:    #ECF2F8;
    --maintenance:  #C47A5C; --maintenance-light:  #FBF0EB;
    --security:     #7B6BBF; --security-light:     #F1EEF8;
    --household:    #4A9E8E; --household-light:    #EAF5F2;

    /* 表面色 */
    --bg:           #F2F4F7;
    --surface:      #FFFFFF;
    --surface-alt:  #F8F9FB;
    --border:       #E2E5EB;
    --border-light: #EEF0F4;
    --divider:      #F0F1F5;

    /* 文字色 (WCAG 2.1 AA/AAA) */
    --text-primary:    #1E2332;  /* contrast 15.2:1 on #FFF */
    --text-secondary:  #5A6380;  /* contrast 5.6:1 on #FFF */
    --text-tertiary:   #8F97B0;  /* contrast 3.2:1 on #FFF */
    --text-inverse:    #FFFFFF;

    /* 圆角统一8px */
    --radius-sm: 6px;
    --radius:    8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 999px;

    /* 微阴影 */
    --shadow-xs:  0 1px 2px rgba(0,0,0,.03);
    --shadow-sm:  0 1px 4px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.03);
    --shadow-md:  0 4px 12px rgba(0,0,0,.05), 0 1px 3px rgba(0,0,0,.03);
    --shadow-lg:  0 8px 24px rgba(0,0,0,.06), 0 2px 6px rgba(0,0,0,.03);
    --shadow-xl:  0 16px 48px rgba(0,0,0,.08);

    /* 动效 */
    --ease:       cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 250ms var(--ease);
    --transition-fast: 150ms var(--ease);

    /* 文字层级 */
    --fs-h1: 24px; --lh-h1: 32px; --fw-h1: 700;
    --fs-h2: 18px; --lh-h2: 26px; --fw-h2: 600;
    --fs-h3: 15px; --lh-h3: 22px; --fw-h3: 600;
    --fs-body: 14px; --lh-body: 20px; --fw-body: 400;
    --fs-sm: 12px; --lh-sm: 16px; --fw-sm: 400;
    --fs-xs: 11px; --lh-xs: 14px;

    /* 布局尺寸 */
    --topbar-h: 56px;
    --sidebar-w: 264px;
    --auxbar-w: 288px;
    --input-h: 56px;
    --kb-h: 48px;
}

/* ====== Reset ====== */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    background: var(--bg); color: var(--text-primary);
    height: 100vh; line-height: var(--lh-body);
    overflow: hidden;
    display: flex; flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: var(--fs-body); outline: none; }
ul, ol { list-style: none; }

/* ====== Scrollbar ====== */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; margin: 4px 0; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; min-height: 30px; }
::-webkit-scrollbar-thumb:hover { background: var(--secondary); }

/* ====== Typography ====== */
.h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); font-weight: var(--fw-h1); }
.h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: var(--fw-h2); }
.h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); font-weight: var(--fw-h3); }
.text-body { font-size: var(--fs-body); line-height: var(--lh-body); }
.text-sm { font-size: var(--fs-sm); line-height: var(--lh-sm); }
.text-xs { font-size: var(--fs-xs); line-height: var(--lh-xs); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }

/* ========================================================================
   TOP BAR — 全局导航栏 (56px)
   ======================================================================== */
.topbar {
    height: var(--topbar-h); background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: var(--space-lg);
    padding: 0 var(--space-lg); position: sticky; top: 0; z-index: 200;
    box-shadow: var(--shadow-xs);
}
.topbar .logo {
    font-size: var(--fs-h3); font-weight: 700; white-space: nowrap;
    display: flex; align-items: center; gap: var(--space-sm);
}
.topbar .logo-avatar {
    width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
    flex-shrink: 0;
    animation: avatar-fade-in 1.2s ease-out;
}
.logo-task-badge {
    position: absolute; top: -6px; right: -6px;
    min-width: 22px; height: 22px; padding: 0 6px;
    border-radius: 11px; background: #ef4444; color: #fff;
    font-size: 12px; font-weight: 700; line-height: 22px;
    text-align: center; white-space: nowrap;
    box-shadow: 0 2px 6px rgba(239,68,68,.4);
    animation: avatar-fade-in 0.3s ease-out;
}
.topbar .version-tag {
    font-size: 10px; padding: 2px 8px; border-radius: var(--radius-full);
    background: var(--primary-light); color: var(--primary); font-weight: 600;
}


/* Nav Links */
.topbar .nav-links { display: flex; gap: var(--space-xs); }
.topbar .nav-link {
    padding: 6px 14px; border-radius: var(--radius);
    font-size: var(--fs-sm); font-weight: 500; color: var(--text-secondary);
    transition: all var(--transition); white-space: nowrap;
    display: flex; align-items: center; gap: 5px;
}
.topbar .nav-link:hover { background: var(--surface-alt); color: var(--text-primary); }
.topbar .nav-link.active { background: var(--primary); color: var(--text-inverse); font-weight: 600; }

/* Topbar Right */
.topbar .nav-right { display: flex; align-items: center; gap: var(--space-sm); margin-left: auto; }

.topbar .topbar-btn {
    padding: 6px 14px; border-radius: var(--radius); font-size: var(--fs-sm);
    font-weight: 500; display: flex; align-items: center; gap: 5px;
    transition: all .15s; white-space: nowrap; cursor: pointer;
    color: var(--text-secondary); background: var(--surface);
    border: 1px solid var(--border); line-height: 1.4;
}
.topbar .topbar-btn:hover {
    background: linear-gradient(135deg, #f0f4ff, #e8edf8);
    border-color: var(--primary); color: var(--primary);
}
.topbar .topbar-btn:active { transform: scale(.96); }
.topbar .topbar-btn.primary {
    background: linear-gradient(135deg, #6366f1, #5558e6);
    color: #fff; border-color: transparent;
}
.topbar .topbar-btn.primary:hover {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
}

/* Status Bar */
.status-bar {
    display: flex; gap: var(--space-lg); justify-content: center;
    padding: 6px 0; background: var(--surface); border-bottom: 1px solid var(--border-light);
    font-size: 12px; color: var(--text-secondary);
}
.status-bar .stat-item {
    display: flex; align-items: center; gap: 5px; cursor: default;
    padding: 2px 10px; border-radius: var(--radius); transition: background .15s;
}
.status-bar .stat-item.clickable { cursor: pointer; }
.status-bar .stat-item.clickable:hover { background: var(--primary-light); }
.status-bar .stat-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status-bar .stat-dot.green { background: #22c55e; }
.status-bar .stat-dot.orange { background: #f59e0b; }

/* Member Switch */
.member-switch {
    position: relative; display: flex; align-items: center; gap: 6px;
    padding: 5px 12px; border-radius: var(--radius-full); cursor: pointer;
    background: var(--surface-alt); border: 1px solid var(--border);
    transition: all var(--transition); font-size: var(--fs-sm);
}
.member-switch:hover { border-color: var(--secondary); }
.member-switch .member-avatar {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--primary-light); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}

/* Compute Status */
.compute-badge {
    display: flex; align-items: center; gap: 5px; padding: 4px 10px;
    border-radius: var(--radius-full); font-size: var(--fs-xs); font-weight: 500;
    background: var(--success-light); color: var(--success);
}
.compute-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.compute-badge .dot.busy { background: var(--warning); animation: pulse-dot 1.5s infinite; }
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:.35} }

/* Privacy Toggle */
.privacy-toggle {
    display: flex; align-items: center; gap: 5px; padding: 5px 10px;
    border-radius: var(--radius-full); font-size: var(--fs-xs); font-weight: 500;
    cursor: pointer; transition: all var(--transition);
    background: var(--success-light); color: var(--success);
}
.privacy-toggle.off { background: var(--surface-alt); color: var(--text-tertiary); }

/* ========================================================================
   MAIN LAYOUT — 三栏
   ======================================================================== */
.main-layout {
    display: flex; flex: 1;
    min-height: 0; /* CRITICAL: allow flex children to shrink for scroll */
    overflow: hidden;
}

/* ========================================================================
   LEFT SIDEBAR — Agent侧边栏 (264px)
   ======================================================================== */
.sidebar {
    width: var(--sidebar-w); flex-shrink: 0;
    display: flex; flex-direction: column; gap: var(--space-xs);
    padding: var(--space-md);
    overflow-y: auto; overflow-x: hidden;
    background: var(--surface); border-right: 1px solid var(--border);
}

/* Agent Card */
.agent-card {
    display: flex; align-items: center; gap: var(--space-md);
    padding: var(--space-sm) var(--space-md); border-radius: var(--radius);
    cursor: pointer; transition: all var(--transition);
    position: relative; border: 1.5px solid transparent;
    min-height: 56px;
}
.agent-card:hover {
    background: var(--surface-alt); transform: translateX(2px);
}
.agent-card.active {
    border-color: var(--primary); background: var(--primary-light);
}
.agent-card .agent-icon {
    width: 40px; height: 40px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
    background: var(--surface-alt); transition: all var(--transition);
}
.agent-card.active .agent-icon { transform: scale(1.05); }
.agent-card .agent-info { flex: 1; min-width: 0; }
.agent-card .agent-name { font-size: var(--fs-body); font-weight: 600; color: var(--text-primary); }
.agent-card .agent-desc { font-size: var(--fs-xs); color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-card .agent-badge {
    width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 10px; background: var(--primary); color: #fff; opacity: 0; transition: opacity var(--transition);
}
.agent-card.active .agent-badge { opacity: 1; }

/* Agent color accents on icon */
.agent-card[data-agent="shopping"] .agent-icon { color: var(--shopping); }
.agent-card[data-agent="meal"] .agent-icon { color: var(--meal); }
.agent-card[data-agent="appliance"] .agent-icon { color: var(--appliance); }
.agent-card[data-agent="maintenance"] .agent-icon { color: var(--maintenance); }
.agent-card[data-agent="security"] .agent-icon { color: var(--security); }
.agent-card[data-agent="household"] .agent-icon { color: var(--household); }
.agent-card.active[data-agent="shopping"] .agent-icon { background: var(--shopping-light); }
.agent-card.active[data-agent="meal"] .agent-icon { background: var(--meal-light); }
.agent-card.active[data-agent="appliance"] .agent-icon { background: var(--appliance-light); }
.agent-card.active[data-agent="maintenance"] .agent-icon { background: var(--maintenance-light); }
.agent-card.active[data-agent="security"] .agent-icon { background: var(--security-light); }
.agent-card.active[data-agent="household"] .agent-icon { background: var(--household-light); }

/* Sidebar Divider */
.sidebar-divider {
    height: 1px; background: var(--divider); margin: var(--space-xs) 0;
}

/* ========================================================================
   CENTER PANEL — 驾驶舱面板
   ======================================================================== */
.chat-panel {
    flex: 1; display: flex; flex-direction: column;
    min-width: 0; min-height: 0;
    background: var(--bg);
}

/* Panel Header */
.panel-header {
    padding: var(--space-sm) var(--space-lg); display: flex; align-items: center;
    justify-content: space-between; background: var(--surface);
    border-bottom: 1px solid var(--border-light); min-height: 48px;
}
.panel-header .panel-title { font-size: var(--fs-h3); font-weight: 600; display: flex; align-items: center; gap: var(--space-sm); }
.panel-header .panel-title .icon { font-size: 20px; }
.panel-header .panel-actions { display: flex; gap: var(--space-sm); }
.panel-status { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-tertiary); }
.panel-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.panel-status .dot.thinking { background: var(--warning); animation: pulse-dot 1.5s infinite; }

/* Quick Chips Bar */
.quick-chips {
    padding: var(--space-sm) var(--space-lg);
    display: flex; gap: var(--space-lg); overflow-x: auto;
    background: var(--surface); border-bottom: 1px solid var(--border-light);
    max-width: 900px; margin: 0 auto; width: 100%; box-sizing: border-box;
    justify-content: flex-start;
}
.chip-group {
    display: flex; align-items: center; gap: var(--space-sm); flex-shrink: 0;
}
.chip-group-label {
    font-size: 10px; font-weight: 600; padding: 3px 10px;
    border-radius: var(--radius-full); white-space: nowrap;
    background: #f3f4f6; color: var(--text-tertiary);
}
.quick-chips .chip {
    padding: 6px 14px; border-radius: var(--radius-full);
    font-size: var(--fs-sm); font-weight: 500; cursor: pointer;
    transition: all .15s; white-space: nowrap;
    background: var(--surface-alt); color: var(--text-secondary);
    border: 1px solid transparent;
}
.quick-chips .chip:hover {
    background: var(--primary-light); color: var(--primary);
    border-color: var(--primary); transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(99,102,241,.12);
}

/* Messages Area — scrollbar at page edge, content centered */
.messages {
    flex: 1; min-height: 0;
    overflow-y: auto; overflow-x: hidden;
    padding: var(--space-lg) 0;
}
.messages-inner {
    max-width: 900px; margin: 0 auto;
    padding: 0 var(--space-lg);
    display: flex; flex-direction: column; gap: var(--space-md);
}
.messages .welcome-card {
    text-align: center; padding: var(--space-2xl) var(--space-lg); margin: auto;
    color: var(--text-tertiary); max-width: 420px;
}
.messages .welcome-icon {
    margin-bottom: var(--space-lg); display: inline-block;
    position: relative; cursor: pointer;
    animation: avatar-fade-in 1.2s ease-out;
}
.messages .welcome-avatar {
    width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
    animation: icon-breathe 3s ease-in-out infinite;
}
@keyframes icon-breathe {
    0%, 100% { transform: scale(1); opacity: .85; }
    50% { transform: scale(1.06); opacity: 1; }
}
.messages .welcome-card .h2 {
    color: var(--text-primary); margin-bottom: var(--space-sm);
    font-size: 22px; font-weight: 700;
}
.messages .welcome-card .welcome-desc {
    font-size: 13px; color: var(--text-secondary); margin-bottom: var(--space-lg);
}
.messages .welcome-action {
    margin-top: var(--space-sm); font-size: 12px; cursor: pointer;
    background: var(--surface-alt); color: var(--primary);
    border: 1px solid var(--primary); padding: 8px 20px;
    border-radius: var(--radius); transition: all .15s;
}
.messages .welcome-action:hover {
    background: var(--primary); color: #fff;
}

/* Data Cards (in messages area) */
.data-cards { display: grid; gap: var(--space-md); margin-bottom: var(--space-md); }
.data-cards.cols-2 { grid-template-columns: 1fr 1fr; }
.data-cards.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.data-card {
    background: var(--surface); border-radius: var(--radius);
    padding: var(--space-md); box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light); transition: all var(--transition);
}
.data-card:hover { box-shadow: var(--shadow-md); }
.data-card .card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--space-sm);
}
.data-card .card-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary); }
.data-card .card-badge {
    font-size: var(--fs-xs); padding: 2px 8px; border-radius: var(--radius-full);
    font-weight: 500;
}

/* Fridge Inventory Visualization */
.fridge-viz { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.fridge-item {
    display: flex; align-items: center; gap: 6px; padding: 6px 10px;
    border-radius: var(--radius); font-size: var(--fs-sm); background: var(--surface-alt);
    border: 1px solid var(--border-light); transition: all var(--transition);
}
.fridge-item.expiring { border-color: var(--warning); background: var(--warning-light); animation: breathe 2s ease-in-out infinite; }
.fridge-item.expired { border-color: var(--danger); background: var(--danger-light); }
.fridge-item .fi-emoji { font-size: 16px; }
.fridge-item .fi-days { font-size: var(--fs-xs); color: var(--text-tertiary); }

@keyframes breathe {
    0%, 100% { box-shadow: 0 0 0 0 rgba(212,162,78,.3); }
    50% { box-shadow: 0 0 0 4px rgba(212,162,78,0); }
}

/* Shopping Compare List */
.compare-list { display: flex; flex-direction: column; gap: var(--space-xs); }
.compare-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 10px; border-radius: var(--radius-sm); font-size: var(--fs-sm);
    background: var(--surface-alt);
}
.compare-item .best-price { color: var(--success); font-weight: 600; }

/* AI Trace Log */
.trace-log { display: flex; flex-direction: column; gap: var(--space-xs); max-height: 200px; overflow-y: auto; }
.trace-item {
    display: flex; align-items: flex-start; gap: var(--space-sm); padding: 6px 10px;
    border-radius: var(--radius-sm); font-size: var(--fs-xs); background: var(--surface-alt);
    border-left: 3px solid var(--border);
}
.trace-item.tool { border-left-color: var(--info); }
.trace-item.reasoning { border-left-color: var(--accent); }
.trace-item .trace-step { color: var(--text-tertiary); white-space: nowrap; flex-shrink: 0; }
.trace-item .trace-content { color: var(--text-secondary); word-break: break-word; }

/* Message Bubbles */
.msg { display: flex; gap: var(--space-md); animation: fadeSlideIn 250ms var(--ease); }
@keyframes fadeSlideIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
.msg.user { flex-direction: row-reverse; }
.msg .avatar {
    display: none;
}
.msg .bubble {
    max-width: 75%; padding: 10px 16px;
    border-radius: 16px; font-size: var(--fs-body); line-height: var(--lh-body);
    word-break: break-word;
}
.msg.user .bubble { background: var(--surface-alt); color: var(--text-primary); }
.msg.assistant { flex-wrap: wrap; }
.msg.assistant .bubble { background: transparent; color: var(--text-primary); padding: 10px 4px; box-shadow: none; }

/* ========================================================================
   RIGHT AUXILIARY BAR — 悬浮辅助栏 (288px, collapsible)
   ======================================================================== */
.aux-bar {
    width: var(--auxbar-w); flex-shrink: 0; min-height: 0;
    overflow-y: auto; overflow-x: hidden;
    background: var(--surface); border-left: 1px solid var(--border);
    padding: var(--space-md); display: flex; flex-direction: column; gap: var(--space-md);
    transition: margin-right var(--transition), opacity var(--transition);
}
.aux-bar.collapsed { margin-right: calc(var(--auxbar-w) * -1 + 28px); opacity: 0.6; }

/* Aux toggle button */
.aux-toggle {
    position: absolute; left: -28px; top: var(--space-lg);
    width: 24px; height: 48px; border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    background: var(--surface); border: 1px solid var(--border); border-right: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 12px; color: var(--text-tertiary);
    transition: all var(--transition); z-index: 10;
}
.aux-toggle:hover { color: var(--primary); }

/* Aux Sections */
.aux-section {
    background: var(--surface-alt); border-radius: var(--radius);
    padding: var(--space-md); border: 1px solid var(--border-light);
}
.aux-section .aux-title {
    font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary);
    margin-bottom: var(--space-sm); display: flex; align-items: center; gap: 6px;
}

/* Scene Quick Actions */
.scene-actions { display: flex; flex-direction: column; gap: var(--space-xs); }
.scene-btn {
    padding: var(--space-sm) var(--space-md); border-radius: var(--radius);
    font-size: var(--fs-sm); font-weight: 500; text-align: left;
    transition: all var(--transition); color: var(--text-secondary);
    background: var(--surface); border: 1px solid var(--border-light);
    display: flex; align-items: center; gap: var(--space-sm);
}
.scene-btn:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.scene-btn .scene-icon { font-size: 16px; }

/* AI Brief */
.ai-brief { font-size: var(--fs-sm); color: var(--text-secondary); line-height: var(--lh-body); }
.ai-brief .brief-item {
    padding: var(--space-xs) 0; border-bottom: 1px solid var(--border-light);
    display: flex; align-items: flex-start; gap: var(--space-sm);
}
.ai-brief .brief-item:last-child { border-bottom: none; }

/* Task Queue */
.task-queue { display: flex; flex-direction: column; gap: var(--space-xs); }
.task-item {
    display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm); font-size: var(--fs-xs); background: var(--surface);
    border: 1px solid var(--border-light);
}
.task-item .task-agent { font-weight: 600; color: var(--primary); white-space: nowrap; }
.task-item .task-desc { flex: 1; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-item .task-status { font-size: 10px; padding: 2px 8px; border-radius: var(--radius-full); }
.task-item .task-status.pending { background: var(--surface-alt); color: var(--text-tertiary); }
.task-item .task-status.running { background: var(--warning-light); color: var(--warning); animation: pulse-dot 1.5s infinite; }
.task-item .task-status.done { background: var(--success-light); color: var(--success); }

/* ========================================================================
   INPUT ROW — 多模态对话输入框
   ======================================================================== */
.input-row {
    display: flex; align-items: center; gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg); background: var(--surface);
    border-top: 1px solid var(--border); min-height: var(--input-h);
    max-width: 900px; margin: 0 auto; width: 100%;
    box-sizing: border-box;
}
.input-row .input-actions { display: flex; gap: var(--space-xs); }
.input-row .input-action-btn {
    width: 36px; height: 36px; border-radius: var(--radius); display: flex;
    align-items: center; justify-content: center; font-size: 16px;
    color: var(--text-tertiary); transition: all var(--transition);
}
.input-row .input-action-btn:hover { background: var(--surface-alt); color: var(--primary); }
.input-row input {
    flex: 1; padding: var(--space-sm) var(--space-md); border: 1.5px solid var(--border);
    border-radius: var(--radius-full); font-size: var(--fs-body);
    transition: border-color var(--transition); background: var(--surface-alt);
}
.input-row input:focus { border-color: var(--primary); background: var(--surface); }
.input-row input::placeholder { color: var(--text-tertiary); }
.input-row .send-btn {
    width: 40px; height: 40px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; font-size: 16px;
    background: var(--primary); color: #fff; transition: all var(--transition);
    flex-shrink: 0;
}
.input-row .send-btn:hover { background: var(--primary-dark); transform: scale(1.04); }
.input-row .send-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ========================================================================
   KNOWLEDGE BASE BAR — BGE-M3检索引擎
   ======================================================================== */
.kb-bar {
    height: var(--kb-h); display: flex; align-items: center; gap: var(--space-sm);
    padding: 0 var(--space-lg); background: var(--surface);
    border-top: 1px solid var(--border); position: sticky; bottom: 0; z-index: 100;
}
.kb-bar .kb-icon { font-size: 16px; color: var(--text-tertiary); flex-shrink: 0; }
.kb-bar .kb-label { font-size: var(--fs-xs); color: var(--text-tertiary); white-space: nowrap; font-weight: 500; }
.kb-bar input {
    flex: 1; padding: 4px var(--space-md); border: 1px solid var(--border-light);
    border-radius: var(--radius-full); font-size: var(--fs-sm); background: var(--surface-alt);
    transition: border-color var(--transition);
}
.kb-bar input:focus { border-color: var(--primary); }
.kb-bar .kb-search-btn {
    padding: 4px 14px; border-radius: var(--radius); font-size: var(--fs-sm);
    font-weight: 600; background: var(--primary); color: #fff; transition: all var(--transition);
}
.kb-bar .kb-search-btn:hover { background: var(--primary-dark); }
/* ========================================================================
   KB SEARCH PANEL — 独立检索面板 (overlay)
   ======================================================================== */
.kb-panel-overlay {
    position: fixed; inset: 0; z-index: 500;
    background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center;
    animation: fadeIn 150ms var(--ease);
}
.kb-panel {
    width: 90%; max-width: 720px; max-height: 80vh;
    background: var(--surface); border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl); display: flex; flex-direction: column;
    overflow: hidden; animation: scaleIn 200ms var(--ease);
}
@keyframes scaleIn { from{opacity:0;transform:scale(.96)} to{opacity:1;transform:scale(1)} }

.kb-panel-header {
    padding: var(--space-md) var(--space-lg);
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border-light); flex-shrink: 0;
}
.kb-panel-title { font-size: var(--fs-h3); font-weight: 600; }
.kb-panel-actions { display: flex; align-items: center; gap: var(--space-sm); }
.kb-panel-badge {
    font-size: var(--fs-xs); padding: 3px 10px; border-radius: var(--radius-full);
    background: var(--primary-light); color: var(--primary); font-weight: 500;
}
.kb-panel-close {
    width: 28px; height: 28px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; font-size: 16px;
    cursor: pointer; color: var(--text-tertiary); transition: all var(--transition-fast);
}
.kb-panel-close:hover { background: var(--surface-alt); color: var(--text-primary); }

.kb-panel-body {
    flex: 1; overflow-y: auto; padding: var(--space-lg);
    min-height: 200px;
}
.kb-panel-placeholder {
    text-align: center; padding: var(--space-2xl); color: var(--text-tertiary);
}
.kb-panel-placeholder-icon { font-size: 40px; margin-bottom: var(--space-md); }

/* Result items */
.kb-panel-result {
    padding: var(--space-md); border-radius: var(--radius);
    background: var(--surface-alt); border: 1px solid var(--border-light);
    margin-bottom: var(--space-md); transition: all var(--transition-fast);
}
.kb-panel-result:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.kb-panel-result .kb-panel-result-header {
    display: flex; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-sm);
}
.kb-panel-result .kb-panel-score {
    font-size: var(--fs-xs); font-weight: 700; padding: 2px 10px;
    border-radius: var(--radius-full); background: var(--accent); color: #fff;
}
.kb-panel-result .kb-panel-title { font-size: var(--fs-body); font-weight: 600; }
.kb-panel-result .kb-panel-content { font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.65; }
.kb-panel-result .kb-panel-content pre { white-space: pre-wrap; margin: 4px 0; }
.kb-panel-answer {
    padding: var(--space-md); border-radius: var(--radius);
    background: var(--primary-light); border-left: 3px solid var(--primary);
    margin-bottom: var(--space-lg);
}
.kb-panel-answer .kb-panel-answer-label {
    font-size: var(--fs-xs); font-weight: 600; color: var(--primary); margin-bottom: var(--space-sm);
}
.kb-panel-answer .kb-panel-answer-text { font-size: var(--fs-body); line-height: 1.7; }
.kb-panel-meta { font-size: var(--fs-xs); color: var(--text-tertiary); margin-top: var(--space-sm); }

/* Input row */
.kb-panel-input-row {
    display: flex; gap: var(--space-sm); padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border); flex-shrink: 0; background: var(--surface-alt);
}
.kb-panel-input-row input {
    flex: 1; padding: 10px var(--space-md); border: 1.5px solid var(--border);
    border-radius: var(--radius-full); font-size: var(--fs-body);
    transition: border-color var(--transition); background: var(--surface);
}
.kb-panel-input-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,106,191,.1); }
.kb-panel-search-btn {
    padding: 10px 20px; border-radius: var(--radius-full); font-size: var(--fs-body);
    font-weight: 600; background: var(--primary); color: #fff; cursor: pointer;
    transition: all var(--transition); white-space: nowrap; border: none;
}
.kb-panel-search-btn:hover { background: var(--primary-dark); }

/* Loading */
.kb-panel-loading {
    display: flex; align-items: center; justify-content: center;
    gap: var(--space-sm); padding: var(--space-2xl); color: var(--text-tertiary);
}
.kb-panel-loading .spinner {
    width: 20px; height: 20px; border: 2.5px solid var(--border);
    border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to{transform:rotate(360deg)} }

/* Hide old kb-results */
.kb-results { display: none; }

/* ========================================================================
   ALERT BAR
   ======================================================================== */
.alert-bar {
    display: none; align-items: center; gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg); background: var(--warning-light);
    border-bottom: 1px solid var(--warning); font-size: var(--fs-sm); color: #7A5D28;
}
.alert-bar.show { display: flex; }
.alert-bar.emergency { background: #FDE8E8; color: #9B2C2C; border-color: #F5C6C6; }
.alert-bar.warning { background: #FEF3C7; color: #92400E; border-color: #FCD34D; }
.alert-bar.info { background: var(--info-light); color: var(--info); border-color: var(--border-light); }
.alert-content { flex: 1; display: flex; align-items: center; gap: var(--space-sm); }
.alert-level-tag { padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 700; color: #fff; }
.alert-bar.emergency .alert-level-tag { background: #DC2626; }
.alert-bar.warning .alert-level-tag { background: #D97706; }
.alert-bar.info .alert-level-tag { background: var(--info); }
.alert-actions { display: flex; gap: var(--space-sm); align-items: center; }
.alert-handle-btn { padding: 4px 12px; border-radius: 6px; font-size: 11px; font-weight: 600; background: #fff; color: var(--text-primary); border: 1px solid var(--border); cursor: pointer; transition: all .2s; }
.alert-handle-btn:hover { background: var(--surface-alt); }
.alert-dismiss { margin-left: 0; cursor: pointer; background: none; border: none; font-size: 16px; color: inherit; padding: 2px 6px; }
.alert-nav { display: flex; gap: 2px; }
.alert-nav-btn { background: none; border: none; font-size: 14px; color: inherit; padding: 2px 4px; border-radius: 3px; cursor: pointer; }
.alert-nav-btn:hover { opacity: .7; }
.alert-count { font-size: 11px; opacity: .7; }
.alert-bar .alert-close { margin-left: auto; cursor: pointer; color: #7A5D28; font-size: 16px; }

/* ========================================================================
   AGENT STATUS DOTS & BADGES
   ======================================================================== */
.agent-card { position: relative; }
.agent-badge { position: absolute; bottom: 8px; right: 10px; }
.agent-status-dot {
    position: absolute; bottom: 4px; right: 8px; width: 10px; height: 10px;
    border-radius: 50%; border: 2px solid #fff; z-index: 2;
}
.agent-status-dot.running { background: var(--success); }
.agent-status-dot.stopped { background: #B0B8C8; }
.agent-pending-count {
    position: absolute; bottom: 2px; right: 5px; min-width: 18px; height: 18px;
    border-radius: 9px; background: var(--danger); color: #fff; font-size: 10px;
    font-weight: 700; display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff; padding: 0 5px; z-index: 2;
}

/* ========================================================================
   FRIDGE EXPIRY COLORS
   ======================================================================== */
.fridge-viz { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0; }
.fridge-item { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; background: var(--surface-alt); font-size: 12px; }
.fridge-item .fi-emoji { font-size: 16px; }
.fridge-item .fi-days { margin-left: auto; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; }
.fridge-item.expired .fi-days { background: #FEE2E2; color: #DC2626; }
.fridge-item.expiring .fi-days { background: #FEF3C7; color: #D97706; }
.fridge-item:not(.expired):not(.expiring) .fi-days { background: #D1FAE5; color: #059669; }

/* ========================================================================
   TASK QUEUE
   ======================================================================== */
.task-queue { display: flex; flex-direction: column; gap: 6px; }
.task-item { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 8px; font-size: 11px; background: var(--surface-alt); transition: all .2s; }
.task-item.running { background: var(--info-light); }
.task-item.waiting { opacity: .6; }
.task-agent-badge { padding: 2px 6px; border-radius: 6px; font-weight: 600; font-size: 10px; white-space: nowrap; }
.task-progress-bar { flex: 1; height: 4px; background: var(--border-light); border-radius: 2px; overflow: hidden; }
.task-progress-fill { height: 100%; border-radius: 2px; background: var(--info); transition: width .5s ease; }
.task-progress-fill.running { animation: progress-pulse 1.5s ease-in-out infinite; }
@keyframes progress-pulse { 0%,100%{opacity:1} 50%{opacity:.6} }
.task-time { font-size: 10px; color: var(--text-tertiary); white-space: nowrap; }
.task-cancel-btn { padding: 3px 8px; border-radius: 6px; font-size: 10px; background: transparent; color: var(--danger); cursor: pointer; border: 1px solid transparent; font-weight: 600; transition: all .2s; }
.task-cancel-btn:hover { background: var(--danger-light); border-color: var(--danger); }

/* ========================================================================
   AI BRIEF — 风险分级
   ======================================================================== */
.brief-item { padding: 8px 10px; border-radius: 8px; font-size: 11px; display: flex; align-items: flex-start; gap: 8px; cursor: pointer; transition: all .2s; border-left: 3px solid transparent; margin-bottom: 4px; }
.brief-item:hover { background: var(--surface-alt); }
.brief-item.emergency { border-left-color: var(--danger); background: var(--danger-light); }
.brief-item.warning { border-left-color: var(--warning); background: var(--warning-light); }
.brief-item.info { border-left-color: var(--info); background: var(--info-light); }
.brief-item .brief-icon { flex-shrink: 0; margin-top: 1px; }
.brief-go { margin-left: auto; font-size: 10px; color: #fff; font-weight: 600; white-space: nowrap; padding: 3px 8px; border-radius: 6px; transition: all .2s; background: var(--primary); cursor: pointer; border: none; }
.brief-go:hover { background: var(--primary-dark); transform: scale(1.05); }

/* ========================================================================
   PRIVACY TOGGLE HIGHLIGHT
   ======================================================================== */
.privacy-toggle { border: 2px solid transparent; transition: all .2s; }
.privacy-toggle.active { border-color: var(--info); box-shadow: 0 0 0 2px var(--info-light); }
.privacy-toggle.off { border-color: var(--warning); box-shadow: 0 0 0 2px var(--warning-light); }

/* ========================================================================
   TOAST
   ======================================================================== */
@keyframes slideInRight { from{transform:translateX(100%);opacity:0} to{transform:translateX(0);opacity:1} }

/* ========================================================================
   UTILITY
   ======================================================================== */
.text-center { text-align: center; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }

/* Typing dots */
.typing-dots { display: flex; gap: 4px; padding: 4px 0; }
.typing-dots span { width: 5px; height: 5px; border-radius: 50%; background: var(--text-tertiary); animation: bounce 1.4s infinite both; }
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes bounce { 0%,80%,100%{transform:scale(0)} 40%{transform:scale(1)} }

/* Markdown in bubbles */
.msg .bubble h1 { font-size: 1.5em; font-weight: 700; margin: 18px 0 10px; padding-bottom: 6px; border-bottom: 1.5px solid var(--border-light); }
.msg .bubble h2 { font-size: 1.25em; font-weight: 700; margin: 16px 0 8px; }
.msg .bubble h3 { font-size: 1.1em; font-weight: 600; margin: 14px 0 6px; }
.msg .bubble h4,.msg .bubble h5,.msg .bubble h6 { font-size: 1em; font-weight: 600; margin: 12px 0 4px; }
.msg .bubble table { width: 100%; border-collapse: collapse; margin: var(--space-sm) 0; font-size: var(--fs-sm); }
.msg .bubble th,.msg .bubble td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.msg .bubble th { background: var(--surface-alt); font-weight: 600; }
.msg .bubble code { background: rgba(0,0,0,.05); padding: 2px 6px; border-radius: var(--radius-sm); font-size: .9em; }
.msg .bubble pre { background: #1E2433; color: #CDD6F4; padding: var(--space-md); border-radius: var(--radius); overflow-x: auto; font-size: var(--fs-sm); margin: var(--space-sm) 0; }
.msg .bubble ul,.msg .bubble ol { padding-left: 20px; margin: var(--space-xs) 0; }
.msg .bubble li { margin: 2px 0; }
.msg .bubble blockquote { border-left: 3px solid var(--primary); padding-left: var(--space-md); color: var(--text-secondary); margin: var(--space-sm) 0; }
.msg .bubble strong { font-weight: 700; }
.msg .bubble em { font-style: italic; }
.msg .bubble del { text-decoration: line-through; color: var(--text-tertiary); }
.msg .bubble a { color: var(--primary); text-decoration: underline; }
.msg .bubble .video-card,
.msg .bubble .video-card:hover,
.msg .bubble .video-card .video-title,
.msg .bubble .video-card .video-info { text-decoration: none !important; }
.msg .bubble p { margin: 6px 0; }
.msg .bubble hr { display: none; }
.msg .bubble img { max-width: 100%; border-radius: var(--radius-sm); }

/* ---- 视频卡片 (B站搜索结果) ---- */
.video-cards {
  display: flex; gap: 10px; overflow-x: auto;
  margin-top: 14px; padding-bottom: 4px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.video-cards::-webkit-scrollbar { height: 4px; }
.video-cards::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.video-card {
  flex: 0 0 200px; display: flex; flex-direction: column;
  background: var(--surface-alt); border-radius: var(--radius);
  overflow: hidden; text-decoration: none; color: inherit;
  transition: transform .15s ease, box-shadow .15s ease;
  border: 1px solid var(--border);
  user-select: none;
}
.video-card:hover { text-decoration: none; }
.video-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
}
.video-thumb {
  position: relative; aspect-ratio: 16/10;
  display: flex; align-items: flex-end; justify-content: flex-end;
  overflow: hidden; background-color: var(--surface-alt);
  background-size: cover; background-position: center;
}
.video-duration {
  position: absolute; bottom: 6px; right: 6px;
  background: rgba(0,0,0,.75); color: #fff;
  font-size: var(--fs-xs); padding: 1px 6px;
  border-radius: 4px; font-weight: 500;
}
.video-meta { padding: 8px 10px; }
.video-title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; font-size: var(--fs-sm); font-weight: 600;
  line-height: 1.35; color: var(--text-primary); margin-bottom: 4px;
  text-decoration: none;
}
.video-info {
  font-size: var(--fs-xs); color: var(--text-tertiary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-decoration: none;
}

/* ========================================================================
   RESPONSIVE
   ======================================================================== */
@media (max-width: 900px) {
    :root { --sidebar-w: 200px; --auxbar-w: 0; }
    .aux-bar { display: none; }
    .data-cards.cols-2, .data-cards.cols-3 { grid-template-columns: 1fr; }
    .topbar { padding: 0 var(--space-md); gap: var(--space-sm); }
    .topbar .nav-link { padding: 4px 10px; font-size: var(--fs-xs); }
    .sidebar { padding: var(--space-sm); }
    .agent-card { padding: var(--space-xs) var(--space-sm); min-height: 44px; }
    .agent-card .agent-desc { display: none; }
    .messages { padding: var(--space-md); }
    .input-row { padding: var(--space-sm) var(--space-md); }
    .kb-bar { padding: 0 var(--space-md); }
}
@media (max-width: 640px) {
    :root { --sidebar-w: 0; }
    .sidebar { display: none; }
    .topbar .nav-links { display: none; }
}

/* Dimension icon image (recommend.js radar chart) */
.dim-icon-img {
    width: 1.2em; height: 1.2em; border-radius: 50%;
    object-fit: cover; vertical-align: middle;
    margin-right: 2px;
    animation: avatar-fade-in 1.2s ease-out;
}

/* Avatar fade-in animation */
@keyframes avatar-fade-in {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* Alert dropdown from welcome icon */
.alert-dropdown {
    position: fixed; transform: translateX(-50%);
    background: var(--surface); border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,.15);
    min-width: 260px; max-width: 360px; z-index: 1000;
    opacity: 0; transform: translateX(-50%) translateY(-8px);
    transition: all .2s ease;
    pointer-events: none; overflow: hidden;
}
.alert-dropdown.show {
    opacity: 1; transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}
.alert-dropdown-header {
    padding: 10px 16px; font-weight: 700; font-size: var(--fs-sm);
    color: var(--text-primary); border-bottom: 1px solid var(--border);
}
.alert-dropdown-item {
    padding: 10px 16px 10px 28px; font-size: var(--fs-sm);
    color: #dc2626; border-bottom: 1px solid var(--border-light, var(--border));
    cursor: pointer; line-height: 1.5; position: relative;
    transition: background .15s;
}
.alert-dropdown-item::before {
    content: "●"; position: absolute; left: 12px;
    color: #dc2626; font-size: 8px;
}
.alert-dropdown-item:last-child { border-bottom: none; }
.alert-dropdown-item:hover { background: #fef2f2; }
.alert-dropdown-item.all-clear { color: var(--text-secondary); }
.alert-dropdown-item.all-clear::before { content: none; }
.alert-dropdown-item.all-clear:hover { background: transparent; }

/* ========================================================================
   MESSAGE ACTION BUTTONS — 复制·朗读·赞·踩·重新生成
   放在 bubble 内部，文字下方自然展示
   ======================================================================== */
.msg-actions {
  display: flex; gap: 4px; padding-top: 10px;
  margin-top: 8px; user-select: none;
  border-top: 1px solid var(--border-light);
  animation: fadeSlideIn 250ms var(--ease);
}
.action-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius);
  color: var(--text-tertiary); cursor: pointer;
  transition: all 0.15s ease; background: transparent;
  border: none; padding: 0; flex-shrink: 0;
}
.action-btn:hover {
  background: var(--surface-alt); color: var(--text-primary);
}
.action-btn:active { transform: scale(0.9); }
.action-btn.liked { color: #ef4444; background: #fef2f2; }
.action-btn.disliked { color: #f59e0b; background: #fffbeb; }
.action-btn.speaking { color: var(--primary); background: var(--primary-light); }
.action-btn.speaking svg { animation: pulse-dot 1.5s infinite; }

/* ====== 反馈调查面板 ====== */
.feedback-survey {
  flex-basis: 100%; width: 100%; margin-top: 8px;
  padding: 0 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease,
              padding 0.25s ease, margin 0.25s ease;
}
.feedback-survey.show {
  max-height: 300px; opacity: 1; padding: 14px;
}
.feedback-title {
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-primary);
  margin-bottom: 10px;
}
.feedback-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.feedback-tag {
  padding: 5px 14px; border-radius: var(--radius-full);
  font-size: var(--fs-sm); cursor: pointer; user-select: none;
  background: var(--surface-alt); color: var(--text-secondary);
  border: 1px solid var(--border-light); transition: all 0.15s;
}
.feedback-tag:hover { border-color: var(--primary); color: var(--primary); }
.feedback-tag.selected {
  background: var(--primary-light); color: var(--primary);
  border-color: var(--primary); font-weight: 600;
}
.feedback-input {
  width: 100%; padding: 8px 12px; border-radius: var(--radius);
  border: 1px solid var(--border); font-size: var(--fs-sm);
  font-family: inherit; resize: vertical; outline: none;
  background: var(--surface-alt); color: var(--text-primary);
  margin-bottom: 10px; transition: border-color 0.15s;
}
.feedback-input:focus { border-color: var(--primary); }
.feedback-actions { display: flex; gap: 8px; justify-content: flex-end; }
.feedback-submit, .feedback-close {
  padding: 6px 18px; border-radius: var(--radius);
  font-size: var(--fs-sm); font-weight: 500; cursor: pointer;
  border: 1px solid var(--border); transition: all 0.15s;
}
.feedback-submit {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.feedback-submit:hover { background: var(--primary-dark); }
.feedback-close { background: var(--surface); color: var(--text-secondary); }
.feedback-close:hover { background: var(--surface-alt); }

/* Copy Toast */
.copy-toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  background: #1E2332; color: #fff; padding: 8px 22px;
  border-radius: 20px; font-size: 13px; z-index: 9999;
  pointer-events: none; white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  animation: toastSlideIn 0.3s var(--ease), toastFadeOut 0.3s var(--ease) 1.4s forwards;
}
@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes toastFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateX(-50%) translateY(-6px); }
}


.camera-btn {
  width: 42px; height: 42px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--bg-secondary);
  font-size: 20px; cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.camera-btn:hover { background: var(--primary-light); border-color: var(--primary); }

.lightbox {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.8); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}

/* ============================================================
   登录弹窗
   ============================================================ */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.4); z-index: 10000;
  display: flex; align-items: center; justify-content: center;
}
.modal-card {
  background: #ffffff; border-radius: 16px; padding: 32px 28px 24px;
  width: 360px; max-width: 90vw; position: relative;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
}
.modal-tabs { display: flex; margin-bottom: 20px; border-bottom: 2px solid #e5e7eb; }
.modal-tab {
  flex: 1; text-align: center; padding: 10px 0; cursor: pointer;
  font-size: 15px; font-weight: 600; color: #9ca3af;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color .2s, border-color .2s;
}
.modal-tab.active { color: #3b82f6; border-bottom-color: #3b82f6; }
.modal-card input {
  width: 100%; padding: 12px 14px; margin-bottom: 12px;
  border: 1px solid #e5e7eb; border-radius: 10px;
  font-size: 14px; background: #f9fafb; color: #1a1a2e;
  box-sizing: border-box; outline: none; transition: border-color .2s;
}
.modal-card input:focus { border-color: #3b82f6; background: #fff; }
.auth-btn {
  width: 100%; padding: 12px; border: none; border-radius: 10px;
  background: #3b82f6; color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer; margin-top: 4px; transition: background .2s;
}
.auth-btn:hover { background: #2563eb; }
.auth-error { color: #ef4444; font-size: 13px; margin-top: 8px; min-height: 20px; text-align: center; }
.auth-hint { color: #9ca3af; font-size: 12px; text-align: center; margin-top: 16px; }
.captcha-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.captcha-img {
  height: 44px; border-radius: 8px; border: 1px solid #e5e7eb;
  cursor: pointer; flex-shrink: 0;
}
/* 隐藏数字输入框的加减按钮 */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}
.modal-close {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none; font-size: 18px; cursor: pointer;
  color: #9ca3af; padding: 4px 8px; border-radius: 6px;
}
.modal-close:hover { background: #f3f4f6; color: #3b82f6; }

/* 用户显示 */
.user-display {
  font-size: 13px; color: var(--text-secondary); cursor: pointer;
  padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border);
  transition: background .2s, color .2s; margin-left: 8px;
}
.user-display:hover { background: var(--bg-hover); }
.user-display.logged-in { color: var(--accent); border-color: var(--accent); }

/* ====== 安全确认弹窗 ====== */
.confirm-card {
  max-width: 420px; text-align: center; padding: 32px 28px;
}
.confirm-icon {
  font-size: 48px; margin-bottom: 12px;
}
.confirm-title {
  font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px;
}
.confirm-message {
  font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; line-height: 1.6;
}
.confirm-details {
  background: var(--warning-light); border: 1px solid #f0d89c;
  border-radius: var(--radius); padding: 12px 16px;
  font-size: 13px; color: var(--text-primary); text-align: left;
  margin-bottom: 20px; line-height: 1.6;
  max-height: 150px; overflow-y: auto;
}
.confirm-details code {
  background: rgba(0,0,0,0.06); padding: 2px 6px; border-radius: 4px;
  font-size: 12px; word-break: break-all;
}
.confirm-actions {
  display: flex; gap: 12px; justify-content: center;
}
.confirm-btn {
  padding: 10px 24px; border-radius: var(--radius); border: none;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s;
}
.confirm-btn.cancel {
  background: var(--surface-alt); color: var(--text-secondary);
  border: 1px solid var(--border);
}
.confirm-btn.cancel:hover { background: var(--border); }
.confirm-btn.approve {
  background: var(--warning); color: #fff;
}
.confirm-btn.approve:hover { background: #c08c3a; }
