/* 工作区：校验抬头、重复发票警告、发票文件夹 */
:root { --warn: #ffc857; --warn-bg: rgba(255, 200, 87, 0.1); --warn-border: rgba(255, 200, 87, 0.55); }

/* 动态弹窗叠在上传确认等弹窗之上；确认/输入框永远在最上层 */
.workspace-modal { z-index: 1100; }
#duplicate-modal { z-index: 1250; }
#confirm-modal, #input-modal, #password-modal { z-index: 1300; }
.workspace-modal .modal-container { width: min(640px, 94vw); max-height: 90vh; overflow-y: auto; }
.workspace-hint { color: #b7abc9; font-size: 14px; line-height: 1.7; margin: 14px 0 18px; }
.workspace-error { color: #ffadad; font-size: 14px; min-height: 1.4em; overflow-wrap: anywhere; }
.workspace-empty { color: #9a8eae; text-align: center; padding: 18px 0; }
.btn-compact { padding: 8px 12px; font-size: 13px; white-space: nowrap; }
/* 确认框消息按行显示（批量删除会列出文件名），过长时在框内滚动 */
.confirm-message { white-space: pre-line; overflow-wrap: anywhere; max-height: 50vh; overflow-y: auto; }
.btn-danger-outline { background: transparent; color: #ff8d8d; border: 1px solid rgba(255, 93, 93, 0.55); }
.btn-danger-outline:hover:not(:disabled) { background: rgba(255, 93, 93, 0.12); }
.btn-warning { background: transparent; color: var(--warn); border: 1px solid var(--warn-border); }
.btn-warning:hover { background: var(--warn-bg); }
h2.warning { color: var(--warn); }

/* ---- 工具条 ---- */
.invoice-toolbar { flex-wrap: wrap; gap: 12px 28px; }
.toolbar-group { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-width: 0; }
#title-select { max-width: min(420px, 70vw); text-overflow: ellipsis; }
.toolbar-note { color: #9a8eae; font-size: 13px; }
.toolbar-note-active { color: #8be4a7; }

/* ---- 开票信息管理 ---- */
.title-list { border: 1px solid #493064; border-radius: 10px; margin-bottom: 20px; max-height: 34vh; overflow-y: auto; }
.title-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid #49306466; }
.title-row:last-child { border-bottom: 0; }
.title-row-text { flex: 1; min-width: 0; }
.title-row-name { font-weight: 600; overflow-wrap: anywhere; }
.title-row-tax { color: #aaa0bc; font-size: 13px; font-family: ui-monospace, Consolas, monospace; letter-spacing: .5px; }
.title-form input { width: 100%; }
#title-form-tax { font-family: ui-monospace, Consolas, monospace; letter-spacing: .5px; }

/* ---- 抬头比对结果 ---- */
.invoice-item-warning { border-color: var(--warn-border) !important; }
.status-title-mismatch { background: var(--warn); color: #241a00; flex-basis: auto; width: auto; }
.title-check-line { font-size: 13px; line-height: 1.5; margin: 0 0 10px; overflow-wrap: anywhere; }
.title-check-line.title-check-match { color: #8be4a7; }
.title-check-line.title-check-mismatch { color: var(--warn); }
.title-check-line.title-check-unknown { color: #aaa0bc; }
.title-check-block { border-radius: 10px; padding: 14px 16px; margin: 0 0 18px; border: 1px solid #493064; }
.title-check-block.title-check-match { border-color: #387e52; background: rgba(93, 255, 138, 0.06); }
.title-check-block.title-check-mismatch { border-color: var(--warn-border); background: var(--warn-bg); }
.title-check-heading { font-weight: 700; line-height: 1.5; }
.title-check-match .title-check-heading { color: #8be4a7; }
.title-check-mismatch .title-check-heading { color: var(--warn); }
.title-check-table-wrap { overflow-x: auto; margin-top: 10px; }
.title-check-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.title-check-table th, .title-check-table td { text-align: left; padding: 7px 10px; border-top: 1px solid #ffffff14; overflow-wrap: anywhere; vertical-align: top; }
.title-check-table thead th { color: #aaa0bc; font-weight: 400; border-top: 0; white-space: nowrap; }
.title-check-table tbody th { color: #aaa0bc; font-weight: 400; white-space: nowrap; }
.title-check-table td:last-child { white-space: nowrap; color: #8be4a7; }
.title-check-table tr.title-diff td { color: var(--warn); font-weight: 600; }
.verify-result-container h2.warning { color: var(--warn); }
.batch-progress-fill.warning { background: var(--warn); }
.batch-stage.warning { color: var(--warn); }
.verified-badge.title-mismatch-badge { color: var(--warn); background: #3d3217; border-color: #8a6d24; }

/* ---- 重复发票 ---- */
.duplicate-list { list-style: none; margin: 0 0 20px; border: 1px solid var(--warn-border); border-radius: 10px; max-height: 42vh; overflow-y: auto; }
.duplicate-list li { padding: 12px 14px; border-bottom: 1px solid #ffffff14; line-height: 1.6; overflow-wrap: anywhere; }
.duplicate-list li:last-child { border-bottom: 0; }
.duplicate-list.compact { margin: 10px 0 0; font-size: 13px; }
.duplicate-file { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.duplicate-file i { color: var(--warn); }
.duplicate-reason { color: var(--warn); font-size: 13px; }
.duplicate-existing { color: #aaa0bc; font-size: 13px; padding-left: 22px; }
.duplicate-modal .modal-actions { flex-wrap: wrap; }

/* ---- 文件夹 ---- */
.explorer-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid #493064; border-radius: 12px; background: rgba(255, 255, 255, 0.03); }
.explorer-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; min-width: 0; }
.explorer-crumb { border: 1px solid transparent; background: transparent; color: #c79aff; font: inherit; padding: 6px 10px; border-radius: 8px; cursor: pointer; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.explorer-crumb:hover { background: #49306466; }
.explorer-crumb.current { color: #eee8fa; font-weight: 700; cursor: default; }
.explorer-crumb.current:hover { background: transparent; }
.explorer-crumb:focus-visible, .folder-card:focus-visible, .folder-tool:focus-visible, .tree-node:focus-visible { outline: 2px solid #ac71ff; outline-offset: 2px; }
.explorer-sep { color: #6f6285; font-size: 12px; }
.explorer-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.folder-card { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 16px 18px; border-radius: 15px; border: 2px solid rgba(159, 93, 255, 0.25); background: rgba(159, 93, 255, 0.07); cursor: pointer; transition: border-color .15s, background .15s; }
.folder-card:hover { border-color: rgba(159, 93, 255, 0.6); background: rgba(159, 93, 255, 0.12); }
.folder-icon { font-size: 30px; color: #e0b64f; flex: 0 0 auto; }
.folder-text { flex: 1; min-width: 0; }
.folder-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-meta { color: #aaa0bc; font-size: 13px; margin-top: 3px; }
.folder-tools { display: flex; gap: 2px; flex: 0 0 auto; }
.folder-tool { border: 0; background: transparent; color: #b7abc9; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; }
.folder-tool:hover { background: #49306499; color: #fff; }
.folder-tool.danger:hover { color: #ff8d8d; }
.drop-hover { border-color: #8be4a7 !important; background: rgba(93, 255, 138, 0.12) !important; border-style: dashed !important; }
.explorer-crumb.drop-hover { border: 1px dashed #8be4a7 !important; }
.invoice-item[draggable="true"] { cursor: grab; }
.invoice-item.dragging { opacity: .45; }
#invoice-panel .invoice-list > .empty-state.empty-state-compact { min-height: 200px; }
.folder-tree, .folder-tree ul { list-style: none; }
.folder-tree { border: 1px solid #493064; border-radius: 10px; padding: 8px; margin: 16px 0 20px; max-height: 50vh; overflow: auto; }
.folder-tree ul { padding-left: 22px; }
.tree-node { display: block; width: 100%; text-align: left; border: 0; background: transparent; color: #eee8fa; font: inherit; padding: 8px 10px; border-radius: 8px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-node i { color: #e0b64f; margin-right: 6px; }
.tree-node:hover:not(:disabled) { background: #49306466; }
.tree-node.selected { background: #593482; }
.tree-node:disabled { color: #7f7391; cursor: not-allowed; }

@media (max-width: 650px) {
    .explorer-bar { padding: 10px; }
    .explorer-actions { width: 100%; }
    /* 窄屏：文件夹名独占一行，操作按钮换到下一行右侧 */
    .folder-card { flex-wrap: wrap; row-gap: 6px; }
    .folder-text { flex-basis: calc(100% - 50px); }
    .folder-tools { margin-left: auto; }
    .title-row { flex-wrap: wrap; }
    .title-row-text { flex-basis: 100%; }
}
