/* ============================================================
   usage.css — Usage page (usage.html)
   Layered on top of main.css (shared Hub chrome). Colors come from
   the theme tokens in tokens.css, so dark (default) and
   body.theme-light both work without per-mode overrides, except
   the bar color, which is stepped separately per surface.
   ============================================================ */

.usage-main { max-width: 1120px; margin: 0 auto; padding: 24px 28px 64px; }

.usage-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.usage-title { font-size: 24px; font-weight: 700; color: var(--color-text-heading); margin: 0 0 6px; }
.usage-subtitle { font-size: 14px; line-height: 1.5; color: var(--color-text-muted); margin: 0; max-width: 70ch; }

/* Range filter — one row, above everything it controls. */
.usage-range { display: inline-flex; border: 1px solid var(--color-border); border-radius: 9px; overflow: hidden; background: var(--color-surface); }
.usage-range__btn { min-height: 36px; padding: 6px 14px; border: 0; background: transparent; color: var(--color-text-muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.usage-range__btn + .usage-range__btn { border-left: 1px solid var(--color-border); }
.usage-range__btn[aria-pressed="true"] { background: rgba(197,33,39,.14); color: var(--color-text-heading); }
.usage-range__btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }

.usage-status { margin: 24px 0; color: var(--color-text-muted); font-size: 14px; }
.usage-status:empty { display: none; }

/* Stat tiles */
.usage-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.usage-kpi { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px; }
.usage-kpi__label { font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--color-text-muted); }
.usage-kpi__value { font-size: 28px; font-weight: 700; line-height: 1.1; color: var(--color-text-heading); font-variant-numeric: tabular-nums; }

/* Cards */
.usage-card { position: relative; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px; padding: 16px; margin-bottom: 16px; min-width: 0; }
.usage-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.usage-card__head h2 { margin: 0; font-size: 15px; font-weight: 700; color: var(--color-text-heading); }
.usage-link-btn { border: 0; background: none; padding: 6px 0; min-height: 32px; color: var(--color-text-muted); font: inherit; font-size: 13px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.usage-link-btn:hover { color: var(--color-text-heading); }
.usage-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 16px; }
/* Side by side only when both tables fit without scrolling. */
@media (min-width: 1500px) { .usage-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); } }
.usage-grid .usage-card { margin-bottom: 16px; }

/* Chart — single series, brand red stepped per surface (validated ≥3:1). */
.usage-chart { width: 100%; overflow: hidden; }
.usage-chart svg { display: block; width: 100%; height: auto; }
.usage-bar { fill: #E0484D; }
body.theme-light .usage-bar { fill: #C52127; }
.usage-bar.is-hover { fill: #F06A6E; }
body.theme-light .usage-bar.is-hover { fill: #A51A1F; }
.usage-hit { fill: transparent; cursor: pointer; }
.usage-grid-line { stroke: var(--color-border); stroke-width: 1; opacity: .6; }
.usage-baseline { stroke: var(--color-text-muted); stroke-width: 1; opacity: .5; }
.usage-axis { fill: var(--color-text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }

.usage-tooltip { position: absolute; z-index: 5; pointer-events: none; display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px; background: var(--color-surface-alt); border: 1px solid var(--color-border); box-shadow: 0 6px 20px rgba(0,0,0,.25); font-size: 12.5px; color: var(--color-text); white-space: nowrap; }
.usage-tooltip strong { color: var(--color-text-heading); font-size: 13px; }

/* Tables */
.usage-table-wrap { overflow-x: auto; }
.usage-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.usage-table th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; color: var(--color-text-muted); padding: 6px 8px; border-bottom: 1px solid var(--color-border); white-space: nowrap; }
.usage-table td { padding: 9px 8px; border-bottom: 1px solid var(--color-border); color: var(--color-text); vertical-align: top; }
.usage-table tr:last-child td { border-bottom: 0; }
.usage-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.usage-table a, .usage-recent a { color: var(--color-text-heading); font-weight: 600; text-decoration: none; }
.usage-table a:hover, .usage-recent a:hover { text-decoration: underline; }
.usage-sub { display: block; margin-top: 2px; font-size: 12px; color: var(--color-text-muted); overflow-wrap: anywhere; }
.usage-dim { color: var(--color-text-muted); }
/* People: keep a name and its email on whole lines; the table scrolls
   sideways inside its card on narrow screens instead of breaking mid-word. */
#usage-users td:first-child { min-width: 180px; }
#usage-users td:first-child, #usage-users .usage-sub { white-space: nowrap; overflow-wrap: normal; }
.usage-empty { margin: 8px 0; color: var(--color-text-muted); font-size: 13px; list-style: none; }

/* Recent activity */
.usage-recent { list-style: none; margin: 0; padding: 0; }
.usage-recent li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; padding: 8px 0; border-bottom: 1px solid var(--color-border); font-size: 13px; color: var(--color-text); }
.usage-recent li:last-child { border-bottom: 0; }
.usage-recent__who { font-weight: 600; color: var(--color-text-heading); }
.usage-recent time { margin-left: auto; color: var(--color-text-muted); font-size: 12px; white-space: nowrap; }

.usage-footnote { margin: 4px 0 0; font-size: 12px; line-height: 1.5; color: var(--color-text-muted); }

@media (max-width: 768px) {
  .usage-main { padding: 18px 16px 48px; }
  .usage-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-kpi__value { font-size: 24px; }
  .usage-range { width: 100%; }
  .usage-range__btn { flex: 1 1 0; min-height: 40px; }
}
