/* poping console: sharp design layer.
   Every rule is scoped to body.console so the marketing pages in styles.css are untouched.
   Load order: styles.css → theme.css → ui.css. */

body.console {
  --bg: #ffffff;
  --bg-2: #fafafa;
  --bg-3: #f4f4f5;
  --ink: #111111;
  --ink-2: #52525b;
  --ink-3: #8a8a94;
  --line: #e4e4e7;
  --line-2: #d4d4d8;
  --brand: #2b2fd9;
  --brand-2: #1e22b8;
  --brand-soft: #eceeff;
  --good: #0f9d63;
  --good-soft: #e9f7f0;
  --warn: #b7791f;
  --warn-soft: #fdf6e7;
  --bad: #d6334a;
  --bad-soft: #fdecef;
  --zest: #19c75a;
  --code-bg: #0d0d0f;
  --code-ink: #e8e8ee;
  --shadow: none;
  --radius: 0;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --ctl: 36px;
  --row: 44px;
  background: var(--bg);
  color: var(--ink);
  font: 13.5px/1.55 var(--font);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) body.console {
    --bg: #0b0b0d;
    --bg-2: #121214;
    --bg-3: #191919;
    --ink: #f2f2f4;
    --ink-2: #b4b4bd;
    --ink-3: #77777f;
    --line: #26262a;
    --line-2: #33333a;
    --brand: #7c7fff;
    --brand-2: #9598ff;
    --brand-soft: #1b1b3a;
    --good: #34d399;
    --good-soft: #10251d;
    --warn: #e0a94a;
    --warn-soft: #2a2113;
    --bad: #f2637a;
    --bad-soft: #2c141a;
    --code-bg: #000000;
    color-scheme: dark;
  }
}
html[data-theme="dark"] body.console {
  --bg: #0b0b0d;
  --bg-2: #121214;
  --bg-3: #191919;
  --ink: #f2f2f4;
  --ink-2: #b4b4bd;
  --ink-3: #77777f;
  --line: #26262a;
  --line-2: #33333a;
  --brand: #7c7fff;
  --brand-2: #9598ff;
  --brand-soft: #1b1b3a;
  --good: #34d399;
  --good-soft: #10251d;
  --warn: #e0a94a;
  --warn-soft: #2a2113;
  --bad: #f2637a;
  --bad-soft: #2c141a;
  --code-bg: #000000;
  color-scheme: dark;
}

/* ---------- base overrides ---------- */
body.console a { color: inherit; text-decoration: none; }
body.console a:hover { text-decoration: none; }
body.console .num,
body.console .mono { font-family: var(--mono); }
body.console .muted { color: var(--ink-3); }
body.console :focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: 0; }

/* ---------- shell ---------- */
body.console .app { display: grid; grid-template-columns: 240px minmax(0, 1fr); align-content: start; min-height: 100vh; }

body.console .side {
  position: sticky; top: 0; z-index: 40;
  height: 100vh; min-width: 0;
  display: flex; flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--line);
  padding: 0;
  gap: 0;
}
body.console .side-head {
  display: flex; align-items: center; gap: 9px;
  height: 56px; padding: 0 14px;
  border-bottom: 1px solid var(--line);
}
body.console .side-head .brand { font: 600 15px var(--font); letter-spacing: -.01em; color: var(--ink); }
body.console .side-head .brand img { display: block; width: 22px; height: 22px; }
body.console .side-head .mark { display: none; }
body.console .side-head .env {
  margin-left: auto;
  font: 500 10px var(--mono); letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); border: 1px solid var(--line); padding: 2px 5px;
}

body.console .side-nav { flex: 1; overflow-y: auto; padding: 8px 0 12px; display: block; }
body.console .side-nav .nav-group { margin: 0; padding: 0; }
body.console .side-nav .nav-group + .nav-group { margin-top: 6px; }
body.console .side-nav .nav-label {
  padding: 10px 16px 6px;
  font: 500 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
}
body.console .side-nav a,
body.console .side-nav .nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  height: 34px; margin: 1px 8px; padding: 0 10px;
  color: var(--ink-2); font: 400 13.5px/1 var(--font);
  border-radius: 0;
}
body.console .side-nav a:hover,
body.console .side-nav .nav-item:hover { background: var(--bg-3); color: var(--ink); text-decoration: none; }
body.console .side-nav a.on,
body.console .side-nav .nav-item.on { background: var(--bg-3); color: var(--ink); font-weight: 500; }
body.console .side-nav a.on::before,
body.console .side-nav .nav-item.on::before {
  content: ''; position: absolute; left: -8px; top: 0; bottom: 0; width: 2px; background: var(--brand);
}
body.console .side-nav a svg { width: 15px; height: 15px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; color: var(--ink-3); }
body.console .side-nav a:hover svg { color: var(--ink-2); }
body.console .side-nav a.on svg { color: var(--ink); }
body.console .side-nav .badge { margin-left: auto; font: 500 10.5px var(--mono); color: var(--ink-3); }

body.console .side-foot { margin: 0; padding: 12px; border-top: 1px solid var(--line); background: none; }
body.console .side .wallet {
  margin: 0; padding: 10px 12px;
  background: none; border: 1px solid var(--line); border-radius: 0;
}
body.console .side .wallet .k { font: 500 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
body.console .side .wallet .v { font: 600 20px var(--mono); letter-spacing: -.02em; margin-top: 2px; }
body.console .side .wallet .actions { display: flex; gap: 6px; margin-top: 10px; }
body.console .side .wallet .muted { display: none; }
body.console .side .user { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
body.console .side .avatar {
  width: 26px; height: 26px; flex: none; border-radius: 0;
  display: grid; place-items: center;
  background: var(--bg-3); border: 1px solid var(--line);
  font: 600 11px var(--mono); color: var(--ink-2);
}
body.console .side .user .who { flex: 1; min-width: 0; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }

/* ---------- main / topbar ---------- */
body.console .main { min-width: 0; display: flex; flex-direction: column; }
body.console .topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  height: 56px; padding: 0 20px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
body.console .crumb { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; }
body.console .crumb .sep, body.console .crumb .up { color: var(--ink-3); font-weight: 400; }
body.console .topbar .spacer { flex: 1; }
body.console .searchbox {
  display: flex; align-items: center; gap: 8px;
  height: var(--ctl); width: 264px; padding: 0 10px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--ink-3);
  border-radius: 0; font-size: 13px;
}
body.console .searchbox kbd {
  margin-left: auto; font: 500 10.5px var(--mono); color: var(--ink-3);
  border: 1px solid var(--line); border-bottom-width: 2px; padding: 1px 5px; background: var(--bg);
}
body.console .topbar .balance { display: flex; align-items: baseline; gap: 6px; font: 600 13px var(--mono); }
body.console .topbar .balance span { font: 500 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- controls ---------- */
body.console .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--ctl); padding: 0 14px;
  border: 1px solid transparent; border-radius: 0;
  background: transparent; color: var(--ink);
  font: 500 13px var(--font); white-space: nowrap; cursor: pointer;
  box-shadow: none;
  transition: background .12s, border-color .12s, color .12s, transform .12s;
}
body.console .btn:active { transform: translateY(1px); }
body.console .btn svg { width: 14px; height: 14px; flex: none; }
body.console .btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
body.console .btn.primary:hover { background: #2a2a2e; border-color: #2a2a2e; }
html[data-theme="dark"] body.console .btn.primary:hover { background: #dcdce2; border-color: #dcdce2; }
body.console .btn.ghost { border-color: var(--line-2); color: var(--ink); background: var(--bg); }
body.console .btn.ghost:hover { border-color: var(--ink); background: var(--bg); }
body.console .btn.danger { border-color: color-mix(in srgb, var(--bad) 32%, transparent); color: var(--bad); background: transparent; }
body.console .btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
body.console .btn.zest { background: var(--zest); color: #06230f; border-color: var(--zest); }
body.console .btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
body.console .btn.lg { height: 44px; padding: 0 18px; font-size: 14px; }
body.console .btn[disabled] { opacity: .5; cursor: not-allowed; }
body.console .icon-btn {
  width: 30px; height: 30px; border-radius: 0;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-2);
  cursor: pointer;
}
body.console .icon-btn:hover { border-color: var(--ink); color: var(--ink); }

body.console .input,
body.console select.input,
body.console textarea.input {
  width: 100%; height: var(--ctl); padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: 0;
  background: var(--bg); color: var(--ink);
  font: 13px var(--font); box-shadow: none; outline: none;
}
body.console textarea.input { height: auto; padding: 8px 10px; resize: vertical; }
body.console .input:focus { border-color: var(--brand); box-shadow: none; outline: 2px solid var(--brand); outline-offset: -2px; }
body.console .input::placeholder { color: var(--ink-3); }
body.console label.field { display: grid; gap: 5px; font: 500 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
body.console label.field > span { font: 500 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
body.console label.field .input, body.console label.field textarea { text-transform: none; letter-spacing: 0; }
body.console .form-error { color: var(--bad); font-size: 12.5px; min-height: 16px; }

body.console .pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px; padding: 0 6px; border-radius: 0;
  border: 1px solid var(--line); background: var(--bg);
  font: 500 10.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2);
}
body.console .pill::before { content: ''; width: 5px; height: 5px; background: currentColor; }
body.console .pill.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 30%, transparent); background: var(--good-soft); }
body.console .pill.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); background: var(--bad-soft); }
body.console .pill.brand { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 30%, transparent); background: var(--brand-soft); }
body.console .pill.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); background: var(--bad-soft); }
body.console .dot { width: 6px; height: 6px; border-radius: 0; box-shadow: none; }

body.console .chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 9px; border-radius: 0;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-2);
  font: 500 12px var(--font); cursor: pointer;
}
body.console .chip:hover { border-color: var(--line-2); color: var(--ink); }
body.console .chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
body.console .chip .n { font: 500 10.5px var(--mono); color: var(--ink-3); }
body.console .chip.on .n { color: color-mix(in srgb, var(--bg) 65%, transparent); }
body.console .off, body.console .tag {
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px; padding: 0 6px; border-radius: 0;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--ink-2);
  font: 500 10.5px var(--mono); letter-spacing: .06em; text-transform: uppercase;
}
body.console .off { border-color: color-mix(in srgb, var(--zest) 35%, transparent); background: color-mix(in srgb, var(--zest) 14%, transparent); color: var(--good); }
body.console .off.none { background: var(--bg-3); border-color: var(--line); color: var(--ink-3); }

/* ---------- page ---------- */
body.console .page { padding: 20px 24px 72px; max-width: 1440px; width: 100%; }
body.console .main-head { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; }
body.console .main-head h1 { margin: 0; font: 600 19px var(--font); letter-spacing: -.02em; }
body.console .main-head h2 { margin: 0; font: 600 15px var(--font); letter-spacing: -.01em; }
body.console .main-head .spacer { flex: 1; }

body.console .card {
  background: var(--bg); border: 1px solid var(--line); border-radius: 0; box-shadow: none;
}
body.console .panel { padding: 0; }
body.console .panel > h3 {
  margin: 0; height: var(--row);
  display: flex; align-items: center; padding: 0 14px;
  border-bottom: 1px solid var(--line);
  font: 600 13px var(--font); letter-spacing: -.01em;
}
body.console .panel > :not(h3) { margin-left: 14px; margin-right: 14px; }
body.console .panel > :not(h3):last-child { margin-bottom: 14px; }
body.console .panel > :not(h3):first-child { margin-top: 14px; }

/* KPI strip */
body.console .kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); margin-bottom: 12px; }
body.console .kpis .kpi { padding: 13px 15px 14px; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none; min-width: 0; }
body.console .kpis .kpi:last-child { border-right: 0; }
body.console .kpis .kpi .k { color: var(--ink-3); font: 500 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
body.console .kpis .kpi .v { margin-top: 5px; font: 600 23px var(--mono); letter-spacing: -.03em; line-height: 1.1; }
body.console .kpis .kpi .s { margin-top: 4px; font: 500 11px var(--mono); color: var(--ink-3); }

/* ---------- table ---------- */
body.console .table-wrap { overflow-x: auto; border-radius: 0; }
body.console table.list,
body.console table.models {
  width: 100%; border-collapse: collapse; font-size: 13px; background: none;
}
body.console table.list th,
body.console table.models th {
  height: 34px; padding: 0 12px; text-align: left; white-space: nowrap; position: static;
  font: 500 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
  background: var(--bg-2); border-bottom: 1px solid var(--line);
}
body.console table.list td,
body.console table.models td {
  height: var(--row); padding: 0 12px; white-space: nowrap;
  border-bottom: 1px solid var(--line); vertical-align: middle;
}
body.console table.list tr:last-child td,
body.console table.models tr:last-child td { border-bottom: 0; }
body.console table.list tbody tr:hover td,
body.console table.models tbody tr:hover td { background: var(--bg-2); }
body.console table.list td.r { text-align: right; }
body.console .table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }
body.console .empty { padding: 40px 20px; text-align: center; color: var(--ink-3); }

/* ---------- chart ---------- */
body.console .chart { height: 180px; display: block; padding: 0; }
body.console .chart svg { width: 100%; height: 100%; }
body.console .chart-axis { display: flex; justify-content: space-between; font: 10.5px var(--mono); color: var(--ink-3); margin: 6px 14px 12px; }

/* top models */
body.console .mlist { display: grid; }
body.console .mrow { display: grid; grid-template-columns: minmax(0, 1fr) 110px 48px; gap: 12px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line); }
body.console .mrow:last-child { border-bottom: 0; }
body.console .mrow .name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.console .mrow .name span { display: block; font: 10.5px var(--mono); color: var(--ink-3); margin-top: 1px; }
body.console .mrow .bar { height: 6px; background: var(--bg-3); }
body.console .mrow .bar i { display: block; height: 100%; background: var(--brand); }
body.console .mrow .pct { text-align: right; font: 500 11.5px var(--mono); color: var(--ink-2); }

/* ---------- code ---------- */
body.console .code { border-radius: 0; box-shadow: none; }
body.console .code-tabs button { border-radius: 0; }
body.console .code .copy { border-radius: 0; }
body.console pre.inline-code, body.console code.inline { border-radius: 0; }

/* ---------- key page ---------- */
body.console .new-key-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; margin-bottom: 12px;
  border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
  background: var(--brand-soft);
}
body.console .new-key-banner .b-ic { width: 22px; height: 22px; flex: none; display: grid; place-items: center; background: var(--brand); color: #fff; font: 600 12px var(--mono); }
body.console .new-key-banner .b-body { flex: 1; min-width: 0; }
body.console .new-key-banner .b-title { font-size: 12.5px; font-weight: 600; }
body.console .new-key-banner .secret-box { margin-top: 4px; padding: 0; border: 0; background: none; display: flex; align-items: center; gap: 8px; font: 12px var(--mono); }
body.console .new-key-banner .secret-box span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* toolbar */
body.console .toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
body.console .toolbar .search { flex: 1 1 240px; position: relative; }
body.console .toolbar .search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; stroke: var(--ink-3); fill: none; stroke-width: 1.8; }
body.console .toolbar .search .input { padding-left: 30px; }

/* ---------- dialog ---------- */
body.console .overlay { position: fixed; inset: 0; z-index: 60; background: rgba(9, 9, 11, .45); display: grid; place-items: center; padding: 20px; }
body.console .dialog { width: 100%; max-width: 440px; background: var(--bg); border: 1px solid var(--line-2); box-shadow: none; }
body.console .dialog-head { display: flex; align-items: center; height: 48px; padding: 0 16px; border-bottom: 1px solid var(--line); }
body.console .dialog-head h2 { margin: 0; font: 600 14px var(--font); }
body.console .dialog-head .x { margin-left: auto; }
body.console .dialog-body { padding: 16px; display: grid; gap: 14px; }
body.console .dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--bg-2); }

/* ---------- toast ---------- */
body.console .toast {
  left: 50%; bottom: 22px; top: auto; transform: translate(-50%, 12px);
  border-radius: 0; background: var(--ink); color: var(--bg);
  padding: 9px 14px; font-size: 12.5px; box-shadow: none;
}
body.console .toast.show { transform: translate(-50%, 0); }

/* ---------- billing inherit ---------- */
body.console .amount-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
body.console .amount-grid .chip { height: 40px; justify-content: center; font: 500 13px var(--mono); }
body.console .ledger-card { border-radius: 0; }
body.console .grid-2 { gap: 12px; }
body.console .grid-3 { gap: 12px; }

/* ---------- admin ---------- */
body.console .mult-cell { display: flex; gap: 5px; align-items: center; }
body.console .mult-cell .input { width: 70px; height: 30px; font-family: var(--mono); font-size: 12.5px; }
body.console .mult-cell .hint { font: 11.5px var(--mono); color: var(--ink-3); min-width: 42px; }
body.console .mult-cell .hint.custom { color: var(--brand); font-weight: 600; }
body.console .mult-cell .btn.sm { padding: 0 7px; font-size: 11.5px; }

body.console .offer { display: flex; gap: 10px; align-items: baseline; padding: 3px 0; flex-wrap: wrap; }
body.console .offer .name { font-weight: 600; min-width: 112px; }
body.console .offer .price { font: 12px var(--mono); color: var(--ink-3); min-width: 112px; }
body.console .offer .rank { width: 1.4em; text-align: right; font: 12px var(--mono); color: var(--ink-3); }
body.console .offer .move { display: inline-flex; gap: 2px; }
body.console .offer .move button {
  width: 22px; height: 20px; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: 0; background: none;
  color: var(--ink-2); font-size: 11px; line-height: 1;
}
body.console .offer .move button:disabled { opacity: .3; cursor: default; }
body.console .order-reset { font-size: 12px; margin-top: 4px; display: flex; gap: 8px; align-items: center; }
body.console .order-reset a { color: var(--brand); }
body.console .health { font: 12px var(--mono); }
body.console .health.good { color: var(--good); }
body.console .health.warn { color: var(--warn); }
body.console .health.bad { color: var(--bad); }
body.console .health.none { color: var(--ink-3); }
body.console #m-window { width: auto; height: var(--ctl); }
body.console .toolbar #m-window { width: 150px; flex: none; }
body.console #users-section table.list td { padding: 0 10px; }
body.console #users-section table.list th { padding: 0 10px; }
body.console tr.saved td { background: color-mix(in srgb, var(--good) 10%, transparent); transition: background .6s; }

/* ---------- playground (ChatGPT-style) ---------- */
body.console .pg-wrap { display: flex; flex-direction: column; height: calc(100vh - 56px - 40px); min-height: 480px; }
body.console .pg-top { display: flex; align-items: center; gap: 10px; padding: 4px 0 12px; }
body.console .pg-top .pg-model-wrap { width: 300px; flex: none; }
body.console .pg-top .pg-meta { flex: 1; text-align: right; font: 11.5px var(--mono); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.console .pg-log { flex: 1; overflow-y: auto; display: block; }
body.console .pg-empty { height: 100%; min-height: 320px; display: grid; place-content: center; gap: 22px; text-align: center; padding: 24px; }
body.console .pg-hello img { width: 30px; height: 30px; margin: 0 auto 14px; }
body.console .pg-hello h2 { margin: 0; font: 300 clamp(22px, 3vw, 30px) var(--font); letter-spacing: -.03em; }
body.console .pg-hello p { margin: 8px 0 0; font-size: 13px; color: var(--ink-3); }
body.console .pg-quick { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 560px; }
body.console .pg-msgs { max-width: 760px; margin: 0 auto; padding: 24px 8px 32px; display: grid; gap: 24px; }
body.console .pg-msgs .msg.user .txt { background: var(--bg-3); padding: 10px 14px; border-radius: 16px; margin-left: 56px; }
body.console .pg-msgs .msg .who { display: none; }
body.console .pg-msgs .msg { display: grid; gap: 4px; }
body.console .pg-msgs .msg .txt { white-space: pre-wrap; line-height: 1.7; font-size: 14px; }
body.console .pg-msgs .msg.assistant { border: 0; }
body.console .pg-msgs .msg.err .txt { color: var(--bad); }

body.console .pg-dock { position: relative; max-width: 760px; width: 100%; margin: 0 auto; }
body.console .pg-composer {
  border: 1px solid var(--line-2); border-radius: 18px;
  background: var(--bg); padding: 10px 12px 8px;
  transition: border-color .15s, box-shadow .15s;
}
body.console .pg-composer:focus-within { border-color: var(--ink-2); box-shadow: 0 2px 12px -6px rgba(0,0,0,.14); }
body.console .pg-text {
  width: 100%; border: 0; outline: none; background: none; resize: none;
  font: 14px/1.6 var(--font); color: var(--ink); padding: 4px 4px 8px;
  max-height: 200px; overflow-y: auto; scrollbar-width: thin;
}
body.console .pg-text::placeholder { color: var(--ink-3); }
body.console .pg-bar { display: flex; align-items: center; gap: 8px; }
body.console .pg-icon {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 9px;
  border: 1px solid transparent; border-radius: 999px; background: none;
  color: var(--ink-3); font: 500 12px var(--font); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
body.console .pg-icon:hover { background: var(--bg-3); color: var(--ink); }
body.console .pg-icon svg { width: 14px; height: 14px; }
body.console .pg-icon[aria-expanded="true"] { background: var(--ink); color: var(--bg); }
body.console .pg-hint { flex: 1; text-align: right; font: 11px var(--mono); color: var(--ink-3); }
body.console .pg-send {
  width: 32px; height: 32px; border-radius: 50%; border: 0;
  display: grid; place-items: center; cursor: pointer;
  background: var(--ink); color: var(--bg);
  transition: transform .12s, opacity .15s, background .15s;
}
body.console .pg-send:hover { transform: translateY(-1px); }
body.console .pg-send:disabled { opacity: .3; cursor: default; transform: none; }
body.console .pg-send svg { width: 15px; height: 15px; }

body.console .pg-panel {
  position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%) translateY(6px);
  width: min(420px, calc(100vw - 32px));
  max-height: min(560px, 70vh); overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--line-2); border-radius: 18px; background: var(--bg);
  box-shadow: 0 16px 48px -20px rgba(0,0,0,.3);
  opacity: 0; pointer-events: none;
  transition: opacity .16s var(--ease-out), transform .16s var(--ease-out);
  z-index: 50;
}
html[data-theme="dark"] body.console .pg-panel { box-shadow: 0 16px 48px -16px #000; }
body.console .pg-panel.pg-open { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
body.console .pg-panel-note { margin: 10px 4px 0; font-size: 11.5px; color: var(--ink-3); }

body.console .pg-cards { display: grid; gap: 10px; }
body.console .pg-card {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px 14px;
  display: grid; gap: 6px;
  transition: opacity .15s;
}
body.console .pg-card:has(.pg-switch:not(.on)) .pg-range,
body.console .pg-card:has(.pg-switch:not(.on)) .pg-max-input,
body.console .pg-card:has(.pg-switch:not(.on)) .input { opacity: .4; pointer-events: none; }
body.console .pg-card-head { display: flex; align-items: center; gap: 8px; }
body.console .pg-card-title { font: 600 13.5px var(--font); color: var(--ink); }
body.console .pg-val {
  font: 500 11px var(--mono); color: var(--ink-2);
  border: 1px solid var(--line-2); border-radius: 6px;
  padding: 1px 7px;
}
body.console .pg-card-desc { font-size: 12px; color: var(--ink-3); }
body.console .pg-card .input { height: 34px; font-size: 13px; }

/* switch */
body.console .pg-switch {
  margin-left: auto; width: 38px; height: 22px; flex: none;
  border: 0; border-radius: 999px; padding: 0; cursor: pointer;
  background: var(--line-2);
  transition: background .18s;
}
body.console .pg-switch i {
  display: block; width: 16px; height: 16px; margin: 3px;
  border-radius: 50%; background: #fff;
  transition: transform .18s var(--ease-out);
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
body.console .pg-switch.on { background: var(--brand); }
body.console .pg-switch.on i { transform: translateX(16px); }
body.console .pg-switch:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* range slider */
body.console .pg-range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 18px; margin: 4px 0 0;
  background: none; cursor: pointer;
}
body.console .pg-range::-webkit-slider-runnable-track { height: 4px; border-radius: 999px; background: linear-gradient(to right, var(--brand) var(--fill, 50%), var(--bg-3) var(--fill, 50%)); }
body.console .pg-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; margin-top: -6px;
  border-radius: 50%; background: var(--bg);
  border: 1.5px solid var(--brand);
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
  transition: transform .12s;
}
body.console .pg-range::-webkit-slider-thumb:hover { transform: scale(1.15); }
body.console .pg-range::-moz-range-track { height: 4px; border-radius: 999px; background: var(--bg-3); }
body.console .pg-range::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--brand); }
body.console .pg-range::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg); border: 1.5px solid var(--brand);
}
body.console .pg-range:disabled { cursor: default; }
body.console .pg-max-input { max-width: 140px; }

/* ---------- usage ---------- */
body.console .usage-table tbody tr.usage-row { cursor: pointer; }
body.console .usage-table tr.is-error td:first-child { box-shadow: inset 2px 0 0 var(--bad); }
body.console .usage-detail td { background: var(--bg-2); padding: 12px 14px; height: auto; white-space: normal; }
body.console .usage-detail:hover td { background: var(--bg-2); }
body.console .detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 18px; }
body.console .detail-grid > div { display: grid; gap: 2px; min-width: 0; }
body.console .detail-grid span { font: 500 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
body.console .detail-grid code { font: 12px var(--mono); color: var(--ink-2); overflow-wrap: anywhere; }
body.console .detail-grid code.err { color: var(--bad); }
body.console .detail-grid .wide { grid-column: 1 / -1; }
body.console .usage-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }
body.console .pager { display: flex; align-items: center; gap: 4px; }
body.console .pager button {
  width: 26px; height: 26px; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: 0; background: var(--bg);
  color: var(--ink-2); font: 500 11px var(--mono);
}
body.console .pager button:hover:not([disabled]) { border-color: var(--ink); color: var(--ink); }
body.console .pager button[disabled] { opacity: .4; cursor: default; }
body.console .pager .page { font: 500 11px var(--mono); color: var(--ink-3); padding: 0 6px; }
body.console .toolbar #usage-hours { width: 140px; flex: none; }
body.console .chips { display: flex; gap: 4px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  body.console .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.console .kpis .kpi:nth-child(2n) { border-right: 0; }
  body.console .kpis .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  body.console .pg { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  body.console .app { grid-template-columns: minmax(0, 1fr); }
  body.console .side {
    position: static; height: auto; min-width: 0;
    flex-direction: row; flex-wrap: wrap;
    align-items: flex-start; align-content: flex-start;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  body.console .side-head { width: 100%; border-bottom: 0; }
  body.console .side-nav { width: 100%; min-width: 0; display: flex; gap: 4px; padding: 0 10px 8px; overflow-x: auto; flex: none; }
  body.console .side-nav .nav-group { display: contents; }
  body.console .side-nav .nav-label { display: none; }
  body.console .side-nav a { height: 30px; margin: 0; padding: 0 8px; white-space: nowrap; }
  body.console .side-nav a.on::before { display: none; }
  body.console .side-foot { display: none; }
  body.console .topbar { height: auto; flex-wrap: wrap; padding: 8px 10px; gap: 8px; }
  body.console .topbar .searchbox { display: none; }
  body.console .page { padding: 12px 10px 60px; }
  body.console .main-head { flex-wrap: wrap; }
}

/* ---------- simplified glass ----------
   Only layers that float over content. Solid surfaces (tables, cards, forms,
   sidebar) stay opaque. Always paired with a 1px hairline and square corners. */
body.console .pg-panel {
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}
body.console .overlay { backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
/* site.js builds the confirm dialog outside the console tree; keep it square. */
body.console .confirm-wrap { backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
body.console .confirm-box { border-radius: 0; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  body.console .pg-panel { background: var(--bg); }
}

/* ---------- tooltip ----------
   ui.js copies [title] into [data-tip]; native tooltips are removed. */
body.console [data-tip] { position: relative; }
body.console [data-tip]::after {
  content: attr(data-tip);
  position: absolute; left: 50%; bottom: calc(100% + 7px);
  transform: translateX(-50%) translateY(2px);
  background: var(--ink); color: var(--bg);
  font: 500 10.5px var(--mono); letter-spacing: .04em; line-height: 1;
  padding: 6px 8px; white-space: nowrap; border-radius: 0;
  opacity: 0; visibility: hidden; pointer-events: none; z-index: 80;
  transition: opacity var(--dur-1) var(--ease-out) 150ms, transform var(--dur-1) var(--ease-out) 150ms, visibility 0s 150ms;
}
body.console [data-tip]:hover::after,
body.console [data-tip]:focus-visible::after {
  opacity: 1; visibility: visible;
  transform: translateX(-50%) translateY(0);
}
/* Topbar sits against the viewport edge: flip the bubble below the button. */
body.console .topbar [data-tip]::after {
  bottom: auto; top: calc(100% + 7px);
  transform: translateX(-50%) translateY(-2px);
}

/* ---------- skeleton ---------- */
body.console .sk {
  display: inline-block; width: 100%; height: 12px;
  background: var(--bg-3); vertical-align: middle;
  animation: sk-pulse 1.4s var(--ease-out) infinite;
}
body.console .sk-num { width: 64px; height: 23px; }
body.console .sk-chart { display: block; width: 100%; height: 180px; }
body.console .sk-rows { padding: 12px 14px; display: grid; gap: 12px; }
body.console .sk-rows span { height: 10px; }
body.console .sk-rows span:nth-child(2n) { width: 72%; }
body.console .sk-cell { width: 70%; height: 10px; }
@keyframes sk-pulse { 50% { opacity: .5; } }

/* ---------- composer hints ---------- */
body.console .pg-hint { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
body.console .pg-hint kbd {
  font: 500 10px var(--mono); color: var(--ink-2);
  border: 1px solid var(--line-2); border-bottom-width: 2px;
  padding: 1px 4px; margin: 0 1px;
}
