/* ==========================================================================
   components/widgets.css — stat wells, tiles, CSS trend bars, metric rows
   Reusable analytics widgets (used by the dashboard and future pages).
   ========================================================================== */

/* ---- Stat wells inside the Monthly Review card ---- */
.stat-well {
    background: var(--crm-surface-alt);
    border: 1px solid var(--crm-border);
    border-radius: 8px;
    padding: 0.875rem 1rem;
    height: 100%;
}
.stat-well .stat-label {
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--crm-text-muted);
    margin-bottom: 0.25rem;
}
.stat-well .stat-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--crm-ink);
    font-variant-numeric: tabular-nums;
}

/* Smaller secondary tiles */
.stat-tile {
    border: 1px solid var(--crm-border);
    border-radius: 6px;
    padding: 0.5rem 0.625rem;
    text-align: center;
    height: 100%;
    background: var(--crm-surface);
}
.stat-tile .stat-label {
    font-size: 0.6875rem;
    color: var(--crm-text-muted);
    margin-bottom: 0.125rem;
}
.stat-tile .stat-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--crm-text);
    font-variant-numeric: tabular-nums;
}

/* ---- Revenue trend (CSS-only bar chart) ---- */
.trend-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.625rem;
    height: 120px;
    padding-top: 0.5rem;
}
.trend-col {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    height: 100%;
    gap: 0.375rem;
}
.trend-bar-track {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    width: 100%;
    max-width: 44px;
    flex: 1 1 auto;
}
.trend-bar {
    width: 100%;
    min-height: 3px;
    background: var(--crm-primary);
    opacity: 0.85;
    border-radius: 3px 3px 0 0;
    transition: opacity 120ms ease;
}
.trend-col:hover .trend-bar { opacity: 1; }
.trend-value {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--crm-text-secondary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.trend-label {
    font-size: 0.6875rem;
    color: var(--crm-text-muted);
    white-space: nowrap;
}

/* ---- Breakdown rows (status lists, snapshot) ---- */
.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5625rem 0;
    border-bottom: 1px solid var(--crm-border);
    font-size: 0.8125rem;
    color: var(--crm-text);
}
.metric-row:last-child { border-bottom: 0; }
.metric-row .metric-count {
    font-weight: 600;
    color: var(--crm-ink);
    font-variant-numeric: tabular-nums;
}

/* Proportional bar under breakdown labels */
.metric-row .metric-label { flex: 0 0 auto; }
.metric-row .metric-bar {
    flex: 1 1 auto;
    height: 4px;
    border-radius: 2px;
    background: var(--crm-border-soft, #eef1f4);
    overflow: hidden;
}
.metric-row .metric-bar > span {
    display: block;
    height: 100%;
    background: var(--crm-primary);
    opacity: 0.7;
    border-radius: 2px;
}

@media (max-width: 575.98px) {
    .trend-chart { height: 96px; gap: 0.375rem; }
    .trend-value { display: none; }
}
