:root {
  color-scheme: dark;
  font-family: Inter, 'Segoe UI', system-ui, sans-serif;
  background: #151411;
  color: #f6f1e9;
  --surface: #1e1c18;
  --border: #39342d;
  --muted: #b9afa2;
  --orange: #ff9b56;
  --mono: 'Cascadia Code', Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button, select, input { font: inherit; }
button, select { cursor: pointer; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 4px; }
[hidden] { display: none !important; }
.container { width: min(calc(100% - 64px), 1120px); margin-inline: auto; }
.topbar { border-bottom: 1px solid #332d26; background: #191713; }
.topbar-inner, .account, .brand, .heading, .section-top, .actions, .history-footer { display: flex; align-items: center; }
.topbar-inner { min-height: 68px; justify-content: space-between; gap: 16px; }
.brand { color: inherit; text-decoration: none; font-size: 1.25rem; font-weight: 750; gap: 11px; letter-spacing: -.04em; }
.brand-mark { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 10px; background: var(--orange); color: #27170c; font: 700 1.2rem var(--mono); }
.account { gap: 10px; font-size: .875rem; }
.avatar { display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid #574033; border-radius: 50%; background: #38271e; color: #ffc29a; font-weight: 650; }
.demo-label { color: var(--muted); margin-inline: 4px 8px; white-space: nowrap; }
.intro { padding: 36px 0 25px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; letter-spacing: -.052em; }
.intro p { margin-top: 10px; color: var(--muted); }
main { padding-bottom: 48px; }
.overview { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { min-width: 0; padding: 22px 24px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.balance { border-color: #62432e; background: radial-gradient(ellipse at 80% -30%, #4e2e1d, transparent 76%), #241d17; }
.heading { gap: 10px; }
h2 { font-size: 1.125rem; letter-spacing: -.02em; }
.section-icon { flex: 0 0 32px; line-height: 32px; text-align: center; border-radius: 8px; background: #38291f; color: var(--orange); font: 700 1rem / 32px var(--mono); }
.amount { margin: 12px 0 4px; font-size: clamp(2.625rem, 6vw, 3.75rem); font-weight: 740; line-height: 1; letter-spacing: -.075em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.currency { color: var(--orange); margin-right: .06em; }
.unit { margin-left: 8px; font: 600 .875rem var(--mono); letter-spacing: 0; color: #e4b594; }
.balance-note, .muted { color: var(--muted); font-size: .875rem; line-height: 1.5; }
.key-status { margin-left: auto; }
.key-status, .status { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; border-radius: 20px; padding: 4px 10px; background: #28352b; color: #b0d6b6; font-size: .875rem; }
.key-status::before, .status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pending { background: #443523; color: #f5c37e; }
.key-value { display: block; width: 100%; margin: 12px 0; padding: 10px 12px; border: 1px solid #37322a; border-radius: 8px; background: #171613; color: #dac9b8; font: .9375rem var(--mono); letter-spacing: .04em; }
.actions { flex-wrap: wrap; gap: 8px; }
.button { min-height: 40px; padding: 8px 13px; border: 1px solid transparent; border-radius: 8px; font-size: .875rem; font-weight: 650; }
.primary { color: #231509; background: var(--orange); }
.primary:hover { background: #ffb784; }
.secondary { border-color: #494138; color: #e6dcd0; background: #27231e; }
.secondary:hover { background: #352c23; }
.usage, .history { margin-top: 16px; }
.section-top { justify-content: space-between; gap: 12px; }
.select-wrap { position: relative; }
.select-wrap::after { content: ''; position: absolute; top: 43%; right: 14px; width: 7px; height: 7px; border: solid var(--orange); border-width: 0 1px 1px 0; transform: rotate(45deg); pointer-events: none; }
select { appearance: none; min-height: 38px; max-width: 100%; border: 1px solid #484037; border-radius: 8px; padding: 7px 30px 7px 11px; color: #eee5d9; background: #27231e; font-size: .875rem; }
.usage-grid { display: grid; grid-template-columns: minmax(195px, 1fr) 2.8fr; align-items: stretch; gap: 25px; margin: 15px 0 11px; }
.total { align-self: center; }
.total-value { font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 730; letter-spacing: -.065em; font-variant-numeric: tabular-nums; line-height: 1.15; margin-bottom: 5px; }
.plot { --plot-height: 76px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; background: repeating-linear-gradient(to top, #393128 0 1px, transparent 1px 25px) no-repeat; background-size: 100% var(--plot-height); }
.plot-cell { display: grid; justify-items: center; text-align: center; min-width: 0; }
.plot-track { height: var(--plot-height); width: 100%; display: grid; align-items: end; justify-items: center; }
.bar { width: 58%; max-width: 48px; min-height: 0; height: var(--height); border-radius: 4px 4px 0 0; background: linear-gradient(180deg, #dd874e, #8c492a); }
.plot-cell:last-child .bar { background: linear-gradient(180deg, #ffad72, #c46638); }
.plot-label { margin-top: 5px; min-height: 1.1em; white-space: nowrap; color: var(--muted); font: .75rem var(--mono); }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: .875rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid #393229; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
th { color: var(--muted); font-weight: 500; }
tbody tr:last-child td { border-bottom: 0; }
.models td:first-child, .requests td:nth-child(2) { font-weight: 650; }
.models :is(th, td):not(:first-child) { text-align: right; }
.models td:not(:first-child), .requests td:nth-child(3), .requests td:nth-child(4), .timezone { font-family: var(--mono); }
.requests { min-width: 650px; margin-top: 9px; }
.timezone { color: var(--muted); font-size: .875rem; }
.history-footer { justify-content: space-between; gap: 12px; border-top: 1px solid #393229; padding-top: 13px; margin-top: 5px; }
dialog { width: min(calc(100% - 32px), 480px); padding: 24px; background: var(--surface); color: inherit; border: 1px solid var(--border); border-radius: 16px; }
dialog::backdrop { background: #0b0806bf; }
.instructions-steps { padding-inline-start: 24px; line-height: 1.5; }
.instructions-steps li + li { margin-top: 8px; }
.instructions-note { margin-bottom: 16px; }
.copy-status { color: #b0d6b6; font-size: .875rem; }
.copy-status:empty { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 700px) {
  .container { width: calc(100% - 32px); }
  .overview { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .intro { padding: 26px 0 20px; }
  .usage-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .models { min-width: 410px; }
}

@media (max-width: 420px) {
  .account-name { display: none; }
  .topbar-inner { flex-wrap: wrap; gap: 8px; padding-block: 12px; }
  .account { flex-wrap: wrap; }
  .demo-label { margin-inline: 0; }
  .section-top { flex-wrap: wrap; }
}
a.button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
button:disabled { cursor: wait; opacity: .65; }
.auth-card { max-width: 432px; margin: clamp(35px, 10vh, 100px) auto; padding: clamp(22px, 4vw, 36px); }
.auth-card h1 { font-size: 2rem; }
.auth-card > p { margin-top: 16px; }
.auth-card form { display: grid; gap: 16px; margin-top: 22px; }
.auth-card label { display: grid; gap: 7px; }
.auth-card input { width: 100%; padding: 12px; color: inherit; background: #151411; border: 1px solid var(--border); border-radius: 8px; }
.auth-card .button { min-height: 44px; }
#server-link { margin-top: 16px; }
#account-message:not(:empty), #auth-message:not(:empty) { margin-block: 16px; color: #ffd0ac; }
#account-name { max-width: 18ch; overflow: hidden; text-overflow: ellipsis; }
@media(max-width: 640px) {
  .topbar-inner, .account { flex-wrap: wrap; }
  .topbar-inner { padding-block: 12px; gap: 10px; }
}
