/* ============================================================================
   FB-APP CREDITS METER — header trigger + popover.
   Lives inside .fb-app-header, no Salient interaction. Self-contained.
   ============================================================================ */

.fb-credits {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* ── Trigger pill ────────────────────────────────────────────────────────── */
.fb-credits__trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 14px 0 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid #2a2a2f;
  border-radius: 9999px;
  cursor: pointer;
  font-family: inherit;
  color: #f4f4f6;
  transition: border-color 0.18s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.fb-credits__trigger:hover,
.fb-credits__trigger[aria-expanded="true"] {
  border-color: rgba(201, 169, 98, 0.45);
  background: rgba(255, 255, 255, 0.06);
}

.fb-credits__ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  flex-shrink: 0;
}
.fb-credits__ring svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  transform: rotate(-90deg);
}
.fb-credits__ring svg circle:first-child { stroke: rgba(255, 255, 255, 0.08); fill: none; stroke-width: 2; }
.fb-credits__ring svg circle:last-child  { stroke: #c9a962; fill: none; stroke-width: 2; stroke-linecap: round; transition: stroke-dasharray 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
.fb-credits__ring-num {
  position: relative;
  font-family: var(--font-display, 'Montserrat', sans-serif);
  font-size: 11px;
  font-weight: 700;
  color: #c9a962;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.fb-credits__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
  gap: 2px;
}
.fb-credits__plan {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c9a962;
}
.fb-credits__count {
  font-size: 10px;
  font-weight: 500;
  color: #c4c4cc;
  font-variant-numeric: tabular-nums;
}

/* ── Popover ─────────────────────────────────────────────────────────────── */
.fb-credits__popover {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 380px;
  background: #0a0a0b;
  border: 1px solid #2a2a2f;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6), 0 4px 16px rgba(0, 0, 0, 0.4);
  z-index: 9100;
  overflow: hidden;
  font-family: var(--font-body, 'DM Sans', sans-serif);
  color: #f4f4f6;
  animation: fb-credits-pop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.fb-credits.is-open .fb-credits__popover { display: block; }
@keyframes fb-credits-pop {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fb-credits__top {
  padding: 22px 22px 18px;
  background: linear-gradient(135deg,
    rgba(201, 169, 98, 0.10) 0%,
    rgba(201, 169, 98, 0.04) 50%,
    rgba(10, 10, 11, 0) 100%);
  border-bottom: 1px solid #1a1a1e;
}
.fb-credits__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
  gap: 12px;
}
.fb-credits__eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8a8a94;
  margin-bottom: 4px;
}
.fb-credits__num {
  font-family: var(--font-display, 'Montserrat', sans-serif);
  font-size: 38px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #f4f4f6;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.fb-credits__num-label {
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 13px;
  font-weight: 500;
  color: #c4c4cc;
  letter-spacing: 0;
  margin-left: 6px;
}
.fb-credits__plan-tag {
  align-self: flex-start;
  display: inline-block;
  padding: 6px 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c9a962;
  background: rgba(201, 169, 98, 0.10);
  border: 1px solid rgba(201, 169, 98, 0.35);
  border-radius: 6px;
}

.fb-credits__bar {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: #1a1a1e;
  margin-bottom: 8px;
}
.fb-credits__bar-fill {
  position: absolute; inset: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, #c9a962 0%, #e4d4a4 100%);
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.fb-credits__bar-tick {
  position: absolute;
  top: -2px; bottom: -2px;
  width: 2px;
  background: #0a0a0b;
}
.fb-credits__bar-axis {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 10px;
  color: #8a8a94;
  margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
}

.fb-credits__resets {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid #1a1a1e;
  border-radius: 8px;
  font-size: 12px;
  color: #8a8a94;
}
.fb-credits__resets strong {
  font-family: var(--font-display, 'Montserrat', sans-serif);
  font-size: 14px;
  font-weight: 600;
  color: #f4f4f6;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

/* Bottom: per-action breakdown */
.fb-credits__bottom { padding: 16px 22px 18px; }
.fb-credits__sub {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.fb-credits__sub-meta {
  font-size: 10px;
  color: #8a8a94;
  letter-spacing: 0.04em;
}
.fb-credits__rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}
.fb-credits__row {
  display: grid;
  grid-template-columns: 1fr 120px auto;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
}
.fb-credits__row-label { font-size: 13px; color: #c4c4cc; }
.fb-credits__row-spark { display: block; width: 100%; height: 18px; color: #c9a962; }
.fb-credits__row-spark svg { display: block; }
.fb-credits__row-count {
  font-family: var(--font-display, 'Montserrat', sans-serif);
  font-size: 16px;
  font-weight: 600;
  color: #f4f4f6;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 28px;
}

.fb-credits__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid #1a1a1e;
}
.fb-credits__live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #8a8a94;
}
.fb-credits__live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #4ade80;
  animation: fb-credits-pulse 2.4s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}
@keyframes fb-credits-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5); }
  50%      { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
}
.fb-credits__cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 14px;
  background: #c9a962;
  color: #0a0a0b;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 8px;
  transition: filter 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.fb-credits__cta:hover { filter: brightness(1.08); color: #0a0a0b; text-decoration: none; }

@media (max-width: 980px) {
  .fb-credits__text { display: none; }
  .fb-credits__trigger { padding: 0 4px; gap: 0; }
  .fb-credits__popover { width: calc(100vw - 32px); right: -16px; }
}
