/**
 * OpenCPAi 合并审计 — 卡片样式
 * consolidation.css
 * ================================
 * 合并配置卡片、管理主卡片、抵消确认卡片、结果卡片的统一样式
 * ================================
 */

/* ========== 通用卡片容器 ========== */
.conso-card {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    border-top-left-radius: 0.25rem;
    overflow: hidden;
}

.conso-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.conso-card-body {
    padding: 1rem 1.25rem;
}

/* ========== 表单元素 ========== */
.conso-label {
    display: block;
    font-size: 0.75rem;
    color: rgba(156, 163, 175, 1);
    margin-bottom: 0.375rem;
    font-weight: 500;
}

.conso-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: white;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.conso-input:focus {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.conso-input::placeholder {
    color: rgba(107, 114, 128, 1);
}

select.conso-input {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1rem;
    padding-right: 2rem;
}

select.conso-input option {
    background: #1f2937;
    color: white;
}

/* ========== 配置卡片 — 主体列表 ========== */
.conso-entity-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.5rem;
    font-size: 0.75rem;
    color: rgba(107, 114, 128, 1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.conso-entity-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

/* ========== Dashboard — 主体卡片 ========== */
.conso-entity-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0.75rem;
    overflow: hidden;
    transition: border-color 0.3s;
}

.conso-entity-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.conso-entity-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.conso-entity-card-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.conso-entity-card-body {
    padding: 0 1rem 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.conso-entity-card-body.hidden {
    display: none;
}

/* 角色徽章 */
.conso-role-badge {
    font-size: 0.625rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-weight: 500;
    flex-shrink: 0;
}

.conso-role-parent {
    background: rgba(59, 130, 246, 0.15);
    color: rgba(147, 197, 253, 1);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.conso-role-branch {
    background: rgba(168, 85, 247, 0.15);
    color: rgba(216, 180, 254, 1);
    border: 1px solid rgba(168, 85, 247, 0.3);
}

/* 状态徽章 */
.conso-status-badge {
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 0.375rem;
    white-space: nowrap;
}

.conso-status-pending {
    color: rgba(156, 163, 175, 1);
}

.conso-status-uploading,
.conso-status-processing {
    color: rgba(96, 165, 250, 1);
    background: rgba(59, 130, 246, 0.1);
}

.conso-status-completed {
    color: rgba(74, 222, 128, 1);
    background: rgba(34, 197, 94, 0.1);
}

.conso-status-failed {
    color: rgba(248, 113, 113, 1);
    background: rgba(239, 68, 68, 0.1);
}

.conso-status-ocr_review {
    color: rgba(251, 191, 36, 1);
    background: rgba(245, 158, 11, 0.1);
}

/* 上传按钮 */
.conso-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.625rem 1.25rem;
    background: rgba(59, 130, 246, 0.15);
    border: 1px dashed rgba(59, 130, 246, 0.4);
    border-radius: 0.75rem;
    color: rgba(147, 197, 253, 1);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.conso-upload-btn:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.6);
}

/* 展开/折叠箭头旋转 */
.conso-entity-card-body:not(.hidden)~.conso-entity-card-header .conso-chevron,
.conso-entity-card-header[aria-expanded="true"] .conso-chevron {
    transform: rotate(180deg);
}

/* ========== 抵消确认 ========== */
.conso-elim-group {
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.conso-elim-matched {
    border-color: rgba(34, 197, 94, 0.2);
}

.conso-elim-warning {
    border-color: rgba(245, 158, 11, 0.3);
}

.conso-elim-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.875rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.conso-elim-group-body {
    padding: 0.75rem 0.875rem;
}

.conso-amount-input {
    width: 8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    font-family: ui-monospace, monospace;
    color: white;
    text-align: right;
    outline: none;
    transition: border-color 0.2s;
}

.conso-amount-input:focus {
    border-color: rgba(59, 130, 246, 0.5);
}

.conso-amount-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== 浮动控制台 ========== */
.consolidation-floating-console {
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 0.5rem 0.75rem;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.consolidation-floating-console.hidden {
    display: none;
}

.cfc-inner {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    max-width: 56rem;
    margin: 0 auto;
}

.cfc-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.cfc-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 12rem;
}

.cfc-progress {
    font-size: 0.75rem;
    color: rgba(156, 163, 175, 1);
    white-space: nowrap;
    flex-shrink: 0;
}

.cfc-bar-wrap {
    flex: 1;
    height: 0.375rem;
    background: rgba(55, 65, 81, 1);
    border-radius: 9999px;
    overflow: hidden;
    min-width: 4rem;
}

.cfc-bar {
    height: 100%;
    background: linear-gradient(to right, #3b82f6, #22c55e);
    border-radius: 9999px;
    transition: width 0.5s ease;
}

.cfc-expand-btn {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.375rem;
    color: rgba(156, 163, 175, 1);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.cfc-expand-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* ========== 结果卡片 ========== */
.conso-result-card {
    background: linear-gradient(to bottom, rgba(55, 65, 81, 0.3), rgba(17, 24, 39, 0.3));
    border-color: rgba(255, 255, 255, 0.1);
}

/* ========== 动画 ========== */
@keyframes conso-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.conso-card {
    animation: conso-fade-in 0.3s ease-out;
}

/* ========== 欢迎页 — 步骤进度条 ========== */
.conso-step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex: 0 0 auto;
}

.conso-step-circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: rgba(107, 114, 128, 1);
    z-index: 1;
    transition: all 0.3s;
}

.conso-step-label {
    font-size: 10px;
    color: rgba(107, 114, 128, 1);
    white-space: nowrap;
    transition: color 0.3s;
}

.conso-step-line {
    flex: 1;
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0 6px;
    margin-bottom: 22px;
    min-width: 24px;
    transition: background 0.3s;
}

/* 激活状态 */
.conso-step-item.active .conso-step-circle {
    border-color: rgba(96, 165, 250, 0.7);
    color: rgba(147, 197, 253, 1);
    background: rgba(59, 130, 246, 0.12);
    box-shadow: 0 0 8px rgba(96, 165, 250, 0.15);
}

.conso-step-item.active .conso-step-label {
    color: rgba(147, 197, 253, 1);
}

/* 已完成状态 */
.conso-step-item.finish .conso-step-circle {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(74, 222, 128, 0.5);
    color: rgba(74, 222, 128, 1);
}

.conso-step-item.finish .conso-step-label {
    color: rgba(74, 222, 128, 1);
}

.conso-step-line.finish {
    background: rgba(74, 222, 128, 0.4);
}

/* ========== 欢迎页 — 进度区 Tab 按钮 ========== */
.conso-progress-tab {
    padding: 10px 14px;
    font-size: 12px;
    color: rgba(107, 114, 128, 1);
    cursor: pointer;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    outline: none;
}

.conso-progress-tab:hover {
    color: rgba(209, 213, 219, 1);
}

.conso-progress-tab.active {
    color: rgba(96, 165, 250, 1);
    border-bottom-color: rgba(96, 165, 250, 0.8);
}

/* ========== 欢迎页 — ZIP 上传成功状态 ========== */
#conso-zip-upload-zone.conso-uploaded {
    border-color: rgba(74, 222, 128, 0.4) !important;
    background: rgba(34, 197, 94, 0.03) !important;
}