/* static/css/style.css */

/* ==================== 变量定义 ==================== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
}

/* ==================== 导航栏 ==================== */
.navbar {
    background: white;
    padding: 0 2rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.nav-brand .logo {
    font-size: 1.5rem;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#user-info {
    color: var(--gray-500);
    font-size: 0.9rem;
}

/* ==================== 按钮 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: white;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--gray-50);
}

.btn-outline.disabled,
.btn-outline:disabled {
    background: var(--gray-100);
    color: var(--gray-400);
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-outline.disabled:hover,
.btn-outline:disabled:hover {
    background: var(--gray-100);
    transform: none;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-warning {
    background: var(--warning);
    color: #000;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-upload {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.btn-upload:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-upload:disabled {
    background: var(--gray-300);
    color: var(--gray-500);
    cursor: not-allowed;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

/* ==================== 认证页面 ==================== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 3rem;
}

.auth-card {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--gray-500);
}

.auth-form .form-group {
    margin-bottom: 1.25rem;
}

.auth-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
}

.auth-form input,
.auth-form select,
.auth-form textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-form input:focus,
.auth-form select:focus,
.auth-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-help {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    max-width: 300px;
}

.auth-help h3 {
    margin-bottom: 1rem;
}

.auth-help ol {
    padding-left: 1.25rem;
    color: var(--gray-500);
}

.auth-help li {
    margin-bottom: 0.5rem;
}

/* ==================== 状态消息 ==================== */
.status-message {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-top: 1rem;
    font-size: 0.9rem;
}

.status-message.info {
    background: #dbeafe;
    color: #1e40af;
}

.status-message.success {
    background: #d1fae5;
    color: #065f46;
}

.status-message.error {
    background: #fee2e2;
    color: #991b1b;
}

/* ==================== 仪表盘布局 ==================== */
.dashboard {
    display: flex;
    min-height: calc(100vh - 60px);
}

.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.sidebar-header h2 {
    font-size: 1.1rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.sidebar-nav .nav-item {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--gray-700);
    text-decoration: none;
    transition: all 0.2s;
}

.sidebar-nav .nav-item:hover {
    background: var(--gray-50);
}

.sidebar-nav .nav-item.active {
    background: var(--primary);
    color: white;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
}

/* ==================== 主内容区 ==================== */
.main-content {
    flex: 1;
    padding: 1.5rem 2rem;
    overflow-y: auto;
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.content-header h1 {
    font-size: 1.5rem;
}

.search-input {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    width: 250px;
}

/* ==================== 任务列表 ==================== */
.task-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.75rem;
}

.task-card {
    background: white;
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.task-code {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-family: monospace;
}

.task-title {
    font-size: 1rem;
    margin-bottom: 0.4rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-theme {
    color: var(--gray-500);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.task-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

.task-date {
    color: var(--gray-500);
    font-size: 0.75rem;
}
    margin-bottom: 0.5rem;
}

.task-theme {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.task-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-draft { background: var(--gray-200); color: var(--gray-700); }
.status-pending { background: #fef3c7; color: #92400e; }
.status-in_progress { background: #dbeafe; color: #1e40af; }
.status-submitted { background: #e0e7ff; color: #3730a3; }
.status-completed { background: #d1fae5; color: #065f46; }
.status-rejected { background: #fee2e2; color: #991b1b; }
.status-cancelled { background: var(--gray-200); color: var(--gray-700); }

.task-date {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.task-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-100);
}

.task-card-actions {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
}

/* ==================== 模态框 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 800px;
}

.modal-xlarge {
    max-width: 1200px;
    width: 95%;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h2 {
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 1.5rem;
    margin-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

/* ==================== 表单元素 ==================== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.95rem;
}

.form-group textarea {
    resize: vertical;
    font-family: inherit;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.flex-1 {
    flex: 1;
}

/* ==================== 详情区域 ==================== */
.detail-section {
    margin-bottom: 1.5rem;
}

.detail-section h4 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--gray-700);
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
    font-size: 0.9rem;
}

.detail-content {
    background: var(--gray-50);
    padding: 1rem;
    border-radius: var(--radius);
    white-space: pre-wrap;
}

.detail-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

.action-left {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.action-right {
    display: flex;
    gap: 0.5rem;
}

/* ==================== 报告列表 ==================== */
.report-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--gray-100);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.selected-count {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.report-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.report-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 2px solid transparent;
    transition: all 0.2s;
}

.report-item:hover {
    background: var(--gray-100);
}

.report-item.selected {
    background: #dbeafe;
    border-color: var(--primary);
}

.report-checkbox {
    flex-shrink: 0;
}

.report-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.report-info {
    flex: 1;
    min-width: 0;
}

.report-filename {
    display: block;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-meta {
    display: block;
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.report-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

/* ==================== 历史记录 ==================== */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-item {
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.history-action {
    font-weight: 600;
    color: var(--gray-900);
}

.history-time {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.history-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--gray-600);
}

.history-operator {
    color: var(--gray-500);
    font-size: 0.85rem;
}

.history-status {
    background: var(--gray-200);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.history-comment {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: white;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--gray-700);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ==================== 两栏详情布局 ==================== */
.detail-layout {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
.detail-main {
    flex: 1;
    min-width: 0;
}
.detail-history {
    width: 260px;
    flex-shrink: 0;
}
.detail-history .detail-section h4 {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}
.detail-history .history-list {
    gap: 0.3rem;
}
.detail-history .history-item {
    padding: 0.35rem 0.5rem;
    font-size: 0.78rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 0.4rem;
    align-items: baseline;
}
.detail-history .history-header,
.detail-history .history-meta {
    display: contents;
}
.detail-history .history-action {
    font-weight: 600;
    font-size: 0.78rem;
}
.detail-history .history-time {
    font-size: 0.7rem;
    color: var(--gray-500);
}
.detail-history .history-operator {
    font-size: 0.72rem;
    color: var(--gray-500);
}
.detail-history .history-status {
    font-size: 0.7rem;
    padding: 0.1rem 0.3rem;
}
.detail-history .history-comment {
    width: 100%;
    margin-top: 0.15rem;
    padding: 0.2rem 0.3rem;
    font-size: 0.75rem;
}

/* ==================== 上传区域 ==================== */
.upload-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

.upload-section h4 {
    margin-bottom: 1rem;
}

.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: var(--gray-50);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.upload-hint {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 0.5rem;
}

.file-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

/* ==================== 预览功能 ==================== */
.preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: var(--gray-500);
}

.preview-error {
    text-align: center;
    padding: 3rem;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.error-message {
    color: var(--danger);
    margin-bottom: 1.5rem;
}

.preview-content {
    max-height: 70vh;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--gray-50);
    border-radius: var(--radius);
}

/* Markdown 预览 */
.markdown-preview {
    line-height: 1.6;
    color: var(--gray-800);
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3,
.markdown-preview h4,
.markdown-preview h5,
.markdown-preview h6 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--gray-900);
    font-weight: 600;
    line-height: 1.3;
}

.markdown-preview h1 {
    font-size: 2rem;
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 0.5rem;
}

.markdown-preview h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    padding-bottom: 0.5rem;
}

.markdown-preview h3 {
    font-size: 1.25rem;
}

.markdown-preview h4 {
    font-size: 1.1rem;
}

.markdown-preview h5 {
    font-size: 1rem;
}

.markdown-preview h6 {
    font-size: 0.9rem;
}

.markdown-preview p {
    margin: 0.75rem 0;
}

.markdown-preview strong {
    font-weight: 600;
    color: var(--gray-900);
}

.markdown-preview em {
    font-style: italic;
}

.markdown-preview ul,
.markdown-preview ol {
    margin: 0.75rem 0;
    padding-left: 2rem;
}

.markdown-preview li {
    margin: 0.25rem 0;
}

.markdown-preview a {
    color: var(--primary);
    text-decoration: none;
}

.markdown-preview a:hover {
    text-decoration: underline;
}

.markdown-preview hr {
    border: none;
    border-top: 1px solid var(--gray-300);
    margin: 1.5rem 0;
}

.markdown-preview code {
    background: var(--gray-100);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

.markdown-preview pre {
    background: #282c34;
    color: #abb2bf;
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
}

.markdown-preview pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.markdown-preview blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
    margin-left: 0;
    color: var(--gray-600);
    font-style: italic;
}

.markdown-preview table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.markdown-preview table th,
.markdown-preview table td {
    border: 1px solid var(--gray-300);
    padding: 0.5rem;
    text-align: left;
}

.markdown-preview table th {
    background: var(--gray-100);
    font-weight: 600;
}

/* DOCX 预览 */
.docx-preview p {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.docx-preview .preview-table,
.excel-preview .preview-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: white;
}

.docx-preview .preview-table th,
.docx-preview .preview-table td,
.excel-preview .preview-table th,
.excel-preview .preview-table td {
    border: 1px solid var(--gray-300);
    padding: 0.5rem;
    min-width: 80px;
}

.docx-preview .preview-table th {
    background: var(--gray-100);
    font-weight: 600;
}

/* Excel 预览 */
.excel-preview .preview-table th {
    background: #4472c4;
    color: white;
    font-weight: 600;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.excel-preview .preview-table tr:nth-child(even) {
    background: var(--gray-50);
}

.excel-preview .preview-table td {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.excel-preview .preview-table td:hover {
    overflow: visible;
    white-space: normal;
    word-wrap: break-word;
}

.empty-sheet {
    text-align: center;
    padding: 2rem;
    color: var(--gray-500);
    font-style: italic;
}

/* Text 预览 */
.text-preview pre {
    background: white;
    border: 1px solid var(--gray-300);
    padding: 1rem;
    border-radius: var(--radius);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
}

.text-muted {
    color: var(--gray-500);
}

/* ==================== 动画 ==================== */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-upload.uploading {
    position: relative;
    pointer-events: none;
}

.btn-upload.uploading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    /* 认证页面 */
    .auth-container {
        flex-direction: column;
    }
    
    .auth-help {
        max-width: none;
    }
    
    /* 仪表盘 */
    .dashboard {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
    }
    
    .sidebar-header {
        display: none;
    }
    
    .sidebar-nav {
        display: flex;
        padding: 0;
    }
    
    .sidebar-nav .nav-item {
        white-space: nowrap;
    }
    
    .sidebar-footer {
        display: none;
    }
    
    /* 任务列表 */
    .task-list {
        grid-template-columns: 1fr;
    }
    
    /* 表单 */
    .form-row {
        flex-direction: column;
    }
    
    /* 模态框 */
    .modal-xlarge {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    .preview-content {
        max-height: calc(100vh - 200px);
    }
    
    /* 操作按钮 */
    .detail-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .action-left,
    .action-right {
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .action-left .btn,
    .action-right .btn {
        flex: 1;
        min-width: 120px;
    }
    
    /* 报告项 */
    .report-item {
        flex-wrap: wrap;
    }
    
    .report-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.5rem;
    }
    
    .report-actions .btn {
        flex: 1;
    }
}
/* static/css/style.css 添加 */

/* 多文件预览 */
.files-preview {
    margin-bottom: 1rem;
}

.files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--gray-100);
    border-radius: var(--radius) var(--radius) 0 0;
    border: 1px solid var(--gray-200);
    border-bottom: none;
}

.files-count {
    font-weight: 500;
    color: var(--gray-700);
}

.files-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--gray-200);
    border-radius: 0 0 var(--radius) var(--radius);
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.2s;
}

.file-item:last-child {
    border-bottom: none;
}

.file-item:hover {
    background: var(--gray-50);
}

.file-item.uploading {
    background: #dbeafe;
}

.file-item.success {
    background: #d1fae5;
}

.file-item.error {
    background: #fee2e2;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.file-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.file-details {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.file-status {
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

.file-status.pending {
    color: var(--gray-500);
}

.file-status.uploading {
    color: var(--primary);
}

.file-status.success {
    color: var(--success);
}

.file-status.error {
    color: var(--danger);
}

.file-actions {
    flex-shrink: 0;
}

/* 上传进度条 */
.upload-progress {
    margin-bottom: 1rem;
}

.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #667eea);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

#progress-text {
    font-size: 0.85rem;
    color: var(--gray-600);
}

/* 拖拽高亮 */
.upload-area.has-files {
    border-style: solid;
    border-color: var(--success);
    background: #f0fdf4;
}

/* ==================== 自定义对话框 ==================== */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.dialog-box {
    background: #fff;
    border-radius: 12px;
    padding: 1.75rem 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.dialog-message {
    margin: 0 0 1.25rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--gray-800, #1f2937);
    white-space: pre-wrap;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.prompt-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300, #d1d5db);
    border-radius: 6px;
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
    box-sizing: border-box;
}

.prompt-input:focus {
    outline: none;
    border-color: var(--primary, #4f46e5);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* ==================== Toast 通知 ==================== */
#toast-container {
    position: fixed;
    top: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #fff;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.toast.toast-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast-success { background: #16a34a; }
.toast-error   { background: #dc2626; }
.toast-info    { background: #2563eb; }
.toast-warning { background: #d97706; }

/* ==================== Manus AI 页面 ==================== */
.manus-page {
    display: flex;
    height: calc(100vh - 56px);
    overflow: hidden;
}

.manus-sidebar {
    width: 280px;
    min-width: 220px;
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    background: var(--gray-50);
    overflow-y: auto;
}

.manus-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}

.manus-sidebar-header h2 {
    font-size: 1.1rem;
    margin: 0;
}

.manus-sidebar-section {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}

.manus-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.manus-select {
    width: 100%;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.875rem;
    background: #fff;
}

.manus-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.manus-history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.manus-history-item {
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: border-color 0.15s;
}

.manus-history-item:hover {
    border-color: var(--primary);
}

.manus-history-prompt {
    font-size: 0.85rem;
    color: var(--gray-800);
    margin-bottom: 0.3rem;
    word-break: break-all;
}

.manus-history-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--gray-500);
    align-items: center;
}

.manus-status {
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.manus-status-completed { background: #dcfce7; color: #166534; }
.manus-status-pending   { background: #fef9c3; color: #854d0e; }
.manus-status-running   { background: #dbeafe; color: #1e40af; }
.manus-status-failed,
.manus-status-error,
.manus-status-timeout   { background: #fee2e2; color: #991b1b; }

.manus-empty {
    font-size: 0.85rem;
    color: var(--gray-400);
    text-align: center;
    padding: 1rem 0;
}

/* ── Main chat area ── */
.manus-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.manus-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.manus-welcome {
    margin: auto;
    text-align: center;
    color: var(--gray-500);
    max-width: 400px;
}

.manus-welcome-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.manus-welcome h3 {
    font-size: 1.25rem;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.manus-msg {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.manus-msg-user {
    align-self: flex-end;
    align-items: flex-end;
}

.manus-msg-ai {
    align-self: flex-start;
    align-items: flex-start;
}

.manus-msg-bubble {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.6;
    word-break: break-word;
}

.manus-msg-user .manus-msg-bubble {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.manus-msg-ai .manus-msg-bubble {
    background: var(--gray-100);
    color: var(--gray-800);
    border-bottom-left-radius: 4px;
}

.manus-msg-text {
    margin: 0;
    white-space: pre-wrap;
    font-family: inherit;
    font-size: inherit;
}

.manus-msg-meta {
    font-size: 0.72rem;
    color: var(--gray-400);
    margin-top: 0.25rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.manus-task-link-btn {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.75rem;
    /* reset <button> defaults */
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font-family: inherit;
    line-height: inherit;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.manus-task-link-btn:hover { text-decoration: underline; }

.manus-msg-error {
    background: #fee2e2;
    color: #991b1b;
}

/* Loading dots */
.manus-loading-bubble {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 0.75rem 1.25rem;
}

.manus-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-400);
    animation: manus-bounce 1.2s infinite ease-in-out;
}

.manus-dot:nth-child(2) { animation-delay: 0.2s; }
.manus-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes manus-bounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
    40%           { transform: scale(1);   opacity: 1;   }
}

/* ── Input bar ── */
.manus-input-bar {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    background: #fff;
    align-items: flex-end;
}

.manus-textarea {
    flex: 1;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.9rem;
    resize: none;
    line-height: 1.5;
    font-family: inherit;
}

.manus-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.manus-send-btn {
    padding: 0.65rem 1.5rem;
    white-space: nowrap;
    align-self: flex-end;
}

/* btn-ai: color-only modifier, sizing comes from .btn / .btn-sm */
.btn-ai {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    text-decoration: none;
}

.btn-ai:hover { opacity: 0.88; color: #fff; }

@media (max-width: 768px) {
    .manus-sidebar { display: none; }
}

