/* Theme follows LibreChat's .dark class on <html>, the same hook
   artdai-theme.css uses. Class-based on purpose: a prefers-color-scheme
   rule would override someone who has explicitly chosen light. */
#artdai-usage-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: calc(0.75rem + env(safe-area-inset-top)) 1rem 0.75rem;
  border-bottom: 1px solid;
  font-family: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.9375rem;
  line-height: 1.4;
}

#artdai-usage-banner[data-state="warn"] {
  background: #FDF1E4;
  color: #6B3A08;
  border-color: #E9CFAE;
}
#artdai-usage-banner[data-state="stop"] {
  background: #FCECEC;
  color: #8E1A1A;
  border-color: #EFC9C9;
}
html.dark #artdai-usage-banner[data-state="warn"],
.dark #artdai-usage-banner[data-state="warn"] {
  background: #2C2013;
  color: #F0C48A;
  border-color: #4A3620;
}
html.dark #artdai-usage-banner[data-state="stop"],
.dark #artdai-usage-banner[data-state="stop"] {
  background: #2E1718;
  color: #F3A6A6;
  border-color: #4D2626;
}

#artdai-usage-banner .artdai-dot {
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}

#artdai-usage-banner .artdai-msg {
  flex: 1 1 auto;
  min-width: 0;
}
#artdai-usage-banner .artdai-msg strong { font-weight: 600; }
#artdai-usage-banner .artdai-when { opacity: 0.78; }

#artdai-usage-banner .artdai-cta {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0 0.875rem;
  border-radius: 0.5rem;
  background: #92400E;
  color: #FFFFFF;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
#artdai-usage-banner .artdai-cta:hover { background: #7A3608; }
html.dark #artdai-usage-banner .artdai-cta,
.dark #artdai-usage-banner .artdai-cta { background: #D97B3C; color: #16130F; }
html.dark #artdai-usage-banner .artdai-cta:hover,
.dark #artdai-usage-banner .artdai-cta:hover { background: #E89052; }

#artdai-usage-banner .artdai-close {
  flex: none;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  color: inherit;
  opacity: 0.55;
  cursor: pointer;
  font-size: 1.125rem;
  line-height: 1;
}
#artdai-usage-banner .artdai-close:hover { opacity: 1; }
#artdai-usage-banner .artdai-close:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 1px;
  opacity: 1;
}

/* The CTA drops to its own full-width row so it clears the 44px touch target
   without squeezing the message to a couple of words. */
@media (max-width: 40rem) {
  #artdai-usage-banner {
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    padding: calc(0.625rem + env(safe-area-inset-top)) 0.75rem 0.625rem;
  }
  #artdai-usage-banner .artdai-msg {
    flex: 1 1 100%;
    order: 1;
    font-size: 0.875rem;
  }
  #artdai-usage-banner .artdai-dot { order: 0; }
  #artdai-usage-banner .artdai-close { order: 0; margin-left: auto; }
  #artdai-usage-banner .artdai-cta {
    order: 2;
    width: 100%;
    justify-content: center;
    min-height: 2.75rem;
  }
}

/* The gate's reply in the transcript, given the banner's treatment.
   Markdown cannot carry a class and this renderer has no rehype-raw, so the
   injected script marks the elements and the border is pieced across them —
   it never reparents nodes React owns.

   Selectors are doubled where LibreChat's own prose rules would otherwise win
   on specificity and reintroduce the margins that break the card apart. */
.artdai-quota-rule.artdai-quota-rule { display: none; }

.artdai-quota-head.artdai-quota-head,
.artdai-quota-body.artdai-quota-body,
.artdai-quota-foot.artdai-quota-foot {
  margin: 0;
  padding: 0 1.125rem;
  border-left: 3px solid #92400E;
  border-right: 1px solid #E9CFAE;
  background: #FDF1E4;
  color: #6B3A08;
}
.artdai-quota-head.artdai-quota-head {
  margin-top: 0.75rem;
  padding-top: 0.875rem;
  padding-bottom: 0.5rem;
  border-top: 1px solid #E9CFAE;
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}
.artdai-quota-body.artdai-quota-body { padding-bottom: 0.5rem; }
.artdai-quota-foot.artdai-quota-foot {
  margin-bottom: 0.75rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid #E9CFAE;
  border-bottom-left-radius: 0.5rem;
  border-bottom-right-radius: 0.5rem;
}
.artdai-quota-foot a { color: inherit; font-weight: 600; }

html.dark .artdai-quota-head.artdai-quota-head,
html.dark .artdai-quota-body.artdai-quota-body,
html.dark .artdai-quota-foot.artdai-quota-foot,
.dark .artdai-quota-head.artdai-quota-head,
.dark .artdai-quota-body.artdai-quota-body,
.dark .artdai-quota-foot.artdai-quota-foot {
  border-left-color: #D97B3C;
  border-right-color: #4A3620;
  background: #2C2013;
  color: #F0C48A;
}
html.dark .artdai-quota-head.artdai-quota-head,
.dark .artdai-quota-head.artdai-quota-head { border-top-color: #4A3620; }
html.dark .artdai-quota-foot.artdai-quota-foot,
.dark .artdai-quota-foot.artdai-quota-foot { border-bottom-color: #4A3620; }
