.tooltip-cell {
    position: relative;
    cursor: help;
}

.table-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.deposits-table tbody tr {
    position: relative;
}

.tooltip-cell[data-tooltip]:hover::after,
.tooltip-cell[data-tooltip]:hover::before {
    display: none !important;
    content: none !important;
}

.custom-tooltip {
    position: fixed;
    padding: 14px 18px;
    background: #1a202c;
    color: #ffffff;
    font-size: 0.875rem;
    line-height: 1.6;
    border-radius: 8px;
    max-width: 700px;
    min-width: 300px;
    z-index: 99999;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    animation: tooltipFadeInCustom 0.2s ease-out forwards;
    font-weight: 400;
    letter-spacing: 0.01em;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.custom-tooltip pre {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
    color: #ffffff;
    overflow-wrap: break-word;
}

.custom-tooltip.tooltip-above::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 100%;
    margin-top: 0;
    border: 8px solid transparent;
    border-top-color: #1a202c;
}

.custom-tooltip.tooltip-below::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 100%;
    margin-bottom: 0;
    border: 8px solid transparent;
    border-bottom-color: #1a202c;
}

@keyframes tooltipFadeInCustom {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sidebar-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.refresh-rcs-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.refresh-rcs-btn:hover {
    background: rgba(255,255,255,0.3);
}

#depositsTableContainer {
    display: none;
    padding: 20px;
}

#rcsNumberHeader {
    margin-bottom: 20px;
    color: #1e40af;
}

#totalDeposits {
    margin-bottom: 20px;
    color: #6c757d;
}

.table-wrapper {
    overflow-x: auto;
}

.deposits-table {
    width: 100%;
    min-width: 1200px;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
    table-layout: fixed;
    word-wrap: break-word;
    word-break: keep-all;
}

.deposits-table thead tr {
    background:#f8f9fa;
    color: #2c3e50;
}

.deposits-table th {
    padding: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.deposits-table th.no-column {
    text-align: center;
    width: 60px;
    min-width: 60px;
}

.deposits-table th.page-count-column {
    text-align: center;
    width: 100px;
    min-width: 100px;
}

.deposits-table th:nth-child(2) {
    width: 150px;
    min-width: 150px;
}

.deposits-table th:nth-child(3) {
    width: 100px;
    min-width: 100px;
}

.deposits-table th:nth-child(4) {
    width: 120px;
    min-width: 120px;
}

.deposits-table th:nth-child(6) {
    width: 250px;
    min-width: 250px;
}

.deposits-table th:nth-child(7) {
    width: 200px;
    min-width: 200px;
}

.deposits-table th:nth-child(8) {
    width: 250px;
    min-width: 250px;
}

.deposits-table th:nth-child(9) {
    width: 250px;
    min-width: 250px;
}

.deposits-table th:not(.no-column):not(.page-count-column) {
    text-align: left;
}

.deposits-table tbody tr {
    border-bottom: 1px solid #dee2e6;
}

.deposits-table tbody tr:nth-child(odd) {
    background: #ffffff;
}

.deposits-table td {
    padding: 12px;
    white-space: nowrap;
}

.deposits-table td.no-cell {
    text-align: center;
    color: #6c757d;
}

.deposits-table td.filing-date-cell {
    color: #6c757d;
}

.deposits-table td.form-type-cell,
.deposits-table td.page-count-cell,
.deposits-table td.title-cell,
.deposits-table td.data-sections-cell,
.deposits-table td.existing-sections-cell,
.deposits-table td.absent-sections-cell {
    color: #495057;
}

.deposits-table td.page-count-cell {
    text-align: center;
}

.deposits-table td.title-cell {
    width: 250px;
    max-width: 250px;
    white-space: normal;
    vertical-align: top;
    padding-top: 12px;
}

.deposits-table td.title-cell > div:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.deposits-table td.existing-sections-cell,
.deposits-table td.absent-sections-cell {
    width: 250px;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deposits-table td.data-sections-cell {
    width: 200px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
}

.deposits-table td.deposit-number-cell {
    width: 150px;
    min-width: 150px;
}

.corrected-deposit-badge {
    display: block;
    padding: 2px 8px;
    background-color: #e9ecef;
    color: #495057;
    border-radius: 6px;
    font-size: 0.6rem;
    font-weight: 400;
    margin-top: 4px;
    white-space: nowrap;
}

.corrected-deposit-badge:first-of-type {
    margin-top: 6px;
}

.deposits-table td.filing-date-cell {
    width: 120px;
    min-width: 120px;
}

.deposits-table th:first-child {
    width: 60px;
    min-width: 60px;
}

.deposits-table th:nth-child(2) {
    width: 150px;
    min-width: 150px;
}

.deposits-table th:nth-child(3) {
    width: 100px;
    min-width: 100px;
}

.deposits-table th:nth-child(4) {
    width: 120px;
    min-width: 120px;
}

.deposits-table th:nth-child(5) {
    width: 100px;
    min-width: 100px;
}

.deposits-table th:nth-child(6) {
    width: 250px;
    min-width: 250px;
}

.deposits-table th:nth-child(7) {
    width: 200px;
    min-width: 200px;
}

.deposits-table th:nth-child(8) {
    width: 250px;
    min-width: 250px;
}

.deposits-table th:nth-child(9) {
    width: 250px;
    min-width: 250px;
}

.deposits-table td.existing-sections-cell,
.deposits-table td.absent-sections-cell {
    font-size: 0.9rem;
}

/* ─── Progress bar label ─────────────────────────────────────────────────── */

.progress-bar-label {
    text-align: right;
    font-size: 0.78rem;
    color: #6c757d;
    margin-top: 2px;
    min-height: 14px;
}

/* ─── Stats row ──────────────────────────────────────────────────────────── */

.job-stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 6px;
}

.job-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 6px 14px;
    min-width: 70px;
    flex: 1;
}

.jstat-icon  { font-size: 1.1rem; line-height: 1; }
.jstat-label { font-size: 0.68rem; color: #6c757d; margin: 2px 0 1px; text-transform: uppercase; letter-spacing: 0.04em; }
.jstat-value { font-size: 1rem; font-weight: 700; color: #212529; }

.jstat-done  .jstat-value { color: #155724; }
.jstat-skip  .jstat-value { color: #856404; }
.jstat-fail  .jstat-value { color: #721c24; }
.jstat-process .jstat-value { color: #1e40af; }

/* ─── Current document row ───────────────────────────────────────────────── */

.current-doc-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    margin: 6px 0;
    background: #e8f4fd;
    border-left: 4px solid #1e40af;
    border-radius: 0 8px 8px 0;
    font-size: 0.85rem;
    animation: pulse-border 1.6s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% { border-left-color: #1e40af; }
    50%       { border-left-color: #93c5fd; }
}

.cur-label      { color: #6c757d; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.cur-step-icon  { font-size: 1rem; }
.cur-step-label { font-weight: 600; color: #1e40af; min-width: 130px; }
.cur-deposit    { font-family: monospace; font-size: 0.82rem; color: #495057; flex: 1; }
.cur-form-type  {
    background: #1e40af;
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.06em;
}

/* ─── Per-document section ───────────────────────────────────────────────── */

.per-doc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 8px 0 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid #dee2e6;
}

.per-doc-toggle {
    cursor: pointer;
    color: #1e40af;
    font-size: 0.75rem;
    user-select: none;
}

.per-doc-list {
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: 2px;
}

/* scrollbar */
.per-doc-list::-webkit-scrollbar { width: 5px; }
.per-doc-list::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 3px; }
.per-doc-list::-webkit-scrollbar-thumb { background: #ced4da; border-radius: 3px; }

.pd-row {
    display: grid;
    grid-template-columns: 28px 22px 130px 42px 1fr auto auto;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    background: #f8f9fa;
}

.pd-completed   { background: #d4edda; }
.pd-failed      { background: #f8d7da; }
.pd-skipped     { background: #fff9e6; }
.pd-downloading,
.pd-detecting,
.pd-extracting,
.pd-mapping,
.pd-saving_mongo,
.pd-saving_pg   { background: #e8f4fd; }

.pd-num     { color: #adb5bd; font-size: 0.72rem; text-align: right; }
.pd-icon    { font-size: 0.9rem; text-align: center; }
.pd-deposit { font-family: monospace; font-size: 0.78rem; color: #495057; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-ft      { background: #6c757d; color: white; font-size: 0.62rem; font-weight: 700; padding: 1px 5px; border-radius: 3px; text-align: center; }
.pd-ft-none { background: transparent; color: #adb5bd; }
.pd-step    { color: #495057; }
.pd-dur     { color: #6c757d; font-size: 0.74rem; white-space: nowrap; text-align: right; }
.pd-note    { color: #856404; font-size: 0.74rem; grid-column: 4 / -1; }
.pd-err     { color: #721c24; }

/* ─────────────────────────────────────────────────────────────────────────── */

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
}

.status-badge.success {
    background: #d4edda;
    color: #155724;
}

.status-badge.failed {
    background: #f8d7da;
    color: #721c24;
}

.status-badge.skipped {
    background: #fff3cd;
    color: #856404;
}

.status-badge.pending {
    background: #e9ecef;
    color: #6c757d;
}
