:root {
    color-scheme: light dark;
    --red-500: #d4382a;
    --gray-100: #f6f6f8;
    --gray-200: #e8e8ef;
    --gray-400: #b6bdc5;
    --gray-700: #3b4552;
    --gray-900: #1e2430;
    --green-500: #1f8a53;
    --yellow-500: #f7a046;
    --blue-500: #2584e3;
    font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

body {
    margin: 0;
    background: var(--gray-100);
    color: var(--gray-900);
    font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

a {
    color: var(--blue-500);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    background: linear-gradient(90deg, #d4382a 0%, #b52c21 100%);
    color: #fff;
    box-shadow: 0 12px 28px rgba(30, 36, 48, 0.2);
}

.app-header-inner {
    width: min(1200px, 100%);
    margin: 0 auto;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}

.brand {
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    letter-spacing: 0.5px;
    transition: background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.brand:hover {
    text-decoration: none;
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.brand:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(6px);
}

.nav-item {
    color: rgba(255, 255, 255, 0.88);
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 10px;
    text-align: left;
    cursor: pointer;
    transition: border 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-item.active,
.nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.22);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.app-content {
    flex: 1;
    padding: 1em 1em;
    box-sizing: border-box;
    background: linear-gradient(180deg, rgba(246, 246, 248, 0.96) 0%, #eef1f6 120%);
}

.app-content-inner {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.content-card {
    width: 100%;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 48px rgba(30, 36, 48, 0.12);
    padding: 24px 28px;
    box-sizing: border-box;
    border: 1px solid rgba(232, 232, 239, 0.9);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-content-card {
    padding: 20px 24px;
    gap: 12px;
}

.landing-header h1 {
    margin: 0;
    font-size: 32px;
    font-weight: 700;
}

.landing-header {
    border-bottom: 1px solid rgba(232, 232, 239, 0.9);
    padding-bottom: 16px;
}

.landing-grid {
    margin-top: 32px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
}

.landing-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 24px;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f4f7fc 100%);
    border: 1px solid rgba(37, 132, 227, 0.18);
    color: inherit;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.landing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 24px rgba(37, 132, 227, 0.18);
    background: linear-gradient(180deg, #ffffff 0%, #e9f2ff 100%);
}

.landing-card h2 {
    margin: 0;
    font-size: 24px;
}

.landing-card p {
    margin: 0;
    color: var(--gray-700);
    font-size: 15px;
}

.landing-card .card-icon {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
}

.landing-card .card-action {
    margin-top: auto;
    color: var(--blue-500);
    font-weight: 600;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.card-header h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
}

.card-subtitle {
    margin: 6px 0 0;
    color: #5f6677;
    font-size: 15px;
}

button.primary,
button.secondary,
.link-button {
    border: none;
    cursor: pointer;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 15px;
    font-weight: 500;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

button.small {
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 6px;
}

button.primary {
    background: var(--red-500);
    color: #fff;
    box-shadow: 0 8px 16px rgba(212, 56, 42, 0.25);
}

button.primary:disabled {
    background: rgba(212, 56, 42, 0.4);
    cursor: not-allowed;
    box-shadow: none;
}

button.secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

button.primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 20px rgba(212, 56, 42, 0.32);
}

button.secondary:hover {
    transform: translateY(-1px);
}

.link-button {
    background: transparent;
    color: var(--blue-500);
    padding: 0;
}

.state-message {
    margin-top: 32px;
    padding: 18px 20px;
    border-radius: 12px;
    background: var(--gray-200);
    color: var(--gray-700);
    border: 1px solid rgba(230, 232, 240, 0.9);
}

.state-message.error {
    background: rgba(212, 56, 42, 0.12);
    color: var(--red-500);
    border-color: rgba(212, 56, 42, 0.24);
}

.list-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--gray-700);
}

.list-toolbar .filter-select {
    min-width: 140px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    background: #fff;
    color: inherit;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 24px;
    font-size: 15px;
    background: #fff;
    border: 1px solid rgba(232, 232, 239, 0.9);
    border-radius: 12px;
    overflow: hidden;
}

.data-table thead th {
    text-align: left;
    padding: 12px 16px;
    background: #f6f7fb;
    color: var(--gray-700);
    font-weight: 600;
}

.data-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-200);
}

.data-table tbody tr:hover {
    background: rgba(37, 132, 227, 0.12);
}

.table-footer {
    margin-top: 16px;
    color: var(--gray-700);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-info {
    font-weight: 600;
    color: var(--gray-700);
}

button.page-button {
    border: none;
    background: rgba(232, 232, 239, 0.9);
    color: var(--gray-700);
    padding: 8px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.1s ease;
}

button.page-button:hover:not(:disabled) {
    background: rgba(37, 132, 227, 0.15);
    color: var(--blue-500);
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(37, 132, 227, 0.18);
}

button.page-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--gray-200);
    color: var(--gray-700);
    font-size: 13px;
    font-weight: 600;
}

.status-cell {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.status-reason {
    font-size: 12px;
    color: var(--gray-700);
    font-weight: 400;
    line-height: 1.4;
}

.status-reason-danger {
    color: var(--red-500);
}

.task-overview .status-cell {
    margin-left: 8px;
}

.chip-success {
    background: rgba(31, 138, 83, 0.18);
    color: var(--green-500);
}

.chip-warning {
    background: rgba(247, 160, 70, 0.18);
    color: var(--yellow-500);
}

.chip-danger {
    background: rgba(212, 56, 42, 0.1);
    color: var(--red-500);
}

.chip-warning.chip {
    color: var(--yellow-500);
}

.task-overview {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin: 12px 0 16px;
    background: var(--gray-200);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 13px;
}

.task-overview .overview-item {
    margin: 4px 0;
    color: var(--gray-700);
}

.task-overview span {
    font-weight: 600;
    font-size: 13px;
}


.detail-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    align-items: flex-start;
}

.detail-panel {
    background: var(--gray-200);
    border-radius: 12px;
    padding: 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.detail-panel h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.docs-panel {
    gap: 20px;
}

.doc-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.docs-preview-card {
    padding: 20px 24px;
    gap: 16px;
}

.docs-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.docs-preview-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    grid-template-rows: auto minmax(420px, 1fr) auto;
    column-gap: 20px;
    row-gap: 12px;
    align-items: flex-start;
}

.docs-preview-layout .doc-list {
    flex-direction: column;
    align-items: stretch;
    grid-row: 1 / span 3;
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    padding-right: 6px;
}

.docs-preview-layout .doc-item {
    width: 100%;
}

.doc-item {
    background: #fff;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 16px;
    text-align: left;
    cursor: pointer;
    transition: border 0.2s ease, box-shadow 0.2s ease;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 12px;
}

.docs-preview-layout .file-strip {
    grid-column: 2;
    grid-row: 1;
    margin-top: 0;
}

.docs-preview-layout .preview-viewer {
    grid-column: 2;
    grid-row: 2;
    height: clamp(420px, 65vh, 820px);
}

.docs-preview-layout .preview-summary {
    grid-column: 2;
    grid-row: 3;
}

.docs-preview-layout>.link-button {
    grid-column: 2;
    justify-self: flex-start;
}

.file-strip {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 4px;
}

.file-item {
    border: 1px solid transparent;
    background: #fff;
    padding: 4px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    min-width: 60px;
    cursor: pointer;
}

.file-item img {
    max-width: 52px;
    max-height: 52px;
    border-radius: 6px;
    display: block;
}

.file-item.active {
    box-shadow: 0 6px 16px rgba(37, 132, 227, 0.18);
    border-color: rgba(37, 132, 227, 0.2);
}

.file-item .file-name {
    font-size: 12px;
    color: var(--gray-700);
    text-align: center;
    display: block;
}

.doc-item .doc-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(37, 132, 227, 0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--blue-500);
    flex: 0 0 36px;
}

.doc-item .doc-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.doc-item .doc-title {
    font-weight: 600;
    color: inherit;
}

.doc-item:hover {
    border-color: var(--blue-500);
    box-shadow: 0 6px 18px rgba(37, 132, 227, 0.25);
}

.doc-item.active {
    border-color: var(--blue-500);
    box-shadow: 0 8px 18px rgba(37, 132, 227, 0.2);
}

.doc-item.active .doc-title {
    color: var(--blue-500);
}

.doc-item.active .doc-icon {
    background: var(--blue-500);
    color: #fff;
}

.docs-panel .link-button {
    align-self: flex-start;
}

.preview-viewer {
    flex: 1;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--gray-200);
    min-height: 320px;
    height: clamp(320px, calc(100vh - 240px), 960px);
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.preview-summary {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    color: var(--gray-700);
}

.summary-line span {
    font-weight: 600;
    margin-right: 6px;
}

.preview-viewer img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    margin-top: 0;
}

.preview-viewer iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}

.detail-table {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #fff;
}

.detail-table.detail-panel {
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--gray-200);
}

.detail-grid-wrapper {
    width: 100%;
}

.detail-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.save-message {
    color: var(--gray-700);
    font-size: 14px;
}

.detail-grid {
    border-collapse: collapse;
    width: 100%;
    font-size: 13px;
    table-layout: fixed;
}



.export-actions {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.export-actions button {
    min-width: 120px;
}

.detail-grid th,
.detail-grid td {
    border: 1px solid var(--gray-200);
    padding: 4px 6px;
    vertical-align: top;
    line-height: 1.3;
    word-break: break-all;
}

.detail-grid thead th {
    background: var(--blue-500);
    color: #fff;
    font-weight: 600;
    text-align: left;
    padding: 6px 8px;
    font-size: 12px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.detail-grid .difference {
    background: rgba(212, 56, 42, 0.12);
    color: var(--red-500);
}

.detail-grid input.difference-input,
.detail-grid textarea.difference-input {
    background: rgba(212, 56, 42, 0.12);
    border-color: rgba(212, 56, 42, 0.28);
    color: var(--red-500);
}

.detail-grid .difference-row {
    background: rgba(212, 56, 42, 0.06);
}

.detail-grid .field-name {
    width: 120px;
    font-weight: 600;
}



.detail-grid .treatment-col {
    width: 140px;
}

.detail-grid .reason-col {
    width: 18%;
}

.system-value-cell,
.system-value-input,
.treatment-value-input,
.treatment-reason-input {
    background: #fff;
}

.system-value-input,
.treatment-value-input,
.treatment-reason-input {
    color: #111;
}

.doc-value-cell {
    transition: background 0.2s ease;
}

.doc-value-cell.match {
    background: #e6f5ec;
    color: var(--green-500);
}

.doc-value-input.match-input,
textarea.doc-value-input.match-input {
    background: #e6f5ec;
    border-color: rgba(31, 138, 83, 0.35);
    color: var(--green-500);
}

.treatment-input {
    width: 100%;
}

.detail-grid .input,
.detail-grid .treatment-input {
    padding: 4px 6px;
    font-size: 12px;
    min-height: 28px;
}

.treatment-input.treatment-done {
    background: #e5f4ef;
    border-color: rgba(31, 138, 83, 0.45);
    color: var(--green-500);
}

.treatment-input.treatment-wait {
    background: #fff6e1;
    border-color: rgba(247, 181, 0, 0.45);
    color: #946200;
}

.treatment-input.treatment-ignore {
    background: #f2f4f7;
    border-color: rgba(15, 23, 42, 0.1);
    color: var(--gray-700);
}

.treatment-input.treatment-none,
.treatment-input.treatment-unknown {
    background: #fff;
    color: var(--gray-700);
}

.input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    box-sizing: border-box;
}

.detail-grid textarea.input {
    resize: vertical;
    font-family: inherit;
    font-size: inherit;
    line-height: 1.4;
}

.ocr-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.ocr-files {
    flex: 2 1 0%;
    background: var(--gray-200);
    border-radius: 12px;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 220px;
}

.ocr-files h2 {
    margin: 0 0 4px 0;
}

.ocr-files .file-input-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    border: 2px dashed var(--gray-400);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.ocr-files .file-input-wrapper:hover {
    border-color: var(--blue-400);
    background: rgba(37, 132, 227, 0.04);
}

.ocr-files .file-input-wrapper .file-input-icon {
    width: 36px;
    height: 36px;
    margin-bottom: 8px;
    color: var(--blue-500);
}

.ocr-files .file-input-wrapper .file-input-text {
    font-size: 14px;
    color: var(--gray-700);
    text-align: center;
}

.ocr-files .file-input-wrapper .file-input-text strong {
    color: var(--blue-500);
}

.ocr-files .file-input-wrapper input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.ocr-files .file-list {
    margin-top: 8px;
}

.ocr-preview-panel {
    flex: 3 1 0%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.file-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
}

.file-list li {
    padding: 0;
    list-style: none;
}

.file-list .placeholder {
    color: var(--gray-700);
    font-style: italic;
    padding: 8px 2px;
}

.file-item {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    color: inherit;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    transition: border 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.file-item:hover {
    border-color: rgba(37, 132, 227, 0.4);
    box-shadow: 0 8px 16px rgba(37, 132, 227, 0.18);
    transform: translateY(-1px);
}

.file-item.active {
    border-color: var(--blue-500);
    box-shadow: 0 10px 20px rgba(37, 132, 227, 0.2);
}

.file-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-meta {
    font-size: 12px;
    color: var(--gray-700);
}

.ocr-result {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: inset 0 0 0 1px var(--gray-200);
    flex: 5 1 0%;
    min-width: 320px;
}

.ocr-result .detail-grid thead th {
    background: var(--blue-500);
    color: #fff;
}

.ocr-result .detail-grid th:first-child,
.ocr-result .detail-grid td:first-child {
    width: 48px;
    min-width: 48px;
    max-width: 48px;
    text-align: center;
}

.ocr-preview {
    border-radius: 12px;
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--gray-200);
    padding: 12px;
    min-height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ocr-files button.primary {
    margin-top: 4px;
}

.ocr-preview img {
    max-width: 100%;
    max-height: 360px;
    border-radius: 8px;
    object-fit: contain;
}

.ocr-preview iframe {
    width: 100%;
    height: 360px;
    border: none;
    border-radius: 8px;
    background: #fff;
}

.preview-placeholder {
    color: var(--gray-700);
    font-size: 14px;
    text-align: center;
    padding: 12px;
}

.ocr-summary {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
    color: var(--gray-700);
}

.ocr-summary span {
    font-weight: 600;
}

@media (max-width: 1024px) {
    .app-content {
        padding: 32px 18px 56px;
    }

    .app-header-inner {
        padding: 0 12px;
    }

    .content-card {
        padding: 28px;
    }

    .detail-layout {
        display: flex;
        flex-direction: column;
    }

    .detail-panel {
        width: 100%;
        max-width: 100%;
    }

    .detail-grid {
        min-width: 600px;
    }

    .detail-grid-wrapper {
        overflow-x: auto;
        overflow-y: visible;
    }

    .ocr-layout,
    .task-overview {
        flex-direction: column;
    }

    .detail-panel,
    .ocr-files,
    .ocr-preview-panel,
    .ocr-result {
        width: 100%;
    }

    .preview-viewer {
        height: 360px;
    }

    .ocr-preview {
        min-height: 260px;
    }

    .ocr-preview iframe {
        height: 300px;
    }

    .docs-preview-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto minmax(0, 1fr) auto auto !important;
        gap: 12px;
        overflow-y: hidden !important;
        overflow-x: hidden;
        height: 100%;
        padding: 12px;
    }

    .docs-preview-layout .doc-list {
        grid-row: 1;
        grid-column: 1;
        flex-direction: row;
        flex-wrap: nowrap;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;

        background: #fff;
        margin: -12px -12px 0 -12px;
        padding: 12px 12px 8px 12px;
        width: calc(100% + 24px);
        border-bottom: 1px solid var(--gray-200);
    }

    .docs-preview-layout .doc-item {
        width: auto;
        white-space: nowrap;
    }

    .docs-preview-layout .file-strip {
        grid-row: 2;
        grid-column: 1;
        margin-top: 0;
    }

    .docs-preview-layout .preview-viewer {
        grid-row: 3;
        grid-column: 1;
        height: 100% !important;
        min-height: 0;
    }

    .docs-preview-layout .preview-summary {
        grid-row: 4;
        grid-column: 1;
    }

    .docs-preview-layout>.link-button {
        grid-row: 5;
        grid-column: 1;
    }
}