.billing-summary-shell {
  display: grid;
  gap: 18px;
  color: #0f172a;
}

.billing-summary-hero,
.billing-summary-kpi-card,
.billing-summary-list,
.billing-summary-row,
.billing-summary-panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.06);
}

.billing-summary-hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 20px;
}

.billing-summary-eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-bottom: 8px;
  border: 1px solid #ccfbf1;
  border-radius: 999px;
  padding: 3px 9px;
  color: #0f766e;
  background: #f0fdfa;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.billing-summary-hero h2 {
  margin: 0;
  color: #0f172a;
  font-size: 26px;
  line-height: 1.15;
}

.billing-summary-hero p {
  max-width: 720px;
  margin: 6px 0 0;
  color: #64748b;
  line-height: 1.45;
}

.billing-summary-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  align-items: end;
}

.billing-summary-period {
  display: grid;
  gap: 4px;
}

.billing-summary-period span {
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

.billing-summary-actions input {
  min-height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  color: #0f172a;
  background: #fff;
}

.billing-summary-kpis {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.billing-summary-kpi-card {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  box-sizing: border-box;
  min-width: 0;
  min-height: 90px;
  padding: 12px;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.05);
}

.billing-summary-kpi-icon,
.billing-summary-panel-icon {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  flex: 0 0 auto;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  color: #1d4ed8;
  background: #eff6ff;
  font-weight: 800;
  letter-spacing: 0;
}

.billing-summary-kpi-icon {
  width: 30px;
  height: 30px;
  font-size: 11px;
}

.billing-summary-kpi-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.billing-summary-kpi-copy small,
.billing-summary-row-main small,
.billing-summary-total-panel span,
.billing-summary-list-head span {
  color: #64748b;
  font-size: 12px;
}

.billing-summary-kpi-copy strong {
  color: #0f172a;
  font-size: 19px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.billing-summary-kpi-copy em {
  color: #64748b;
  font-size: 11px;
  font-style: normal;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.billing-summary-kpi-card.is-teal .billing-summary-kpi-icon {
  border-color: #ccfbf1;
  color: #0f766e;
  background: #f0fdfa;
}

.billing-summary-kpi-card.is-indigo .billing-summary-kpi-icon {
  border-color: #e0e7ff;
  color: #4338ca;
  background: #eef2ff;
}

.billing-summary-kpi-card.is-strong {
  border-color: #bae6fd;
  box-shadow: 0 18px 36px rgba(14, 116, 144, 0.1);
}

.billing-summary-kpi-card.is-strong .billing-summary-kpi-icon {
  border-color: #bae6fd;
  color: #0e7490;
  background: #ecfeff;
}

.billing-summary-kpi-card.is-amber .billing-summary-kpi-icon {
  border-color: #fde68a;
  color: #92400e;
  background: #fffbeb;
}

.billing-summary-kpi-card.is-slate .billing-summary-kpi-icon {
  border-color: #e2e8f0;
  color: #475569;
  background: #f8fafc;
}

.billing-summary-list {
  display: grid;
  gap: 10px;
  padding: 14px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.045);
}

.billing-summary-list-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 4px 2px 8px;
}

.billing-summary-list-head div {
  display: grid;
  gap: 2px;
}

.billing-summary-list-head strong {
  font-size: 16px;
}

.billing-summary-list-head small {
  color: #94a3b8;
}

.billing-summary-row {
  overflow: hidden;
  box-shadow: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.billing-summary-row:hover,
.billing-summary-row.is-expanded {
  border-color: #bfdbfe;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.07);
}

.billing-summary-row:hover {
  transform: translateY(-1px);
}

.billing-summary-row-main {
  width: 100%;
  border: 0;
  background: #fff;
  display: grid;
  grid-template-columns: minmax(260px, 1.15fr) minmax(220px, 0.9fr) minmax(420px, 1.25fr) 34px;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
}

.billing-summary-row-main:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: -2px;
}

.billing-summary-company {
  min-width: 0;
}

.billing-summary-company strong {
  display: block;
  overflow: hidden;
  color: #0f172a;
  font-size: 15px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.billing-summary-company small {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.billing-summary-row-badges,
.billing-summary-row-values,
.billing-summary-vo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.billing-summary-row-values {
  justify-content: flex-end;
}

.billing-summary-badge {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 24px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 4px 9px;
  color: #1d4ed8;
  background: #eff6ff;
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
}

.billing-summary-badge.is-ok {
  border-color: #99f6e4;
  color: #0f766e;
  background: #f0fdfa;
}

.billing-summary-badge.is-muted {
  border-color: #e2e8f0;
  color: #64748b;
  background: #f8fafc;
}

.billing-summary-badge.is-warning {
  border-color: #fde68a;
  color: #92400e;
  background: #fffbeb;
}

.billing-summary-badge.is-danger {
  border-color: #fecaca;
  color: #b91c1c;
  background: #fef2f2;
}

.billing-summary-badge.is-paused {
  border-color: #ddd6fe;
  color: #6d28d9;
  background: #f5f3ff;
}

.billing-summary-badge.is-risk {
  border-color: #fed7aa;
  color: #c2410c;
  background: #fff7ed;
}

.billing-summary-row-metric {
  display: grid;
  gap: 2px;
  min-width: 92px;
  text-align: right;
}

.billing-summary-row-metric strong {
  color: #0f172a;
  font-size: 14px;
  line-height: 1.2;
}

.billing-summary-row-metric.is-total strong {
  color: #0e7490;
  font-size: 16px;
}

.billing-summary-row-metric.is-risk strong {
  color: #c2410c;
}

.billing-summary-row-chevron {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #64748b;
  background: #f8fafc;
  font-size: 16px;
}

.billing-summary-detail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.billing-summary-panel {
  padding: 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.045);
}

.billing-summary-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.billing-summary-panel-head > div {
  display: flex;
  gap: 9px;
  align-items: center;
}

.billing-summary-panel-icon {
  width: 30px;
  height: 30px;
  font-size: 11px;
}

.billing-summary-panel-head h3 {
  margin: 0;
  color: #0f172a;
  font-size: 15px;
  line-height: 1.2;
}

.billing-summary-panel-head > strong {
  color: #0e7490;
  font-size: 16px;
}

.billing-summary-terms {
  max-height: 260px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  color: #334155;
  font: inherit;
  line-height: 1.55;
}

.billing-summary-empty {
  color: #64748b;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 14px;
  line-height: 1.45;
}

.billing-summary-empty--soft {
  padding: 10px;
}

.billing-summary-category {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.billing-summary-category header,
.billing-summary-service-item,
.billing-summary-total-panel div:not(.billing-summary-panel-head),
.billing-summary-grand {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.billing-summary-category header {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 9px 10px;
  background: #f8fafc;
}

.billing-summary-category header span,
.billing-summary-service-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.billing-summary-service-item {
  border-top: 1px solid #e2e8f0;
  padding-top: 8px;
  color: #334155;
}

.billing-summary-service-item strong,
.billing-summary-category header strong,
.billing-summary-total-panel strong {
  white-space: nowrap;
}

.billing-summary-vo-meta p {
  flex-basis: 100%;
  margin: 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  color: #334155;
  background: #f8fafc;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.billing-summary-total-panel {
  display: grid;
  align-content: start;
  gap: 9px;
}

.billing-summary-total-panel div:not(.billing-summary-panel-head) {
  border-bottom: 1px solid #eef2f7;
  padding-bottom: 8px;
}

.billing-summary-grand {
  margin-top: 2px;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 12px !important;
  background: #ecfeff;
}

.billing-summary-grand span {
  color: #0f766e;
  font-weight: 700;
}

.billing-summary-grand strong {
  color: #0e7490;
  font-size: 22px;
}

.billing-summary-export-preview {
  grid-column: 1 / -1;
  padding: 9px 12px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  color: #1d4ed8;
  background: #eff6ff;
  overflow-x: auto;
  white-space: nowrap;
  font-size: 12px;
}

@media (max-width: 1240px) {
  .billing-summary-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .billing-summary-row-main {
    grid-template-columns: minmax(240px, 1fr) minmax(200px, 0.8fr) 1fr 34px;
  }
}

@media (max-width: 980px) {
  .billing-summary-hero {
    display: grid;
  }

  .billing-summary-actions {
    justify-content: start;
  }

  .billing-summary-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .billing-summary-row-main {
    grid-template-columns: 1fr 34px;
  }

  .billing-summary-company,
  .billing-summary-row-badges,
  .billing-summary-row-values {
    grid-column: 1 / -1;
  }

  .billing-summary-row-chevron {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .billing-summary-row-values {
    justify-content: start;
  }

  .billing-summary-detail {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .billing-summary-hero,
  .billing-summary-list,
  .billing-summary-detail {
    padding: 12px;
  }

  .billing-summary-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .billing-summary-kpi-card {
    min-height: 82px;
    padding: 11px;
  }

  .billing-summary-actions,
  .billing-summary-actions .btn,
  .billing-summary-period,
  .billing-summary-period input {
    width: 100%;
  }

  .billing-summary-list-head {
    display: grid;
  }

  .billing-summary-row-main {
    padding: 12px;
  }

  .billing-summary-row-metric {
    min-width: calc(50% - 8px);
    text-align: left;
  }
}

@media (max-width: 420px) {
  .billing-summary-kpis {
    grid-template-columns: 1fr;
  }
}
