:root {
    font-family: Arial, sans-serif;
    color: #1f2937;
    background: #f5f7fa;
}

* { box-sizing: border-box; }
body { margin: 0; }
body.processing-active { overflow: hidden; }
header { background: #172033; color: white; padding: 16px 24px; }
main { padding: 24px; }
.page-heading { display: flex; justify-content: space-between; gap: 24px; align-items: end; }
h1 { margin-bottom: 4px; }
.grid-filter-form { display: flex; gap: 8px; align-items: end; }
input, button { padding: 8px 10px; }
button { cursor: pointer; }
button:disabled, input:disabled { cursor: wait; opacity: 0.65; }
.summary { display: flex; gap: 24px; margin: 20px 0; padding: 14px; background: white; border: 1px solid #dce2ea; }
.table-wrapper { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 10px; border: 1px solid #dce2ea; text-align: left; vertical-align: top; }
th { background: #eef2f7; }
small { color: #667085; }
.detail-row td { background: #fafbfc; font-size: 0.9rem; }
.grid-message { min-height: 1.25rem; margin-top: 12px; }
.grid-message.is-error { color: #b42318; font-weight: 600; }
.empty-grid-message,
.grid-error { margin-top: 20px; padding: 18px; background: white; border: 1px solid #dce2ea; }
.grid-error { border-color: #f1aeb5; background: #fff5f5; color: #842029; }
.grid-error h2 { margin-top: 0; font-size: 1.1rem; }

.processing-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(245, 247, 250, 0.88);
    backdrop-filter: blur(2px);
}

.processing-overlay.is-hidden { display: none; }

.processing-overlay-card {
    min-width: 300px;
    max-width: 440px;
    padding: 30px 36px;
    text-align: center;
    background: white;
    border: 1px solid #dce2ea;
    border-radius: 12px;
    box-shadow: 0 18px 48px rgba(23, 32, 51, 0.22);
}

.processing-spinner {
    width: 42px;
    height: 42px;
    margin: 0 auto;
    border: 4px solid #dce2ea;
    border-top-color: #172033;
    border-radius: 50%;
    animation: processing-spin 0.85s linear infinite;
}

.processing-overlay-title {
    margin-top: 16px;
    font-size: 1.15rem;
    font-weight: 700;
}

.processing-overlay-message {
    margin-top: 6px;
    color: #667085;
    line-height: 1.4;
}

@keyframes processing-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .processing-spinner { animation-duration: 1.8s; }
}

@media (max-width: 760px) {
    main { padding: 16px; }
    .page-heading { align-items: stretch; flex-direction: column; }
    .grid-filter-form { align-items: stretch; flex-direction: column; }
    .summary { flex-direction: column; gap: 8px; }
}

.status-paid {
    font-weight: 600;
    color: #146c43;
}

.status-unpaid {
    font-weight: 600;
    color: #997404;
}

.selection-cell {
    width: 72px;
    text-align: center;
}

.invoice-selection {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.invoice-selection:disabled {
    cursor: not-allowed;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-auto-selected {
    color: #0f5132;
    background: #d1e7dd;
}

.status-review {
    color: #664d03;
    background: #fff3cd;
}

.status-ineligible {
    color: #842029;
    background: #f8d7da;
}

.status-missing {
    font-weight: 600;
    color: #842029;
}
