@charset "utf-8";

/* Application layouts and shared chrome. */

:root {
  --bg: #0b0a0c;
  --surface: #141317;
  --panel: #141317;
  --card: #141317;
  --chip: #17161b;
  --chip-hover: #211f26;
  --ink: #f3f3f5;
  --mut: #9096a0;
  --muted: #9096a0;
  --faint: #7f848d;
  --line: #1e1d22;
  --line-2: #17161b;
  --line-soft: #17161b;
  --pri: #ff7a2f;
  --pri-strong: #ff8f4f;
  --pri-soft: #2a1508;
  --pri-line: #3a2114;
  --good: #3fbb82;
  --teal: #3fbb82;
  --teal-soft: #11241b;
  --warn: #e0a458;
  --warn-soft: #2a1f10;
  --bad: #ff6b63;
  --bad-soft: #2a0d0c;
  --r-s: 2px;
  --r-m: 4px;
  --r-l: 4px;
  --sh-s: none;
  --sh-m: none;
  --sh-l: none;
  --font: Manrope, Figtree, 'Helvetica Neue', Helvetica, Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --sans: var(--font);
  --mono: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --head-h: 57px;
  color-scheme: dark;
}

[hidden] { display: none !important; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 200; padding: 10px 16px; background: var(--ink); color: var(--bg); transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.site-header { position: sticky; top: 0; z-index: 80; background: rgba(11, 10, 12, .85); border-bottom: 1px solid rgba(255, 255, 255, .06); }
.site-header.scrolled { box-shadow: none; }
.site-header > .wrap { display: flex; align-items: center; gap: 18px; height: 57px; max-width: none; padding: 0 clamp(16px, 2.2vw, 28px); }
.site-header .logo { display: inline-flex; align-items: center; gap: 9px; white-space: nowrap; font: 400 19px/1 var(--font); letter-spacing: -.03em; }
.site-header .logo .mark-svg { width: 26px; height: 26px; flex: none; }
.site-header .nav { position: static; display: flex; align-items: center; gap: 8px; margin-left: auto; }
.site-header .nav a { padding: 7px 12px; font: 400 14px/1.4 var(--font); white-space: nowrap; }
.site-header .nav a.cta { padding: 10px 16px; border-radius: 0; background: #fff; color: #0d0c0f; font: 500 13px/1 var(--font); clip-path: polygon(5px 0,calc(100% - 5px) 0,100% 5px,100% calc(100% - 5px),calc(100% - 5px) 100%,5px 100%,0 calc(100% - 5px),0 5px); }
.site-header .nav a.cta:hover { background: #e9ebef; color: #0d0c0f; }
.site-header .burger { display: none; }
@media (max-width: 860px) {
  .site-header .burger { display: grid; place-items: center; position: static; margin-left: auto; width: 36px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--ink); cursor: pointer; }
  .site-header .burger span { display: block; height: auto; background: none; font: 400 20px/1 var(--font); }
  .site-header .nav { display: none; position: absolute; top: 57px; left: 0; right: 0; padding: 12px 16px 18px; background: #141317; border-bottom: 1px solid var(--line); }
  body.nav-open .site-header .nav { display: flex; flex-direction: column; align-items: stretch; }
  .site-header .nav a.secondary { display: block; }
  .site-header .nav a.cta { margin: 5px 0 0; text-align: center; }
}
.rv { opacity: 0; transform: translateY(10px); }
.rv.in { opacity: 1; transform: none; }
/* body-prefixed so the reveal transition wins over the page <style> blocks
   (equal class specificity, later in the document). Their border/box-shadow
   timings are preserved so hover feel is unchanged. */
body .rv.in {
  transition: opacity .4s ease, transform .45s cubic-bezier(.2, .7, .2, 1),
              border-color .15s ease, box-shadow .15s ease;
}
/* polish.js only adds .rv when it can also observe + reveal, so no-JS
   and reduced-motion users always get fully visible content. */
.mg .scroller { position: relative; max-width: 100%; overflow-x: auto; }
.mg .statement > h1 { font-size: 38px; }
.mg .pricing-prose { max-width: 920px; margin-inline: auto; }
.mg .pricing-prose .statement { padding-top: 10px; }
.mg .pricing-prose .statement > h1 { font-size: clamp(32px, 3vw, 43.2px); }
.mg .mcard-lab img { width: 76px; height: 76px; display: block; filter: drop-shadow(0 2px 10px rgba(0,0,0,.6)); }
.mg .mrow-lab img { width: 20px; height: 20px; display: block; }

/* Public catalog/pricing metadata: the inline page styles pin several
   identifiers/hints to #6e737b, which fails comfortable reading contrast.
   Lift them one step and let long model ids wrap at word boundaries
   (overflow-wrap breaks only when needed, so codes stay intact). */
.mg .mcard .mcard-meta,
.mg .mcard .mcard-cache,
.mg .mcard .mcard-name,
.mg .mcard .mcard-hint,
.mg .mrow .mrow-id { color: #8b909b; }
.mg .mcard .mcard-name { word-break: normal; overflow-wrap: anywhere; }
/* Hover detail stays in the lava-orange family instead of neutral grey. */
.mg .mcards .mcard:hover { border-color: rgba(255, 122, 47, .42); }
.mg .mcards .mcard:focus-within { border-color: rgba(255, 122, 47, .42); }

/* App surfaces use a separate palette from marketing pages. */
body.chat-body,
body.docs,
body.dashboard {
  --bg: #222125;
  --surface: #2b2a2e;
  --panel: #2b2a2e;
  --card: #2b2a2e;
  --chip: #302e34;
  --chip-hover: #3a383e;
  --line: #38363c;
  --line-2: #2e2c32;
  --line-soft: #2e2c32;
  background: var(--bg);
  color: var(--ink);
}

body.chat-body {
  --sb-bg: #1a191c;
  --sb-edge: #2e2c32;
  --sb-hover: #302e34;
  --sb-ink: #f3f3f5;
  --main-bg: #222125;
}

html:has(.account-shell),
html:has(.docs-page) { background: #222125; }
html.in-app { background: #222125; }
::selection { background: rgba(255, 122, 47, .28); color: #fff; }

/* Search boxes are not part of this build; the header one stays hidden. */
.hsearch, .site-search, .docs-search { display: none !important; }

/* ---------- account shell ------------------------------------------------- */

/* Account colors stay scoped to signed-in pages (dashboard domain only). */
body.dashboard {
  --bg: #222125;
  --side: #1a191c;
  --surface: #2b2a2e;
  --panel: #2b2a2e;
  --card: #2b2a2e;
  --chip: #333236;
  --chip-hover: #3a383e;
  --input: #131216;
  --line: #38363c;
  --line-2: #2e2c32;
  --line-soft: #2e2c32;
  --ink: #f3f3f5;
  --mut: #9096a0;
  --muted: #9096a0;
  --faint: #7f848d;
  --rail-ink: #d9d8dc;
  --rail-hover: #232227;
  --rail-active: #2a292d;
  background: var(--bg);
  color: var(--ink);
}

.account-shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100vh;
  align-items: stretch;
  background: var(--bg);
  color: var(--ink);
}
.account-shell > .dash-rail { grid-row: 1; grid-column: 1; }
.account-shell > .account-main { grid-row: 1; grid-column: 2; }

/* Keep navigation reachable until JavaScript initializes the drawer. */
.account-shell .account-menu,
.account-mobile-bar,
.account-shell > .account-scrim { display: none; }
.orders-empty span { display: block; margin-bottom: 12px; }
.orders-empty { padding: 28px 16px !important; text-align: center !important; }

.dash-rail {
  position: sticky;
  top: 0;
  box-sizing: border-box;
  width: 272px;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px 16px;
  background: var(--side);
  z-index: 40;
}

.rail-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px 18px;
  color: var(--ink);
  font: 500 16.5px/1.2 var(--font);
  letter-spacing: -.02em;
  text-decoration: none;
}
.rail-brand .mark-svg,
.rail-brand svg { flex: none; width: 26px; height: 26px; }
.rail-brand:hover { color: #fff; text-decoration: none; }

.rail-close {
  display: none;
  position: absolute;
  top: 14px;
  right: 12px;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: 400 18px/1 var(--font);
  cursor: pointer;
}
.rail-close:hover { background: var(--rail-active); color: var(--ink); }

.rail-label {
  padding: 14px 10px 6px;
  color: var(--faint);
  font: 400 11.5px/1.4 var(--font);
  letter-spacing: .05em;
}

.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.rail-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--rail-ink);
  font: 400 14.5px/1.4 var(--font);
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.rail-nav a svg {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.rail-nav a:hover { background: var(--rail-hover); color: #fff; text-decoration: none; }
.rail-nav a[aria-current="page"] { background: var(--rail-active); color: #fff; }
.rail-secondary a { font-size: 14px; }

/* Rail foot: slim toggle + popover, no big border or avatar card. */
.rail-foot {
  position: relative;
  margin-top: auto;
  padding: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rail-foot a { color: var(--faint); font-size: 12.5px; text-decoration: none; }
.rail-foot a:hover { color: var(--ink); text-decoration: none; }
.rail-foot a[data-logout],
.rail-foot .rail-logout { color: var(--muted); font-weight: 500; }

.rail-account-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--rail-ink);
  font: 400 14px/1.4 var(--font);
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.rail-account-toggle:hover,
.rail-account-toggle[aria-expanded="true"] { background: var(--rail-hover); color: #fff; }

.rail-avatar {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--chip);
  color: var(--ink);
  font: 600 10.5px/1 var(--mono);
}
.rail-email {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
  font-size: 13px;
}

.rail-account-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .42);
}
.rail-account-menu a {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--rail-ink);
  font-size: 13.5px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rail-account-menu a:hover { background: var(--chip); color: #fff; text-decoration: none; }
/* No-JS fallback: the account links stay reachable as a plain inline list. */
body:not(.account-nav) .rail-account-menu[hidden] {
  display: flex !important;
  position: static;
  padding: 2px 0 0 24px;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
body:not(.account-nav) .rail-account-menu[hidden] a { color: var(--faint); font-size: 13px; }

/* Legacy rail identity (old markup during transition). */
.rail-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 2px 2px 8px;
}
.rail-identity .rail-avatar { width: 26px; height: 26px; border-radius: 50%; font-size: 11px; }

.account-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0;
  background: var(--bg);
  font-size: 14px;
  line-height: 1.55;
}
.account-main :where(section) { padding: 0; border: 0; }

.account-topbar {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex: none;
  height: 64px;
  padding: 0 clamp(20px, 3vw, 40px);
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg);
}
.account-topbar .crumb,
.account-topbar .breadcrumb,
.account-topbar .account-crumb,
.account-topbar .topbar-crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--faint);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-topbar .crumb a,
.account-topbar .breadcrumb a,
.account-topbar .account-crumb a,
.account-topbar .topbar-crumb a { color: var(--mut); text-decoration: none; }
.account-topbar .crumb a:hover,
.account-topbar .breadcrumb a:hover,
.account-topbar .account-crumb a:hover,
.account-topbar .topbar-crumb a:hover { color: var(--ink); }
.account-topbar .topbar-links,
.account-topbar .topbar-actions,
.account-topbar > nav:last-child {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex: none;
}
.account-topbar .topbar-links a,
.account-topbar .topbar-actions a,
.account-topbar > nav:last-child a {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 11px;
  border-radius: 6px;
  color: var(--mut);
  font-size: 12.5px;
  text-decoration: none;
}
.account-topbar .topbar-links a:hover,
.account-topbar .topbar-actions a:hover,
.account-topbar > nav:last-child a:hover { background: var(--chip); color: var(--ink); }

.account-content {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 40px 4vw 80px;
  min-width: 0;
}
.account-content > section + section { margin-top: 40px; }

.account-content a:not(.btn):not(.integration-card) {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(243, 243, 245, .22);
}
.account-content a:not(.btn):not(.integration-card):hover {
  color: var(--ink);
  text-decoration-color: rgba(243, 243, 245, .55);
}

/* ---------- headings ------------------------------------------------------ */

.account-title,
.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: nowrap;
  margin: 0 0 28px;
}
.account-title > div,
.page-heading > div { flex: 1 1 auto; min-width: 0; }
.account-title > .btn,
.account-title > a.btn,
.page-heading > .btn,
.page-heading > a.btn { flex: none; margin-top: 2px; }
.account-title h1,
.page-heading h1 {
  margin: 0;
  color: var(--ink);
  font: 400 24px/1.55 var(--font);
  letter-spacing: -.01em;
}
.account-title p,
.page-heading p {
  margin: 6px 0 0;
  color: var(--mut);
  font-size: 14px;
  line-height: 1.55;
  max-width: 70ch;
}
.account-title .kicker,
.page-heading .kicker {
  margin-bottom: 8px;
  color: var(--faint);
  font: 500 11.5px/1.4 var(--mono);
  letter-spacing: .07em;
}
.dashboard-head { display: block; margin-bottom: 0; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 0; }

/* ---------- buttons ------------------------------------------------------- */

.account-shell .btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #333236;
  color: var(--ink);
  font: 500 14px/1 var(--font);
  box-shadow: none;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease, filter .15s ease, transform .12s ease;
}
@media (prefers-reduced-motion: no-preference) {
  .account-shell .btn:not(:disabled):active { transform: translateY(1px); }
}
.account-shell .btn:hover {
  background: #3a383e;
  border-color: transparent;
  color: #fff;
  text-decoration: none;
}
.account-shell .btn.primary {
  background: linear-gradient(96deg, #d81f00, #f2610a);
  border-color: transparent;
  color: #fff;
  font-weight: 500;
}
.account-shell .btn.primary:hover { background: linear-gradient(96deg, #d81f00, #f2610a); filter: brightness(1.07); color: #fff; }
.account-shell .btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.account-shell .btn.ghost:hover { background: #333236; border-color: transparent; color: var(--ink); }
.account-shell .btn.danger { background: transparent; border-color: transparent; color: var(--bad); }
.account-shell .btn.danger:hover { background: var(--bad-soft); }
.account-shell .btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.account-shell .btn:disabled { opacity: .5; cursor: default; }
.account-shell .btn:focus-visible,
.account-shell a:focus-visible,
.account-shell input:focus-visible,
.account-shell select:focus-visible,
.account-shell button:focus-visible { outline: 2px solid rgba(242, 97, 10, .6); outline-offset: 2px; }

/* Integration cards share the copy hook but retain their card layout. */
.account-main .copy:not(.integration-card),
.account-main .mcard-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: 500 12px/1.2 var(--font);
  cursor: pointer;
}
.account-main .copy:not(.integration-card):hover,
.account-main .mcard-copy:hover { border-color: #4a4850; background: var(--chip); color: var(--ink); }
.account-main .copy.done:not(.integration-card) { border-color: rgba(63, 187, 130, .35); color: #74cfa2; }

/* ---------- cards / metrics ---------------------------------------------- */

.account-main .card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  box-shadow: none;
  color: var(--ink);
  padding: clamp(18px, 2.2vw, 28px);
}
.account-main .empty-state { background: var(--input); }
.account-main .card p { margin: 0; color: var(--mut); font-size: 14px; line-height: 1.55; }
.account-main h2,
.account-main .card-head h2 { margin: 0 0 8px; color: var(--ink); font: 400 21px/1.45 var(--font); letter-spacing: -.01em; }
.account-main h3 { margin: 0 0 6px; color: var(--ink); font: 500 14px/1.4 var(--font); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }

.metric-grid { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card.metric { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; }
.card.metric > span { color: var(--muted); font: 400 12.5px/1.4 var(--font); }
.card.metric > b,
.card.metric > b.good,
.card.metric > b.bad,
.card.metric .good,
.card.metric .bad {
  color: var(--ink);
  font: 400 24px/1.2 var(--font);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.account-main .good { color: var(--good); }
.account-main .bad { color: var(--bad); }
.account-main .muted,
.account-main .faint { color: var(--faint); }
.card.metric > small {
  color: var(--faint);
  font: 400 11.5px/1.4 var(--font);
  font-variant-numeric: tabular-nums;
}
.range-switch {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  margin-left: auto;
}
.range-switch .range-opt {
  padding: 4px 12px;
  border-radius: 999px;
  color: var(--muted);
  font: 500 12px/1 var(--font);
  text-decoration: none;
}
.range-switch .range-opt:hover { color: var(--ink); text-decoration: none; }
.range-switch .range-opt.active {
  background: var(--ink);
  color: var(--bg);
}
.chart-panel .card-head .range-switch { margin-left: auto; margin-right: 12px; }
@media (max-width: 640px) {
  .chart-panel .card-head { flex-wrap: wrap; row-gap: 10px; }
  .chart-panel .card-head .range-switch { margin-left: 0; }
}

.dashboard-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  margin-top: 20px;
}
.billing-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.account-activity { display: grid; gap: 16px; }
.account-activity .activity-summary .section-heading { margin: 0 0 20px; }
.account-activity .activity-summary .metric { padding: 0; background: transparent; }
.account-content > *, .billing-page > *, .order-page > * { min-width: 0; }
.billing-page > .page-heading, .order-page > .page-heading { margin-bottom: 0; }
.billing-page .orders-secondary { margin-top: 0; }
.billing-page .orders-secondary .section-heading { margin-top: 4px; }

/* ---------- usage chart --------------------------------------------------- */

.usage-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 150px;
  padding: 0;
  border-bottom: 1px solid var(--line);
}
.usage-bar { flex: 1; min-width: 2px; display: flex; align-items: flex-end; }
.usage-bar i { display: block; width: 100%; border-radius: 0; background: var(--pri) !important; }
.usage-bar i[style*="d9deea"] { background: var(--line-soft) !important; }
.usage-axis { display: flex; justify-content: space-between; margin-top: 10px; color: var(--faint); font-size: 11.5px; }

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--input);
  padding: 30px 22px;
  text-align: center;
  color: var(--mut);
}
.empty-state h2, .empty-state h3 { color: var(--ink); margin-bottom: 6px; }
.empty-state p { margin: 0 auto; max-width: 460px; font-size: 14px; line-height: 1.55; }
.empty-state .btn { margin-top: 16px; }
.chart-panel .empty-state { min-height: 150px; display: grid; align-content: center; gap: 10px; }

/* ---------- get started --------------------------------------------------- */

.get-started { display: block; max-width: none; }
.get-started .account-title { margin-bottom: 24px; }
.get-started .account-title h1 { font: 400 24px/1.55 var(--font); letter-spacing: -.01em; }
.get-started .account-title p { max-width: 70ch; font-size: 14px; line-height: 1.55; }

/* Start page: the panel itself is flat; the key rows carry the card surface. */
.setup-panel { padding: 0; }
.account-main .setup-panel { background: none; border: 0; border-radius: 0; padding: 0; color: var(--ink); }
/* Legacy order/billing side panels keep the card surface. */
.account-main .card.setup-panel { background: var(--surface); border-radius: 12px; padding: clamp(18px, 2.2vw, 28px); }
.setup-panel code {
  background: var(--chip);
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  padding: 1px 6px;
  font-size: .92em;
}
.setup-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
}
.setup-heading h2,
.setup-heading h3 { margin: 0; font: 400 21px/1.4 var(--font); }
.setup-heading .step,
.setup-heading .step-marker,
.setup-heading .step-no,
.setup-heading .setup-step {
  flex: none;
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--chip);
  color: var(--muted);
  font: 500 11px/1 var(--mono);
}

.setup-key-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  max-width: 680px;
  margin-top: 8px;
}
.setup-key {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
  margin: 0;
  padding: 12px 14px;
  background: var(--surface);
  border: 0;
  border-radius: 10px;
}
.account-main .setup-key > label { flex-basis: 100%; margin: 0; color: var(--muted); font-size: 12px; font-weight: 400; }
.setup-key .endpoint-line { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; }
.setup-key code,
.endpoint-value {
  flex: 1 1 140px;
  min-width: 0;
  color: var(--ink);
  font: 400 12.5px/1.55 var(--mono);
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}
.endpoint-value { display: block; flex: 1 1 160px; min-width: 0; }
.setup-key .copy:not(.integration-card) { flex: none; }
.setup-key .btn { height: 32px; padding: 0 12px; font-size: 12.5px; }
.account-main .setup-key code { background: transparent; border: 0; padding: 0; }
.setup-heading .setup-heading-action { margin-left: auto; flex: none; }
.setup-note,
.setup-help,
.mgd-key-note,
.account-main .card .setup-note,
.account-main .card .setup-help,
.account-main .card .mgd-key-note {
  margin: 10px 0 0;
  color: var(--faint);
  font-size: 13px;
  line-height: 1.55;
}
.all-keys-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 400;
}

.integration-section { margin-top: 40px; }
.integration-section h2 { margin: 0 0 8px; font: 400 21px/1.45 var(--font); }
.integration-section > p {
  margin: 0 0 16px;
  color: var(--mut);
  font-size: 14px;
  line-height: 1.55;
  max-width: 80ch;
}
.integration-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 0;
}
.integration-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 68px;
  padding: 14px 16px 14px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: none;
  transition: background .15s ease;
}
.integration-card:hover { background: #333236; }
.integration-card:focus-visible { outline: 2px solid rgba(242, 97, 10, .6); outline-offset: 2px; }
.integration-icon {
  flex: none;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #d9d8dc;
  font: 600 12px/1 var(--mono);
}
.integration-icon svg { display: block; width: 20px; height: 20px; }
.integration-card-copy {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.integration-card strong { display: block; color: var(--ink); font: 400 15px/1.35 var(--font); }
.integration-card small { display: block; color: var(--mut); font-size: 12px; line-height: 1.45; }
.integration-card .copy-label {
  margin-left: auto;
  align-self: center;
  flex: none;
  min-width: 48px;
  text-align: right;
  color: var(--muted);
  font: 500 12px/1.2 var(--font);
  white-space: nowrap;
}
.integration-card:hover .copy-label { color: var(--ink); }
.integration-copy { margin-left: auto; align-self: center; color: var(--faint); font-size: 14px; }

.dash-overview,
.secondary-overview { max-width: none; margin-top: 32px; }
.dash-overview .dashboard-grid,
.secondary-overview .dashboard-grid { margin-top: 20px; }
.dash-overview > .card-head { margin-top: 28px; }
.dash-overview > .chart-panel, .dash-overview > .recent-panel { margin-top: 20px; }
.account-main .recent-panel .tablewrap { border: 0; border-radius: 0; margin: 0; }
/* Tables that live inside a card run transparent with internal hairlines only. */
.account-main .card .tablewrap { border: 0; border-radius: 0; background: transparent; }

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 12px;
}
.section-heading h2 {
  margin: 0;
  color: var(--ink);
  font: 400 21px/1.45 var(--font);
  letter-spacing: -.01em;
}
.section-heading .btn { height: 32px; }

.account-main details.activity-extra { margin: 0; padding: 0; overflow: hidden; }
.account-main details.activity-extra summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin: 0;
  padding: 0 clamp(18px, 2.2vw, 28px);
  color: var(--ink);
  font: 400 15px/1.3 var(--font);
  cursor: pointer;
  list-style: none;
}
.account-main details.activity-extra summary::-webkit-details-marker { display: none; }
.account-main details.activity-extra summary::after { content: "+"; margin-left: auto; color: var(--faint); font-size: 18px; }
.account-main details.activity-extra[open] summary::after { content: "−"; }
.account-main details.activity-extra[open] summary { border-bottom: 1px solid var(--line-soft); }
.account-main details.activity-extra .tablewrap { border: 0; border-radius: 0; background: transparent; }
.account-main details.activity-extra .tablewrap table { min-width: 640px; }

/* ---------- tables / toolbars -------------------------------------------- */

.section-toolbar,
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}
.section-toolbar .toolbar-count,
.toolbar-count,
.toolbar-meta,
.filter-result { color: var(--faint); font-size: 12.5px; }
.filter-result:empty { display: none; }
.account-main .filter-result { margin: 0 0 14px; }
.account-main .section-toolbar .filter-bar { margin: 0; justify-content: flex-start; align-items: flex-end; }
.account-main .section-toolbar label { margin-top: 0; }
.account-main .table-footer { display: flex; justify-content: space-between; gap: 12px; padding: 14px 0 0; color: var(--faint); font-size: 12px; }
.account-main .pager { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 16px; font-size: 12px; }
.account-main .section-toolbar input,
.account-main .filter-bar input,
.account-main .filter-bar select {
  width: min(280px, 100%);
  height: 41px;
  min-width: 0;
  padding: 0 12px;
  font-size: 13.5px;
}
.filter-bar .btn { padding: 0 14px; }

.account-main .tablewrap {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: none;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.account-main table { width: 100%; border-collapse: collapse; color: var(--ink); font-size: 13.5px; }
.account-main .tablewrap table { min-width: 760px; }
.account-main thead th {
  height: 42px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: 400 12.5px/1.3 var(--font);
  letter-spacing: .01em;
  text-align: left;
  text-transform: none;
  white-space: nowrap;
}
.account-main tbody td {
  height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
  font-size: 13.5px;
  vertical-align: middle;
  text-align: left;
  white-space: nowrap;
}
.account-main tbody tr:last-child td { border-bottom: 0; }
.account-main tbody tr:hover { background: rgba(255, 255, 255, .045); }
.account-main tbody tr:hover td { background: transparent; }
.account-main tbody td.muted,
.account-main tbody td.faint { color: var(--faint); }

.account-main table td.num {
  display: table-cell;
  width: auto;
  height: auto;
  min-width: 0;
  margin: 0;
  padding: 0 16px;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.account-main table th.num {
  display: table-cell;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 0 16px;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font: 400 12.5px/1.3 var(--font);
  text-align: right;
  white-space: nowrap;
}
.account-main td.key-action { display: table-cell; white-space: nowrap; }
.account-main td.key-action .key-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}
.account-main td.key-action form { display: inline-flex; align-items: center; margin: 0; }
.account-main td.key-action .btn { height: 28px; padding: 0 10px; font-size: 12px; }

.keys-page { max-width: none; }
.keys-table { margin-top: 0; }
.keys-empty { padding: 26px 10px; color: var(--faint); text-align: center; }
.key-prefix { color: var(--muted); }
/* The create form sits above the table. */
.key-create-card { margin: 0 0 20px; }
.key-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}
.key-create > details.key-limits { grid-column: 1 / -1; grid-row: 2; }
.key-create label { margin: 0 0 6px; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.key-create button { grid-column: 2; grid-row: 1; justify-self: start; height: 41px; margin: 0; }
.account-main details.key-limits summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font: 400 13px/1.3 var(--font);
  cursor: pointer;
  list-style: none;
}
.account-main details.key-limits summary::-webkit-details-marker { display: none; }
.account-main details.key-limits summary::after { content: "+"; margin-left: auto; color: var(--faint); font-size: 16px; }
.account-main details.key-limits[open] summary::after { content: "−"; }
.account-main details.key-limits[open] summary { margin-bottom: 10px; color: var(--ink); }
.field-note { margin-top: 6px; color: var(--faint); font-size: 12px; line-height: 1.5; }
.key-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.keyout { margin-top: 14px; }
.key-msg { margin-top: 10px; font-size: 13.5px; }

.orders-secondary { margin-top: 26px; }
.mcard-meta.num { text-align: left; line-height: 1.8; }
.mcard-foot { flex-wrap: wrap; }

/* ---------- status badges / notices -------------------------------------- */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(240, 239, 243, .06);
  color: var(--mut);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.status-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--faint); }
.status-badge.paid, .status-badge.good { background: rgba(63, 187, 130, .1); border-color: rgba(63, 187, 130, .22); color: #74cfa2; }
.status-badge.paid::before, .status-badge.good::before { background: #74cfa2; }
.status-badge.pending, .status-badge.warn { background: rgba(224, 164, 88, .1); border-color: rgba(224, 164, 88, .22); color: #d8b07a; }
.status-badge.pending::before, .status-badge.warn::before { background: #d8b07a; }
.status-badge.expired, .status-badge.bad { background: rgba(255, 107, 99, .1); border-color: rgba(255, 107, 99, .22); color: #ff9a94; }
.status-badge.expired::before, .status-badge.bad::before { background: #ff9a94; }
.status-badge.muted { color: var(--faint); }

.notice {
  margin: 0 0 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--pri);
  border-radius: 8px;
  background: var(--surface);
  color: var(--mut);
  font-size: 13.5px;
}
.notice.error, .error.notice {
  border-color: rgba(255, 107, 99, .32);
  border-left-color: var(--bad);
  background: var(--bad-soft);
  color: #ff9a94;
}

/* ---------- forms --------------------------------------------------------- */

.account-main label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.account-main label:first-child { margin-top: 0; }
.account-main input,
.account-main select,
.account-main textarea {
  width: 100%;
  height: 41px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input);
  color: var(--ink);
  font: 400 14px var(--font);
  box-shadow: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.account-main textarea { height: auto; min-height: 96px; padding: 10px 12px; }
.account-main input::placeholder, .account-main textarea::placeholder { color: var(--faint); }
/* Checkboxes and radios are hit targets, not text fields: they must not
   inherit the full-width 41px text-input box. */
.account-main input[type="checkbox"],
.account-main input[type="radio"] {
  width: 16px;
  height: 16px;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  flex: none;
  border-radius: 3px;
  accent-color: var(--pri);
}
.account-main input:focus,
.account-main select:focus,
.account-main textarea:focus {
  outline: 0;
  border-color: rgba(242, 97, 10, .65);
  background: var(--input);
  box-shadow: 0 0 0 3px rgba(242, 97, 10, .14);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--chip);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}
.chip:hover { background: var(--chip-hover); color: #fff; }
.chip.active, .chip[aria-pressed="true"] { background: #3a383e; color: #fff; }

.keybox {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 100%;
  padding: 14px 16px;
  background: var(--input);
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  overflow-wrap: anywhere;
  word-break: break-all;
}
.keybox code { min-width: 0; overflow-wrap: anywhere; word-break: break-all; }

.payment-qr { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 14px 0 4px; }
.payment-qr .qr-frame { padding: 10px; background: #ffffff; border-radius: 12px; line-height: 0; box-shadow: 0 0 0 1px var(--line); }
.payment-qr .qr-frame svg { display: block; }
.payment-qr .qr-hint { font-size: 12px; color: var(--muted, #b9a99e); }

/* ---------- billing / orders --------------------------------------------- */

.promotion-banner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, .4fr); gap: 24px; padding: 24px; border: 1px solid #68432c; border-radius: 10px; background: linear-gradient(110deg, #30251f, #29262a); }
.promotion-tag { color: #ffab70; font-size: 11px; letter-spacing: .08em; }
.promotion-banner h2 { margin: 10px 0 !important; font-size: 22px !important; }
.promotion-banner p { margin: 8px 0 0; color: #d1c4ba; font-size: 13px; line-height: 1.65; }
.promotion-banner .promotion-rule { color: #b9a99e; font-size: 12px; }
.promotion-estimate { display: flex; flex-direction: column; gap: 8px; border-left: 1px solid #624737; padding-left: 24px; color: #d1c4ba; font-size: 12px; }
.promotion-estimate > strong { color: #ffad73; font: 400 34px/1.1 var(--font); font-variant-numeric: tabular-nums; }
.promotion-estimate small { line-height: 1.6; color: #b9a99e; }
.promotion-order { margin: 0; padding: 18px 20px; border: 1px solid #59412f; border-radius: 8px; background: #2b2420; }
.promotion-order p { margin: 8px 0 0; color: var(--mut); font-size: 13px; }
.promotion-order .promotion-amounts { display: flex; flex-wrap: wrap; gap: 16px; color: #ffad73; font-size: 14px; }
@media (max-width: 640px) { .promotion-banner { grid-template-columns: minmax(0, 1fr); padding: 18px; gap: 18px; } .promotion-estimate { border-left: 0; border-top: 1px solid #624737; padding: 16px 0 0; } }
/* Balance card: horizontal info + action. */
.billing-balance {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(18px, 2.2vw, 28px);
}
.billing-balance .balance-main { display: grid; gap: 6px; margin: 0; }
.billing-balance span { display: block; color: var(--muted); font: 400 13px/1.4 var(--font); }
.billing-balance strong,
.billing-balance strong.good,
.billing-balance strong.bad {
  display: block;
  margin-top: 0;
  color: var(--ink);
  font: 400 36px/1.1 var(--font);
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.billing-balance .balance-sub { margin: 0; max-width: 34ch; color: var(--mut); font-size: 13px; line-height: 1.55; }
.billing-balance .btn { flex: none; }

/* Top-up lives in a native details panel; the summary stays operable without JS. */
.topup-panel { margin-top: 0; }
.topup-panel > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0;
  color: var(--ink);
  font: 400 21px/1.45 var(--font);
  letter-spacing: -.01em;
  cursor: pointer;
  list-style: none;
}
.topup-panel > summary::-webkit-details-marker { display: none; }
.topup-panel > summary h2 { margin: 0; font: inherit; color: inherit; }
.topup-panel > summary::after { content: "+"; margin-left: auto; color: var(--faint); font-size: 22px; }
.topup-panel[open] > summary::after { content: "−"; }
.topup-panel > .topup-card { margin-top: 14px; }
.topup-card,
.topup-form,
.topup-rules,
.topup-copy { margin-top: 0; }
.account-main .topup-card .topup-rules,
.account-main .topup-card .topup-copy { margin-top: 12px; color: var(--faint); font-size: 13px; line-height: 1.6; }
.topup-card form { margin: 0; }
.topup-card label { margin: 0 0 6px; }

.payment-unavailable {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--input);
  color: var(--mut);
}
.payment-unavailable:not(:has(svg)):not(:has(.icon))::before {
  content: "i";
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--chip);
  color: var(--mut);
  font: 600 12px/1 var(--mono);
}
.payment-unavailable svg,
.payment-unavailable .icon { flex: none; width: 22px; height: 22px; color: var(--mut); }
.payment-unavailable > div { min-width: 0; }
.payment-unavailable strong,
.payment-unavailable h2,
.payment-unavailable h3 { display: block; margin: 0 0 4px; color: var(--ink); font: 500 14px/1.4 var(--font); }
.account-main .payment-unavailable p { margin: 0; color: var(--faint); font-size: 13px; line-height: 1.6; }

.billing-notes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.billing-notes li,
.billing-notes .billing-note {
  margin: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--mut);
  font-size: 13px;
  line-height: 1.6;
}
.billing-notes li strong { display: block; margin-bottom: 4px; color: var(--ink); font-weight: 500; }
.billing-note .note-no { display: block; margin-bottom: 10px; color: var(--faint); font: 12px var(--mono); }
.billing-note p { margin: 0; }
.account-main .topup-card .field-note { margin-bottom: 18px; }
.account-main .topup-form > label { margin-top: 18px; }
.account-main .topup-form > label:first-child { margin-top: 0; }
.account-main .topup-form > .muted { margin-top: 8px; font-size: 12px; }
.account-main .topup-form > .btn { margin-top: 18px; width: 100%; }
.billing-recent, .billing-orders { margin-top: 0; }

.order-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; max-width: 1000px; }
.order-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr);
  gap: 16px;
  align-items: start;
}
.payment-amount {
  color: var(--ink);
  font: 400 36px/1.1 var(--font);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.terminal-card {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--input);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.terminal-card code,
.terminal-card pre { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-all; }

.key-created-page { max-width: 760px; }
.key-created-page .card,
.key-created-card { max-width: 760px; }
.key-created-page .keybox { margin: 20px 0; }
.key-created-page h1 { margin: 16px 0 12px; font: 400 30px/1.25 var(--font); letter-spacing: -.02em; }
.key-created-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: rgba(63,187,130,.12); color: #74cfa2; }
.key-created-icon svg { width: 24px; height: 24px; }
.account-main .key-created-card { padding: 32px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.account-main .key-created-card > p { color: var(--mut); font-size: 14px; line-height: 1.7; }
.account-main .key-created-card .keybox code { flex: 1; }
.account-main .order-terminal { padding: 32px; }
.account-main .order-terminal .btn { margin-top: 22px; }
.order-grid .setup-panel > p + p { margin-top: 12px; }
.order-grid .setup-panel > .btn { margin-top: 18px; }
.order-page .payment-amount > strong { font-weight: 400; font-size: clamp(22px, 2.5vw, 32px); }
.account-main .card p.notice.error { color: #ff9a94; }

/* ---------- old setup list (kept for order/billing side panels) ---------- */

.setup-panel ol.setup-steps { list-style: decimal; margin: 14px 0 0; padding-left: 22px; color: var(--mut); font-size: 13.5px; }
.setup-steps li { padding: 11px 0; border-bottom: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.setup-steps li::marker { color: var(--faint); }
.setup-steps li:last-child { border-bottom: 0; }
.setup-steps code {
  display: block;
  margin: 8px 0;
  padding: 8px 10px;
  background: var(--input);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-size: 12px;
}

/* ---------- chat support -------------------------------------------------- */

body.chat-body { background: #222125; color: var(--ink); }
.chat-body {
  --main-bg: #222125;
  --sb-bg: #1a191c;
  --sb-edge: #2e2c32;
  --sb-hover: #302e34;
  --sb-ink: #f3f3f5;
  --panel: #2b2a2e;
  --surface: #2b2a2e;
}
.chat-body .shell { background: #222125; color: var(--ink); }
.chat-body .sb { background: #1a191c; border-right-color: var(--sb-edge); }
.chat-body .main { background: #222125; }
.chat-body .sb-empty { color: var(--faint); }
.chat-body .chat-item { display: flex; align-items: center; gap: 4px; border-radius: var(--r-s); color: var(--mut); }
.chat-body .chat-item:hover, .chat-body .chat-item.active { background: var(--chip); color: var(--ink); }
.chat-body .chat-main { flex: 1; min-width: 0; display: grid; gap: 1px; padding: 8px 10px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.chat-body .chat-main .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.chat-body .chat-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); font-size: 11px; }
.chat-body .sb-del { flex: none; width: 26px; height: 26px; margin-right: 4px; border: 0; border-radius: var(--r-s); background: none; color: var(--faint); font-size: 15px; line-height: 1; cursor: pointer; opacity: 0; }
.chat-body .chat-item:hover .sb-del, .chat-body .chat-item.active .sb-del { opacity: 1; }
.chat-body .sb-del:hover { background: var(--bad-soft); color: var(--bad); }

.sb-user { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 8px; border: 1px solid transparent; border-radius: var(--r-s); background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.sb-user:hover, .sb-user[aria-expanded="true"] { background: var(--chip); }
.sb-avatar {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--r-s);
  background: linear-gradient(96deg, #e10600 0%, #ff4d0a 46%, #ff9a1f 100%);
  color: #fff;
  font: 600 11px/1 var(--mono);
}
.sb-user-copy { display: grid; gap: 1px; min-width: 0; flex: 1; line-height: 1.3; }
.sb-user-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user-bal { color: var(--faint); font: 400 11.5px var(--mono); }
.sb-user-more { flex: none; width: 26px; color: var(--faint); font-size: 16px; text-align: center; }

.usage-pill { flex: none; margin-left: auto; padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); color: var(--faint); font: 400 11.5px var(--mono); font-variant-numeric: tabular-nums; }
.chat-body .mp-btn { border: 1px solid transparent; background: transparent; color: var(--ink); }
.chat-body .mp-btn:hover { background: var(--chip); }

.chat-body .pop { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: none; }
.chat-body .mp-row:hover { background: var(--chip); }
.chat-body .mp-row.hi, .chat-body .mp-row[aria-selected="true"] { background: var(--chip); }
.chat-body .mp-row:focus-visible { outline: 2px solid rgba(255, 122, 47, .55); outline-offset: -2px; }
.chat-body .user-menu { padding: 8px; }
.chat-body .user-menu a { display: block; padding: 8px 10px; border-radius: var(--r-s); color: var(--ink); font-size: 13.5px; text-decoration: none; }
.chat-body .user-menu a:hover { background: var(--chip); color: var(--ink); }
.chat-body .menu-who { padding: 8px 10px 10px; }
.chat-body .menu-who strong { display: block; color: var(--ink); font-size: 13px; overflow-wrap: anywhere; }
.chat-body .menu-who span { display: block; margin-top: 2px; color: var(--good); font-size: 12px; font-variant-numeric: tabular-nums; }
.chat-body .menu-sep { height: 1px; margin: 6px 0; background: var(--line); }
.chat-body .menu-runtime { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; margin-top: 8px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--bg); color: var(--faint); font-size: 11.5px; }
.chat-body .menu-runtime code { color: var(--ink); font: 400 11.5px var(--mono); word-break: break-all; }
.chat-body .menu-sep { background: var(--line); }

.intro-sub { margin: 0 0 22px; color: var(--mut); font-size: 13.5px; }

.chat-body .message { display: flex; gap: 12px; margin: 0; min-width: 0; }
.chat-body .message-avatar {
  flex: none;
  width: 26px;
  height: 26px;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  background: transparent;
  color: var(--faint);
  font: 500 9.5px var(--mono);
  letter-spacing: .02em;
}
.chat-body .message.user { flex-direction: row-reverse; }
.chat-body .message.user .message-avatar { border-color: transparent; background: var(--chip); color: var(--mut); }
.chat-body .message.user > div { display: flex; flex-direction: column; align-items: flex-end; }
.chat-body .message > div { min-width: 0; max-width: calc(100% - 42px); }
.chat-body .message-role { margin-bottom: 6px; color: var(--faint); font: 400 11.5px var(--mono); letter-spacing: 0; }
.chat-body .message.user .message-role { text-align: right; }
.chat-body .message-text { color: var(--ink); font-size: 15px; line-height: 1.68; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-body .message.user .message-text {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 20px;
  background: var(--chip);
  color: var(--ink);
  text-align: left;
}
.chat-body .message.ai .message-text { background: none; border: 0; padding: 0; border-radius: 0; }
.chat-body .message-text code { background: var(--chip); border: 1px solid var(--line); border-radius: var(--r-s); padding: 1px 5px; color: var(--ink); font-size: .88em; }
.chat-body .message-text pre {
  position: relative;
  margin: 12px 0;
  padding: 38px 16px 14px;
  background: #141317;
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  color: #d7d7db;
  font: 400 12.8px/1.7 var(--mono);
  overflow-x: auto;
  white-space: pre;
}
.chat-body .message-text pre code { background: none; border: 0; padding: 0; color: inherit; font: inherit; }
.chat-body .message-text pre .copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  background: var(--chip);
  color: var(--mut);
  font-size: 11.5px;
  cursor: pointer;
}
.chat-body .message-text pre .copy:hover { color: var(--ink); border-color: #333238; }
.chat-body .message-text.bad, .chat-body .message-text[data-interrupted="true"] { color: var(--bad); }
.chat-body .message-text[data-interrupted="true"] { font-style: italic; }
.chat-body .message-text.thinking::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 14px;
  margin-left: 3px;
  vertical-align: -2px;
  background: var(--pri);
  animation: caret 1s steps(2) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

.chat-body .composer { border: 1px solid var(--line); }
.chat-body .composer textarea { color: var(--ink); background: none; }
.chat-body .composer textarea::placeholder { color: var(--faint); }
.chat-body .composer-hint { color: var(--faint); }
.chat-body .composer-hint.bad { color: var(--bad); }
.chat-body .composer-capability, .chat-body .composer-note { color: var(--faint); }
/* Send / stop keep the original chat.css treatment: gradient send pill,
   ink-coloured stop variant; no extra overrides here. */

/* ---------- responsive ---------------------------------------------------- */

@media (max-width: 1080px) {
  .account-content { padding: 36px 4vw 72px; }
}

@media (max-width: 1000px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .order-grid { grid-template-columns: minmax(0, 1fr); }
  .billing-notes { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .integration-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .setup-key-row { grid-template-columns: minmax(0, 1fr); }
  .key-create { grid-template-columns: minmax(0, 1fr); }
  .key-create button { grid-column: 1; grid-row: 3; justify-self: stretch; width: 100%; }
  .account-title,
  .page-heading { flex-wrap: wrap; gap: 16px; }
  .account-title > .btn,
  .page-heading > .btn { margin-top: 0; }
}

@media (max-width: 860px) {
  /* Without JavaScript, keep navigation in the normal document flow. */
  body:not(.account-nav) .account-shell { grid-template-columns: minmax(0, 1fr); }
  body:not(.account-nav) .account-shell > .dash-rail {
    grid-column: 1;
    grid-row: 1;
    position: static;
    width: auto;
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  body:not(.account-nav) .account-shell > .account-main { grid-column: 1; grid-row: 2; }

  body.account-nav .account-shell { display: block; }
  body.account-nav .account-main { padding-top: 60px; }
  body.account-nav .account-mobile-bar {
    position: fixed; inset: 0 0 auto; height: 60px; z-index: 80;
    display: flex; align-items: center; padding: 0 16px 0 64px;
    background: var(--side); border-bottom: 1px solid var(--line-soft);
  }
  .account-mobile-brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; }
  .account-mobile-brand:hover { text-decoration: none; }
  .account-mobile-brand .mark-svg { width: 23px; height: 23px; }
  body.account-nav.rail-open { overflow: hidden; }
  body.account-nav .account-shell > .dash-rail {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(300px, 84vw);
    height: 100vh;
    height: 100dvh;
    max-height: none;
    z-index: 90;
    border-right: 1px solid var(--line);
    transform: translateX(-102%);
    transition: transform .22s ease;
  }
  body.account-nav.rail-open .account-shell > .dash-rail { transform: none; }
  body.account-nav .rail-close { display: inline-flex; }
  body.account-nav .account-shell .account-menu {
    display: inline-flex;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 80;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: var(--chip);
    color: var(--ink);
    font: 400 18px/1 var(--font);
    cursor: pointer;
  }
  body.account-nav .account-shell .account-menu:hover { background: var(--chip-hover); }
  body.account-nav .account-shell > .account-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 85;
    padding: 0;
    border: 0;
    background: rgba(0, 0, 0, .55);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, visibility 0s linear .2s;
  }
  body.account-nav.rail-open .account-shell > .account-scrim {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }

  .account-content { padding: 24px 16px calc(56px + env(safe-area-inset-bottom)); }
  .account-content > section + section { margin-top: 32px; }
  /* Drawer nav items get comfortable 44px tap targets on touch layouts. */
  .rail-nav a { min-height: 44px; }
  .site-header .nav a { padding: 11px 14px; font-size: 15px; }
  .account-title,
  .page-heading { margin-bottom: 22px; }
  .dash-overview,
  .secondary-overview { margin-top: 24px; }
  .section-heading { margin-top: 22px; }
  .integration-section { margin-top: 32px; }
  .billing-balance { flex-wrap: wrap; }
  .billing-balance strong { font-size: 32px; }
}

@media (max-width: 560px) {
  .integration-grid { grid-template-columns: minmax(0, 1fr); }
  .account-title h1,
  .page-heading h1,
  .get-started .account-title h1 { font-size: 22px; }
  .account-title p,
  .page-heading p { font-size: 13.5px; }
  .integration-card { height: auto; min-height: 0; padding: 12px 14px; }
  .card.metric > b,
  .card.metric > b.good,
  .card.metric > b.bad { font-size: 22px; }
  .account-main .card,
  .account-main .card.setup-panel { padding: 18px; }
  .account-content { padding: 20px 14px 48px; }
  .billing-balance { flex-direction: column; align-items: flex-start; }
  .billing-balance .btn { width: 100%; }
  .topup-panel > summary { font-size: 19px; }
}

/* ---------- commercial interaction finish -------------------------------- */

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid rgba(255, 122, 47, .72);
  outline-offset: 3px;
}

/* Genuine processing state only: the submitting control itself. The busy
   filter is paired with .is-submitting so arbitrary [aria-busy] containers
   (regions, tables) are never globally desaturated. */
button.is-submitting,
input.is-submitting { cursor: wait !important; }
button.is-submitting[aria-busy="true"],
input.is-submitting[aria-busy="true"] { filter: saturate(.72); }

button.is-submitting::before,
input.is-submitting::before {
  content: "";
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: relay-spin .72s linear infinite;
}

@keyframes relay-spin { to { transform: rotate(360deg); } }

.scroll-affordance {
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: #4a4850 transparent;
}

.scroll-affordance::-webkit-scrollbar { height: 8px; }
.scroll-affordance::-webkit-scrollbar-thumb { background: #4a4850; border-radius: 999px; }
.scroll-affordance.is-scrollable:not(.at-scroll-end) {
  box-shadow: inset -18px 0 18px -20px rgba(255, 255, 255, .42);
}
.scroll-affordance.is-scrollable:not(.at-scroll-start) {
  border-left-color: rgba(255, 122, 47, .34);
}

/* Surface feedback is limited to colour/border changes. Cards that host
   forms and tables never move on hover — shifting inputs mid-interaction
   is hostile — only self-contained clickable cards lift one pixel. */
.account-main .card,
.account-main .tablewrap,
.account-main .notice {
  transition: border-color .18s ease, background-color .18s ease;
}
.integration-card { transition: background .15s ease, transform .18s ease; }
.integration-card:hover { transform: translateY(-1px); }

/* Entry motion: auth card settles in once on load (from-state only, so
   content is never waiting on a script to appear). */
@media (prefers-reduced-motion: no-preference) {
  body.auth-body .auth-card { animation: auth-in .45s cubic-bezier(.2, .7, .2, 1) both; }
}
@keyframes auth-in { from { opacity: 0; transform: translateY(8px); } }

/* Auth gate clears notched-display safe areas. */
body.auth-body .auth {
  padding: max(32px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
}

@media (prefers-reduced-motion: reduce) {
  body .rv, body .rv.in { opacity: 1; transform: none; transition: none; }
  body.account-nav .account-shell > .dash-rail,
  body.account-nav .account-shell > .account-scrim,
  .account-main .card,
  .integration-card,
  .account-main .tablewrap,
  .account-main .notice { transition: none; transform: none !important; }
  .chat-body .message-text.thinking::after,
  button.is-submitting::before,
  input.is-submitting::before { animation: none; }
}
