:root {
    --cream: #F9F7F5;
    --cream-dark: #F0EDE8;
    --warm-gray: #E8E4DE;
    --charcoal: #2D2D2D;
    --accent: #D4A373;
    --accent-dark: #B8956A;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Microsoft YaHei", "PingFang SC", sans-serif;
    background: var(--cream);
    color: var(--charcoal);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* === Top Bar === */
.topbar {
    background: var(--charcoal);
    color: var(--cream);
    padding: 0 20px;
    height: 52px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    z-index: 10;
}

.topbar-brand {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
    white-space: nowrap;
    color: var(--accent);
}

.topbar-github {
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    transition: color 0.15s;
}

.topbar-github:hover {
    color: #fff;
}

.topbar-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.15);
}

.topbar-filename {
    font-size: 14px;
    opacity: 0.7;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.topbar-delete-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: all 0.15s;
    flex-shrink: 0;
}
.topbar-delete-btn:hover {
    color: #DC2626;
    background: rgba(220, 38, 38, 0.15);
}

.topbar-spacer {
    flex: 1;
}

.topbar-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    opacity: 0.6;
    white-space: nowrap;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
    flex-shrink: 0;
}

.status-dot.online {
    background: #6DBF7B;
}

.status-dot.loading {
    background: var(--accent);
    animation: pulse 1s infinite;
}

.status-dot.error {
    background: #DC2626;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.35;
    }
}

.topbar-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.topbar-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.topbar-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.topbar-btn.primary {
    background: var(--accent);
    color: #fff;
}

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

.topbar-btn.danger {
    background: #DC2626;
    color: #fff;
    border: none;
}

.topbar-btn.danger:hover {
    background: #B91C1C;
}

/* === Main Layout === */
.main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* === Left Panel (Page List) === */
.panel-left {
    width: 200px;
    background: #fff;
    border-right: 1px solid var(--warm-gray);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.panel-left.hidden {
    display: none;
}

.panel-header {
    padding: 12px 14px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(45, 45, 45, 0.45);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--cream-dark);
    flex-shrink: 0;
}

/* === Document List === */
.doc-list-section {
    display: flex;
    flex-direction: column;
    max-height: 45%;
    flex-shrink: 0;
    transition: max-height 0.2s ease;
}

.doc-list-section.collapsed {
    max-height: none;
    flex-shrink: 0;
}

.doc-list-section.collapsed .doc-list {
    display: none;
}

.doc-list-header {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.panel-header-spacer {
    flex: 1;
}

.doc-list-count {
    font-size: 10px;
    font-weight: 500;
    color: rgba(45, 45, 45, 0.35);
}

.doc-list-toggle {
    background: none;
    border: none;
    font-size: 10px;
    color: rgba(45, 45, 45, 0.35);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.15s;
    line-height: 1;
}

.doc-list-toggle:hover {
    color: var(--charcoal);
    background: var(--cream);
}

.doc-list-section.collapsed .doc-list-toggle {
    transform: rotate(180deg);
}

.doc-list {
    overflow-y: auto;
    padding: 4px 8px;
}

.doc-item {
    padding: 6px 8px;
    border-radius: 0.75rem;
    cursor: pointer;
    margin-bottom: 2px;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.doc-item:hover {
    background: var(--cream);
}

.doc-item.active {
    background: var(--cream-dark);
    outline: 2px solid var(--accent);
}

.doc-item-info {
    min-width: 0;
    flex: 1;
}

.doc-item-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--charcoal);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doc-item-meta {
    font-size: 10px;
    color: rgba(45, 45, 45, 0.4);
    margin-top: 1px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.doc-item-badge {
    font-size: 10px;
    font-weight: 500;
    color: var(--accent-dark);
    background: var(--cream-dark);
    padding: 0 5px;
    border-radius: 0.25rem;
    white-space: nowrap;
}

.doc-item-delete {
    background: none;
    border: none;
    font-size: 14px;
    color: rgba(45, 45, 45, 0.25);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.15s;
    flex-shrink: 0;
    line-height: 1;
}

.doc-item:hover .doc-item-delete {
    opacity: 1;
}

.doc-item-delete:hover {
    color: #DC2626;
    background: rgba(220, 38, 38, 0.08);
}

.panel-divider {
    height: 1px;
    background: var(--warm-gray);
    flex-shrink: 0;
}

.page-list-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.page-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.page-thumb {
    padding: 6px;
    border-radius: 0.75rem;
    cursor: pointer;
    margin-bottom: 4px;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-thumb:hover {
    background: var(--cream);
}

.page-thumb.active {
    background: var(--cream-dark);
    outline: 2px solid var(--accent);
}

.page-thumb img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 0.5rem;
    background: var(--cream);
    flex-shrink: 0;
}

.page-thumb-info {
    min-width: 0;
    flex: 1;
}

.page-thumb-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--charcoal);
}

.page-thumb-status {
    font-size: 11px;
    color: rgba(45, 45, 45, 0.4);
    margin-top: 2px;
}

.page-thumb-status.done {
    color: #6DBF7B;
}

.page-thumb-status.running {
    color: var(--accent);
}

.page-thumb-status.error {
    color: #DC2626;
}

/* === Center Panel (Preview / Upload) === */
.panel-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cream);
    overflow: hidden;
    position: relative;
}

.upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--warm-gray);
    border-radius: 1rem;
    padding: 60px 40px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    max-width: 420px;
    width: 80%;
}

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

.upload-zone.dragover {
    border-color: var(--accent);
    background: var(--cream-dark);
}

.upload-zone svg {
    width: 56px;
    height: 56px;
    stroke: var(--accent);
    opacity: 0.6;
    margin-bottom: 16px;
}

.upload-zone p {
    color: var(--charcoal);
    font-size: 15px;
    margin-bottom: 6px;
}

.upload-zone small {
    color: rgba(45, 45, 45, 0.4);
    font-size: 12px;
}

.upload-zone.hidden {
    display: none;
}

.preview-container {
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 16px;
}

.preview-container.show {
    display: flex;
}

.preview-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
    max-height: 100%;
}

.preview-wrap img {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 100px);
    object-fit: contain;
    border-radius: 0.75rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.bbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.bbox-rect {
    position: absolute;
    border: 2px solid var(--accent);
    border-radius: 4px;
    opacity: 0;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.15s;
}

.bbox-rect:hover {
    opacity: 0.5;
    background: rgba(212, 163, 115, 0.1);
}

.bbox-rect.active {
    opacity: 0.8;
    background: rgba(212, 163, 115, 0.15);
    border-width: 3px;
}

/* Region blocks in right panel */
.region-block {
    cursor: pointer;
    transition: background 0.15s;
    border-radius: 4px;
}

.region-block.active {
    background: rgba(212, 163, 115, 0.12);
}

.region-label {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--accent-dark);
    background: var(--cream-dark);
    padding: 1px 6px;
    border-radius: 0.25rem;
    margin-bottom: 4px;
}

.region-text {
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-line;
    word-break: break-all;
}

.region-text table {
    border-collapse: collapse;
    width: 100%;
    margin: 4px 0;
    white-space: normal;
    word-break: normal;
}

.region-text th,
.region-text td {
    border: 1px solid var(--warm-gray);
    padding: 4px 8px;
    text-align: left;
    font-size: 13px;
}

.region-text th {
    background: var(--cream-dark);
    font-weight: 600;
}

/* === Resize Handle === */
.resize-handle {
    width: 5px;
    cursor: col-resize;
    background: transparent;
    flex-shrink: 0;
    position: relative;
    z-index: 5;
    margin-left: -3px;
    margin-right: -2px;
    transition: background 0.15s;
}

.resize-handle:hover,
.resize-handle.dragging {
    background: var(--accent);
}

.resize-handle.hidden {
    display: none;
}

/* === Right Panel (OCR Result) === */
.panel-right {
    width: 480px;
    background: #fff;
    border-left: 1px solid var(--warm-gray);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.panel-right.hidden {
    display: none;
}

.result-header {
    padding: 8px 14px;
    border-bottom: 1px solid var(--cream-dark);
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.result-header-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-header-title {
    font-size: 11px;
    font-weight: 600;
    color: rgba(45, 45, 45, 0.45);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-header-spacer {
    flex: 1;
}

.result-time {
    font-size: 11px;
    color: var(--accent-dark);
    background: var(--cream-dark);
    padding: 2px 8px;
    border-radius: 0.5rem;
}

.copy-btn {
    padding: 0.35rem 0.75rem;
    border: none;
    border-radius: 0.5rem;
    background: var(--warm-gray);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    color: var(--charcoal);
    transition: all 0.15s;
}

.copy-btn:hover {
    background: var(--cream-dark);
}

.result-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.result-placeholder {
    color: rgba(45, 45, 45, 0.3);
    text-align: center;
    padding-top: 60px;
    font-size: 14px;
}

.result-editor {
    flex: 1;
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    padding: 16px;
    font-family: "Consolas", "Monaco", "Courier New", monospace;
    font-size: 14px;
    line-height: 1.7;
    color: var(--charcoal);
    background: #fff;
    white-space: pre-wrap;
    word-break: break-all;
}

.result-editor::placeholder {
    color: rgba(45, 45, 45, 0.25);
}

.result-editor.hidden {
    display: none;
}

.result-preview {
    flex: 1;
    width: 100%;
    padding: 16px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--charcoal);
    overflow-y: auto;
    white-space: pre-line;
    word-break: break-all;
}

.result-preview.hidden {
    display: none;
}

.result-preview table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
    white-space: normal;
    word-break: normal;
}

.result-preview th,
.result-preview td {
    border: 1px solid var(--warm-gray);
    padding: 6px 10px;
    text-align: left;
    font-size: 13px;
}

.result-preview th {
    background: var(--cream-dark);
    font-weight: 600;
}

.result-preview tr:hover {
    background: var(--cream);
}

.result-preview h1,
.result-preview h2,
.result-preview h3 {
    margin: 12px 0 6px 0;
    white-space: normal;
}

.result-preview h1 {
    font-size: 1.4em;
}

.result-preview h2 {
    font-size: 1.2em;
}

.result-preview h3 {
    font-size: 1.1em;
}

.result-preview p {
    margin: 0 0 4px 0;
    white-space: pre-line;
}

/* View toggle */
.view-toggle {
    display: flex;
    background: var(--cream-dark);
    border-radius: 0.5rem;
    padding: 2px;
    gap: 2px;
}

.view-btn {
    padding: 3px 10px;
    border: none;
    border-radius: 0.375rem;
    background: transparent;
    font-size: 11px;
    font-weight: 500;
    color: rgba(45, 45, 45, 0.5);
    cursor: pointer;
    transition: all 0.15s;
}

.view-btn:hover {
    color: var(--charcoal);
}

.view-btn.active {
    background: #fff;
    color: var(--charcoal);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.result-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 60px;
    color: rgba(45, 45, 45, 0.5);
    font-size: 13px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--warm-gray);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

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

.result-error {
    color: #DC2626;
    background: #FEE2E2;
    padding: 12px;
    margin: 16px;
    border-radius: 0.75rem;
    font-size: 13px;
}

/* === Layout toggle === */
.layout-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
}

.layout-switch {
    position: relative;
    width: 32px;
    height: 18px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 9px;
    cursor: pointer;
    transition: background 0.2s;
}

.layout-switch.on {
    background: var(--accent);
}

.layout-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.layout-switch.on::after {
    transform: translateX(14px);
}

/* === Progress bar === */
.ocr-progress {
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.ocr-progress-bar {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s ease;
    border-radius: 0 2px 2px 0;
}

/* === Export dropdown === */
.export-wrap {
    position: relative;
    display: inline-block;
}

.export-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
    padding: 4px;
    z-index: 100;
    min-width: 170px;
}

.export-menu.show {
    display: block;
}

.export-item {
    padding: 8px 14px;
    cursor: pointer;
    border-radius: 0.5rem;
    font-size: 13px;
    color: var(--charcoal);
    white-space: nowrap;
    transition: background 0.1s;
}

.export-item:hover {
    background: var(--cream);
}

/* === Search === */
.search-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}

.search-toggle {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}

.search-toggle:hover {
    color: #fff;
}

.search-toggle.active {
    color: var(--accent);
}

.search-input {
    width: 0;
    padding: 0;
    border: none;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
}

.search-input.open {
    width: 160px;
    padding: 5px 10px;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.search-info {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
}

.search-nav-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
}

.search-nav-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.search-nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.page-thumb.search-miss {
    opacity: 0.35;
}

.page-thumb .search-badge {
    font-size: 10px;
    color: var(--accent-dark);
    background: var(--cream-dark);
    padding: 0 5px;
    border-radius: 0.25rem;
    margin-left: 4px;
}

mark {
    background: #FBBF24;
    color: var(--charcoal);
    border-radius: 2px;
    padding: 0 1px;
}

mark.current {
    background: #F97316;
    color: #fff;
}

/* === Hidden file input === */
#fileInput {
    display: none;
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--warm-gray);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

/* === Toast notifications === */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 8px 20px;
    border-radius: 0.75rem;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    pointer-events: auto;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-error {
    background: #DC2626;
}

.toast-warn {
    background: #D97706;
}

.toast-success {
    background: #059669;
}
/* === AI Toolbar === */
.result-ai-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-top: 1px solid var(--cream-dark);
    flex-wrap: wrap;
}

.ai-btn {
    padding: 4px 10px;
    border: 1px solid var(--warm-gray);
    border-radius: 0.5rem;
    background: #fff;
    color: var(--charcoal);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.ai-btn:hover {
    background: var(--cream);
    border-color: var(--accent);
}

.ai-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ai-btn.json-btn {
    border-color: #3b82f6;
    color: #1d4ed8;
}

.ai-btn.json-btn:hover {
    background: #eff6ff;
}

.ai-btn.html-btn {
    border-color: #f59e0b;
    color: #b45309;
}

.ai-btn.html-btn:hover {
    background: #fffbeb;
}

.lang-select {
    padding: 4px 8px;
    font-size: 11px;
    border: 1px solid var(--warm-gray);
    border-radius: 0.5rem;
    background: #fff;
    color: var(--charcoal);
    cursor: pointer;
    appearance: auto;
}

/* === Mobile Tab Bar === */
.mobile-tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--charcoal);
    display: flex;
    align-items: stretch;
    z-index: 100;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.mobile-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.45);
    font-size: 10px;
    cursor: pointer;
    transition: all 0.15s;
    padding: 4px;
}

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

.mobile-tab-icon {
    font-size: 18px;
    line-height: 1;
}

/* === Mobile Responsive === */
@media (max-width: 768px) {
    body {
        overflow: auto;
        height: auto;
        min-height: 100vh;
        padding-bottom: 60px;
    }

    .topbar {
        height: auto;
        min-height: 44px;
        padding: 6px 10px;
        gap: 6px;
        flex-wrap: wrap;
    }

    .topbar-brand {
        font-size: 15px;
    }

    .topbar-filename {
        font-size: 12px;
        max-width: 120px;
    }

    .topbar-btn {
        padding: 5px 10px;
        font-size: 12px;
    }

    .topbar-status {
        font-size: 11px;
    }

    .search-wrap {
        order: 99;
        width: 100%;
    }

    .search-input.open {
        width: 100%;
    }

    .main {
        flex-direction: column;
        overflow: auto;
    }

    .panel-left {
        width: 100%;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid var(--warm-gray);
    }

    .panel-left.hidden {
        display: none;
    }

    /* 移动端面板切换 */
    .panel-left.mobile-hidden {
        display: none !important;
    }

    .panel-center {
        flex: none;
        min-height: 300px;
    }

    .panel-center.mobile-hidden {
        display: none !important;
    }

    .resize-handle {
        display: none !important;
    }

    .panel-right {
        width: 100% !important;
        min-width: 0;
        border-left: none;
        border-top: 1px solid var(--warm-gray);
    }

    .panel-right.hidden {
        display: none;
    }

    .panel-right.mobile-hidden {
        display: none !important;
    }

    .page-list {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        padding: 6px;
    }

    .page-thumb {
        padding: 4px;
        margin-bottom: 0;
        flex: 0 0 auto;
    }

    .page-thumb img {
        width: 36px;
        height: 36px;
    }

    .page-thumb-info {
        min-width: 0;
    }

    .page-thumb-label {
        font-size: 10px;
    }

    .page-thumb-status {
        font-size: 9px;
    }

    .upload-zone {
        padding: 30px 20px;
    }

    .upload-zone p {
        font-size: 14px;
    }

    .result-header-row {
        flex-wrap: wrap;
        gap: 4px;
    }

    .result-ai-toolbar {
        padding: 6px 10px;
        gap: 4px;
    }

    .ai-btn {
        font-size: 10px;
        padding: 4px 8px;
    }

    .result-editor {
        font-size: 13px;
        min-height: 200px;
    }

    .export-menu {
        right: 0;
        left: auto;
    }

    .doc-list-section {
        max-height: 120px;
    }

    .layout-toggle,
    .ocr-progress {
        display: flex;
    }

    .toast-container {
        bottom: 70px;
    }
}

@media (max-width: 480px) {
    .topbar {
        padding: 4px 8px;
        gap: 4px;
    }

    .topbar-brand {
        font-size: 13px;
    }

    .topbar-filename {
        max-width: 80px;
        font-size: 11px;
    }

    .topbar-btn {
        padding: 4px 8px;
        font-size: 11px;
    }

    .page-thumb img {
        width: 30px;
        height: 30px;
    }
}

/* === Mobile Upload Buttons === */
.upload-mobile-hint {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
}

.mobile-upload-btn {
    padding: 10px 18px;
    border: 1.5px solid var(--accent);
    border-radius: 1rem;
    background: #fff;
    color: var(--charcoal);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.mobile-upload-btn:hover,
.mobile-upload-btn:active {
    background: var(--cream-dark);
    border-color: var(--accent-dark);
}

@media (max-width: 768px) {
    .upload-mobile-hint {
        display: flex;
    }

    .upload-zone p {
        font-size: 13px;
    }

    .upload-zone small {
        font-size: 11px;
    }

    .upload-zone input[type="file"] {
        /* 隐藏默认 file input，用按钮代替 */
        position: absolute;
        width: 1px;
        height: 1px;
        opacity: 0;
    }
}
