.intv-credit-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 36px;
  padding: 0.45rem 0.7rem;
  color: var(--text-color);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
}

.intv-credit-badge:hover,
.intv-credit-badge:focus-visible {
  background: var(--bg-hover);
  border-color: var(--accent-color);
}

.intv-credit-badge strong {
  color: var(--accent-color);
  font-variant-numeric: tabular-nums;
}

.intv-credit-badge.is-low strong,
.intv-credit-badge.is-empty strong { color: var(--accent-color-dark); }

.intv-credit-dialog {
  width: min(680px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  color: var(--text-color);
  background: var(--containerbackground);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  box-shadow: 0 24px 70px color-mix(in srgb, var(--text-color) 24%, transparent);
}

.intv-credit-dialog::backdrop {
  background: color-mix(in srgb, var(--text-color) 45%, transparent);
}

.intv-credit-dialog-inner { padding: 1.4rem; }
.intv-credit-dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.intv-credit-dialog-head h2 { margin: 0; font-size: 1.35rem; }
.intv-credit-dialog-head p { margin: 0.35rem 0 0; color: var(--text-secondary); }
.intv-credit-close { color: var(--text-color); background: transparent; border: 0; padding: 0.35rem; cursor: pointer; }

.intv-credit-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1.2rem 0;
}

.intv-credit-stat { padding: 0.85rem; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 12px; }
.intv-credit-stat span { display: block; color: var(--text-secondary); font-size: 0.78rem; }
.intv-credit-stat strong { display: block; margin-top: 0.25rem; font-size: 1.2rem; }

.intv-credit-packs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
.intv-credit-pack { padding: 1rem; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 12px; }
.intv-credit-pack h3 { margin: 0; font-size: 1rem; }
.intv-credit-pack-price { margin: 0.35rem 0; font-size: 1.3rem; font-weight: 700; }
.intv-credit-pack small { display: block; min-height: 2.4em; color: var(--text-secondary); }
.intv-credit-pack button { width: 100%; margin-top: 0.8rem; }
.intv-credit-note { margin: 1rem 0 0; color: var(--text-secondary); font-size: 0.82rem; }
.intv-credit-error { margin: 0.75rem 0 0; color: var(--accent-color-dark); }

.intv-template-cost-control {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.intv-template-cost-summary { color: var(--text-color); font-size: 0.86rem; }

.intv-template-cost-trigger {
  display: inline-grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.intv-template-cost-trigger:hover,
.intv-template-cost-trigger[aria-expanded="true"] {
  background: color-mix(in srgb, var(--accent-color) 10%, transparent);
  color: var(--accent-color);
}

.intv-template-cost-trigger:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.intv-template-cost-detail {
  position: fixed;
  inset: auto;
  width: min(21rem, calc(100vw - 1.5rem));
  margin: 0;
  padding: 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  background: var(--intv-surface, var(--containerbackground, #fff));
  color: var(--text-color);
  box-shadow: 0 0.75rem 2rem color-mix(in srgb, var(--text-color) 20%, transparent);
}

.intv-template-cost-detail::backdrop { background: transparent; }
.intv-template-cost-detail-title { display: block; margin-bottom: 0.6rem; font-size: 0.82rem; font-weight: 700; }
.intv-template-cost-detail-list { display: grid; gap: 0.4rem; }
.intv-template-cost-detail-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}
.intv-template-cost-detail-row > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.intv-template-cost-detail-row strong { color: var(--accent-color); white-space: nowrap; }
.intv-template-cost-detail-row > span:last-child { color: var(--text-secondary); white-space: nowrap; }
.intv-template-cost-detail small { display: block; margin-top: 0.7rem; color: var(--text-secondary); font-size: 0.75rem; line-height: 1.35; }

.intv-cost-estimate-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem 1rem;
  margin: 1rem 0;
  padding: 1rem 1.1rem;
  color: var(--text-color);
  background: color-mix(in srgb, var(--accent-color) 8%, var(--containerbackground));
  border: 1px solid color-mix(in srgb, var(--accent-color) 35%, var(--border-color));
  border-radius: 12px;
}

.intv-cost-estimate-label { font-weight: 650; }
.intv-cost-estimate-values { display: flex; align-items: baseline; gap: 0.65rem; white-space: nowrap; }
.intv-cost-estimate-values strong { color: var(--accent-color); font-size: 1.05rem; }
.intv-cost-estimate-values > span { color: var(--text-secondary); font-size: 0.82rem; }
.intv-cost-estimate-card > small { grid-column: 1 / -1; color: var(--text-secondary); line-height: 1.4; }
.intv-cost-estimate-publish { margin-top: 0.9rem; }
.intv-cost-modality-list { display: grid; gap: 0.38rem; min-width: 0; width: 100%; }
.intv-cost-modality-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: baseline;
  gap: 0.45rem;
  font-variant-numeric: tabular-nums;
}
.intv-cost-modality-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text-color);
  font-size: 0.82rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.intv-cost-modality-row strong { color: var(--accent-color); font-size: 0.94rem; white-space: nowrap; }
.intv-cost-modality-row > span:last-child { color: var(--text-secondary); font-size: 0.78rem; white-space: nowrap; }

.intv-duration-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 260px));
  gap: 1rem;
  align-items: start;
}

@media (max-width: 720px) {
  .intv-credit-badge > span { display: none; }
  .intv-credit-summary,
  .intv-credit-packs { grid-template-columns: 1fr; }
  .intv-cost-estimate-card { grid-template-columns: 1fr; }
  .intv-cost-estimate-values { flex-wrap: wrap; }
  .intv-cost-estimate-values,
  .intv-cost-modality-list { width: 100%; }
  .intv-cost-modality-row { grid-template-columns: minmax(6rem, 1fr) auto auto; }
  .intv-duration-settings { grid-template-columns: 1fr; }
}
