/* ============================================================================
   Usage & Cost — the finance-mode ledger view (go-to-market shortlist §3.1).

   Supplements the standard classes: .execution-list / .card / .table /
   .execution-table / .scroll-sentinel / .pagination and the .btn family all come
   from main.css + components.css and are used unchanged. Everything here is
   prefixed `ulg-` and exists because this section has genuinely new furniture:
   a period bar, a status legend, and a two-column totals breakdown.
   ============================================================================ */

/* ── Period bar ───────────────────────────────────────────── */
.ulg-period {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-sm);
    margin-left: auto;
}

.ulg-label {
    color: var(--text-secondary);
    font-size: var(--font-size-body-xs);
}

/* Compact form controls. main.css styles input/select at element level, so this only tightens the
   padding for a dense filter row and gives <input type="date"> the same treatment (it is not in
   main.css's element selector list). */
.ulg-control {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-family: inherit;
    font-size: var(--font-size-body-xs);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius-md);
    min-width: 140px;
}

.ulg-control::placeholder {
    color: var(--text-muted);
}

.ulg-note {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--font-size-body-xs);
    line-height: 1.5;
}

/* ── Filters ──────────────────────────────────────────────── */
.ulg-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    align-items: center;
}

.ulg-filter-note {
    color: var(--text-muted);
    font-size: var(--font-size-body-xs);
}

/* ── Totals panel ─────────────────────────────────────────── */
.ulg-totals {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.ulg-totals__head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--spacing-sm);
}

.ulg-totals__title {
    color: var(--text-primary);
    font-size: var(--font-size-body-sm);
    font-weight: 600;
    margin-right: var(--spacing-sm);
}

.ulg-totals__range,
.ulg-totals__elapsed {
    color: var(--text-muted);
    font-size: var(--font-size-body-xs);
}

.ulg-totals__grand {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-sm);
}

.ulg-totals__grand-value {
    color: var(--text-primary);
    font-size: var(--font-size-h4);
    font-weight: 600;
}

.ulg-totals__grand-label {
    color: var(--text-secondary);
    font-size: var(--font-size-body-xs);
}

.ulg-loading,
.ulg-problem {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius-lg);
    font-size: var(--font-size-body-xs);
}

.ulg-loading {
    color: var(--text-secondary);
}

.ulg-problem {
    color: var(--accent-danger);
    border-color: var(--accent-danger);
}

/* ── Status chips + legend ────────────────────────────────── */
.ulg-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.ulg-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius-lg);
    color: var(--text-secondary);
    font-size: var(--font-size-body-xs);
    cursor: pointer;
}

.ulg-chip:hover {
    background: var(--bg-muted);
}

.ulg-chip__label {
    color: var(--text-primary);
}

.ulg-chip__count {
    font-weight: 600;
    color: var(--text-primary);
}

.ulg-chip__rows {
    color: var(--text-muted);
}

.ulg-legend {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--font-size-body-xs);
    line-height: 1.5;
}

/* ── Breakdown tables ─────────────────────────────────────────
   Stacked full width, not side by side (aug-12 cleanup §3.5). Three narrow columns meant none of the
   three fitted its rows and all three needed horizontal scrolling — and horizontally scrolling a summary
   panel is the wrong trade. Vertical space is free and these read top to bottom anyway. */
.ulg-breakdowns {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.ulg-breakdown {
    width: 100%;
}

.ulg-breakdown__title {
    margin: 0 0 var(--spacing-xs) 0;
    color: var(--text-secondary);
    font-size: var(--font-size-body-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ulg-group-row {
    cursor: pointer;
}

.ulg-empty {
    margin: 0;
    color: var(--text-muted);
    font-size: var(--font-size-body-xs);
}

/* ── Rows ─────────────────────────────────────────────────── */
.ulg-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    vertical-align: middle;
}

.ulg-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* A value that is absent on purpose — an unattributed row's tenant, an unpriced row's metric. Styled
   as clearly-not-a-name so it can never be mistaken for one. */
.ulg-null {
    color: var(--text-muted);
    font-style: italic;
}
