/* Customer usage totals and per-request counts. */
#workspace .token-usage-cell {
  min-width: 158px;
  text-align: left;
  white-space: normal;
}
#workspace .token-facts {
  color: #3b5747;
  font-variant-numeric: tabular-nums;
}
#workspace .token-facts dl {
  margin: 0;
  display: grid;
  gap: 4px;
}
#workspace .token-facts dl > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
}
#workspace .token-facts dt {
  font-size: 14px;
  color: #61705c;
  white-space: nowrap;
}
#workspace .token-facts dd {
  margin: 0;
  font-size: 14px;
  font-weight: 550;
  text-align: right;
  overflow-wrap: anywhere;
}
#workspace .token-facts dl > div:last-child {
  border-top: 1px solid #edf1e6;
  padding-top: 5px;
}
#workspace #usage-summary .token-summary-breakdown {
  flex: 1 1 280px;
  min-width: 0;
}
#workspace .token-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
#workspace .token-summary-grid b {
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
#workspace .token-summary-grid small {
  display: block;
  font-size: 13px;
  color: #61705c;
}
.billing-row-group {
  display: block;
  margin-top: 4px;
  color: #4b6958;
}
#billing-detail {
  width: min(580px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: clamp(16px, 4vw, 28px);
}
#billing-detail .dialog-head { margin-bottom: 12px; }
#billing-detail .close-button { min-width: 36px; min-height: 36px; }
#billing-detail .billing-detail-model {
  color: #163c32;
  font: 600 17px/1.4 var(--mono);
  overflow-wrap: anywhere;
}
#billing-detail .billing-detail-meta {
  display: grid;
  gap: 8px;
  margin: 14px 0 18px;
}
#billing-detail .billing-detail-meta > div {
  display: grid;
  grid-template-columns: minmax(0, 96px) minmax(0, 1fr);
  gap: 12px;
}
#billing-detail dt { color: #506458; font-size: 13px; }
#billing-detail dd { margin: 0; overflow-wrap: anywhere; }
#billing-detail .billing-detail-tokens {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: #dce6dd;
  border: 1px solid #dce6dd;
  border-radius: 10px;
  margin: 0;
  overflow: hidden;
}
#billing-detail .billing-detail-tokens > div {
  background: #f7faf6;
  padding: 11px 13px;
}
#billing-detail .billing-detail-tokens > div:last-child {
  grid-column: span 2;
  background: #edf4eb;
}
#billing-detail .billing-detail-tokens dd {
  margin-top: 4px;
  color: #203f31;
  font: 600 18px/1.35 var(--mono);
  font-variant-numeric: tabular-nums;
}
#billing-detail .billing-detail-note {
  margin-top: 12px;
  font-size: 13px;
  color: #506458;
}
@media (max-width: 850px) {
  #workspace #usage-summary .token-summary-breakdown { flex-basis: 100%; }
}

/* Token totals (2026-11-30): their own full-width card under the money figures; each count is a short
   figure with a unit, the exact count beneath in code style, and an input/output split bar. */
@media (min-width: 621px) {
  #workspace .usage-summary:has(> .token-summary-breakdown) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
#workspace .usage-summary > section.token-summary-breakdown {
  grid-column: 1 / -1;
  padding: 16px 18px 14px;
  background: #fff;
  border: 1px solid var(--workspace-line, #dfe2ea);
  border-radius: var(--radius, 14px);
}
#workspace .usage-summary .token-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px 0;
}
#workspace .token-stat {
  --token-tone: #202835;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  padding: 0 18px;
  border-left: 1px solid #eceef4;
}
#workspace .token-stat:first-child {
  padding-left: 0;
  border-left: 0;
}
#workspace .token-stat-input { --token-tone: #3549a4; }
#workspace .token-stat-output { --token-tone: #0f7258; }
#workspace .token-stat-cache { --token-tone: #9a5b0f; }
#workspace .usage-summary .token-stat-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  white-space: nowrap;
}
#workspace .token-stat-label::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--token-tone);
}
#workspace .usage-summary b.token-stat-value {
  color: var(--token-tone);
  font: 600 22px/1.15 var(--ui-sans);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow-wrap: normal;
}
#workspace .usage-summary b.token-stat-value .token-stat-unknown {
  color: var(--workspace-muted, #555e6f);
  font-size: 17px;
}
#workspace .usage-summary .token-summary-grid small.token-stat-unit {
  display: inline;
  margin-left: 3px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--workspace-muted, #555e6f);
}
#workspace .usage-summary .token-summary-grid small.token-stat-about {
  margin: 0 4px 0 0;
}
#workspace .token-stat-exact {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 1px 7px;
  color: #424b5d;
  background: #f4f5f9;
  border: 1px solid #e2e5ee;
  border-radius: 5px;
  font: 500 12px/1.65 var(--mono, "Cascadia Code", Consolas, monospace);
  font-variant-numeric: tabular-nums;
}
#workspace .usage-summary .token-summary-grid small.token-stat-note {
  font-size: 12px;
  line-height: 1.65;
}
#workspace .token-split {
  display: flex;
  height: 6px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 3px;
  background: #0f7258;
}
#workspace .token-split-input {
  min-width: 2px;
  background: #3549a4;
  box-shadow: 2px 0 0 #fff;
}
#workspace .token-split-legend {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 7px;
  font: 500 12px/1.4 var(--ui-sans);
  font-variant-numeric: tabular-nums;
}
#workspace .token-split-key-input { color: #3549a4; }
#workspace .token-split-key-output { color: #0f7258; }
#workspace .token-summary-breakdown .billing-detail-note {
  margin: 10px 0 0;
}
@media (max-width: 620px) {
  /* Two money cards per row on phones; the third (failed records) becomes one slim full-width row. */
  #workspace .usage-summary:has(> .token-summary-breakdown) > div:nth-child(3) {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
}
@media (max-width: 640px) {
  #workspace .usage-summary .token-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #workspace .token-stat:nth-child(odd) {
    padding-left: 0;
    border-left: 0;
  }
}
