/* ============================================================
   卡曼报关处理程序 - 主样式表 v3
   企业级智能设计 | 深色主题 | iOS 规范 | 流畅动效
   ============================================================ */

/* CSS 自定义属性 */
:root {
    --bg-primary: #080c12;
    --bg-secondary: #0f151c;
    --bg-tertiary: #171e28;
    --bg-elevated: #1a2332;
    --bg-input: #0c1118;
    --bg-glass: rgba(15, 21, 28, 0.85);

    --text-primary: #e8edf4;
    --text-secondary: #8fa0b4;
    --text-muted: #5c6d80;
    --text-placeholder: #404b5a;

    --border-default: rgba(255,255,255,0.08);
    --border-light: rgba(255,255,255,0.05);
    --border-accent: rgba(56, 139, 253, 0.4);

    --accent: #388bfd;
    --accent-hover: #539bf5;
    --accent-light: rgba(56, 139, 253, 0.12);
    --accent-glow: rgba(56, 139, 253, 0.25);

    --success: #2da44e;
    --success-light: rgba(45, 164, 78, 0.12);
    --warning: #d29922;
    --warning-light: rgba(210, 153, 34, 0.12);
    --danger: #da3633;
    --danger-light: rgba(218, 54, 51, 0.12);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --shadow-xs: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.4);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);

    --font-mono: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;

    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);

    --transition-instant: 80ms ease;
    --transition-fast: 150ms var(--ease-out-expo);
    --transition-normal: 250ms var(--ease-out-expo);
    --transition-slow: 400ms var(--ease-in-out);

    --toolbar-height: 52px;
    --sidebar-width: 380px;
}

/* ========== Keyframes ========== */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(0.75); }
}

@keyframes borderGlow {
    0%, 100% { border-color: rgba(56, 139, 253, 0.15); }
    50% { border-color: rgba(56, 139, 253, 0.35); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ========== Reset ========== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    user-select: none;
}

/* Subtle bg noise texture via gradient */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(56, 139, 253, 0.04), transparent),
        radial-gradient(ellipse 60% 50% at 100% 100%, rgba(56, 139, 253, 0.02), transparent);
    pointer-events: none;
    z-index: 0;
}

/* ========== 顶部工具栏 ========== */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--toolbar-height);
    padding: 0 20px;
    background: rgba(15, 21, 28, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-default);
    z-index: 100;
    position: relative;
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toolbar-center {
    gap: 6px;
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-logo-img {
    border-radius: 7px;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: transform var(--transition-fast);
}

.app-logo-img:hover {
    transform: scale(1.05);
}

.app-title {
    font-size: 15px;
    font-weight: 650;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    background: linear-gradient(135deg, #e8edf4 0%, #a0b8d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========== 按钮系统 ========== */
.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 15px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.03);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.toolbar-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255,255,255,0.08), transparent 70%);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.toolbar-btn:hover::after {
    opacity: 1;
}

.toolbar-btn:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.toolbar-btn:active {
    transform: translateY(0);
    transition: all 60ms ease;
}

.toolbar-btn.primary {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 12px rgba(56, 139, 253, 0.3);
}

.toolbar-btn.primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 20px rgba(56, 139, 253, 0.45);
    transform: translateY(-1px);
}

.toolbar-btn.accent {
    background: var(--success);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 12px rgba(45, 164, 78, 0.3);
}

.toolbar-btn.accent:hover {
    background: #3fb950;
    box-shadow: 0 4px 20px rgba(45, 164, 78, 0.45);
    transform: translateY(-1px);
}

.toolbar-btn svg {
    transition: transform var(--transition-fast);
    flex-shrink: 0;
}

.toolbar-btn:hover svg {
    transform: scale(1.08);
}

/* ========== 状态指示器 ========== */
.status-indicator {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.status-indicator::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px rgba(45, 164, 78, 0.5);
    transition: all var(--transition-normal);
}

.status-indicator.processing {
    color: var(--warning);
}

.status-indicator.processing::before {
    background: var(--warning);
    animation: pulseDot 1.4s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(210, 153, 34, 0.5);
}

.status-indicator.error {
    color: var(--danger);
}

.status-indicator.error::before {
    background: var(--danger);
    box-shadow: 0 0 10px rgba(218, 54, 51, 0.5);
}

/* ========== 主内容布局 ========== */
.main-content {
    display: flex;
    height: calc(100vh - var(--toolbar-height));
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* ========== 左侧预览面板 ========== */
.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    overflow: hidden;
    animation: fadeInScale 0.5s var(--ease-out-expo);
}

.preview-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 8px 20px 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-default);
    flex-shrink: 0;
}

.preview-tabs-container {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    margin-right: 16px;
    padding-bottom: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.06) transparent;
}
.preview-tabs-container::-webkit-scrollbar {
    height: 3px;
}
.preview-tabs-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
}

.preview-tabs {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    flex-wrap: nowrap;
    min-width: 0;
}

.preview-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 15px 8px;
    background: transparent;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 9px 9px 0 0;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: all var(--transition-fast);
    position: relative;
    margin-bottom: -1px;
    flex-shrink: 1;
    min-width: 68px;
    max-width: 200px;
    overflow: hidden;
}

.preview-tab::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 8px;
    right: 8px;
    height: 2px;
    background: var(--accent);
    border-radius: 1px 1px 0 0;
    transform: scaleX(0);
    transition: transform var(--transition-fast);
}

.preview-tab:hover {
    color: var(--text-secondary);
    background: rgba(255,255,255,0.03);
}

.preview-tab.active {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--border-default);
    font-weight: 550;
    z-index: 1;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.25);
    padding-bottom: 9px;
    flex-shrink: 0;
}

.preview-tab.active::before {
    transform: scaleX(1);
}

.tab-title {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}

.tab-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    color: inherit;
    opacity: 0;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.tab-rename-input {
    background: var(--bg-input);
    border: 1px solid var(--accent);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    padding: 2px 7px;
    outline: none;
    flex-shrink: 1;
    min-width: 60px;
    box-shadow: 0 0 0 3px var(--accent-light);
    transition: box-shadow var(--transition-fast);
}

.preview-tab:hover .tab-close,
.preview-tab.active .tab-close {
    opacity: 0.45;
}

.tab-close:hover {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 0.1);
}

.preview-tab.active .tab-close:hover {
    background: rgba(255, 255, 255, 0.08);
}

.preview-actions {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding-bottom: 7px;
}

.preview-actions .toolbar-btn.active {
    background: var(--accent-light);
    color: var(--accent-hover);
    border-color: var(--border-accent);
}

.preview-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.preview-body {
    flex: 1;
    overflow: auto;
    padding: 28px 36px 44px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.015), transparent 40%),
        #dee1e7;
    margin: 0;
    transition: background var(--transition-slow);
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 18px;
    animation: fadeInUp 0.6s var(--ease-out-expo);
}

.preview-placeholder svg {
    animation: fadeInScale 0.6s 0.15s var(--ease-out-back) both;
}

.preview-placeholder p {
    font-size: 14px;
    animation: fadeInUp 0.5s 0.25s var(--ease-out-expo) both;
}

/* ========== Word 文档预览样式 ========== */
.docx-preview {
    width: max-content;
    min-width: 100%;
    margin: 0 auto;
    padding: 8px 0 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    color: #1a1a1a;
    background: transparent;
    font-family: 'Microsoft YaHei', 'PingFang SC', 'SimSun', 'Arial', sans-serif;
    animation: fadeInUp 0.45s var(--ease-out-expo);
}

.docx-preview-raw {
    width: 100%;
    min-width: 0;
    display: block;
    padding: 0;
}

.docx-flow {
    width: calc(var(--page-width) - var(--page-padding-left) - var(--page-padding-right));
    min-height: 0;
    margin: 0 auto;
    padding: 0;
    background: transparent;
}

.docx-explicit-page-break {
    display: block;
    width: 100%;
    height: 0;
    margin: 0;
    padding: 0;
}

.docx-page {
    width: var(--page-width);
    min-height: var(--page-height);
    padding: var(--page-padding-top) var(--page-padding-right) var(--page-padding-bottom) var(--page-padding-left);
    background: #fff;
    box-shadow:
        0 2px 4px rgba(16, 24, 40, 0.04),
        0 12px 32px rgba(16, 24, 40, 0.1);
    position: relative;
    box-sizing: border-box;
    flex-shrink: 0;
    border: 1px solid rgba(15, 23, 42, 0.05);
    border-radius: 2px;
    transition: box-shadow var(--transition-normal), transform var(--transition-normal);
    animation: fadeInUp 0.4s var(--ease-out-expo) both;
}

.docx-page:hover {
    box-shadow:
        0 4px 8px rgba(16, 24, 40, 0.06),
        0 16px 40px rgba(16, 24, 40, 0.14);
    transform: translateY(-1px);
}

.docx-page::after {
    content: attr(data-page);
    position: absolute;
    right: 18px;
    bottom: 10px;
    font-size: 11px;
    color: #8a94a6;
    letter-spacing: 0.02em;
}

.docx-page-content {
    width: 100%;
    min-height: calc(var(--page-height) - var(--page-padding-top) - var(--page-padding-bottom));
    box-sizing: border-box;
}

.docx-page * {
    box-sizing: border-box;
}

.docx-preview .docx-p {
    margin: 0;
    padding: 0;
    min-height: 1em;
    color: #111827;
    word-break: normal;
    overflow-wrap: break-word;
}

.docx-preview .docx-p br {
    display: inline;
}

.docx-table {
    width: auto;
    max-width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: inherit;
    table-layout: auto;
    background: transparent;
}

.docx-table > tbody > tr,
.docx-table > tr {
    page-break-inside: avoid;
}

.docx-table td {
    padding: 4px 6px;
    vertical-align: top;
    font-size: inherit;
    line-height: 1.4;
    word-break: break-word;
    overflow-wrap: break-word;
}

.docx-table td .docx-p {
    margin: 0;
    font-size: inherit;
    line-height: inherit;
}

.docx-preview img {
    max-width: 100%;
    height: auto;
    display: inline-block;
    vertical-align: middle;
}

.preview-body.preview-plain-mode {
    background: #eef1f5;
}

.docx-plain-output {
    width: min(980px, 100%);
    margin: 0 auto;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 14px;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.03),
        0 10px 30px rgba(15, 23, 42, 0.06);
    padding: 32px 36px;
    color: #111827;
    font-size: 14px;
    line-height: 1.75;
    animation: fadeInUp 0.4s var(--ease-out-expo);
}

.docx-plain-p {
    margin: 0 0 12px;
    color: #111827;
    word-break: break-word;
}

.docx-plain-table {
    width: 100%;
    border-collapse: collapse;
    margin: 18px 0;
    table-layout: fixed;
    background: #fff;
}

.docx-plain-table td {
    border: 1px solid #d6dce5;
    padding: 10px 12px;
    vertical-align: top;
    color: #1f2937;
    word-break: break-word;
    line-height: 1.65;
}

.docx-page .docx-table + .docx-p,
.docx-page .docx-p + .docx-table {
    margin-top: 4px;
}

/* ========== 文件插图画廊 ========== */
.file-gallery-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    color: var(--text-muted);
}

.loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-default);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.file-gallery {
    max-width: 1100px;
    margin: 0 auto;
    padding: 8px 0 24px;
}

.file-gallery-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 20px;
    padding: 0 4px;
}

.file-gallery-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
    word-break: break-word;
}

.file-gallery-count {
    font-size: 13px;
    color: #6b7280;
    white-space: nowrap;
}

.file-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.file-gallery-item {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 6px 16px rgba(15, 23, 42, 0.06);
    transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

.file-gallery-item:hover {
    box-shadow:
        0 2px 4px rgba(15, 23, 42, 0.06),
        0 12px 28px rgba(15, 23, 42, 0.1);
    transform: translateY(-2px);
}

.file-gallery-img-wrap {
    width: 100%;
    background: #f8f9fb;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    aspect-ratio: 4 / 3;
}

.file-gallery-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform var(--transition-normal);
}

.file-gallery-item:hover .file-gallery-img {
    transform: scale(1.03);
}

.file-gallery-label {
    display: block;
    padding: 10px 14px;
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: #ffffff;
    border-top: 1px solid #f3f4f6;
}

@media (max-width: 1280px) {
    .preview-body {
        padding: 16px 18px 28px;
    }
    .docx-preview {
        align-items: flex-start;
    }
}

/* ========== 右侧操作面板 ========== */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-default);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideInRight 0.45s var(--ease-out-expo) both;
}

.data-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-default);
    background: transparent;
    padding: 0 18px;
    gap: 4px;
}

.data-tab {
    padding: 11px 14px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    position: relative;
}

.data-tab::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
    transform: scaleX(0);
    transition: transform var(--transition-fast);
}

.data-tab:hover {
    color: var(--text-primary);
}

.data-tab.active {
    color: var(--accent-hover);
}

.data-tab.active::after {
    transform: scaleX(1);
}

.data-tab-content {
    display: none;
    padding: 16px 0;
    animation: fadeInUp 0.3s var(--ease-out-expo) both;
}

.data-tab-content.active {
    display: block;
}

.sidebar-section {
    border-bottom: 1px solid var(--border-light);
}

.sidebar-section:last-child {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-bottom: none;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    flex-shrink: 0;
}

.section-header h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

/* ========== 图标按钮 ========== */
.icon-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.icon-btn:hover {
    background: rgba(255,255,255,0.06);
    color: var(--danger);
    border-color: rgba(218, 54, 51, 0.2);
}

.icon-btn:active {
    transform: scale(0.94);
}

/* ========== 数据表单 ========== */
.data-form {
    padding: 0 16px 16px;
    overflow-y: auto;
    max-height: calc(100vh - var(--toolbar-height) - 300px);
}

.form-tip {
    margin-bottom: 14px;
    padding: 10px 13px;
    border: 1px solid rgba(56, 139, 253, 0.18);
    border-radius: var(--radius-md);
    background: rgba(56, 139, 253, 0.06);
    color: #9ec5ff;
    font-size: 12px;
    line-height: 1.6;
    transition: border-color var(--transition-fast);
}

.form-tip:hover {
    border-color: rgba(56, 139, 253, 0.3);
}

.form-group {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 13px 15px;
    margin-bottom: 14px;
    background: rgba(255,255,255,0.015);
    transition: border-color var(--transition-normal), background var(--transition-normal);
}

.form-group:hover {
    border-color: rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.025);
}

.form-group:focus-within {
    border-color: var(--border-accent);
    box-shadow: 0 0 0 1px var(--accent-glow);
}

.form-group legend {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 0 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
    line-height: 1;
    padding: 0;
}

.legend-refresh-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    transform: rotate(180deg);
}

.legend-refresh-btn:active {
    transform: rotate(180deg) scale(0.92);
}

.form-row {
    margin-bottom: 11px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-row.half {
    display: inline-block;
    width: calc(50% - 7px);
    margin-right: 14px;
    vertical-align: top;
}

.form-row.half:last-child,
.form-row.half:nth-child(even) {
    margin-right: 0;
}

.form-row label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 5px;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.form-group:focus-within .form-row label {
    color: var(--text-primary);
}

.form-row input,
.form-row textarea {
    width: 100%;
    padding: 8px 11px;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: all var(--transition-fast);
}

.form-row input:hover,
.form-row textarea:hover {
    border-color: rgba(255,255,255,0.15);
}

.form-row input:focus,
.form-row textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light), 0 0 12px var(--accent-glow);
    background: rgba(12, 17, 24, 0.95);
}

.form-row textarea {
    resize: vertical;
    min-height: 48px;
}

/* ========== 文件列表 ========== */
.file-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 16px;
    font-size: 12px;
}

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

.file-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-md);
    margin-bottom: 6px;
    background: rgba(255,255,255,0.025);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.file-item:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.08);
    transform: translateX(2px);
    box-shadow: var(--shadow-xs);
}

/* 缩略图容器 */
.file-thumb-wrap {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color var(--transition-fast);
}

.file-item:hover .file-thumb-wrap {
    border-color: rgba(255,255,255,0.15);
}

.file-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-muted);
}

.file-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--transition-normal);
}

.file-item:hover .file-thumb-img {
    transform: scale(1.08);
}

/* Excel 多图网格 */
.file-thumb-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    width: 100%;
    height: 100%;
    gap: 1px;
    background: var(--border-default);
}

.file-thumb-grid-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.file-thumb-more {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
}

.file-item .file-info {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.file-item .file-name {
    font-size: 12px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    margin-bottom: 3px;
    font-weight: 500;
}

.file-item .file-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
}

.file-item .file-actions {
    flex-shrink: 0;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.file-item:hover .file-actions {
    opacity: 1;
}

/* ========== 弹窗 ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    animation: modalSlideIn 0.3s var(--ease-out-expo);
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translate(-50%, -46%) scale(0.97); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 360px;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
}

.modal.modal-ai {
    max-width: 920px;
    width: 92vw;
    background: var(--bg-secondary);
    border: 1px solid rgba(56, 139, 253, 0.12);
    box-shadow:
        0 0 0 1px rgba(56, 139, 253, 0.06),
        0 24px 80px rgba(0,0,0,0.6),
        0 0 120px rgba(56, 139, 253, 0.08);
    overflow: visible;
}

/* ========== AI Modal Epic Header ========== */
.modal-ai .modal-header {
    position: relative;
    padding: 20px 24px 16px;
    border-bottom: none;
    overflow: hidden;
}

.modal-ai .modal-header::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 24px;
    right: 24px;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(56,139,253,0.25) 15%,
        rgba(56,139,253,0.5) 35%,
        rgba(88,166,255,0.35) 65%,
        rgba(56,139,253,0.1) 85%,
        transparent);
}

.modal-ai .modal-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 30%;
    width: 40%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #58a6ff, transparent);
    animation: aiHeaderSweep 3s ease-in-out infinite;
}

@keyframes aiHeaderSweep {
    0%, 100% { left: 10%; width: 30%; opacity: 0; }
    25% { left: 8%; width: 35%; opacity: 0.6; }
    50% { left: 55%; width: 35%; opacity: 1; }
    75% { left: 60%; width: 30%; opacity: 0.3; }
}

.modal-ai .modal-header h3 {
    font-size: 16px;
    font-weight: 650;
    letter-spacing: 0.02em;
    background: linear-gradient(135deg, #c8dfff 0%, #539bf5 50%, #388bfd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-ai .modal-header h3::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow), 0 0 24px rgba(56,139,253,0.3);
    animation: aiDotPulse 2s ease-in-out infinite;
}

@keyframes aiDotPulse {
    0%, 100% { box-shadow: 0 0 8px var(--accent-glow), 0 0 16px rgba(56,139,253,0.2); }
    50% { box-shadow: 0 0 18px rgba(56,139,253,0.5), 0 0 40px rgba(56,139,253,0.35); }
}

.modal-ai .modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    font-size: 16px;
    transition: all 0.3s var(--ease-out-expo);
}

.modal-ai .modal-close:hover {
    background: rgba(218, 54, 51, 0.12);
    border-color: rgba(218, 54, 51, 0.25);
    color: var(--danger);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 0 16px rgba(218, 54, 51, 0.2);
}

.modal-ai .modal-body {
    padding: 0 24px 20px;
    max-height: 62vh;
}

.modal-ai .modal-footer {
    padding: 14px 24px;
    border-top: 1px solid rgba(255,255,255,0.05);
    background: rgba(0,0,0,0.15);
}

/* ========== Epic Upload Zone ========== */
.ai-upload-zone {
    position: relative;
    border: 2px dashed rgba(56, 139, 253, 0.18);
    border-radius: 16px;
    padding: 56px 24px;
    cursor: pointer;
    text-align: center;
    background: rgba(56, 139, 253, 0.02);
    transition: all 0.4s var(--ease-out-expo);
    overflow: hidden;
}

.ai-upload-zone::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 18px;
    padding: 2px;
    background: conic-gradient(
        from 0deg,
        transparent,
        rgba(56,139,253,0.15),
        rgba(56,139,253,0.35),
        rgba(56,139,253,0.15),
        transparent
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.5s;
}

.ai-upload-zone:hover::before {
    opacity: 1;
    animation: uploadRingRotate 4s linear infinite;
}

@keyframes uploadRingRotate {
    to { transform: rotate(360deg); }
}

.ai-upload-zone:hover {
    border-color: rgba(56, 139, 253, 0.4);
    background: rgba(56, 139, 253, 0.05);
    box-shadow:
        inset 0 0 60px rgba(56,139,253,0.04),
        0 0 40px rgba(56,139,253,0.06);
    transform: scale(1.01);
}

.ai-upload-zone:active {
    transform: scale(0.985);
    transition: transform 0.1s ease;
}

.ai-upload-icon-wrap {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
    transition: transform 0.5s var(--ease-out-expo);
}

.ai-upload-zone:hover .ai-upload-icon-wrap {
    transform: translateY(-4px);
}

.ai-upload-icon-ring {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 1px solid rgba(56,139,253,0.2);
    animation: uploadRingPulse 2.5s ease-in-out infinite;
}

.ai-upload-zone:hover .ai-upload-icon-ring {
    border-color: rgba(56,139,253,0.4);
    animation-duration: 1.5s;
}

@keyframes uploadRingPulse {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.25); opacity: 0; }
}

.ai-upload-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 6px;
    transition: color 0.4s;
}

.ai-upload-zone:hover .ai-upload-title {
    color: var(--text-primary);
}

.ai-upload-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    transition: color 0.4s;
}

.ai-upload-zone:hover .ai-upload-subtitle {
    color: var(--text-secondary);
}

.ai-upload-glow {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(56,139,253,0.12), transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s;
}

.ai-upload-zone:hover .ai-upload-glow {
    opacity: 1;
}

/* ========== Epic Progress Section ========== */
.ai-progress-section {
    display: none;
    margin: 24px 0 4px;
    padding: 20px 22px;
    background: linear-gradient(135deg, rgba(15,21,28,0.8), rgba(23,30,40,0.6));
    border-radius: 14px;
    border: 1px solid rgba(56,139,253,0.1);
    position: relative;
    overflow: hidden;
}

.ai-progress-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent 30%,
        rgba(56,139,253,0.03) 45%,
        rgba(56,139,253,0.06) 50%,
        rgba(56,139,253,0.03) 55%,
        transparent 70%);
    animation: progressBgShimmer 3s ease-in-out infinite;
}

@keyframes progressBgShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.ai-progress-section.active {
    display: block;
    animation: progressReveal 0.5s var(--ease-out-expo);
}

@keyframes progressReveal {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ai-progress-bar-track {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.04);
    border-radius: 2px;
    overflow: visible;
    position: relative;
}

.ai-progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #1f6feb, #388bfd 40%, #58a6ff 65%, #79c0ff 100%);
    border-radius: 2px;
    transition: width 0.6s var(--ease-in-out);
    position: relative;
    box-shadow: 0 0 12px rgba(56,139,253,0.4), 0 0 24px rgba(56,139,253,0.2);
}

.ai-progress-bar-fill::after {
    content: '';
    position: absolute;
    right: -2px;
    top: -3px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #79c0ff;
    box-shadow:
        0 0 6px #58a6ff,
        0 0 18px rgba(56,139,253,0.6),
        0 0 36px rgba(56,139,253,0.3);
    animation: progressDotTrail 1.2s ease-in-out infinite;
}

@keyframes progressDotTrail {
    0%, 100% { box-shadow: 0 0 6px #58a6ff, 0 0 18px rgba(56,139,253,0.6), 0 0 36px rgba(56,139,253,0.3); }
    50% { box-shadow: 0 0 10px #79c0ff, 0 0 28px rgba(56,139,253,0.8), 0 0 50px rgba(56,139,253,0.45); }
}

.ai-progress-bar-fill .progress-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.progress-particle {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: #79c0ff;
    animation: particleFloat 1.5s ease-out infinite;
}

.progress-particle:nth-child(1) { left: 20%; animation-delay: 0s; }
.progress-particle:nth-child(2) { left: 40%; animation-delay: 0.3s; }
.progress-particle:nth-child(3) { left: 60%; animation-delay: 0.6s; }
.progress-particle:nth-child(4) { left: 80%; animation-delay: 0.9s; }

@keyframes particleFloat {
    0% { transform: translateY(0); opacity: 0.8; }
    50% { transform: translateY(-6px); opacity: 0.4; }
    100% { transform: translateY(-14px); opacity: 0; }
}

.ai-progress-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    font-size: 13px;
}

.ai-progress-status {
    color: var(--text-primary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-progress-status .ai-progress-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent-hover);
    box-shadow: 0 0 8px rgba(56,139,253,0.5);
    animation: pulseDot 1.2s ease-in-out infinite;
    flex-shrink: 0;
}

.ai-progress-percent {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    min-width: 42px;
    text-align: right;
    background: linear-gradient(135deg, #388bfd, #79c0ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.4s;
}

/* ========== Epic Image Grid ========== */
.ai-image-grid-horizontal {
    display: flex;
    flex-wrap: nowrap;
    gap: 18px;
    overflow-x: auto;
    padding: 4px 2px 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(56,139,253,0.15) transparent;
}

.ai-image-grid-horizontal::-webkit-scrollbar {
    height: 3px;
}

.ai-image-grid-horizontal::-webkit-scrollbar-thumb {
    background: rgba(56,139,253,0.2);
    border-radius: 2px;
}

.ai-image-card {
    flex: 0 0 220px;
    max-width: 240px;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    overflow: hidden;
    background: linear-gradient(180deg, var(--bg-elevated), var(--bg-tertiary));
    position: relative;
    transition: all 0.4s var(--ease-out-expo);
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    animation: cardReveal 0.5s var(--ease-out-back) forwards;
}

.ai-image-card:nth-child(1) { animation-delay: 0.05s; }
.ai-image-card:nth-child(2) { animation-delay: 0.1s; }
.ai-image-card:nth-child(3) { animation-delay: 0.15s; }
.ai-image-card:nth-child(4) { animation-delay: 0.2s; }
.ai-image-card:nth-child(5) { animation-delay: 0.25s; }
.ai-image-card:nth-child(6) { animation-delay: 0.3s; }

@keyframes cardReveal {
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.ai-image-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    padding: 1px;
    background: linear-gradient(180deg,
        rgba(255,255,255,0.06),
        transparent 50%,
        rgba(56,139,253,0.08));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    z-index: 1;
    pointer-events: none;
}

.ai-image-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow:
        0 12px 40px rgba(0,0,0,0.4),
        0 0 0 1px rgba(56,139,253,0.2),
        0 0 30px rgba(56,139,253,0.1);
}

.ai-image-card.processing {
    border-color: rgba(56,139,253,0.35);
    box-shadow:
        0 0 20px rgba(56,139,253,0.12),
        0 0 40px rgba(56,139,253,0.06);
    animation: cardReveal 0.5s var(--ease-out-back) forwards, cardProcessingGlow 2s ease-in-out infinite;
}

@keyframes cardProcessingGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(56,139,253,0.12), 0 0 40px rgba(56,139,253,0.06);
    }
    50% {
        box-shadow: 0 0 30px rgba(56,139,253,0.22), 0 0 60px rgba(56,139,253,0.12);
    }
}

.ai-image-card.done {
    border-color: rgba(45,164,78,0.3);
}

.ai-image-card.done::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(45,164,78,0.06), transparent 60%);
    z-index: 0;
    pointer-events: none;
}

.ai-image-card.error {
    border-color: rgba(218,54,51,0.3);
}

/* Image container */
.ai-image-card .ai-card-img-wrap {
    position: relative;
    height: 155px;
    overflow: hidden;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-image-card .ai-card-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s var(--ease-out-expo);
}

.ai-image-card:hover .ai-card-img {
    transform: scale(1.06);
}

/* Processing overlay */
.ai-card-processing-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    z-index: 2;
}

.ai-card-spinner {
    width: 28px;
    height: 28px;
    position: relative;
}

.ai-card-spinner::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.1);
    border-top-color: #79c0ff;
    animation: spin 0.7s linear infinite;
}

.ai-card-spinner::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.06);
    border-bottom-color: rgba(56,139,253,0.5);
    animation: spin 1.1s linear infinite reverse;
}

.ai-card-processing-label {
    font-size: 11px;
    color: #c0cddb;
    font-weight: 500;
    letter-spacing: 0.03em;
}

/* Badges */
.ai-card-badge {
    position: absolute;
    top: 10px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    z-index: 3;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.ai-card-badge.type {
    left: 10px;
    background: rgba(56,139,253,0.2);
    border: 1px solid rgba(56,139,253,0.3);
    color: #79c0ff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.ai-card-badge.status {
    right: 10px;
    width: 24px;
    height: 24px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.ai-card-badge.status.success {
    background: rgba(45,164,78,0.25);
    border: 1px solid rgba(45,164,78,0.4);
    animation: badgePopIn 0.4s var(--ease-out-back);
}

.ai-card-badge.status.error {
    background: rgba(218,54,51,0.25);
    border: 1px solid rgba(218,54,51,0.4);
    animation: badgePopIn 0.4s var(--ease-out-back);
}

@keyframes badgePopIn {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* Card data area */
.ai-card-data {
    padding: 12px 14px;
    font-size: 11px;
    color: var(--text-secondary);
    min-height: 48px;
    max-height: 120px;
    overflow-y: auto;
    position: relative;
    z-index: 1;
    background: linear-gradient(180deg, rgba(0,0,0,0.1), transparent);
}

.ai-card-data-status {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
}

.ai-card-data-status.pending {
    animation: statusBreathing 2s ease-in-out infinite;
}

@keyframes statusBreathing {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.ai-card-data-field {
    margin-bottom: 4px;
    display: flex;
    gap: 6px;
    animation: fieldSlideIn 0.3s var(--ease-out-expo) both;
}

.ai-card-data-field:nth-child(1) { animation-delay: 0s; }
.ai-card-data-field:nth-child(2) { animation-delay: 0.04s; }
.ai-card-data-field:nth-child(3) { animation-delay: 0.08s; }
.ai-card-data-field:nth-child(4) { animation-delay: 0.12s; }
.ai-card-data-field:nth-child(5) { animation-delay: 0.16s; }

@keyframes fieldSlideIn {
    from { opacity: 0; transform: translateX(-6px); }
    to { opacity: 1; transform: translateX(0); }
}

.ai-card-data-key {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    min-width: fit-content;
}

.ai-card-data-val {
    color: var(--text-secondary);
    word-break: break-all;
}

/* Column layout for grid */
.ai-image-grid-column {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.ai-image-grid-column .ai-image-card {
    flex: unset;
    max-width: unset;
}

/* ========== Modal shared (keep existing) ========== */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}

.modal-close {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: 60vh;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
}

.modal-btn {
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid var(--border-default);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 500;
}

.modal-btn:hover {
    background: rgba(255,255,255,0.08);
    transform: translateY(-1px);
}

.modal-btn:active {
    transform: translateY(0);
}

.modal-btn.primary {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 10px rgba(56, 139, 253, 0.3);
}

.modal-btn.primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 18px rgba(56, 139, 253, 0.45);
}

.modal-btn.danger {
    background: var(--danger);
    color: #fff;
    border-color: transparent;
}

.modal-btn.danger:hover {
    background: #e5534b;
}

/* ========== AI 识别结果 ========== */
.ai-result-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.ai-result-item .label {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 80px;
    text-align: right;
}

.ai-result-item .value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.ai-result-item .apply-btn {
    margin-left: auto;
    padding: 4px 10px;
    font-size: 11px;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.ai-result-item .apply-btn:hover {
    background: var(--accent);
    color: #fff;
}

/* ========== Toast ========== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
}

.toast {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    box-shadow: var(--shadow-md);
    animation: toastSlideIn 0.3s var(--ease-out-expo);
    max-width: 360px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info { background: var(--accent); }

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(24px) scale(0.95); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

/* ========== 下拉选择 ========== */
.custom-select {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    width: 100%;
    padding: 8px 30px 8px 11px;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    position: relative;
    transition: all var(--transition-fast);
}

.custom-select-trigger:hover {
    border-color: rgba(255,255,255,0.15);
}

.custom-select-trigger::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--text-secondary);
    transition: transform var(--transition-fast);
}

.custom-select-trigger.open::after {
    transform: translateY(-50%) rotate(180deg);
}

.custom-select-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    animation: fadeInUp 0.15s var(--ease-out-expo);
}

.custom-select-dropdown.up {
    bottom: 100%;
    margin-bottom: 4px;
}

.custom-select-dropdown.down {
    top: 100%;
    margin-top: 4px;
}

.custom-select-option {
    padding: 8px 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    transition: background var(--transition-fast);
}

.custom-select-option:hover {
    background: var(--accent-light);
    color: var(--accent-hover);
}

.custom-select-option.selected {
    background: var(--accent-light);
    color: var(--accent-hover);
    font-weight: 500;
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.15);
}

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
    .preview-panel {
        height: 50%;
    }
    .sidebar {
        width: 100%;
        min-width: unset;
        height: 50%;
        border-left: none;
        border-top: 1px solid var(--border-default);
    }
}
