/* --- Tables ------------------------------------------------------------------- */

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

th, td {
    padding: 0.6rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    font-weight: 600;
    background: var(--wash);
}

tr:last-child td {
    border-bottom: none;
}

.tablewrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
}

.table {
    width: 100%;
    border: none;
    border-radius: 0;
}

.table th {
    font-size: 0.83rem;
    color: var(--muted);
    background: #f7fafd;
}

html[data-theme="dark"] .table th {
    background: var(--wash);
}

@media (max-width: 700px) {
    .tablewrap table,
    .tablewrap th,
    .tablewrap td {
        display: block;
    }

    .tablewrap thead {
        display: none;
    }

    .tablewrap tr {
        display: flex;
        flex-direction: column;
        border-bottom: 1px solid var(--line);
        padding: 0.5rem 0.75rem;
    }

    .tablewrap td {
        border-bottom: none;
        padding: 0.2rem 0;
    }
}

/* --- Cards ------------------------------------------------------------------ */

.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.card h1,
.card h2 {
    margin-top: 0;
}

.panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.panel-head h2 {
    margin: 0;
}

/* --- Pills --------------------------------------------------------------------- */

.pill {
    display: inline-block;
    padding: 0.18rem 0.65rem;
    border-radius: 7px;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    background: var(--wash);
    color: var(--muted);
}

.pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

/* Severity (risk) pills */
.risk-low {
    background: #e4f6eb;
    color: #1e5e40;
}

.risk-medium {
    background: #fff1cf;
    color: #75500e;
}

.risk-high {
    background: #fde8df;
    color: #8f3322;
}

.risk-critical {
    background: #fbe2ec;
    color: #962840;
}

/* Status pills: 7px dot on the left */
.status-new {
    background: #e9f3ff;
    color: #075db4;
}

.status-review,
.status-needs {
    background: #fff1d1;
    color: #715011;
}

.status-accepted,
.status-fixing,
.status-verification {
    background: #eae9ff;
    color: #4439a2;
}

.status-resolved,
.status-paid {
    background: #e3f6ec;
    color: #17663c;
}

.status-rejected,
.status-duplicate {
    background: #edf1f5;
    color: #4a5f75;
}

.pill.status-new::before,
.pill.status-review::before,
.pill.status-needs::before,
.pill.status-accepted::before,
.pill.status-fixing::before,
.pill.status-verification::before,
.pill.status-resolved::before,
.pill.status-paid::before,
.pill.status-rejected::before,
.pill.status-duplicate::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    margin-right: 0.4em;
    vertical-align: baseline;
}

/* --- Low-data badge ------------------------------------------------------------ */

.lowdata {
    display: inline-block;
    padding: 0.18rem 0.65rem;
    border-radius: 7px;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    background: var(--wash);
    color: var(--muted);
}

/* --- Metrics ----------------------------------------------------------------------- */

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

@media (max-width: 700px) {
    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.metric {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}

.metric-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--muted);
}

.metric-label .icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 27px;
    height: 27px;
    border-radius: var(--radius-sm);
    background: var(--wash);
    color: var(--brand);
    font-size: 0.875rem;
}

.metric strong {
    display: block;
    font-size: 1.7rem;
    line-height: 1.2;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
}

.metric p.muted {
    margin: 0.25rem 0 0;
    font-size: 0.8125rem;
}

/* --- Empty state / notice ------------------------------------------------------------------ */

.empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--muted);
    background: var(--paper);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
}

.notice {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    background: #e9f3ff;
    color: #075db4;
    border: 1px solid #cfe4fb;
}

/* --- Meter (status/severity distribution) ------------------------------------------------------ */

.meter {
    height: 7px;
    border-radius: 4px;
    background: var(--wash);
    overflow: hidden;
}

.meter-fill {
    height: 100%;
    background: var(--brand);
}

/* Widths are class-based (CSP forbids inline styles). */
.w-0 { width: 0%; }
.w-5 { width: 5%; }
.w-10 { width: 10%; }
.w-15 { width: 15%; }
.w-20 { width: 20%; }
.w-25 { width: 25%; }
.w-30 { width: 30%; }
.w-35 { width: 35%; }
.w-40 { width: 40%; }
.w-45 { width: 45%; }
.w-50 { width: 50%; }
.w-55 { width: 55%; }
.w-60 { width: 60%; }
.w-65 { width: 65%; }
.w-70 { width: 70%; }
.w-75 { width: 75%; }
.w-80 { width: 80%; }
.w-85 { width: 85%; }
.w-90 { width: 90%; }
.w-95 { width: 95%; }
.w-100 { width: 100%; }

@media (max-width: 640px) {
    table {
        display: block;
        overflow-x: auto;
    }
}
