.credit-usage-view {
  min-width: 0;
  min-height: 600px;
}

.credit-usage-state {
  padding: 70px 0;
  color: var(--muted-foreground);
  text-align: center;
}

.credit-usage-chart-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 12px 38px rgba(22, 32, 50, 0.05);
}

.credit-usage-card-heading {
  display: grid;
  min-height: 96px;
  padding: 19px 22px;
  align-items: end;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  border-bottom: 1px solid var(--border);
}

.credit-usage-card-heading h2 {
  margin-bottom: 5px;
  font-size: 19px;
}

.credit-usage-chart-metadata {
  display: flex;
  margin-bottom: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted-foreground);
  font-size: 13px;
  line-height: 1.5;
}

.credit-usage-chart-tools {
  display: flex;
  width: min(100%, 240px);
  min-width: 0;
}

.credit-usage-chart-tool {
  display: inline-flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.credit-usage-chart-tool > span {
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.credit-usage-chart-tool select {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 13px;
}

.credit-usage-chart-scroll {
  margin: 16px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.credit-usage-chart {
  min-width: max(100%, 720px);
  height: 300px;
  padding: 10px 18px;
}

.credit-usage-hairline-chart {
  display: block;
  width: 100%;
  height: 100%;
  font-family: Inter, var(--font-sans);
}

.credit-usage-calendar-tick {
  stroke: var(--palette-gray-bg);
  stroke-width: 0.6;
}

.credit-usage-calendar-baseline {
  stroke: var(--palette-gray-bg);
  stroke-width: 0.8;
}

.credit-usage-y-grid {
  stroke: var(--border);
  stroke-width: 0.6;
}

.credit-usage-y-grid.is-baseline {
  stroke: var(--muted-foreground);
  stroke-width: 1;
}

.credit-usage-y-label,
.credit-usage-y-unit {
  fill: var(--muted-foreground);
  font-size: 7px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-anchor: end;
}

.credit-usage-y-unit {
  letter-spacing: 0.08em;
}

.credit-usage-line-path {
  fill: none;
  stroke: var(--palette-blue-fg);
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  stroke-width: 1;
  animation: credit-usage-line-draw 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.credit-usage-day-point {
  fill: var(--palette-blue-fg);
  pointer-events: none;
  stroke: var(--palette-blue-fg);
  stroke-width: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: credit-usage-point-in 0.5s cubic-bezier(0.2, 0.7, 0.3, 1.3) both;
}

.credit-usage-day-point.is-weekend {
  fill: var(--palette-blue-bg);
  stroke-width: 1;
}

.credit-usage-day-hit {
  fill: transparent;
  cursor: pointer;
  outline: none;
  stroke: transparent;
  stroke-width: 1;
}

.credit-usage-day-hit:focus-visible {
  stroke: var(--palette-blue-fg);
}

.credit-usage-day-point.is-selected {
  stroke: var(--surface);
  stroke-width: 2;
}

.credit-usage-crosshair {
  display: none;
  pointer-events: none;
  stroke: var(--palette-blue-fg);
  stroke-width: 0.7;
}

.credit-usage-crosshair.is-visible {
  display: block;
}

.credit-usage-tooltip {
  display: none;
  pointer-events: none;
}

.credit-usage-tooltip.is-visible {
  display: block;
}

.credit-usage-tooltip-background {
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: 0.8;
}

.credit-usage-tooltip-text {
  fill: var(--foreground);
  font-size: 7.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.batch-redemption-stagger-chart {
  display: block;
  width: 100%;
  height: 100%;
  font-family: Inter, var(--font-sans);
}

.batch-redemption-stagger-grid {
  stroke: none;
}

.batch-redemption-stagger-grid.is-baseline {
  stroke: var(--muted-foreground);
  stroke-width: 1;
}

.batch-redemption-stagger-bar {
  fill: var(--bar-fill);
}

.batch-redemption-stagger-bar.is-active {
  stroke: var(--chart-accent-fg, var(--palette-blue-fg));
  stroke-width: 0.8;
}

.batch-redemption-zero-marker {
  fill: var(--chart-accent-fg, var(--palette-blue-fg));
  opacity: 0;
  pointer-events: none;
}

.batch-redemption-zero-marker.is-active {
  opacity: 1;
}

.batch-redemption-stagger-hit {
  fill: transparent;
  cursor: pointer;
  stroke: none;
}

.batch-redemption-stagger-hit:hover,
.batch-redemption-stagger-hit:focus-visible {
  fill: transparent;
  outline: none;
  stroke: none;
}

.credit-usage-peak-label {
  fill: var(--chart-accent-fg, var(--palette-blue-fg));
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  paint-order: stroke;
  stroke: var(--chart-accent-bg, var(--palette-blue-bg));
  stroke-width: 3px;
  text-anchor: middle;
}

.credit-usage-date-label {
  fill: var(--palette-gray-fg);
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-anchor: middle;
}

.credit-usage-x-title {
  fill: var(--muted-foreground);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-anchor: middle;
}

.credit-usage-chart-caption {
  fill: var(--palette-gray-fg);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-anchor: middle;
}

@keyframes credit-usage-line-draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes credit-usage-point-in {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

.credit-usage-view .table-heading {
  padding: 19px 22px;
}

.table-heading-title-block {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 5px;
}

.table-heading-title-row {
  display: inline-flex;
  width: fit-content;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.table-heading-title-row h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
}

.table-heading-title-block small {
  color: var(--muted-foreground);
  font-size: 13px;
  font-weight: 400;
}

.table-heading-chevron-toggle {
  display: inline-grid;
  width: 32px;
  height: 32px;
  padding: 0;
  flex: 0 0 32px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: var(--muted-foreground);
  background: transparent;
  line-height: 1;
}

.table-heading-chevron-toggle:hover {
  color: var(--foreground);
  background: var(--surface-muted);
}

.table-heading-chevron-toggle:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.table-heading-chevron {
  display: block;
  font-size: 18px;
  line-height: 1;
}

.credit-usage-view .table-heading-actions {
  margin-left: auto;
  align-self: center;
}

.credit-usage-table {
  min-width: 620px;
}

.credit-usage-table th:last-child,
.credit-usage-table td:last-child {
  font-variant-numeric: tabular-nums;
  text-align: left;
}

.credit-usage-user-statistics-heading {
  gap: 18px;
}

.credit-usage-user-statistics-actions {
  gap: 14px;
}

.credit-usage-user-statistics-table {
  min-width: 1240px;
  table-layout: fixed;
}

.credit-usage-user-statistics-table .credit-usage-user-column {
  width: 220px;
}

.credit-usage-user-statistics-table .credit-usage-contact-column {
  width: 250px;
}

.credit-usage-user-statistics-table .credit-usage-remark-column {
  width: 190px;
}

.credit-usage-user-statistics-table th:nth-child(3),
.credit-usage-user-statistics-table th:nth-child(4) {
  width: 145px;
}

.credit-usage-user-statistics-table th:nth-child(5),
.credit-usage-user-statistics-table th:nth-child(6) {
  width: 100px;
}

.credit-usage-user-statistics-table th:nth-child(8) {
  width: 130px;
}

.credit-usage-user-statistics-table td:nth-child(7) {
  overflow-wrap: anywhere;
  white-space: normal;
}

.credit-usage-user-information,
.credit-usage-user-contact {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.credit-usage-user-information strong {
  overflow: hidden;
  color: var(--foreground);
  text-overflow: ellipsis;
}

.credit-usage-user-information span,
.credit-usage-user-contact span {
  overflow: hidden;
  color: var(--muted-foreground);
  font-size: 12px;
  text-overflow: ellipsis;
}

#credit-usage-batch-settlement-dialog {
  width: min(calc(100% - 32px), 720px);
}

.credit-usage-batch-settlement-body {
  max-height: min(60vh, 560px);
  overflow-y: auto;
}

.credit-usage-batch-settlement-table {
  min-width: 520px;
}

.credit-usage-batch-settlement-table th:last-child,
.credit-usage-batch-settlement-table td:last-child {
  width: 190px;
}

.credit-usage-batch-settlement-table input {
  width: 160px;
  min-height: 38px;
  border-radius: 9px;
}

.credit-usage-batch-information {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.credit-usage-batch-information span {
  color: var(--muted-foreground);
  font-size: 12px;
}

@media (max-width: 900px) {
  .credit-usage-view .table-heading {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .table-heading-title-block {
    width: 100%;
    flex-basis: 100%;
  }

  .credit-usage-view .table-heading-actions {
    display: flex;
    width: 100%;
    min-width: 0;
    padding-top: 10px;
    align-self: stretch;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .credit-usage-user-statistics-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .credit-usage-view {
    min-height: 0;
  }

  .credit-usage-card-heading {
    align-items: stretch;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .credit-usage-chart-tools {
    width: 100%;
  }

  .credit-usage-chart {
    height: 250px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .credit-usage-line-path,
  .credit-usage-day-point {
    animation: none;
  }
}
