/* ============================================================
   credits.css — the Copilot's AI credits (public/js/credits-ui.js, cr-*): the pill (top
   bar + Copilot header), the Add Credits dialog, the out-of-credits card and the Billing
   page's Credits section. Page tokens only → light/dark + accent themes follow.
   ============================================================ */

/* ── the pill ── */
.cr-pill{display:inline-flex;align-items:center;gap:6px;height:42px;padding:0 13px;border-radius:11px;flex:none;cursor:pointer;font:inherit;font-size:13.5px;font-weight:700;
  font-variant-numeric:tabular-nums;background:var(--panel2);color:var(--text);border:1px solid var(--line);transition:border-color .2s,background .2s,color .2s}
.cr-pill[hidden]{display:none}
.cr-pill i{font-size:16px;color:#F5A623}
.cr-pill em{font-style:normal;font-weight:600;color:var(--muted)}
.cr-pill:hover{border-color:var(--accent-line)}
.cr-pill:focus-visible{outline:3px solid var(--accent-line);outline-offset:2px}
.cr-pill.low{border-color:rgba(245,199,93,.55);background:rgba(245,199,93,.12)}
.cr-pill.low i,.cr-pill.low em{color:var(--amber,#F5C75D)}
[data-mode="light"] .cr-pill.low i,[data-mode="light"] .cr-pill.low em{color:#9A5B00}
.cr-pill.empty{border-color:var(--red-line);background:var(--red-soft);color:var(--red)}
.cr-pill.empty i,.cr-pill.empty em{color:var(--red)}
[data-mode="light"] .cr-pill.empty,[data-mode="light"] .cr-pill.empty i,[data-mode="light"] .cr-pill.empty em{color:#c6372a}
.cr-pill.sm{height:24px;padding:0 8px;gap:4px;margin-top:4px;border-radius:999px;font-size:11.5px}
.cr-pill.sm i{font-size:12px}
@media (max-width:640px){.topbar .cr-pill{height:36px;padding:0 9px;font-size:12.5px}.topbar .cr-pill em{display:none}}
/* phones: the top bar has no room left for the page title — the Copilot header's pill (and
   Billing) carry the balance there */
@media (max-width:420px){.topbar .cr-pill{display:none}}

/* ── Add Credits dialog (inside lt-sheet) ── */
.cr-lede{margin:0 0 16px;font-size:14.5px;line-height:1.55;color:var(--body)}
.cr-chips{display:grid;grid-template-columns:repeat(4,1fr);gap:9px}
.cr-chip{min-height:52px;border-radius:13px;border:1.5px solid var(--line);background:var(--panel2);color:var(--text);font:inherit;font-family:var(--display);font-size:18px;font-weight:700;cursor:pointer;transition:border-color .15s,background .15s,transform .1s}
.cr-chip:hover{border-color:var(--accent-line)}
.cr-chip:active{transform:scale(.97)}
.cr-chip.on{border-color:var(--accent);background:var(--accent-soft);color:var(--text);box-shadow:0 0 0 3px var(--accent-soft)}
.cr-chip:focus-visible{outline:3px solid var(--accent-line);outline-offset:2px}
.cr-custom{display:block;margin-top:16px}
.cr-custom>span{display:block;font-family:var(--mono);font-size:11px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted);margin-bottom:8px}
.cr-amt{display:flex;align-items:center;gap:8px;height:50px;padding:0 14px;border-radius:12px;border:1.5px solid var(--line);background:var(--panel2);transition:border-color .2s,box-shadow .2s}
.cr-amt:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
.cr-amt.bad{border-color:var(--red)}
.cr-amt b{font-family:var(--mono);font-size:17px;color:var(--muted)}
.cr-amt input{flex:1;min-width:0;height:100%;border:0;outline:0;background:transparent;color:var(--text);font-family:var(--mono);font-size:17px}
.cr-msg{min-height:18px;margin:6px 0 0;font-size:12.5px;color:var(--muted)}
.cr-msg.bad{color:var(--red)}
.cr-calc{display:flex;flex-direction:column;gap:3px;margin-top:6px;padding:14px 16px;border-radius:14px;background:var(--accent-soft);border:1px solid var(--accent-line);min-height:64px}
.cr-calc:empty{visibility:hidden}
.cr-calc b{font-family:var(--display);font-size:19px;color:var(--text)}
.cr-calc span{font-size:13px;color:var(--body)}
.cr-pay{display:flex;align-items:center;justify-content:center;gap:9px;width:100%;min-height:54px;margin-top:16px;border-radius:14px;border:0;cursor:pointer;
  background:var(--accent);color:var(--accent-ink);font:inherit;font-family:var(--display);font-size:16px;font-weight:700;box-shadow:0 8px 26px var(--accent-soft)}
.cr-pay:hover{filter:brightness(1.06)}
.cr-pay:disabled{opacity:.5;cursor:not-allowed;filter:none}
.cr-pay:focus-visible{outline:3px solid var(--accent-line);outline-offset:3px}
.cr-pay i{font-size:19px}
.cr-spin{animation:spin .8s linear infinite}
.cr-fine{margin:12px 0 0;text-align:center;font-size:12.5px;color:var(--muted)}
@media (max-width:420px){.cr-chips{grid-template-columns:repeat(2,1fr)}}

/* ── out of credits (Copilot panel / orb window) ── */
.cr-out{display:flex;gap:12px;align-items:flex-start;margin:6px 0;padding:14px;border-radius:14px;border:1px solid var(--red-line);background:var(--red-soft)}
.cr-out-ic{width:36px;height:36px;border-radius:10px;flex:none;display:grid;place-items:center;background:var(--panel);color:var(--red);font-size:18px}
.cr-out b{display:block;color:var(--text);font-size:14.5px;line-height:1.35}
.cr-out p{margin:4px 0 10px;color:var(--body);font-size:13px;line-height:1.5}
.cr-out b+.cr-btn{margin-top:10px}
.cr-btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:38px;padding:0 14px;border-radius:11px;font:inherit;font-size:13.5px;font-weight:700;cursor:pointer;
  border:1.5px solid var(--line);background:transparent;color:var(--text)}
.cr-btn.go{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
.cr-btn:hover{filter:brightness(1.06)}
.cr-btn:focus-visible{outline:3px solid var(--accent-line);outline-offset:2px}
.cr-btn i{font-size:15px}

/* ── Billing page: Credits ── */
.cr-bill-load{padding:18px;color:var(--muted);font-size:14px}
.cr-bill-top{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.cr-bill-total span{display:block;font-size:13px;color:var(--muted)}
.cr-bill-total b{display:inline-flex;align-items:center;gap:7px;font-family:var(--display);font-size:32px;font-weight:800;color:var(--text);font-variant-numeric:tabular-nums}
.cr-bill-total b i{font-size:26px;color:#F5A623}
.cr-bill-total b.low{color:var(--amber,#F5C75D)} [data-mode="light"] .cr-bill-total b.low{color:#9A5B00}
.cr-bill-total b.empty{color:var(--red)}
.cr-bill-top .cr-btn{min-height:44px;padding:0 18px;font-size:14.5px}
.cr-bill-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:12px;margin-top:16px}
.cr-bill-card{border:1px solid var(--line);border-radius:13px;padding:13px 14px;background:var(--panel2)}
.cr-bill-card .h{display:flex;justify-content:space-between;align-items:baseline;gap:8px}
.cr-bill-card .h b{font-size:14px;color:var(--text)}
.cr-bill-card .h span{font-size:13px;color:var(--body);font-variant-numeric:tabular-nums}
.cr-bill-card .r{font-size:12px;color:var(--muted);margin-top:8px}
.cr-bar{height:7px;border-radius:99px;background:var(--line);overflow:hidden;margin-top:10px}
.cr-bar span{display:block;height:100%;border-radius:inherit;background:var(--accent);transition:width .5s ease}
.cr-bill-costs{margin:12px 0 0;font-size:12.5px;color:var(--muted)}
.cr-hist{margin-top:16px}
.cr-hist>b{display:block;font-size:13.5px;color:var(--text);margin-bottom:6px}
.cr-hist ul{list-style:none;margin:0;padding:0;border:1px solid var(--line);border-radius:13px;overflow:hidden}
.cr-hist li{display:grid;grid-template-columns:70px minmax(0,1fr) auto;gap:10px;align-items:center;padding:10px 14px;font-size:13.5px;border-top:1px solid var(--line-soft)}
.cr-hist li:first-child{border-top:0}
.cr-hist .when{color:var(--muted);font-size:12.5px;white-space:nowrap}
.cr-hist .what{color:var(--body);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cr-hist .amt{font-family:var(--mono);font-weight:700;font-variant-numeric:tabular-nums}
.cr-hist .amt.plus{color:var(--green)} [data-mode="light"] .cr-hist .amt.plus{color:#1f8a66}
.cr-hist .amt.minus{color:var(--text)}
.cr-hist-empty{margin:14px 0 0;font-size:13px;color:var(--muted)}
@media (prefers-reduced-motion:reduce){.cr-bar span{transition:none}.cr-spin{animation:none}}
