/* BARBAROS — credits-premium.css · top-up model 5 "Montant libre" (owner choice, prototypes/topup-models.html)
   A centred modal on desktop, a bottom sheet under 600px. Surfaces, ink and accent come only from the
   --buld-* tokens (Signature dark palette: page #1F1E22 · surface-2 #29272D · elevated #3A3640 ·
   elevated-2 #45414C · hover #4F4A57 · cta #4C9DFF), so the light theme and the other palettes follow.
   Sits between drawers and the confirm dialog (BuldUX.confirm must stack above it).
   Collision list: the legacy modal #apBillingModal is never shown (#1); every class is `tu-*` and avoids
   the painter substrings (card, -chip, -tag, badge, status, pill, -box, block, -tile, -list, -label). */
html[data-buld-theme] #apBillingModal { display: none !important; }
html.tu-lock, html.tu-lock body { overflow: hidden; }
html.tu-lock #agentFab { visibility: hidden; }   /* the assistant FAB (z 9998) would sit on the sheet's footer */
/* collision: legacy input rules repaint every field (border, fill); the hero number and the slider are not fields */
html[data-buld-theme] body .tu .tu-big__n { border: 0 !important; background: transparent !important; box-shadow: none; height: auto !important; min-height: 0 !important; }
html[data-buld-theme] body .tu .tu-range input[type=range] { border: 0 !important; padding: 0 !important; height: 8px !important; box-shadow: none !important;
    background: linear-gradient(90deg, var(--buld-cta) var(--p, 30%), var(--buld-hover) var(--p, 30%)) !important; }

.tu-root { position: fixed; inset: 0; z-index: calc(var(--p-z-drawer, 130) + 2); display: grid; place-items: center; padding: 24px 12px; font-family: var(--buld-font-text, inherit); }
.tu-ov { position: absolute; inset: 0; background: rgba(10, 9, 12, .62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: tuFade .18s ease; }
html[data-buld-theme="light"] .tu-ov { background: rgba(20, 24, 40, .38); }
.tu { position: relative; display: flex; flex-direction: column; width: min(560px, 100%); max-height: min(860px, calc(100vh - 48px)); max-height: min(860px, calc(100dvh - 48px)); min-height: 0;
      background: var(--buld-surface-2); color: var(--buld-ink-1); border: 1px solid var(--buld-divider); border-radius: 20px;
      box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .8); animation: tuPop .2s ease; overflow: hidden; }
html[data-buld-theme="light"] .tu { background: var(--buld-elevated-2); box-shadow: 0 24px 60px -24px rgba(23, 51, 108, .45); }
.tu-root.is-out .tu, .tu-root.is-out .tu-ov { opacity: 0; transition: opacity .15s ease; }
.tu-grab { display: none; }
@keyframes tuFade { from { opacity: 0; } }
@keyframes tuPop { from { opacity: 0; transform: scale(.98); } }
@keyframes tuUp { from { transform: translateY(32px); opacity: 0; } }

.tu :where(button, input) { font: inherit; font-size: 13px; color: inherit; }
.tu :focus-visible { outline: 2px solid var(--buld-cta); outline-offset: 2px; }
.tu .tu-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tu svg { flex: none; }

/* header */
.tu-hd { display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 18px; border-bottom: 1px solid var(--buld-hairline); }
.tu-hd h2 { flex: 1; min-width: 0; margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.01em; color: var(--buld-ink-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tu-hd h2 span { color: var(--buld-ink-3); font-weight: 500; }
.tu-hd h2 b { color: var(--buld-ink-1); font-weight: 650; font-variant-numeric: tabular-nums; }
.tu-icon { width: 32px; height: 32px; display: inline-grid; place-items: center; flex: none; border: 0; border-radius: 9px; background: transparent; color: var(--buld-ink-3); cursor: pointer; transition: background-color .15s, color .15s; }
.tu-icon:hover { background: var(--buld-hover); color: var(--buld-ink-1); }
.tu-icon svg { width: 16px; height: 16px; }
.tu-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--buld-page); border: 1px solid var(--buld-hairline); flex: none; }
.tu-seg button { border: 0; background: transparent; color: var(--buld-ink-3); font-weight: 650; font-size: 12.5px; padding: 5px 12px; border-radius: 7px; cursor: pointer; }
.tu-seg button.on { background: var(--buld-elevated-2); color: var(--buld-ink-1); box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
html[data-buld-theme="light"] .tu-seg button.on { background: var(--buld-elevated); box-shadow: none; }

/* body */
.tu-bd { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 18px; display: grid; gap: 18px; align-content: start; overscroll-behavior: contain; }
.tu-sec { min-width: 0; }
.tu-h { display: block; margin: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--buld-ink-3); }
.tu-note { display: flex; gap: 6px; align-items: flex-start; margin: 0; font-size: 12px; line-height: 1.45; color: var(--buld-ink-3); }
.tu-note svg { width: 14px; height: 14px; margin-top: 1px; }
.tu-skel { height: 110px; border-radius: 14px; background: linear-gradient(90deg, var(--buld-elevated) 25%, var(--buld-hover) 50%, var(--buld-elevated) 75%); background-size: 200% 100%; animation: tuSk 1.2s linear infinite; }
@keyframes tuSk { to { background-position: -200% 0; } }
.tu-link { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--buld-cta); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; flex: none; }
.tu-link:hover { background: var(--buld-cta-soft); }
.tu-link svg { width: 14px; height: 14px; }
.tu-input { height: 40px; min-width: 0; flex: 1; padding: 0 12px; border-radius: 10px; border: 1px solid var(--buld-divider); background: var(--buld-page); color: var(--buld-ink-1); outline: 0; transition: border-color .15s; }
.tu-input:focus { border-color: var(--buld-cta); }
.tu-input::placeholder { color: var(--buld-ink-4); }

/* amount */
.tu-amount { min-width: 0; }
.tu-big { text-align: center; }
.tu-big__n { display: block; width: 100%; max-width: 100%; margin: 0 auto; padding: 0; border: 0; background: transparent; text-align: center; outline: 0;
             font-family: var(--buld-font-display, inherit); font-size: 56px; font-weight: 800; letter-spacing: -.04em; line-height: 1.05; color: var(--buld-ink-1); font-variant-numeric: tabular-nums; caret-color: var(--buld-cta); }
.tu-big__n:focus { border-radius: 10px; box-shadow: inset 0 -2px 0 var(--buld-cta); }
.tu-big__n[readonly] { cursor: default; }
.tu-big__n[readonly]:focus { box-shadow: none; }
.tu-big > span { display: block; margin-top: 4px; font-size: 13px; color: var(--buld-ink-3); }
.tu-range { position: relative; margin: 18px 0 0; padding-bottom: 22px; }
.tu-range input[type=range] { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 8px; margin: 0; border-radius: 8px; outline: 0; cursor: pointer;
                              background: linear-gradient(90deg, var(--buld-cta) var(--p, 30%), var(--buld-hover) var(--p, 30%)); }
.tu-range input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 4px solid var(--buld-cta); box-shadow: 0 2px 8px rgba(0, 0, 0, .5); cursor: grab; }
.tu-range input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 4px solid var(--buld-cta); box-shadow: 0 2px 8px rgba(0, 0, 0, .5); cursor: grab; }
.tu-range input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--buld-cta-soft), 0 2px 8px rgba(0, 0, 0, .5); }
.tu-ticks { position: absolute; left: 12px; right: 12px; bottom: 0; height: 16px; font-size: 11px; color: var(--buld-ink-4); font-variant-numeric: tabular-nums; }
.tu-ticks span { position: absolute; left: var(--x, 0); transform: translateX(-50%); white-space: nowrap; }
.tu-ticks span:first-child { transform: none; margin-left: -12px; }
.tu-ticks span:last-child { transform: translateX(-100%); margin-left: 12px; }
.tu-err { margin: 8px 0 0; font-size: 12px; color: var(--buld-danger); text-align: center; }
.tu-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; text-align: center; }
.tu-facts div { min-width: 0; }
.tu-facts b { display: block; font-size: 20px; font-weight: 700; letter-spacing: -.02em; color: var(--buld-ink-1); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tu-facts span { font-size: 11.5px; color: var(--buld-ink-3); }
.tu-tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.tu-tier { min-width: 0; border: 1px solid var(--buld-hairline); border-radius: 10px; padding: 8px 10px; font-size: 12px; color: var(--buld-ink-3); transition: border-color .15s, background-color .15s; }
.tu-tier b { display: block; font-size: 13px; font-weight: 650; color: var(--buld-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tu-tier span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tu-tier.on { border-color: var(--buld-cta); background: var(--buld-cta-soft); }
.tu-tier.on b { color: var(--buld-ink-1); }
.tu-next { display: flex; gap: 6px; align-items: flex-start; justify-content: center; margin: 10px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--buld-ink-2); text-align: center; }
.tu-next svg { width: 14px; height: 14px; margin-top: 2px; color: var(--buld-cta); }
.tu-quick { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 14px; }
.tu-q { height: 30px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--buld-hairline); background: var(--buld-elevated); color: var(--buld-ink-2); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; transition: background-color .15s, border-color .15s; }
.tu-q:hover { background: var(--buld-hover); color: var(--buld-ink-1); }
.tu-q.on { border-color: var(--buld-cta); background: var(--buld-cta-soft); color: var(--buld-ink-1); }

/* promo + feedback */
.tu-promo { display: flex; gap: 8px; align-items: center; min-width: 0; }
.tu-fb { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; font-size: 12.5px; line-height: 1.4; }
.tu-fb svg { width: 14px; height: 14px; }
.tu-fb span { flex: 1; min-width: 0; }
.tu-fb.is-ok { color: var(--buld-success); }
.tu-fb.is-ko { color: var(--buld-danger); }

/* payment methods */
.tu-meths { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tu-meth { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 9px; row-gap: 1px; align-items: center; min-width: 0; padding: 10px 12px; text-align: left;
           border: 1px solid var(--buld-hairline); border-radius: 12px; background: var(--buld-elevated); cursor: pointer; transition: background-color .15s, border-color .15s; }
.tu-meth svg { grid-row: span 2; width: 18px; height: 18px; color: var(--buld-ink-3); }
.tu-meth b { font-size: 13px; font-weight: 650; color: var(--buld-ink-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tu-meth small { font-size: 11.5px; color: var(--buld-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tu-meth:hover:not([disabled]) { background: var(--buld-hover); }
.tu-meth.on { border-color: var(--buld-cta); background: var(--buld-cta-soft); box-shadow: inset 0 0 0 1px var(--buld-cta); }
.tu-meth.on svg { color: var(--buld-cta); }
.tu-meth[disabled] { opacity: .5; cursor: not-allowed; }

/* grouped rows: pending payments, account details */
.tu-group { border: 1px solid var(--buld-hairline); border-radius: 12px; background: var(--buld-elevated); overflow: hidden; }
.tu-pend, .tu-kv { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 10px 8px 14px; }
.tu-pend + .tu-pend, .tu-kv + .tu-kv { border-top: 1px solid var(--buld-hairline); }
.tu-pend__t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tu-pend__t b { font-size: 13px; font-weight: 600; color: var(--buld-ink-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tu-pend__t span { font-size: 12px; color: var(--buld-ink-3); }
.tu-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--buld-ink-4); }
.tu-dot.is-wait { background: var(--buld-warning); }
.tu-dot.is-check { background: var(--buld-cta); }
.tu-kv span { width: 110px; flex: none; font-size: 12px; color: var(--buld-ink-3); }
.tu-kv b { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--buld-ink-1); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

/* receipt */
.tu-rcpt { display: grid; gap: 16px; min-width: 0; }
.tu-rcpt__amt b { display: block; font-family: var(--buld-font-display, inherit); font-size: 40px; font-weight: 800; letter-spacing: -.035em; line-height: 1.1; color: var(--buld-ink-1); font-variant-numeric: tabular-nums; }
.tu-rcpt__amt .tu-note { margin-top: 4px; }
.tu-ref { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; border-radius: 12px; border: 1px dashed var(--buld-divider); background: var(--buld-page); }
.tu-ref > div { flex: 1; min-width: 0; }
.tu-ref .tu-h { margin-bottom: 4px; }
.tu-ref code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 17px; font-weight: 700; letter-spacing: .04em; color: var(--buld-ink-1); overflow-wrap: anywhere; }
.tu-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tu-steps li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--buld-ink-2); line-height: 1.45; }
.tu-steps li b { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--buld-cta-soft); color: var(--buld-cta); font-size: 12px; }
.tu-done { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 18px 8px 4px; }
.tu-done__i { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--buld-success) 18%, transparent); color: var(--buld-success); }
.tu-done__i svg { width: 26px; height: 26px; }
.tu-done b { font-size: 16px; color: var(--buld-ink-1); }
.tu-done p { margin: 0; max-width: 380px; font-size: 13px; color: var(--buld-ink-3); line-height: 1.5; }

/* footer: always visible */
.tu-ft { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--buld-hairline); background: color-mix(in srgb, var(--buld-page) 55%, transparent); }
.tu-ft[hidden] { display: none; }
.tu-tot { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tu-tot b { font-size: 20px; font-weight: 750; letter-spacing: -.02em; color: var(--buld-ink-1); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tu-tot span { font-size: 12px; color: var(--buld-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tu .tu-go { height: 44px; padding: 0 16px; border-radius: 12px; font-weight: 650; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; flex: none; text-decoration: none; }
.tu .tu-go svg { width: 16px; height: 16px; }
.tu .tu-go[disabled] { opacity: .45; cursor: not-allowed; }
.tu-ft .bx-btn--secondary { display: inline-flex; align-items: center; gap: 7px; }
.tu-ft .bx-btn--secondary svg { width: 15px; height: 15px; }

/* phone: bottom sheet */
@media (max-width: 600px) {
    .tu-root { place-items: end stretch; padding: 0; }
    .tu { width: 100%; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); border-radius: 22px 22px 0 0; border-bottom: 0; animation-name: tuUp; animation-duration: .24s; }
    .tu-grab { display: block; width: 40px; height: 5px; margin: 8px auto 0; border-radius: 9px; background: var(--buld-hover); flex: none; }
    .tu-hd { padding: 8px 10px 10px 16px; flex-wrap: wrap; row-gap: 8px; }
    .tu-hd h2 { font-size: 14px; }
    .tu-bd { padding: 14px 16px; gap: 16px; }
    .tu-big__n { font-size: 46px; }
    .tu-facts b { font-size: 17px; }
    .tu-tier { padding: 7px 8px; }
    .tu-tier b { font-size: 12px; }
    .tu-tier span { font-size: 11px; }
    .tu-meths { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tu-ft { padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); }
    .tu-tot b { font-size: 18px; }
    .tu .tu-go { padding: 0 12px; font-size: 13px; }
    .tu-rcpt__amt b { font-size: 32px; }
    .tu-kv span { width: 88px; }
}
@media (max-width: 360px) { .tu .tu-go span { max-width: 132px; overflow: hidden; text-overflow: ellipsis; } }

@media (prefers-reduced-motion: reduce) {
    .tu, .tu-ov, .tu-skel { animation: none !important; }
    .tu-root.is-out .tu, .tu-root.is-out .tu-ov { transition: none; }
    .tu *, .tu-ov { transition: none !important; }
}
