/* 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; }
