:root {
  --bg: #ffffff; --side: #f9f9f9; --soft: #f4f4f4; --hover: #ececec; --raised: #ffffff;
  --ink: #0d0d0d; --ink-2: #5d5d5d; --ink-3: #737373;
  --line: rgba(0, 0, 0, .1); --line-soft: rgba(0, 0, 0, .06);
  --primary: #0d0d0d; --primary-ink: #ffffff; --primary-hover: #2f2f2f;
  --good: #0a7d60; --good-soft: rgba(16, 163, 127, .12); --bad: #c62a1f; --bad-soft: rgba(217, 45, 32, .09); --warn: #9a6200; --warn-soft: rgba(202, 138, 4, .13);
  --meter-ok: #10a37f; --meter-low: #d98a04; --meter-critical: #d92d20;
  --chart-1: #10a37f; --chart-2: #6366f1; --chart-grid: rgba(0, 0, 0, .07);
  --code-kw: #a626a4; --code-str: #1a7f5a; --code-num: #b35900; --code-com: #8a8a8a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 28px rgba(0, 0, 0, .1);
  --shadow-soft: 0 1px 3px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .05);
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", "Helvetica Neue", "Noto Sans Thai", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #212121; --side: #171717; --soft: #2f2f2f; --hover: #3a3a3a; --raised: #2a2a2a;
    --ink: #ececec; --ink-2: #b4b4b4; --ink-3: #9b9b9b;
    --line: rgba(255, 255, 255, .12); --line-soft: rgba(255, 255, 255, .07);
    --primary: #ececec; --primary-ink: #0d0d0d; --primary-hover: #ffffff;
    --good: #4cd3a7; --good-soft: rgba(16, 163, 127, .18); --bad: #ff8a80; --bad-soft: rgba(255, 138, 128, .13); --warn: #e8b54d; --warn-soft: rgba(232, 181, 77, .14);
    --meter-ok: #12a67f; --meter-low: #e8a93a; --meter-critical: #ff6b5e;
    --chart-1: #12a67f; --chart-2: #7a84f0; --chart-grid: rgba(255, 255, 255, .08);
    --code-kw: #d19ad8; --code-str: #7fd1ae; --code-num: #e6b673; --code-com: #8f8f8f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 32px rgba(0, 0, 0, .4);
    --shadow-soft: 0 1px 3px rgba(0, 0, 0, .2), 0 4px 16px rgba(0, 0, 0, .2);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #212121; --side: #171717; --soft: #2f2f2f; --hover: #3a3a3a; --raised: #2a2a2a;
  --ink: #ececec; --ink-2: #b4b4b4; --ink-3: #9b9b9b;
  --line: rgba(255, 255, 255, .12); --line-soft: rgba(255, 255, 255, .07);
  --primary: #ececec; --primary-ink: #0d0d0d; --primary-hover: #ffffff;
  --good: #4cd3a7; --good-soft: rgba(16, 163, 127, .18); --bad: #ff8a80; --bad-soft: rgba(255, 138, 128, .13); --warn: #e8b54d; --warn-soft: rgba(232, 181, 77, .14);
  --meter-ok: #12a67f; --meter-low: #e8a93a; --meter-critical: #ff6b5e;
  --chart-1: #12a67f; --chart-2: #7a84f0; --chart-grid: rgba(255, 255, 255, .08);
  --code-kw: #d19ad8; --code-str: #7fd1ae; --code-num: #e6b673; --code-com: #8f8f8f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 32px rgba(0, 0, 0, .4);
  --shadow-soft: 0 1px 3px rgba(0, 0, 0, .2), 0 4px 16px rgba(0, 0, 0, .2);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
[hidden] { display: none !important; }
h1, h2, h3, p, dl, dd, ol { margin: 0; }
h1 { font-size: 26px; line-height: 1.25; font-weight: 600; letter-spacing: -.015em; }
h2 { font-size: 16px; font-weight: 600; letter-spacing: -.005em; }
h3 { font-size: 14px; font-weight: 600; }
a { color: inherit; }
code, pre, kbd { font-family: var(--mono); font-size: 12.5px; }
kbd { padding: 1px 6px; border-radius: 6px; background: var(--soft); border: 1px solid var(--line-soft); color: var(--ink-2); font-size: 11.5px; white-space: nowrap; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; flex: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }
.faint { color: var(--ink-3); font-size: 12.5px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.wrap { flex-wrap: wrap; }
.stack { display: grid; gap: 8px; }
.truncate { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.icon-btn.mobile-only { display: none; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--primary); color: var(--primary-ink); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }

/* Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; font-weight: 500; font-size: 13.5px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, opacity .12s; }
.btn:hover { background: var(--soft); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn[aria-busy="true"] { opacity: .6; cursor: progress; }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-danger-solid { background: var(--meter-critical); color: #fff; border-color: transparent; }
.btn-danger-solid:hover { opacity: .9; background: var(--meter-critical); }
.btn-wide { width: 100%; }
.btn-large { min-height: 42px; font-size: 14px; }
.btn-small { min-height: 30px; padding: 0 11px; font-size: 12.5px; }
.text-btn { border: 0; background: none; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; color: inherit; font-size: inherit; }
.faint-btn { color: var(--ink-3); font-size: 12px; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); cursor: pointer; transition: background .12s, color .12s; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.is-spinning svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.field { display: grid; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > span:first-child { font-size: 13px; font-weight: 500; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], input:not([type]), textarea, select {
  width: 100%; min-height: 38px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: transparent; outline: none; transition: border-color .12s;
}
input:focus, textarea:focus, select:focus { border-color: var(--ink-3); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; box-shadow: 0 0 0 1px var(--ink-3); }
input[readonly] { color: var(--ink-2); background: var(--soft); }
select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 16px) 55%, calc(100% - 12px) 55%; background-size: 4px 4px; background-repeat: no-repeat; }
select option, select optgroup { background: var(--raised); color: var(--ink); }
textarea { resize: vertical; display: block; }
.input-with-button { position: relative; display: block; }
.input-with-button input { padding-right: 44px; }
.input-with-button .icon-btn { position: absolute; right: 3px; top: 2px; }
.form-error { color: var(--bad); background: var(--bad-soft); padding: 8px 12px; border-radius: 10px; margin-bottom: 14px; font-size: 13px; }
.hint { color: var(--ink-3); font-size: 12.5px; margin: -6px 0 14px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input, .pick-list input { width: 16px; height: 16px; accent-color: var(--chart-1); flex: none; }
.form-gap { margin: 4px 0 14px; }
.form-details { margin-bottom: 14px; }
.form-details summary { cursor: pointer; color: var(--ink-2); font-size: 13px; }
.details-body { margin-top: 10px; }
.switch { position: relative; display: inline-block; width: 34px; height: 20px; flex: none; cursor: pointer; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--hover); transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s; }
.switch input:checked + span { background: var(--chart-1); }
.switch input:checked + span::after { transform: translateX(14px); }
.switch input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 4px 12px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; white-space: nowrap; transition: background .12s; }
.chip:hover { background: var(--soft); }
.chip[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.segmented { display: inline-flex; padding: 2px; border-radius: 10px; background: var(--soft); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented button { border: 0; background: transparent; border-radius: 8px; padding: 4px 11px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.segmented button[aria-pressed="true"] { background: var(--raised); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

/* Sign-in */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(360px, 100%); }
.login-card h1 { margin: 16px 0 4px; }
.login-card > .muted { margin-bottom: 24px; }
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.mark { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-weight: 700; font-size: 15px; line-height: 1; padding-bottom: 2px; flex: none; }
.mark-large { width: 40px; height: 40px; font-size: 22px; }

/* Shell */
.app { display: flex; height: 100dvh; overflow: hidden; }
.sidebar { width: 260px; flex: none; display: flex; flex-direction: column; background: var(--side); padding: 8px; gap: 1px; overflow: hidden; transition: margin-left .18s ease; }
body.sidebar-hidden .sidebar { margin-left: -260px; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 8px 8px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 15px; text-decoration: none; }
.side-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; text-decoration: none; color: var(--ink); cursor: pointer; font-size: 14px; text-align: left; }
.side-item:hover { background: var(--hover); }
.side-item[aria-current="page"] { background: var(--hover); font-weight: 500; }
.side-item svg { width: 17px; height: 17px; color: var(--ink-2); }
.side-item kbd { background: transparent; border-color: transparent; color: var(--ink-3); }
#nav { display: grid; gap: 1px; margin-top: 10px; }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; margin: 12px -2px 6px; padding: 0 2px; scrollbar-width: thin; }
.side-label { padding: 10px 10px 4px; color: var(--ink-3); font-size: 12px; font-weight: 500; }
.chat-item { position: relative; display: flex; align-items: center; border-radius: 9px; }
.chat-item:hover, .chat-item.is-current { background: var(--hover); }
.chat-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 6px 10px; text-decoration: none; font-size: 13.5px; }
.chat-more { position: absolute; right: 2px; width: 28px; height: 28px; opacity: 0; background: var(--hover); }
.chat-item:hover .chat-more, .chat-item.is-current .chat-more, .chat-more:focus-visible, .chat-more[aria-expanded="true"] { opacity: 1; }
.side-foot { margin-top: auto; padding-top: 6px; display: grid; gap: 4px; }
.quota-widget { display: grid; gap: 5px; padding: 10px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line-soft); text-decoration: none; font-size: 12.5px; transition: border-color .12s; }
.quota-widget:hover { border-color: var(--line); }
.quota-widget.is-cta { gap: 1px; }
.quota-widget.is-cta strong { font-weight: 500; }
.account { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 8px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; text-align: left; }
.account:hover, .account[aria-expanded="true"] { background: var(--hover); }
.avatar { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--chart-1); color: #fff; font-weight: 600; font-size: 12.5px; }
.account-text { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.account-text strong { font-size: 13px; font-weight: 500; }
.account-text span { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
#content { flex: 1; min-height: 0; overflow-y: auto; outline: none; display: flex; flex-direction: column; }
.mobile-bar { display: none; align-items: center; justify-content: space-between; height: 48px; padding: 0 6px; flex: none; border-bottom: 1px solid var(--line-soft); }
.open-sidebar { display: none; }
body.sidebar-hidden .open-sidebar { display: inline-grid; }
body.sidebar-hidden:not([data-page="chat"]) .page { padding-top: 56px; }
body.sidebar-hidden:not([data-page="chat"]) .mobile-bar { display: flex; position: absolute; z-index: 5; border: 0; width: auto; height: auto; padding: 8px; background: transparent; }
body.sidebar-hidden:not([data-page="chat"]) .mobile-bar strong, body.sidebar-hidden:not([data-page="chat"]) #mobile-new { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 20; }
.page { width: 100%; max-width: 1040px; margin: 0 auto; padding: 36px 32px 72px; animation: rise .16s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { color: var(--ink-2); margin-top: 3px; }
.section { margin-top: 32px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head p { color: var(--ink-2); font-size: 13px; margin-top: 1px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar > input { flex: 1 1 220px; width: auto; }
.toolbar > select { flex: 0 1 190px; width: auto; }

/* Status and shared pieces */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; background: var(--soft); color: var(--ink-2); font-size: 12px; white-space: nowrap; }
.tag svg { width: 12px; height: 12px; }
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.card { border: 1px solid var(--line); border-radius: 16px; padding: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-title { margin-bottom: 12px; }
.glyph { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 10px; background: var(--soft); font-weight: 600; font-size: 13px; color: var(--ink-2); }
.notice { display: flex; gap: 10px; padding: 11px 13px; border-radius: 12px; background: var(--soft); color: var(--ink-2); font-size: 13px; }
.notice svg { width: 16px; height: 16px; margin-top: 2px; }
.notice strong { color: var(--ink); font-weight: 500; }
.list { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 58px; }
.list-row + .list-row { border-top: 1px solid var(--line-soft); }
.list-row .grow > strong { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.list-row .grow > span { display: block; color: var(--ink-2); font-size: 13px; overflow-wrap: anywhere; }
.list-row .grow > span.faint { color: var(--ink-3); font-size: 12px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: 12px; padding: 9px 14px; white-space: nowrap; border-bottom: 1px solid var(--line); }
td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td code { color: var(--ink-2); }
tr.is-clickable { cursor: pointer; }
tr.is-clickable:hover td { background: var(--soft); }
.empty { padding: 44px 16px; text-align: center; color: var(--ink-2); }
.empty h3 { color: var(--ink); margin-bottom: 4px; font-size: 15px; }
.empty .btn { margin-top: 14px; }
.empty-inline { padding: 18px; border: 1px dashed var(--line); border-radius: 14px; color: var(--ink-2); font-size: 13px; }
.skeletons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.skeleton { height: 150px; border-radius: 16px; background: linear-gradient(90deg, var(--soft) 25%, var(--hover) 50%, var(--soft) 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Meters */
.meter { position: relative; height: 6px; border-radius: 3px; background: var(--hover); }
.meter-fill { height: 100%; border-radius: 3px; background: var(--meter-ok); transition: width .3s ease; }
.meter-fill.is-low { background: var(--meter-low); }
.meter-fill.is-critical { background: var(--meter-critical); }
.meter-pace { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink); box-shadow: 0 0 0 1.5px var(--bg); }
.plan-card { padding: 20px; }
.plan-meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px 32px; }
.plan-meter { display: grid; gap: 7px; min-width: 0; }
.plan-meter-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink-2); font-size: 13px; min-height: 22px; }
.hero-number { display: flex; align-items: baseline; gap: 7px; }
.hero-number strong { font-size: 44px; line-height: 1.05; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.hero-number span { color: var(--ink-2); font-size: 15px; }
.plan-meter-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; margin-top: 2px; }
.pace-note { color: var(--ink-3); font-size: 12.5px; }
.pace-note.is-warn { color: var(--warn); }
.spark { height: 36px; margin-top: 4px; }
.spark svg { width: 100%; }
.line-1.is-thin { stroke-width: 1.5; }
.plan-body.has-details { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px 32px; align-items: start; }
.plan-details { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px 14px; padding: 12px 14px; border-radius: 12px; background: var(--soft); font-size: 13px; }
.plan-details dt { color: var(--ink-2); }
.plan-details dd { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.plan-card > .notice { margin-top: 12px; }
.plan-caption { margin-top: 12px; }
.cta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cta.is-quiet { padding: 12px 16px; background: var(--side); border-color: var(--line-soft); }
.stack-large { display: grid; gap: 16px; }
.stack-large:empty { display: none; }
.provider-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; margin-top: 16px; }
.provider-card .card-head { margin-bottom: 10px; }
.rate-line { display: grid; gap: 5px; }
.rate-line + .rate-line { margin-top: 12px; }
.rate-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13px; min-width: 0; }
.rate-head strong { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rate-foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.budget-row .rate-head { margin-bottom: 7px; }
.budget-row .rate-foot { margin-top: 6px; }
.budget-row .grow > .rate-foot > span { display: inline; }
.key-limit { display: grid; gap: 4px; min-width: 90px; }
.dialog-meters { display: grid; gap: 12px; margin-bottom: 14px; }

/* Usage */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--line-soft); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.stat { padding: 14px 16px; min-width: 0; background: var(--bg); }
.stat span { display: block; color: var(--ink-2); font-size: 12.5px; }
.stat strong { display: block; font-size: 22px; font-weight: 600; letter-spacing: -.02em; line-height: 1.4; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat small { display: block; color: var(--ink-3); font-size: 12px; }
.periods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 16px; padding: 0 16px; }
.periods > div { display: grid; font-size: 13px; }
.periods strong { font-weight: 500; }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.chart-card { padding: 14px 16px 10px; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.chart-head h3 { font-weight: 500; }
.chart-head p { color: var(--ink-3); font-size: 12px; }
.chart-box { position: relative; width: 100%; }
.chart-box svg { width: 100%; overflow: visible; touch-action: pan-y; }
.chart-table { max-height: 200px; overflow: auto; }
.grid-line { stroke: var(--chart-grid); stroke-width: 1; shape-rendering: crispEdges; }
.axis-text { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.series-1 { fill: var(--chart-1); }
.series-2 { fill: var(--chart-2); }
.line-1 { fill: none; stroke: var(--chart-1); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.area-1 { fill: var(--chart-1); fill-opacity: .1; }
.end-dot { fill: var(--chart-1); stroke: var(--bg); stroke-width: 2; }
.crosshair { stroke: var(--ink-3); stroke-width: 1; shape-rendering: crispEdges; }
.bar-hit { fill: transparent; }
.bar-hit:hover { fill: var(--chart-grid); }
.legend { display: flex; gap: 14px; color: var(--ink-2); font-size: 12px; margin: 2px 0 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend .s1 { background: var(--chart-1); }
.legend .s2 { background: var(--chart-2); }
.chart-tip { position: fixed; z-index: 70; pointer-events: none; min-width: 120px; padding: 7px 10px; border-radius: 10px; background: var(--raised); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 12px; }
.chart-tip .when { color: var(--ink-3); margin-bottom: 3px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.chart-tip .tip-row b { font-weight: 600; }
.chart-tip .tip-row span { color: var(--ink-2); }
.chart-tip .key { width: 10px; height: 2px; border-radius: 1px; background: var(--chart-1); }
.chart-tip .key.s2 { background: var(--chart-2); }
.share { height: 3px; border-radius: 2px; background: var(--chart-1); min-width: 2px; margin-top: 4px; }

/* Providers and models */
.provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; }
.provider-tile { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 14px; background: transparent; cursor: pointer; text-align: left; transition: background .12s, border-color .12s; }
.provider-tile:hover { background: var(--soft); }
.provider-tile.is-primary { border-color: var(--ink-3); }
.provider-tile strong { display: block; font-weight: 500; }
.provider-tile small { display: block; color: var(--ink-2); font-size: 12.5px; line-height: 1.35; }
.provider-tile > svg { width: 16px; height: 16px; color: var(--ink-3); }
#claude-note { margin-top: 10px; }
.model-group + .model-group { margin-top: 24px; }
.group-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.group-head h2 { font-size: 13.5px; font-weight: 600; }
.model-row.is-off .grow > strong { color: var(--ink-3); }
.test-result { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.test-result.is-failed { color: var(--bad); }
.steps { padding-left: 20px; color: var(--ink-2); margin-bottom: 4px; }
.steps.wide { margin-bottom: 14px; display: grid; gap: 4px; }
.dialog-snippet { margin: 12px 0; }
.dialog-snippet pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.hint.plain { margin: 0 0 12px; }
.device-code { text-align: center; padding: 16px; margin: 10px 0 14px; border-radius: 14px; background: var(--soft); font: 600 28px/1.2 var(--mono); letter-spacing: .1em; overflow-wrap: anywhere; }
.pick-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; margin: 0 0 4px; }
.pick-list label { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; }
.pick-list label + label { border-top: 1px solid var(--line-soft); }
.pick-list label:hover { background: var(--soft); }
.pick-list span { overflow-wrap: anywhere; min-width: 0; }
.pick-list small { display: block; }
.load-more { display: flex; margin: 14px auto 0; }
.details { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 18px; font-size: 13px; margin-bottom: 14px; }
.details dt { color: var(--ink-2); }
.details dd { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

/* Connect apps and settings */
.copy-line { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.copy-line code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.base-url { margin-bottom: 18px; }
.app-tabs { margin-bottom: 10px; }
.app-note { margin-bottom: 12px; max-width: 72ch; }
.snippet { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--side); }
.snippet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 6px 14px; color: var(--ink-2); font-size: 12.5px; }
.snippet pre { margin: 0; padding: 2px 14px 14px; overflow-x: auto; line-height: 1.6; }
.settings-gap { margin-top: 12px; }
.settings-form .btn { margin-top: 2px; }
.tk-kw { color: var(--code-kw); }
.tk-str { color: var(--code-str); }
.tk-num { color: var(--code-num); }
.tk-com { color: var(--code-com); }

/* Chat */
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.chat.is-dropping::after { content: "Drop to attach"; position: absolute; inset: 8px; z-index: 6; display: grid; place-items: center; border: 2px dashed var(--ink-3); border-radius: 18px; background: var(--bg); font-size: 16px; color: var(--ink-2); pointer-events: none; }
.chat-top { display: flex; align-items: center; gap: 4px; padding: 8px 10px; flex: none; min-height: 52px; }
.model-button { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; max-width: min(320px, 60vw); padding: 0 8px 0 10px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; font-size: 16px; font-weight: 600; }
.model-button:hover, .model-button[aria-expanded="true"] { background: var(--soft); }
.model-button-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-button svg { width: 16px; height: 16px; color: var(--ink-3); }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.chat-column { width: 100%; max-width: 780px; margin: 0 auto; padding: 0 24px; }
.chat-log { padding-bottom: 12px; }
.chat.is-empty .chat-scroll { display: none; }
.chat.is-empty .chat-dock { margin: auto 0; padding-bottom: 14vh; }
.chat-greeting { text-align: center; margin-bottom: 22px; }
.chat-greeting h1 { font-size: 28px; font-weight: 500; }
.chat-greeting p { color: var(--ink-2); margin: 8px 0 16px; }
.msg-user { margin: 26px 0; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.bubble { max-width: 78%; padding: 9px 16px; border-radius: 20px; background: var(--soft); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.bubble img { display: block; max-width: 240px; max-height: 240px; border-radius: 12px; margin-bottom: 6px; }
.msg-user-actions { display: flex; opacity: 0; transition: opacity .12s; }
.msg-user:hover .msg-user-actions, .msg-user-actions:focus-within { opacity: 1; }
.msg-user-actions .icon-btn { width: 28px; height: 28px; }
.msg-user-actions .icon-btn svg { width: 15px; height: 15px; }
.edit-box { margin: 26px 0; padding: 10px; border-radius: 18px; background: var(--soft); }
.edit-box textarea { border: 0; font-size: 15px; resize: vertical; box-shadow: none; }
.edit-box .dialog-actions { margin-top: 6px; }
.msg-assistant { margin: 26px 0; font-size: 15px; line-height: 1.7; }
.msg-assistant.is-error .md { color: var(--bad); }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md pre, .md blockquote { margin: 0 0 14px; }
.md h1, .md h2, .md h3, .md h4 { margin: 22px 0 8px; font-weight: 600; line-height: 1.3; font-size: 16px; }
.md h1 { font-size: 21px; }
.md h2 { font-size: 18px; }
.md ul, .md ol { padding-left: 22px; }
.md li { margin: 4px 0; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.md blockquote { border-left: 3px solid var(--line); padding-left: 12px; color: var(--ink-2); }
.md a { text-decoration: underline; text-underline-offset: 2px; }
.md :not(pre) > code { background: var(--soft); padding: 1px 5px; border-radius: 5px; font-size: 13px; overflow-wrap: anywhere; }
.md .table-wrap { margin: 0 0 14px; }
.caret { display: inline-block; width: 9px; height: 9px; margin-left: 3px; border-radius: 50%; background: var(--ink); vertical-align: 1px; animation: pulse 1s ease-in-out infinite; }
.md > .caret { display: block; margin: 0; }
.code-block { border-radius: 12px; background: var(--side); border: 1px solid var(--line-soft); margin: 0 0 14px; overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 4px 12px; color: var(--ink-3); font-size: 12px; }
.code-head .icon-btn { width: 26px; height: 26px; }
.code-head .icon-btn svg { width: 14px; height: 14px; }
.code-block pre { margin: 0; padding: 0 14px 12px; overflow-x: auto; line-height: 1.55; }
.thinking { color: var(--ink-3); font-size: 13.5px; margin-bottom: 8px; line-height: 1.55; }
.thinking summary { cursor: pointer; }
.thinking > div { white-space: pre-wrap; margin-top: 6px; padding-left: 12px; border-left: 2px solid var(--line); }
.status-line { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 14px; }
.pulse { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); flex: none; animation: pulse 1.1s ease-in-out infinite; }
.pulse.is-small { width: 7px; height: 7px; }
@keyframes pulse { 50% { transform: scale(.65); opacity: .45; } }
.msg-meta { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; margin-top: 6px; color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.msg-meta .icon-btn { width: 28px; height: 28px; }
.msg-meta .icon-btn svg { width: 15px; height: 15px; }
.msg-facts { margin-left: 6px; }
.msg-json { margin-top: 8px; max-height: 340px; overflow: auto; padding: 12px; border-radius: 12px; background: var(--side); border: 1px solid var(--line-soft); line-height: 1.5; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.sources a { padding: 2px 10px; border-radius: 999px; background: var(--soft); font-size: 12.5px; text-decoration: none; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sources a:hover { background: var(--hover); }
.jump { position: absolute; left: 50%; bottom: 128px; transform: translateX(-50%); z-index: 4; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: var(--raised); color: var(--ink-2); box-shadow: var(--shadow-soft); cursor: pointer; }
.jump svg { width: 16px; height: 16px; }
.chat-dock { flex: none; padding: 0 0 max(10px, env(safe-area-inset-bottom)); }
.limit-notice { display: flex; align-items: center; gap: 8px; margin: 0 8px 8px; padding: 6px 12px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 12.5px; text-decoration: none; }
.limit-notice.is-critical { background: var(--bad-soft); color: var(--bad); }
.limit-notice svg { width: 14px; height: 14px; }
.composer { border: 1px solid var(--line); border-radius: 26px; background: var(--raised); box-shadow: var(--shadow-soft); padding: 10px 10px 8px; transition: border-color .12s; }
.composer:focus-within { border-color: var(--ink-3); }
.composer textarea { width: 100%; min-height: 28px; max-height: 260px; border: 0; padding: 2px 8px 6px; resize: none; background: transparent; font-size: 15px; line-height: 1.5; }
.composer textarea:focus, .composer textarea:focus-visible { outline: none; box-shadow: none; }
.composer-tools { display: flex; align-items: center; gap: 2px; min-width: 0; flex-wrap: wrap; }
.composer-tools .icon-btn { border-radius: 50%; }
.send { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border: 0; border-radius: 50%; background: var(--primary); color: var(--primary-ink); cursor: pointer; margin-left: auto; transition: opacity .12s; }
.send:disabled { opacity: .22; cursor: not-allowed; }
.send svg { width: 17px; height: 17px; }
.chip-toggle { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.chip-toggle:hover, .chip-toggle[aria-expanded="true"] { background: var(--soft); }
.chip-toggle[aria-pressed="true"] { background: var(--good-soft); color: var(--good); }
.chip-toggle svg { width: 15px; height: 15px; }
.attachments { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 4px 8px; }
.attachment { display: inline-flex; align-items: center; gap: 6px; padding: 3px 3px 3px 4px; border-radius: 10px; background: var(--soft); font-size: 12.5px; max-width: 210px; }
.attachment img { width: 28px; height: 28px; border-radius: 7px; object-fit: cover; }
.attachment > svg { width: 18px; height: 18px; margin-left: 4px; color: var(--ink-3); }
.attachment span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment .icon-btn { width: 22px; height: 22px; }
.attachment .icon-btn svg { width: 12px; height: 12px; }
.ideas { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.idea { border: 1px solid var(--line); border-radius: 999px; background: transparent; padding: 6px 13px; color: var(--ink-2); font-size: 13px; cursor: pointer; transition: background .12s; }
.idea:hover { background: var(--soft); }
.dock-note { text-align: center; color: var(--ink-3); font-size: 11.5px; padding-top: 8px; }

/* Popovers */
.popover { position: fixed; z-index: 45; min-width: 190px; max-width: calc(100vw - 16px); background: var(--raised); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; animation: pop .1s ease-out; }
@keyframes pop { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
.menu { padding: 5px; display: grid; gap: 1px; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 34px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); font-size: 13.5px; cursor: pointer; text-decoration: none; text-align: left; white-space: nowrap; }
.menu-item:hover, .menu-item:focus-visible { background: var(--soft); outline: none; }
.menu-item:disabled { opacity: .45; cursor: not-allowed; }
.menu-item svg { width: 16px; height: 16px; color: var(--ink-2); }
.menu-item.is-danger, .menu-item.is-danger svg { color: var(--bad); }
.menu-gap { width: 16px; flex: none; }
.menu-sep { height: 1px; background: var(--line-soft); margin: 4px 6px; }
.popover-search, .palette-input { border: 0 !important; border-bottom: 1px solid var(--line-soft) !important; border-radius: 0 !important; min-height: 44px !important; padding: 10px 14px !important; box-shadow: none !important; }
.picker-list { max-height: min(50vh, 400px); overflow-y: auto; padding: 5px; }
.picker-group { padding: 8px 10px 3px; color: var(--ink-3); font-size: 12px; font-weight: 500; }
.picker-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 10px; min-height: 36px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; text-align: left; }
.picker-row:hover, .picker-row:focus-visible { background: var(--soft); outline: none; }
.picker-row:disabled { opacity: .45; cursor: not-allowed; }
.picker-row strong { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-row small { display: block; color: var(--ink-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-row > svg { width: 16px; height: 16px; color: var(--ink-2); }
.picker-none { padding: 18px 12px; text-align: center; }
.picker-foot { display: block; padding: 9px 15px; border-top: 1px solid var(--line-soft); color: var(--ink-2); font-size: 12.5px; text-decoration: none; }
.picker-foot:hover { background: var(--soft); }
.popover-form { padding: 14px; }
.popover-form .hint { margin-bottom: 0; }

/* Dialogs */
.dialog { width: min(520px, calc(100vw - 32px)); max-height: min(86dvh, 780px); padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--raised); color: var(--ink); box-shadow: var(--shadow); }
.dialog[open] { animation: pop .12s ease-out; }
.dialog::backdrop, .palette::backdrop { background: rgba(0, 0, 0, .45); }
.dialog.is-drawer { margin: 0 0 0 auto; width: min(420px, 100vw); height: 100dvh; max-height: 100dvh; border-radius: 18px 0 0 18px; border-width: 0 0 0 1px; }
.dialog-inner { padding: 20px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.dialog-head h2 { font-size: 18px; }
.dialog-head p { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.palette { width: min(600px, calc(100vw - 24px)); margin: 12vh auto auto; padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--raised); color: var(--ink); box-shadow: var(--shadow); overflow: hidden; }
.palette-list { max-height: 54vh; overflow-y: auto; padding: 5px; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 8px; width: max-content; max-width: min(540px, calc(100vw - 32px)); padding: 9px 16px; border-radius: 12px; background: var(--primary); color: var(--primary-ink); font-size: 13.5px; box-shadow: var(--shadow); animation: rise .14s ease-out; }
.toast svg { width: 16px; height: 16px; }
.toast.is-error { background: var(--meter-critical); color: #fff; }

@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .stat { grid-column: span 2; }
  .stat:nth-child(n + 4) { grid-column: span 3; }
  .plan-body.has-details { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  /* Below 16px, iOS zooms the whole page when a field takes focus. */
  input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], input:not([type]), textarea, select, .composer textarea { font-size: 16px; }
  .icon-btn { width: 40px; height: 40px; }
  .side-item { min-height: 42px; }
  .btn { min-height: 40px; }
  .btn-small { min-height: 36px; padding: 0 13px; }
  .chip { padding: 7px 14px; }
  .segmented button { padding: 7px 12px; }
  .send { width: 38px; height: 38px; }
  .chip-toggle { min-height: 38px; }
  .picker-row, .menu-item { min-height: 44px; }
  .chat-link { padding: 10px; }
  .msg-meta .icon-btn, .msg-user-actions .icon-btn { width: 36px; height: 36px; }
  .sidebar { padding-bottom: max(8px, env(safe-area-inset-bottom)); position: fixed; inset: 0 auto 0 0; z-index: 30; margin-left: 0 !important; transform: translateX(-100%); transition: transform .18s ease; width: min(290px, 86vw); }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .mobile-bar { display: flex; position: static !important; width: auto; height: 48px !important; padding: 0 6px !important; border-bottom: 1px solid var(--line-soft) !important; }
  .mobile-bar strong { display: block !important; }
  #mobile-new { display: inline-grid !important; }
  .open-sidebar { display: inline-grid; }
  body[data-page="chat"] .mobile-bar { display: none; }
  body.sidebar-hidden:not([data-page="chat"]) .page { padding-top: 20px; }
  .icon-btn.mobile-only { display: inline-grid; }
  .page { padding: 20px 16px 48px; }
  h1 { font-size: 23px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat, .stat:nth-child(n + 4) { grid-column: auto; }
  .stat:last-child { grid-column: 1 / -1; }
  .periods { padding: 0 4px; gap: 10px; }
  .charts, .skeletons { grid-template-columns: minmax(0, 1fr); }
  .chat-column { padding: 0 12px; }
  .chat-top { padding: 6px; }
  .bubble { max-width: 88%; }
  .msg-user-actions { opacity: 1; }
  .chat-greeting h1 { font-size: 24px; }
  .chat.is-empty .chat-dock { padding-bottom: 6vh; }
  .jump { bottom: 118px; }
  .list-row { flex-wrap: wrap; padding: 12px; }
  .list-row .grow { flex-basis: calc(100% - 50px); }
  .row-end { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
  .budget-row .grow { flex-basis: 100%; }
  .hero-number strong { font-size: 38px; }
  .plan-meters { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .plan-body.has-details { grid-template-columns: minmax(0, 1fr); }
  .field-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .details-body.field-row { gap: 8px; }
  .toolbar > select { flex: 1 1 140px; }
  .popover { left: 8px !important; right: 8px; top: auto !important; bottom: 8px; width: auto !important; max-width: none; }
  .picker-list { max-height: 60vh; }
  .chat-more { opacity: 1; background: transparent; }
  .dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0; border-width: 1px 0 0; max-height: 90dvh; padding-bottom: env(safe-area-inset-bottom); }
  .dialog.is-drawer { border-radius: 18px 18px 0 0; width: 100vw; max-width: 100vw; height: auto; margin: auto 0 0; max-height: 85dvh; border-width: 1px 0 0; }
  .palette { margin-top: 8vh; }
}
@media (max-width: 600px) {
  .hide-small { display: none; }
  td, th { padding-left: 10px; padding-right: 10px; }
  .periods { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .periods > div { grid-template-columns: 90px minmax(0, 1fr) auto; align-items: baseline; gap: 8px; }
  .test-result { max-width: 150px; }
  .chat-column { padding: 0 8px; }
  .composer { border-radius: 22px; }
  .chat-greeting h1 { font-size: 22px; }
  .hero-number strong { font-size: 36px; }
}
@media (max-width: 360px) {
  .segmented button { padding: 7px 8px; }
  .chip-toggle { padding: 0 7px; }
  .composer-tools .icon-btn { width: 34px; height: 34px; }
  .composer { padding-left: 6px; padding-right: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
@media (forced-colors: active) {
  .series-1, .series-2, .meter-fill { fill: CanvasText; background: CanvasText; }
  .line-1 { stroke: CanvasText; }
}

/* Request workbench and scoped analytics share the app's existing type and color tokens. */
body[data-page="playground"] .page, body[data-page="usage"] .page { max-width: 1240px; }
.play-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; align-items: start; }
.play-controls, .play-response { padding: 22px; }
.play-controls .card-head, .play-response .card-head { justify-content: space-between; }
.play-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
.play-fields:disabled { opacity: .6; }
.play-fields .play-fields:disabled { opacity: .65; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.play-controls textarea { width: 100%; resize: vertical; min-height: 80px; }
#play-prompt { min-height: 180px; line-height: 1.65; }
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; margin: -3px 0 18px; }
.preset-row .btn { font-size: 12px; }
.play-options, .request-preview { border-top: 1px solid var(--line-soft); padding-top: 12px; margin: 14px 0; }
summary { cursor: pointer; }
.play-options summary, .request-preview summary, .period-details summary { font-size: 13px; color: var(--ink-2); padding: 4px 0; }
.play-options[open] summary, .request-preview[open] summary { margin-bottom: 12px; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 10px 0; }
.check-line input { width: 16px; height: 16px; accent-color: var(--meter-ok); }
.request-preview pre, .play-raw, .code-editor { font: 12px/1.65 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.request-preview pre { max-height: 340px; overflow: auto; background: var(--side); border-radius: 10px; padding: 14px; margin: 10px 0; }
.code-editor { background: var(--side); tab-size: 2; }
.play-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.play-actions .btn { min-width: 135px; }
.play-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 20px; padding: 14px 0; border-block: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.play-metrics > div { display: grid; gap: 4px; min-width: 0; }
.play-metrics span { font-size: 11.5px; color: var(--ink-2); }
.play-metrics strong { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.play-output { min-height: 310px; max-height: 600px; overflow: auto; padding: 20px 0; overflow-wrap: anywhere; }
.play-output .empty { padding-block: 70px; }
.play-output .markdown { font-size: 14px; }
.play-output .notice { margin-bottom: 16px; }
.play-thinking { margin-top: 18px; color: var(--ink-2); }
.play-thinking pre { white-space: pre-wrap; font-family: var(--sans); }
.play-result-foot { border-top: 1px solid var(--line-soft); padding-top: 14px; display: flex; align-items: center; gap: 12px; }
.play-result-foot .btn { flex-shrink: 0; }
.play-privacy { margin-top: 16px; max-width: 900px; }
#play-history { max-width: 300px; }
.usage-filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) auto; align-items: end; gap: 10px; margin-bottom: 10px; }
.usage-filters .field { margin: 0; }
.usage-filters select { width: 100%; text-overflow: ellipsis; }
.usage-filters .btn { min-height: 38px; }
#usage-freshness { margin-bottom: 16px; }
.usage-health { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 14px 2px 0; font-size: 12.5px; color: var(--ink-2); }
.usage-health strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.latency-card { margin-top: 16px; }
.latency-bands { display: grid; gap: 10px; margin-top: 18px; }
.latency-band { display: grid; grid-template-columns: 78px minmax(0, 1fr) 40px; gap: 12px; align-items: center; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.latency-band strong { text-align: right; font-weight: 500; }
.latency-track { height: 8px; background: var(--soft); border-radius: 3px; overflow: hidden; }
.latency-bar { display: block; height: 100%; background: var(--chart-1); border-radius: 3px; }
.status-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 20px; }
.breakdown-table { min-width: 850px; }
.breakdown-name { max-width: 230px; overflow-wrap: anywhere; text-align: left; }
.period-details { margin: 24px 0 16px; border-block: 1px solid var(--line-soft); padding: 12px 0; }
.period-details .periods { margin-bottom: 16px; }
#quota-area { margin-top: 22px; }
.chart-box svg { width: 100%; overflow: visible; }
@media (max-width: 1100px) {
  .usage-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .play-layout { grid-template-columns: minmax(0, 1fr); }
  .play-output { min-height: 220px; }
}
@media (max-width: 600px) {
  .play-controls, .play-response { padding: 16px; }
  .play-layout { gap: 14px; }
  .usage-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .play-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .play-result-foot { align-items: flex-start; flex-direction: column; }
  #play-history { width: 100%; max-width: 100%; }
  .play-actions .btn { min-height: 44px; }
  .usage-filters select, .play-controls input, .play-controls textarea, .play-controls select { font-size: 16px; }
  .status-chips .btn, .preset-row .btn, .segmented button { min-height: 36px; }
  .periods { grid-template-columns: 1fr; gap: 12px; }
  .breakdown-table .text-btn { min-height: 36px; }
  .page { padding-bottom: max(40px, env(safe-area-inset-bottom)); }
}
