/* ============================================================
   ARCHIVES PAGE
   ============================================================ */
.archive-page {
    width: 100%;
    min-width: 0;
}

.archive-card {
    background: #fff;
    border: 1px solid var(--bs-gray-200, #e9ecef);
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

/* ===== TABS ===== */
.archive-tabs {
    display: flex;
    align-items: stretch;
    gap: 0.25rem;
    border-bottom: 1px solid var(--bs-gray-200, #e9ecef);
    padding: 0 1rem;
    overflow: hidden;
}

.archive-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    min-width: 0;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--bs-gray-600, #6c757d);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
    margin-bottom: -1px;
}

.archive-tab__label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.archive-tab:hover {
    color: var(--bs-gray-900, #1f2937);
}

.archive-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.archive-tab__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 999px;
    background: var(--bs-gray-100, #f1f5f9);
    color: var(--bs-gray-600, #64748b);
}

.archive-tab.active .archive-tab__count {
    background: #dbeafe;
    color: #2563eb;
}

/* ===== FILTERS ===== */
.archive-filters {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--bs-gray-200, #e9ecef);
}

.archive-filter-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 1.5rem;
    row-gap: 0.625rem;
}

.archive-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.archive-field--full {
    margin-bottom: 0.875rem;
}

.archive-label {
    flex: 0 0 9.5rem;
    max-width: 9.5rem;
    text-align: right;
    font-size: 0.8125rem;
    color: var(--bs-gray-600, #64748b);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.archive-label--short {
    flex-basis: 2rem;
    max-width: 2rem;
}

.archive-info {
    color: var(--bs-gray-400, #94a3b8);
    font-size: 0.875rem;
}

.archive-control {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    height: 2.125rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.8125rem;
    color: var(--bs-gray-700, #334155);
    background: #fff;
    border: 1px solid var(--bs-gray-300, #cbd5e1);
    border-radius: 0.375rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.archive-control:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

select.archive-control {
    color: var(--bs-gray-500, #94a3b8);
    cursor: pointer;
}

.archive-field--disabled .archive-label {
    color: var(--bs-gray-400, #94a3b8);
}

.archive-control:disabled,
.archive-field--disabled .archive-control {
    background: var(--bs-gray-100, #f1f5f9);
    border-color: var(--bs-gray-200, #e2e8f0);
    color: var(--bs-gray-400, #94a3b8);
    cursor: not-allowed;
    opacity: 0.85;
}

.archive-control:disabled:focus,
.archive-field--disabled .archive-control:focus {
    border-color: var(--bs-gray-200, #e2e8f0);
    box-shadow: none;
}

select.archive-control:disabled {
    cursor: not-allowed;
}

.archive-input-money {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.archive-input-prefix {
    position: absolute;
    left: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8125rem;
    color: var(--bs-gray-500, #94a3b8);
    pointer-events: none;
}

.archive-input-money .archive-control {
    padding-left: 1.5rem;
}

.archive-filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

.archive-field--autocomplete,
.archive-field--multiselect {
    position: relative;
}

.archive-autocomplete,
.archive-multiselect {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.archive-multiselect__toggle {
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.archive-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 30;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--bs-gray-200, #e2e8f0);
    border-radius: 0.375rem;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.archive-suggestions--checkboxes {
    padding: 0.375rem 0;
}

.archive-suggestion-item {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 0.8125rem;
    color: var(--bs-gray-700, #334155);
    cursor: pointer;
}

.archive-suggestion-item:hover {
    background: var(--bs-gray-50, #f8fafc);
}

.archive-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4375rem 0.75rem;
    margin: 0;
    font-size: 0.8125rem;
    color: var(--bs-gray-700, #334155);
    cursor: pointer;
}

.archive-checkbox-item:hover {
    background: var(--bs-gray-50, #f8fafc);
}

.archive-suggestion-empty {
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--bs-gray-500, #64748b);
}

/* ===== TABLE ===== */
.archive-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.archive-table {
    width: 100%;
    min-width: 64rem;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
}

.archive-table thead th {
    position: sticky;
    top: 0;
    background: var(--bs-gray-50, #f8fafc);
    padding: 0.75rem 0.875rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--bs-gray-500, #64748b);
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--bs-gray-200, #e9ecef);
}

.archive-table tbody td {
    padding: 0.6875rem 0.875rem;
    font-size: 0.8125rem;
    color: var(--bs-gray-700, #334155);
    border-bottom: 1px solid var(--bs-gray-100, #f1f5f9);
    vertical-align: middle;
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.archive-table tbody tr:hover td {
    background: var(--bs-gray-50, #f8fafc);
}

.archive-table tbody tr.selected td {
    background: rgba(37, 99, 235, 0.06);
}

.archive-table .col-checkbox {
    width: 40px;
    text-align: center;
}

.archive-doc-link {
    color: #2563eb;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}

.archive-doc-link:hover {
    text-decoration: underline;
}

/* ===== PAYMENT BADGE ===== */
.archive-pay-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 4.5rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.375rem;
    color: #fff;
}

.archive-pay-badge--paid {
    background: #16a34a;
}

.archive-pay-badge--unpaid {
    background: #ef4444;
}

/* ===== DONE ICON ===== */
.archive-done {
    font-size: 1.25rem;
}

.archive-done--yes {
    color: #16a34a;
}

.archive-done--no {
    color: var(--bs-gray-300, #cbd5e1);
}

/* ===== ACTION BUTTONS ===== */
.archive-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.archive-act {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 0.375rem;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.15s ease;
}

.archive-act:hover {
    filter: brightness(0.92);
}

.archive-act:active {
    transform: scale(0.95);
}

.archive-act--orange { background: #f59e0b; }
.archive-act--blue   { background: #3b82f6; }
.archive-act--green  { background: #22c55e; }
.archive-act--red    { background: #ef4444; }

/* ===== RESPONSIVE ===== */
@media (max-width: 992px) {
    .archive-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .archive-filter-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .archive-label {
        flex-basis: 7rem;
        max-width: 7rem;
    }
}
