/* Usage report (/usage). Palette: one sequential blue ramp for magnitude; two categorical series, blue =
   Kaufman Rossin and orange = outside users (the validated data-viz pair); text in ink tokens only. Charts
   are inline SVG built by the usage helpers; cards are self-contained (the app has no shared card class). */
.usage-report {
  --usage-ink: #0b0b0b;
  --usage-ink-2: #52514e;
  --usage-muted: #898781;
  --usage-grid: #e1e0d9;
  --usage-baseline: #c3c2b7;
  --usage-track: #f3f2ee;
  --usage-kr: #2a78d6;
  --usage-ext: #eb6834;
  --heat-1: #b7d3f6;
  --heat-2: #86b6ef;
  --heat-3: #5598e7;
  --heat-4: #2a78d6;
  --heat-5: #1c5cab;
  --heat-6: #0d366b;
  color: var(--usage-ink);
  padding-bottom: 24px;
}

#usage-header {
  padding-top: 30px;
  font-size: 24px;
  color: black;
  margin-bottom: 20px;
  font-weight: bold;
}

.usage-intro {
  color: #52514e;
  max-width: 960px;
  margin: 0 0 18px;
}

/* Cards */
.usage-card {
  background: #fff;
  border: 1px solid #d9d9d9;
  box-shadow: 0 4px 12px 3px rgba(0, 0, 0, 0.12);
  border-radius: 18px;
  margin-bottom: 20px;
  padding: 20px 24px 18px;
}

.usage-empty {
  margin-bottom: 38px;
}

.usage-card h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 2px;
}

.usage-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.usage-card-head p {
  margin: 0;
  color: var(--usage-ink-2);
}

.usage-subhead {
  font-size: 14px;
  font-weight: 700;
  margin: 16px 0 4px;
}

/* What to count: everything / changes / downloads / sign-ins */
.usage-kind {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}

.usage-kind-label {
  color: #52514e;
  font-size: 13px;
}

.usage-kind .btn {
  font-size: 13px;
}

.usage-kind .btn.active {
  background: #1d4c7e;
  border-color: #1d4c7e;
  color: #fff;
}

.usage-kind-count {
  opacity: 0.8;
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}

/* KPI row */
.usage-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.usage-kpi {
  padding: 14px 18px;
  border-radius: 12px;
  margin-bottom: 0;
}

.usage-kpi-label {
  color: var(--usage-ink-2);
  font-size: 13px;
}

.usage-kpi-value {
  font-size: 30px;
  font-weight: 600;
  line-height: 1.1;
  margin-top: 4px;
}

.usage-kpi-hero {
  font-size: 46px;
}

.usage-kpi-of {
  font-size: 16px;
}

.usage-kpi-detail {
  color: var(--usage-ink-2);
  font-size: 12.5px;
  margin-top: 4px;
}

/* Filter row: scopes the heatmap and the people table together */
.usage-filters {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 14px;
}

.usage-filters label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--usage-ink-2);
  font-size: 13px;
  margin: 0;
}

.usage-filters .form-select,
.usage-filters .form-control {
  width: auto;
}

.usage-count {
  margin-left: auto;
  color: var(--usage-muted);
  font-size: 13px;
}

/* Legends */
.usage-legend {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--usage-ink-2);
  font-size: 13px;
  margin: 8px 0 0;
}

.usage-legend-tight {
  margin: 0 0 6px;
}

.usage-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
}

.usage-dot-kr { fill: var(--usage-kr); background: var(--usage-kr); }
.usage-dot-ext { fill: var(--usage-ext); background: var(--usage-ext); }

.usage-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -2px;
}

.usage-swatch-kr { background: var(--usage-kr); }
.usage-swatch-ext { background: var(--usage-ext); }

.usage-scale {
  display: inline-flex;
  gap: 2px;
  align-items: center;
}

.usage-scale i {
  display: inline-block;
  width: 18px;
  height: 12px;
  border-radius: 2px;
}

.usage-scale i.heat-1 { background: var(--heat-1); }
.usage-scale i.heat-2 { background: var(--heat-2); }
.usage-scale i.heat-3 { background: var(--heat-3); }
.usage-scale i.heat-4 { background: var(--heat-4); }
.usage-scale i.heat-5 { background: var(--heat-5); }
.usage-scale i.heat-6 { background: var(--heat-6); }

/* SVG charts */
.usage-scroll {
  overflow-x: auto;
}

.usage-report svg {
  display: block;
  font-family: inherit;
}

.usage-report svg text {
  fill: var(--usage-ink-2);
  font-size: 12px;
}

.usage-report svg text.label { fill: var(--usage-ink); }
.usage-report svg text.value { fill: var(--usage-ink-2); font-size: 11.5px; }
.usage-report svg text.axis { fill: var(--usage-muted); font-size: 11.5px; }
.usage-report svg text.axis-muted { fill: var(--usage-muted); font-size: 11px; }
.usage-report svg line.grid { stroke: var(--usage-grid); stroke-width: 1; shape-rendering: crispEdges; }
.usage-report svg line.baseline { stroke: var(--usage-baseline); stroke-width: 1; shape-rendering: crispEdges; }
.usage-report svg .usage-track { fill: var(--usage-track); }
.usage-report svg .hit { fill: transparent; }
.usage-report svg .s-kr { fill: var(--usage-kr); }
.usage-report svg .s-ext { fill: var(--usage-ext); }
.usage-report svg .heat-0 { fill: transparent; }
.usage-report svg .heat-1 { fill: var(--heat-1); }
.usage-report svg .heat-2 { fill: var(--heat-2); }
.usage-report svg .heat-3 { fill: var(--heat-3); }
.usage-report svg .heat-4 { fill: var(--heat-4); }
.usage-report svg .heat-5 { fill: var(--heat-5); }
.usage-report svg .heat-6 { fill: var(--heat-6); }
.usage-report svg .col:hover rect:not(.hit),
.usage-report svg .col:focus rect:not(.hit),
.usage-report svg .col:hover path,
.usage-report svg .col:focus path,
.usage-report svg .cell:hover,
.usage-report svg .cell:focus {
  filter: brightness(1.12);
  outline: none;
}

.usage-report svg .cell.heat-0:hover { fill: var(--usage-track); }
.usage-report svg .usage-row.hidden { display: none; }
.usage-report .tab { font-variant-numeric: tabular-nums; }

.usage-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 18px;
}

/* Tooltip */
.usage-tip {
  position: fixed;
  z-index: 1080;
  pointer-events: none;
  background: var(--usage-ink);
  color: #fff;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  line-height: 1.4;
  white-space: pre-line;
  max-width: 340px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.usage-tip strong {
  font-size: 14px;
}

/* Tables (the accessible twin of every chart) */
.usage-table-wrap {
  max-height: 70vh;
  overflow: auto;
  margin-top: 12px;
}

.usage-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}

.usage-table th,
.usage-table td {
  text-align: left;
  padding: 7px 10px;
  border-bottom: 1px solid var(--usage-grid);
  vertical-align: top;
}

.usage-table th {
  color: var(--usage-ink-2);
  font-weight: 600;
  font-size: 12.5px;
  position: sticky;
  top: 0;
  background: #fff;
}

.usage-table th.sortable { cursor: pointer; user-select: none; }
.usage-table th.sortable::after { content: ' ↕'; color: var(--usage-muted); }
.usage-table th.sorted-asc::after { content: ' ↑'; color: var(--usage-ink); }
.usage-table th.sorted-desc::after { content: ' ↓'; color: var(--usage-ink); }
.usage-table td.num,
.usage-table th.num { text-align: right; }
.usage-table tr.hidden { display: none; }
.usage-table tr.usage-deleted td { color: var(--usage-ink-2); }

/* Never-active accounts + notes */
.usage-report details summary {
  cursor: pointer;
  color: var(--usage-ink-2);
}

.usage-never {
  columns: 2;
  column-gap: 32px;
  margin: 10px 0 0;
  padding-left: 0;
  list-style: none;
  font-size: 13px;
}

.usage-never li {
  padding: 3px 0;
  break-inside: avoid;
}

.usage-muted {
  color: var(--usage-muted);
}

.usage-notes {
  color: var(--usage-ink-2);
  font-size: 13px;
}

.usage-notes ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.usage-notes li {
  margin: 4px 0;
}

@media print {
  .usage-kind,
  .usage-filters,
  .usage-toggle,
  .usage-tip {
    display: none !important;
  }
}
