/* ---- pages/usage.py: the month's AI use as tiles, charts and tables ---- */

/* The filters row above the cards: the month, and an administrator's company. */
.aucra-usage-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
.aucra-usage-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 240px;
  max-width: 100%;
}
.aucra-usage-filter-label {
  font-size: 12px;
  font-weight: var(--weight-bold);
  color: var(--muted);
}

.aucra-usage-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 18px 4px;
}
@media (max-width: 719px) {
  .aucra-usage-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* A stat value keeps proportional figures; tabular ones are for columns. */
/* A value never wraps: "US$0.0001" is one figure. */
.aucra-usage-tiles .aucra-tile-value {
  overflow-wrap: normal;
  white-space: nowrap;
}
@media (max-width: 599px) {
  .aucra-usage-tiles .aucra-tile-value {
    font-size: 18px;
  }
}
.aucra-usage-aside {
  margin-top: 2px;
}
.aucra-usage-caveat {
  padding: 2px 18px;
  font-size: 12.5px;
  color: var(--muted);
}
.aucra-usage-table-title {
  padding: 14px 18px 6px;
  font-size: 12px;
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--muted);
}
.aucra-usage-table {
  display: flex;
  flex-direction: column;
  padding-bottom: 6px;
}
.aucra-usage-head,
.aucra-usage-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 8px 18px;
  font-size: 13px;
  border-top: 1px solid var(--line);
}
.aucra-usage-head {
  font-size: 11.5px;
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--muted);
  border-top: 0;
}
.aucra-usage-head > :not(:first-child),
.aucra-usage-row > :not(:first-child) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
/* The name cell: a link for an administrator's company, a muted second
   line (a model's provider), and a bar of the row's share (a person's tokens). */
.aucra-usage-name {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  overflow-wrap: anywhere;
}
a.aucra-usage-link {
  color: var(--gold-deep);
  font-weight: var(--weight-bold);
}
.aucra-usage-sub {
  font-size: 12px;
  color: var(--muted);
}
.aucra-usage-bar {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
}
.aucra-usage-bar-fill {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: #2a78d6; /* kit/chart.py's SERIES */
}
/* Charts: ECharts sizes itself to its box; the bars' height follows their rows. */
.aucra-chart {
  width: 100%;
}
/* A margin, never padding: ECharts sizes its canvas to the padded box and
   clips the first labels. */
.aucra-section-card .aucra-chart {
  width: auto;
  margin: 12px 18px 8px;
}
.aucra-chart-line.nicegui-echart {
  height: 200px;
}
.aucra-usage-lines {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
  padding-bottom: 8px;
}
@media (max-width: 719px) {
  .aucra-usage-lines {
    grid-template-columns: minmax(0, 1fr);
  }
}
.aucra-usage-empty {
  padding: 12px 18px 14px;
}
/* One row per person under a company's month. */
.aucra-usage-people {
  display: flex;
  flex-direction: column;
  padding-bottom: 6px;
}
.aucra-usage-person {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 18px;
  font-size: 13px;
  border-top: 1px solid var(--line);
}
.aucra-usage-person > :last-child {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
/* Five columns do not fit a phone: the table scrolls inside its card, the
   page never does. */
@media (max-width: 599px) {
  /* The cue: a shadow at whichever edge still has columns past it. The
     panel coloured covers scroll with the content and uncover the shadows. */
  .aucra-usage-table {
    overflow-x: auto;
    background:
      linear-gradient(to right, var(--panel) 30%, transparent) left / 28px 100% no-repeat local,
      linear-gradient(to left, var(--panel) 30%, transparent) right / 28px 100% no-repeat local,
      radial-gradient(farthest-side at 0 50%, rgba(28, 33, 38, 0.16), transparent)
        left / 12px 100% no-repeat scroll,
      radial-gradient(farthest-side at 100% 50%, rgba(28, 33, 38, 0.16), transparent)
        right / 12px 100% no-repeat scroll;
  }
  .aucra-usage-head,
  .aucra-usage-row {
    min-width: 540px;
    grid-template-columns: minmax(0, 1.4fr) repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 8px 12px;
    font-size: 12px;
  }
}

/* ---- The monthly AI limits (dashboard plan section 3) ---- */
/* The 80 % line: on the limit card, under the drawer's box and under a
   suggestion card (services/ai/limits.py). */
.aucra-ai-warning,
.aucra-chat .aucra-chat-note.aucra-ai-warning {
  color: var(--warn);
  font-size: 12.5px;
}
.aucra-usage-limits {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 18px 4px;
}
@media (max-width: 719px) {
  .aucra-usage-limits {
    grid-template-columns: minmax(0, 1fr);
  }
}
.aucra-usage-limit {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.aucra-usage-limit-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: var(--weight-bold);
  color: var(--muted);
}
.aucra-usage-limits-foot {
  padding: 4px 18px 14px;
}
