.billing-engine {
  --be-control-shadow: 0 1px 3px #0000001a, 0 1px 2px -1px #0000001a;
  font-family: var(--font-sans, ui-sans-serif, system-ui, sans-serif);
  color: var(--foreground);
  font-size: 14px;
  line-height: 20px;
  text-align: left;
}
.billing-engine *,
.billing-engine *::before,
.billing-engine *::after {
  box-sizing: border-box;
}
.billing-engine button,
.billing-engine input {
  font-family: inherit;
}
.billing-engine button:disabled,
.billing-engine input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
.billing-engine button:not(:disabled),
.billing-engine input[type="checkbox"]:not(:disabled) {
  cursor: pointer;
}
.billing-engine :focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.billing-engine h2 {
  font-size: 18px;
  font-weight: 600;
  line-height: 28px;
  letter-spacing: -0.025em;
  margin: 0;
}
.billing-engine h3 {
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  letter-spacing: -0.025em;
  margin: 0;
}
.billing-engine p {
  margin: 0;
}
.billing-engine strong,
.billing-engine b {
  font-weight: 500;
}
.billing-engine .be-subtitle {
  font-size: 12px;
  line-height: 16px;
  color: var(--muted-foreground);
  margin-top: 8px;
}
.billing-engine .be-subtitle strong {
  color: var(--foreground);
}
.billing-engine .be-muted {
  color: var(--muted-foreground);
}
.billing-engine .be-xs {
  font-size: 12px;
  line-height: 16px;
}
.billing-engine.be-feature {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.billing-engine .be-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.billing-engine .be-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}
.billing-engine .be-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  box-shadow:
    0 1px 3px #0000001a,
    0 1px 2px -1px #0000001a;
}
.billing-engine .be-counts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.billing-engine .be-count {
  border: 1px solid;
  border-radius: 8px;
  padding: 12px 16px;
}
.billing-engine .be-count > span {
  display: block;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  opacity: 0.8;
}
.billing-engine .be-count > strong {
  display: block;
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.billing-engine .be-count-0 {
  border-color: oklch(90.5% 0.093 164.15);
  background: oklch(97.9% 0.021 166.113 / 0.7);
  color: oklch(43.2% 0.095 166.913);
}
.billing-engine .be-count-1 {
  border-color: oklch(88.2% 0.059 254.128);
  background: oklch(97% 0.014 254.604 / 0.7);
  color: oklch(42.4% 0.199 265.638);
}
.billing-engine .be-count-2 {
  border-color: oklch(92.4% 0.12 95.746);
  background: oklch(98.7% 0.022 95.277 / 0.7);
  color: oklch(41.4% 0.112 45.904);
}
.billing-engine .be-count-3 {
  border-color: oklch(84.5% 0.143 164.978);
  background: oklch(95% 0.052 163.051 / 0.7);
  color: oklch(37.8% 0.077 168.94);
}
.billing-engine .be-sources {
  padding: 24px;
}
.billing-engine .be-source-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.billing-engine .be-source {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  font-size: 12px;
  line-height: 16px;
  text-align: left;
}
.billing-engine .be-source > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.billing-engine .be-source-detail {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  line-height: 16px;
  overflow-wrap: anywhere;
}
.billing-engine .be-source-detail p {
  margin-top: 4px;
  color: var(--muted-foreground);
}
.billing-engine .be-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid;
  border-radius: 9999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  white-space: nowrap;
}
.billing-engine .be-tone-green {
  color: oklch(50.8% 0.118 165.612);
  background: oklch(97.9% 0.021 166.113);
  border-color: oklch(90.5% 0.093 164.15);
}
.billing-engine .be-tone-blue {
  color: oklch(48.8% 0.243 264.376);
  background: oklch(97% 0.014 254.604);
  border-color: oklch(88.2% 0.059 254.128);
}
.billing-engine .be-tone-amber {
  color: oklch(47.3% 0.137 46.201);
  background: oklch(98.7% 0.022 95.277);
  border-color: oklch(92.4% 0.12 95.746);
}
.billing-engine .be-tone-red {
  color: oklch(50.5% 0.213 27.518);
  background: oklch(97.1% 0.013 17.38);
  border-color: oklch(88.5% 0.062 18.334);
}
.billing-engine .be-tone-indigo {
  color: oklch(45.7% 0.24 277.023);
  background: oklch(96.2% 0.018 272.314);
  border-color: oklch(87% 0.065 274.039);
}
.billing-engine .be-tone-muted {
  color: var(--muted-foreground);
  background: var(--muted);
  border-color: var(--border);
}
.billing-engine .be-filters,
.billing-engine .be-bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.billing-engine .be-search {
  position: relative;
  min-width: 240px;
  max-width: 448px;
  flex: 1;
}
.billing-engine .be-search > .be-icon {
  position: absolute;
  left: 10px;
  top: 10px;
  color: var(--muted-foreground);
  pointer-events: none;
}
.billing-engine .be-search > input {
  height: 36px;
  border: 1px solid var(--input);
  border-radius: 6px;
  padding: 4px 12px 4px 32px;
  width: 100%;
  font-size: 14px;
  line-height: 20px;
  background: transparent;
  box-shadow: var(--be-control-shadow);
  color: var(--foreground);
}
.billing-engine .be-search > input::placeholder {
  color: var(--muted-foreground);
}
.billing-engine .be-select {
  position: relative;
  width: 220px;
  max-width: 100%;
  flex-shrink: 0;
}
.billing-engine .be-select > button {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--input);
  border-radius: 6px;
  background: transparent;
  box-shadow: var(--be-control-shadow);
  color: var(--foreground);
  font-size: 14px;
  line-height: 20px;
}
.billing-engine .be-select > button > span {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.billing-engine .be-select > button > .be-icon {
  opacity: 0.5;
}
.billing-engine .be-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 40;
  width: max-content;
  min-width: 100%;
  max-width: min(400px, 90vw);
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px;
  background: var(--popover);
  box-shadow:
    0 4px 6px -1px #0000001a,
    0 2px 4px -2px #0000001a;
}
.billing-engine .be-options [role="option"] {
  display: flex;
  align-items: center;
  border-radius: 2px;
  padding: 6px 8px;
  font-size: 14px;
  line-height: 20px;
  cursor: pointer;
}
.billing-engine .be-option-focused {
  background: var(--accent);
  color: var(--accent-foreground);
}
.billing-engine .be-option-check {
  width: 24px;
  display: flex;
  align-items: center;
}
.billing-engine .be-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
}
.billing-engine .be-checkbox {
  appearance: none;
  -webkit-appearance: none;
  display: inline-block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 1px solid var(--primary);
  border-radius: 4px;
  background: transparent;
  margin: 0;
  box-shadow: var(--be-control-shadow);
  vertical-align: middle;
}
.billing-engine .be-checkbox:checked {
  background-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m20 6-11 11-5-5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.billing-engine .be-checkbox:indeterminate {
  background-color: var(--primary);
  background-image: linear-gradient(white, white);
  background-size: 8px 2px;
  background-position: center;
  background-repeat: no-repeat;
}
.billing-engine .be-bulk {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in oklab, var(--muted) 30%, transparent);
  padding: 12px;
}
.billing-engine .be-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  border: 0;
  border-radius: 6px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  height: 36px;
  padding: 8px 16px;
  transition: background-color 0.15s;
}
.billing-engine .be-button.be-small {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  line-height: 16px;
}
.billing-engine .be-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow:
    0 1px 3px #0000001a,
    0 1px 2px -1px #0000001a;
}
.billing-engine .be-primary:hover:not(:disabled) {
  background: color-mix(in oklab, var(--primary) 90%, transparent);
}
.billing-engine .be-outline {
  border: 1px solid var(--input);
  background: var(--background);
  box-shadow: var(--be-control-shadow);
}
.billing-engine .be-ghost {
  background: transparent;
}
.billing-engine .be-outline:hover:not(:disabled),
.billing-engine .be-ghost:hover:not(:disabled) {
  background: var(--accent);
  color: var(--accent-foreground);
}
.billing-engine .be-table-scroll {
  max-height: 560px;
  overflow: auto;
}
.billing-engine table {
  border-collapse: collapse;
  width: 100%;
  min-width: 880px;
  font-size: 14px;
  line-height: 20px;
}
.billing-engine thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--background);
}
.billing-engine tr {
  border-bottom: 1px solid var(--border);
}
.billing-engine tbody > tr:last-child {
  border-bottom: 0;
}
.billing-engine th {
  height: 40px;
  padding: 0 8px;
  font-weight: 500;
  color: var(--muted-foreground);
  text-align: left;
  white-space: nowrap;
}
.billing-engine td {
  padding: 8px;
  vertical-align: middle;
}
.billing-engine th:has(.be-checkbox),
.billing-engine td:has(> .be-checkbox) {
  padding-right: 0;
}
.billing-engine tbody > tr:hover {
  background: color-mix(in oklab, var(--muted) 50%, transparent);
}
.billing-engine th > .be-checkbox,
.billing-engine td > .be-checkbox {
  display: grid;
  transform: translateY(2px);
}
.billing-engine .be-select-cell {
  width: 32px;
}
.billing-engine .be-customer {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}
.billing-engine .be-customer > button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted-foreground);
  display: flex;
}
.billing-engine .be-customer > a {
  color: inherit;
  text-decoration: none;
}
.billing-engine .be-customer > a:hover,
.billing-engine .be-invoice > a:hover {
  text-decoration: underline;
}
.billing-engine .be-invoice {
  font-size: 12px;
  line-height: 16px;
}
.billing-engine .be-invoice > a {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
}
.billing-engine .be-coverage {
  white-space: nowrap;
  font-size: 12px;
  line-height: 16px;
}
.billing-engine .be-right {
  text-align: right;
  white-space: nowrap;
}
.billing-engine .be-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}
.billing-engine td.be-empty {
  padding: 40px 8px;
  text-align: center;
  color: var(--muted-foreground);
}
.billing-engine .be-details-row,
.billing-engine .be-details-row:hover {
  background: color-mix(in oklab, var(--muted) 30%, transparent);
}
.billing-engine .be-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.billing-engine .be-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.billing-engine .be-detail-daily {
  grid-template-columns: 1fr;
}
.billing-engine .be-detail-box {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  padding: 12px;
  font-size: 12px;
  line-height: 16px;
  overflow-wrap: anywhere;
}
.billing-engine .be-detail-box > strong {
  font-size: 14px;
  line-height: 20px;
}
.billing-engine .be-detail-box p {
  margin-top: 4px;
  color: var(--muted-foreground);
}
.billing-engine .be-problem {
  border: 1px solid oklch(92.4% 0.12 95.746);
  background: oklch(98.7% 0.022 95.277);
  color: oklch(41.4% 0.112 45.904);
  padding: 12px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 16px;
}
.billing-engine .be-problem > strong {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
  line-height: 20px;
}
.billing-engine .be-problem p {
  margin-top: 4px;
}
.billing-engine .be-documents {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.billing-engine .be-document {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  padding: 8px;
  font-size: 12px;
  line-height: 16px;
}
.billing-engine .be-downloads {
  display: flex;
  gap: 4px;
}
.billing-engine .be-button.be-download {
  height: 28px;
  gap: 4px;
}
.billing-engine .be-download > .be-icon {
  width: 16px;
  height: 16px;
}
.billing-engine.be-period-controls {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.billing-engine .be-error,
.billing-engine .be-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  line-height: 20px;
  overflow-wrap: anywhere;
}
.billing-engine .be-error {
  border-color: oklch(92.4% 0.12 95.746);
  background: oklch(98.7% 0.022 95.277);
  color: oklch(47.3% 0.137 46.201);
}
.billing-engine .be-error > .be-icon {
  margin-top: 2px;
}
.billing-engine .be-notice {
  flex-wrap: wrap;
  background: var(--muted);
}
.billing-engine .be-jobs {
  padding: 24px;
}
.billing-engine .be-jobs > div {
  margin-top: 12px;
}
.billing-engine.be-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: calc(100% - 32px);
  max-width: 512px;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--background);
  padding: 24px;
  box-shadow:
    0 10px 15px -3px #0000001a,
    0 4px 6px -4px #0000001a;
}
.billing-engine.be-dialog::backdrop {
  background: rgb(0 0 0 / 0.8);
}
.billing-engine.be-dialog h2 {
  font-size: 18px;
  line-height: 18px;
  letter-spacing: -0.025em;
  padding-right: 20px;
}
.billing-engine.be-dialog #be-review-description {
  margin-top: 6px;
  font-size: 14px;
  line-height: 20px;
}
.billing-engine .be-dialog-close {
  position: absolute;
  right: 16px;
  top: 16px;
  border: 0;
  background: none;
  opacity: 0.7;
  padding: 0;
  display: flex;
}
.billing-engine .be-review-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 14px;
  line-height: 20px;
  margin-top: 16px;
}
.billing-engine .be-review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.billing-engine .be-info {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
}
.billing-engine .be-info > span {
  display: block;
  font-size: 12px;
  line-height: 16px;
  color: var(--muted-foreground);
}
.billing-engine .be-info > strong {
  font-size: 14px;
  line-height: 20px;
}
.billing-engine hr {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--border);
}
.billing-engine .be-review-customers {
  max-height: 200px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.billing-engine .be-review-customers > div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font-size: 12px;
  line-height: 16px;
  overflow-wrap: anywhere;
}
.billing-engine .be-review-customers > div > span {
  white-space: nowrap;
}
.billing-engine .be-review-blocked {
  color: oklch(47.3% 0.137 46.201);
  margin-top: 4px;
}
.billing-engine .be-email-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid oklch(92.4% 0.12 95.746);
  background: oklch(98.7% 0.022 95.277);
  color: oklch(47.3% 0.137 46.201);
  padding: 8px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 16px;
}
.billing-engine .be-email-warning > .be-icon {
  width: 14px;
  height: 14px;
  margin-top: 2px;
}
.billing-engine .be-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.billing-engine .be-skeleton {
  background: var(--muted);
  animation: be-pulse 2s ease-in-out infinite;
}
.billing-engine .be-skeleton > * {
  visibility: hidden;
}
.billing-engine .be-row-skeleton {
  height: 24px;
  border-radius: 6px;
}
.billing-engine .be-spin {
  animation: be-spin 1s linear infinite;
}
@keyframes be-pulse {
  50% {
    opacity: 0.5;
  }
}
@keyframes be-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (max-width: 1023px) {
  .billing-engine .be-counts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .billing-engine .be-source-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 639px) {
  .billing-engine .be-counts {
    grid-template-columns: 1fr;
  }
  .billing-engine .be-source-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .billing-engine .be-sources {
    padding: 16px;
  }
  .billing-engine .be-source {
    padding: 0 8px;
    gap: 4px;
  }
  .billing-engine .be-source .be-pill {
    padding: 2px 6px;
    font-size: 11px;
  }
  .billing-engine .be-search {
    min-width: 0;
    width: 100%;
    max-width: none;
    flex-basis: 100%;
  }
  .billing-engine .be-filters > .be-select {
    width: 100%;
  }
  .billing-engine .be-detail-grid {
    grid-template-columns: 1fr;
  }
  .billing-engine .be-dialog-footer {
    flex-direction: column-reverse;
  }
  .billing-engine .be-document {
    align-items: flex-start;
  }
  .billing-engine .be-table-scroll {
    max-height: 560px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .billing-engine .be-skeleton,
  .billing-engine .be-spin {
    animation: none;
  }
}

.billing-engine.be-invoice-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0;
  padding: 4px;
  border: 0;
  border-radius: 6px;
  background: var(--muted);
}
.billing-engine.be-invoice-tabs > button {
  height: 28px;
  padding: 4px 12px;
  border: 0;
  border-radius: 2px;
  font-size: 14px;
  line-height: 20px;
}
