/* The owner's Credits row and its popover (credits.js; docs/CONSOLE-REDESIGN.md §3.1, docs/BILLING.md §4a). The row is
   a frame item (frame.css .s-item) in the sidebar's foot, above Settings: wide, "Credits" with the balance at the right;
   collapsed, the icon moves up a little and a short figure sits under it, so the row stays 36 px and nothing jumps when
   the sidebar opens. Running low is the warning colour, out of credits the bad one; colour is never the only signal (the
   tooltip, the label and the popover say it in words). The popover is a menu surface (--pop-bg, --elev-2, the motion
   tokens), flat inside: hairlines between its parts, no boxes. Loaded before motion.css. */

/* ---------- the row ---------- */
.cr-row .cr-ic { position: relative; width: 18px; height: 18px; flex: none; display: grid; place-items: center; transition: transform var(--dur-2) var(--ease-out); }
.cr-row .cr-ic svg { width: 18px; height: 18px; display: block; }
.cr-row .cr-short { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 1px; font: 600 9.5px/1 var(--mono); font-style: normal;
  font-variant-numeric: tabular-nums; letter-spacing: -.03em; white-space: nowrap; color: var(--chrome-fg-2); opacity: 0; transition: opacity var(--dur-1) var(--ease-in); }
.cr-row .cr-fig { max-width: 62%; font-variant-numeric: tabular-nums; }
/* collapsed (not hovered, not focused): the icon and the short figure, stacked on the sidebar's centre line */
.shell[data-side="collapsed"] .rail:not(:hover):not(.peek) .cr-row .cr-ic, body.chrome-compact .cr-row .cr-ic { transform: translateY(-5px); }
.shell[data-side="collapsed"] .rail:not(:hover):not(.peek) .cr-row .cr-short, body.chrome-compact .cr-row .cr-short { opacity: 1; transition: opacity var(--dur-2) var(--ease-out) 60ms; }
.cr-row[aria-expanded="true"] { background: var(--chrome-active); color: var(--chrome-fg); }
.cr-row[data-state="low"] .cr-ic, .cr-row[data-state="low"] .cr-short, .cr-row[data-state="low"] .cr-fig { color: var(--warn); }
.cr-row[data-state="empty"] .cr-ic, .cr-row[data-state="empty"] .cr-short, .cr-row[data-state="empty"] .cr-fig { color: var(--bad-2); }

/* ---------- the phone's More ---------- */
.morelist .cr-more span { font-variant-numeric: tabular-nums; }
.morelist .cr-more[data-state="low"] span, .morelist .cr-more[data-state="low"] svg { color: var(--warn); }
.morelist .cr-more[data-state="empty"] span, .morelist .cr-more[data-state="empty"] svg { color: var(--bad-2); }

/* ---------- the popover: beside the sidebar, its foot level with the row; a bottom sheet on a phone ---------- */
.cr-wrap { position: fixed; inset: 0; z-index: var(--z-menu); pointer-events: none; } /* the Create menu's layer (composer.css .cz-menuwrap) */
.cr-wrap > * { pointer-events: auto; }
.cr-pop { position: fixed; width: 320px; max-height: calc(100vh - 16px); overflow-y: auto; padding: 14px 16px 12px; border-radius: 10px;
  background: var(--pop-bg); color: var(--text); box-shadow: var(--elev-2); font-size: 13px;
  --pop-dy: 4px; transform-origin: bottom left; animation: cp-pop-in var(--dur-2) var(--ease-out); }
/* The dialog itself takes focus when it opens (tabindex -1, never a Tab stop), so Escape and Tab work from the keyboard;
   its edge is the elevation, not tokens.css's focus ring, which its buttons keep (as the composer's box does). */
.cr-pop:focus, .cr-pop:focus-visible { outline: none !important; }
.cr-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cr-top h2 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.cr-bal { display: block; margin: 6px 0 2px; font: 600 26px/1.15 var(--sans); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.cr-bal[data-state="low"] { color: var(--warn); }
.cr-bal[data-state="empty"] { color: var(--bad-2); }
.cr-note { margin: 0 0 10px; font-size: 12.5px; line-height: 1.4; color: var(--text-3); }
.cr-line { margin: 0; line-height: 1.4; color: var(--text-2); }
.cr-left { margin: 0 0 10px; color: var(--text); }
.cr-dim { margin: 0 0 10px; color: var(--text-3); }
.cr-sec { border-top: 1px solid var(--line); padding: 10px 0; }
.cr-sh { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 12px; color: var(--text-3); }
.cr-sh .cr-amt { color: var(--text); font-weight: 600; }
.cr-cats, .cr-ends { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.cr-cats li { display: grid; grid-template-columns: minmax(0, 1fr) 64px minmax(64px, auto); align-items: center; gap: 10px; }
.cr-cl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-bar { height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--text) 9%, transparent); overflow: hidden; }
.cr-bar i { display: block; height: 100%; border-radius: 2px; background: var(--canopy); }
.cr-amt { font: 12px var(--mono); font-variant-numeric: tabular-nums; color: var(--text-2); text-align: right; white-space: nowrap; }
.cr-ends { margin-top: 6px; }
.cr-ends li { display: grid; grid-template-columns: minmax(0, 1fr) auto 56px; align-items: center; gap: 10px; }
.cr-ends time { font-size: 12px; color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }
.cr-on { color: var(--ok); }
.cr-acts { display: flex; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.cr-sheet .cr-pop { left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 82vh; border-radius: 14px 14px 0 0;
  padding: 8px 16px calc(14px + env(safe-area-inset-bottom)); animation: cp-sheet-up var(--dur-3) var(--ease-emph); }
.cr-sheet .cr-acts .btn { flex: 1; min-height: 44px; justify-content: center; }

/* ---------- out of credits on Free: "Top up" and Pro yearly in one line (credits.js fillOffers) ---------- */
.cr-offer { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 10px 0 0; }
.cr-offer .btn { white-space: normal; height: auto; min-height: 30px; padding-top: 5px; padding-bottom: 5px; text-align: left; line-height: 1.3; }
.cr-offer-who { flex: 1 1 100%; font-size: 12.5px; color: var(--text-3); }
.cr-head .cr-offer { margin: 0 0 12px; }
.cr-head .cr-offer .btn { flex: 1 1 100%; justify-content: center; text-align: center; }
.toast .cr-offer { margin-top: 8px; }
/* In the banner: inline after its sentence, the buttons in the banner's own colours */
.platform-banner .cr-offer-slot { display: inline; }
.platform-banner .cr-offer { display: inline-flex; margin: 6px 0 0 4px; vertical-align: middle; }
.platform-banner .cr-offer .btn { background: transparent; color: inherit; border-color: color-mix(in srgb, currentColor 45%, transparent); box-shadow: none; }
.platform-banner .cr-offer .btn.primary { background: #f3e3b5; color: #2a2414; border-color: #f3e3b5; }
.platform-banner .cr-offer-who { color: inherit; opacity: .8; }
@media (max-width: 780px) {
  .cr-offer .btn { flex: 1 1 100%; justify-content: center; text-align: center; min-height: 40px; }
  .platform-banner .cr-offer { display: flex; flex-wrap: nowrap; align-items: stretch; margin: 8px 0 0; }
  .platform-banner .cr-offer .btn { flex: 0 1 auto; min-height: 34px; font-size: 12.5px; }
  .platform-banner .cr-offer .btn.primary { flex: none; }
}

/* The starting credit, held until a selfie in Prson or a card check unlocks it (starter.js, docs/ABUSE.md): one line
   between hairlines, never a card; the two ways side by side, Prson first; one column on a phone. */
.st-unlock { padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 10px 0; }
.st-unlock.compact { margin: 8px 0 0; padding: 10px 0 8px; border-bottom: 0; }
.st-unlock p { margin: 0; }
.st-lead { font-size: 14px; line-height: 1.45; color: var(--text); }
.st-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; }
.st-way { display: inline-flex; align-items: center; gap: 8px; }
.st-hint, .st-or { font-size: 12.5px; color: var(--text-3); }
.st-unlock .st-last { margin-top: 8px; font-size: 13px; line-height: 1.4; color: var(--warn); }
.st-unlock .st-what, .st-unlock .st-who { margin-top: 8px; font-size: 12.5px; line-height: 1.4; color: var(--text-3); }
.st-what a { color: var(--text-2); }
.st-unlock.locked .st-acts { opacity: .55; }
/* The sidebar's Credits row while the starting credit waits: the figure in the accent, "to unlock" in words */
.cr-row[data-state="held"] .cr-ic, .cr-row[data-state="held"] .cr-fig, .cr-row[data-state="held"] .cr-short { color: var(--canopy-2); }
.morelist .cr-more[data-state="held"] span { color: var(--canopy-2); }
/* The create form's one line, and the first screen's */
.ob-starter { margin: 0 0 14px; }
.ob-starter-line { font-size: 13px; color: var(--text-2); margin: 8px 0 0; }
@media (max-width: 780px) {
  .st-acts { flex-direction: column; align-items: stretch; }
  .st-way { flex-wrap: wrap; }
  .st-way .btn { flex: 1 1 100%; justify-content: center; min-height: 40px; }
  .st-or { text-align: center; }
}
.st-unlock.top { margin: 0; border-top: 0; padding-top: 14px; }   /* Billing: the tabs' hairline above */
.st-unlock.compact .st-acts { flex-direction: column; align-items: flex-start; gap: 6px; }   /* the popover: one way per line */
@media (max-width: 780px) { .st-way .st-hint { flex: 1 1 100%; text-align: center; } }
