/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.modal-title h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.btn-close {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-close:hover {
    background-color: var(--bg-subtle);
    color: var(--text-primary);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 1rem;
}

.footer-actions-left,
.footer-actions-right {
    display: flex;
    gap: 0.75rem;
}

/* Form Styles in Modal */
.form-section {
    margin-bottom: 2rem;
}

.form-section:last-child {
    margin-bottom: 0;
}

.form-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1.125rem;
    color: var(--text-primary);
    font-weight: 600;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9375rem;
    transition: all 0.2s;
    font-family: inherit;
    background-color: var(--card-bg);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input:disabled,
.form-group textarea:disabled,
.form-group select:disabled {
    background-color: var(--bg-subtle);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.form-group input[readonly] {
    background-color: var(--bg-subtle);
    color: var(--text-secondary);
}

/* Add Line Form */
.add-line-form {
    background-color: var(--bg-subtle);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 2px dashed var(--border-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Invoice Lines Table */
.invoice-lines {
    margin: 1rem 0;
}

.lines-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.lines-table thead {
    background-color: var(--bg-subtle);
}

.lines-table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

.lines-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.lines-table tbody tr:hover {
    background-color: var(--bg-subtle);
}

.no-lines {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

/* Delete line button */
.line-actions-col {
    width: 50px;
}

.line-actions {
    text-align: center;
}

.btn-delete-line {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.35rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-delete-line:hover {
    color: var(--danger, #ef4444);
    background: rgba(239, 68, 68, 0.1);
}

.btn-delete-line:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Invoice Totals */
.invoice-totals {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: var(--bg-subtle);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 300px;
    margin-left: auto;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9375rem;
}

.total-row.subtotal {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.total-row.paid {
    color: var(--success, #22c55e);
}

.total-row.pending {
    font-size: 1.125rem;
    color: var(--primary);
    padding-top: 0.75rem;
    border-top: 2px solid var(--border-color);
}

.total-row--highlight {
    font-size: 1.35rem;
    font-weight: 700;
    padding-top: 0.75rem;
    margin-top: 0.25rem;
    border-top: 2px solid var(--border-color);
}

.total-row--highlight-paid {
    color: var(--success);
}

.total-row--highlight-pending {
    color: var(--danger);
}

/* Payment Section */
.payment-section {
    border-top: 2px solid var(--border-color);
    padding-top: 1.25rem;
    margin-top: 1rem;
}

.payment-section h3 {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.payment-form .form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.payment-form .form-group {
    flex: 1;
}

.payment-form label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: var(--text-secondary);
}

.payment-form input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--card-bg);
    color: var(--text-primary);
    box-sizing: border-box;
}

.payment-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.payment-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.btn-pay {
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    white-space: nowrap;
}

.btn-pay:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Payment History */
.payments-history-section {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

.payments-history-section h3 {
    margin: 0 0 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.payments-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.payments-history-table thead th {
    padding: 0.5rem 0.875rem;
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-subtle, #f3f4f6);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.payments-history-table thead th:last-child {
    text-align: right;
}

.payments-history-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.12s ease;
}

.payments-history-table tbody tr:last-child {
    border-bottom: none;
}

.payments-history-table tbody tr:hover {
    background: var(--bg-subtle, #f3f4f6);
}

.payments-history-table td {
    padding: 0.625rem 0.875rem;
    color: var(--text-primary);
    vertical-align: middle;
}

.payments-history-table td:last-child {
    text-align: right;
}

.payment-amount-cell {
    font-weight: 600;
    color: var(--success, #16a34a);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.payment-ref-cell {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.payment-type-pill {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-subtle, #f3f4f6);
    border-radius: 99px;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Button Styles */
.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: var(--success-hover);
}

.btn-cancel {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-cancel:hover {
    background-color: var(--bg-subtle);
    color: var(--text-primary);
}

/* Invoice Actions Buttons */
.invoice-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
}

.btn-action {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-action:hover {
    background-color: var(--bg-subtle);
    transform: scale(1.1);
}

.btn-delete:hover {
    background-color: #fee2e2;
}

/* Loading and Error States */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.error {
    text-align: center;
    padding: 2rem;
    color: var(--danger);
}

/* Responsive Modal */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 0;
    }

    .modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .invoice-totals {
        max-width: 100%;
    }

    .modal-footer {
        flex-direction: column;
    }

    .footer-actions-left,
    .footer-actions-right {
        width: 100%;
    }

    .footer-actions-left button,
    .footer-actions-right button {
        flex: 1;
    }
}

/* ============================================
   Confirm Exit Modal Styles
   ============================================ */
.confirm-exit-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
    animation: confirmFadeIn 0.2s ease-out;
}

.confirm-exit-overlay.closing {
    animation: confirmFadeOut 0.2s ease-out forwards;
}

@keyframes confirmFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes confirmFadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

.confirm-exit-modal {
    background: var(--card-bg, #ffffff);
    border-radius: 16px;
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: confirmSlideUp 0.3s ease-out;
}

.confirm-exit-overlay.closing .confirm-exit-modal {
    animation: confirmSlideDown 0.2s ease-out forwards;
}

@keyframes confirmSlideUp {
    from {
        transform: translateY(20px) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes confirmSlideDown {
    from {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    to {
        transform: translateY(20px) scale(0.95);
        opacity: 0;
    }
}

.confirm-exit-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.25rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-exit-icon svg {
    color: #d97706;
}

.confirm-exit-title {
    margin: 0 0 0.75rem;
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
}

.confirm-exit-message {
    margin: 0 0 1.75rem;
    font-size: 0.9375rem;
    color: var(--text-secondary, #64748b);
    line-height: 1.5;
}

.confirm-exit-actions {
    display: flex;
    gap: 0.75rem;
}

.confirm-exit-actions button {
    flex: 1;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.confirm-exit-actions .btn-stay {
    background-color: var(--primary, #2563eb);
    color: white;
}

.confirm-exit-actions .btn-stay:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.confirm-exit-actions .btn-exit {
    background-color: var(--bg-subtle);
    color: var(--text-primary, #1e293b);
    border: 1px solid var(--border-color, #e2e8f0);
}

.confirm-exit-actions .btn-exit:hover {
    background-color: rgba(148, 163, 184, 0.18);
    border-color: rgba(148, 163, 184, 0.28);
}

/* Responsive Confirm Modal */
@media (max-width: 480px) {
    .confirm-exit-modal {
        padding: 1.5rem;
        margin: 1rem;
    }

    .confirm-exit-icon {
        width: 60px;
        height: 60px;
    }

    .confirm-exit-icon svg {
        width: 36px;
        height: 36px;
    }

    .confirm-exit-title {
        font-size: 1.25rem;
    }

    .confirm-exit-actions {
        flex-direction: column-reverse;
    }
}

/* ============================================
   Blocked Navigation Toast Styles
   ============================================ */
.blocked-nav-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    z-index: 3000;
    opacity: 0;
    transition: all 0.3s ease-out;
    pointer-events: none;
}

.blocked-nav-toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.blocked-nav-toast.hiding {
    transform: translateX(-50%) translateY(-20px);
    opacity: 0;
}

.blocked-nav-toast-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fbbf24;
    border-radius: 10px;
    box-shadow: 0 10px 25px -5px rgba(251, 191, 36, 0.3),
        0 4px 6px -2px rgba(0, 0, 0, 0.1);
}

.blocked-nav-icon {
    color: #d97706;
    flex-shrink: 0;
}

.blocked-nav-message {
    font-size: 0.9375rem;
    font-weight: 500;
    color: #92400e;
    white-space: nowrap;
}

/* ============================================
   Dark Mode Overrides
   ============================================ */

:root[data-theme='dark'] .modal-content {
    background: #081226;
}

:root[data-theme='dark'] .modal-header,
:root[data-theme='dark'] .modal-footer,
:root[data-theme='dark'] .total-row.pending,
:root[data-theme='dark'] .payments-history-section,
:root[data-theme='dark'] .payment-section {
    border-color: #1e2f4d;
}

:root[data-theme='dark'] .form-group input,
:root[data-theme='dark'] .form-group textarea,
:root[data-theme='dark'] .form-group select {
    background: #0b1220;
    border-color: #1e2f4d;
    color: var(--text-primary);
}

:root[data-theme='dark'] .form-group input:disabled,
:root[data-theme='dark'] .form-group textarea:disabled,
:root[data-theme='dark'] .form-group input[readonly] {
    background: rgba(15, 23, 42, 0.8);
    color: var(--text-secondary);
}

:root[data-theme='dark'] .add-line-form {
    background: rgba(15, 23, 42, 0.6);
    border-color: #1e2f4d;
}

:root[data-theme='dark'] .lines-table thead {
    background: rgba(15, 23, 42, 0.6);
}

:root[data-theme='dark'] .lines-table th,
:root[data-theme='dark'] .lines-table td {
    border-color: #1e2f4d;
}

:root[data-theme='dark'] .lines-table tbody tr:hover {
    background: rgba(30, 58, 110, 0.2);
}

:root[data-theme='dark'] .invoice-totals {
    background: rgba(15, 23, 42, 0.6);
}

:root[data-theme='dark'] .payments-history-table {
    border-color: #1e2f4d;
}

:root[data-theme='dark'] .payments-history-table thead th {
    background: rgba(15, 23, 42, 0.6);
    border-color: #1e2f4d;
}

:root[data-theme='dark'] .payments-history-table td,
:root[data-theme='dark'] .payments-history-table th {
    border-color: #1e2f4d;
}

:root[data-theme='dark'] .payments-history-table tbody tr:hover {
    background: rgba(30, 58, 110, 0.2);
}

:root[data-theme='dark'] .payment-form input {
    background: #0b1220;
    border-color: #1e2f4d;
}

:root[data-theme='dark'] .payment-type-pill {
    background: rgba(30, 58, 110, 0.4);
}

:root[data-theme='dark'] .btn-delete:hover {
    background-color: rgba(220, 38, 38, 0.15);
}

:root[data-theme='dark'] .btn-cancel:hover {
    background-color: rgba(30, 58, 110, 0.2);
}

:root[data-theme='dark'] .confirm-exit-modal {
    background: #081226;
    border: 1px solid #1e2f4d;
}

:root[data-theme='dark'] .confirm-exit-icon {
    background: rgba(217, 119, 6, 0.15);
}

@media (max-width: 480px) {
    .blocked-nav-toast {
        left: 1rem;
        right: 1rem;
        transform: translateX(0) translateY(-100px);
    }

    .blocked-nav-toast.visible {
        transform: translateX(0) translateY(0);
    }

    .blocked-nav-toast.hiding {
        transform: translateX(0) translateY(-20px);
    }

    .blocked-nav-message {
        white-space: normal;
    }
}

/* ===== Supplier invoice detail modal ===== */
.sup-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 2rem 1rem;
}

.sup-detail-modal {
    width: 100%;
    max-width: 780px;
    max-height: none;
    overflow-y: visible;
    border-radius: 12px;
    margin: auto;
}

/* Modal detalle factura proveedor */
.sup-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow-y: auto;
}

.sup-modal-box {
    background: var(--card-bg);
    border-radius: 12px;
    width: 100%;
    max-width: 820px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0,0,0,0.18);
    animation: slideUp 0.25s ease-out;
}

.sup-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sup-modal-head h2 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.sup-modal-body {
    padding: 1.5rem 1.75rem;
    overflow-y: auto;
    flex: 1;
}

.invoice-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 1.5rem;
    margin-bottom: 1.5rem;
}

.invoice-detail-grid .detail-row.full-width {
    grid-column: 1 / -1;
}

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.detail-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.detail-value {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

.lines-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 1.25rem 0 0.75rem;
}

.invoice-lines-table-wrap {
    overflow-x: auto;
    margin-bottom: 1rem;
}

.invoice-lines-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.invoice-lines-table th,
.invoice-lines-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.invoice-lines-table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
    background: var(--bg-secondary);
}

.invoice-lines-table .text-right,
.facturas-table .text-right { text-align: right; }

:root[data-theme='dark'] .detail-row { border-color: rgba(255,255,255,0.08); }
:root[data-theme='dark'] .invoice-lines-table th { background: rgba(255,255,255,0.04); }
:root[data-theme='dark'] .invoice-lines-table th,
:root[data-theme='dark'] .invoice-lines-table td { border-color: rgba(255,255,255,0.08); }

.line-row-compact {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    margin-bottom: 0.4rem;
}

/* ── Documentos adjuntos ── */
.documents-section .no-documents {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.documents-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.document-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.75rem;
  background: var(--bg-secondary, #f8fafc);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
}

.doc-icon { color: var(--text-tertiary); flex-shrink: 0; }

.document-name {
  flex: 1;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.document-size {
  color: var(--text-secondary);
  font-size: 0.75rem;
  white-space: nowrap;
}

.btn-download-doc {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn-download-doc:hover { background: var(--primary); color: #fff; }

:root[data-theme='dark'] .document-item {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
}
:root[data-theme='dark'] .btn-download-doc {
  background: rgba(37,99,235,0.12);
  border-color: rgba(37,99,235,0.4);
  color: #93c5fd;
}
:root[data-theme='dark'] .btn-download-doc:hover {
  background: var(--primary);
  color: #fff;
}