/* ==========================================================================
   panel.css — this product's additions on top of the delivered theme
   (fonts.css -> tw.css -> skin.css -> custom.css -> app.css -> panel.css).
   Nothing here uses an inline style: the page CSP allows style-src 'self'.
   ========================================================================== */

/* The template carried style="outline: none;" on two tablists; same rule, no
   style attribute. */
[data-replica-tabs] { outline: none; }

/* A progress bar's fill is set by setBalance()/app.js through a custom
   property (CSP has no inline styles): .meter is the track, .meter-fill the
   bar whose width follows --pct. */
.meter-fill,
[data-balance-fill],
[data-wallet-fill] { width: var(--pct, 0%); }

/* Loading frame: the view's shape while its fragment and data are on the way
   (the page paints at once instead of staying blank). No script, no inline
   style; app.js only toggles the [hidden] attribute. */
.cd-skel { display: grid; gap: 1.25rem; }
.cd-skel-row { display: grid; gap: 1.25rem; }
@media (min-width: 768px) {
  .cd-skel-row { grid-template-columns: 2fr 1fr; }
}
.cd-skel-block {
  border-radius: 0.5rem;
  background-color: hsl(var(--muted));
  animation: pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;
}
.cd-skel-hero { height: 9rem; }
.cd-skel-card { height: 13rem; }
.cd-skel-line { height: 1rem; width: 100%; }
.cd-skel-short { width: 60%; }
.cd-skel[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) {
  .cd-skel-block { animation: none; }
}


/* Overview placeholders while data loads, and per-card status lines. */
[data-loading] { opacity: 0.55; }
.data-note { font-size: 0.75rem; line-height: 1.4; }

/* A plain, denser table for requests (Overview) and the token-type weights. */
.tbl { width: 100%; caption-side: bottom; border-collapse: collapse; font-size: 13px; }
.tbl th { height: 2.25rem; padding: 0 0.75rem; text-align: left; font-size: 10px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.05em; color: hsl(var(--muted-foreground)); white-space: nowrap; }
.tbl td { padding: 0.625rem 0.75rem; border-top: 1px solid hsl(var(--border)); vertical-align: middle; }
.tbl tr:hover td { background-color: hsl(var(--muted) / 0.5); }
.tbl .num { text-align: right; font-family: var(--v7-font-mono, ui-monospace, monospace);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl-scroll { overflow-x: auto; margin-top: 0.25rem; }
.tbl .status-ok { color: hsl(160 60% 40%); }
.tbl .status-bad { color: hsl(0 72% 55%); }
.dark .tbl .status-ok { color: hsl(160 60% 60%); }
.dark .tbl .status-bad { color: hsl(0 72% 68%); }

/* Quota windows: one row per cap, a thin bar and the two numbers. */
.window-row { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) auto; gap: 0.75rem;
  align-items: center; padding: 0.5rem 0; border-top: 1px solid hsl(var(--border)); }
.window-row:first-child { border-top: 0; }
.window-name { font-size: 0.75rem; font-weight: 500; text-transform: capitalize; }
.window-track { height: 0.375rem; overflow: hidden; border-radius: 9999px; background-color: hsl(var(--muted)); }
.window-bar { height: 100%; border-radius: 9999px; background-color: hsl(var(--ring));
  width: var(--pct, 0%); }
.window-bar.is-warn { background-color: hsl(38 92% 50%); }
.window-bar.is-hot { background-color: hsl(var(--destructive)); }
.window-numbers { font-family: var(--v7-font-mono, ui-monospace, monospace); font-size: 0.75rem;
  font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* Model rows: name + id on the left, multiplier on the right. */
.model-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 0;
  border-top: 1px solid hsl(var(--border)); }
.model-row:first-child { border-top: 0; }
.model-copy { display: inline-flex; align-items: center; gap: 0.375rem; margin-top: 0.125rem;
  border-radius: 2px; font-family: var(--v7-font-mono, ui-monospace, monospace); font-size: 0.75rem;
  color: hsl(var(--muted-foreground)); max-width: 100%; }
.model-copy:hover, .model-copy:focus-visible { color: hsl(var(--foreground)); }
.model-badge { border-radius: 9999px; background-color: hsl(var(--muted)); padding: 0.25rem 0.625rem;
  font-family: var(--v7-font-mono, ui-monospace, monospace); font-size: 0.75rem; font-weight: 600;
  color: hsl(var(--muted-foreground)); white-space: nowrap; }
.model-badge.is-premium { color: hsl(150 60% 30%); }
.dark .model-badge.is-premium { color: hsl(150 60% 68%); }

/* The link-first entry: one centred card, no sidebar navigation to click.
   With no working link there is nothing to navigate, so the shell's rail,
   header, bottom bar, footer and help launcher step aside and the card is the
   page. app.js flips the root class (``panel.setChrome``) and nothing in the
   markup changes. */
.link-card { max-width: 34rem; margin: 3rem auto; }
.link-card .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
html.cd-chrome-off .v8-root > aside,
html.cd-chrome-off .shell > header,
html.cd-chrome-off body > nav,
html.cd-chrome-off .shell > footer,
html.cd-chrome-off .support-help-launcher { display: none; }
html.cd-chrome-off .cd-main { margin-inline-start: 0; padding: 1rem; }

/* ---------- views ---------- */
/* Each view is a section the shell ships hidden; app.js reveals one at a time
   and fills its [data-view-body] with the fragment. */
.view[hidden] { display: none; }
[data-standby] { margin-inline: auto; }

/* ---------- the page next to the fixed sidebar ---------- */
/* The sidebar is position: fixed (16rem from xl up, an icon rail of 4rem
   below that), so the content column is offset by exactly that. The template
   put a centred max-width column inside a column that knew nothing about the
   offset, which made the page look pushed to the right and re-centred
   differently at every zoom step; here the column owns the space that is
   left of the sidebar and fills it up to a comfortable reading width. */
.cd-main { padding: 1.25rem 1rem 5rem; }
@media (min-width: 768px) {
  .cd-main { margin-inline-start: 4rem; padding-bottom: 2.5rem; }
}
@media (min-width: 1280px) {
  .cd-main { margin-inline-start: 16rem; padding-inline: 1.5rem; }
}
/* The shell's own header spans the page minus the same rail. The shell is a
   full-height flex column so a short page (Support) still has a footer at the
   bottom of the window instead of stranded mid-page. */
.shell { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.cd-main { flex: 1 0 auto; }
.shell > footer { margin-top: auto; }
@media (min-width: 768px) {
  .shell > header { margin-inline-start: 4rem; }
}
@media (min-width: 1280px) {
  .shell > header { margin-inline-start: 16rem; }
}
/* The content column is centred in the width that is left of the sidebar —
   not glued to the left edge. (The section is the flex/grid child; auto
   inline margins centre it inside the padded main area.) */
.cd-main > .view { width: 100%; max-width: 68rem; margin-inline: auto; }
/* The footer is part of the shell, so it takes the same rail offset as the
   header and lets its own (centred, max-width) content line up with the
   column above it. Without this it sat under the sidebar and only the first
   word was visible. */
.shell > footer { margin-inline-start: 0; margin-inline-end: 0; max-width: none; }
@media (min-width: 768px) {
  .shell > footer { margin-inline-start: 4rem; }
}
@media (min-width: 1280px) {
  .shell > footer { margin-inline-start: 16rem; }
}

/* One window's cap: the bar, the numbers and when it rolls over. The
   aria-label on each bar says whether the percentage is used or left. */
.window-row { grid-template-columns: minmax(0, 9rem) minmax(0, 1fr) auto; }
.window-meta { display: block; font-size: 0.6875rem; font-weight: 400; text-transform: none;
  color: hsl(var(--muted-foreground)); }
.window-numbers { display: grid; justify-items: end; gap: 0.0625rem; }
.window-reset { font-size: 0.6875rem; color: hsl(var(--muted-foreground)); }

/* Desktop: the configured limits sit side by side in one row — one column per
   limit, so then a glance compares five-hour, daily and weekly. An unset limit
   has no column at all; one configured limit takes the row by itself. */
@media (min-width: 1024px) {
  .cd-windows { display: grid; grid-template-columns: repeat(var(--window-cols, 3), minmax(0, 1fr)); }
  .cd-windows .window-row { grid-template-columns: minmax(0, 1fr); gap: 0.375rem;
    padding: 0 1.125rem; border-top: 0; border-left: 1px solid hsl(var(--border)); }
  .cd-windows .window-row:first-child { border-left: 0; padding-left: 0; }
  .cd-windows .window-row:last-child { padding-right: 0; }
  .cd-windows .window-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cd-windows .window-numbers { grid-auto-flow: column; justify-content: space-between;
    justify-items: start; gap: 0.5rem; text-align: left; }
}

/* ---------- dialogs (sign out, copy by hand, key unavailable) ---------- */
[data-modal-host] { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  padding: 1rem; background-color: hsl(0 0% 0% / 0.45); }
[data-modal-host][hidden] { display: none; }
[data-dialog] { width: 100%; display: grid; place-items: center; }
[data-dialog][hidden] { display: none; }
.cd-dialog { width: min(26rem, 100%); border: 1px solid hsl(var(--border)); border-radius: 0.75rem;
  background-color: hsl(var(--card)); color: hsl(var(--card-foreground)); padding: 1.25rem;
  box-shadow: 0 20px 50px hsl(0 0% 0% / 0.25); }
.cd-dialog-title { font-size: 1rem; font-weight: 600; }
.cd-dialog-text { margin-top: 0.375rem; font-size: 0.8125rem; line-height: 1.55;
  color: hsl(var(--muted-foreground)); }
.cd-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem;
  margin-top: 1rem; }
.cd-copy-source { margin-top: 0.75rem; width: 100%; resize: vertical; border-radius: 0.5rem;
  border: 1px solid hsl(var(--input)); background-color: hsl(var(--background)); padding: 0.5rem;
  font-family: var(--v7-font-mono, ui-monospace, monospace); font-size: 0.75rem;
  overflow-wrap: anywhere; }

/* The wallet dialog: the balance, what it pays for, and the movements behind
   it. Amounts are the API's USD strings; app.js formats them with money(). */
#pn-wallet .cd-dialog { width: min(30rem, 100%); }
.cd-wallet { display: grid; gap: 0.125rem; margin-top: 0.875rem; padding: 0.75rem;
  border: 1px solid hsl(var(--border)); border-radius: 0.5rem;
  background-color: hsl(var(--muted) / 0.35); }
.cd-wallet-label { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: hsl(var(--muted-foreground)); }
.cd-wallet-amount { font-family: var(--v7-font-mono, ui-monospace, monospace);
  font-size: 1.375rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.cd-wallet-state { font-size: 0.75rem; line-height: 1.45; color: hsl(var(--muted-foreground)); }
.cd-wallet-movements { display: grid; gap: 0.375rem; margin-top: 0.75rem;
  max-height: 12rem; overflow-y: auto; overscroll-behavior: contain; }
.cd-wallet-movement { display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.75rem; font-size: 0.75rem; }
.cd-wallet-movement-kind { font-weight: 500; }
.cd-wallet-movement-meta { font-size: 0.6875rem; color: hsl(var(--muted-foreground)); }
.cd-wallet-movement-amount { font-family: var(--v7-font-mono, ui-monospace, monospace);
  font-variant-numeric: tabular-nums; }
html.cd-locked { overflow: hidden; }

/* The entry page (/join): one card in the middle of the window. It carries
   either the address form (ask for a link) or the state of a link that was
   opened, see join.js. */
.cd-body { min-height: 100vh; margin: 0; background-color: hsl(var(--background));
  color: hsl(var(--foreground)); }
.cd-center { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.cd-center-text { text-align: center; font-size: 0.8125rem; color: hsl(var(--muted-foreground)); }
.cd-join-note { margin-top: 0.5rem; font-size: 0.75rem; line-height: 1.5;
  color: hsl(var(--muted-foreground)); }
.cd-field { display: grid; gap: 0.375rem; margin-top: 1rem; }
.cd-field-label { font-size: 0.75rem; font-weight: 600; }
.cd-input { height: 2.25rem; width: 100%; padding: 0 0.75rem; border-radius: 0.375rem;
  border: 1px solid hsl(var(--input)); background-color: hsl(var(--background));
  color: inherit; font-size: 0.8125rem; }
.cd-input:focus-visible { outline: none; box-shadow: 0 0 0 2px hsl(var(--ring)); }
.cd-join-form { width: 100%; }
.cd-join-form .cd-dialog-actions { margin-top: 0.875rem; }
/* Third-party sign-in: a quiet divider and the provider buttons under the
   e-mail form (see join.js). */
.cd-join-providers { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  margin-top: 0.25rem; }
.cd-join-providers .cd-join-note { width: 100%; margin-top: 0.75rem; text-align: center; }

/* ---------- buttons used by app.js and the dialogs ---------- */
.cd-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem;
  height: 2.25rem; padding: 0 0.875rem; border: 1px solid hsl(var(--input)); border-radius: 0.375rem;
  background-color: hsl(var(--background)); font-size: 0.8125rem; font-weight: 500; }
.cd-btn:hover { background-color: hsl(var(--accent)); }
.cd-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px hsl(var(--ring)); }
.cd-btn-primary { border-color: transparent; background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground)); }
.cd-btn-primary:hover { background-color: hsl(var(--primary) / 0.9); }
.cd-btn-danger { border-color: transparent; background-color: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground, 0 0% 100%)); }
.cd-btn:disabled { opacity: 0.5; pointer-events: none; }

/* The header's sign-out control: quiet by default, sized to sit beside the
   theme switch. The label hides under sm (see SIGN_OUT_BUTTON in build_ui.py)
   so the row keeps its width on a phone. */
.cd-signout-btn { display: inline-flex; align-items: center; gap: 0.375rem;
  height: 2rem; padding: 0 0.625rem; border: 1px solid hsl(var(--border));
  border-radius: 0.375rem; background-color: transparent;
  color: hsl(var(--muted-foreground)); font-size: 0.75rem; font-weight: 500; }
.cd-signout-btn:hover { color: hsl(var(--foreground)); background-color: hsl(var(--accent)); }
.cd-signout-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px hsl(var(--ring)); }
@media (max-width: 639px) { .cd-signout-btn { padding: 0 0.5rem; } }

/* A copy that worked: the icon turns into a check for a moment. */
.copy-ok svg { color: hsl(160 60% 40%); }

/* ---------- notifications ---------- */
/* The bell's count: the template shipped a permanently lit dot on the icon,
   which read as one unread item that never cleared. The dot now only shows
   while the list has something in it, and the number says how many. */
[data-notif-toggle] svg .text-primary { display: none; }
[data-notif-badge] { position: absolute; top: -0.25rem; right: -0.25rem;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1rem; height: 1rem; padding: 0 0.25rem; border-radius: 9999px;
  background-color: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  font-size: 0.625rem; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; }
.notif-item { padding: 0.5rem; border-radius: 0.375rem; border: 1px solid hsl(var(--border)); cursor: pointer; transition: background-color 0.12s; }
.notif-item:hover { background: hsl(var(--muted)); }
.notif-item[data-notif-read] { opacity: 0.6; }
.notif-title { font-size: 0.75rem; font-weight: 600; }
.notif-body { font-size: 0.6875rem; line-height: 1.45; color: hsl(var(--muted-foreground)); }
.notif-link { font-size: 0.6875rem; font-weight: 500; color: hsl(var(--primary)); text-decoration: underline; }
.notif-dialog-body { white-space: pre-wrap; }

/* ---------- copy fallback ---------- */
.cd-offscreen { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0;
  pointer-events: none; }

/* ---------- the Connect guide's client list ---------- */
.cd-client-list { max-height: 34rem; overflow-y: auto; overscroll-behavior: contain; }
.cd-client-list [data-client-pick] { scroll-margin-top: 4rem; }

/* The template shows a tooltip on focus inside .group; the panel's own layer
   already does that, so the template's rule is switched off here. */
.group:has(> button:focus-visible) > .tt { display: none; }

/* ---------- scrollbars (theme skin, not the browser default) ----------
   The delivered template's own skin styles no scrollbar; on Windows the
   browser then paints a light trough on the dark theme, a bright band down
   the side of a dark page. One rule set, both themes: the thumb takes the
   theme border colour, so it follows light/dark without a second copy. */
html, body, .cd-body, .tbl-scroll, .cd-wallet-movements, .cd-client-list,
[data-command-panel] pre, .tbl-scroll table {
  scrollbar-width: thin;
  scrollbar-color: hsl(var(--border)) transparent;
}
html::-webkit-scrollbar, body::-webkit-scrollbar, .cd-body::-webkit-scrollbar,
.tbl-scroll::-webkit-scrollbar, .cd-wallet-movements::-webkit-scrollbar,
.cd-client-list::-webkit-scrollbar, [data-command-panel] pre::-webkit-scrollbar {
  width: 10px; height: 10px;
}
html::-webkit-scrollbar-track, body::-webkit-scrollbar-track, .cd-body::-webkit-scrollbar-track,
.tbl-scroll::-webkit-scrollbar-track, .cd-wallet-movements::-webkit-scrollbar-track,
.cd-client-list::-webkit-scrollbar-track, [data-command-panel] pre::-webkit-scrollbar-track {
  background: transparent;
}
html::-webkit-scrollbar-thumb, body::-webkit-scrollbar-thumb, .cd-body::-webkit-scrollbar-thumb,
.tbl-scroll::-webkit-scrollbar-thumb, .cd-wallet-movements::-webkit-scrollbar-thumb,
.cd-client-list::-webkit-scrollbar-thumb, [data-command-panel] pre::-webkit-scrollbar-thumb {
  border-radius: 9999px; border: 2px solid transparent; background-clip: padding-box;
  background-color: hsl(var(--border));
}
html::-webkit-scrollbar-thumb:hover, body::-webkit-scrollbar-thumb:hover,
.cd-body::-webkit-scrollbar-thumb:hover, .tbl-scroll::-webkit-scrollbar-thumb:hover,
.cd-wallet-movements::-webkit-scrollbar-thumb:hover,
.cd-client-list::-webkit-scrollbar-thumb:hover,
[data-command-panel] pre::-webkit-scrollbar-thumb:hover {
  background-color: hsl(var(--muted-foreground) / 0.5);
}
html::-webkit-scrollbar-corner, body::-webkit-scrollbar-corner { background: transparent; }

/* ---------- the Overview card ---------- */
/* One real overview: usage gauge, the plan's clock, every limit and the two
   values a client needs, in one surface. The colour comes from a small set of
   accents (blue = usage, green = premium and healthy) rather than from a
   recoloured page. */
.cd-card { border: 1px solid hsl(var(--border)); border-radius: 0.75rem;
  background-color: hsl(var(--card)); color: hsl(var(--card-foreground));
  box-shadow: 0 1px 2px hsl(0 0% 0% / 0.04); min-width: 0; }
.cd-card-head { display: flex; flex-wrap: wrap; align-items: flex-start;
  justify-content: space-between; gap: 0.75rem; padding: 1.25rem;
  border-bottom: 1px solid hsl(var(--border)); }
.cd-card-body { padding: 1.25rem; }
.cd-eyebrow { display: block; font-size: 0.6875rem; font-weight: 600; line-height: 1;
  text-transform: uppercase; letter-spacing: 0.06em; color: hsl(var(--muted-foreground)); }
.cd-h2 { margin: 0.375rem 0 0; font-size: 1.0625rem; font-weight: 600; line-height: 1.25; }
.cd-h3 { margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.25; }
.cd-sub { margin: 0.25rem 0 0; font-size: 0.8125rem; line-height: 1.45;
  color: hsl(var(--muted-foreground)); }
.cd-note { margin: 0; font-size: 0.75rem; line-height: 1.45; color: hsl(var(--muted-foreground)); }
.cd-warn { display: flex; align-items: flex-start; gap: 0.5rem; margin: 0.75rem 0 0;
  font-size: 0.75rem; font-weight: 500; color: hsl(var(--destructive)); }
.cd-warn[hidden] { display: none; }

.ov-card { display: grid; gap: 0; overflow: hidden; }
.ov-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.75rem 1.25rem; padding: 1.25rem 1.25rem 0; }
.ov-head-main { min-width: 0; }
.ov-buy { flex: none; }
/* Wallet credit: the balance sits in the card head, the purchase form in the
   body. Three fields on one row on a wide card, stacked on a phone. */
.ov-wallet { display: grid; gap: 0.15rem; justify-items: end; flex: none; }
.ov-wallet-value { font-family: var(--v7-font-mono, ui-monospace, monospace);
  font-size: 1.25rem; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums;
  color: hsl(var(--primary)); }
.ov-topup { display: grid; gap: 0.65rem; }
.ov-topup[hidden] { display: none; }
.ov-topup-fields { display: grid; gap: 0.65rem; align-items: end; }
@media (min-width: 640px) {
  .ov-topup-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 12rem) auto; }
}
.ov-field { display: grid; gap: 0.3rem; min-width: 0; }
.ov-field > span { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: hsl(var(--muted-foreground)); }
/* The wallet-after-expiry switch: one labelled checkbox and the sentence that
   says what it changes. */
.ov-fallback { display: grid; gap: 0.35rem; margin-top: 1rem; padding-top: 1rem;
  border-top: 1px solid hsl(var(--border)); }
.ov-switch { display: inline-flex; align-items: center; gap: 0.55rem; cursor: pointer;
  font-size: 0.875rem; font-weight: 600; color: hsl(var(--foreground)); }
.ov-switch input { inline-size: 1rem; block-size: 1rem; accent-color: hsl(var(--primary)); cursor: pointer; }
.ov-switch input:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.ov-grid { display: grid; gap: 1.25rem; padding: 1.25rem; }
@media (min-width: 900px) {
  .ov-grid { grid-template-columns: minmax(0, 1fr); align-items: start; }
}
.ov-gauge { display: grid; gap: 0.5rem; min-width: 0; }
.ov-gauge-number { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.5rem; }
.ov-gauge-number > span:first-child { font-family: var(--v7-font-mono, ui-monospace, monospace);
  font-size: 2.75rem; font-weight: 650; line-height: 1; font-variant-numeric: tabular-nums;
  color: hsl(var(--primary)); }
.ov-gauge-of { font-size: 0.8125rem; color: hsl(var(--muted-foreground)); }
.cd-bar { height: 0.625rem; overflow: hidden; border-radius: 9999px; background-color: hsl(var(--muted)); }
.cd-bar-fill { display: block; height: 100%; border-radius: 9999px;
  background-color: hsl(var(--primary)); transition: width 0.5s ease; }
@media (prefers-reduced-motion: reduce) { .cd-bar-fill { transition: none; } }
.cd-bar-fill.is-warn { background-color: hsl(38 92% 50%); }
.cd-bar-fill.is-hot { background-color: hsl(var(--destructive)); }
.ov-gauge-foot { display: flex; flex-wrap: wrap; align-items: baseline;
  justify-content: space-between; gap: 0.25rem 1rem; font-size: 0.75rem;
  color: hsl(var(--muted-foreground)); }
.ov-gauge-used { font-weight: 600; color: hsl(var(--foreground)); }

/* The four history stats: real tiles, a small label over a big figure. The
   template left them as bare text that stacked into one column. */
.ov-today { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
@media (min-width: 640px) { .ov-today { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ov-today > div { display: grid; gap: 0.25rem; padding: 0.75rem 0.875rem;
  border: 1px solid hsl(var(--border)); border-radius: 0.625rem;
  background-color: hsl(var(--muted) / 0.3); min-width: 0; }
.ov-today > div > span:first-child { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: hsl(var(--muted-foreground)); }
.ov-today-value { font-family: var(--v7-font-mono, ui-monospace, monospace); font-size: 1.375rem;
  font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
/* Success blue, failed red — the same pair the tables use, so the tile and the
   row read as one story instead of two shades of the same amber. */
.ov-today-value.is-ok { color: hsl(210 90% 50%); }
.dark .ov-today-value.is-ok { color: hsl(210 90% 70%); }
.ov-today-value.is-bad { color: hsl(0 72% 52%); }
.dark .ov-today-value.is-bad { color: hsl(0 72% 68%); }
.ov-today-pair { display: inline-flex; align-items: baseline; gap: 0.1875rem; }
.ov-today-sep { color: hsl(var(--muted-foreground)); font-weight: 500; }
/* The note under the tiles that says the token figure already folds in cache. */
.cd-tokens-note { margin: 0.625rem 0 0; }

/* Tab bars shared by the tabbed cards. The active tab is blue, matching the
   active sidebar item, so "where am I" reads the same everywhere. */
.cd-tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0.875rem 0;
  border-bottom: 1px solid hsl(var(--border)); }
.cd-tab { appearance: none; border: 0; border-bottom: 2px solid transparent; background: none;
  margin-bottom: -1px; padding: 0.5rem 0.75rem; font-size: 0.8125rem; font-weight: 600;
  color: hsl(var(--muted-foreground)); cursor: pointer; transition: color 0.12s ease, border-color 0.12s ease; }
.cd-tab:hover { color: hsl(var(--foreground)); }
.cd-tab.is-active { color: hsl(var(--primary)); border-bottom-color: hsl(var(--primary)); }
.cd-tab:focus-visible { outline: none; box-shadow: 0 0 0 2px hsl(var(--ring)); border-radius: 0.375rem 0.375rem 0 0; }

/* A fragment that is two stacked cards (the Connect view): keep the Connect
   card and the client grid from gluing to each other. */
.cd-view-stack { display: grid; gap: 1.25rem; min-width: 0; }

/* The gauge's foot: a plain reset/usable sentence on the left, and a small
   chip (premium share or cache) on the right. */
.ov-chip { display: inline-flex; flex: none; align-items: center; }
.ov-chip[hidden] { display: none !important; }
.ov-chip-btn { display: inline-flex; align-items: center; gap: 0.3125rem; height: 1.5rem;
  padding: 0 0.5rem; border: 1px solid hsl(var(--border)); border-radius: 9999px;
  background-color: hsl(var(--background)); font-size: 0.6875rem; font-weight: 600; line-height: 1; }
.ov-chip-btn.is-share { border-color: hsl(150 60% 40% / 0.45); background-color: hsl(150 60% 40% / 0.12);
  color: hsl(150 65% 26%); }
.dark .ov-chip-btn.is-share { color: hsl(150 55% 64%); }
.ov-chip-btn.is-cache { border-color: hsl(210 90% 55% / 0.4); background-color: hsl(210 90% 55% / 0.12);
  color: hsl(214 80% 40%); }
.dark .ov-chip-btn.is-cache { color: hsl(210 90% 74%); }
.ov-chip-num { font-variant-numeric: tabular-nums; color: hsl(150 62% 30%); }
.dark .ov-chip-num { color: hsl(150 55% 64%); }
.ov-chip-i, .ov-inline-i { display: inline-flex; align-items: center; justify-content: center;
  width: 0.875rem; height: 0.875rem; border-radius: 9999px; border: 1px solid currentColor;
  font-size: 0.5625rem; font-weight: 700; font-style: normal; line-height: 1; opacity: 0.8; }
.ov-inline-i { width: 0.8125rem; height: 0.8125rem; vertical-align: -1px; }
.ov-chip-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px hsl(var(--ring)); }

/* The floating tooltip the data-tt-anchor → data-tt-body system paints. It had
   no style at all, so it rendered as bare text at the end of the page. */
.tt-layer { position: fixed; z-index: 80; max-width: 18rem; padding: 0.5rem 0.625rem;
  border-radius: 0.5rem; border: 1px solid hsl(var(--border));
  background-color: hsl(var(--popover)); color: hsl(var(--popover-foreground));
  box-shadow: 0 10px 30px hsl(0 0% 0% / 0.2); font-size: 0.75rem; line-height: 1.45;
  opacity: 0; pointer-events: none; transition: opacity 0.12s ease; }
.tt-layer.is-open { opacity: 1; }
.tt-line { display: flex; justify-content: space-between; gap: 0.75rem; white-space: nowrap; }
.tt-line + .tt-line { margin-top: 0.1875rem; }
.tt-line .tt-k { color: hsl(var(--muted-foreground)); }
.tt-line .tt-v { font-family: var(--v7-font-mono, ui-monospace, monospace); font-variant-numeric: tabular-nums; }
.tt-total { margin-top: 0.375rem; padding-top: 0.375rem; border-top: 1px solid hsl(var(--border)); font-weight: 600; }
.ov-chip-src { display: none; }
.tt-line.tt-total .tt-k { color: inherit; }
/* The charged total is the answer the row is asking for: paint it blue, the
   panel's "figure that matters" colour, so it is not lost among the parts. */
.tt-line.tt-total .tt-v, .tt-total .tt-v { color: hsl(210 90% 50%); }
.dark .tt-line.tt-total .tt-v, .dark .tt-total .tt-v { color: hsl(210 90% 72%); }
/* A cache component's tag (5m / 1h / read) in green, so the cached part of a
   charge is visible at a glance in the tooltip. */
.tt-tag { display: inline-block; margin-right: 0.375rem; padding: 0 0.3rem;
  border-radius: 9999px; border: 1px solid hsl(150 55% 42% / 0.5);
  background-color: hsl(150 55% 42% / 0.14); color: hsl(150 62% 28%);
  font-family: var(--v7-font-mono, ui-monospace, monospace); font-size: 0.5625rem;
  font-weight: 700; line-height: 1.35; }
.dark .tt-tag { color: hsl(150 55% 68%); }
/* A wallet charge breakdown is a message box, so its whole panel is tinted the
   same green as the cache tag: clear signal it is about money spent, while the
   neutral informational tooltips stay on the popover surface. */
.tt-layer.is-wallet { border-color: hsl(150 55% 42% / 0.5); background-color: hsl(150 45% 96%); color: hsl(150 40% 18%); }
.dark .tt-layer.is-wallet { background-color: hsl(150 30% 14%); color: hsl(150 30% 88%); }
.tt-layer.is-wallet .tt-line .tt-k { color: hsl(150 30% 32%); }
.dark .tt-layer.is-wallet .tt-line .tt-k { color: hsl(150 25% 72%); }

/* Wallet charges: each cell shows the tokens, with what that part cost in
   dollars underneath; the total carries the breakdown tooltip button. */
.wallet-cost { display: block; font-size: 0.625rem; line-height: 1.25;
  color: hsl(var(--muted-foreground)); font-variant-numeric: tabular-nums; }
.wallet-total { display: inline-flex; align-items: center; gap: 0.25rem;
  font-variant-numeric: tabular-nums; }
button.ov-chip-i { background: none; padding: 0; cursor: help;
  color: hsl(var(--muted-foreground)); }
button.ov-chip-i:hover { color: hsl(var(--foreground)); }
button.ov-chip-i:focus-visible { outline: none; box-shadow: 0 0 0 2px hsl(var(--ring)); }

/* The sidebar's connection ping dot: neutral while checking, then green /
   amber / red for a healthy / fair / slow round trip to the Base URL. */
[data-ping-dot] { background-color: hsl(var(--muted-foreground)); }
[data-ping-dot][data-ping-tone="checking"] { background-color: hsl(var(--muted-foreground)); }
[data-ping-dot][data-ping-tone="fast"] { background-color: hsl(160 60% 45%); }
[data-ping-dot][data-ping-tone="ok"] { background-color: hsl(38 92% 50%); }
[data-ping-dot][data-ping-tone="slow"] { background-color: hsl(0 72% 55%); }

.ov-limits { display: grid; gap: 0.375rem; padding: 0 1.25rem 1.25rem; }
.ov-limits[hidden] { display: none; }
.ov-conn { display: grid; gap: 0.75rem; padding: 1.25rem;
  border-top: 1px solid hsl(var(--border)); background-color: hsl(var(--muted) / 0.35); }
.ov-conn-row { display: grid; gap: 0.375rem; min-width: 0; }
.ov-conn-row > span { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: hsl(var(--muted-foreground)); }
.ov-conn-value { display: flex; min-width: 0; align-items: center; gap: 0.5rem; }
.ov-conn-value code { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; border: 1px solid hsl(var(--border)); border-radius: 0.375rem;
  background-color: hsl(var(--card)); padding: 0.375rem 0.625rem;
  font-family: var(--v7-font-mono, ui-monospace, monospace); font-size: 0.75rem; }
.ov-conn-actions { display: flex; flex: none; align-items: center; gap: 0.25rem; }
/* Desktop: the key and the Base URL share one row, so both values are visible
   together; the note under them still runs the full width. */
@media (min-width: 768px) {
  .ov-conn { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.25rem; }
  .ov-conn > .cd-note { grid-column: 1 / -1; }
}
.cd-icon-btn { display: inline-flex; align-items: center; justify-content: center;
  width: 1.875rem; height: 1.875rem; flex: none; border-radius: 0.375rem;
  border: 1px solid hsl(var(--border)); background-color: hsl(var(--card)); }
.cd-icon-btn:hover { background-color: hsl(var(--accent)); }
.cd-icon-btn svg { width: 0.875rem; height: 0.875rem; }

/* ---------- the models list ---------- */
.cd-models { display: grid; }
.mod-group { display: grid; }
.mod-group-head { display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.75rem; padding: 0.875rem 0 0.5rem; }
.mod-group:first-child .mod-group-head { padding-top: 0; }
.mod-group-name { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: hsl(var(--primary)); }
.mod-group-count { font-size: 0.6875rem; color: hsl(var(--muted-foreground)); }
.mod-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.5rem 1rem;
  align-items: center; padding: 0.625rem 0; border-top: 1px solid hsl(var(--border)); }
.mod-main { display: grid; gap: 0.1875rem; min-width: 0; }
.mod-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem;
  font-size: 0.875rem; font-weight: 550; line-height: 1.3; }
.mod-id { display: inline-flex; align-items: center; gap: 0.25rem;
  font-family: var(--v7-font-mono, ui-monospace, monospace); font-size: 0.6875rem;
  color: hsl(var(--muted-foreground)); }
.mod-id-copy { display: inline-flex; align-items: center; justify-content: center;
  width: 1.25rem; height: 1.25rem; border-radius: 0.25rem; border: 1px solid hsl(var(--border));
  background-color: hsl(var(--card)); color: hsl(var(--muted-foreground)); }
.mod-id-copy:hover { color: hsl(var(--foreground)); background-color: hsl(var(--accent)); }
.mod-id-copy svg { width: 0.625rem; height: 0.625rem; }
.mod-tag { display: inline-flex; align-items: center; height: 1.125rem; padding: 0 0.375rem;
  border-radius: 9999px; font-size: 0.625rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; white-space: nowrap; }
.mod-tag.is-premium { background-color: hsl(150 60% 40% / 0.16); color: hsl(150 60% 26%); }
.dark .mod-tag.is-premium { color: hsl(150 60% 70%); }
.mod-tag.is-cache { background-color: hsl(210 90% 50% / 0.14); color: hsl(214 80% 40%); }
.dark .mod-tag.is-cache { color: hsl(210 90% 72%); }
.mod-prices { display: grid; grid-template-columns: repeat(4, minmax(4.5rem, auto));
  gap: 0.25rem 0.75rem; text-align: right; }
.mod-price { display: grid; gap: 0.0625rem; }
.mod-price-label { font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: hsl(var(--muted-foreground)); }
.mod-price-value { font-family: var(--v7-font-mono, ui-monospace, monospace);
  font-size: 0.75rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mod-price-value.is-muted { color: hsl(var(--muted-foreground)); }
.mod-price-sub { font-size: 0.5625rem; line-height: 1.2; color: hsl(var(--muted-foreground)); }
@media (max-width: 640px) {
  .mod-row { grid-template-columns: minmax(0, 1fr); }
  .mod-prices { text-align: left; }
}
.cd-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  font-size: 0.75rem; color: hsl(var(--muted-foreground)); }
.cd-premium-note { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem;
  margin: 0 0 0.75rem; padding: 0.625rem 0.75rem; border-radius: 0.5rem;
  border: 1px solid hsl(150 60% 40% / 0.35); background-color: hsl(150 60% 40% / 0.08);
  font-size: 0.75rem; line-height: 1.45; }

/* Sortable column headers (Overview and, from admin.css, the console): the
   header itself is the control, so there is no "order" select beside the
   list. The arrow says the current direction. */
.tbl th.sortable { padding: 0; }
.tbl th.sortable > button { display: inline-flex; align-items: center; gap: 0.25rem;
  width: 100%; height: 2.25rem; padding: 0 0.75rem; text-align: inherit;
  font: inherit; letter-spacing: inherit; text-transform: inherit;
  color: inherit; white-space: nowrap; }
.tbl th.sortable.num > button { justify-content: flex-end; }
.tbl th.sortable > button:hover { color: hsl(var(--foreground)); }
.tbl th.sortable > button:focus-visible { outline: none;
  box-shadow: inset 0 0 0 2px hsl(var(--ring)); }
.tbl th[aria-sort] > button { color: hsl(var(--foreground)); }
.tbl th .sort-arrow { font-size: 0.625rem; opacity: 0.45; }
.tbl th[aria-sort="ascending"] .sort-arrow::after { content: "▲"; opacity: 1; }
.tbl th[aria-sort="descending"] .sort-arrow::after { content: "▼"; opacity: 1; }
.tbl th:not([aria-sort]) .sort-arrow::after { content: "↕"; }

/* ---------- the Support card ---------- */
/* The Messenger id and its Copy sit together; the blue button no longer
   presses against the edge with the id stranded on the left. */
.support-messenger { display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 0.75rem 1rem; padding: 1rem 1.25rem;
  border: 1px solid hsl(var(--border)); border-radius: 0.75rem;
  background-color: hsl(var(--muted) / 0.35); }
.support-handle { display: flex; min-width: 0; align-items: center; gap: 0.5rem; }
.support-handle code { font-family: var(--v7-font-mono, ui-monospace, monospace);
  font-size: 0.8125rem; overflow-wrap: anywhere; }
.support-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }

/* The banner's radio chips. These sizes apply to the Operating-system group
   only: the App cards below them are two-line buttons (icon + title +
   subtitle) and must keep their own larger padding. */
[data-connect-banner] [aria-label="Operating system"] { display: flex; flex-wrap: wrap; gap: 0.375rem; }
[data-connect-banner] [aria-label="Operating system"] [role="radio"] {
  display: inline-flex; align-items: center; height: 1.75rem;
  padding: 0 0.625rem; border: 1px solid hsl(var(--border)); border-radius: 0.375rem;
  background-color: hsl(var(--background)); font-size: 0.75rem; color: hsl(var(--muted-foreground)); }
[data-connect-banner] [aria-label="Operating system"] [role="radio"][aria-checked="true"] {
  border-color: hsl(var(--primary));
  background-color: hsl(var(--primary) / 0.1); color: hsl(var(--foreground)); }
[data-connect-banner] [aria-label="Operating system"] [role="radio"]:focus-visible {
  outline: none; box-shadow: 0 0 0 2px hsl(var(--ring)); }

/* The two App cards: big enough for an icon and two lines (title + subtitle).
   The generated utility CSS never shipped ``py-2.5``, so their padding was
   zero and the blocks read as tiny chips; these rules set the size directly. */
[data-connect-banner] [aria-label="App"] { display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; max-width: 36rem; }
[data-connect-banner] [aria-label="App"] [role="radio"] { display: flex; align-items: center;
  gap: 0.5rem; min-height: 3.25rem; padding: 0.5rem 0.75rem; text-align: left;
  border: 1px solid hsl(var(--border)); border-radius: 0.5rem;
  background-color: hsl(var(--background) / 0.65); color: hsl(var(--muted-foreground)); }
[data-connect-banner] [aria-label="App"] [role="radio"] > span:first-child {
  display: flex; align-items: center; justify-content: center; width: 2rem; height: 2rem;
  flex: none; border-radius: 0.375rem; background-color: hsl(var(--muted)); }
[data-connect-banner] [aria-label="App"] [role="radio"] > span:first-child svg { width: 1rem; height: 1rem; }
[data-connect-banner] [aria-label="App"] [role="radio"][aria-checked="true"] {
  border-color: hsl(var(--primary) / 0.5); background-color: hsl(var(--primary) / 0.1);
  color: hsl(var(--foreground)); box-shadow: 0 1px 2px hsl(0 0% 0% / 0.06); }
[data-connect-banner] [aria-label="App"] [role="radio"][aria-checked="true"] > span:first-child {
  background-color: hsl(var(--primary) / 0.15); color: hsl(var(--primary)); }
[data-connect-banner] [aria-label="App"] [role="radio"]:focus-visible {
  outline: none; box-shadow: 0 0 0 2px hsl(var(--ring)); }

/* The Connect view's two columns: the Clients card on the left and the key /
   code card beside it. The generated gap-4 utility is only 16px, and both
   cards already carry a border, so on a wide window they read as one slab.
   The gap is set here (panel.css loads after tw.css) so the columns stay
   visibly separate without depending on a responsive utility the build did
   not ship. */
[data-connect-grid] { gap: 1.25rem; }
@media (min-width: 768px) { [data-connect-grid] { gap: 2rem; } }

/* A window with no cap left in the plan: the amount is still real, the bar is not. */
.window-bar.is-hot { background-color: hsl(var(--destructive)); }
/* The per-limit rows under the top gauge fill yellow, with the remaining share
   in blue and the used share in yellow — matching the gauge's own reading. */
.window-bar.is-limit { background-color: hsl(38 92% 50%); }
.window-left { color: hsl(210 90% 46%); font-weight: 600; }
.dark .window-left { color: hsl(205 90% 70%); }
.window-used { color: hsl(38 92% 42%); font-weight: 600; }
.dark .window-used { color: hsl(38 92% 64%); }

/* Request-history controls (Overview). Small, quiet selects that sit beside the
   table heading and never wrap the table on a narrow screen. */
.cd-select {
  height: 1.75rem;
  max-width: 11rem;
  border-radius: 0.375rem;
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--background));
  color: inherit;
  font-family: inherit;
  font-size: 0.6875rem;
  line-height: 1rem;
  padding: 0 1.25rem 0 0.4rem;
  /* Native OS chrome (a bevel and the system arrow) reads as a Windows
     control next to the themed table, so it is reset and the arrow redrawn. */
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M2 4l4 4 4-4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.35rem center;
  cursor: pointer;
}
.cd-select:focus-visible { outline: none; box-shadow: 0 0 0 2px hsl(var(--ring)); }
/* The filter row around those selects ships gap-1.5; a row of four controls
   then reads as one glued strip. */
[data-history-bar] { gap: 0.5rem; }

/* ---------- the latency chip (next to the Base URL) ----------
   First-byte time of this account's latest requests, drawn only when the usage
   list has a measured row. The dot carries the threshold: fast, ok, slow. The
   number itself is text, so it stays readable without colour. */
.cd-latency { display: inline-flex; flex: none; align-items: center; gap: 0.375rem;
  height: 1.5rem; padding: 0 0.5rem; border: 1px solid hsl(var(--border));
  border-radius: 9999px; background-color: hsl(var(--background));
  font-size: 0.6875rem; line-height: 1rem; color: hsl(var(--muted-foreground));
  white-space: nowrap; cursor: help; }
[data-latency-chip][hidden] { display: none; }
.cd-latency-dot { width: 0.5rem; height: 0.5rem; flex: none; border-radius: 9999px;
  background-color: #9ca3af; }
[data-latency-tone="fast"] .cd-latency-dot { background-color: #10b981; }
[data-latency-tone="ok"] .cd-latency-dot { background-color: #f59e0b; }
[data-latency-tone="slow"] .cd-latency-dot { background-color: #f43f5e; }

/* Operator copy from admin → Settings → Connect guide. The banner sits above
   the whole guide; the per-client note follows that card's intro paragraph. */
.cd-connect-banner { margin-bottom: 0.75rem; border: 1px solid hsl(var(--border));
  border-radius: 0.5rem; padding: 0.625rem 0.75rem; font-size: 0.8125rem; line-height: 1.55;
  background-color: hsl(var(--muted)); color: hsl(var(--foreground)); }
.cd-connect-note { margin-top: 0.375rem; font-size: 0.8125rem; line-height: 1.55;
  color: hsl(var(--muted-foreground)); }
/* A client hidden by the operator stays hidden even if it is the current pick. */
[data-cd-off] { display: none !important; }
