/* Call costs: the Overview's Spend section and the call drawer's Cost section.
   Uses the tokens from styles.css only, so it follows the light / dark theme. */

.ov-spend {
  transition: opacity .2s;
}

/* Refetch keeps the frame: the previous render stays, dimmed */
.ov-spend.is-loading {
  opacity: .55;
}

.spend-tables {
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
}

@media (max-width: 1000px) {
  .spend-tables {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Tables of money: right-aligned, aligned digits */
.cost-table .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.cost-table td {
  vertical-align: top;
}

/* Model ids stay on one line; on a narrow screen the table scrolls in its own box */
.cost-table code {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
}

.cost-service {
  font-weight: 600;
  color: var(--text-hi);
  white-space: nowrap;
}

.cost-model {
  color: var(--text-2);
  margin-right: 4px;
}

.cost-usage {
  color: var(--text-2);
  font-size: 12.5px;
}

.cost-sub {
  font-size: 11.5px;
  color: var(--text-3);
}

.cost-unpriced {
  font-size: 11.5px;
  color: var(--warn);
}

/* "your key": the company's own API key paid for this service */
.cost-key {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border-hi);
  font-size: 11px;
  color: var(--text-2);
  white-space: nowrap;
}

/* Call drawer */
.cost-total {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-bottom: 10px;
}

.cost-total b {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-hi);
}

.cost-total span {
  font-size: 12.5px;
  color: var(--text-3);
}

.cost-note {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: var(--warn);
}

.cost-sec .table-wrap {
  overflow-x: auto;
}

.cost-basis {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--text-3);
}

/* Spend by provider: money is wider than a call count, so its column sizes to the value */
#ov-spend-provider .meter-row {
  grid-template-columns: minmax(80px, 120px) minmax(48px, 1fr) auto 36px;
}

/* Phones: the Overview's model table keeps Service, Model and Cost (usage is in each call) */
@media (max-width: 560px) {
  #ov-spend-models .cost-usage {
    display: none;
  }
}

/* Call drawer → Cost: donut by service beside its legend (amount and share) */
.cost-donut {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: center;
  gap: 28px;
  margin: 4px 0 18px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
}

.cost-donut .chart-legend {
  width: 100%;
  max-width: 380px;
  margin: 0;
}

.cost-donut .chart-legend li {
  grid-template-columns: 10px minmax(0, 1fr) auto 44px;
}

.cost-donut .donut-value {
  font-size: 22px;
}

.cost-share {
  color: var(--text-3);
}

@media (max-width: 640px) {
  .cost-donut {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
  }

  .cost-donut .chart-legend {
    width: 100%;
  }
}
