/* Vista Excel facturas (gas_v2 / futuros *_v2) */
.invoice-excel-mount {
    flex: 1;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.invoice-excel-host {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
    min-height: 0;
    background: #f7f8fa;
    font-family: "Segoe UI", system-ui, sans-serif;
    overflow: hidden;
}

.invoice-excel-alerts {
    flex: 0 0 auto;
    padding: 8px 12px;
    border-bottom: 1px solid #e2e5ea;
    background: #fff;
    max-height: 140px;
    overflow: auto;
}

.invoice-excel-alert-banner {
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 6px;
}
.invoice-excel-alert-banner.ok {
    background: #e8f6ee;
    color: #146c43;
}
.invoice-excel-alert-banner.warn {
    background: #fff4e5;
    color: #9a5b00;
}

.invoice-excel-check-list {
    margin: 0;
    padding-left: 18px;
    font-size: 12px;
    color: #444;
}
.invoice-excel-check-list .estado-REVISAR,
.invoice-excel-check-list .estado-SIN_FACTURA_ANTERIOR {
    color: #b42318;
}

.invoice-excel-prev-link {
    font-size: 12px;
    margin-top: 4px;
}

.invoice-excel-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #e2e5ea;
    background: #fff;
}

.invoice-excel-formula-bar {
    display: flex;
    flex: 1;
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.invoice-excel-cell-ref {
    min-width: 48px;
    font-weight: 700;
    font-size: 13px;
    color: #1f2937;
}

.invoice-excel-formula-input {
    flex: 1;
    border: 1px solid #cfd6e0;
    border-radius: 4px;
    padding: 6px 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    background: #f8fafc;
}
.invoice-excel-formula-input.is-editable {
    background: #fffef5;
    border-color: #f59e0b;
}
.invoice-excel-formula-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
    background: #fff;
}

.btn-excel-icon {
    border: 1px solid #cfd6e0;
    background: #fff;
    color: #334155;
    border-radius: 6px;
    width: 34px;
    height: 34px;
    padding: 0;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
.btn-excel-icon:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #94a3b8;
}
.btn-excel-icon:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-save-excel {
    border: none;
    background: #2563eb;
    color: #fff;
    border-radius: 6px;
    padding: 7px 12px;
    font-size: 13px;
    cursor: pointer;
}
.btn-save-excel:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.invoice-excel-meta {
    padding: 4px 12px;
    font-size: 11px;
    color: #64748b;
    border-bottom: 1px solid #eef1f5;
    background: #fafbfc;
    min-height: 22px;
}
.invoice-excel-meta code {
    background: #eef2ff;
    padding: 1px 4px;
    border-radius: 3px;
}
.invoice-excel-meta .f {
    font-family: ui-monospace, monospace;
    color: #0f766e;
}

.invoice-excel-sheet-wrap {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

.invoice-excel-sheet {
    border-collapse: collapse;
    font-size: 11px;
    background: #fff;
    min-width: 100%;
}

.invoice-excel-sheet th,
.invoice-excel-sheet td {
    border: 1px solid #d8dee8;
    padding: 3px 6px;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.invoice-excel-sheet thead th,
.invoice-excel-sheet tbody th {
    background: #eef1f6;
    color: #475569;
    font-weight: 600;
    position: sticky;
    z-index: 1;
}
.invoice-excel-sheet thead th {
    top: 0;
}
.invoice-excel-sheet tbody th {
    left: 0;
}

.invoice-excel-sheet td.editable {
    background: #fffef5;
    cursor: cell;
}
.invoice-excel-sheet td.formula {
    color: #0f766e;
}
.invoice-excel-sheet td.selected {
    outline: 2px solid #2563eb;
    outline-offset: -2px;
    z-index: 2;
    position: relative;
}
.invoice-excel-sheet td.in-range {
    background: #dbeafe;
}
.invoice-excel-sheet td.editable.in-range {
    background: #fef9c3;
}
.invoice-excel-sheet td.dirty {
    background: #fef3c7;
}
.invoice-excel-sheet td.editing {
    padding: 0;
    outline: 2px solid #2563eb;
    outline-offset: -2px;
    z-index: 3;
    overflow: visible;
}
.invoice-excel-sheet td.editing .excel-cell-editor {
    display: block;
    width: 100%;
    min-width: 80px;
    box-sizing: border-box;
    border: none;
    outline: none;
    padding: 3px 6px;
    font: inherit;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: #fff;
}
.invoice-excel-sheet td.check-ok {
    background: #d1fae5;
    color: #065f46;
    font-weight: 700;
}
.invoice-excel-sheet td.check-revisar {
    background: #fee2e2;
    color: #991b1b;
    font-weight: 700;
}

.split-view-right-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #e2e5ea;
    background: #fff;
    padding: 0 8px;
}
.split-view-right-tabs .sv-tab {
    border: none;
    background: transparent;
    padding: 10px 14px;
    font-size: 13px;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}
.split-view-right-tabs .sv-tab.active {
    color: #1d4ed8;
    border-bottom-color: #2563eb;
    font-weight: 600;
}
.split-view-right-panels {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.split-view-right-panels .sv-panel {
    display: none;
    flex: 1;
    min-height: 0;
    overflow: auto;
}
.split-view-right-panels .sv-panel.active {
    display: flex;
    flex-direction: column;
}
/* La hoja hace scroll; la barra de estado (Suma) queda fija abajo */
.split-view-right-panels .sv-panel[data-panel="excel"] {
    overflow: hidden;
}
.split-view-right.with-excel-tabs {
    display: flex;
    flex-direction: column;
}
.split-view-right.with-excel-tabs .json-editor-header {
    flex: 0 0 auto;
}

.invoice-excel-statusbar {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    border-top: 1px solid #cbd5e1;
    background: #e8eef5;
    font-size: 12px;
    color: #334155;
    min-height: 30px;
    z-index: 2;
    box-shadow: 0 -1px 0 rgba(15, 23, 42, 0.04);
}
.invoice-excel-statusbar .sb-hint {
    color: #64748b;
    font-size: 11px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.invoice-excel-statusbar .sb-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    margin-left: auto;
}
.invoice-excel-statusbar .sb-stats strong {
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}
.invoice-excel-statusbar .sb-item.sb-sum {
    background: #fff;
    border: 1px solid #94a3b8;
    border-radius: 4px;
    padding: 2px 10px;
    color: #0f172a;
}
.invoice-excel-statusbar .sb-item.sb-sum strong {
    font-size: 13px;
}

.invoice-excel-host:focus {
    outline: none;
}
.invoice-excel-error {
    padding: 16px;
    color: #b42318;
}
