/* ==========================================
   组件样式 v3 - 苹果毛玻璃风格
   登录、文件、备忘录、人物、日程、日志、待办
   ========================================== */

/* === 登录页 === */
.login-page {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-gradient);
    background-size: 400% 400%;
    animation: gradientShift 25s ease infinite;
}

.login-card {
    background: var(--bg-secondary);
    backdrop-filter: blur(var(--blur)) saturate(1.5);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5);
    border: 1px solid var(--glass-border);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 400px;
    max-width: 90vw;
}

.login-card h1 {
    text-align: center;
    margin-bottom: 8px;
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 14px;
}

.login-card .form-group {
    margin-bottom: 20px;
}

.login-card label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 13px;
}

.login-card .btn-primary {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    justify-content: center;
}

.login-error {
    color: var(--danger);
    text-align: center;
    margin-bottom: 16px;
    font-size: 13px;
    min-height: 20px;
}

/* === 文件管理 === */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.file-card {
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 16px;
    transition: all var(--transition);
}

.file-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.file-card .file-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.file-card .file-name {
    font-weight: 500;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-card .file-meta {
    color: var(--text-muted);
    font-size: 12px;
}

/* === 上传区域 === */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 20px;
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.upload-zone .upload-icon {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* === 备忘录 === */
.memo-card {
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 12px;
    transition: all var(--transition);
}

.memo-card:hover {
    box-shadow: var(--shadow);
}

.memo-card .memo-title {
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.memo-card .memo-content {
    color: var(--text-secondary);
    margin-bottom: 8px;
    white-space: pre-wrap;
}

.memo-card .memo-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* === 人物档案 === */
.person-card {
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    gap: 16px;
    align-items: center;
    transition: all var(--transition);
}

.person-card:hover {
    box-shadow: var(--shadow);
}

.person-info {
    flex: 1;
}

.person-info .person-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.person-info .person-desc {
    color: var(--text-muted);
    font-size: 13px;
}

/* === 日程计划 === */
.schedule-timeline {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.schedule-item {
    display: flex;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.schedule-item:hover {
    box-shadow: var(--shadow);
}

.schedule-item.done {
    opacity: 0.6;
}

.schedule-item.done .schedule-title {
    text-decoration: line-through;
}

.schedule-time {
    flex-shrink: 0;
    text-align: right;
    min-width: 80px;
}

.schedule-time .time {
    font-weight: 600;
    color: var(--accent);
}

.schedule-time .slot {
    font-size: 11px;
    color: var(--text-muted);
}

.schedule-content {
    flex: 1;
}

.schedule-content .schedule-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.schedule-content .schedule-desc {
    color: var(--text-secondary);
    font-size: 13px;
}

.priority-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 8px;
    font-size: 11px;
    margin-left: 8px;
}

.priority-high {
    background: rgba(255,69,58,0.12);
    color: var(--danger);
}

.priority-normal {
    background: rgba(48,209,88,0.12);
    color: var(--success);
}

.priority-low {
    background: rgba(199,199,204,0.15);
    color: var(--text-muted);
}

/* === 周计划（固定看板：完成后仍显示） === */
.weekly-plan-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.weekly-plan-title {
    font-size: 16px;
    font-weight: 600;
}

.weekly-plan-sub {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 8px;
}

.weekly-plan-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.weekly-plan-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.weekly-plan-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.weekly-plan-item:hover {
    box-shadow: var(--shadow);
}

.weekly-plan-item.done {
    opacity: 0.62;
}

.weekly-plan-item.done .weekly-plan-text {
    text-decoration: line-through;
}

.weekly-plan-check {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid var(--text-muted);
    background: transparent;
    color: #fff;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.weekly-plan-check.checked {
    background: var(--success);
    border-color: var(--success);
}

.weekly-plan-content {
    flex: 1;
    min-width: 0;
}

.weekly-plan-text {
    font-weight: 500;
    font-size: 14px;
    word-break: break-word;
}

.weekly-plan-desc {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 2px;
}

.weekly-plan-done-tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 8px;
    font-size: 11px;
    margin-left: 8px;
    background: rgba(48,209,88,0.12);
    color: var(--success);
    text-decoration: none;
}

.weekly-plan-empty {
    padding: 18px;
    font-size: 13px;
}

/* === 模态框 === */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal, .modal-box {
    background: var(--bg-secondary);
    backdrop-filter: blur(var(--blur)) saturate(1.5);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 24px;
    width: 500px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal h2 {
    margin-bottom: 20px;
    font-size: 18px;
}

.modal .form-group {
    margin-bottom: 16px;
}

.modal .form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 13px;
}

.modal-input {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

/* ==========================================
   v3 日志面板样式
   ========================================== */
.diary-panel { height: 100%; }
.diary-layout { display: flex; height: 100%; gap: 0; }
.diary-sidebar {
    width: 260px;
    border-right: 1px solid var(--glass-border);
    padding: 16px;
    overflow-y: auto;
    flex-shrink: 0;
}

.diary-main {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.diary-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* 日历 */
.diary-calendar { margin-bottom: 20px; }
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.cal-weekday {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    padding: 4px 0;
}
.cal-day {
    text-align: center;
    padding: 8px 0;
    font-size: 13px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}
.cal-day:hover { background: var(--bg-hover); }
.cal-day.cal-empty { cursor: default; }
.cal-day.cal-today {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}
.cal-day.cal-selected {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

/* 风格选择器 */
.diary-style-section {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}
.style-selector {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.style-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}
.style-option:hover {
    background: var(--bg-hover);
}
.style-option.active {
    background: var(--accent-light);
    border-color: var(--glass-border);
}
.style-option-icon {
    font-size: 20px;
    flex-shrink: 0;
}
.style-option-info {
    flex: 1;
}
.style-option-name {
    font-size: 13px;
    font-weight: 600;
}
.style-option-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.style-check {
    color: var(--accent);
    font-size: 14px;
    font-weight: 700;
}

.style-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    background: var(--accent-light);
    color: var(--accent);
}

/* 日志内容区 */
.diary-content-area {
    min-height: 300px;
}

.journal-section {
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.journal-section-analysis {
    background: rgba(180,160,255,0.06);
    border-left: 3px solid #b4a0ff;
}

.journal-section-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.journal-section-icon {
    font-size: 18px;
}

.journal-section-body {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

.journal-risk-box {
    background: rgba(255,69,58,0.08);
    border-left: 3px solid var(--danger);
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 12px;
    font-size: 13px;
}

/* 日志条目卡片 */
.diary-entry-card {
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 12px;
}

.diary-entry-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.diary-category {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 500;
}

.diary-event-type {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.diary-time { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.diary-source { font-size: 11px; color: var(--text-muted); }
.diary-content {
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}
.diary-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* ==========================================
   待办面板样式
   ========================================== */
.todo-panel { height: 100%; overflow-y: auto; padding: 20px 24px; }
.todo-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.stat-card {
    flex: 1;
    min-width: 100px;
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
    transition: all var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-num { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-active { border-color: var(--accent2); }
.stat-active .stat-num { color: var(--accent2); }
.stat-warning { border-color: var(--warning); }
.stat-warning .stat-num { color: var(--warning); }
.stat-danger { border-color: var(--danger); }
.stat-danger .stat-num { color: var(--danger); }

.todo-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}
.todo-filters { display: flex; gap: 8px; align-items: center; }
.todo-select, .todo-input {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.todo-card {
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 10px;
    transition: all var(--transition);
}
.todo-card:hover { box-shadow: var(--shadow); }
.todo-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.todo-status-badge {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 500;
}
.todo-pending { background: rgba(255,214,10,0.15); color: #92400e; }
.todo-progress { background: rgba(123,164,240,0.15); color: #1e40af; }
.todo-done { background: rgba(48,209,88,0.15); color: #065f46; }
.todo-cancelled { background: rgba(199,199,204,0.15); color: #6b7280; }
.todo-priority { font-size: 12px; }
.pri-high { color: var(--danger); }
.pri-normal { color: var(--warning); }
.pri-low { color: var(--success); }
.todo-source { font-size: 11px; color: var(--text-muted); }
/* v4：任务冻结徽章（3天无内容更新自动冻结，逾期概念已取消） */
.todo-frozen-badge {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(96,165,250,0.18);
    color: #1d4ed8;
    white-space: nowrap;
}
.todo-date { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.todo-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.todo-summary { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; line-height: 1.5; }
.todo-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.tag-guide { background: rgba(99,102,241,0.12); color: #6366f1; border: 1px solid rgba(99,102,241,0.3); }
.todo-detail { display: flex; flex-direction: column; gap: 16px; }
.todo-detail-section { border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.todo-detail-section:last-child { border-bottom: none; }
.todo-detail-label { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.todo-detail-value { font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.todo-guide { background: var(--bg-hover); border-radius: 8px; padding: 10px 12px; border-left: 3px solid #6366f1; }
.todo-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.todo-actions { display: flex; gap: 4px; }
.progress-bar {
    height: 6px;
    background: var(--accent);
    border-radius: 3px;
    display: inline-block;
    max-width: 200px;
    vertical-align: middle;
    margin-right: 8px;
}

/* === 任务折叠/展开 === */
.todo-collapsed {
    padding: 10px 14px;
    cursor: pointer;
}
.todo-collapsed:hover {
    background: var(--bg-hover);
}
.todo-collapse-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    overflow: hidden;
}
.todo-collapse-title {
    font-size: 14px;
    font-weight: 600;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}
.todo-collapse-date {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.todo-expand-icon {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.2s;
}
.todo-expanded {
    padding: 12px 14px;
}
.todo-expanded .todo-collapse-header {
    cursor: pointer;
    margin-bottom: 0;
}
.todo-expanded .todo-collapse-header:hover {
    opacity: 0.8;
}
.todo-collapse-body {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    animation: expandFade 0.2s ease;
}
@keyframes expandFade {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.todo-collapse-summary {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 10px;
}

/* === 进度时间线 === */
.todo-progress-timeline {
    margin-bottom: 12px;
    max-height: 200px;
    overflow-y: auto;
}
.todo-progress-item {
    display: flex;
    gap: 10px;
    padding: 6px 0;
    position: relative;
}
.todo-progress-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 16px;
    bottom: -2px;
    width: 2px;
    background: var(--border-color);
}
.todo-progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    margin-top: 4px;
    border: 2px solid var(--bg-secondary);
    z-index: 1;
}
.todo-progress-content {
    flex: 1;
    min-width: 0;
}
.todo-progress-head {
    display: flex;
    align-items: center;
    gap: 8px;
}
.todo-progress-pct {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
}
.todo-progress-time {
    font-size: 11px;
    color: var(--text-muted);
}
.todo-progress-note {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* === 内联进度输入 === */
.todo-inline-progress {
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.todo-inline-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.todo-inline-range {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-color);
    border-radius: 2px;
    outline: none;
}
.todo-inline-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--bg-secondary);
}
.todo-inline-range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--bg-secondary);
}
.todo-inline-pct {
    font-size: 13px;
    font-weight: 600;
    min-width: 38px;
    text-align: right;
    color: var(--accent);
}
.todo-inline-note {
    flex: 1;
    font-size: 13px;
}

/* ==========================================
   v3 新增样式：二级菜单、任务分级、档案、关系
   ========================================== */

/* 二级菜单 */
.nav-group {
    margin: 0;
}
.nav-group-toggle {
    cursor: pointer;
    user-select: none;
}
.nav-group-toggle .nav-arrow {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.2s;
}
.nav-submenu {
    padding-left: 16px;
}
.nav-sub {
    font-size: 13px !important;
    opacity: 0.85;
    padding: 6px 12px !important;
}
.nav-sub .icon {
    font-size: 14px;
}
.nav-sub.active {
    opacity: 1;
    background: var(--accent-light);
    color: var(--accent);
}

/* 任务分级头部 */
.todo-level-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
}

/* 事件总结 */
.todo-event-summary {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 8px 12px;
    margin: 6px 0;
    line-height: 1.5;
}

/* 对话引用标识 */
.chat-ref-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(99,102,241,0.12);
    color: #6366f1;
    font-family: 'SF Mono', 'Monaco', monospace;
    cursor: pointer;
    transition: all 0.2s;
}
.chat-ref-badge:hover {
    background: rgba(99,102,241,0.2);
}

/* 档案面板 */
.archive-panel {
    padding: 20px 24px;
    height: 100%;
    overflow-y: auto;
}
.archive-categories {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.cat-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.cat-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.cat-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* 关系面板 */
.relations-panel {
    padding: 20px 24px;
    height: 100%;
    overflow-y: auto;
}
.relations-toolbar {
    margin-bottom: 16px;
}
.person-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 10px;
    transition: all var(--transition);
}
.person-card:hover { box-shadow: var(--shadow); }
.person-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    flex-shrink: 0;
}
.person-info { flex: 1; min-width: 0; }
.person-name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.person-desc { font-size: 12px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }

/* 文件网格 */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 16px;
}
.file-card {
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 14px;
    transition: all var(--transition);
}
.file-card:hover { box-shadow: var(--shadow); }
.file-icon { font-size: 32px; margin-bottom: 8px; }
.file-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}
.file-meta { font-size: 11px; color: var(--text-muted); }


/* === 邮箱 === */
.mail-panel {
    max-width: 700px;
    margin: 0 auto;
}
.mail-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}
.mail-filter-btn {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    font-size: 13px;
    color: var(--text-sub);
    cursor: pointer;
    transition: all 0.2s;
}
.mail-filter-btn:hover {
    border-color: var(--accent);
}
.mail-filter-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
.mail-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mail-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.mail-item:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.mail-item.mail-unread {
    border-left: 3px solid var(--accent);
}
.mail-item-icon {
    font-size: 22px;
    flex-shrink: 0;
    margin-top: 2px;
}
.mail-item-content {
    flex: 1;
    min-width: 0;
}
.mail-item-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.mail-item-subject {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mail-unread .mail-item-subject {
    font-weight: 700;
}
.mail-unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    flex-shrink: 0;
}
.mail-item-preview {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}
.mail-item-meta {
    display: flex;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}
.mail-item-sender {
    font-weight: 500;
}
.mail-item-del {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.mail-item-del:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* 邮件详情 */
.mail-detail {
    max-width: 700px;
    margin: 0 auto;
}
.mail-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.mail-detail-subject {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.mail-detail-meta {
    display: flex;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}
.mail-detail-body {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-sub);
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: 12px;
    white-space: pre-wrap;
}

/* === 导航徽章 === */
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    margin-left: auto;
}

/* === 管理后台 === */
.admin-panel {
    max-width: 900px;
    margin: 0 auto;
}

.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: var(--bg-secondary);
    backdrop-filter: blur(var(--blur));
    border-radius: var(--radius-sm);
    padding: 4px;
    border: 1px solid var(--border-color);
}

.admin-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
}

.admin-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.admin-tab.active {
    background: var(--accent);
    color: white;
    font-weight: 600;
}

.admin-content {
    background: var(--bg-secondary);
    backdrop-filter: blur(var(--blur));
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    min-height: 400px;
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.admin-stat-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.admin-stat-card .stat-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.admin-stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.admin-stat-card .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.admin-stat-card .stat-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.admin-section {
    margin-bottom: 24px;
}

.admin-section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.admin-section-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.admin-toolbar {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    gap: 8px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table th {
    text-align: left;
    padding: 10px 12px;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.admin-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.admin-table tr:hover td {
    background: var(--bg-hover);
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.tag-admin { background: var(--accent-light); color: var(--accent); }
.tag-user { background: rgba(123,164,240,0.15); color: var(--accent2); }
.tag-active { background: rgba(48,209,88,0.15); color: var(--success); }
.tag-inactive { background: rgba(255,69,58,0.15); color: var(--danger); }

.admin-action-btns {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.btn-danger-ghost {
    background: transparent;
    border: 1px solid rgba(255,69,58,0.3);
    color: var(--danger);
    padding: 4px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all var(--transition);
}

.btn-danger-ghost:hover {
    background: rgba(255,69,58,0.1);
}

.admin-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.admin-modal {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 28px;
    width: 380px;
    max-width: 90vw;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.admin-modal .modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.admin-modal .form-group {
    margin-bottom: 16px;
}

.admin-modal .form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.admin-modal .form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border var(--transition);
}

.admin-modal .form-input:focus {
    border-color: var(--accent);
}

.modal-error {
    color: var(--danger);
    font-size: 13px;
    padding: 8px 12px;
    background: rgba(255,69,58,0.1);
    border-radius: 8px;
    margin-bottom: 12px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

.admin-error {
    color: var(--danger);
    text-align: center;
    padding: 40px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border var(--transition);
}

.form-input:focus {
    border-color: var(--accent);
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.model-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.model-chip {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.model-chip:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.model-chip.active {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

.admin-storage-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.admin-storage-row .rank-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.admin-storage-row .rank-user {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
}

.admin-storage-row .rank-files {
    color: var(--text-muted);
    font-size: 12px;
}

.admin-storage-row .rank-size {
    font-weight: 600;
    color: var(--accent);
    min-width: 80px;
    text-align: right;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-primary {
    background: var(--accent);
    color: white;
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-ghost {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.vendor-preset.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ============ Token 用量明细弹窗 ============ */
.usage-modal {
    width: 680px;
    max-width: 94vw;
    max-height: 86vh;
    overflow-y: auto;
}

.usage-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.usage-year-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.usage-select {
    width: 110px;
    padding: 6px 10px;
    font-size: 13px;
}

.usage-note {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}

.usage-loading {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 0;
}

.usage-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 24px 0;
    font-size: 13px;
}

.usage-stats {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    margin-bottom: 8px;
}

.usage-section {
    margin-top: 8px;
}

.usage-section-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.usage-chart {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.usage-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.usage-bar-label {
    width: 36px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
    flex-shrink: 0;
}

.usage-bar-track {
    flex: 1;
    height: 18px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.usage-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 6px;
    transition: width 0.3s ease;
}

.usage-bar-value {
    width: 60px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.usage-table th,
.usage-table td {
    padding: 8px 10px;
}

/* === 任务分支（每个任务可有多个分支，信息独立记录） === */
.todo-branches {
    margin: 10px 0;
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: 10px 12px;
}

.todo-branches-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.todo-branches-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
}

.todo-branches-loading,
.todo-branch-empty {
    font-size: 12px;
    color: var(--text-muted);
    padding: 4px 0;
}

.todo-branch-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.todo-branch-row:last-child {
    border-bottom: none;
}

.todo-branch-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.todo-branch-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.todo-branch-actions .btn {
    padding: 1px 7px;
    font-size: 11px;
}

.todo-progress-status {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}
