/* Scribly billing: /billing and /billing/result (builds on css/app-shell.css and css/forms.css; Circly v2 tokens). No external origins.
   /billing reads top to bottom as one task: «اعتبار من» → «افزایش اعتبار» (packs | plans) → one quiet row for codes.
   History, receipts and member usage open in the shared dialog (a full-screen sheet on phones). */

.quiet { font-size: 12px; color: var(--d-dim); }
.quiet.warn { color: var(--d-gold); display: inline-flex; align-items: center; gap: 6px; }
.quiet .icon { inline-size: 14px; block-size: 14px; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 6px 4px; min-block-size: 32px; color: var(--d-accent); font: inherit; font-size: 13px; cursor: pointer; border-radius: var(--r-3); }
.link-btn:hover { text-decoration: underline; }
.link-btn:focus-visible { outline: 2px solid var(--d-ring); outline-offset: 1px; }
.link-btn .icon { inline-size: 16px; block-size: 16px; }

/* «اعتبار من» */
.credit { gap: 10px; padding: 20px; }
.credit > h2 { font-size: 14px; font-weight: 600; color: var(--d-dim); }
#balCard { display: flex; flex-direction: column; gap: 8px; }
.bal-total { font-size: 40px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.bal-total small { font-size: 14px; font-weight: 400; color: var(--d-dim); margin-inline-start: 4px; }
.meter { block-size: 6px; border-radius: 999px; background: var(--d-hover); overflow: hidden; max-inline-size: 420px; }
.meter > i { display: block; block-size: 100%; border-radius: inherit; background: var(--d-accent); transition: inline-size var(--dur-2); }
.meter.low > i { background: var(--d-gold); }
.bal-split { margin: 0; font-size: 12px; color: var(--d-dim); display: flex; flex-wrap: wrap; gap: 4px 8px; }
.bal-split .sep { color: var(--d-faint); }
.plan-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding-block-start: 10px; border-block-start: 1px solid var(--d-glass-line); }
.plan-name { font-size: 15px; font-weight: 700; }
.plan-line .notice-warn { flex: 1 1 100%; }
.notice-warn { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; border-radius: var(--r-3); background: rgba(246, 170, 40, .12); border: 1px solid rgba(246, 170, 40, .4); color: var(--d-gold); }
.credit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-block-start: 4px; }
.credit-actions .btn { min-block-size: 40px; padding-inline: 16px; }
.credit-actions .btn .icon { inline-size: 16px; block-size: 16px; }
.credit-actions .link-btn { margin-inline-start: auto; }

/* offers */
.bill-sec { display: flex; flex-direction: column; gap: 10px; }
.offers-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.offers-head h2 { font-size: 16px; }
.offers-head h2:focus { outline: none; }
.offer-seg button, .hist-seg button { padding: 6px 16px; font-size: 13px; min-block-size: 32px; }
.offer-seg button:focus-visible, .hist-seg button:focus-visible { outline: 2px solid var(--d-ring); outline-offset: 1px; }
#offersHint { margin: 0; }
.offers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.offers[hidden] { display: none; }
.offers > p { grid-column: 1 / -1; }
.offer { padding: 18px; display: flex; flex-direction: column; gap: 8px; border-radius: var(--r-16); background: var(--d-glass-solid); border: 1px solid var(--d-glass-line); box-shadow: var(--d-shadow-panel); transition: border-color var(--dur-2), transform var(--dur-2), background var(--dur-2); }
.offer:hover, .offer:focus-within { border-color: var(--d-accent); background: var(--d-hover); transform: translateY(-2px); }
.offer.current { border-color: var(--d-accent); }
.offer h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.offer .badge.cur { font-size: 11px; font-weight: 600; }
.offer .price { font-size: 20px; font-weight: 700; }
.offer .price small { font-size: 12px; font-weight: 400; color: var(--d-dim); }
.offer ul { margin: 0; padding-inline-start: 18px; font-size: 13px; color: var(--d-dim); flex: 1; display: flex; flex-direction: column; gap: 2px; }
.offer .btn { align-self: stretch; justify-content: center; min-block-size: 40px; margin-block-start: 6px; }

/* the quiet row: promo code and referral */
.extra { border-radius: var(--r-3); border: 1px solid var(--d-glass-line); background: var(--d-side); }
.extra-toggle { display: flex; align-items: center; gap: 10px; inline-size: 100%; min-block-size: 44px; padding: 8px 14px; border: 0; background: none; color: var(--d-dim); font: inherit; font-size: 13px; cursor: pointer; text-align: start; border-radius: inherit; }
.extra-toggle:hover { color: var(--d-text); }
.extra-toggle:focus-visible { outline: 2px solid var(--d-ring); outline-offset: -2px; }
.extra-toggle .icon { inline-size: 16px; block-size: 16px; }
.extra-toggle .chev { transition: transform var(--dur-2); }
.extra-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.extra-panel { padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.extra-panel[hidden] { display: none; }
.ref { display: flex; flex-direction: column; gap: 6px; padding-block-start: 10px; border-block-start: 1px solid var(--d-glass-line); }
.ref .hint { margin: 0; }
.copy-row, .promo-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.copy-row input { flex: 1; min-inline-size: 180px; }

/* history dialog */
.dlg.sheet { inline-size: min(880px, 100%); }
.hist { display: flex; flex-direction: column; gap: 12px; }
.hist-pane { display: flex; flex-direction: column; gap: 10px; }
.hist-pane[hidden] { display: none; }
.hist-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hist-bar .search { flex: 1 1 220px; inline-size: auto; max-inline-size: none; min-block-size: 34px; }
.hist-bar .fld.inl { flex-direction: row; align-items: center; gap: 6px; }
.hist-bar .fld.inl > label { white-space: nowrap; }
.hist-bar select, .hist-bar input[type="date"] { inline-size: auto; padding-block: 5px; }
.tbl td.pos { color: var(--d-green); }
.tbl td.run { color: var(--d-dim); }

/* Search boxes look like the meetings search (css/app-shell.css .search): the box carries the border,
   the accent shows only on focus. forms.css gives every input[type=search] its own border and ring, which
   drew a light frame inside the box on this page; undo that for .search here only. */
[data-page^="billing"] .search input[type="search"] { border: 0; background: transparent; padding: 2px; outline: none; box-shadow: none; inline-size: 100%; min-inline-size: 0; }
[data-page^="billing"] .search input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }

/* member usage */
.usage-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(120px, 2fr) auto; gap: 12px; align-items: center; padding: 8px 0; border-block-end: 1px solid var(--d-glass-line); }
.usage-row:last-of-type { border-block-end: 0; }
.usage-row .meter { max-inline-size: none; }
.usage-row .cap { display: flex; align-items: center; gap: 6px; }
.usage-row .cap input { inline-size: 96px; }

/* checkout dialog */
.gw { display: flex; flex-direction: column; gap: 8px; border: 0; padding: 0; margin: 0; }
.gw legend { font-size: 12px; color: var(--d-dim); padding: 0; margin-block-end: 6px; }
.gw label { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-3); border: 1px solid var(--d-glass-line); background: var(--d-side); cursor: pointer; }
.gw label:hover { border-color: var(--d-accent); }
.gw label:has(input:checked) { border-color: var(--d-accent); background: var(--d-accent-soft); }
.gw input[type="radio"] { accent-color: var(--d-accent); }
.dlg.narrow { inline-size: min(480px, 100%); }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-start; flex-wrap: wrap; }

/* statuses */
.badge.paid { background: rgba(60, 200, 130, .14); color: var(--d-green); }
.badge.pend { background: var(--d-accent-soft); color: var(--d-accent); }
.badge.fail { background: rgba(241, 95, 95, .12); color: var(--d-red); }

/* receipt (printable) */
.receipt { display: flex; flex-direction: column; gap: 10px; }
.receipt dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.receipt dt { color: var(--d-dim); font-size: 13px; }
.receipt dd { margin: 0; font-weight: 600; }

/* result page */
.result { align-items: center; text-align: center; padding: 36px 24px; max-inline-size: 560px; margin-inline: auto; inline-size: 100%; }
.result .big { inline-size: 64px; block-size: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--d-accent-soft); color: var(--d-accent); }
.result .big svg { inline-size: 32px; block-size: 32px; }
.result.ok .big { background: rgba(60, 200, 130, .14); color: var(--d-green); }
.result.bad .big { background: rgba(241, 95, 95, .12); color: var(--d-red); }
.result dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; text-align: start; margin: 0; }
.result dt { color: var(--d-dim); font-size: 13px; }
.result dd { margin: 0; font-weight: 600; }
.result .spin { animation: bill-spin 1.2s linear infinite; }
@keyframes bill-spin { to { transform: rotate(360deg); } }

@media (max-width: 860px) { .offers { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .usage-row { grid-template-columns: 1fr; } .offer:hover { transform: none; } .credit-actions .btn { flex: 1 1 auto; justify-content: center; } }
/* phones: history and member usage become a full-screen sheet */
@media (max-width: 640px) {
  .scrim.sheet { padding: 0; place-items: stretch; }
  .dlg.sheet { inline-size: 100%; block-size: 100dvh; max-block-size: 100dvh; border-radius: 0; border: 0; padding-block-end: env(safe-area-inset-bottom); }
  .hist-bar .fld.inl { flex: 1 1 40%; }
  .hist-bar select, .hist-bar input[type="date"] { inline-size: 100%; }
}
@media (prefers-reduced-motion: reduce) { .result .spin { animation: none; } .offer, .meter > i, .extra-toggle .chev { transition: none; } .offer:hover, .offer:focus-within { transform: none; } }
@media print {
  body { overflow: visible; background: #fff; color: #000; }
  .shell, .ui-aurora, .toast, .no-print { display: none !important; }
  .scrim { position: static; background: none; padding: 0; display: block; }
  .scrim:not(:last-child) { display: none !important; }
  .dlg { box-shadow: none; border: 0; background: #fff; color: #000; max-block-size: none; inline-size: 100%; }
  .receipt dt { color: #333; }
}

/* onboarding card on /app (app-shell.js links this file when it shows the card) */
.onboard { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.ob-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ob-steps li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--r-3); background: var(--d-side); border: 1px solid var(--d-glass-line); }
.ob-steps li.done { opacity: .75; }
.ob-tick { inline-size: 26px; block-size: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 12px; font-weight: 700; background: var(--d-hover); color: var(--d-dim); }
.ob-steps li.done .ob-tick { background: rgba(60, 200, 130, .16); color: var(--d-green); }
.ob-tick .icon { inline-size: 14px; block-size: 14px; }
