/* Layout for the signed-in dashboard pages (index.html, admin.html). */
header { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); }
/* Up to 1440px wide (wide enough that no table scrolls), centered beyond that. */
.bar { max-width: 1440px; margin: 0 auto; padding: 12px 24px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; margin: 0; }
.brand .muted { font-weight: 500; }
.acct { display: flex; align-items: center; gap: 14px; }
/* Account menu: a round initial that opens email, links and sign out. */
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
#avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--soft); color: var(--acc); font-weight: 700; font-size: 13px; text-transform: uppercase; border: 1px solid var(--edge); }
.menu[open] #avatar, #avatar:hover { border-color: var(--acc); }
.pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; padding: 6px; background: var(--card); border: 1px solid var(--edge); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18); display: grid; }
.pop .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: grid; font-size: 12px; }
.pop .who b { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.pop a, .pop button { display: block; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--fg); text-decoration: none; font-weight: 500; font-size: 13.5px; }
.pop a:hover, .pop button:hover { background: var(--hover); }
.tabsrow { max-width: 1440px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 12px; }
.tabsrow select { margin-left: auto; padding: 5px 28px 5px 10px; font-size: 13px; }
nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
#tabs { margin-left: -12px; }
nav button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 10px 12px; color: var(--muted); white-space: nowrap; }
nav button:hover { background: none; color: var(--fg); }
nav button.on { color: var(--fg); border-bottom-color: var(--acc); }
main { max-width: 1440px; margin: 0 auto; padding: 24px 24px 48px; display: grid; gap: 16px; }
/* Wide tables scroll on their own (the scrollbar sits under the table, not the card). */
.tw { overflow-x: auto; max-width: 100%; scrollbar-width: thin; scrollbar-color: var(--edge) transparent; }
.tw::-webkit-scrollbar { height: 8px; }
.tw::-webkit-scrollbar-thumb { background: var(--edge); border-radius: 4px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { white-space: normal; vertical-align: bottom; min-width: 6.5em; } /* long headers wrap instead of widening the table */
td code.sub { font-size: 11.5px; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--hover); }
.n { text-align: right; font-variant-numeric: tabular-nums; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); }
.tile > span { font-size: 12px; font-weight: 500; }
.tile b { display: block; margin-top: 4px; font-size: 24px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.slots { display: inline-block; width: 80px; height: 6px; background: var(--line); border-radius: 3px; vertical-align: middle; }
.slots i { display: block; height: 100%; background: var(--bar); border-radius: 3px; }
#token, #newkey { white-space: normal; }
#newkey:not(:empty), #token:not(:empty) { margin-top: 16px; padding: 16px; border-radius: 10px; background: var(--soft); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
/* Signed out: links in the header, a short pitch and the sign-in card. */
#links { display: flex; align-items: center; gap: 4px; }
#links a { color: var(--fg); text-decoration: none; padding: 6px 12px; border-radius: 8px; font-weight: 500; font-size: 13.5px; }
#links a:hover { background: var(--hover); }
#links a.cta { background: var(--card); border: 1px solid var(--edge); margin-left: 8px; }
#docs { color: var(--muted); text-decoration: none; font-size: 13px; }
#docs:hover { color: var(--fg); }
.switch { font-size: 13px; font-weight: 500; text-decoration: none; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--fg); }
.switch:hover { background: var(--hover); }
body.out main { min-height: calc(100vh - 60px); align-content: center; justify-items: center; padding-bottom: 96px; }
.hero { text-align: center; max-width: 560px; }
.hero h2 { font-size: clamp(30px, 5vw, 44px); line-height: 1.1; font-weight: 600; letter-spacing: -.03em; margin: 0 0 14px; text-wrap: balance; }
.hero p { color: var(--muted); font-size: 15.5px; line-height: 1.55; margin: 0 auto; max-width: 470px; }
.login { width: 100%; max-width: 420px; margin-top: 12px; padding: 24px; display: grid; gap: 12px; border-radius: 20px; overflow: visible;
  box-shadow: 0 1px 2px rgba(11, 15, 20, .05), 0 16px 48px rgba(11, 15, 20, .08); }
.login p { margin: 0; }
.login label { font-size: 13px; font-weight: 500; color: var(--muted); }
.login input { padding: 12px 14px; font-size: 15px; border-radius: 10px; background: var(--bg); }
.login #code { font: 600 24px var(--mono); letter-spacing: .5em; text-align: center; padding-left: calc(14px + .5em); }
.login button.primary { padding: 12px 14px; font-size: 15px; border-radius: 10px; }
.login button.primary:disabled { opacity: .6; cursor: progress; }
.login .or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.login .or::before, .login .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.login .alt { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.login .alt a { display: block; text-align: center; padding: 10px; border: 1px solid var(--edge); border-radius: 10px; color: var(--fg); text-decoration: none; font-weight: 500; font-size: 13.5px; }
.login .alt a:hover { background: var(--hover); }
.login .links { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.login .links button { border: 0; background: none; padding: 0; color: var(--acc); font-weight: 500; }
.login .links button:hover { text-decoration: underline; }
.fine { color: var(--muted); font-size: 12.5px; text-align: center; max-width: 380px; margin: 0; }
.fine a { color: var(--muted); }
#msg:empty { display: none; }
/* USDC payment panel. */
.pay { display: grid; gap: 20px; border-color: var(--edge); }
.pay-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.pay-head h2 { font-size: 18px; margin: 0 0 2px; }
.pay-body { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; }
.qr { margin: 0; display: grid; gap: 8px; justify-items: center; }
.qr #solqr { background: #fff; padding: 12px; border-radius: 12px; border: 1px solid var(--line); line-height: 0; }
.qr figcaption { font-size: 12px; max-width: 208px; text-align: center; }
.fields { flex: 1; min-width: 260px; display: grid; gap: 14px; align-content: start; }
.field { display: grid; gap: 4px; }
.field > span { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.field > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.field code { font-size: 13px; overflow-wrap: anywhere; }
.field button { flex: none; padding: 5px 12px; font-size: 13px; }
.amt { font-size: 20px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.note { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.btn { display: inline-block; text-align: center; padding: 11px 16px; border-radius: 10px; text-decoration: none; }
.pay-status { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--soft); font-size: 13.5px; font-weight: 500; }
.spin { width: 14px; height: 14px; flex: none; border-radius: 50%; border: 2px solid var(--acc); border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pay-status .spin + span { margin-right: auto; }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }
.paid { display: flex; gap: 14px; align-items: center; }
.paid p { margin: 2px 0 0; }
.tick { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 20px; font-weight: 700; }
@media (max-width: 640px) {
  header { position: static; }
  #docs { display: none; }
  .bar { flex-wrap: nowrap; }
  #op { display: none; }
  .tabsrow { flex-wrap: wrap; gap: 0; }
  .tabsrow nav { width: 100%; }
  .tabsrow select { margin: 0 0 10px; }
  .bar { padding: 10px 16px; gap: 8px; }
  .tabsrow { padding: 0 16px; }
  main { padding: 16px 16px 40px; }
  .tile b { font-size: 20px; }
  section, .login { padding: 16px; }
  #links a:not(.keep) { display: none; }
  body.out main { padding-top: 32px; align-content: start; }
}

/* curl example with a model picker */
.curl { border: 1px solid var(--edge); border-radius: 10px; overflow: hidden; margin: 10px 0; background: var(--card); }
.curlbar { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--hover); flex-wrap: wrap; }
.curlbar label { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); flex: 1; min-width: 0; }
.curlbar input { font: 13px var(--mono); padding: 5px 8px; border: 1px solid var(--edge); border-radius: 6px; background: var(--card); color: var(--fg); flex: 1; min-width: 0; max-width: 360px; }
.curl pre { margin: 0; padding: 12px 14px; font: 12.5px/1.6 var(--mono); overflow-x: auto; white-space: pre; background: #0b0f14; color: #e8eef4; }
.curl .c-cmd { color: #ff7b72; font-weight: 500; } .curl .c-url { color: #79c0ff; } .curl .c-flag { color: #d2a8ff; }
.curl .c-str { color: #a5d6ff; } .curl .c-model { color: #3ee8ff; background: rgba(62, 232, 255, .12); border-radius: 3px; padding: 0 2px; }

/* Overview: empty-balance banner and the Get started steps. */
.banner { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--line));
  background: color-mix(in srgb, var(--warn) 8%, var(--card)); }
.banner > div { flex: 1; min-width: 0; }
.banner p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.bicon { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); font-weight: 700; }
.start { display: grid; gap: 18px; }
.start-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.start-head h2 { margin: 0 0 2px; font-size: 18px; }
.start-head p { margin: 0; font-size: 13.5px; }
.progress { flex: none; width: 120px; height: 6px; margin-top: 10px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--acc); border-radius: 3px; transition: width .3s; }
ol.steps { list-style: none; padding: 0; gap: 0; }
.step { display: flex; gap: 14px; position: relative; padding-bottom: 20px; }
.step:last-child { padding-bottom: 0; }
.step:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 2px; background: var(--line); }
.num { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--edge); background: var(--card); font-size: 13px; font-weight: 600; color: var(--muted); }
.step:not(.done) .num { border-color: var(--acc); color: var(--acc); background: var(--soft); }
.step.done .num { border-color: var(--ok); background: var(--ok); color: #fff; }
.step.done b { color: var(--muted); }
.stepbody { flex: 1; min-width: 0; padding-top: 3px; }
.stepbody p { margin: 2px 0 10px; color: var(--muted); font-size: 13.5px; }
.step.done .stepbody p { margin-bottom: 0; }
.stepbody a { color: var(--acc); text-decoration: none; font-weight: 500; }
.stepbody a:hover { text-decoration: underline; }
.stepbody .curl { margin: 0; }
@media (max-width: 640px) { .banner { flex-wrap: wrap; } .banner button { width: 100%; } }
.pay-actions { display: flex; align-items: center; gap: 12px; }
.timer { font: 500 13px var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.timer.low { color: var(--warn); }
.tick.late { background: var(--warn); }

/* Overview activity: spend per day, top models, keys, balance changes. */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sec-head h2 { margin-bottom: 12px; }
button.link { border: 0; background: none; padding: 0; color: var(--acc); font-weight: 500; font-size: 13px; }
button.link:hover { text-decoration: underline; background: none; }
.cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; }
.cols.solo { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 900px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.cols section { min-width: 0; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; }
.barcol { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bart { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bart i { display: block; width: 100%; max-width: 48px; background: var(--acc); border-radius: 4px 4px 0 0; }
.barval { font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.barday { font-size: 11px; color: var(--muted); white-space: nowrap; border-top: 1px solid var(--line); width: 100%; text-align: center; padding-top: 4px; }
.bars:has(.barcol:nth-child(15)) .barval { display: none; }
.share { display: inline-block; width: 48px; height: 6px; margin-left: 8px; background: var(--line); border-radius: 3px; vertical-align: middle; overflow: hidden; }
.share i { display: block; height: 100%; background: var(--bar); }
.tierpick { padding: 4px 26px 4px 8px; font-size: 13px; }

/* Operator tab: capacity insights and status chips. */
.tile small { display: block; margin-top: 2px; font-size: 12px; font-weight: 500; }
.insights { margin: 0 0 14px; padding: 12px 14px 12px 30px; border-radius: 10px; background: var(--soft); display: grid; gap: 6px; font-size: 13.5px; line-height: 1.5; white-space: normal; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--hover); border: 1px solid var(--line); }
.chip.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.chip.acc { background: var(--soft); border-color: color-mix(in srgb, var(--acc) 35%, transparent); color: var(--acc); }
.access { display: inline-flex; align-items: center; gap: 10px; }
.chip.ok { background: color-mix(in srgb, var(--ok) 10%, transparent); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
details summary { cursor: pointer; padding: 4px 0 10px; font-size: 13px; }
.chart { position: relative; height: 220px; }
section h3 { font-size: 13.5px; font-weight: 600; margin: 18px 0 8px; }

/* Dialogs (client keys) */
dialog.modal { border: 1px solid var(--edge); border-radius: 12px; background: var(--card); color: var(--fg); padding: 22px; width: min(440px, calc(100vw - 32px)); box-sizing: border-box; box-shadow: 0 12px 48px rgba(0, 0, 0, .35); }
dialog.modal::backdrop { background: rgba(5, 7, 11, .55); }
.modal h3 { margin: 0 0 18px; font-size: 16px; }
.modal .fld { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; font-weight: 500; }
.modal .fld input { width: 100%; box-sizing: border-box; font-weight: 400; }
.modal .cap { display: flex; flex-direction: column; gap: 4px; font-weight: 400; font-size: 12.5px; }
.modal .chk { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.modal .hint { margin: 4px 0 16px 24px; font-size: 13px; }
.modal .keybox + .hint { margin-left: 0; }
.modal input:disabled { opacity: .45; cursor: not-allowed; }
.modal .err { margin: 0; font-size: 13px; min-height: 0; }
.modal .err:empty { display: none; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal .keybox { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border: 1px solid var(--edge); border-radius: 8px; background: var(--bg); }
.modal .keybox code { flex: 1; }
.modal .opts { display: grid; gap: 8px; }
.modal .opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--edge); border-radius: 10px; cursor: pointer; }
.modal .opt:has(input:checked) { border-color: var(--acc); background: var(--soft); }
.modal .opt input { margin: 3px 0 0; accent-color: var(--acc); }
.modal .opt > span { display: grid; gap: 2px; font-size: 13px; line-height: 1.45; }
.modal .opt b { font-size: 14px; font-weight: 600; }
.modal .opts + .hint { margin-left: 0; }
.modal button:disabled { opacity: .5; cursor: not-allowed; }
.addnode { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-top: 14px; }
.addnode label { display: flex; flex-direction: column; gap: 4px; }
.addnode input { min-width: 220px; max-width: 100%; }
/* Self-serve operator setup and the node-token view (index.html). */
.setup { max-width: 600px; margin: 12px auto 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.setupcard { padding: 28px; border-radius: 16px; }
.setup h2 { font-size: 22px; font-weight: 700; margin: 0 0 6px; }
.setup .lead { margin: 0 0 22px; font-size: 14.5px; }
.setup .fine { margin: 0 auto; max-width: 480px; text-align: center; font-size: 13px; }
.setupsteps { list-style: none; display: flex; gap: 6px; margin: 0 0 22px; padding: 0; font-size: 12.5px; font-weight: 500; color: var(--muted); flex-wrap: wrap; }
.setupsteps li { display: flex; align-items: center; gap: 8px; }
.setupsteps li + li::before { content: ""; width: 20px; height: 1px; background: var(--edge); margin-right: 2px; }
.setupsteps span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--edge); font-size: 11.5px; font-weight: 600; }
.setupsteps .on { color: var(--fg); }
.setupsteps .on span { background: var(--acc); border-color: var(--acc); color: var(--accfg); }
.setupsteps .done span { background: var(--soft); border-color: color-mix(in srgb, var(--acc) 40%, transparent); color: var(--acc); }
#setup { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
#setup label { font-size: 13px; font-weight: 600; }
.idrow { display: flex; gap: 8px; }
.idrow input { flex: 1; min-width: 0; padding: 12px 14px; border-radius: 10px; font: 500 16px var(--mono); background: var(--bg); }
.idrow button { display: inline-flex; align-items: center; gap: 6px; border-radius: 10px; padding: 0 14px; white-space: nowrap; }
.setup .hint { margin: 0; font-size: 12.5px; color: var(--muted); }
.setup .err { margin: 0; font-size: 13px; color: var(--bad); }
.setup .err:empty { display: none; }
button.big { padding: 12px 18px; font-size: 15px; border-radius: 10px; margin-top: 10px; }
button:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.signedas { display: flex; gap: 12px; align-items: center; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.signedas b { color: var(--fg); font-weight: 600; word-break: break-all; }
.signedas .avatar { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--soft); color: var(--acc); font-weight: 700; text-transform: uppercase; }
/* The token view: also used on the Nodes tab after Add node or New token. */
.tokenview h2 { font-size: 20px; }
.tokenview h3 { margin: 22px 0 10px; font-size: 14px; }
.tokenview .nodeid { font: 600 .9em var(--mono); color: var(--acc); }
.tokenview > p { margin: 0 0 14px; }
.secret { display: flex; gap: 10px; align-items: center; padding: 12px 12px 12px 16px; border: 1px dashed color-mix(in srgb, var(--acc) 55%, transparent); border-radius: 12px; background: var(--soft); }
.secret code { flex: 1; font-size: 13.5px; line-height: 1.5; user-select: all; }
.secret button { flex: none; }
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--edge); border-radius: 10px; background: var(--bg); margin-bottom: 14px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 7px; color: var(--muted); }
.seg button[aria-selected="true"] { background: var(--card); color: var(--fg); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.howto { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 8px; }
.howto li::marker { color: var(--acc); font-weight: 600; }
#way > p { margin: 0 0 10px; }
.cmd { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--edge); border-radius: 10px; background: var(--bg); margin-bottom: 12px; }
.cmd code { flex: 1; line-height: 1.6; word-break: normal; overflow-wrap: anywhere; }
.more { font-size: 13px; font-weight: 500; text-decoration: none; }
.more:hover { text-decoration: underline; }
.tokenview .actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.tokenview .actions .big { margin: 0; }
section #token:has(.tokenview) { margin-top: 18px; padding: 22px; background: var(--card); border: 1px solid var(--edge); border-radius: 12px; }
.setupcard #token:has(.tokenview) { margin: 0; padding: 0; border: 0; background: none; }
@media (max-width: 520px) {
  .setupcard { padding: 20px 16px; }
  .secret, .cmd { flex-direction: column; align-items: stretch; }
  .setupsteps { gap: 6px 14px; }
  .setupsteps li + li::before { display: none; }
}
