/* Data Quality page styling.
   Colours here mirror dq/theme.py's tokens -- keep the two in sync:
   brand #006401, coverage present #15803D, coverage missing tint of
   DANGER_C #DC2626, severity high #DC2626 / medium #FFC107 / low #64748B,
   ok #16A34A. */

.dq-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Header: title + filters + "Run DQ" action on one row, tabs directly below
   -- keeps the chrome above the tab content compact instead of stacking a
   full-width title row on top of a full-width filter row. */
.dq-header-row {
    display: flex;
    align-items: flex-end;
    margin-top: 10px;
    gap: 20px;
}

.dq-header-title-col {
    flex: 0 0 20%;
    max-width: 20%;
}

.dq-page-title {
    color: #2c3e50;
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.01em;
}

.dq-header-filters-col {
    flex: 0 0 100%;
    max-width: 100%;
    margin-bottom: 0;
}

.dq-header-filters-col.config-controls-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 15px;
}

.dq-header-action-col {
    flex: 0 0 20%;
    max-width: 20%;
    display: flex;
    justify-content: flex-end;
}

.dq-run-btn {
    background: #006401;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.dq-run-btn:hover {
    background: #004d01;
}

@media (max-width: 768px) {
    .dq-header-row {
        flex-direction: column;
        align-items: stretch;
    }

    .dq-header-title-col,
    .dq-header-filters-col,
    .dq-header-action-col {
        flex: 1 1 auto;
        max-width: 100%;
    }

    .dq-header-filters-col.config-controls-grid {
        grid-template-columns: 1fr;
    }

    .dq-header-action-col {
        justify-content: flex-start;
    }
}

.dq-status-message {
    padding: 10px 16px;
    border-radius: 8px;
    background: #f8f9fa;
    color: #2c3e50;
    font-size: 0.875rem;
}

/* Empty states -- always explain what's missing and what to do next,
   never just "no data". */
.dq-empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #6c757d;
    background: #f8f9fa;
    border-radius: 12px;
    margin: 12px 0;
}

.dq-empty-state-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 6px;
}

/* Severity / status badges -- colour is always paired with this text
   label, never the only signal. */
.dq-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.dq-badge-high {
    background: #FCE4E4;
    color: #DC2626;
}

.dq-badge-medium {
    background: #FFF3CD;
    color: #8a6d00;
}

.dq-badge-low {
    background: #F1F5F9;
    color: #64748B;
}

.dq-badge-ok {
    background: #DCFCE7;
    color: #16A34A;
}

/* Coverage grid -- one row per patient, one cell per column. */
.dq-coverage-grid {
    display: grid;
    gap: 1px;
    background: #E2E8F0;
    border: 1px solid #E2E8F0;
    border-radius: 4px;
    overflow: auto;
}

.dq-coverage-cell {
    width: 100%;
    height: 100%;
    min-height: 14px;
}

.dq-coverage-cell-present {
    background: #15803D;
}

.dq-coverage-cell-missing {
    background: #FADEDE;
}

/* Facility scorecard / defects tables re-use the app's existing DataTable
   look (see reports.css) -- nothing new needed here. */

.dq-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.dq-kpi-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dq-kpi-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #495057;
}

.dq-kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #006401;
}

.dq-kpi-sub {
    font-size: 0.75rem;
    color: #6c757d;
}

.dq-panel {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 16px;
}

.dq-panel-title {
    margin: 0 0 8px 0;
    color: #2c3e50;
    font-size: 1rem;
    font-weight: 600;
}

.dq-panel-note {
    font-size: 0.75rem;
    color: #6c757d;
    margin-bottom: 12px;
    font-style: italic;
}

.dq-checklist-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px 20px;
}

.dq-checklist-label {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    font-size: 0.875rem;
    color: #2c3e50;
}

.dq-candidates-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.dq-candidates-table th,
.dq-candidates-table td {
    border: 1px solid #e9ecef;
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
}

.dq-candidates-table th {
    background: #f8f9fa;
    color: #2c3e50;
}

.dq-pagination-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
}

.dq-pagination-btn {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #006401;
    cursor: pointer;
}

.dq-pagination-btn:disabled {
    color: #adb5bd;
    cursor: not-allowed;
}

.dq-pagination-info {
    font-size: 0.8125rem;
    color: #6c757d;
}

.dq-group-details {
    border: none;
    padding: 0;
    background: transparent;
}

.dq-group-summary {
    cursor: pointer;
    font-weight: 600;
    color: #2c3e50;
    padding: 4px 0;
}

.dq-compare-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 0.8125rem;
}

.dq-compare-table th,
.dq-compare-table td {
    border: 1px solid #e9ecef;
    padding: 6px 10px;
    text-align: left;
}

.dq-compare-table th {
    background: #f8f9fa;
    color: #2c3e50;
}

.dq-diff-field {
    font-weight: 600;
    color: #495057;
    background: #f8f9fa;
}

.dq-diff-cell-mismatch {
    background: #FADEDE;
    color: #DC2626;
    font-weight: 600;
}

.dq-page :focus-visible {
    outline: 2px solid #006401;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .dq-page,
    .dq-page * {
        animation: none !important;
        transition: none !important;
    }
}
